query
stringlengths
7
33.1k
document
stringlengths
7
335k
metadata
dict
negatives
listlengths
3
101
negative_scores
listlengths
3
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
The Interface Identifiable. Implement this interface to permit comparison of objects in testing code.
public interface Identifiable { /** * Generate a String that uniquely identifies this object. This String can * be created from class data/state, and will be used to determine compare * with other objects of the same type to determine equivalence. * * @return the String identifying the state of the object to compare */ public String id(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\t\tpublic boolean implementEquals(Object obj) {\n\t\t\treturn false;\r\n\t\t}", "@Test\n public void testEqualsObject() {\n \n BSPJobID jobId1 = new BSPJobID(jtIdentifier, 2);\n System.out.println(jobId.equals(jobId1));\n assertEquals(false, jobId.equals(jobId1));\n }", "public static void main(String[] args) {\n Student student1 = new Student(10000, 20000, \"Sang\", \"Shin\", \"Good School\");\r\n \r\n // You can assign the object instance to\r\n // StudentInterface type.\r\n StudentInterface studentinterface1 = student1;\r\n \r\n // Display data from student1 and studentinterface1.\r\n // Observe that they refer to the same object instance.\r\n System.out.println(\"student1.getName() = \" + student1.getName() + \",\" +\r\n \" student1.computeTotalWealth() = \" + student1.computeTotalWealth()+ \",\" +\r\n \" student1.findSchool() = \" + student1.findSchool());\r\n \r\n System.out.println(\"studentinterface1.getName() = \" + studentinterface1.getName() + \",\" +\r\n \" studentinterface1.computeTotalWealth() = \" + studentinterface1.computeTotalWealth()+ \",\" +\r\n \" studentinterface1.findSchool() = \" + studentinterface1.findSchool());\r\n \r\n // Check of object instance that is referred by student1 and\r\n // studentinterface1 is the same object instance.\r\n boolean b1 = (student1 == studentinterface1);\r\n System.out.println(\"Do student1 and studentinterface1 point to the same object instance? \" + b1);\r\n \r\n }", "public interface IUniqueObject {\n\t/**\n\t * Get the unique ID of the object\n\t * \n\t * @return unique ID\n\t */\n\tpublic int getID();\n}", "@Override public boolean equals(Object object);", "@Override\n public abstract boolean equals(Object obj);", "public interface IdentifiableObject {\n\n\n public String getSubtitle();\n\n public String getTitle();\n\n public int getIdentifier();\n\n public int getRecourseId();\n}", "public interface Identifiable {\n\tObject getID();\n\tString getIDText();\n\tString getInfoText();\n}", "@Override\n public boolean equals(Object object) {\n if (!(object instanceof NetworkInterface)) {\n return false;\n }\n NetworkInterface other = (NetworkInterface) object;\n if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {\n return false;\n }\n return true;\n }", "@Test\r\n\tpublic void testEquality(){\n\t\t assertEquals(object1, object2);\r\n\t}", "@Override\n boolean equals(Object obj);", "@Override \n boolean equals(Object obj);", "public interface Entity extends Serializable { \n\n public abstract boolean equals(Object other);\n public abstract int hashCode();\n\n}", "@Override\n public abstract boolean equals(Object other);", "@Override\n public abstract boolean equals(Object other);", "@Override\n boolean equals(Object other);", "@Override\n public boolean equals(Object obj) {\n return this == obj;\n }", "@Override\n boolean equals(Object o);", "@Override\n\tpublic abstract boolean equals(Object other);", "private IdentifiableComparator() {\n\t\t// This class is not intended to create own objects from it.\n\t}", "@Override\n public abstract boolean equals(Object abc);", "public interface SerializableAssert {\n\n /**\n * Compares deserialized and reference objects.\n *\n * @param initial - initial object used for creating serialized form\n * @param deserialized - deserialized object\n */\n void assertDeserialized(Serializable initial, Serializable deserialized);\n }", "@Override\n\tpublic boolean equals(Object o) {\n\t\tif (this == o) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Return false if the other object has the wrong type.\n\t\t// This type may be an interface depending on the interface's\n\t\t// specification.\n\t\tif (!(o instanceof NewDoc)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Cast to the appropriate type.\n\t\t// This will succeed because of the instanceof, and lets us access\n\t\t// private fields.\n\t\tNewDoc lhs = (NewDoc) o;\n\n\t\t// Check each field. Primitive fields, reference fields, and nullable\n\t\t// reference\n\t\t// fields are all treated differently.\n\t\treturn id.equals(lhs.getId());\n\t}", "@Override\n public abstract boolean equals(final Object o);", "@Override\n public abstract boolean equals(final Object o);", "@Override\n public boolean equals(Object obj) {\n return this == obj;\n }", "public interface Object {\n\n /**\n * Checks whether this object is an instance of a class that\n * implements the given interface.\n *\n * @param repositoryIdentifier the interface to check against\n * @return <code>true</code> if this object reference is an instance of a class that implements\n * the interface; <code>false</code> otherwise\n */\n boolean _is_a(String repositoryIdentifier);\n\n\n /**\n * Determines whether the two object references are equivalent,\n * so far as the ORB can easily determine. Two object references are equivalent\n * if they are identical. Two distinct object references which in fact refer to\n * the same object are also equivalent. However, ORBs are not required\n * to attempt determination of whether two distinct object references\n * refer to the same object, since such determination could be impractically\n * expensive.\n *\n * @param other the other object reference with which to check for equivalence\n * @return <code>true</code> if this object reference is known to be equivalent to the given\n * object reference. Note that <code>false</code> indicates only that the two object references\n * are distinct, not necessarily that they reference distinct objects.\n */\n boolean _is_equivalent(org.omg.CORBA.Object other);\n\n\n /**\n * Determines whether the server object for this object reference has been\n * destroyed.\n *\n * @return <code>true</code> if the ORB knows authoritatively that the server object does not\n * exist; <code>false</code> otherwise\n */\n boolean _non_existent();\n\n\n /**\n * Returns an ORB-internal identifier for this object reference.\n * This is a hash identifier, which does\n * not change during the lifetime of the object reference, and so\n * neither will any hash function of that identifier change. The value returned\n * is not guaranteed to be unique; in other words, another object\n * reference may have the same hash value.\n * If two object references hash differently,\n * then they are distinct object references; however, both may still refer\n * to the same CORBA object.\n *\n * @param maximum the upper bound on the hash value returned by the ORB\n * @return the ORB-internal hash identifier for this object reference\n */\n int _hash(int maximum);\n\n\n /**\n * Returns a duplicate of this CORBA object reference.\n * The server object implementation is not involved in creating\n * the duplicate, and the implementation cannot distinguish whether\n * the original object reference or a duplicate was used to make a request.\n * <P>\n * Note that this method is not very useful in the Java platform,\n * since memory management is handled by the VM.\n * It is included for compliance with the CORBA APIs.\n * <P>\n * The method <code>_duplicate</code> may return this object reference itself.\n *\n * @return a duplicate of this object reference or this object reference itself\n */\n org.omg.CORBA.Object _duplicate();\n\n\n /**\n * Signals that the caller is done using this object reference, so\n * internal ORB resources associated with this object reference can be\n * released. Note that the object implementation is not involved in\n * this operation, and other references to the same object are not affected.\n */\n void _release();\n\n\n /**\n * Obtains an <code>InterfaceDef</code> for the object implementation\n * referenced by this object reference.\n * The <code>InterfaceDef</code> object\n * may be used to introspect on the methods, attributes, and other\n * type information for the object referred to by this object reference.\n *\n * @return the <code>InterfaceDef</code> object in the Interface Repository which provides type\n * information about the object referred to by this object reference\n */\n org.omg.CORBA.Object _get_interface_def();\n\n\n /**\n * Creates a <code>Request</code> instance for use in the\n * Dynamic Invocation Interface.\n *\n * @param operation the name of the method to be invoked using the <code>Request</code> instance\n * @return the newly-created <code>Request</code> instance\n */\n Request _request(String operation);\n\n\n /**\n * Creates a <code>Request</code> instance initialized with the\n * given context, method name, list of arguments, and container\n * for the method's return value.\n *\n * @param ctx a <code>Context</code> object containing a list of properties\n * @param operation the name of the method to be invoked\n * @param arg_list an <code>NVList</code> containing the actual arguments to the method being\n * invoked\n * @param result a <code>NamedValue</code> object to serve as a container for the method's return\n * value\n * @return the newly-created <code>Request</code> object\n * @see Request\n * @see NVList\n * @see NamedValue\n */\n\n Request _create_request(Context ctx,\n String operation,\n NVList arg_list,\n NamedValue result);\n\n /**\n * Creates a <code>Request</code> instance initialized with the\n * given context, method name, list of arguments, container\n * for the method's return value, list of possible exceptions,\n * and list of context strings needing to be resolved.\n *\n * @param ctx a <code>Context</code> object containing a list of properties\n * @param operation the name of the method to be invoked\n * @param arg_list an <code>NVList</code> containing the actual arguments to the method being\n * invoked\n * @param result a <code>NamedValue</code> object to serve as a container for the method's return\n * value\n * @param exclist an <code>ExceptionList</code> object containing a list of possible exceptions\n * the method can throw\n * @param ctxlist a <code>ContextList</code> object containing a list of context strings that need\n * to be resolved and sent with the <code>Request</code> instance\n * @return the newly-created <code>Request</code> object\n * @see Request\n * @see NVList\n * @see NamedValue\n * @see ExceptionList\n * @see ContextList\n */\n\n Request _create_request(Context ctx,\n String operation,\n NVList arg_list,\n NamedValue result,\n ExceptionList exclist,\n ContextList ctxlist);\n\n\n /**\n * Returns the <code>Policy</code> object of the specified type\n * which applies to this object.\n *\n * @param policy_type the type of policy to be obtained\n * @return A <code>Policy</code> object of the type specified by the policy_type parameter\n * @throws org.omg.CORBA.BAD_PARAM when the value of policy type is not valid either because the\n * specified type is not supported by this ORB or because a policy object of that type is not\n * associated with this Object\n */\n Policy _get_policy(int policy_type);\n\n\n /**\n * Retrieves the <code>DomainManagers</code> of this object.\n * This allows administration services (and applications) to retrieve the\n * domain managers, and hence the security and other policies applicable\n * to individual objects that are members of the domain.\n *\n * @return the list of immediately enclosing domain managers of this object. At least one domain\n * manager is always returned in the list since by default each object is associated with at least\n * one domain manager at creation.\n */\n DomainManager[] _get_domain_managers();\n\n\n /**\n * Returns a new <code>Object</code> with the given policies\n * either replacing any existing policies in this\n * <code>Object</code> or with the given policies added\n * to the existing ones, depending on the value of the\n * given <code>SetOverrideType</code> object.\n *\n * @param policies an array of <code>Policy</code> objects containing the policies to be added or\n * to be used as replacements\n * @param set_add either <code>SetOverrideType.SET_OVERRIDE</code>, indicating that the given\n * policies will replace any existing ones, or <code>SetOverrideType.ADD_OVERRIDE</code>,\n * indicating that the given policies should be added to any existing ones\n * @return a new <code>Object</code> with the given policies replacing or added to those in this\n * <code>Object</code>\n */\n org.omg.CORBA.Object _set_policy_override(Policy[] policies,\n SetOverrideType set_add);\n\n\n}", "@Override\n public boolean equals(Object obj){\n boolean isEqual = false;\n if (this.getClass() == obj.getClass())\n {\n ItemID itemID = (ItemID) obj;\n if (itemID.id.equals(this.id))\n isEqual = true;\n }\n \n return isEqual;\n }", "@Override\n public boolean equals(Object o) {\n return this == o;\n }", "public abstract boolean equals(Object other);", "@Override\n public boolean equals(final Object obj) {\n if ( this == obj )\n return true;\n\n if (obj instanceof Interface) {\n\n Interface temp = (Interface)obj;\n if (this._address != null) {\n if (temp._address == null) return false;\n else if (!(this._address.equals(temp._address))) \n return false;\n }\n else if (temp._address != null)\n return false;\n return true;\n }\n return false;\n }", "@Test\r\n public void testEquals() {\r\n System.out.println(\"equals\");\r\n Object object = null;\r\n Integrante instance = new Integrante();\r\n boolean expResult = false;\r\n boolean result = instance.equals(object);\r\n assertEquals(expResult, result);\r\n // TODO review the generated test code and remove the default call to fail.\r\n fail(\"The test case is a prototype.\");\r\n }", "public abstract boolean equals(Object o);", "@Override\n public boolean equals(Object other) {\n return this == other;\n }", "@Override\n public boolean equals(Object obj) {\n return super.equals(obj);\n }", "@Override\n\tpublic boolean equals(TestObject obj) {\n\t\treturn false;\n\t}", "@Test\n @DisplayName(\"Test should detect equality between equal states.\")\n public void testShouldResultInEquality() {\n ObjectBag os1 = new ObjectBag(null, \"Hi\");\n ObjectBag os2 = new ObjectBag(null, \"Hi\");\n\n Assertions.assertThat(os1).isEqualTo(os2);\n }", "public interface ValueObject<T> {\n\n /**\n * TODO BTF this is stupid. Use {@link #equals(Object)}.\n * \n * Value objects compare by the values of their attributes, they don't have an identity.\n *\n * @param other The other value object.\n * @return <code>true</code> if the given value object's and this value object's attributes are the same.\n */\n boolean sameValueAs(T other);\n\n}", "public void testEqualsObject()\n {\n Mana meme = new Mana( myMise );\n Assert.assertEquals( myMise, meme );\n \n System.out.println( myMise.toString());\n Mana autre = new Mana( 49 );\n Assert.assertFalse( myMise.equals( autre ));\n autre = new Mana( 50 );\n Assert.assertTrue( myMise.equals( autre ));\n }", "@Override\n public boolean equals(final Object obj) {\n return getClass().isInstance(obj);\n }", "public interface Identifiable {\n\n\t/**\n\t * Adds an ID from a root string and an extension string.\n\t *\n\t * @param root A String value, formatted as either an OID or a UUID.\n\t * @param extension A String value\n\t */\n\tvoid addId(String root, String extension);\n\n\t/**\n\t * Adds an ID from a root string.\n\t *\n\t * @param root A String value, formatted as either an OID or a UUID.\n\t */\n\tvoid addId(String root);\n\n\t/**\n\t * Adds an existing everest II identifier object to the set of\n\t * identifiers.\n\t *\n\t * @param identifier The II object to add.\n\t */\n\tvoid addId(II identifier);\n\n\t/**\n\t * Gets a set of identifiers that have been added.\n\t *\n\t * @return A set of II objects.\n\t */\n\tSet<II> getIds();\n}", "@Override\n public boolean equals(Object other) {\n return super.equals(other);\n }", "@Override\r\n public boolean equals(Object obj) {\r\n return super.equals(obj);\r\n }", "public interface Identifiable extends Serializable {\n\n\t/**\n\t * Returns the id.\n\t * \n\t * @return id\n\t */\n\tpublic Long getId();\n\n\t/**\n\t * Sets the id.\n\t * \n\t * @param id\n\t * the id to set.\n\t */\n\tpublic void setId(Long id);\n}", "public interface CompareInterface<R> extends Serializable, Comparator<R> {\n int compare(R r1, R r2);\n}", "private static interface WithObjectOverrides {\n\n public boolean equals(Object obj);\n\n public int hashCode();\n\n public String toString();\n }", "public interface Identifiable<T> {\n \n public T getId();\n public void setId(T id);\n \n public String getName();\n public void setName(String name);\n \n}", "@Override\n protected boolean doEquals(Object obj) {\n if (obj instanceof BsUserInfo) {\n BsUserInfo other = (BsUserInfo)obj;\n if (!xSV(_id, other._id)) { return false; }\n return true;\n } else {\n return false;\n }\n }", "@Override\n public boolean equals(Object obj) {\n return super.equals(obj);\n }", "@Override\n public boolean equals(Object object) {\n if (!(object instanceof Test)) {\n return false;\n }\n Test other = (Test) object;\n if ((this.idtest == null && other.idtest != null) || (this.idtest != null && !this.idtest.equals(other.idtest))) {\n return false;\n }\n return true;\n }", "interface ID extends Serializable {\n\n }", "@Override\n public boolean equals(Object o) {\n return true;\n }", "public void equals() {\r\n // todo Implement this java.lang.Object method\r\n throw new UnsupportedOperationException(\"Method equals() not yet implemented.\");\r\n }", "@Override\n public boolean equals(final Object obj) {\n return super.equals(obj);\n }", "@Override\r\n\tpublic boolean equals(Object obj) {\n\t\treturn super.equals(obj);\r\n\t}", "@Override\r\n\tpublic boolean equals(Object obj) {\n\t\treturn super.equals(obj);\r\n\t}", "@Override\r\n\tpublic boolean equals(Object obj) {\n\t\treturn super.equals(obj);\r\n\t}", "public void testEqualsObject() {\n\t\t\tTipoNodoLeisure tipo1 = new TipoNodoLeisure(Messages.getString(\"TipoNodoLeisureTest.0\")); //$NON-NLS-1$\n\t\t\tTipoNodoLeisure tipo2= new TipoNodoLeisure(Messages.getString(\"TipoNodoLeisureTest.1\")); //$NON-NLS-1$\n\t\t\tTipoNodoLeisure tipo3= new TipoNodoLeisure(Messages.getString(\"TipoNodoLeisureTest.2\")); //$NON-NLS-1$\n\t\t\tif (tipo1 != tipo1)\n\t\t\t\tfail(Messages.getString(\"TipoNodoLeisureTest.3\")); //$NON-NLS-1$\n\t\t\tif (!tipo1.equals(tipo2))\n\t\t\t\tfail(Messages.getString(\"TipoNodoLeisureTest.4\"));\t\t\t //$NON-NLS-1$\n\t\t\tif (tipo1.equals(tipo3))\n\t\t\t\tfail(Messages.getString(\"TipoNodoLeisureTest.5\"));\t //$NON-NLS-1$\n\t\t}", "@Test\n public void testEquals() {\n System.out.println(\"equals\");\n Commissioner instance = new Commissioner();\n Commissioner instance2 = new Commissioner();\n instance.setLogin(\"genie\");\n instance2.setLogin(\"genie\");\n boolean expResult = true;\n boolean result = instance.equals(instance2);\n assertEquals(expResult, result);\n }", "@Override public boolean isA(InterfaceId in_interfaceId)\n {\n return (in_interfaceId == INTERFACE_ID);\n }", "public boolean isEqual(Object objectname1, Object objectname2, Class<?> voClass) {\n\t\treturn false;\n\t}", "@Test\r\n public void testReflexiveForEqual() throws Exception {\n\r\n EmployeeImpl emp1 = new EmployeeImpl(\"7993389\", \"[email protected]\");\r\n EmployeeImpl emp2 = new EmployeeImpl(\"7993389\", \"[email protected]\");\r\n\r\n Assert.assertTrue(\"Comparable implementation is incorrect\", emp1.compareTo(emp2) == 0);\r\n Assert.assertTrue(\"Comparable implementation is incorrect\", emp1.compareTo(emp2) == emp2.compareTo(emp1));\r\n }", "@Override\n public final boolean equals(final Object other) {\n return super.equals(other);\n }", "public boolean isIdentical(Remote obj1, Remote obj2)\n {\n\torg.omg.CORBA.Object corbaObj1 = (org.omg.CORBA.Object)obj1;\n\torg.omg.CORBA.Object corbaObj2 = (org.omg.CORBA.Object)obj2;\n\n\treturn corbaObj1._is_equivalent(corbaObj2);\n }", "@Override\n public boolean equals(Object obj) {\n \n //TODO: Complete Method\n \n return true;\n }", "@Test\n public void testEquals02() {\n System.out.println(\"equals\");\n Object otherObject = new SocialNetwork();\n boolean result = sn10.equals(otherObject);\n assertFalse(result);\n }", "@Override\n\tpublic boolean equals(Object obj){\n\t\treturn super.equals(obj);\n\t}", "public interface Participant extends Comparable<Participant> {\n /**\n * Returns the unique identifier for this Participant.\n *\n * @return The unique identifier for this Participant.\n */\n String getId();\n\n /**\n * Returns the name of this Participant.\n *\n * @return The name of this Participant.\n */\n String getName();\n\n /**\n * Returns the URL for an avatar image for this Participant.\n *\n * @return the URL for an avatar image for this Participant.\n */\n Uri getAvatarUrl();\n\n /**\n * Allows sorting Participants.\n */\n int compareTo(Participant another);\n}", "public abstract void compare();", "private static interface WithoutObjectOverrides {\n\n public boolean equals();\n\n public long hashCode(Object obj);\n\n public void toString(long foo);\n }", "@Override\n public final boolean equals( Object obj ) {\n return super.equals(obj);\n }", "@Override\n\tpublic boolean equals(Object obj) {\n\t\treturn super.equals(obj);\n\t}", "@Override\n\tpublic boolean equals(Object obj) {\n\t\treturn super.equals(obj);\n\t}", "@Override\n\tpublic boolean equals(Object obj) {\n\t\treturn super.equals(obj);\n\t}", "@Override\n\tpublic boolean equals(Object obj) {\n\t\treturn super.equals(obj);\n\t}", "@Override\n\tpublic boolean equals(Object obj) {\n\t\treturn super.equals(obj);\n\t}", "@Override\n\tpublic boolean equals(Object obj) {\n\t\treturn super.equals(obj);\n\t}", "@Test\n public void testEquals() {\n System.out.println(\"equals\");\n Object outroObjecto = new RegistoExposicoes();\n RegistoExposicoes instance = new RegistoExposicoes();\n assertTrue(instance.equals(outroObjecto));\n }", "@Override public boolean equals(Object o) { // since 1.3.1\n // should these ever match actually?\n return (o == this);\n }", "@Override\n public boolean equals(Object o) {\n return false;\n }", "@Test\n\tpublic void testEqualsObject() {\n\t\tJob testJob = new Job(\"Trash Pickup\", initialPark, cal, cal2,\n\t\t\t\t\"This job will just be picking up trash.\", new ArrayList<User>(), 5, 2, 0);\n\t\tassertEquals(testJob, initialJob);\n\t}", "@Override\n public final boolean equals(Object obj) {\n return super.equals(obj);\n }", "@Test\n\tpublic void test_hashCode1() {\n\tTennisPlayer c1 = new TennisPlayer(5,\"David Ferrer\");\n\tTennisPlayer c2 = new TennisPlayer(5,\"David Ferrer\");\n\tassertTrue(c1.hashCode()==c2.hashCode());\n }", "@Override\n\t\tpublic boolean equals(Object obj) {\n\t\t\treturn super.equals(obj);\n\t\t}", "@Override\n public boolean equals(Object object) {\n if (!(object instanceof Abstract)) {\n return false;\n }\n Abstract other = (Abstract) object;\n if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {\n return false;\n }\n return true;\n }", "public void testEquals()\r\n\t{\r\n\t\tIrClassType irClassType1 = new IrClassType();\r\n\t\tirClassType1.setName(\"irClassTypeName\");\r\n\t\tirClassType1.setDescription(\"irClassTypeDescription\");\r\n\t\tirClassType1.setId(55l);\r\n\t\tirClassType1.setVersion(33);\r\n\t\t\r\n\t\tIrClassType irClassType2 = new IrClassType();\r\n\t\tirClassType2.setName(\"irClassTypeName2\");\r\n\t\tirClassType2.setDescription(\"irClassTypeDescription2\");\r\n\t\tirClassType2.setId(55l);\r\n\t\tirClassType2.setVersion(33);\r\n\r\n\t\t\r\n\t\tIrClassType irClassType3 = new IrClassType();\r\n\t\tirClassType3.setName(\"irClassTypeName\");\r\n\t\tirClassType3.setDescription(\"irClassTypeDescription\");\r\n\t\tirClassType3.setId(55l);\r\n\t\tirClassType3.setVersion(33);\r\n\t\t\r\n\t\tassert irClassType1.equals(irClassType3) : \"Classes should be equal\";\r\n\t\tassert !irClassType1.equals(irClassType2) : \"Classes should not be equal\";\r\n\t\t\r\n\t\tassert irClassType1.hashCode() == irClassType3.hashCode() : \"Hash codes should be the same\";\r\n\t\tassert irClassType2.hashCode() != irClassType3.hashCode() : \"Hash codes should not be the same\";\r\n\t}", "@Test\n\tpublic void testEqualsObject_True() {\n\t\tbook3 = new Book(DEFAULT_TITLE, DEFAULT_AUTHOR, DEFAULT_YEAR, DEFAULT_ISBN);\n\t\tassertEquals(book1, book3);\n\t}", "@Override\r\n public boolean equals(Object obj) {\r\n if (this == obj)\r\n return true;\r\n if (obj == null)\r\n return false;\r\n if (getClass() != obj.getClass())\r\n return false;\r\n ItemImpl other = (ItemImpl) obj;\r\n if (id != other.id)\r\n return false;\r\n return true;\r\n }", "@Test\n public void testEquals01() {\n System.out.println(\"equals\");\n Object otherObject = new SocialNetwork();\n SocialNetwork sn = new SocialNetwork();\n boolean result = sn.equals(otherObject);\n assertTrue(result);\n }", "@Test\n public void testEquals() {\n System.out.println(\"Animal.equals\");\n Animal newAnimal = new Animal(252, \"Candid Chandelier\", 10, \"Cheetah\", 202);\n assertTrue(animal1.equals(newAnimal));\n assertFalse(animal2.equals(newAnimal));\n }", "@Override\n public boolean equals(Object o1) {\n return super.equals(o1);\n }", "@Test\n public void testEquals_sameParameters() {\n CellIdentityNr cellIdentityNr =\n new CellIdentityNr(PCI, TAC, NRARFCN, BANDS, MCC_STR, MNC_STR, NCI,\n ALPHAL, ALPHAS, Collections.emptyList());\n CellIdentityNr anotherCellIdentityNr =\n new CellIdentityNr(PCI, TAC, NRARFCN, BANDS, MCC_STR, MNC_STR, NCI,\n ALPHAL, ALPHAS, Collections.emptyList());\n\n // THEN this two objects are equivalent\n assertThat(cellIdentityNr).isEqualTo(anotherCellIdentityNr);\n }", "@Override\r\n public boolean equals(Object object) {\n if (!(object instanceof Equipment)) {\r\n return false;\r\n }\r\n Equipment other = (Equipment) object;\r\n if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {\r\n return false;\r\n }\r\n return true;\r\n }", "@Override\n\tpublic boolean equals(Object obj) {\n\t\treturn this.hashCode() == obj.hashCode();\n\t}", "@Override\n\tpublic boolean equals(Object obj) {\n\t\treturn this.hashCode() == obj.hashCode();\n\t}", "public interface Comparable\n{\n\t/**\n\t * Returns a number representing the ordering relationship that\n\t * the object has with the given object.\n\t * A negative number indicates that the object is \"smaller\" than\n\t * the parameter, a positive number means it is \"larger\" and zero\n\t * indicates that the objects are equal.\n\t */\n\tint compareTo(Object o);\n\n\t/**\n\t * Returns true if this object is equal to the given object.\n\t */\n\tboolean equals(Object o);\n}", "@Test\n public void equalsSameTest() {\n Device device2 = new Device(deviceID, token);\n assertEquals(device, device2);\n }", "public boolean equals(Object obj);", "@Override\n public boolean equals(Object object) {\n if (!(object instanceof Kanri)) {\n return false;\n }\n Kanri other = (Kanri) object;\n if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {\n return false;\n }\n return true;\n }", "public interface AgileItem {\n\n /**\n * Get the label.\n *\n * @return The label\n */\n String getLabel();\n\n /**\n * Set the label.\n * @param label label of agile item\n */\n void setLabel(String label);\n\n /**\n * Copy values from an existing AgileItem object to the current AgileItem\n *\n * @param agileItem The AgileItem object to copy values from\n */\n void copyValues(AgileItem agileItem);\n\n /**\n * What will display in the list.\n *\n * @return String representation of item.\n */\n String toString();\n\n /**\n * The function which will be used to compare AgileItems. Assumes labels are unique and non null.\n *\n * @param obj Object to compare to.\n * @return Whether labels are equal or not.\n */\n boolean equals(Object obj);\n\n}" ]
[ "0.6725496", "0.63724023", "0.63713264", "0.6352591", "0.63036704", "0.6300636", "0.627178", "0.624214", "0.623127", "0.62159324", "0.62079453", "0.6197707", "0.6180498", "0.61722004", "0.61722004", "0.61650056", "0.6164163", "0.6151277", "0.61249185", "0.6111151", "0.60955197", "0.6094954", "0.6074683", "0.6062005", "0.6062005", "0.6060066", "0.6049079", "0.60204804", "0.60173136", "0.60164034", "0.6005279", "0.5997557", "0.59918445", "0.5980362", "0.5974117", "0.59701854", "0.59654164", "0.59642816", "0.5934021", "0.59282327", "0.59096575", "0.5895351", "0.5892719", "0.5890566", "0.58874995", "0.5860281", "0.5841162", "0.5835916", "0.5833539", "0.58250016", "0.5818231", "0.5811267", "0.58047324", "0.5802995", "0.5790967", "0.5790967", "0.5790967", "0.57875204", "0.57815313", "0.5776263", "0.57691324", "0.5767334", "0.57643485", "0.5756373", "0.5753277", "0.57524264", "0.57502323", "0.5735991", "0.57353324", "0.5734916", "0.5732651", "0.57294214", "0.57294214", "0.57294214", "0.57294214", "0.57294214", "0.57294214", "0.57273334", "0.5719978", "0.57147324", "0.57141167", "0.5711503", "0.5700236", "0.5697979", "0.56978756", "0.569698", "0.56963825", "0.56921273", "0.5687223", "0.5686954", "0.56862134", "0.5683651", "0.5682812", "0.56807506", "0.56807506", "0.5674441", "0.56659013", "0.565837", "0.56556976", "0.5652366" ]
0.76471186
0
Generate a String that uniquely identifies this object. This String can be created from class data/state, and will be used to determine compare with other objects of the same type to determine equivalence.
public String id();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String getId() {\n return this.getClass().getSimpleName() + \"@\" + this.hashCode();\n }", "public String identityHash() {\n return Integer.toHexString(System.identityHashCode(this));\n }", "public interface Identifiable {\n\n\t/**\n\t * Generate a String that uniquely identifies this object. This String can\n\t * be created from class data/state, and will be used to determine compare\n\t * with other objects of the same type to determine equivalence.\n\t * \n\t * @return the String identifying the state of the object to compare\n\t */\n\tpublic String id();\n}", "private String generateUniqueIdString() {\r\n return TimeBasedUUID.getUUIDAsString();\r\n }", "public String toString() {\n\t\treturn (isStatic ? \"static \" : \"\") + type.toString() + \" \" + id;\n\t}", "private String toBaseString(final Object o) {\n return o.getClass().getName() + \"@\" + Integer.toHexString(System.identityHashCode(o));\n }", "public static String uniqueId() {\r\n return UUID.randomUUID().toString();\r\n }", "public static String uniqueId() {\n return UUID.randomUUID().toString();\n }", "public static String combinedUniqueId() {\n\t\t// generate combined unique id using device id, pseudo unique id and\n\t\t// android id\n\t\tString _combinedUniqueId = deviceId() + pseudoUniqueId() + androidId();\n\n\t\tLog.d(LOG_TAG, \"The combined unique id = \" + _combinedUniqueId);\n\n\t\treturn StringUtils.md5(_combinedUniqueId);\n\t}", "public String getId() {\n\t\treturn Integer.toString(this.hashCode());\n\t}", "public static String identityToString(Object obj) {\r\n if (obj == null) {\r\n return EMPTY_STRING;\r\n }\r\n return obj.getClass().getName() + \"@\" + getIdentityHexString(obj);\r\n }", "public static String getIdentityHexString(Object obj) {\r\n return Integer.toHexString(System.identityHashCode(obj));\r\n }", "public String toString() {\n StringBuffer sb = new StringBuffer();\n HashSet visited = new HashSet();\n IdentityHashCodeWrapper ap = IdentityHashCodeWrapper.create(this);\n visited.add(ap);\n toString(sb, visited);\n return sb.toString();\n }", "public static String getUniqueIdentifier() {\r\n UUID uuid = UUID.randomUUID();\r\n return uuid.toString();\r\n }", "public String toString() {\n return this.UID;\n }", "public String toString(){\n\t\treturn \"\"+getId();\n\t}", "public String toString() {\n\t\treturn thisInstance.getInstanceClass().getName() + \" : \" + thisInstance.getInstanceInObject().getObjectId() ;\n\t}", "String getUniqueId();", "public String toString( ) {\n return \"v\" + id;\n }", "public static String generateInstanceId() {\n\t\t// TODO Use a complex hashing algorithm and generate 16-character\n\t\t// string;\n\n\t\treturn Calendar.getInstance().getTime().toString().replaceAll(\" \", \"\");\n\t}", "@Override\r\n public String toString() {\n return getClass().getName() + \"@\" + Integer.toHexString(super.hashCode());\r\n }", "public String RtoosGetID() \n\t{\n\t\treturn UUIDs.random().toString();\n\t}", "public static String toString(Object obj)\n {\n return obj.getClass().getName() + \"@\" + Integer.toHexString(obj.hashCode()); //$NON-NLS-1$\n }", "public String toString() {\n\t\treturn hashString;\n\t}", "public String Identity();", "@Override\n public String toString() {\n StringBuilder sb = new StringBuilder();\n sb.append(getClass().getSimpleName());\n sb.append(\" [\");\n sb.append(\"Hash = \").append(hashCode());\n sb.append(\", id=\").append(id);\n sb.append(\", userId=\").append(userId);\n sb.append(\", identityType=\").append(identityType);\n sb.append(\", identifier=\").append(identifier);\n sb.append(\"]\");\n return sb.toString();\n }", "private static String localUnique(){\n\t\tfinal long counterValue = instanceCounter.getAndIncrement();\n\t\tString unique = uniqueTop + String.format(\"%08d\", counterValue);\n\t\treturn unique;\t\t\n\t}", "public String getUniqueId() {\n\t\treturn m_serverName + \" - \" + m_userId + \" - \" + m_timestampMillisecs;\n\t}", "private String creatUniqueID(){\n long ID = System.currentTimeMillis();\n return Long.toString(ID).substring(9,13);\n }", "public String getId() {\n\t\tStringBuilder builder = new StringBuilder();\n\t\tbuilder.append(\"n=\");\n\t\tif ( nodeId != null ) {\n\t\t\tbuilder.append(nodeId);\n\t\t}\n\t\tbuilder.append(\";c=\");\n\t\tif ( created != null ) {\n\t\t\tbuilder.append(created);\n\t\t}\n\t\tbuilder.append(\";s=\");\n\t\tif ( sourceId != null ) {\n\t\t\tbuilder.append(sourceId);\n\t\t}\n\t\treturn DigestUtils.sha1Hex(builder.toString());\n\t}", "String uniqueId();", "public void generateID()\n {\n ID = this.hashCode();\n }", "String generateUID();", "private static String pseudoUniqueId() {\n\t\t// decimal\n\t\tfinal Integer DECIMAL = 10;\n\n\t\t// return the android device some common info(board, brand, CPU type +\n\t\t// ABI convention, device, display, host, id, manufacturer, model,\n\t\t// product, tags, type and user) combined string\n\t\treturn new StringBuilder().append(Build.BOARD.length() % DECIMAL)\n\t\t\t\t.append(Build.BRAND.length() % DECIMAL)\n\t\t\t\t.append(Build.CPU_ABI.length() % DECIMAL)\n\t\t\t\t.append(Build.DEVICE.length() % DECIMAL)\n\t\t\t\t.append(Build.DISPLAY.length() % DECIMAL)\n\t\t\t\t.append(Build.HOST.length() % DECIMAL)\n\t\t\t\t.append(Build.ID.length() % DECIMAL)\n\t\t\t\t.append(Build.MANUFACTURER.length() % DECIMAL)\n\t\t\t\t.append(Build.MODEL.length() % DECIMAL)\n\t\t\t\t.append(Build.PRODUCT.length() % DECIMAL)\n\t\t\t\t.append(Build.TAGS.length() % DECIMAL)\n\t\t\t\t.append(Build.TYPE.length() % DECIMAL)\n\t\t\t\t.append(Build.USER.length() % DECIMAL).toString();\n\t}", "public String uniqueId() {\n return this.uniqueId;\n }", "public String toString()\n {\n String strResult = new String(\"Class: \" + SHUTTLENAME + \" (Revision \" +\n getRevisionNumber() +\n \")\" + hashCode());\n return(strResult);\n }", "@Override\r\n\tpublic String toString() {\n\t\treturn this.getClass().getName() + \" id=\" + get_id();\r\n\t}", "private void generateID(){\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (String t : terms.keySet())\n\t\t\tsb.append(t.replaceAll(\"\\\\W\", \"\")\n\t\t\t\t\t.substring(0, Math.min(4, t.replaceAll(\"\\\\W\", \"\").length())) + \"-\");\n\t\tfor (String s : sources)\n\t\t\tsb.append(s.replaceAll(\"\\\\W\", \"\")\n\t\t\t\t\t.substring(0, Math.min(4, s.replaceAll(\"\\\\W\", \"\").length())) + \"-\");\n\t\tsb.deleteCharAt(sb.length()-1);\n\t\tif (yearFrom > -1) sb.append(\"_\" + yearFrom);\n\t\tif (yearTo > -1) sb.append(\"_\" + yearTo);\n\t\tif (useCompounds) sb.append(\"_COMP\");\n\t\tif (useStopwords) sb.append(\"_STOP\");\n\t\tsb.append(\"_CNT\" + contextSize);\n\t\tsb.append(\"_\" + System.currentTimeMillis());\n\t\tthis.id = sb.toString();\n\t}", "@Override\r\n public String toString() {\r\n StringBuilder sb = new StringBuilder();\r\n sb.append(getClass().getSimpleName());\r\n sb.append(\" [\");\r\n sb.append(\"Hash = \").append(hashCode());\r\n sb.append(\", name=\").append(name);\r\n sb.append(\", className=\").append(className);\r\n sb.append(\", groupName=\").append(groupName);\r\n sb.append(\", description=\").append(description);\r\n sb.append(\"]\");\r\n return sb.toString();\r\n }", "String getUniqueID();", "public String getUniqueID();", "@Override\n\tpublic String toString() {\n\t\treturn Name;// + \"||\" + ID;// + \"-\" + ID;\n\t}", "public String generateId() {\n return Utils.generateKey();\n }", "static int getUniqueID(Object obj) {\n return obj.hashCode();\n }", "public static String createUniqueKey() {\r\n\r\n\t\tint iRnd;\r\n\t\tlong lSeed = System.currentTimeMillis();\r\n\t\tRandom oRnd = new Random(lSeed);\r\n\t\tString sHex;\r\n\t\tStringBuffer sUUID = new StringBuffer(32);\r\n\t\tbyte[] localIPAddr = new byte[4];\r\n\r\n\t\ttry {\r\n\r\n\t\t\t// 8 characters Code IP address of this machine\r\n\t\t\tlocalIPAddr = InetAddress.getLocalHost().getAddress();\r\n\r\n\t\t\tsUUID.append(byteToStr[((int) localIPAddr[0]) & 255]);\r\n\t\t\tsUUID.append(byteToStr[((int) localIPAddr[1]) & 255]);\r\n\t\t\tsUUID.append(byteToStr[((int) localIPAddr[2]) & 255]);\r\n\t\t\tsUUID.append(byteToStr[((int) localIPAddr[3]) & 255]);\r\n\t\t}\r\n\t\tcatch (UnknownHostException e) {\r\n\t\t\t// Use localhost by default\r\n\t\t\tsUUID.append(\"7F000000\");\r\n\t\t}\r\n\r\n\t\t// Append a seed value based on current system date\r\n\t\tsUUID.append(Long.toHexString(lSeed));\r\n\r\n\t\t// 6 characters - an incremental sequence\r\n\t\tsUUID.append(Integer.toHexString(iSequence.incrementAndGet()));\r\n\r\n\t\tiSequence.compareAndSet(16777000, 1048576);\r\n\r\n\t\tdo {\r\n\t\t\tiRnd = oRnd.nextInt();\r\n\t\t\tif (iRnd>0) iRnd = -iRnd;\r\n\t\t\tsHex = Integer.toHexString(iRnd);\r\n\t\t} while (0==iRnd);\r\n\r\n\t\t// Finally append a random number\r\n\t\tsUUID.append(sHex);\r\n\r\n\t\treturn sUUID.substring(0, 32);\r\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn String.valueOf(this.getId());\n\t}", "@Override\n public String toString() {\n StringBuilder sb = new StringBuilder();\n sb.append(getClass().getSimpleName());\n sb.append(\" [\");\n sb.append(\"Hash = \").append(hashCode());\n sb.append(\", id=\").append(id);\n sb.append(\", name=\").append(name);\n sb.append(\", remark=\").append(remark);\n sb.append(\"]\");\n return sb.toString();\n }", "public String getUniqueID ( ) { return _uniqueID; }", "public static String aUniqueIdentifier() {\n return \"MONEXT\" + new SimpleDateFormat(\"yyyyMMddHHmmss\").format(new Date());\n }", "public String toString() {\n return \"/\" + toIdent(0);\n }", "public String getUniqueID()\r\n {\r\n return (m_uniqueID);\r\n }", "public String getUniqueId() {\n return _uniqueId;\n }", "@Override\n public String toString()\n {\n return getClass().getSimpleName() + \"(\" + getAccountID() + \")\";\n }", "@org.jetbrains.annotations.NotNull\n public static String getUniquePsuedoID() {\n\n String m_szDevIDShort = \"35\" + (Build.BOARD.length() % 10) + (Build.BRAND.length() % 10) + (Build.CPU_ABI.length() % 10) + (Build.DEVICE.length() % 10) + (Build.MANUFACTURER.length() % 10) + (Build.MODEL.length() % 10) + (Build.PRODUCT.length() % 10);\n\n String serial = null;\n try {\n serial = android.os.Build.class.getField(\"SERIAL\").get(null).toString();\n\n return new UUID(m_szDevIDShort.hashCode(), serial.hashCode()).toString();\n } catch (Exception exception) {\n serial = \"serial\";\n }\n\n return new UUID(m_szDevIDShort.hashCode(), serial.hashCode()).toString();\n }", "public String toString() {\n\t\treturn \"[\"+this.getClass().getName()+\":\"+\n\t\t\tgetId()+\"]\";\n\t}", "public synchronized String generateTag() {\n return Integer.toHexString(rand.nextInt());\n }", "@Override\n\tpublic synchronized String toString() {\n\t\treturn this.id + \" : \" + this.name;\n\t}", "@Override\n public String toString()\n {\n return Integer.toString(this.ID).concat(\" - \" + this.name);\n }", "public String toString() {\r\n\r\n\t\tStringBuilder buffer = new StringBuilder();\r\n\r\n\t\tbuffer.append(\"id=[\").append(id).append(\"] \");\r\n\r\n\t\treturn buffer.toString();\r\n\t}", "@Override\n public String toString() {\n StringBuilder sb = new StringBuilder();\n sb.append(getClass().getSimpleName());\n sb.append(\" [\");\n sb.append(\"Hash = \").append(hashCode());\n sb.append(\", id=\").append(id);\n sb.append(\", uid=\").append(uid);\n sb.append(\", name=\").append(name);\n sb.append(\", account=\").append(account);\n sb.append(\", modifyTime=\").append(modifyTime);\n sb.append(\", createTime=\").append(createTime);\n sb.append(\"]\");\n return sb.toString();\n }", "public String generateUniqueSignature(){\n final String uuid = UniqueIdentifierGenerator.generateUniqueIdentifier();\n setSignature(uuid);\n return uuid;\n }", "@Override\r\n public String toString() {\r\n StringBuilder sb = new StringBuilder();\r\n sb.append(getClass().getSimpleName());\r\n sb.append(\" [\");\r\n sb.append(\"Hash = \").append(hashCode());\r\n sb.append(\", id=\").append(id);\r\n sb.append(\", companyCode=\").append(companyCode);\r\n sb.append(\", companyName=\").append(companyName);\r\n sb.append(\", briefName=\").append(briefName);\r\n sb.append(\", serialVersionUID=\").append(serialVersionUID);\r\n sb.append(\"]\");\r\n return sb.toString();\r\n }", "@Override\n\tpublic String toString() {\n\t\treturn getId().getName();\n\t}", "public static String get() {\n\t\treturn new ObjectId()+\"\";\n\t}", "public String toStringID()\r\n\t{\r\n\t\treturn nodeIdString;\r\n\t}", "@Override\n public String toString() {\n StringBuilder sb = new StringBuilder();\n sb.append(getClass().getSimpleName());\n sb.append(\" [\");\n sb.append(\"Hash = \").append(hashCode());\n sb.append(\", id=\").append(id);\n sb.append(\", activityId=\").append(activityId);\n sb.append(\", spuId=\").append(spuId);\n sb.append(\", participation=\").append(participation);\n sb.append(\", serialVersionUID=\").append(serialVersionUID);\n sb.append(\"]\");\n return sb.toString();\n }", "@Override\n public String toString() {\n StringBuilder sb = new StringBuilder();\n sb.append(getClass().getSimpleName());\n sb.append(\" [\");\n sb.append(\"Hash = \").append(hashCode());\n sb.append(\", pObjObjectGid=\").append(pObjObjectGid);\n sb.append(\", layoutName=\").append(layoutName);\n sb.append(\", layoutType=\").append(layoutType);\n sb.append(\", df=\").append(df);\n sb.append(\", fields=\").append(fields);\n sb.append(\", jsondata=\").append(jsondata);\n sb.append(\", serialVersionUID=\").append(serialVersionUID);\n sb.append(\"]\");\n return sb.toString();\n }", "public String code() {\n\t\treturn (\"ID\"+this.hashCode()).replace(\"-\", \"M\");\n\t}", "@Override\r\n\r\n public String toString() {\r\n StringBuilder s = new StringBuilder();\r\n s.append(\"#\").append(id).append(\" (\").append(name).append(\")\");\r\n return s.toString();\r\n }", "public String createUniqueScriptInstanceIdentifier() {\n\n\t\tLOGGER.debug(\"Creating a unique script instance identifier\");\n\n\t\t// generate a random name for the connection\n\t\tCalendar myCalendar = Calendar.getInstance();\n\t\tSimpleDateFormat dateFormatter = new SimpleDateFormat(\"yyyyMMddHHmmssS\");\n\t\tString scriptIdentifier = \"scriptInstance\"\n\t\t\t\t+ dateFormatter.format(myCalendar.getTime())\n\t\t\t\t+ randomNameSequence;\n\t\trandomNameSequence = randomNameSequence + 1;\n\n\t\tLOGGER.info(\"Generated unique script instance identifier [\"\n\t\t\t\t+ scriptIdentifier + \"]\");\n\n\t\treturn scriptIdentifier;\n\t}", "static String generateId() {\r\n\t\treturn UUID.randomUUID().toString().replaceAll(\"-\", \"\");\r\n\t}", "public String toString() { return stringify(this, true); }", "public String toString() {\n \n TmpStringBuffer = new StringBuffer(1000);\n TmpStringBuffer.append(this.getClass().getName());\n \n return TmpStringBuffer.toString();\n \n }", "public String toString() {\n \n TmpStringBuffer = new StringBuffer(1000);\n TmpStringBuffer.append(this.getClass().getName());\n \n return TmpStringBuffer.toString();\n \n }", "public String toString() {\n \n TmpStringBuffer = new StringBuffer(1000);\n TmpStringBuffer.append(this.getClass().getName());\n \n return TmpStringBuffer.toString();\n \n }", "public String toString() {\n \n TmpStringBuffer = new StringBuffer(1000);\n TmpStringBuffer.append(this.getClass().getName());\n \n return TmpStringBuffer.toString();\n \n }", "public String toString() {return classSimpleName+\"#\"+name;}", "@Override\r\n public String toString() {\r\n StringBuilder sb = new StringBuilder();\r\n sb.append(getClass().getSimpleName());\r\n sb.append(\" [\");\r\n sb.append(\"Hash = \").append(hashCode());\r\n sb.append(\", id=\").append(id);\r\n sb.append(\", uid=\").append(uid);\r\n sb.append(\", companyCode=\").append(companyCode);\r\n sb.append(\", basicAccount=\").append(basicAccount);\r\n sb.append(\", giftAccount=\").append(giftAccount);\r\n sb.append(\", insertTime=\").append(insertTime);\r\n sb.append(\", updateTime=\").append(updateTime);\r\n sb.append(\", serialVersionUID=\").append(serialVersionUID);\r\n sb.append(\"]\");\r\n return sb.toString();\r\n }", "@Override\n public String toString() {\n StringBuilder sb = new StringBuilder();\n sb.append(getClass().getSimpleName());\n sb.append(\" [\");\n sb.append(\"Hash = \").append(hashCode());\n sb.append(\", stuid=\").append(stuid);\n sb.append(\", stuname=\").append(stuname);\n sb.append(\", clazzid=\").append(clazzid);\n sb.append(\", age=\").append(age);\n sb.append(\", sex=\").append(sex);\n sb.append(\", birth=\").append(birth);\n sb.append(\", serialVersionUID=\").append(serialVersionUID);\n sb.append(\"]\");\n return sb.toString();\n }", "public String getUniqueIdValue() {\n return uniqueIdValue;\n }", "public String getIdentifier() {\n try {\n return keyAlias + \"-\" + toHexString(\n MessageDigest.getInstance(\"SHA1\").digest(keyStoreManager.getIdentifierKey(keyAlias).getEncoded()));\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }", "String id();", "String id();", "String id();", "String id();", "String id();", "String id();", "String id();", "String id();", "String id();", "String id();", "String id();", "String id();", "String id();", "String id();", "String id();", "String id();", "String id();", "String id();", "String id();", "String id();" ]
[ "0.7134955", "0.70209026", "0.6852484", "0.67915255", "0.668993", "0.6615907", "0.6526738", "0.64957374", "0.6458731", "0.64497304", "0.6447233", "0.6444718", "0.6419735", "0.6406878", "0.63534504", "0.6350364", "0.63191545", "0.6300291", "0.6273109", "0.62706006", "0.6261882", "0.6250092", "0.624824", "0.6246339", "0.62300014", "0.622162", "0.62186444", "0.6204597", "0.6201112", "0.6194778", "0.61891866", "0.61818814", "0.6167257", "0.61636734", "0.6135702", "0.6106652", "0.6102637", "0.6100781", "0.60961425", "0.60881597", "0.6080239", "0.6077651", "0.6077323", "0.6076411", "0.6076306", "0.60478145", "0.6027061", "0.6023703", "0.6020147", "0.6018895", "0.6006944", "0.6001617", "0.59961057", "0.59930664", "0.59920096", "0.59845227", "0.5982632", "0.59763306", "0.59731007", "0.59707266", "0.59653795", "0.5964918", "0.5960569", "0.5959986", "0.5959934", "0.5956899", "0.5953572", "0.59527034", "0.5952143", "0.5946695", "0.59450585", "0.59373754", "0.5931501", "0.5931501", "0.5931501", "0.5931501", "0.5931027", "0.59279686", "0.59144354", "0.5913489", "0.59130764", "0.59114087", "0.59114087", "0.59114087", "0.59114087", "0.59114087", "0.59114087", "0.59114087", "0.59114087", "0.59114087", "0.59114087", "0.59114087", "0.59114087", "0.59114087", "0.59114087", "0.59114087", "0.59114087", "0.59114087", "0.59114087", "0.59114087", "0.59114087" ]
0.0
-1
Load all sheets in the given folder.
public void loadChordSheets(File folder) { if (folder.exists()) { ActivityDataUtility.getInstance().setCurrentFolder(folder); files.clear(); if (!FileUtility.getBaseFolder().equals(folder)) { files.add(new FileItem(folder.getParentFile())); } for (File file : folder.listFiles(new ChordSheetListFilter())) { files.add(new FileItem(file)); } } files.sort(new FileItemComparator()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void loadSheet() {\n\t\ttry {\n\t\t\tBufferedImage image = ImageIO.read(SpriteSheet.class\n\t\t\t\t\t.getResource(path));\n\t\t\tint w = image.getWidth();\n\t\t\tint h = image.getHeight();\n\t\t\timage.getRGB(0, 0, w, h, sheetPixles, 0, w);\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "protected void loadAll() {\n\t\ttry {\n\t\t\tloadGroups(this.folder, this.cls, this.cachedOnes);\n\t\t\t/*\n\t\t\t * we have to initialize the components\n\t\t\t */\n\t\t\tfor (Object obj : this.cachedOnes.values()) {\n\t\t\t\t((Component) obj).getReady();\n\t\t\t}\n\t\t\tTracer.trace(this.cachedOnes.size() + \" \" + this + \" loaded.\");\n\t\t} catch (Exception e) {\n\t\t\tthis.cachedOnes.clear();\n\t\t\tTracer.trace(\n\t\t\t\t\te,\n\t\t\t\t\tthis\n\t\t\t\t\t\t\t+ \" pre-loading failed. No component of this type is available till we successfully pre-load them again.\");\n\t\t}\n\t}", "public Collection<TestCaseDto> loadSuiteFromReportFolder(Path folder) throws IOException {\n Map<String, TestCaseDto> testMap = new HashMap<>();\n Files.walk(folder).filter(Files::isRegularFile)\n .filter(f -> f.getFileName().toString().endsWith(\".xml\"))\n .forEach(f -> this.parseAndAddTests(f, testMap));\n return testMap.values();\n }", "public void loadArenas() {\n\t\tLogger logger = getLogger();\n\t\tFile arenaFolder = getArenaFolder();\n\t\tif (!arenaFolder.exists()) {\n\t\t\tarenaFolder.mkdirs();\n\t\t}\n\n\t\tCollection<File> arenas = FileUtils.listFiles(arenaFolder, null, false);\n\n\t\tif (arenas.isEmpty()) {\n\t\t\tlogger.info(\"No arenas loaded for \" + getName());\n\t\t\treturn;\n\t\t}\n\n\t\tfor (File file : arenas) {\n\t\t\ttry {\n\t\t\t\tArena arena = new Arena(file);\n\t\t\t\tarena.load();\n\t\t\t\tarenaManager.addArena(arena);\n\t\t\t\tlogger.info((\"Loaded arena \" + arena.toString()));\n\t\t\t} catch (Exception e) {\n\t\t\t\te.printStackTrace();\n\t\t\t\tlogger.info(\"Unable to load arena from file: \" + file.getName());\n\t\t\t}\n\t\t}\n\n\t}", "public static void reload() {\n mods.clear();\n tableMap.clear();\n List<TableInfo> tableInfos = new ArrayList<>();\n\n List<File> files = FileUtil.loopFiles(\"system\", pathname -> pathname.isFile()\n && pathname.getName().startsWith(\"table_\")\n && StrUtil.endWithAnyIgnoreCase(pathname.getName(), \".xls\", \".xlsx\"));\n\n for (File file : files) {\n log.info(file.getAbsolutePath());\n List<TableInfo> tableInfos2 =\n XlsUtils.readAll(file, \"tables\", TableInfo.class);\n List<SelectOps> selOpts =\n XlsUtils.readAll(file, \"tables_select_ops\", SelectOps.class);\n List<ButtonInfo> buttonInfos =\n XlsUtils.readAll(file, \"tables_btns\", ButtonInfo.class);\n for (TableInfo tableInfo : tableInfos2) {\n if (!StrUtil.isEmpty(tableInfo.getUrl())) continue;\n List<ColumnInfo> columnInfos =\n XlsUtils.readAll(file, tableInfo.getName(), ColumnInfo.class).stream().filter(\n columnInfo -> StrUtil.equals(columnInfo.getIsactive(), \"Y\")\n ).collect(Collectors.toList());\n tableInfo.setColumns(columnInfos);\n for (ColumnInfo columnInfo : columnInfos) {\n columnInfo.setName(columnInfo.getName().toLowerCase());\n if (columnInfo.getView_type() == ColumnType.select) {\n columnInfo.setSelectOps(selOpts.stream()\n .filter(selectOps -> StrUtil.equalsIgnoreCase(\n selectOps.getGroupname(),\n columnInfo.getSelGroup())\n ).collect(Collectors.toList())\n );\n }\n tableInfo.setButtons(buttonInfos.stream().filter(\n it -> StrUtil.equalsIgnoreCase(tableInfo.getName(), it.getTable())).collect(Collectors.toList()));\n }\n }\n log.info(\"**************** stop reload xlsx *********************\");\n log.info(JSONUtil.toJsonStr(tableInfos2));\n tableInfos.addAll(tableInfos2);\n }\n tableInfos.forEach(c -> {\n tableMap.put(c.getName(), c);\n });\n tableInfos.forEach(c -> {\n int i = 0;\n for (ColumnInfo columnInfo : c.getColumns()) {\n if (columnInfo.getList_size() == 0)\n columnInfo.setList_size(StrUtil.length(columnInfo.getRemark()));\n if (StrUtil.isEmpty(columnInfo.getApiName()))\n columnInfo.setApiName(columnInfo.getName());\n if (StrUtil.contains(columnInfo.getApiName(), \";\")) {\n// columnInfo.setApiName(StrUtil.replace(columnInfo.getApiName(), \";\", \"$\"));\n columnInfo.setApiName(\"col_\" + i);\n }\n if (StrUtil.isNotEmpty(columnInfo.getLinkTable()) && StrUtil.isEmpty(columnInfo.getLinkTableName())) {\n if (tableMap.containsKey(columnInfo.getLinkTable()))\n columnInfo.setLinkTableName(tableMap.get(columnInfo.getLinkTable()).getRemark());\n }\n i++;\n }\n String upTableStr = c.getUpTable();\n if (StrUtil.isNotEmpty(upTableStr)) {\n TableInfo upTable = tableMap.get(upTableStr);\n upTable.getItemTables().add(c);\n }\n });\n\n\n for (TableInfo tableInfo : tableInfos) {\n if (!StrUtil.equalsIgnoreCase(tableInfo.getIsmenu(), \"Y\")) continue;\n String modInfo = tableInfo.getMod();\n if (!mods.contains(modInfo))\n mods.add(modInfo);\n }\n }", "public void readXlsx(String year, String month) throws IOException {\n XSSFWorkbook xssfWorkbook;\n XSSFSheet sheet;\n File dir = new File(\"C:\\\\Munka\\\\\" + year.trim() + month.trim());\n File[] directoryListing = dir.listFiles();\n if (directoryListing != null) {\n for (File xlsxFile : directoryListing) {\n try (InputStream fileInputStream = new FileInputStream(xlsxFile)) {\n xssfWorkbook = new XSSFWorkbook(fileInputStream);\n sheet = xssfWorkbook.getSheetAt(0);\n iterateXlsRow(sheet);\n } catch (NullPointerException e) {\n System.out.println(\"Hiba történt!\");\n }\n }\n }\n this.directory = month;\n this.year = year;\n }", "public Map<String,Sheet> getSheetsByName() {\n return this.sheetsByName;\n }", "public ArrayList<String> getData(String testcaseName) throws IOException\n{\n//fileInputStream argument\nArrayList<String> a=new ArrayList<String>();\n\nFileInputStream fis=new FileInputStream(\"D://TestCases.xlsx\");\nXSSFWorkbook workbook=new XSSFWorkbook(fis);\n\nint sheets=workbook.getNumberOfSheets();\n}", "@Autowired(required=false)\n public void setSheetsByName(Map<String,Sheet> map) {\n this.sheetsByName = map;\n }", "public void setGroupList() {\n \n String path = \".\"; //curent folder\n String files; //files name\n File folder = new File(path); // get the folfer\n File[] listOfFiles = folder.listFiles(); //list of files\n for (int i = 0; i < listOfFiles.length; i++) {//this loop go trough the folder\n if (listOfFiles[i].isFile()) {\n files = listOfFiles[i].getName();\n if (files.endsWith(\".xls\") || files.endsWith(\".XLS\")) {//filter all the xls file\n if(!files.equalsIgnoreCase(\".xls\")){\n // add a new objet CompoundBook in a our xlsBook\n xlsBook.add(new CompoundBook(files));\n //add only the name of the file without the .xls extension\n groups.add(files.substring(0, files.lastIndexOf(\".\")));\n }\n }\n }\n }\n gList.setListData(groups); // set the group List on the GUI\n }", "private void importData() {\n Sheet sheet;\n Row row;\n int lastRowNum;\n // Discover how many sheets there are in the workbook....\n int numSheets = this.workbook.getNumberOfSheets();\n // and then iterate through them.\n for (int i = 0; i < numSheets; i++) {\n\n // Get a reference to a sheet and check to see if it contains\n // any rows.\n sheet = this.workbook.getSheetAt(i);\n if (sheet.getPhysicalNumberOfRows() > 0) {\n lastRowNum = sheet.getLastRowNum();\n for (int j = 1; j <= lastRowNum; j++) {\n row = sheet.getRow(j);\n this.rowToRenddet(row);\n }\n }\n }\n }", "public void loadSheet(String sheetName) {\n\t\tsheet = excelWBook.getSheet(sheetName);\n\t}", "public void loadReports() throws EngineException {\n File folder = new File(reportsPath);\n for (String file : Objects.requireNonNull(folder.list())) {\n if (!file.endsWith(\".rptdesign\")) {\n continue;\n }\n\n reports.put(file.replace(\".rptdesign\", \"\"),\n birtEngine.openReportDesign(folder.getAbsolutePath() + File.separator + file));\n\n }\n }", "public void intializeExcel(String path) throws Exception{\n//\t\topen a input stream\n\t\t fis = new FileInputStream(path);\n\n\t\t//create a workbook object\n\t\t wb = new XSSFWorkbook(fis);\n\t\t\n\t}", "void reloadInternal()\r\n {\r\n final ArrayList<Workspace> newWorkspaces = new ArrayList<Workspace>();\r\n\r\n final File[] files = FileUtil.getFiles(new File(FileUtil.getGenericPath(WORKSPACE_PATH)), new FileFilter()\r\n {\r\n @Override\r\n public boolean accept(File file)\r\n {\r\n // only accept xml file\r\n return FileUtil.getFileExtension(file.getPath(), true).toLowerCase().equals(EXT);\r\n }\r\n }, true, false, false);\r\n\r\n for (File file : files)\r\n {\r\n final Workspace workspace = new Workspace(file);\r\n\r\n // don't load the specific system workspace\r\n if (!workspace.getName().equals(Workspace.WORKSPACE_SYSTEM_NAME))\r\n {\r\n // empty workspace ?\r\n if (workspace.isEmpty())\r\n {\r\n // don't show this message for default workspace\r\n // if (!workspace.getName().equals(Workspace.WORKSPACE_DEFAULT_NAME))\r\n System.err.println(\"Empty workspace '\" + workspace.getName() + \"' is not loaded\");\r\n }\r\n else\r\n newWorkspaces.add(workspace);\r\n }\r\n }\r\n\r\n // sort list\r\n Collections.sort(newWorkspaces);\r\n\r\n // set workspace list\r\n workspaces = newWorkspaces;\r\n\r\n // notify change\r\n changed();\r\n }", "private static void loadImagesInDirectory(String dir){\n\t\tFile file = new File(Files.localize(\"images\\\\\"+dir));\n\t\tassert file.isDirectory();\n\t\n\t\tFile[] files = file.listFiles();\n\t\tfor(File f : files){\n\t\t\tif(isImageFile(f)){\n\t\t\t\tString name = dir+\"\\\\\"+f.getName();\n\t\t\t\tint i = name.lastIndexOf('.');\n\t\t\t\tassert i != -1;\n\t\t\t\tname = name.substring(0, i).replaceAll(\"\\\\\\\\\", \"/\");\n\t\t\t\t//Image image = load(f,true);\n\t\t\t\tImageIcon image;\n\t\t\t\tFile f2 = new File(f.getAbsolutePath()+\".anim\");\n\t\t\t\tif(f2.exists()){\n\t\t\t\t\timage = evaluateAnimFile(dir,f2,load(f,true));\n\t\t\t\t}else{\n\t\t\t\t\timage = new ImageIcon(f.getAbsolutePath());\n\t\t\t\t}\n\t\t\t\tdebug(\"Loaded image \"+name+\" as \"+f.getAbsolutePath());\n\t\t\t\timages.put(name, image);\n\t\t\t}else if(f.isDirectory()){\n\t\t\t\tloadImagesInDirectory(dir+\"\\\\\"+f.getName());\n\t\t\t}\n\t\t}\n\t}", "public List<Sheet> getSheets() {\n\n List<Sheet> sheets = new ArrayList<>();\n for (int i=0; i<workbook.getNumberOfSheets(); i++) {\n sheets.add( workbook.getSheetAt(i) );\n }\n return sheets;\n }", "private File[] getResourceFolderFiles(String folder) {\n\t\tClassLoader loader = Thread.currentThread().getContextClassLoader();\n\t\tURL url = loader.getResource(folder);\n\t\tString path = url.getPath();\n\n\t\treturn new File(path).listFiles();\n\n\t}", "protected static void loadGroups(String folderName, Class<?> rootClass,\n\t\t\tMap<String, Object> objects) {\n\t\tString packageName = null;\n\t\tif (rootClass != null) {\n\t\t\tpackageName = rootClass.getPackage().getName() + '.';\n\t\t}\n\t\tfor (String resName : FileManager.getResources(componentFolder\n\t\t\t\t+ folderName)) {\n\t\t\tif (resName.endsWith(EXTN) == false) {\n\t\t\t\tTracer.trace(\"Skipping Non-resource \" + resName);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tTracer.trace(\"Going to load components from \" + resName);\n\t\t\ttry {\n\t\t\t\tXmlUtil.xmlToCollection(resName, objects, packageName);\n\t\t\t} catch (Exception e) {\n\t\t\t\tTracer.trace(e, \"Resource \" + resName + \" failed to load.\");\n\t\t\t}\n\t\t}\n\t}", "private <T> void loadAllFromFolder(String name,Class<T> type){\n\t\tFileHandle dirHandle;\n\t\tif (Gdx.app.getType() == ApplicationType.Desktop) {\n\t\t dirHandle = new FileHandle(\"./bin/\"+name);\n\t\t \n\t\t} else {\n\t\t dirHandle = Gdx.files.internal(name);\n\t\t}\n\t\t \n\t\tfor (FileHandle entry: dirHandle.list()) {\n\t\t assetManager.load(entry.path(),type);\n\t\t}\n\t}", "public TileSheet(final String path) throws IOException {\n this.sheet = ImageIO.read(getClass().getResource(path));\n }", "private void cacheFoldersFiles() throws Exception {\n\n ArrayList<FileManagerFile> files = new ArrayList<FileManagerFile>();\n if (fileCount > 0) {\n SimpleDateFormat formatter = new SimpleDateFormat(\"yyyy-MM-dd'T'HH:mm:ss\");\n formatter.setTimeZone(TimeZone.getTimeZone(\"GMT\"));\n\n int offset = 0;\n int count = 1000;\n List<FileManagerFile> filelist;\n\n do {\n filelist = connection.getFileManager().getFileManagerFiles(count, offset);\n offset += count;\n for (FileManagerFile file : filelist) {\n if (file.getFolderId() == id) {\n files.add(file);\n }\n }\n } while (filelist.size() > 0 && files.size() < fileCount);\n }\n this.files = files;\n }", "public void loadCache() {\n if (!directory.exists()) {\n directory.mkdirs();\n }\n File[] files = this.directory.listFiles();\n if (files == null) {\n return;\n }\n for (File file : files) {\n if (file.getName().endsWith(\".json\")) {\n cache.put(file.getName().split(\".json\")[0], new JsonDocument(file));\n }\n }\n }", "private static List<String> loadDocuments(String path) throws Exception {\n\t\tFile folder = new File(path);\n\t\tArrayList<String> documents = new ArrayList<String>();\n\t\tfor (final File fileEntry : folder.listFiles()) {\n\t\t\tSystem.out.println(fileEntry.getName());\n\t\t\tif (fileEntry.isFile() && !fileEntry.isHidden()) {\n\t\t\t\tString content = getTextFromHtml(fileEntry);\n\t\t\t\tdocuments.add(content);\n\t\t\t}\n\t\t}\n\t\treturn documents;\n\t}", "private void loadSpritesheet() {\n\t\tobjects = new SpriteSheet(\"res\\\\pong.png\");\n\t\tobjects_hires = new SpriteSheet(\"res\\\\ponghires.png\",\n\t\t\t\tSpriteSheet.LINEAR);\n\t}", "private void init() {\n\n File folder = new File(MAP_PATH);\n File[] listOfFiles = folder.listFiles();\n\n for (int i = 0; i < Objects.requireNonNull(listOfFiles).length; i++) {\n this.mapFiles.add(new File(MAP_PATH + listOfFiles[i].getName()));\n }\n }", "private void loadSavedSchedules() {\n scheduleList = new ScheduleList(new ArrayList<>());\n try {\n scheduleList = reader.readSchedules();\n } catch (IOException e) {\n System.err.println(\"Schedule File Missing\");\n } catch (JSONException je) {\n System.err.println(\"Empty File - Schedule\");\n System.out.println(je);\n }\n }", "private void loadImages() {\n\t\ttry {\n\t\t\tall_images = new Bitmap[img_files.length];\n\t\t\tfor (int i = 0; i < all_images.length; i++) {\n\t\t\t\tall_images[i] = loadImage(img_files[i] + \".jpg\");\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\tToast.makeText(this, \"Unable to load images\", Toast.LENGTH_LONG)\n\t\t\t\t\t.show();\n\t\t\tfinish();\n\t\t}\n\t}", "private void loadSprites(String s){\n try {\n BufferedImage spriteSheet = ImageIO.read(\n getClass().getResourceAsStream(s));\n sprites = new BufferedImage[1];\n sprites[0] = spriteSheet.getSubimage(0, 0, width, height);\n\n } catch (Exception e){\n e.printStackTrace();\n }\n\n }", "public static ArrayList<Course> loadAllJsonFlies(){\n List<String> jsonFileNames = Data.getJsonFilesAsList();\n ArrayList<Course> coursesOfAllSemesters = new ArrayList<>();\n for (String jsonFileName:jsonFileNames){\n ArrayList<Course> coursesOfSemester = loadJsonByFileName(jsonFileName);\n coursesOfAllSemesters.addAll(coursesOfSemester);\n }\n return coursesOfAllSemesters;\n }", "@Override\n\tpublic StyleSheetList getStyleSheets() {\n\t\tif (sheets.needsUpdate()) {\n\t\t\tsheets.update();\n\t\t}\n\t\treturn sheets;\n\t}", "public void reloadFiles()\n {\n for (Reloadable rel : reloadables)\n {\n rel.reload();\n }\n }", "ISheet getSheet(String name);", "public void loadOIFitsFiles(final File[] files, final OIFitsChecker checker, final LoadOIFitsListener listener) {\n if (files != null) {\n final List<String> fileLocations = new ArrayList<String>(files.length);\n for (File file : files) {\n fileLocations.add(file.getAbsolutePath());\n }\n\n new LoadOIFitsFilesSwingWorker(fileLocations, checker, listener) {\n /**\n * Refresh GUI invoked by the Swing Event Dispatcher Thread (Swing EDT)\n * Called by @see #done()\n * @param oifitsFiles computed data\n */\n @Override\n public void refreshUI(final List<OIFitsFile> oifitsFiles) {\n // add OIFits files to collection = fire OIFitsCollectionChanged:\n super.refreshUI(oifitsFiles);\n\n listener.done(false);\n }\n\n @Override\n public void refreshNoData(final boolean cancelled) {\n listener.done(cancelled);\n }\n\n }.executeTask();\n }\n }", "public void loadTemplates()\n {\n for (PageTemplate template : templates.values())\n {\n template.load(pageDirectory);\n }\n }", "@Override\r\n public List<Folder> getAllFolder() {\n return folderRepository.findAll();\r\n }", "@Override\n public void onApplicationEvent(ApplicationEvent event) {\n if(event instanceof ContextRefreshedEvent) {\n for(Sheet s: sheetsByName.values()) {\n s.prime(); // exception if Sheet can't target overridable properties\n }\n // log warning for any sheets named but not present\n HashSet<String> allSheetNames = new HashSet<String>();\n for(DecideRuledSheetAssociation assoc : ruleAssociations) {\n allSheetNames.addAll(assoc.getTargetSheetNames());\n }\n for(List<String> names : sheetNamesBySurt.values()) {\n allSheetNames.addAll(names);\n }\n for(String name : allSheetNames) {\n if(!sheetsByName.containsKey(name)) {\n logger.warning(\"sheet '\"+name+\"' referenced but absent\");\n }\n }\n }\n }", "void loadFromFile() {\n\t\ttry {\n\t\t\tFile directory = GameApplication.getInstance().getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS);\n\t\t\tFile source = new File(directory, FILE_NAME);\n\t\t\tMap<String, Scoreboard> scoreboards = new HashMap<String, Scoreboard>();\n\t\t\tif (source.exists()) {\n\t\t\t\tJsonReader reader = new JsonReader(new FileReader(source));\n\t\t\t\treader.beginArray();\n\t\t\t\twhile (reader.hasNext()) {\n\t\t\t\t\tScoreboard scoreboard = readScoreboard(reader);\n\t\t\t\t\tscoreboards.put(scoreboard.getName(), scoreboard);\n\t\t\t\t}\n\t\t\t\treader.endArray();\n\t\t\t\treader.close();\n\t\t\t} else {\n\t\t\t\tsource.createNewFile();\n\t\t\t}\n\t\t\tthis.scoreboards = scoreboards;\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "private void fetchProjects(Folder folder) {\n\n logger.atInfo().log(\"Fetching projects from \" + folder.getDisplayName());\n\n Set<Project> projectSet = new HashSet<Project>();\n ListProjectsPagedResponse projectsResponse = projectsClient.listProjects(folder.getName());\n Iterable<Project> iterableProjects = projectsResponse.iterateAll();\n Iterator<Project> projects = iterableProjects.iterator();\n\n while (projects.hasNext()) {\n Project project = projects.next();\n projectSet.add(project);\n }\n folderProjectMap.put(folder, projectSet);\n }", "void loadAll() {\n\t\tsynchronized (this) {\n\t\t\tif (isFullyLoaded) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfor (Entry<Integer, Supplier<ChunkMeta<?>>> generator : ChunkMetaFactory.getInstance()\n\t\t\t\t\t.getEmptyChunkFunctions()) {\n\t\t\t\tChunkMeta<?> chunk = generator.getValue().get();\n\t\t\t\tchunk.setChunkCoord(this);\n\t\t\t\tchunk.setPluginID(generator.getKey());\n\t\t\t\ttry {\n\t\t\t\t\tchunk.populate();\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t// need to catch everything here, otherwise we block the main thread forever\n\t\t\t\t\t// once it tries to read this\n\t\t\t\t\tCivModCorePlugin.getInstance().getLogger().log(Level.SEVERE, \n\t\t\t\t\t\t\t\"Failed to load chunk data\", e);\n\t\t\t\t}\n\t\t\t\taddChunkMeta(chunk);\n\t\t\t}\n\t\t\tisFullyLoaded = true;\n\t\t\tthis.notifyAll();\n\t\t}\n\t}", "public void loadFilesInFolder(File rootFile) {\r\n\t\tDefaultListModel<File> model = new DefaultListModel<>();\r\n\t\tfor (File nextFile : rootFile.listFiles()) {\r\n\t\t\tmodel.addElement(nextFile);\r\n\t\t}\r\n\t\tlist.setModel(model);\r\n\t}", "public static void setExcelFile(String path, String sheetName) throws Exception {\r\n\t\ttry {\r\n\t\t\tFileInputStream excelFile = new FileInputStream(path);\r\n\t\t\tworkBook = new HSSFWorkbook(excelFile);\r\n\t\t\tsheet = workBook.getSheet(sheetName);\r\n\t\t\tformatter = new DataFormatter();\r\n\t\t} catch (Exception e) {\r\n\t\t\tthrow (e);\r\n\t\t}\r\n\t//---------------------------------------------------------------------------------\r\n\r\n\t}", "@Override\n\tpublic Stream<Path> loadAll() {\n\t\treturn null;\n\t}", "public static void initialize(final String sFolder) {\n\n GUIResources.addResourcesFromFolder(sFolder);\n _initialize();\n\n\n }", "private void loadMap(String path) {\n\t\ttry {\n\t\t\tfor(Player p : players)\tp.clear();\n\t\t\tmap.players = players;\n\t\t\tmap.setPlayerNumber(playerNumber);\n\t\t\tfor(Player p : map.players) {\n\t\t\t\tp.setMap(map);\n\t\t\t\tp.setArmies(map.getInitialArmiesNumber());\n\t\t\t}\n\t\t\tmap.setPlayerNumber(map.players.size());\n\t\t\tmap.load(path);\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public static void loadAllSongs()\n {\n if (JSoundsMainWindowViewController.alreadyPlaying)\n JSoundsMainWindowViewController.stopSong();\n \n JSoundsMainWindowViewController.shutDownPlayer();\n JSoundsMainWindowViewController.isPlaylist=false;\n JSoundsMainWindowViewController.orderBy(false, true, false);\n }", "public static void readInstances(ArrayList<MISPData> data, String path_folder) throws IOException {\n\t\tfinal File folder = new File(path_folder);\r\n\t\tfor (final File fileEntry : folder.listFiles()) {//recorre los files de la carpeta folder\r\n\t\t\tif (fileEntry.isDirectory()) {\r\n\t\t\t\treadInstances(data, fileEntry.getPath());\r\n\t\t\t} else {\r\n\t\t\t\tSystem.out.print(\"-\");\r\n\t\t\t\t//System.out.println(\"Leyendo: \" + fileEntry.getName());\r\n\t\t\t\tMISPData mispd = new MISPData();//Declara una nueva variable MISPData, con atributos vacios\r\n\t\t\t\treadFile(mispd.getInstance(), fileEntry.getPath());//metodo readFile, recibe un parametro instancia vacio y el nombre del file correspondiente a una instancia a leer \r\n\t\t\t\t//mispd.instance.getIndependenSet().Print_ListAdya();//Imprime por consola la lista enlazada\r\n\t\t\t\tdata.add(mispd);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public static void load() {\n for (DataSourceSwapper each : ServiceLoader.load(DataSourceSwapper.class)) {\n loadOneSwapper(each);\n }\n }", "private static List<List<String>> loadSheetDataTable(XSSFSheet sheet) {\n List<List<String>> ret = new ArrayList<List<String>>();\n // Get the first and last sheet row number.\n int firstRowNum = sheet.getFirstRowNum();\n int lastRowNum = sheet.getLastRowNum();\n if (lastRowNum > 0) {\n // Loop in sheet rows.\n for (int i = firstRowNum; i < lastRowNum + 1; i++) {\n // Get current row object.\n Row row = sheet.getRow(i);\n // Get first and last cell number.\n int firstCellNum = row.getFirstCellNum();\n int lastCellNum = row.getLastCellNum();\n // Create a String list to save column data in a row.\n List<String> rowDataList = new ArrayList<String>();\n // Loop in the row cells.\n for (int j = firstCellNum; j < lastCellNum; j++) {\n // Get current cell.\n Cell cell = row.getCell(j);\n // Get cell type.\n CellType cellType = cell.getCellType();\n if (cellType == CellType.NUMERIC) {\n double numberValue = cell.getNumericCellValue();\n // BigDecimal is used to avoid double value is counted use Scientific counting method.\n // For example the original double variable value is 12345678, but jdk translated the value to 1.2345678E7.\n String stringCellValue = BigDecimal.valueOf(numberValue).toPlainString();\n rowDataList.add(stringCellValue);\n } else if (cellType == CellType.STRING) {\n String cellValue = cell.getStringCellValue();\n rowDataList.add(cellValue);\n } else if (cellType == CellType.BOOLEAN) {\n boolean numberValue = cell.getBooleanCellValue();\n String stringCellValue = String.valueOf(numberValue);\n rowDataList.add(stringCellValue);\n } else if (cellType == CellType.BLANK) {\n rowDataList.add(\"\");\n }\n }\n // Add current row data list in the return list.\n ret.add(rowDataList);\n }\n }\n return ret;\n }", "private void updateAllFoldersTreeSet() throws MessagingException {\n\n Folder[] allFoldersArray = this.store.getDefaultFolder().list(\"*\");\n TreeSet<Folder> allFoldersTreeSet =\n new TreeSet<Folder>(new FolderByFullNameComparator());\n\n for(int ii = 0; ii < allFoldersArray.length; ii++) {\n\n allFoldersTreeSet.add(allFoldersArray[ii]);\n }\n\n this.allFolders = allFoldersTreeSet;\n }", "void loadProjects(File workspaceDir) {\n WorkspaceFactory.getInstance().resetCache();\n Workspace workspace = null;\n try {\n workspace = WorkspaceFactory.getInstance().load(workspaceDir);\n } catch (ProjectImporterException e) {\n wizard.setErrorMessage(ProjectImporterWizard.getMessage(\n \"MSG_WorkspaceIsInvalid\", workspaceDir)); // NOI18N\n logger.log(Level.FINE, \"ProjectImporterException catched\", e); // NOI18N\n return;\n }\n Set<EclipseProject> wsPrjs = new TreeSet<EclipseProject>(workspace.getProjects());\n projects = wsPrjs.toArray(new EclipseProject[wsPrjs.size()]);\n selectedProjects = new HashSet<EclipseProject>();\n requiredProjects = new HashSet<EclipseProject>();\n if (projects.length == 0) {\n wizard.setErrorMessage(ProjectImporterWizard.getMessage(\n \"MSG_WorkspaceIsEmpty\", workspaceDir)); // NOI18N\n } else {\n updateValidity();\n }\n }", "public void listFilesForFolder(final File folder) {\n\t\tfor (final File fileEntry : folder.listFiles()) {\n\t\t\tif (fileEntry.isDirectory()) {\n\t\t\t\tlistFilesForFolder(fileEntry);\n\t\t\t} else if (!fileEntry.getName().startsWith(\".\")) {\n\t\t\t\tRunConfigDataNode temp = new RunConfigDataNode(null);\n\t\t\t\ttemp.setName(fileEntry.getName());\n\t\t\t\ttemp.setSerializeDestination(serializePath);\n\t\t\t\tString name = fileEntry.getName();\n\t\t\t\tif (!name.equals(\"entries\")) {\n\t\t\t\t\tRunConfigDataNode config = temp.deserialize();\n\t\t\t\t\tif (!config.isMarkedForDelete()) {\n\t\t\t\t\t\tsavedConfigs.put(name, config);\n\t\t\t\t\t\tnewConfigsNum++;\n\t\t\t\t\t}\n\t\t\t\t\t// if the config is marked for delete, delete it.\n\t\t\t\t\telse {\n\t\t\t\t\t\tfileEntry.delete();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private void processFolder(File folder) {\n \t\tFile[] subFolders = folder.listFiles(new FileFilter() {\n \t\t\t@Override\n \t\t\tpublic boolean accept(File pathname) {\n \t\t\t\treturn pathname.isDirectory();\n \t\t\t}\n \t\t});\n \t\tfor (File subFolder : subFolders){\n \t\t\tprocessFolder(subFolder); \n \t\t}\n \t\tPattern nameRegex = Pattern.compile(\"([\\\\d-]+)\\\\.(pdf|epub)\", Pattern.CANON_EQ | Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);\n \t\tFile[] files = folder.listFiles();\n \t\tfor (File file : files) {\n \t\t\tlogger.info(\"Processing file \" + file.getName());\n \t\t\tprocessLog.addNote(\"Processing file \" + file.getName());\n \t\t\tif (file.isDirectory()) {\n \t\t\t\t//TODO: Determine how to deal with nested folders?\n \t\t\t\t//processFolder(file);\n \t\t\t} else {\n \t\t\t\t// File check to see if it is of a known type\n \t\t\t\tMatcher nameMatcher = nameRegex.matcher(file.getName());\n \t\t\t\tif (nameMatcher.matches()) {\n \t\t\t\t\tImportResult importResult = new ImportResult();\n \t\t\t\t\tString isbn = nameMatcher.group(1);\n \t\t\t\t\tString fileType = nameMatcher.group(2).toLowerCase();\n \t\t\t\t\timportResult.setBaseFilename(isbn);\n \t\t\t\t\tisbn = isbn.replaceAll(\"-\", \"\");\n \t\t\t\t\timportResult.setISBN(isbn);\n \t\t\t\t\timportResult.setCoverImported(\"\");\n \t\t\t\t\t\n \t\t\t\t\ttry {\n \t\t\t\t\t\t// Get the record for the isbn\n \t\t\t\t\t\tgetRelatedRecords.setString(1, \"%\" + isbn + \"%\");\n \t\t\t\t\t\tResultSet existingRecords = getRelatedRecords.executeQuery();\n \t\t\t\t\t\tif (!existingRecords.next()){\n \t\t\t\t\t\t\t//No record found \n \t\t\t\t\t\t\tlogger.info(\"Could not find record for ISBN \" + isbn);\n \t\t\t\t\t\t\timportResult.setStatus(fileType, \"failed\", \"Could not find record for ISBN \" + isbn);\n \t\t\t\t\t\t\tprocessLog.incErrors();\n \t\t\t\t\t\t\tprocessLog.addNote(\"Could not find record for ISBN \" + isbn);\n \t\t\t\t\t\t}else{\n \t\t\t\t\t\t\tlogger.info(\"Found at least one record for \" + isbn);\n \t\t\t\t\t\t\tif (existingRecords.last()){\n \t\t\t\t\t\t\t\tif (existingRecords.getRow() >= 2){\n \t\t\t\t\t\t\t\t\tlogger.info(\"Multiple records were found for ISBN \" + isbn);\n \t\t\t\t\t\t\t\t\timportResult.setStatus(fileType, \"failed\", \"Multiple records were found for ISBN \" + isbn);\n \t\t\t\t\t\t\t\t\tprocessLog.incErrors();\n \t\t\t\t\t\t\t\t\tprocessLog.addNote(\"Multiple records were found for ISBN \" + isbn);\n \t\t\t\t\t\t\t\t}else{\n \t\t\t\t\t\t\t\t\t//We have an existing record\n \t\t\t\t\t\t\t\t\texistingRecords.first();\n \t\t\t\t\t\t\t\t\tString recordId = existingRecords.getString(\"id\");\n \t\t\t\t\t\t\t\t\tString accessType = existingRecords.getString(\"accessType\");\n \t\t\t\t\t\t\t\t\tString source = existingRecords.getString(\"source\");\n \t\t\t\t\t\t\t\t\tlogger.info(\" Attaching file to \" + recordId + \" accessType = \" + accessType + \" source=\" + source);\n \t\t\t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\t\t// Copy the file to the library if it does not exist already\n \t\t\t\t\t\t\t\t\tFile resultsFile = new File(libraryDirectory + source + \"_\" + file.getName());\n \t\t\t\t\t\t\t\t\tif (resultsFile.exists()) {\n \t\t\t\t\t\t\t\t\t\tlogger.info(\"Skipping file because it already exists in the library\");\n \t\t\t\t\t\t\t\t\t\timportResult.setStatus(fileType, \"skipped\" ,\"File has already been copied to library\");\n \t\t\t\t\t\t\t\t\t\tprocessLog.addNote(\"Skipping file \" + file.getName() + \" because it already exists in the library\");\n \t\t\t\t\t\t\t\t\t} else {\n \t\t\t\t\t\t\t\t\t\tlogger.info(\"Importing file \" + file.getName());\n \t\t\t\t\t\t\t\t\t\t//Check to see if the file has already been added to the library.\n \t\t\t\t\t\t\t\t\t\tdoesItemExist.setString(1, file.getName());\n \t\t\t\t\t\t\t\t\t\tdoesItemExist.setString(2, recordId);\n \t\t\t\t\t\t\t\t\t\tResultSet existingItems = doesItemExist.executeQuery();\n \t\t\t\t\t\t\t\t\t\tif (existingItems.next()){\n \t\t\t\t\t\t\t\t\t\t\t//The item already exists\n \t\t\t\t\t\t\t\t\t\t\tlogger.info(\" the file has already been attached to this record\");\n \t\t\t\t\t\t\t\t\t\t\timportResult.setStatus(fileType, \"skipped\" ,\"The file has already been aded as an eContent Item\");\n \t\t\t\t\t\t\t\t\t\t\tprocessLog.addNote(\"Skipping file \" + file.getName() + \" because has already been attached to this record\");\n \t\t\t\t\t\t\t\t\t\t}else{\n \t\t\t\t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\t\t\t\ttry {\n \t\t\t\t\t\t\t\t\t\t\t\tlogger.info(\" copying the file to library source=\" + file + \" dest=\" + resultsFile);\n \t\t\t\t\t\t\t\t\t\t\t\t//Copy the pdf file to the library\n \t\t\t\t\t\t\t\t\t\t\t\tUtil.copyFile(file, resultsFile);\n \t\t\t\t\t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\t\t\t\t\t//Add file to acs server\n \t\t\t\t\t\t\t\t\t\t\t\tboolean addedToAcs = true;\n \t\t\t\t\t\t\t\t\t\t\t\tif (accessType.equals(\"acs\")){\n \t\t\t\t\t\t\t\t\t\t\t\t\tlogger.info(\"Adding file to the ACS server\");\n \t\t\t\t\t\t\t\t\t\t\t\t\taddedToAcs = addFileToAcsServer(fileType, resultsFile, importResult);\n \t\t\t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\t\t\t\t\tif (addedToAcs){\n \t\t\t\t\t\t\t\t\t\t\t\t\t//filename, acsId, recordId, item_type, addedBy, date_added, date_updated\n \t\t\t\t\t\t\t\t\t\t\t\t\tlong curTimeSec = new Date().getTime() / 1000;\n \t\t\t\t\t\t\t\t\t\t\t\t\taddEContentItem.setString(1, resultsFile.getName());\n \t\t\t\t\t\t\t\t\t\t\t\t\taddEContentItem.setString(2, importResult.getAcsId());\n \t\t\t\t\t\t\t\t\t\t\t\t\taddEContentItem.setString(3, recordId);\n \t\t\t\t\t\t\t\t\t\t\t\t\taddEContentItem.setString(4, fileType);\n \t\t\t\t\t\t\t\t\t\t\t\t\taddEContentItem.setLong(5, -1);\n \t\t\t\t\t\t\t\t\t\t\t\t\taddEContentItem.setLong(6, curTimeSec);\n \t\t\t\t\t\t\t\t\t\t\t\t\taddEContentItem.setLong(7, curTimeSec);\n \t\t\t\t\t\t\t\t\t\t\t\t\tint rowsInserted = addEContentItem.executeUpdate();\n \t\t\t\t\t\t\t\t\t\t\t\t\tif (rowsInserted == 1){\n \t\t\t\t\t\t\t\t\t\t\t\t\t\timportResult.setStatus(fileType, \"success\", \"\");\n \t\t\t\t\t\t\t\t\t\t\t\t\t\tlogger.info(\" added to the database\");\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\t\t\t\t\t\t}else{\n \t\t\t\t\t\t\t\t\t\t\t\t\t\tlogger.info(\" file could not be added to the database\");\n \t\t\t\t\t\t\t\t\t\t\t\t\t\tprocessLog.addNote(file.getName() + \" could not be added to the database\");\n \t\t\t\t\t\t\t\t\t\t\t\t\t\tprocessLog.incErrors();\n \t\t\t\t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t\t\t\t}else{\n \t\t\t\t\t\t\t\t\t\t\t\t\tlogger.info(\" the file could not be added to the acs server\");\n \t\t\t\t\t\t\t\t\t\t\t\t\tprocessLog.addNote(file.getName() + \" could not be added to the acs server\");\n \t\t\t\t\t\t\t\t\t\t\t\t\tprocessLog.incErrors();\n \t\t\t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\t\t\t\t\tif (importResult.getSatus(fileType).equals(\"failed\")){\n \t\t\t\t\t\t\t\t\t\t\t\t\t//If we weren't able to add the file correctly, remove it so it will be processed next time. \n \t\t\t\t\t\t\t\t\t\t\t\t\tresultsFile.delete();\n \t\t\t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\t\t\t\t} catch (IOException e) {\n \t\t\t\t\t\t\t\t\t\t\t\tlogger.error(\"Error copying file to record\", e);\n \t\t\t\t\t\t\t\t\t\t\t\timportResult.setStatus(fileType, \"failed\", \"Error copying file \" + e.toString());\n \t\t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t}\n \t\t\t\t\t} catch (SQLException e) {\n \t\t\t\t\t\tlogger.error(\"Error finding related records\", e);\n \t\t\t\t\t\timportResult.setStatus(\"pdf\", \"failed\", \"SQL error processing file \" + e.toString());\n \t\t\t\t\t}\n \t\t\t\t\timportResults.add(importResult);\n \t\t\t\t\t//Update that another file has been processed.\n \t\t\t\t\tprocessLog.incUpdated();\n \t\t\t\t\ttry {\n \t\t\t\t\t\tupdateRecordsProcessed.setLong(1, processLog.getNumUpdates());\n \t\t\t\t\t\tupdateRecordsProcessed.setLong(2, processLog.getNumErrors());\n \t\t\t\t\t\tupdateRecordsProcessed.setLong(3, logEntryId);\n \t\t\t\t\t\tupdateRecordsProcessed.executeUpdate();\n \t\t\t\t\t} catch (SQLException e) {\n \t\t\t\t\t\tlogger.error(\"Error updating number of records processed.\", e);\n \t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\tprocessLog.addNote(\" Skipping because the name is not an ISBN\");\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\t\n \t}", "public void setSheetName(String name){\n this.sheetName = name;\n }", "private static void enterFolder(File folder, int i, GameFile gameFile) throws IOException {\r\n\t\tfor(File f: folder.listFiles()) { //loops through all files in a folder folder\r\n\t\t\tif(f.isFile()) { //if the file is not a folder just use the file\r\n\t\t\t\tBufferedReader br = new BufferedReader(new FileReader(f));\r\n\t\t\t\tString path = f.getPath();\r\n\t\t\t\tString field = path.substring(path.indexOf(\"\\\\\")+1, path.lastIndexOf(\"\\\\\")).replace(\"\\\\\", \".\")+\"?\";\r\n\t\t\t\tread(br, field, \"\", i, gameFile);\r\n\t\t\t} else { //otherwise repeat with the current file\r\n\t\t\t\tenterFolder(f, i+1, gameFile);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public List<List<String>> readXlsx(String path) throws IOException {\n\t\tSystem.out.println(\"read excel 2010\");\n\t\tInputStream is = new FileInputStream(path);\n\t\tXSSFWorkbook xssfWorkbook = new XSSFWorkbook(is);\n\t\tList<List<String>> list = new ArrayList<List<String>>();\n\t\t// Read the Sheet\n\t\tfor (int numSheet = 0; numSheet < xssfWorkbook.getNumberOfSheets(); numSheet++) {\n\t\t\tXSSFSheet xssfSheet = xssfWorkbook.getSheetAt(numSheet);\n\t\t\tif (xssfSheet == null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// Read the Row\n\t\t\tfor (int rowNum = 1; rowNum <= xssfSheet.getLastRowNum(); rowNum++) {\n\t\t\t\tXSSFRow xssfRow = xssfSheet.getRow(rowNum);\n\t\t\t\tif (xssfRow != null) {\n\t\t\t\t\tList<String> rowList = new ArrayList<String>();\n\t\t\t\t\tfor(int cellNum=0;cellNum<xssfRow.getLastCellNum();cellNum++){\n\t\t\t\t\t\trowList.add(getValue(xssfRow.getCell(cellNum)));\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tlist.add(rowList);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn list;\n\t}", "void readData(String dataFilename) {\n System.out.println(\"NormalizedStorySheetsHandler\");\n InputStream is = null;\n try {\n is = new FileInputStream(dataFilename);\n Workbook wb = WorkbookFactory.create(is);\n Sheet rolesSheet = wb.getSheet(\"Role\");\n Sheet goalsSheet = wb.getSheet(\"Goal\");\n Sheet benefitsSheet = wb.getSheet(\"Benefit\");\n Sheet criteriaSheet = wb.getSheet(\"Criterion\");\n readRows(roles, rolesSheet);\n readRows(goals, goalsSheet);\n readRows(benefits, benefitsSheet);\n readRows(criteria, criteriaSheet);\n } catch (Exception e) {\n System.out.println(e.getMessage());\n } finally {\n try {\n if (is != null) {\n is.close();\n }\n } catch (Exception e) {\n System.out.println(e.getMessage());\n }\n }\n }", "public void loadGuilds(Collection<Server> guilds) {\n\t\tfor (var guild : guilds) {\n\t\t\tvar file = dir.resolve(guild.getId() + \".json\");\n\t\t\tvar config = GuildConfig.loadOrCreate(guild, file);\n\t\t\tthis.guilds.put(guild.getId(), config);\n\t\t\tlog.info(\"Loaded guild config for guild {} ({}).\", guild.getName(), guild.getId());\n\t\t}\n\t}", "public static void setExcelFileSheet(String sheetName) throws IOException {\n\t testDataExcelPath = currentDir+\"\\\\src\\\\example\\\\trademeSellAndBuy\\\\testData\\\\\";\n\t // Open the Excel file\n FileInputStream excelFile = new FileInputStream(new File(testDataExcelPath + testDataExcelFileName));\n excelWBook = new XSSFWorkbook(excelFile);\n excelWSheet = (XSSFSheet) excelWBook.getSheet(sheetName);\n }", "public static void load() {\n\t\tspritesheet = new Spritesheet(\"src/de/kaffeeliebhaber/assets/pyxel/voland_spritesheet_new.png\", 32, 32);\n\t\tspritesheet.load();\n\t\t\n\t\t// load player\n\t\tAssetsLoader.loadPlayerAssets();\n\t\t\n\t\t// load crate\n\t\tAssetsLoader.loadCrates();\n\t\t\n\t\t// load item spritesheet \n\t\tspritesheetInventory = new Spritesheet(Config.ITEM_SPRITESHEET, Config.ITEM_SIZE, Config.ITEM_SIZE);\n\t\tspritesheetInventory.load();\n\t\t\n\t\t// load font \n\t\tloadFonts();\n\t\t\n\t\t// ui\n\t\timageUI = ImageLoader.loadImage(\"src/de/kaffeeliebhaber/assets/ui/ui.png\");\n\t\t\n\t\tAssetsLoader.loadInfoPaneAssets();\n\t\t\n\t\t// npc\n\t\tspritesheetNPC = new Spritesheet(\"src/de/kaffeeliebhaber/assets/AH_SpriteSheet_People1.png\", 16, 16);\n\t\tspritesheetNPC.load();\n\t\t\n\t\t// fox\n\t\tspritesheetNPCFox = new Spritesheet(\"src/de/kaffeeliebhaber/assets/imgs/72c68863962b7a6b5a9f5f5bcc5afb16.png\", 32, 32);\n\t\tspritesheetNPCFox.load();\n\n\t\t// *** LOAD NPCs\n\t\tAssetsLoader.loadFoxAssets();\n\t\t\n\t\tAssetsLoader.loadNPCs();\n\t\t\n\t\tspritesheetFemale = new Spritesheet(\"src/de/kaffeeliebhaber/assets/imgs/Female 01-1.png\", 32, 32);\n\t\tspritesheetFemale.load();\n\t}", "public void load() {\n loadDisabledWorlds();\n chunks.clear();\n for (World world : ObsidianDestroyer.getInstance().getServer().getWorlds()) {\n for (Chunk chunk : world.getLoadedChunks()) {\n loadChunk(chunk);\n }\n }\n }", "public void LoadDirectory(String folder, String suffix)\n\t\t\tthrows org.xml.sax.SAXException, SAXException {\n\t\tFile dir = new File(folder);\n\t\tint size = m_reviews.size();\n\t\tfor (File f : dir.listFiles()) {\n\t\t\tString name = f.getName();\n\t\t\tif (f.isFile() && name.endsWith(suffix)) {\n\t\t\t\tmovie_names.add(name.substring(0, name.length() - 4));\n\t\t\t\tanalyzeDocument(LoadXML(f.getAbsolutePath()));\n\t\t\t} else if (f.isDirectory())\n\t\t\t\tLoadDirectory(f.getAbsolutePath(), suffix);\n\t\t}\n\t\tsize = m_reviews.size() - size;\n\t\tSystem.out.println(\"Loading \" + size + \" review documents from \"\n\t\t\t\t+ folder);\n\t}", "public void setExcelFile(String excelfilepath,String Sheetname) throws IOException {\n\t\t File file=new File(excelfilepath);\n\t\t FileInputStream inputstream=new FileInputStream(file);\n\t\t workbook =new XSSFWorkbook(inputstream);\n\t\t sheet =workbook.getSheet(Sheetname);\n\n\t}", "public void loadJobFiles(Job job, String mask) throws IOException {\n\t\tif(mask == null || mask.trim().isEmpty()) {\n\t\t\tmask = \"*\";\n\t\t}\n\t\tCore.loadJobFiles(job, mask, getHttpMethodExecutor());\n\t}", "public void loadFiles(String location) {\r\n files = new ArrayList<>();\r\n try {\r\n // определяем объект для каталога\r\n File dir = new File(location);\r\n String[] listOfFiles = dir.list();\r\n if(dir.isDirectory()) {\r\n \tSystem.out.println(\"Dir: \" + dir.getAbsolutePath());\r\n \ttestWriter.write(\"Dir: \" + dir.getAbsolutePath());\r\n }\r\n for(File i : dir.listFiles()) {\r\n System.out.println(\"SubDir: \" + i.getAbsolutePath());\r\n for(File j : i.listFiles()) {\r\n files.add(new File(j.getAbsolutePath()));\r\n System.out.println(\"File: \" + j.getAbsolutePath() + \" is loaded\");\r\n testWriter.write(\"File: \" + j.getAbsolutePath() + \" is loaded\");\r\n }\r\n }\r\n }\r\n catch(NullPointerException e) {\r\n System.err.println(\"Error while loading file\");\r\n e.printStackTrace();\r\n } catch (IOException e) {\r\n \tSystem.err.println(\"Error while writing to log file\");\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n }", "private void addStyles(String dir, boolean recurse) {\n File dirF = new File(dir);\n if (dirF.isDirectory()) {\n File[] files = dirF.listFiles();\n for (File file : files) {\n // If the file looks like a style file, parse it:\n if (!file.isDirectory() && (file.getName().endsWith(StyleSelectDialog.STYLE_FILE_EXTENSION))) {\n addSingleFile(file);\n }\n // If the file is a directory, and we should recurse, do:\n else if (file.isDirectory() && recurse) {\n addStyles(file.getPath(), recurse);\n }\n }\n }\n else {\n // The file wasn't a directory, so we simply parse it:\n addSingleFile(dirF);\n }\n }", "public void CreateXLSLibrary(String path) \n\t{\n\t\t\tthis.path=path;\n\t\t\ttry \n\t\t\t{\n\t\t\t\tfis = new FileInputStream(path);\n\t\t\t\tworkbook = new XSSFWorkbook(fis);\n\t\t\t\tsheet = workbook.getSheetAt(0);\n\t\t\t\tfis.close();\n\t\t\t} \n\t\t\tcatch (Exception e) \n\t\t\t{\n\t\t\t\te.printStackTrace();\n\t\t\t} \n\t\n\t}", "protected void load(SpriteInfo[] arr) {\n\t\tassert arr != null;\n\t\tassert arr.length > 0;\n\n\t\tfor (SpriteInfo s : arr) {\n\t\t\tassert s != null;\n\t\t\tsprites.put(s.name, sheet.getSubimage(s.getX(), s.getY(), s.getWidth(), s.getHeight()));\n\t\t}\n\t}", "protected abstract Collection<Cache> loadCaches();", "List<? extends ISheet> getSheetList();", "public static Sheets getSheetsService() throws IOException {\n Credential credential = authorize();\n return new Sheets.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential)\n .setApplicationName(APPLICATION_NAME)\n .build();\n }", "private void importAll() {\n\t\tfinal JFileChooser chooser = new JFileChooser(System.getProperty(\"user.home\"));\n\t\tint returnVal = chooser.showOpenDialog(null);\n\t\tif(returnVal == JFileChooser.APPROVE_OPTION) {\n\t\t\tFile file = chooser.getSelectedFile();\n\t\t\tdeserializeFile(file);\n\t\t\t // imported the projects for this application from a file, so update what should be persisted on close\n\t\t\tupdatePersistence();\n\t\t}\n\t}", "private void loadLists() {\n loadSavedCourses();\n loadSavedSchedules();\n }", "public static void loadFilesFromClasspath(final String dirFile)\n\t{\n\n\t\t// You can uncomment this for local \n\t\t// but DO NOT CHECK IT IN UNCOMMENTED\n\t\t//\t if(\"true\".equals(\"true\")){\n\t\t//\t\t\tloadFilesFromClasspathLocalEnv(dirFile);\n\t\t//\t\t\treturn; \n\t\t//\t\t}\n\t\ttry\n\t\t{\n\t\t\tlogger.info(\"loading files from \" + dirFile);\n\t\t\tfinal PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(classLoader);\n\t\t\tfinal Resource[] resources = resolver.getResources(dirFile + \"/**/*.xsl\");\n\t\t\tif (resources == null)\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tResource resource;\n\t\t\tfor (int i = 0; i < resources.length; i++)\n\t\t\t{\n\t\t\t\tresource = resources[i];\n\t\t\t\tlogger.info(\"found a file to load: \" + resource.getFilename());\n\n\t\t\t\tfinal URL url = resource.getURL();\n\t\t\t\tif (ResourceUtils.isJarURL(url))\n\t\t\t\t{\n\t\t\t\t\tfinal InputStream inputStream = resource.getInputStream();\n\t\t\t\t\tcreateTransformer(inputStream, resource.getDescription());\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tInputStream inputStream = classLoader.getResourceAsStream(resource.getFilename());\n\t\t\t\t\tif (inputStream == null)\n\t\t\t\t\t{\n\t\t\t\t\t\tinputStream = resource.getInputStream();\n\t\t\t\t\t}\n\t\t\t\t\tcreateTransformer(inputStream, resource.getDescription(), resource);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcatch (final Exception e)\n\t\t{\n\t\t\tlogger.warn(\"Unable to load files from \" + dirFile + \" :reason: \", e);\n\t\t}\n\n\t}", "public void setAllFiles(HashMap<String, String> allFiles) {\n _allFiles = allFiles;\n }", "public void init(){\n\t\tm_Folders = new ArrayList<Folder>();\n\t\n\t\tm_Folders.add(new Folder(\"Inbox\"));\n\t\tm_Folders.add(new Folder(\"Today\"));\n\t\tm_Folders.add(new Folder(\"Next\"));\n\t\tm_Folders.add(new Folder(\"Someday/Maybe\"));\t\t\n\t}", "public List<TimeSheet> showAllTimeSheet(){\n log.info(\"Inside TimeSheetService#ShowAllTimeSheet() Method\");\n List<TimeSheet> allTimeSheet = timeSheetRepository.findAll();\n return allTimeSheet;\n }", "public void loadLayers(String axl)\n throws java.rmi.RemoteException\n {\n loadLayersWithLayoutProject(axl, _layoutProj);\n }", "public static void fillCache(DataTable table) throws Exception {\n SheetDefC.setListt(Crud.SheetDefCrud.TableToList(table));\n }", "public void processFiles(){\n\t\tfor(String fileName : files) {\n\t\t\ttry {\n\t\t\t\tloadDataFromFile(fileName);\n\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\tSystem.out.println(\"Can't open file: \" + fileName);\n\t\t\t\tSystem.out.println();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tprintInOrder();\n\t\t\tstudents.clear();\n\t\t}\n\t}", "private void loadMap(ArrayList<Sprite> allSprites) {\n\t\tint numTargets = 0;\n\t\t\n\t\tfor (Sprite thisSprite : allSprites) {\n\t\t\tif(!(thisSprite instanceof Explosion)) {\n\t\t\t\tputInCell(thisSprite.getX(), thisSprite.getY(), thisSprite);\n\t\t\t}\n\t\t\tif (thisSprite instanceof Target) {\n\t\t\t\tnumTargets++;\n\t\t\t}\n\t\t\tif(thisSprite instanceof Door) {\n\t\t\t\tthis.theDoor = (Door)thisSprite;\n\t\t\t}\n\t\t\tif(thisSprite instanceof Player) {\n\t\t\t\tthis.thePlayer = (Player)thisSprite;\n\t\t\t}\n\t\t}\n\t\tthis.numTargets = numTargets;\n\t}", "public void loadSavedConfigsMap() {\n\t\tfinal File folder = new File(serializePath);\n\t\tlistFilesForFolder(folder);\n\t}", "private void loadGameFiles(){\n\t}", "@Override\n\tpublic synchronized void initialize() {\n\t\tFile[] files = mRootDirectory.listFiles();\n\t\tif (files == null) {\n\t\t\treturn;\n\t\t}\n\t\tfor (File file : files) {\n\t\t\tFileInputStream fis = null;\n\t\t\ttry {\n\t\t\t\tfis = new FileInputStream(file);\n\t\t\t\tCacheHeader entry = CacheHeader.readHeader(fis);\n\t\t\t\tentry.size = file.length();\n\t\t\t\tputEntry(entry.key, entry);\n\t\t\t} catch (IOException e) {\n\t\t\t\tif (file != null) {\n\t\t\t\t\tfile.delete();\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\ttry {\n\t\t\t\t\tif (fis != null) {\n\t\t\t\t\t\tfis.close();\n\t\t\t\t\t}\n\t\t\t\t} catch (IOException ignored) {\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private void refreshList() {\n setTitle(this.path.get(this.path.size() - 1));\n\n // Read all files sorted into the values-array\n values.clear();\n File dir = new File(this.path.get(this.path.size() - 1));\n if (!dir.canRead()) {\n setTitle(getTitle() + \" (inaccessible)\");\n }\n String[] list = dir.list();\n if (list != null) {\n for (String file : list) {\n if (!file.startsWith(\".\")) {\n values.add(file);\n }\n }\n }\n Collections.sort(values);\n }", "public static void goThroughFilesForFolder(final File folder) throws Exception {\r\n\r\n\t\t/*\r\n\t\t * char[] filePath;\r\n\t\t// *Files.walk(Paths.get(\"E:/Studying/eclipse/workspace/Thesis/PMIDs\")).\r\n\t\t * Files.walk(Paths.get(\"E:/Studying/Box Sync/workspace/Thesis/PMIDs\")).\r\n\t\t * forEach(filePath -> { if (Files.isRegularFile(filePath)) {\r\n\t\t * System.out.println(filePath); } }\r\n\t\t */\r\n\t\t// /*\r\n\t\tfor (final File fileEntry : folder.listFiles()) {\r\n\t\t\tif (fileEntry.isDirectory()) {\r\n\t\t\t\tgoThroughFilesForFolder(fileEntry);\r\n\t\t\t} else {\r\n\t\t\t\tprocessFile(fileEntry);\r\n\t\t\t\t// System.out.println(fileEntry.getName());\r\n\t\t\t}\r\n\t\t}\r\n\t\t// */\r\n\t}", "private void scanAllDirectories()\n throws IOException, InstanceNotFoundException {\n\n int errcount = 0;\n final StringBuilder b = new StringBuilder();\n for (ObjectName key : scanmap.keySet()) {\n final DirectoryScannerMXBean s = scanmap.get(key);\n try {\n if (state == STOPPED) return;\n s.scan();\n } catch (Exception ex) {\n LOG.log(Level.FINE,key + \" failed to scan: \"+ex,ex);\n errcount++;\n append(b,\"\\t\",ex);\n }\n }\n if (errcount > 0) {\n b.insert(0,\"scan partially performed with \"+errcount+\" error(s):\");\n throw new RuntimeException(b.toString());\n }\n }", "public void setSheetNameForGermplasm(String sheetName);", "public void loadExternalRepositories() {\n\t\tString envExternalRepsString = System.getenv(\"ODFI_DOCBOOK_STYLESHEETS_REPS\");\r\n\t\tif (envExternalRepsString!=null) {\r\n\t\t\tString[] externalEnvReps = envExternalRepsString.split(\"\"+File.pathSeparatorChar);\r\n\t\t\tfor (String rep : externalEnvReps) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tthis.loadRepository(rep);\r\n\t\t\t\t} catch (Exception e) {\r\n\t\t\t\t\t// Remove wrong URL\r\n\t\t\t\t\t//it.remove();\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t/*\r\n\t\t// Load Preferences with Environment variable if there is one, otherwise don't touch it\r\n\t\t//---------------------\r\n\t\tString envExternalReps = System.getenv(DocbookPlugin.ENV_EXTERNAL_REPS);\r\n\t\tif (envExternalReps!=null) {\r\n\t\t\tDocbookPlugin.getDefault().getPreferenceStore().setDefault(\"reps.external.env\", envExternalReps);\r\n\t\t}\r\n\t\t\r\n\t\t// Do we have any manually added stylesheets repositories?\r\n\t\t//-----------------------\r\n\t\tString externalAddedRepsString = DocbookPlugin.getDefault().getPreferenceStore().getString(\"reps.external.added\");\r\n\t\tString externalEnvRepsString = DocbookPlugin.getDefault().getPreferenceStore().getString(\"reps.external.env\");\r\n\r\n\t\t\r\n\t\t// Parse the repositories\r\n\t\t//----------------------------------\r\n\t\tString[] externalEnvReps = externalEnvRepsString.split(\";\");\r\n\t\tArrayIterator<String> it = new ArrayIterator<String>(externalEnvReps);\r\n\t\twhile (it.hasNext()) {\r\n\t\t\tString rep = it.next();\r\n\t\t\ttry {\r\n\t\t\t\tthis.loadRepository(rep);\r\n\t\t\t} catch (Exception e) {\r\n\t\t\t\t// Remove wrong URL\r\n\t\t\t\t//it.remove();\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tString[] externalAddedReps = externalAddedRepsString.split(\";\");\r\n\t\tit = new ArrayIterator<String>(externalAddedReps);\r\n\t\twhile (it.hasNext()) {\r\n\t\t\tString rep = it.next();\r\n\t\t\ttry {\r\n\t\t\t\tthis.loadRepository(rep);\r\n\t\t\t} catch (Exception e) {\r\n\t\t\t\t// Remove wrong URL\r\n\t\t\t\t//it.remove();\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t} \r\n\t\t}\r\n\t\t\r\n\t\t// Resave in case we cleaned them\r\n\t\t//-------------------------------------\r\n\t\t*/\r\n\t\t\r\n\t\t\r\n\t}", "public static NodeList getSpriteSheetParsed(String path) {\r\n\t\tNodeList nlist = null;\r\n\t\tDocument doc = null;\r\n\t\tFile file = new File(path);\r\n\r\n\t\ttry {\r\n\t\t\tDocumentBuilder builder = factory.newDocumentBuilder();\r\n\r\n\t\t\tdoc = builder.parse(file);\r\n\r\n\t\t\tnlist = doc.getElementsByTagName(\"Cell\");\r\n\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\r\n\t\treturn nlist;\r\n\t}", "public void loadTables(String tsvFilesDir) throws IOException, SQLException{\n\t\t\n\t\tFile data = new File(tsvFilesDir);\n\t\t\n\t\tFile[] tables = data.listFiles(new FileFilter() {\n\t\t\t\n\t\t\tpublic boolean accept(File pathname) {\n\t\t\t\treturn !pathname.isDirectory() && pathname.getName().endsWith(\".txt\");\n\t\t\t}\n\t\t});\n\t\t\n\t\tfor(File table: tables){\n\t\t\tloadTable(table);\n\t\t}\n\t}", "private void loadFolderPressed() {\n\n\t\t// open a jfile chooser and then go through the directory chosen\n\t\t// then load all the video and audio files in that directory\n\n\t\tFile chosenDirectory =null;\n\n\t\t// choose a directory only\n\t\tJFileChooser chooser = new JFileChooser();\n\t\tchooser.setCurrentDirectory(new java.io.File(\".\"));\n\t\tchooser.setDialogTitle(\"Choose Directory\");\n\t\tchooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);\n\t\tint response = chooser.showOpenDialog(Library.this);\n\t\tif (response == JFileChooser.APPROVE_OPTION) {\n\t\t\t// Chose the directory to save to\n\t\t\tchosenDirectory = chooser.getSelectedFile().getAbsoluteFile();\n\t\t}\n\t\tif(chosenDirectory != null){\n\t\t\t// go through the chosen directory and get all the files\n\t\t\tl.clear();\n\t\t\tFile[] directoryListing = chosenDirectory.listFiles();\n\t\t\tif (directoryListing != null) {\n\n\t\t\t\t// check if that file chosen currently is a media file. If it is then\n\t\t\t\t// add it to the list\n\t\t\t\tInvalidCheck ic = new InvalidCheck();\n\n\t\t\t\tfor(File f : directoryListing){\n\t\t\t\t\tboolean isValid = ic.invalidCheck(f.getAbsolutePath());\n\n\t\t\t\t\tif(isValid){\n\t\t\t\t\t\tlistFolder.add(f);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor(File f2 : listFolder){\n\t\t\t\t\tSystem.out.println(f2.getName());\n\t\t\t\t}\n\n\t\t\t\t// get the paths and sizes of the media files.\n\t\t\t\tfor(File f : listFolder){\n\t\t\t\t\t// only put the file in if it is not size 0 so that any bad files are avoided.\n\t\t\t\t\tif(f.length() != 0){\n\t\t\t\t\t\tl.addElement(f.getName());\n\t\t\t\t\t\tpaths.put(f.getName(),f.getAbsoluteFile());\n\t\t\t\t\t\tsizes.put(f.getName(), f.length());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "ISheet addSheet();", "@Scheduled(fixedRate = 5000)\n public void refreshAllIndex() {\n\n HashMap<String, String> dictlist = new HashMap<>();\n\n //get the file list\n try {\n dictlist = FileUtil.subFolderList(fieryConfig.getIndexpath());\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n //load all index if not contain on folder\n for (Map.Entry<String, String> e : dictlist.entrySet()) {\n String foldername = e.getKey();\n String folderpath = e.getValue();\n if (!readerList.containsKey(foldername)) {\n log.info(\"start load index foldername:\" + foldername + \" abspath:\" + folderpath);\n //open index\n boolean ret = this.openIndex(foldername, folderpath);\n\n //warning this may cause bug\n //loaded fail? clean it\n if (!ret) {\n FileUtil.deleteDir(folderpath);\n }\n }\n }\n\n\n /////////////////////\n // recycle expire index\n /////////////////////\n for (Map.Entry<String, DirectoryReader> e : readerList.entrySet()) {\n String dbname = e.getKey();\n\n try {\n Long dbtime = Long.parseLong(dbname);\n\n if (dbtime < DateTimeHepler.getBeforDay(fieryConfig.getKeepdataday())) {\n //closed all\n if (analyzerList.containsKey(dbname)) {\n analyzerList.get(dbname).close();\n analyzerList.remove(dbname);\n }\n if (directorList.containsKey(dbname)) {\n directorList.get(dbname).close();\n directorList.remove(dbname);\n }\n if (readerList.containsKey(dbname)) {\n readerList.get(dbname).close();\n readerList.remove(dbname);\n }\n\n //remove the folder\n FileUtil.deleteDir(fieryConfig.getIndexpath() + \"/\" + dbname);\n }\n } catch (Exception ex) {\n ex.printStackTrace();\n }\n }\n\n\n /////////////////////\n // refresh already loaded index\n /////////////////////\n for (Map.Entry<String, DirectoryReader> e : readerList.entrySet()) {\n\n String dbname = e.getKey();\n DirectoryReader diskReader = e.getValue();\n\n try {\n Date start = new Date();\n\n DirectoryReader tmp = DirectoryReader.openIfChanged(diskReader);\n if (tmp != null) {\n diskReader.close();\n diskReader = tmp;\n readerList.put(dbname, diskReader);\n Date end = new Date();\n log.info(\"Reload Index:\" + dbname + \" cost:\" + (end.getTime() - start.getTime()) + \" totalcount:\" + diskReader.numDocs());\n }\n\n } catch (Exception exx) {\n exx.printStackTrace();\n log.error(exx.getMessage());\n }\n }\n /////////////////////\n //refresh the all in one searcher\n /////////////////////\n\n this.reloadSearch();\n\n }", "private void loadLogs(List<File> dirs) {\n for (File dir : dirs) {\n Map<TopicAndPartition, Long> recoveryPoints = this.recoveryPointCheckpoints.get(dir).read();\n /* load the logs */\n File[] subDirs = dir.listFiles();\n if (subDirs != null) {\n File cleanShutDownFile = new File(dir, Logs.CleanShutdownFile);\n if (cleanShutDownFile.exists())\n logger.info(\"Found clean shutdown file. Skipping recovery for all logs in data directory '{}'\", dir.getAbsolutePath());\n for (File subDir : subDirs) {\n if (subDir.isDirectory()) {\n logger.info(\"Loading log '\" + subDir.getName() + \"'\");\n TopicAndPartition topicPartition = parseTopicPartitionName(subDir.getName());\n LogConfig config = Utils.getOrElse(topicConfigs, topicPartition.topic, defaultConfig);\n Log log = new Log(subDir, config, Utils.getOrElse(recoveryPoints, topicPartition, 0L), scheduler, time);\n Log previous = this.logs.put(topicPartition, log);\n if (previous != null)\n throw new IllegalArgumentException(String.format(\"Duplicate log directories found: %s, %s!\", log.dir.getAbsolutePath(), previous.dir.getAbsolutePath()));\n }\n }\n cleanShutDownFile.delete();\n }\n }\n }", "public void printAllSpreadSheets() {\n\t\tif(getBubbleSpreadsheetSet().isEmpty())\n\t\t\tSystem.out.println(\"0 Spreadsheets in Bubbledocs\");\n\t\tfor (SpreadSheet f : getBubbleSpreadsheetSet()) {\n\t\t\tSystem.out.println(f);\n\t\t}\n\t}", "public static XSSFSheet setExcelFile() throws Exception {\n\n XSSFSheet ExcelWSheet;\n XSSFWorkbook ExcelWBook;\n XSSFRow Row;\n String Path;\n String SheetName;\n\n try {\n // Open the Excel file\n Path = fetchMyProperties(\"spreadsheet_path\");\n SheetName= fetchMyProperties(\"sheet_name\");\n FileInputStream ExcelFile = new FileInputStream(Path);\n\n // Access the required test data sheet\n ExcelWBook = new XSSFWorkbook(ExcelFile);\n ExcelWSheet = ExcelWBook.getSheet(SheetName);\n\n } catch (Exception e){\n throw (e);\n }\n return ExcelWSheet;\n }", "void readExcel(File existedFile) throws Exception;", "private void processFolders(List<File> folderList, java.io.File parentFolder) {\n // process each folder to see if it needs to be updated;\n for (File f : folderList) {\n String folderName = f.getTitle();\n java.io.File localFolder = new java.io.File(parentFolder, folderName);\n Log.e(\"folder\",localFolder.getAbsolutePath());\n if (!localFolder.exists())\n localFolder.mkdirs();\n getFolderContents(f, localFolder);\n }\n }", "void readData(File file) {\n // Common Place?--\n // Bool--\n List<DirectoryEntry>directoryEntries = new ArrayList<DirectoryEntry>();\n List<String>directoryTypes = new ArrayList<String>();\n try {\n FileInputStream excelFile = new FileInputStream(file);\n Workbook workbook = new XSSFWorkbook(excelFile);\n Sheet datatypeSheet = workbook.getSheetAt(0);\n Iterator<Row> iterator = datatypeSheet.iterator();\n\n int rowCnt=0;\n while (iterator.hasNext()) {\n Row currentRow = iterator.next();\n\n // skip the first 3 rows\n rowCnt++;\n if(rowCnt<=3) {\n continue ;\n }\n\n\n // iterate over cells on the row\n int columnCnt=0;\n String name = null;\n String phoneNumber = null;\n String starCodePattern = null;\n String categoryTab = null;\n\n Iterator<Cell> columnIterator = currentRow.iterator();\n while (columnIterator.hasNext()) {\n Cell currentCell = columnIterator.next();\n\n //getCellTypeEnum shown as deprecated for version 3.15\n //getCellTypeEnum ill be renamed to getCellType starting from version 4.0\n String value = \"\";\n if (currentCell.getCellTypeEnum() == CellType.STRING) {\n value = currentCell.getStringCellValue();\n } else if (currentCell.getCellTypeEnum() == CellType.NUMERIC) {\n value = \"\" + currentCell.getNumericCellValue();\n }\n\n columnCnt++;\n switch(columnCnt) {\n case 1:\n name = value;\n break;\n case 2:\n phoneNumber = value;\n break;\n case 3:\n starCodePattern = value;\n break;\n case 4:\n categoryTab = value;\n if( !directoryTypes.contains(categoryTab) ) {\n directoryTypes.add(categoryTab);\n }\n break;\n }\n }\n\n if(StringUtils.isNotBlank(name)) {\n directoryEntries.add(new DirectoryEntry(name, phoneNumber, starCodePattern, categoryTab));\n data.add(new DirectoryEntry(name, phoneNumber, starCodePattern, categoryTab));\n }\n }\n\n workbook.close();\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }" ]
[ "0.6123784", "0.53619224", "0.52187294", "0.51440287", "0.51258105", "0.5097726", "0.50931066", "0.5091057", "0.50847185", "0.50733733", "0.50492465", "0.49930754", "0.49878693", "0.49336466", "0.49282745", "0.49111715", "0.48683608", "0.48556766", "0.484321", "0.48090294", "0.4792415", "0.4785402", "0.4783186", "0.47791243", "0.47517374", "0.4746754", "0.47413376", "0.47271714", "0.47271532", "0.4705234", "0.4704239", "0.46689054", "0.46651974", "0.46502098", "0.46486276", "0.46404216", "0.4635517", "0.46332088", "0.4626889", "0.46154362", "0.46002194", "0.45972314", "0.45931783", "0.45846227", "0.45765668", "0.45684263", "0.4563998", "0.45634222", "0.45319718", "0.4530923", "0.45276567", "0.4523184", "0.44968805", "0.44961357", "0.44943294", "0.44928136", "0.44887692", "0.44830272", "0.44807407", "0.44751078", "0.44746938", "0.44628057", "0.44540778", "0.44383383", "0.44371474", "0.44359103", "0.44342846", "0.44321954", "0.44317162", "0.44306386", "0.4427723", "0.44240952", "0.44205198", "0.44036612", "0.43984687", "0.43897736", "0.43838796", "0.4383125", "0.4380565", "0.43796027", "0.4376094", "0.4363706", "0.43630537", "0.4358111", "0.43542507", "0.43484583", "0.43418655", "0.43401745", "0.4332972", "0.43316445", "0.4329857", "0.43259293", "0.4325292", "0.4324556", "0.43148452", "0.43080738", "0.42953068", "0.42949408", "0.42862153", "0.42817947" ]
0.71133024
0
Create long press context menu.
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; FileItem fileItem = files.getItem(info.position); if (!fileItem.isDirectory()) { getActivity().getMenuInflater().inflate(R.menu.chordsheet_context, menu); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void onCreateContextMenu(ContextMenu menu, View v,\r\n\t\t\tContextMenuInfo menuInfo) {\n\t\tgetMenuInflater().inflate(R.menu.long_click_context, menu);\r\n\t\t//menu.setHeaderIcon(R.drawable.qq);\r\n\t\tmenu.setHeaderTitle(\"选项菜单\");//设置菜单标题\r\n\t\tthis.contextmenu = menu;\r\n\t\t\r\n\t\tsuper.onCreateContextMenu(menu, v, menuInfo);\r\n\t}", "@Override\n protected void hookContextMenu() {\n\n }", "protected void createContextMenu() {\n\t\t// TODO : XML Editor 에서 Query Editor 관련 Action 삭제~~\n\t\tMenuManager contextMenu = new MenuManager(\"#PopUp\"); //$NON-NLS-1$\n\t\tcontextMenu.add(new Separator(\"additions\")); //$NON-NLS-1$\n\t\tcontextMenu.setRemoveAllWhenShown(true);\n\t\tcontextMenu.addMenuListener(new NodeActionMenuListener());\n\t\tMenu menu = contextMenu.createContextMenu(getControl());\n\t\tgetControl().setMenu(menu);\n\t\t// makeActions();\n\t\t// hookSingleClickAction();\n\n\t}", "private void createContextMenu(){\r\n\t\tmenu = new JMenuBar();\r\n\t\tint ctrl;\r\n\t\tif(MAC)\r\n\t\t\tctrl = ActionEvent.META_MASK;\r\n\t\telse\r\n\t\t\tctrl = ActionEvent.CTRL_MASK;\r\n\r\n\t\tJMenu fileMenu = new JMenu(\"File\");\r\n\t\tnewMenu = new JMenuItem(\"New\");\r\n\t\tnewMenu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ctrl));\r\n\t\tnewMenu.addActionListener(this);\r\n\t\topenMenu = new JMenuItem(\"Open\");\r\n\t\topenMenu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ctrl));\r\n\t\topenMenu.addActionListener(this);\r\n\t\trecentMenu = new JMenu(\"Open Recent\");\r\n\t\tpopulateRecentMenu();\r\n\t\tsaveMenu = new JMenuItem(\"Save\");\r\n\t\tsaveMenu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ctrl));\r\n\t\tsaveMenu.addActionListener(this);\r\n\t\tsaveAsMenu = new JMenuItem(\"Save As...\");\r\n\t\tsaveAsMenu.addActionListener(this);\r\n\t\tfileMenu.add(newMenu);\r\n\t\tfileMenu.add(openMenu);\r\n\t\tfileMenu.add(recentMenu);\r\n\t\tfileMenu.add(saveMenu);\r\n\t\tfileMenu.add(saveAsMenu);\r\n\r\n\t\tmenu.add(fileMenu);\r\n\r\n\t\tJMenu editMenu = new JMenu(\"Edit\");\r\n\t\tpreferencesMenu = new JMenuItem(\"Preferences\");\r\n\t\tpreferencesMenu.addActionListener(this);\r\n\t\teditMenu.add(preferencesMenu);\r\n\r\n\t\tmenu.add(editMenu);\r\n\r\n\t\tif(!MAC){\r\n\t\t\tJMenu helpMenu = new JMenu(\"Help\");\r\n\t\t\tJMenuItem aboutMenuI = new JMenuItem(\"About\");\r\n\r\n\t\t\taboutMenuI.addActionListener(new ActionListener(){\r\n\t\t\t\tpublic void actionPerformed(ActionEvent e) {\r\n\t\t\t\t\tshowAboutMenu();\r\n\t\t\t\t}\t\t\r\n\t\t\t});\r\n\t\t\thelpMenu.add(aboutMenuI);\r\n\t\t\tmenu.add(helpMenu);\r\n\t\t}\r\n\t}", "private void createContextMenu(Event event) {\r\n\t\tif (event.button == 3) {\r\n\t\t\tControl control = (Control) event.widget;\r\n\t\t\tPoint absoluteLoc = control.toDisplay(event.x, event.y);\r\n\t\t\twhile (control != null && control.getMenu() == null) {\r\n\t\t\t\tcontrol = control.getParent();\r\n\t\t\t}\r\n\t\t\tif (control != null) {\r\n\t\t\t\tcontrol.getMenu().setLocation(absoluteLoc);\r\n\t\t\t\tcontrol.getMenu().setVisible(true);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "@Override\n public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {\n //menu.setHeaderTitle(\"Select The Action\");\n menu.add(0, v.getId(), 0, \"Edit word\");\n menu.add(1, v.getId(), 0, \"Delete word\");\n\n super.onCreateContextMenu(menu, v, menuInfo);\n }", "private void addContextMenu(StringBuilder xml) {\n\t\t\n\t\tif(contextMenu != null) {\n\t\t\tstartElementWithAttributes(xml, \"ContextMenu\");\n\t\t\taddStringAttribute(xml, \"contextObject\", contextMenu.getContextObject());\n\t\t\tcloseSimpleElementWithAttributes(xml);\n\t\t}\n\t\t\n\t}", "public GuiContextMenu createContextMenu(GuiContext context)\n {\n return this.contextMenu == null ? null : this.contextMenu.get();\n }", "public ContextMenu createContextMenu() {\n\t\tContextMenu ctm = new ContextMenu();\n\n\t\tMenuItem rename = new MenuItem(\"Rename\");\n\t\tMenuItem remove = new MenuItem(\"Remove\");\n\n\t\trename.setOnAction((ActionEvent) -> {\n\t\t\tthis.fireEvent(new VertexEvent(VertexEvent.RENAME, this));\n\t\t});\n\t\tremove.setOnAction((ActionEvent) -> {\n\t\t\tthis.fireEvent(new VertexEvent(VertexEvent.REMOVE, this));\n\n\t\t});\n\t\t// Add MenuItem to ContextMenu\n\t\tctm.getItems().addAll(rename, remove);\n\t\treturn ctm;\n\t}", "@Override\n protected void onCreateContextMenu(ContextMenu menu) {\n super.onCreateContextMenu(menu);\n }", "private void createContextMenu(Menu contextMenu) {\t\n \t\tMenuActions menuActions;\n \t\ttry {\n \t\t\tmenuActions = ParseUtils.parseMenuData(this, this.contextMenuXmlFileName);\n \t\t\tthis.listContextualActions = menuActions.getList();\n \t\t\t\n \t\t\tIterator<MenuActionDataItem> itContextualActions = this.listContextualActions.iterator();\n \t\t\t\n \t\t\tint i = 0;\n \t\t\twhile(itContextualActions.hasNext()){\n \t\t\t\tfinal MenuActionDataItem action = itContextualActions.next();\n \t\t\t\t\n \t\t\t\tif( this.isEntryPoint == false || (\n \t\t\t\t\t\t(this.isEntryPoint == true & ( !action.getSystemAction().equals(\"home\") && \n \t\t\t\t\t\t!action.getSystemAction().equals(\"back\") ) ) ) ){\n \t\t\t\t\n \t\t\t\tString resource = \"drawable/\" + action.getImageName().split(\"\\\\.\")[0];\n \t\t\t\tint idImage = getResources().getIdentifier(resource, null, getPackageName());\n \t\t\t\t\n \t\t\t\tcontextMenu.add(Menu.NONE, i, Menu.NONE, action.getTitle()).setIcon(idImage);\n \t\t\t\ti++;\n \t\t\t\t}\n \t\t\t}\n \t\t} catch (InvalidFileException e) {\n \t\t\tLog.e(\"createContextMenu\", e.getMessage());\n \t\t}\t\n \t}", "@SuppressLint(\"NewApi\")\n\t\t\t@Override\n\t\t\tpublic void onCreateContextMenu(ContextMenu menu, View arg1,\n\t\t\t\t\tContextMenuInfo arg2) {\n\t\t\t\t\t\t\t\t\n\t\t\t\tmenu.setHeaderTitle(\"操作\");\n\t\t\t\tmenu.add(0,1,0,\"播放\");\n\t\t\t\tmenu.add(0,2,0,\"删除\");\n\t\t\t\tmenu.add(0,3,0,\"详细信息\");\n\t\t\t\tmenu.add(0,4,0,\"取消\");\n\t\t\t}", "@Override\r\n public void onCreateContextMenu(ContextMenu menu, View v,\r\n ContextMenuInfo menuInfo) {\n return;\r\n }", "@Override\n public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {\n super.onCreateContextMenu(menu, v, menuInfo);\n menu.setHeaderTitle(\"Select the Action\");\n getMenuInflater().inflate(R.menu.my_context_menu, menu); // add costume menu\n }", "public Menu createToolsMenu();", "public void initMenuContext(){\n GralMenu menuCurve = getContextMenu();\n //menuCurve.addMenuItemGthread(\"pause\", \"pause\", null);\n menuCurve.addMenuItem(\"refresh\", actionPaintAll);\n menuCurve.addMenuItem(\"go\", actionGo);\n menuCurve.addMenuItem(\"show All\", actionShowAll);\n //menuCurve.addMenuItemGthread(\"zoomOut\", \"zoom in\", null);\n menuCurve.addMenuItem(\"zoomBetweenCursor\", \"zoom between Cursors\", actionZoomBetweenCursors);\n menuCurve.addMenuItem(\"zoomOut\", \"zoom out\", actionZoomOut);\n menuCurve.addMenuItem(\"cleanBuffer\", \"clean Buffer\", actionCleanBuffer);\n //menuCurve.addMenuItemGthread(\"zoomOut\", \"to left\", null);\n //menuCurve.addMenuItemGthread(\"zoomOut\", \"to right\", null);\n \n }", "@Override\n\t\t\t\t\tpublic void onCreateContextMenu(ContextMenu menu, View v,\n\t\t\t\t\t\t\tContextMenuInfo menuInfo) {\n\t\t\t\t\t\tmenu.add(0, 0, 0, \"更新\");\n\t\t\t\t\t\tmenu.add(0, 1, 0, \"删除\");\n\t\t\t\t\t}", "private void createContextMenu() {\r\n\r\n\t\tfinal MenuManager menuMgr = new MenuManager();\r\n\r\n\t\tmenuMgr.setRemoveAllWhenShown(true);\r\n\r\n\t\tmenuMgr.addMenuListener(new IMenuListener() {\r\n\t\t\tpublic void menuAboutToShow(final IMenuManager menuMgr2) {\r\n\t\t\t\tfillContextMenu(menuMgr2);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tfinal Table table = _photoViewer.getTable();\r\n\r\n//\t\tif (isRecreate) {\r\n//\r\n//\t\t\t/*\r\n//\t\t\t * when a tooltip is reparented, the context menu must be recreated otherwise an\r\n//\t\t\t * exception is thown that the menu shell has the wrong parent\r\n//\t\t\t */\r\n//\r\n//\t\t\tmenuMgr.dispose();\r\n//\t\t}\r\n\r\n\t\tfinal Menu tableContextMenu = menuMgr.createContextMenu(table);\r\n\r\n\t\ttable.setMenu(tableContextMenu);\r\n\r\n\t\t_columnManager.createHeaderContextMenu(table, tableContextMenu);\r\n\t}", "private void createContextMenu() {\n\t\tMenuManager menuMgr = new MenuManager();\n\t\tmenuMgr.setRemoveAllWhenShown(true);\n\t\tmenuMgr.addMenuListener(new IMenuListener() {\n\t\t\tpublic void menuAboutToShow(IMenuManager mgr) {\n\t\t\t\tfillContextMenuMethodsTableViewer(mgr);\n\t\t\t}\n\n\t\t});\n\t\t// Create menu for methodsTableViewer\n\t\tMenu menu = menuMgr.createContextMenu(tableViewerLeft.getControl());\n\t\ttableViewerLeft.getControl().setMenu(menu);\n\n\t\t// Register menu for extension.\n\t\tgetSite().registerContextMenu(menuMgr, tableViewerLeft);\n\n\t\t// Create menu manager for methodsTableViewer for callsTableViewer\n\t\tMenuManager menuMgr1 = new MenuManager();\n\t\tmenuMgr1.setRemoveAllWhenShown(true);\n\t\tmenuMgr1.addMenuListener(new IMenuListener() {\n\t\t\tpublic void menuAboutToShow(IMenuManager mgr) {\n\t\t\t\tfillContextMenuCallsTableViewer(mgr);\n\t\t\t}\n\n\t\t});\n\t\t// Create menu for callsTableViewer\n\t\tMenu menu1 = menuMgr1.createContextMenu(tableViewerRight.getControl());\n\t\ttableViewerRight.getControl().setMenu(menu1);\n\n\t\t// Register menu for extension.\n\t\tgetSite().registerContextMenu(menuMgr1, tableViewerRight);\n\t}", "@Override\n public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) {\n MenuInflater inflater = getMenuInflater();\n inflater.inflate(R.menu.lay_context, menu);\n }", "private ContextMenu getElementSpecificContextMenu(){\n MenuItem menuItem_EditTLE = new MenuItem(\"Edit annotation\");\n menuItem_EditTLE.setOnAction(event -> handleEditTimeLineElementClick());\n\n\n MenuItem menuItem_DeleteTLE = new MenuItem(\"Delete annotation\");\n menuItem_DeleteTLE.setOnAction(event -> handleDeleteTimeLineElementClick());\n\n return new ContextMenu(menuItem_EditTLE, menuItem_DeleteTLE);\n }", "@Override\n public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {\n menu.setHeaderTitle(\"Context Menu\");\n getMenuInflater().inflate(R.menu.menu,menu);\n }", "@Override\r\n public boolean onLongClick(int x, int y, int pointer, int button) {\r\n return true;\r\n }", "@Override\n public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {\n super.onCreateContextMenu(menu, v, menuInfo);\n MenuInflater inflater = getMenuInflater();\n inflater.inflate(R.menu.contextmenu, menu);\n }", "@Override\n\tpublic void onCreateContextMenu(ContextMenu menu, View v,\n\t\t\tContextMenuInfo menuInfo) {\n\t\tmenu.setHeaderTitle(\"操作设置\");\n\t\t// add context menu item\n\t\tmenu.add(0, 1, Menu.NONE, \"选择监控车辆\");\n\t\tmenu.add(0, 2, Menu.NONE, \"查看车辆信息\");\n\t\t// menu.add(0, 3, Menu.NONE, \"车辆轨迹回放\");\n\n\t}", "public void createContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo){\n \t\tAdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;\n \t\tAdapterItemRef ref = (AdapterItemRef)info.targetView.getTag();\n \t\t\t\t\n \t\tmenu.setHeaderTitle(ref.lblTitle.getText().toString());\t\t\t\t\n \t\tmenu.add(0,2,0,\"Delete\");\n \t\tmenu.add(0,1,1,\"Reset Progress\");\n \t\tmenu.add(0,3,2,\"Mark as Read\");\n \t\tmenu.add(0,4,3,\"Edit Series Name\");\n \t}", "@Override\n public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { // Add Items to menu\n if (v.getId() == R.id.listView) {\n String[] menuItems = getResources().getStringArray(R.array.menu);\n for (int i = 0; i < menuItems.length; i++) {\n menu.add(Menu.NONE, i, i, menuItems[i]);\n }\n }\n }", "@Override\n public void onLongClick(int position) {\n log(\"Long Pressed\" + position);\n enableActionMode(position);\n }", "@Override\n\tpublic void onCreateContextMenu(ContextMenu menu, View v,\n\t\t\tContextMenuInfo menuInfo) {\n\t\tsuper.onCreateContextMenu(menu, v, menuInfo);\n\t\tmenu.add(0, MENU_DELETE, 0, R.string.delete);\n\t\tmenu.add(0,MENU_MOVE,1,getResources().getString(R.string.transmit_m));\n\t}", "@Override\n protected void handleLongClick() {\n }", "@Override\n public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {\n menu.add(0, getAdapterPosition(),0,\"DELETE\");\n // Log.d(TAG, \"onCreateContextMenu: \" + );\n }", "@Override\n public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {\n super.onCreateContextMenu(menu, v, menuInfo);\n menu.add(0, v.getId(), 0, \"Edit\");\n menu.add(0, v.getId(), 0, \"Delete\");\n menu.add(0, v.getId(), 0, \"Share via\");\n menu.add(0, v.getId(), 0, \"Share via Facebook\");\n menu.add(0, v.getId(), 0, \"Cancel\");\n }", "private void createTextContextMenu() {\n String id = \"de.loskutov.bco.views.BytecodeOutlineView#ContextMenu\"; //$NON-NLS-1$\n contextMenuManager = new MenuManager(\"#ContextMenu\", id); //$NON-NLS-1$\n contextMenuManager.setRemoveAllWhenShown(true);\n contextMenuManager.addMenuListener(new IMenuListener() {\n\n @Override\n public void menuAboutToShow(IMenuManager m) {\n contextMenuAboutToShow(m);\n }\n });\n Menu menu = contextMenuManager.createContextMenu(textControl);\n textControl.setMenu(menu);\n\n getSite().registerContextMenu(id, contextMenuManager, textViewer);\n }", "public void mo21807a(ContextMenu contextMenu, View view, ContextMenuInfo contextMenuInfo) {\n }", "void onCreateContextMenuForGroup(ContextMenu menu, Activity activity) {\n }", "@Override\n public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {\n super.onCreateContextMenu(menu, v, menuInfo);\n MenuInflater inflater = getMenuInflater();\n inflater.inflate(R.menu.menu_context, menu);\n }", "@Override\n public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {\n super.onCreateContextMenu(menu, v, menuInfo);\n getMenuInflater().inflate(R.menu.menu_main_for_context , menu);\n menu.setHeaderTitle(\"Select Menu \");\n }", "@Override\r\n\t public boolean longClick() {\n\t return LongClick();\r\n\t }", "@Override\n public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {\n super.onCreateContextMenu(menu, v, menuInfo);\n\n getActivity().getMenuInflater().inflate(R.menu.actions , menu);\n\n }", "@Override\n public void onCreateContextMenu(ContextMenu menu, View v,\n \t\tContextMenuInfo menuInfo) {\n \tsuper.onCreateContextMenu(menu, v, menuInfo);\n \tMenuInflater inflater = getMenuInflater();\n \tint menuXML = (v == mImage)?R.menu.menu_contextual_componente1:R.menu.menu_contextual_componente2;\n \tinflater.inflate(menuXML, menu);\n }", "private void createMenuForGCodeModifier(IMenuManager contextMenu, IModifier<?> modifier) {\r\n\t\tcontextMenu.add(new EnableDisableAction(rs274Service, modifier.getId()));\r\n\t\tcontextMenu.add(new ModifierMoveUpAction(rs274Service, modifier.getId()));\r\n\t\tcontextMenu.add(new ModifierMoveDownAction(rs274Service, modifier.getId()));\r\n\t\tcontextMenu.add(new Separator());\r\n\t\tcontextMenu.add(new DeleteModifierAction(rs274Service, modifier.getId()));\r\n\t}", "void onCreateContextMenuForChild(int childPosition, ContextMenu menu,\n Activity activity) {\n }", "@Override\r\n\tpublic void onCreateContextMenu(ContextMenu menu, View v,\r\n\t\t\tContextMenuInfo menuInfo) {\n\t\tsuper.onCreateContextMenu(menu, v, menuInfo);\r\n\t\tmenu.setHeaderIcon(getResources().getDrawable(R.drawable.ic_launcher));\r\n\t\tmenu.setHeaderTitle(\"test\");\r\n\t\tmenu.add(0, Menu.FIRST, 0, \"aaaa\");\r\n\t\tmenu.add(0, Menu.FIRST + 1, 0, \"bbbb\");\r\n\t\tmenu.add(0, Menu.FIRST + 2, 0, \"cccc\");\r\n\t}", "@Override\r\npublic void onCreateContextMenu(ContextMenu menu, View v,\r\n\t\t\tContextMenuInfo menuInfo) {\n\t\t\r\n\t\tsuper.onCreateContextMenu(menu, v, menuInfo);\r\n\t\tMenuInflater inflator= getMenuInflater();\r\n\t\tinflator.inflate(R.layout.context_menu, menu);\r\n\t}", "@Override\n public void onCreateContextMenu(ContextMenu menu, View v,\n \t\tContextMenuInfo menuInfo) {\n \tsuper.onCreateContextMenu(menu, v, menuInfo);\n }", "private void createPopupMenu()\r\n\t{\r\n\t\tfinal Camera camera = SrvHal.getCamera();\r\n\t\tfinal PopupMenu menu = new PopupMenu();\r\n\t\tfinal MenuItem setColour = new MenuItem(\"Set colour to selected bin\");\r\n\r\n\t\tsetColour.addActionListener(new ActionListener()\r\n\t\t{\r\n\t\t\t@Override\r\n\t\t\tpublic void actionPerformed(ActionEvent e)\r\n\t\t\t{\r\n\t\t\t\tcamera.getDetector().updateColourBinFromCoords();\r\n\t\t\t\tcamera.getDetector().setSampleLock(false);\r\n\t\t\t}\r\n\t\t});\r\n\t\tmenu.add(setColour);\r\n\r\n\t\tfinal Component canvas = this;\r\n\t\tadd(menu);\r\n\t\taddMouseListener(new MouseAdapter()\r\n\t\t{\r\n\t\t\t@Override\r\n\t\t\tpublic void mouseClicked(MouseEvent e)\r\n\t\t\t{\r\n\t\t\t\t// show the context menu when right-click detected within image bounds\r\n\t\t\t\tif (e.getButton() == MouseEvent.BUTTON3)\r\n\t\t\t\t{\r\n\t\t\t\t\tint x = e.getX();\r\n\t\t\t\t\tint y = e.getY();\r\n\t\t\t\t\tRectangle bounds = getOffsetBounds();\r\n\t\t\t\t\tif (bounds.contains(x, y))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcamera.getDetector().setSampleLock(true);\r\n\t\t\t\t\t\tmenu.show(canvas, x, y);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t}", "private void fillDetailContextMenu(IMenuManager menu) {\n menu.add(getAction(DETAIL_COPY_ACTION));\n menu.add(getAction(DETAIL_SELECT_ALL_ACTION));\n menu.add(new Separator());\n menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));\n }", "@Override\n public void onCreateContextMenu(ContextMenu menu, View v,\n ContextMenu.ContextMenuInfo menuInfo) {\n if (v.getId() == R.id.subRedditList) {\n AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;\n menu.setHeaderTitle(subReddits.get(info.position));\n String[] menuItems = getResources().getStringArray(R.array.extraOptions);\n for (int i = 0; i < menuItems.length; i++) {\n menu.add(Menu.NONE, i, i, menuItems[i]);\n }\n }\n }", "protected void showContextMenu(FrameEditorSelectionState seln,\n boolean context)\n {\n // Check the context menu enabled states\n setViewEnabledState(seln, ListenerIdentifierMap.CONTEXT);\n\n // Multiple selection?\n if (seln.getElementSelectionCount() > 0) {\n view.showSelectionMenu(context);\n }\n else {\n view.showBlankSpaceMenu();\n }\n }", "@Override\n public void showContextMenu()\n {\n showContextMenu(selection, View.SELECTION);\n }", "public void onCreateContextMenu(ContextMenu menu, View v,\n ContextMenu.ContextMenuInfo menuInfo) {\n super.onCreateContextMenu(menu, v, menuInfo);\n MenuInflater inflater = getMenuInflater();\n inflater.inflate(R.menu.contextual_menu, menu);\n }", "@Override\n public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {\n getMenuInflater().inflate(R.menu.menu_context, menu);\n menu.setHeaderTitle(\"Chọn công việc!\");\n super.onCreateContextMenu(menu, v, menuInfo);\n }", "@Override\n public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {\n MenuInflater inflater = getMenuInflater();\n if (v.getId() == R.id.list)\n inflater.inflate(R.menu.context_menu, menu);\n //You can show a different context menu by checking the ID of the view\n // if you have called registerForContextMenu for another view as well\n }", "@Override\n\tpublic void onCreateContextMenu(ContextMenu menu, View v,\n\t\t\tContextMenuInfo menuInfo) {\n\t\tsuper.onCreateContextMenu(menu, v, menuInfo);\n\t}", "@Override\n\tpublic void onCreateContextMenu(ContextMenu menu, View v,\n\t\t\tContextMenuInfo menuInfo) {\n\t\tsuper.onCreateContextMenu(menu, v, menuInfo);\n\t}", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n if (MainAct.longClicked) {\n DebugUtil.showDebug(\"MainAct.onCreateOptionsMenu(), when item longClicked\");\n getMenuInflater().inflate(R.menu.menu_main_long_clicked, menu);\n } else {\n getMenuInflater().inflate(R.menu.menu_main, menu);\n }\n return true;\n }", "public java.awt.Menu getMenuHook();", "public void onContextMenu(Object event, HTMLElement target) {\n// Logger.log(target);\n// int clientX = ((Number) JsTools.getObjectProperty(event, \"clientX\")).intValue();\n// int clientY = ((Number) JsTools.getObjectProperty(event, \"clientY\")).intValue();\n// \n// contextMenuModel = JsArray.of(\"details\", \"add\", \"remove\", null, \"filter-by-value\");\n// JQuery.Helper.$(\"body\").on(\"click\", (e, d) -> {\n// \n// // TODO e.target holds the clicked menuItem if any...\n// \n// contextMenuModel = null;\n// JQuery.Helper.$(\"body\").off(\"click\");\n// });\n// \n// Scheduler.get().scheduleDeferred(() -> {\n// Object offset = get$().offset();\n// int offsetTop = ((Number) JsTools.getObjectProperty(offset, \"top\")).intValue();\n// int offsetLeft = ((Number) JsTools.getObjectProperty(offset, \"left\")).intValue();\n// Object position = get$().position();\n// int positionTop = ((Number) JsTools.getObjectProperty(position, \"top\")).intValue();\n//\n// get$().find(\".context-menu\").css(\"top\", (clientY - offsetTop + positionTop) + \"px\");\n// get$().find(\".context-menu\").css(\"left\", (clientX - offsetLeft) + \"px\");\n// });\n }", "@Override\n\tpublic boolean longPress(float x, float y) {\n\t\treturn false;\n\t}", "@Override\n public boolean onItemLongClick(AdapterView<?> arg0, View view,\n int pos, long id) {\n\n showPopupMenu(view, pos, id);\n\n return true;\n }", "public JPopupMenu buildContextMenu(EditPart select) {\n\t\tJPopupMenu menu = new JPopupMenu();\n //GEFActionConstants.addStandardActionGroups(menu);\n\n menu.add(createItem(GEN_JUNIT_TEST_CODE_MSG, new DecisionTreeCodeGenAction(virtualFile, diagram)));\n menu.addSeparator();\n menu.add(createItem(CREATE_NEW_DECISION_MSG, new DecisionTreeCreateDecisionAction(project, diagram)));\n menu.add(createItem(CREATE_NEW_FACTOR_MSG, new DecisionTreeCreateFactorAction(project, diagram)));\n menu.addSeparator();\n JMenu sub = new JMenu(\"New value for factor\");\n \tgetFactorActions(sub);\n \tmenu.add(sub);\n\n \treturn menu;\n }", "protected void createContextMenuFor(StructuredViewer viewer) {\r\n\t\tMenuManager contextMenu = new MenuManager(\"#PopUp\");\r\n\t\tcontextMenu.add(new Separator(\"additions\"));\r\n\t\tcontextMenu.setRemoveAllWhenShown(true);\r\n\t\tcontextMenu.addMenuListener(this);\r\n\t\tMenu menu = contextMenu.createContextMenu(viewer.getControl());\r\n\t\tviewer.getControl().setMenu(menu);\r\n\t\tgetSite().registerContextMenu(contextMenu,\r\n\t\t\t\tnew UnwrappingSelectionProvider(viewer));\r\n\r\n\t\tint dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;\r\n\t\tTransfer[] transfers = new Transfer[] { LocalTransfer.getInstance() };\r\n\t\tviewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(\r\n\t\t\t\tviewer));\r\n\t\tviewer.addDropSupport(dndOperations, transfers,\r\n\t\t\t\tnew EditingDomainViewerDropAdapter(editingDomain, viewer));\r\n\t}", "public JPopupMenu getContextMenu() {\n\t\tJPopupMenu ContextMenu = new JPopupMenu();\n\t\treturn ContextMenu;\n\t}", "@Override\n\tpublic void rightClick(MouseEvent e) {\n\n\t}", "@Override\n\t\tpublic void onLongPress(MotionEvent e) {\n\t\t\t\n\t\t}", "@Override\r\n\tpublic void onLongPress(MotionEvent e) {\n\t\tSystem.out.println(\"longpress\");\r\n\t\t\r\n\t}", "static void createContextMenu(View view, ContextMenu menu, ContextMenu.ContextMenuInfo menuInfo) {\n ((MenuBuilder) menu).setCurrentMenuInfo(menuInfo);\n\n XpContextMenuViewCompat.onCreateContextMenu(view, menu);\n// ListenerInfo li = mListenerInfo;\n// if (li != null && li.mOnCreateContextMenuListener != null) {\n// li.mOnCreateContextMenuListener.onCreateContextMenu(menu, view, menuInfo);\n// }\n View.OnCreateContextMenuListener li = XpContextMenuViewCompat.getOnCreateContextMenuListener(view);\n if (li != null) {\n li.onCreateContextMenu(menu, view, menuInfo);\n }\n\n // Clear the extra information so subsequent items that aren't mine don't\n // have my extra info.\n ((MenuBuilder) menu).setCurrentMenuInfo(null);\n\n if (view.getParent() != null) {\n try {\n createContextMenu((View) view.getParent(), menu);\n } catch (ClassCastException ex) {\n //\n }\n }\n }", "@Override\n\tpublic void onCreateContextMenu(ContextMenu menu, View v,\n\t\t\tContextMenuInfo menuInfo) {\n\t\tsuper.onCreateContextMenu(menu, v, menuInfo);\n\t\t// Set title for the context menu\n\t\t// menu.setHeaderTitle(\"Options\");\n\n\t\t// Add all the menu options\n\n\t\t// menu.add(Menu.NONE, CONTEXTMENU_OPTION1, 0, \"View Message Details\");\n\t\tmenu.add(Menu.NONE, CONTEXTMENU_OPTION2, 1, \"Send Message Now\");\n\t\tmenu.add(Menu.NONE, CONTEXTMENU_OPTION3, 2, \"Update Message Details\");\n\t\tmenu.add(Menu.NONE, CONTEXTMENU_OPTION4, 3, \"Delete Message\");\n\t}", "@Override\n\tpublic void onLongPress(MotionEvent e) {\n\t\t\n\t}", "@Override\n\tpublic void onLongPress(MotionEvent e) {\n\t\t\n\t}", "@Override\n\tpublic void onLongPress(MotionEvent e) {\n\t\t\n\t}", "@Override\n\tpublic void onLongPress(MotionEvent e) {\n\t\t\n\t}", "@Override\n\tpublic void onLongPress(MotionEvent e) {\n\t\t\n\t}", "@Override\r\n\tpublic void rightClick(MouseEvent arg0) {\n\t\t\r\n\t}", "public native static MenuItemToggle create();", "public interface ContextMenuProvider extends View.OnCreateContextMenuListener {\n\tpublic boolean onContextItemSelected(MenuItem menuItem, View view);\n\n}", "public JTextField addContextMenu(final JTextField field) {\n field.addMouseListener(\n new MouseAdapter() {\n public void mouseReleased(MouseEvent e) {\n if (e.isPopupTrigger()) {\n JPopupMenu jPopupMenu = new JPopupMenu();\n String actionName =\n Constant.messages.getString(MESSAGE_PREFIX + \"pasteaction\");\n @SuppressWarnings(\"serial\")\n Action pasteAction =\n new AbstractAction(actionName) {\n public void actionPerformed(ActionEvent e) {\n field.paste();\n }\n };\n JMenuItem paste = new JMenuItem(pasteAction);\n jPopupMenu.add(paste);\n jPopupMenu.show(field, e.getX(), e.getY());\n }\n }\n });\n return field;\n }", "@Override\r\n public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {\n mActionMode = MainActivity.this.startActionMode(MainActivity.this);\r\n toggleViewSelection(view, id, position);\r\n return true;\r\n }", "@Override\n\tpublic void onCreateContextMenu(ContextMenu menu, View v,\n\t\t\tContextMenuInfo menuInfo) {\n\t\tsuper.onCreateContextMenu(menu, v, menuInfo);\n\t\t MenuInflater inflater = getMenuInflater();\n\t\t inflater.inflate(R.menu.context_menu, menu);\n\t}", "public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {\n \tsuper.onCreateContextMenu(menu, view, menuInfo);\n \tmenu.add(Menu.NONE, MENU_CONTEXT_SAVE, Menu.NONE, \n \t\t\tmContext.getText(R.string.context_save));\n }", "public void menuItemClicked( Menu2DEvent e );", "@Override\n\t\t\t\tpublic void onLongPress(MotionEvent e) {\n\t\t\t\t\t\n\t\t\t\t}", "@Override\n public boolean onLongClick(View view) {\n PopupMenu popup = new PopupMenu(view.getContext(), ((ToDoHolder) holder).mToDo);\n //inflating menu from xml resource\n popup.inflate(R.menu.popupmenu);\n //adding click listener\n popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {\n @Override\n public boolean onMenuItemClick(MenuItem item) {\n switch (item.getItemId()) {\n case R.id.menu_delete:\n mToDoProviderFromDB.deleteToDoFromDB(mToDos.get(position).getToDoID());\n break;\n }\n return false;\n }\n });\n popup.show();\n return true;\n }", "public void buildContextMenu(IMenuManager menu) {\n\t\t// Add standard action groups to the menu\n\t\tGEFActionConstants.addStandardActionGroups(menu);\n\n\t\t// Add actions to the menu\n\t\tmenu.appendToGroup(GEFActionConstants.GROUP_UNDO, // target group id\n\t\t\t\tgetAction(ActionFactory.UNDO.getId())); // action to add\n\t\tmenu.appendToGroup(GEFActionConstants.GROUP_UNDO,\n\t\t\t\tgetAction(ActionFactory.REDO.getId()));\n\t\tmenu.appendToGroup(GEFActionConstants.GROUP_EDIT,\n\t\t\t\tgetAction(ActionFactory.DELETE.getId()));\n\t}", "@Override\n\tpublic void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {\n\t\tgetActivity().getMenuInflater().inflate(R.menu.exercise_list_item_context, menu);\n\t}", "@Override\n\tpublic void onLongPress(MotionEvent e) {\n\n\t}", "@Override\n\tpublic void onLongPress(MotionEvent e) {\n\n\t}", "@Override\n\tpublic void onLongPress(MotionEvent e) {\n\n\t}", "@Override\n\tpublic void onLongPress(MotionEvent e) {\n\n\t}", "@Override\n\tpublic void onLongPress(MotionEvent e) {\n\n\t}", "@Override\r\n public void onLongPress(MotionEvent e)\r\n {\n }", "@Override\n public void onCreateContextMenu(final ContextMenu menu, final View v, final ContextMenu.ContextMenuInfo menuInfo) {\n getMenuInflater().inflate(R.menu.menu_context, menu);\n super.onCreateContextMenu(menu, v, menuInfo);\n }", "@Override\n\tpublic void onClick(View v) {\n\t\tv.showContextMenu();\n\t}", "@Override\n public void onCreateContextMenu(ContextMenu menu, View v,\n ContextMenu.ContextMenuInfo menuInfo) {\n menu.add(0, MENU_COLOR_RED, 0, \"Red\");\n menu.add(0, MENU_COLOR_BLUE, 0, \"Blue\");\n menu.add(0, MENU_COLOR_GREEN, 0, \"Green\");\n menu.add(0, MENU_COLOR_GRAY, 0, \"Gray (default)\");\n super.onCreateContextMenu(menu, v, menuInfo);\n }", "@Override\n public void run() {\n JMenuItem abubillaMenuItem = new JMenuItem(\"Akino Abubilla\");\n // JMenuItem is similar to JButton. You can create Action Listeners on the JMenuItem\n abubillaMenuItem.addActionListener(e -> System.out.println(\"Akino Abubilla!!\"));\n // Also mnemonics\n abubillaMenuItem.setMnemonic(KeyEvent.VK_A); // This auto-creates alt-A shortcut...\n // but only works when the menuItem is visible.\n abubillaMenuItem.setDisplayedMnemonicIndex(6);\n // And of course, accelerators\n abubillaMenuItem.setAccelerator(KeyStroke.getKeyStroke('A', Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx()));\n // In order to get \"command\" key in mac and \"ctrl\" key in windows, we have to use\n // Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(). (Since 10!!)\n // to get the correct modifier\n\n JMenuItem kilimanjaroMenuItem = new JMenuItem(\"Akino Kilimanjaro\");\n kilimanjaroMenuItem.addActionListener(e -> System.out.println(\"Fallen From Kilimanjaro!!\"));\n kilimanjaroMenuItem.setMnemonic(KeyEvent.VK_K);\n kilimanjaroMenuItem.setAccelerator(KeyStroke.getKeyStroke('K',\n InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK)); // we can force the modifiers this way\n\n // Now we add the JMenuItems to a JMenu...\n JMenu akinoMenu = new JMenu(\"Akino Items\");\n akinoMenu.setMnemonic(KeyEvent.VK_I); // This auto-creates the alt-I shortcut\n akinoMenu.setDisplayedMnemonicIndex(6);\n akinoMenu.add(abubillaMenuItem);\n akinoMenu.add(kilimanjaroMenuItem);\n\n // Let's make another menu\n JMenuItem docMenuItem = new JMenuItem(\"Documentation\");\n //docMenuItem.setMnemonic(KeyEvent.VK_F1);\n docMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));\n docMenuItem.addActionListener(e -> System.out.println(\"Help!!\"));\n JMenuItem aboutMenuItem = new JMenuItem(\"About\");\n JMenuItem upgradeMenuItem = new JMenuItem(\"Look for Upgrades\");\n\n JMenu helpMenu = new JMenu(\"Help\");\n helpMenu.setMnemonic(KeyEvent.VK_H);\n helpMenu.add(docMenuItem);\n helpMenu.add(aboutMenuItem);\n helpMenu.addSeparator(); // Separator between help and look for upgrades\n helpMenu.add(upgradeMenuItem);\n\n // Now, the menu needs a JMenuBar to live within\n JMenuBar akinoMenuBar = new JMenuBar();\n akinoMenuBar.add(akinoMenu);\n //akinoMenuBar.add(helpMenu); // We can add menus to the menu bar or....\n akinoMenu.add(helpMenu); // we can nest menus in menus\n\n\n JPanel mainPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 8, 8));\n mainPanel.add(new JLabel(\"Hello, Akino!!\"));\n // We could add the menu to the main component of the frame...\n //mainPanel.add(akinoMenuBar); // But this adds the menu to mainPanel, not to the application\n\n JFrame frame = new JFrame(\"Akino Menus\");\n frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n\n frame.setContentPane(mainPanel);\n frame.setJMenuBar(akinoMenuBar); // The menu belongs to the window frame, not to the internal components.\n frame.setSize(240, 240);\n frame.setLocationByPlatform(true);\n frame.setVisible(true);\n\n }", "@Override\n public ContextMenu getContextMenu(MouseEvent mouseEvent) throws MissingResourceException {\n ContextMenu contextMenu = getContextMenu();\n if (contextMenu != null) {\n contextMenu.hide();\n }\n\n long selectedTimeMillis = getXAxis().getValueForDisplay(getXAxis().parentToLocal(mouseEvent.getX(), 0).getX()).getMillis();\n\n //make and assign a new context menu based on the given mouseEvent\n setContextMenu(ActionUtils.createContextMenu(Arrays.asList(\n new PlaceMarkerAction(this, mouseEvent),\n new AddManualEvent(controller, selectedTimeMillis),\n ActionUtils.ACTION_SEPARATOR,\n TimeLineChart.newZoomHistoyActionGroup(getController())\n )));\n return getContextMenu();\n }", "@Override\r\n\tpublic void onLongPress(MotionEvent e) {\n\t\t\r\n\t}", "@Override\r\n\tpublic void onLongPress(MotionEvent e) {\n\t\t\r\n\t}", "public void createSwitchButtonPopupMenu() {\n\n\t\tremoveAll();\n\t\tadd(midiLearnMenuItem);\n\t\tadd(midiUnlearnMenuItem);\n\t}", "public GenericMotifBrowserPanelContextMenu(final GenericMotifBrowserPanel panel) {\n this(panel,true);\n }", "@Override\n\tpublic void onLongPress(MotionEvent arg0) {\n\t\t\n\t}" ]
[ "0.7237881", "0.7105967", "0.6815752", "0.6753843", "0.667562", "0.66709065", "0.6660162", "0.65300936", "0.65206367", "0.64827526", "0.6480333", "0.64790905", "0.64504987", "0.6423031", "0.64227927", "0.64063907", "0.64039516", "0.6402743", "0.6332798", "0.6298058", "0.6291052", "0.6284647", "0.6281137", "0.62665486", "0.6264961", "0.6263097", "0.62584937", "0.6257529", "0.62188554", "0.6203732", "0.61971354", "0.6166532", "0.61430514", "0.61158586", "0.61119896", "0.6097554", "0.60853344", "0.60776687", "0.60764295", "0.6074936", "0.6072931", "0.60700744", "0.60662824", "0.6055828", "0.6054761", "0.60499376", "0.6040388", "0.5991648", "0.5984836", "0.59822965", "0.5977402", "0.5940011", "0.5931404", "0.592316", "0.592316", "0.59079987", "0.5892113", "0.58907616", "0.58906", "0.5888262", "0.5881187", "0.5880108", "0.58507144", "0.584676", "0.5839228", "0.58252084", "0.58239084", "0.58231556", "0.58144754", "0.58144754", "0.58144754", "0.58144754", "0.58144754", "0.5810952", "0.5809238", "0.57969815", "0.57964903", "0.5790176", "0.57883", "0.57844484", "0.5781209", "0.577668", "0.577652", "0.5771072", "0.57662505", "0.5765821", "0.5765821", "0.5765821", "0.5765821", "0.5765821", "0.5765626", "0.575685", "0.57419485", "0.5739275", "0.5731601", "0.57236147", "0.57216674", "0.57216674", "0.57067496", "0.5685028", "0.568173" ]
0.0
-1
Perform action on long press context menu selection.
@Override public boolean onContextItemSelected(MenuItem item) { boolean handled = false; // Get the selected ChordSheet AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); FileItem fileItem = files.getItem(info.position); final ChordSheet sheet = fileItem.getSheet(); switch (item.getItemId()) { case R.id.chordsheet_add_to_set: ChordSheetUtility.addChordSheetToSet(getActivity(), sheet); handled = true; break; case R.id.chordsheet_edit: ChordSheetUtility.editChordSheet(getActivity(), sheet); handled = true; break; case R.id.chordsheet_remove: fileItem.getFile().delete(); loadChordSheets(ActivityDataUtility.getInstance().getCurrentFolder()); handled = true; break; default: handled = super.onContextItemSelected(item); break; } return handled; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void onLongClick(int position) {\n log(\"Long Pressed\" + position);\n enableActionMode(position);\n }", "@Override\n protected void hookContextMenu() {\n\n }", "@Override\r\n public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {\n mActionMode = MainActivity.this.startActionMode(MainActivity.this);\r\n toggleViewSelection(view, id, position);\r\n return true;\r\n }", "@Override\r\n\t public boolean longClick() {\n\t return LongClick();\r\n\t }", "@Override\r\n public boolean onLongClick(int x, int y, int pointer, int button) {\r\n return true;\r\n }", "@Override\n\tpublic boolean longPress(float x, float y) {\n\t\treturn false;\n\t}", "@Override\r\n\tpublic void onLongPress(MotionEvent e) {\n\t\tSystem.out.println(\"longpress\");\r\n\t\t\r\n\t}", "@Override\n protected void handleLongClick() {\n }", "@Override\n public void showContextMenu()\n {\n showContextMenu(selection, View.SELECTION);\n }", "public boolean onLongClick(View v) {\n\t\t\treturn itemSelectedUnselectedActionMode(v);\n\t\t}", "@Override\r\n\tpublic boolean onLongClick(View v) {\n\t\tif (mAction != null) {\r\n\t\t\treturn mAction.onContentLongClick(v);\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "public void longPress(int x, int y) {\n TouchAction touch = new TouchAction((MobileDriver) getDriver());\n PointOption pointOption = new PointOption();\n pointOption.withCoordinates(x, y);\n touch.longPress(pointOption).release().perform();\n info(\"Long press successful on coordinates: \" + \"( \" + x + \",\" + y + \" )\");\n\n }", "@Override\n\t\tpublic void onLongPress(MotionEvent e) {\n\t\t\t\n\t\t}", "@Override\n\tpublic void onLongPress(MotionEvent e) {\n\t\t\n\t}", "@Override\n\tpublic void onLongPress(MotionEvent e) {\n\t\t\n\t}", "@Override\n\tpublic void onLongPress(MotionEvent e) {\n\t\t\n\t}", "@Override\n\tpublic void onLongPress(MotionEvent e) {\n\t\t\n\t}", "@Override\n\tpublic void onLongPress(MotionEvent e) {\n\t\t\n\t}", "@Override\n\t\t\t\tpublic void onLongPress(MotionEvent e) {\n\t\t\t\t\t\n\t\t\t\t}", "@Override\n\tpublic void onLongPress(MotionEvent e) {\n\n\t}", "@Override\n\tpublic void onLongPress(MotionEvent e) {\n\n\t}", "@Override\n\tpublic void onLongPress(MotionEvent e) {\n\n\t}", "@Override\n\tpublic void onLongPress(MotionEvent e) {\n\n\t}", "@Override\n\tpublic void onLongPress(MotionEvent e) {\n\n\t}", "@Override\r\n\tpublic void onLongPress(MotionEvent e) {\n\t\t\r\n\t}", "@Override\r\n\tpublic void onLongPress(MotionEvent e) {\n\t\t\r\n\t}", "@Override\n public void onLongPress(MotionEvent e) {}", "@Override\r\n public void onLongPress(MotionEvent e)\r\n {\n }", "@Override\n\tpublic void onLongPress(MotionEvent arg0) {\n\t\t\n\t}", "@Override\n\tpublic void onLongPress(MotionEvent arg0) {\n\t\t\n\t}", "@Override\n\tpublic void onLongPress(MotionEvent arg0) {\n\t\t\n\t}", "@Override\r\n\tpublic void onLongPress(MotionEvent arg0) {\n\t\t\r\n\t}", "@Override\n public void onLongPress(MotionEvent e) {\n }", "@Override\n\tpublic void onLongPress(MotionEvent arg0) {\n\n\t}", "@Override\n\t\t\tpublic boolean onLongClick(View v) {\n\t\t\t\tonQuickLauncherLongClick(v);\n\t\t\t\treturn true;\n\t\t\t}", "@Override\n\t\t\tpublic void onLongPress(MotionEvent arg0)\n\t\t\t{\n\t\t\t\t\n\t\t\t}", "@Override\n public void onLongPress(MotionEvent e) {\n\n }", "@Override\r\n\tpublic void onCreateContextMenu(ContextMenu menu, View v,\r\n\t\t\tContextMenuInfo menuInfo) {\n\t\tgetMenuInflater().inflate(R.menu.long_click_context, menu);\r\n\t\t//menu.setHeaderIcon(R.drawable.qq);\r\n\t\tmenu.setHeaderTitle(\"选项菜单\");//设置菜单标题\r\n\t\tthis.contextmenu = menu;\r\n\t\t\r\n\t\tsuper.onCreateContextMenu(menu, v, menuInfo);\r\n\t}", "@Override\n public void onLongSkillClick(int skill_id, int position) {\n }", "@Override\n public void onLongClick(View view, int position) {\n showActionsDialog(position);\n }", "@Override\r\n\tpublic void rightClick(MouseEvent arg0) {\n\t\t\r\n\t}", "@Override\n public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {\n //menu.setHeaderTitle(\"Select The Action\");\n menu.add(0, v.getId(), 0, \"Edit word\");\n menu.add(1, v.getId(), 0, \"Delete word\");\n\n super.onCreateContextMenu(menu, v, menuInfo);\n }", "@Override\n public void onLongPress(MotionEvent e) {\n\n }", "@Override\n\tpublic void rightClick(MouseEvent e) {\n\n\t}", "private void hookSingleClickAction() {\n\t\tthis.addSelectionChangedListener(new ISelectionChangedListener() {\n\t\t\tpublic void selectionChanged(SelectionChangedEvent event) {\n\t\t\t\tsingleClickAction.run();\n\t\t\t}\n\t\t});\n\t}", "@Override\n public boolean onItemLongClick(AdapterView<?> arg0, View view,\n int pos, long id) {\n\n showPopupMenu(view, pos, id);\n\n return true;\n }", "@Override\n\t\t\tpublic void onRightClick() {\n\t\t\t}", "@Override\n\tpublic void onLongPress(MotionEvent e) {\n\t\tstr.add(\"longpress\");\n\t\ttext1.setText(str.toString());\n\t\tLog.d(\"long\",\"longpress\");\n\t}", "@Override\n public void onLongClick(View view, int position) {\n }", "@Override\n public void onLongPress(MotionEvent e) {\n\n }", "public boolean LongClick() {\r\n\t return EventDispatcher.dispatchEvent(this, \"LongClick\");\r\n\t }", "public void menuItemClicked( Menu2DEvent e );", "void onItemLongClickListener(View view, int postion);", "protected void showContextMenu(FrameEditorSelectionState seln,\n boolean context)\n {\n // Check the context menu enabled states\n setViewEnabledState(seln, ListenerIdentifierMap.CONTEXT);\n\n // Multiple selection?\n if (seln.getElementSelectionCount() > 0) {\n view.showSelectionMenu(context);\n }\n else {\n view.showBlankSpaceMenu();\n }\n }", "abstract void onRightClick(int x, int y, boolean down);", "@Override\n public void showContextMenu(int x, int y)\n {\n // Check which region of the frame was hit\n FrameEltSelnFig<?> eltFig =\n (FrameEltSelnFig<?>)\n frameUI.getFigureAtXY(x,\n y,\n FrameUIModel.ONLY_GRAPHICAL_WIDGETS);\n\n // Check for appropriate MoveHalo\n if (eltFig == null) {\n MoveHalo halo = moveHaloUnderXY(x, y);\n\n if (halo instanceof FrameEltGroupHalo) {\n eltFig = (FrameEltGroupHalo) halo;\n }\n }\n\n // Invocation in empty space?\n if (eltFig == null) {\n contextSelection.deselectAll();\n showContextMenu(contextSelection, View.CONTEXT);\n }\n\n // Invocation on a selection widget\n else if (eltFig.isSelected()) {\n showContextMenu();\n\n Iterator<FrameEltSelnFig<?>> selectedFigs =\n selection.getSelectedFigures();\n\n while (selectedFigs.hasNext()) {\n FrameEltSelnFig<?> selectedFig = selectedFigs.next();\n\n selectedFig.dynamicHighlight(true);\n }\n\n // The mac requires an additional repaint to display the highlight\n if (OSUtils.MACOSX) {\n updateUISupport();\n }\n }\n\n // Invocation on an unselected widget\n else {\n eltFig.dynamicHighlight(true);\n\n // Populate the context selection\n // This does not impact current selection, just the context one.\n contextSelection.setSelectedSelnFig(eltFig);\n\n // Display the correct context menu.\n showContextMenu(contextSelection, View.CONTEXT);\n\n // The mac requires an additional repaint to display highlighting\n if (OSUtils.MACOSX) {\n updateUISupport();\n }\n }\n }", "public void mo21807a(ContextMenu contextMenu, View view, ContextMenuInfo contextMenuInfo) {\n }", "@Override\n public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {\n super.onCreateContextMenu(menu, v, menuInfo);\n menu.setHeaderTitle(\"Select the Action\");\n getMenuInflater().inflate(R.menu.my_context_menu, menu); // add costume menu\n }", "@Override\n public void onLongPress(MotionEvent e) {\n if (null != mLongClickListener) {\n mLongClickListener.onLongClick(getImageView());\n }\n }", "@Override\n public void onLongPress(MotionEvent e) {\n }", "@Override\n public void onLongItemClick(View view, int position) {\n }", "@Override\n public void onLongPress(MotionEvent e) {\n Log.d(TAG, \"onLongPress\");\n }", "@Override\n public void onLongClick(String date, String time) {\n }", "@Override\n public void onLongClick(String date, String time) {\n\n }", "@Override\r\n public void onCreateContextMenu(ContextMenu menu, View v,\r\n ContextMenuInfo menuInfo) {\n return;\r\n }", "@Override\n\t\t\t\tpublic void onItemLongClick(View view, int position) {\n\t\t\t\t\t\n\t\t\t\t}", "public boolean onLongClick(View view) {\n\t\t\t\tif (mActionMode != null) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t// Start the CAB using the ActionMode.Callback defined above\n\t\t\t\tmActionMode = ActionBarTutorialActivity.this\n\t\t\t\t\t\t.startActionMode(mActionModeCallback);\n\t\t\t\t//view.setSelected(true);\n\t\t\t\treturn true;\n\t\t\t}", "@Override\n\tpublic boolean onTextContextMenuItem(int id)\n\t{\n\t\t// Do your thing:\n\t\tboolean consumed = super.onTextContextMenuItem(id);\n\t\t// React:\n\t\tswitch (id)\n\t\t{\n\t\t\tcase android.R.id.cut:\n\t\t\t\tonTextCut();\n\t\t\t\tbreak;\n\t\t\tcase android.R.id.paste:\n\t\t\t\tonTextPaste();\n\t\t\t\tbreak;\n\t\t\tcase android.R.id.copy:\n\t\t\t\tonTextCopy();\n\t\t}\n\t\treturn consumed;\n\t}", "@Override\n\t\t\tpublic boolean onItemLongClick(AdapterView<?> parent, View view,\n\t\t\t\t\tint position, long id) {\n\t\t\t\tlstv.setLongClickable(true);\n\t\t\t\tview.setSelected(true);\n\t\t\t\tview.setPressed(true);\n\t\t\t\t\n\t\t\t\treturn true;\n\t\t\t}", "@Override\n protected void onCreateContextMenu(ContextMenu menu) {\n super.onCreateContextMenu(menu);\n }", "@Override\n\t\tpublic boolean OnLongClick(View view, int time) {\n\t\t\treturn false;\n\t\t}", "@Override\n\t\tpublic boolean OnLongClick(View view, int time) {\n\t\t\treturn false;\n\t\t}", "@Override\n\tpublic void onClick(View v) {\n\t\tv.showContextMenu();\n\t}", "public void addLongListSelectionListener(LongListSelectionListener x) {\n return;\r\n }", "@Override\n public void select(Menu context) {\n updateControllable(context);\n currentStructure.assignWorkersToPowerHarvest(context.getFocus(), PopUpMenuWindow.WorkerMenu());\n }", "@Override\n public boolean onLongClick(View view) {\n return true;\n }", "@Override\n public boolean onLongClick(View view) {\n return true;\n }", "@Override\r\n\t\tpublic boolean onItemLongClick(AdapterView<?> parent, View v,int position, long id) {\n\t\t\tif(!speechFlags[position]&&!subtitleFlags[position])\r\n\t\t\t\treturn false;\r\n\t\t\tmanageItemIndex=position;\r\n\t\t\tmQuickAction.show(v);\r\n\t\t\tGaLogger.sendEvent(\"ui_action\", \"show_dialog\", \"quick_action_menu\", null);\r\n\t\t\t//itemManageDialog=getItemManageDialog(position);\r\n\t\t\t//itemManageDialog.show();\r\n//\t\t\tif(!wakeLock.isHeld()){wakeLock.acquire();}\r\n\t\t\treturn true;\r\n\t\t}", "private void runContextMenuAction(Action a, Project p) {\n if (a instanceof ContextAwareAction) {\n Lookup l = Lookups.singleton(p);\n a = ((ContextAwareAction) a).createContextAwareInstance(l);\n }\n a.actionPerformed(null);\n }", "@Override\n public boolean onLongClick(View view) {\n view.setOnTouchListener(new AppTouchListener());\n return false;\n }", "public void onClick(View v) {\n registerForContextMenu(click);\n openContextMenu(click);\n\n }", "public void onContextMenu(Object event, HTMLElement target) {\n// Logger.log(target);\n// int clientX = ((Number) JsTools.getObjectProperty(event, \"clientX\")).intValue();\n// int clientY = ((Number) JsTools.getObjectProperty(event, \"clientY\")).intValue();\n// \n// contextMenuModel = JsArray.of(\"details\", \"add\", \"remove\", null, \"filter-by-value\");\n// JQuery.Helper.$(\"body\").on(\"click\", (e, d) -> {\n// \n// // TODO e.target holds the clicked menuItem if any...\n// \n// contextMenuModel = null;\n// JQuery.Helper.$(\"body\").off(\"click\");\n// });\n// \n// Scheduler.get().scheduleDeferred(() -> {\n// Object offset = get$().offset();\n// int offsetTop = ((Number) JsTools.getObjectProperty(offset, \"top\")).intValue();\n// int offsetLeft = ((Number) JsTools.getObjectProperty(offset, \"left\")).intValue();\n// Object position = get$().position();\n// int positionTop = ((Number) JsTools.getObjectProperty(position, \"top\")).intValue();\n//\n// get$().find(\".context-menu\").css(\"top\", (clientY - offsetTop + positionTop) + \"px\");\n// get$().find(\".context-menu\").css(\"left\", (clientX - offsetLeft) + \"px\");\n// });\n }", "void onRightClick(double mouseX, double mouseY);", "@Override\n\tpublic boolean onMenuItemSelected(int featureId, MenuItem item) {\n\t\tOptionsMenu.selectItem(item,getApplicationContext());\n\t\treturn super.onMenuItemSelected(featureId, item);\n\t}", "@Override\r\n protected void doSelect(double x, double y, MouseButton button,\r\n int clickCount, boolean shiftDown, boolean shortcutDown) {\n super.doSelect(x, y, button, clickCount, shiftDown, shortcutDown);\r\n }", "@Override\n\tpublic void RightButtonClick() {\n\t\t\n\t}", "@Override\n\tpublic void RightButtonClick() {\n\t\t\n\t}", "@Override\n public void onItemLongClick(int position, View v) {\n }", "@Override\n public boolean onMenuItemSelected(int featureId, MenuItem item) {\n int lSelectedItemID = item.getItemId(); // 액션 메뉴 아이디 확인함.\n if(lSelectedItemID == R.id.action_example){\n // To-do something\n }\n return super.onMenuItemSelected(featureId, item);\n }", "default public void clickMenu() {\n\t\tremoteControlAction(RemoteControlKeyword.MENU);\n\t}", "default public void clickRight() {\n\t\tremoteControlAction(RemoteControlKeyword.RIGHT);\n\t}", "@Override\n public void onContextMenuClosed(Menu menu) {\n \tsuper.onContextMenuClosed(menu);\n \tToast.makeText(this, \"Menu Contextual finalizado\", Toast.LENGTH_LONG).show();\n }", "@Override\n public void onLongPress(MotionEvent event) {\n PickNavigateController.this.onLongPressHandler(event);\n }", "@Override\n\t\t\tpublic void onItemLongClick(CardItemView view, int position) {\n\t\t\t\t\n\t\t\t}", "@Override\n public boolean onItemLongPress(int arg0, OverlayItem arg1) {\n return false;\n }", "@Override\n public boolean onLongClick(View v) {\n longClickListener.onItemLongClicked(getAdapterPosition());\n return true;\n }", "interface OnLongPressedListener{\n\t\tvoid onLongPressed();\n\t}", "public abstract void executeLongPressListView(PokemonApp app, Activity context, int pos);", "@Override\n public void onItemLongClick(View view, int position) {\n }", "@Override\n public boolean onItemLongClick(AdapterView<?> arg0, View view,\n int pos, long id) {\n\n showPagePopupMenu(view, pos, id);\n\n return true;\n }", "public boolean onLongClick(View v) {\n Intent intent = EditFoodActivity.newIntent(getActivity(), mFood.getFoodId(), mFood.getType());\n startActivityForResult(intent, REQUEST_EDIT_FOOD);\n return true;\n }" ]
[ "0.71846753", "0.6944727", "0.69159985", "0.6769514", "0.6750448", "0.67449355", "0.67334116", "0.66398484", "0.6625128", "0.65998274", "0.6508571", "0.6499078", "0.6466025", "0.6409946", "0.6409946", "0.6409946", "0.6409946", "0.6409946", "0.63913417", "0.6384579", "0.6384579", "0.6384579", "0.6384579", "0.6384579", "0.63759", "0.63759", "0.6374462", "0.6367352", "0.63295335", "0.63295335", "0.63295335", "0.629855", "0.62913483", "0.62868863", "0.62756634", "0.626234", "0.62617487", "0.6232164", "0.6193603", "0.6176666", "0.6174256", "0.616083", "0.6159969", "0.61513025", "0.61414415", "0.61412585", "0.6128658", "0.61271775", "0.6122277", "0.6119988", "0.60939133", "0.60921043", "0.6090339", "0.608939", "0.60865676", "0.60769886", "0.6069956", "0.60424817", "0.6037442", "0.6033049", "0.6006325", "0.60007983", "0.599499", "0.5946663", "0.5940057", "0.5936735", "0.5915841", "0.59080243", "0.59030944", "0.5899508", "0.5896219", "0.5896219", "0.5883073", "0.5876607", "0.5876277", "0.5869571", "0.5869571", "0.5858531", "0.58532065", "0.58432496", "0.5834379", "0.5833208", "0.58194304", "0.5796492", "0.5779706", "0.5774386", "0.5774386", "0.57656616", "0.5751154", "0.5744102", "0.57290757", "0.57253814", "0.5720414", "0.57125086", "0.5711251", "0.5696066", "0.56947917", "0.56940466", "0.5692015", "0.5656183", "0.5650802" ]
0.0
-1
/ access modifiers changed from: protected
public void onCreate(Bundle bundle) { super.onCreate(bundle); this.eventDelegate.onCreate(bundle); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n protected void prot() {\n }", "private stendhal() {\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void anular() {\n\n\t}", "private Rekenhulp()\n\t{\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "private abstract void privateabstract();", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "@Override\n\tprotected void interr() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "public void smell() {\n\t\t\n\t}", "public abstract Object mo26777y();", "protected void h() {}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "protected abstract Set method_1559();", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "public abstract void mo70713b();", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "protected Doodler() {\n\t}", "public abstract void mo27386d();", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "private PropertyAccess() {\n\t\tsuper();\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "public abstract void mo56925d();", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void init() {\n }", "@Override\n protected void getExras() {\n }", "@Override\n\tpublic void emprestimo() {\n\n\t}", "public abstract void mo27385c();", "@Override\r\n\t\t\tpublic void buscar() {\n\r\n\t\t\t}", "@Override\n public void memoria() {\n \n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\r\n\tprotected void func03() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void smthAbstr() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void func02() {\n\t\t\t\t\r\n\t\t\t}", "@Override\n\tpublic void dosomething() {\n\t\t\n\t}", "protected boolean func_70814_o() { return true; }", "private void someUtilityMethod() {\n }", "private void someUtilityMethod() {\n }", "public abstract void mo30696a();", "abstract int pregnancy();", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\n\t\t\t\tpublic void a() {\n\n\t\t\t\t}", "@Override\n public void init() {\n\n }", "@Override\n void init() {\n }", "@Override\n\tpublic void leti() \n\t{\n\t}", "private TMCourse() {\n\t}", "public abstract void mo35054b();", "@Override\n public void init() {\n }", "@Override\n\tpublic void buscar() {\n\t\t\n\t}", "private Infer() {\n\n }", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tpublic void erstellen() {\n\t\t\n\t}", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "public final void mo51373a() {\n }", "protected void method_3848() {\r\n super.method_3848();\r\n }", "protected FanisamBato(){\n\t}", "public abstract Object mo1771a();", "public abstract void m15813a();", "public void gored() {\n\t\t\n\t}", "@Override\n public void get() {}", "@Override\n\tpublic void dibuja() {\n\t\t\n\t}", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "private Get() {}", "private Get() {}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "public abstract void mo27464a();", "public abstract String mo41079d();", "@Override\n\tpublic void classroom() {\n\t\t\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\n\tpublic void verkaufen() {\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void logic() {\n\n\t}", "public abstract void mo102899a();", "@SuppressWarnings(\"unused\")\n private void _read() {\n }", "public abstract void mo42329d();", "@Override\r\n\t\t\tpublic void test() {\n\t\t\t}", "@Override\r\n \tpublic void process() {\n \t\t\r\n \t}", "public void method_4270() {}", "public abstract void mo6549b();", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void function() {\n\t\t\n\t}", "protected void init() {\n // to override and use this method\n }" ]
[ "0.7375736", "0.7042321", "0.6922649", "0.6909494", "0.68470824", "0.6830288", "0.68062353", "0.6583185", "0.6539446", "0.65011257", "0.64917654", "0.64917654", "0.64733833", "0.6438831", "0.64330196", "0.64330196", "0.64295477", "0.6426414", "0.6420484", "0.64083177", "0.6406691", "0.6402136", "0.6400287", "0.63977665", "0.63784796", "0.6373787", "0.63716805", "0.63680965", "0.6353791", "0.63344383", "0.6327005", "0.6327005", "0.63259363", "0.63079315", "0.6279023", "0.6271251", "0.62518364", "0.62254924", "0.62218183", "0.6213994", "0.6204108", "0.6195944", "0.61826825", "0.617686", "0.6158371", "0.6138765", "0.61224854", "0.6119267", "0.6119013", "0.61006695", "0.60922325", "0.60922325", "0.6086324", "0.6083917", "0.607071", "0.6070383", "0.6067458", "0.60568124", "0.6047576", "0.6047091", "0.60342956", "0.6031699", "0.6026248", "0.6019563", "0.60169774", "0.6014913", "0.6011912", "0.59969044", "0.59951806", "0.5994921", "0.599172", "0.59913194", "0.5985337", "0.59844744", "0.59678656", "0.5966894", "0.5966894", "0.5966894", "0.5966894", "0.5966894", "0.5966894", "0.59647757", "0.59647757", "0.59616375", "0.5956373", "0.5952514", "0.59497356", "0.59454703", "0.5941018", "0.5934147", "0.5933801", "0.59318185", "0.5931161", "0.5929297", "0.5926942", "0.5925829", "0.5924853", "0.5923296", "0.5922199", "0.59202504", "0.5918595" ]
0.0
-1
/ access modifiers changed from: protected
public void onStart() { super.onStart(); this.eventDelegate.onStart(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n protected void prot() {\n }", "private stendhal() {\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void anular() {\n\n\t}", "private Rekenhulp()\n\t{\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "private abstract void privateabstract();", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "@Override\n\tprotected void interr() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "public void smell() {\n\t\t\n\t}", "public abstract Object mo26777y();", "protected void h() {}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "protected abstract Set method_1559();", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "public abstract void mo70713b();", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "protected Doodler() {\n\t}", "public abstract void mo27386d();", "@Override\n\tprotected void getExras() {\n\n\t}", "private PropertyAccess() {\n\t\tsuper();\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "public abstract void mo56925d();", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void init() {\n }", "@Override\n protected void getExras() {\n }", "@Override\n\tpublic void emprestimo() {\n\n\t}", "public abstract void mo27385c();", "@Override\r\n\t\t\tpublic void buscar() {\n\r\n\t\t\t}", "@Override\n public void memoria() {\n \n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\r\n\tprotected void func03() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void smthAbstr() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void func02() {\n\t\t\t\t\r\n\t\t\t}", "@Override\n\tpublic void dosomething() {\n\t\t\n\t}", "protected boolean func_70814_o() { return true; }", "private void someUtilityMethod() {\n }", "private void someUtilityMethod() {\n }", "public abstract void mo30696a();", "abstract int pregnancy();", "@Override\n\t\t\t\tpublic void a() {\n\n\t\t\t\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n void init() {\n }", "private TMCourse() {\n\t}", "@Override\n\tpublic void leti() \n\t{\n\t}", "public abstract void mo35054b();", "@Override\n public void init() {\n }", "@Override\n\tpublic void buscar() {\n\t\t\n\t}", "private Infer() {\n\n }", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tpublic void erstellen() {\n\t\t\n\t}", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "public final void mo51373a() {\n }", "protected void method_3848() {\r\n super.method_3848();\r\n }", "protected FanisamBato(){\n\t}", "public abstract Object mo1771a();", "public abstract void m15813a();", "@Override\n public void get() {}", "public void gored() {\n\t\t\n\t}", "@Override\n\tpublic void dibuja() {\n\t\t\n\t}", "private Get() {}", "private Get() {}", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "public abstract void mo27464a();", "public abstract String mo41079d();", "@Override\n\tpublic void classroom() {\n\t\t\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\n\tpublic void verkaufen() {\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "public abstract void mo102899a();", "@SuppressWarnings(\"unused\")\n private void _read() {\n }", "public abstract void mo42329d();", "@Override\r\n\t\t\tpublic void test() {\n\t\t\t}", "@Override\r\n \tpublic void process() {\n \t\t\r\n \t}", "public void method_4270() {}", "public abstract void mo6549b();", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void function() {\n\t\t\n\t}", "public abstract String mo118046b();" ]
[ "0.7374581", "0.704046", "0.6921078", "0.6907657", "0.68447137", "0.68278503", "0.68051183", "0.6581499", "0.65379775", "0.65013164", "0.64906055", "0.64906055", "0.6471428", "0.64376146", "0.64308655", "0.64308655", "0.6427683", "0.6424486", "0.64190304", "0.640871", "0.64053404", "0.6400181", "0.63988847", "0.6397776", "0.6377783", "0.6372898", "0.63703156", "0.6366763", "0.63532007", "0.6333713", "0.6325645", "0.63249475", "0.63249475", "0.6305955", "0.62785715", "0.6270012", "0.6250164", "0.62232584", "0.62212026", "0.6211955", "0.6203344", "0.61942434", "0.6181467", "0.6174815", "0.61573285", "0.61370647", "0.6121865", "0.61183035", "0.6117989", "0.6099771", "0.60917133", "0.60917133", "0.6085753", "0.60845906", "0.60690045", "0.60688764", "0.6064975", "0.60543966", "0.60454184", "0.6045176", "0.60337836", "0.60292566", "0.60245013", "0.6018325", "0.60145676", "0.6013568", "0.6010313", "0.5994281", "0.5994048", "0.59938633", "0.59918624", "0.5990596", "0.5983826", "0.59835196", "0.596629", "0.5964607", "0.5964607", "0.5964553", "0.5964553", "0.5964553", "0.5964553", "0.5964553", "0.5964553", "0.59601754", "0.5955775", "0.5953048", "0.5947975", "0.5944416", "0.59391934", "0.59318924", "0.59317297", "0.5931352", "0.59298736", "0.59288", "0.5924899", "0.5924048", "0.5923699", "0.5922455", "0.5919852", "0.59191453", "0.5918418" ]
0.0
-1
/ access modifiers changed from: protected
public void onResume() { super.onResume(); this.eventDelegate.onResume(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n protected void prot() {\n }", "private stendhal() {\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void anular() {\n\n\t}", "private Rekenhulp()\n\t{\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "private abstract void privateabstract();", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "@Override\n\tprotected void interr() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "public void smell() {\n\t\t\n\t}", "public abstract Object mo26777y();", "protected void h() {}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "protected abstract Set method_1559();", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "public abstract void mo70713b();", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "protected Doodler() {\n\t}", "public abstract void mo27386d();", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "private PropertyAccess() {\n\t\tsuper();\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "public abstract void mo56925d();", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void init() {\n }", "@Override\n protected void getExras() {\n }", "@Override\n\tpublic void emprestimo() {\n\n\t}", "public abstract void mo27385c();", "@Override\r\n\t\t\tpublic void buscar() {\n\r\n\t\t\t}", "@Override\n public void memoria() {\n \n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\r\n\tprotected void func03() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void smthAbstr() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void func02() {\n\t\t\t\t\r\n\t\t\t}", "@Override\n\tpublic void dosomething() {\n\t\t\n\t}", "protected boolean func_70814_o() { return true; }", "private void someUtilityMethod() {\n }", "private void someUtilityMethod() {\n }", "public abstract void mo30696a();", "abstract int pregnancy();", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\n\t\t\t\tpublic void a() {\n\n\t\t\t\t}", "@Override\n public void init() {\n\n }", "@Override\n void init() {\n }", "@Override\n\tpublic void leti() \n\t{\n\t}", "private TMCourse() {\n\t}", "public abstract void mo35054b();", "@Override\n public void init() {\n }", "@Override\n\tpublic void buscar() {\n\t\t\n\t}", "private Infer() {\n\n }", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tpublic void erstellen() {\n\t\t\n\t}", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "public final void mo51373a() {\n }", "protected void method_3848() {\r\n super.method_3848();\r\n }", "protected FanisamBato(){\n\t}", "public abstract Object mo1771a();", "public abstract void m15813a();", "public void gored() {\n\t\t\n\t}", "@Override\n public void get() {}", "@Override\n\tpublic void dibuja() {\n\t\t\n\t}", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "private Get() {}", "private Get() {}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "public abstract void mo27464a();", "public abstract String mo41079d();", "@Override\n\tpublic void classroom() {\n\t\t\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\n\tpublic void verkaufen() {\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void logic() {\n\n\t}", "public abstract void mo102899a();", "@SuppressWarnings(\"unused\")\n private void _read() {\n }", "public abstract void mo42329d();", "@Override\r\n\t\t\tpublic void test() {\n\t\t\t}", "@Override\r\n \tpublic void process() {\n \t\t\r\n \t}", "public void method_4270() {}", "public abstract void mo6549b();", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void function() {\n\t\t\n\t}", "protected void init() {\n // to override and use this method\n }" ]
[ "0.7375736", "0.7042321", "0.6922649", "0.6909494", "0.68470824", "0.6830288", "0.68062353", "0.6583185", "0.6539446", "0.65011257", "0.64917654", "0.64917654", "0.64733833", "0.6438831", "0.64330196", "0.64330196", "0.64295477", "0.6426414", "0.6420484", "0.64083177", "0.6406691", "0.6402136", "0.6400287", "0.63977665", "0.63784796", "0.6373787", "0.63716805", "0.63680965", "0.6353791", "0.63344383", "0.6327005", "0.6327005", "0.63259363", "0.63079315", "0.6279023", "0.6271251", "0.62518364", "0.62254924", "0.62218183", "0.6213994", "0.6204108", "0.6195944", "0.61826825", "0.617686", "0.6158371", "0.6138765", "0.61224854", "0.6119267", "0.6119013", "0.61006695", "0.60922325", "0.60922325", "0.6086324", "0.6083917", "0.607071", "0.6070383", "0.6067458", "0.60568124", "0.6047576", "0.6047091", "0.60342956", "0.6031699", "0.6026248", "0.6019563", "0.60169774", "0.6014913", "0.6011912", "0.59969044", "0.59951806", "0.5994921", "0.599172", "0.59913194", "0.5985337", "0.59844744", "0.59678656", "0.5966894", "0.5966894", "0.5966894", "0.5966894", "0.5966894", "0.5966894", "0.59647757", "0.59647757", "0.59616375", "0.5956373", "0.5952514", "0.59497356", "0.59454703", "0.5941018", "0.5934147", "0.5933801", "0.59318185", "0.5931161", "0.5929297", "0.5926942", "0.5925829", "0.5924853", "0.5923296", "0.5922199", "0.59202504", "0.5918595" ]
0.0
-1
/ access modifiers changed from: protected
public void onDestroy() { this.eventDelegate.onDestroy(); super.onDestroy(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n protected void prot() {\n }", "private stendhal() {\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void anular() {\n\n\t}", "private Rekenhulp()\n\t{\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "private abstract void privateabstract();", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "@Override\n\tprotected void interr() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "public void smell() {\n\t\t\n\t}", "public abstract Object mo26777y();", "protected void h() {}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "protected abstract Set method_1559();", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "public abstract void mo70713b();", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "protected Doodler() {\n\t}", "public abstract void mo27386d();", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "private PropertyAccess() {\n\t\tsuper();\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "public abstract void mo56925d();", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void init() {\n }", "@Override\n protected void getExras() {\n }", "@Override\n\tpublic void emprestimo() {\n\n\t}", "public abstract void mo27385c();", "@Override\r\n\t\t\tpublic void buscar() {\n\r\n\t\t\t}", "@Override\n public void memoria() {\n \n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\r\n\tprotected void func03() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void smthAbstr() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void func02() {\n\t\t\t\t\r\n\t\t\t}", "@Override\n\tpublic void dosomething() {\n\t\t\n\t}", "protected boolean func_70814_o() { return true; }", "private void someUtilityMethod() {\n }", "private void someUtilityMethod() {\n }", "public abstract void mo30696a();", "abstract int pregnancy();", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\n\t\t\t\tpublic void a() {\n\n\t\t\t\t}", "@Override\n public void init() {\n\n }", "@Override\n void init() {\n }", "@Override\n\tpublic void leti() \n\t{\n\t}", "private TMCourse() {\n\t}", "public abstract void mo35054b();", "@Override\n public void init() {\n }", "@Override\n\tpublic void buscar() {\n\t\t\n\t}", "private Infer() {\n\n }", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tpublic void erstellen() {\n\t\t\n\t}", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "public final void mo51373a() {\n }", "protected void method_3848() {\r\n super.method_3848();\r\n }", "protected FanisamBato(){\n\t}", "public abstract Object mo1771a();", "public abstract void m15813a();", "public void gored() {\n\t\t\n\t}", "@Override\n public void get() {}", "@Override\n\tpublic void dibuja() {\n\t\t\n\t}", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "private Get() {}", "private Get() {}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "public abstract void mo27464a();", "public abstract String mo41079d();", "@Override\n\tpublic void classroom() {\n\t\t\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\n\tpublic void verkaufen() {\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void logic() {\n\n\t}", "public abstract void mo102899a();", "@SuppressWarnings(\"unused\")\n private void _read() {\n }", "public abstract void mo42329d();", "@Override\r\n\t\t\tpublic void test() {\n\t\t\t}", "@Override\r\n \tpublic void process() {\n \t\t\r\n \t}", "public void method_4270() {}", "public abstract void mo6549b();", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void function() {\n\t\t\n\t}", "protected void init() {\n // to override and use this method\n }" ]
[ "0.7375736", "0.7042321", "0.6922649", "0.6909494", "0.68470824", "0.6830288", "0.68062353", "0.6583185", "0.6539446", "0.65011257", "0.64917654", "0.64917654", "0.64733833", "0.6438831", "0.64330196", "0.64330196", "0.64295477", "0.6426414", "0.6420484", "0.64083177", "0.6406691", "0.6402136", "0.6400287", "0.63977665", "0.63784796", "0.6373787", "0.63716805", "0.63680965", "0.6353791", "0.63344383", "0.6327005", "0.6327005", "0.63259363", "0.63079315", "0.6279023", "0.6271251", "0.62518364", "0.62254924", "0.62218183", "0.6213994", "0.6204108", "0.6195944", "0.61826825", "0.617686", "0.6158371", "0.6138765", "0.61224854", "0.6119267", "0.6119013", "0.61006695", "0.60922325", "0.60922325", "0.6086324", "0.6083917", "0.607071", "0.6070383", "0.6067458", "0.60568124", "0.6047576", "0.6047091", "0.60342956", "0.6031699", "0.6026248", "0.6019563", "0.60169774", "0.6014913", "0.6011912", "0.59969044", "0.59951806", "0.5994921", "0.599172", "0.59913194", "0.5985337", "0.59844744", "0.59678656", "0.5966894", "0.5966894", "0.5966894", "0.5966894", "0.5966894", "0.5966894", "0.59647757", "0.59647757", "0.59616375", "0.5956373", "0.5952514", "0.59497356", "0.59454703", "0.5941018", "0.5934147", "0.5933801", "0.59318185", "0.5931161", "0.5929297", "0.5926942", "0.5925829", "0.5924853", "0.5923296", "0.5922199", "0.59202504", "0.5918595" ]
0.0
-1
/ access modifiers changed from: protected
public void onStop() { this.eventDelegate.onStop(); super.onStop(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n protected void prot() {\n }", "private stendhal() {\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void anular() {\n\n\t}", "private Rekenhulp()\n\t{\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "private abstract void privateabstract();", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "@Override\n\tprotected void interr() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "public void smell() {\n\t\t\n\t}", "public abstract Object mo26777y();", "protected void h() {}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "protected abstract Set method_1559();", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "public abstract void mo70713b();", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "protected Doodler() {\n\t}", "public abstract void mo27386d();", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "private PropertyAccess() {\n\t\tsuper();\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "public abstract void mo56925d();", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void init() {\n }", "@Override\n protected void getExras() {\n }", "@Override\n\tpublic void emprestimo() {\n\n\t}", "public abstract void mo27385c();", "@Override\r\n\t\t\tpublic void buscar() {\n\r\n\t\t\t}", "@Override\n public void memoria() {\n \n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\r\n\tprotected void func03() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void smthAbstr() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void func02() {\n\t\t\t\t\r\n\t\t\t}", "@Override\n\tpublic void dosomething() {\n\t\t\n\t}", "protected boolean func_70814_o() { return true; }", "private void someUtilityMethod() {\n }", "private void someUtilityMethod() {\n }", "public abstract void mo30696a();", "abstract int pregnancy();", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\n\t\t\t\tpublic void a() {\n\n\t\t\t\t}", "@Override\n public void init() {\n\n }", "@Override\n void init() {\n }", "@Override\n\tpublic void leti() \n\t{\n\t}", "private TMCourse() {\n\t}", "public abstract void mo35054b();", "@Override\n public void init() {\n }", "@Override\n\tpublic void buscar() {\n\t\t\n\t}", "private Infer() {\n\n }", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tpublic void erstellen() {\n\t\t\n\t}", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "public final void mo51373a() {\n }", "protected void method_3848() {\r\n super.method_3848();\r\n }", "protected FanisamBato(){\n\t}", "public abstract Object mo1771a();", "public abstract void m15813a();", "public void gored() {\n\t\t\n\t}", "@Override\n public void get() {}", "@Override\n\tpublic void dibuja() {\n\t\t\n\t}", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "private Get() {}", "private Get() {}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "public abstract void mo27464a();", "public abstract String mo41079d();", "@Override\n\tpublic void classroom() {\n\t\t\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\n\tpublic void verkaufen() {\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void logic() {\n\n\t}", "public abstract void mo102899a();", "@SuppressWarnings(\"unused\")\n private void _read() {\n }", "public abstract void mo42329d();", "@Override\r\n\t\t\tpublic void test() {\n\t\t\t}", "@Override\r\n \tpublic void process() {\n \t\t\r\n \t}", "public void method_4270() {}", "public abstract void mo6549b();", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void function() {\n\t\t\n\t}", "protected void init() {\n // to override and use this method\n }" ]
[ "0.7375736", "0.7042321", "0.6922649", "0.6909494", "0.68470824", "0.6830288", "0.68062353", "0.6583185", "0.6539446", "0.65011257", "0.64917654", "0.64917654", "0.64733833", "0.6438831", "0.64330196", "0.64330196", "0.64295477", "0.6426414", "0.6420484", "0.64083177", "0.6406691", "0.6402136", "0.6400287", "0.63977665", "0.63784796", "0.6373787", "0.63716805", "0.63680965", "0.6353791", "0.63344383", "0.6327005", "0.6327005", "0.63259363", "0.63079315", "0.6279023", "0.6271251", "0.62518364", "0.62254924", "0.62218183", "0.6213994", "0.6204108", "0.6195944", "0.61826825", "0.617686", "0.6158371", "0.6138765", "0.61224854", "0.6119267", "0.6119013", "0.61006695", "0.60922325", "0.60922325", "0.6086324", "0.6083917", "0.607071", "0.6070383", "0.6067458", "0.60568124", "0.6047576", "0.6047091", "0.60342956", "0.6031699", "0.6026248", "0.6019563", "0.60169774", "0.6014913", "0.6011912", "0.59969044", "0.59951806", "0.5994921", "0.599172", "0.59913194", "0.5985337", "0.59844744", "0.59678656", "0.5966894", "0.5966894", "0.5966894", "0.5966894", "0.5966894", "0.5966894", "0.59647757", "0.59647757", "0.59616375", "0.5956373", "0.5952514", "0.59497356", "0.59454703", "0.5941018", "0.5934147", "0.5933801", "0.59318185", "0.5931161", "0.5929297", "0.5926942", "0.5925829", "0.5924853", "0.5923296", "0.5922199", "0.59202504", "0.5918595" ]
0.0
-1
/ access modifiers changed from: protected
public void onPause() { super.onPause(); this.eventDelegate.onPause(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n protected void prot() {\n }", "private stendhal() {\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void anular() {\n\n\t}", "private Rekenhulp()\n\t{\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "private abstract void privateabstract();", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "@Override\n\tprotected void interr() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "public void smell() {\n\t\t\n\t}", "public abstract Object mo26777y();", "protected void h() {}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "protected abstract Set method_1559();", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "public abstract void mo70713b();", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "protected Doodler() {\n\t}", "public abstract void mo27386d();", "@Override\n\tprotected void getExras() {\n\n\t}", "private PropertyAccess() {\n\t\tsuper();\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "public abstract void mo56925d();", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void init() {\n }", "@Override\n protected void getExras() {\n }", "@Override\n\tpublic void emprestimo() {\n\n\t}", "public abstract void mo27385c();", "@Override\r\n\t\t\tpublic void buscar() {\n\r\n\t\t\t}", "@Override\n public void memoria() {\n \n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\r\n\tprotected void func03() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void smthAbstr() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void func02() {\n\t\t\t\t\r\n\t\t\t}", "@Override\n\tpublic void dosomething() {\n\t\t\n\t}", "protected boolean func_70814_o() { return true; }", "private void someUtilityMethod() {\n }", "private void someUtilityMethod() {\n }", "public abstract void mo30696a();", "abstract int pregnancy();", "@Override\n\t\t\t\tpublic void a() {\n\n\t\t\t\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n void init() {\n }", "private TMCourse() {\n\t}", "@Override\n\tpublic void leti() \n\t{\n\t}", "public abstract void mo35054b();", "@Override\n public void init() {\n }", "@Override\n\tpublic void buscar() {\n\t\t\n\t}", "private Infer() {\n\n }", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tpublic void erstellen() {\n\t\t\n\t}", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "public final void mo51373a() {\n }", "protected void method_3848() {\r\n super.method_3848();\r\n }", "protected FanisamBato(){\n\t}", "public abstract Object mo1771a();", "public abstract void m15813a();", "@Override\n public void get() {}", "public void gored() {\n\t\t\n\t}", "@Override\n\tpublic void dibuja() {\n\t\t\n\t}", "private Get() {}", "private Get() {}", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "public abstract void mo27464a();", "public abstract String mo41079d();", "@Override\n\tpublic void classroom() {\n\t\t\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\n\tpublic void verkaufen() {\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "public abstract void mo102899a();", "@SuppressWarnings(\"unused\")\n private void _read() {\n }", "public abstract void mo42329d();", "@Override\r\n\t\t\tpublic void test() {\n\t\t\t}", "@Override\r\n \tpublic void process() {\n \t\t\r\n \t}", "public void method_4270() {}", "public abstract void mo6549b();", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void function() {\n\t\t\n\t}", "public abstract String mo118046b();" ]
[ "0.7374581", "0.704046", "0.6921078", "0.6907657", "0.68447137", "0.68278503", "0.68051183", "0.6581499", "0.65379775", "0.65013164", "0.64906055", "0.64906055", "0.6471428", "0.64376146", "0.64308655", "0.64308655", "0.6427683", "0.6424486", "0.64190304", "0.640871", "0.64053404", "0.6400181", "0.63988847", "0.6397776", "0.6377783", "0.6372898", "0.63703156", "0.6366763", "0.63532007", "0.6333713", "0.6325645", "0.63249475", "0.63249475", "0.6305955", "0.62785715", "0.6270012", "0.6250164", "0.62232584", "0.62212026", "0.6211955", "0.6203344", "0.61942434", "0.6181467", "0.6174815", "0.61573285", "0.61370647", "0.6121865", "0.61183035", "0.6117989", "0.6099771", "0.60917133", "0.60917133", "0.6085753", "0.60845906", "0.60690045", "0.60688764", "0.6064975", "0.60543966", "0.60454184", "0.6045176", "0.60337836", "0.60292566", "0.60245013", "0.6018325", "0.60145676", "0.6013568", "0.6010313", "0.5994281", "0.5994048", "0.59938633", "0.59918624", "0.5990596", "0.5983826", "0.59835196", "0.596629", "0.5964607", "0.5964607", "0.5964553", "0.5964553", "0.5964553", "0.5964553", "0.5964553", "0.5964553", "0.59601754", "0.5955775", "0.5953048", "0.5947975", "0.5944416", "0.59391934", "0.59318924", "0.59317297", "0.5931352", "0.59298736", "0.59288", "0.5924899", "0.5924048", "0.5923699", "0.5922455", "0.5919852", "0.59191453", "0.5918418" ]
0.0
-1
/ access modifiers changed from: protected
public void onPostResume() { super.onPostResume(); this.eventDelegate.onPostResume(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n protected void prot() {\n }", "private stendhal() {\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void anular() {\n\n\t}", "private Rekenhulp()\n\t{\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "private abstract void privateabstract();", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "@Override\n\tprotected void interr() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "public void smell() {\n\t\t\n\t}", "public abstract Object mo26777y();", "protected void h() {}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "protected abstract Set method_1559();", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "public abstract void mo70713b();", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "protected Doodler() {\n\t}", "public abstract void mo27386d();", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "private PropertyAccess() {\n\t\tsuper();\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "public abstract void mo56925d();", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void init() {\n }", "@Override\n protected void getExras() {\n }", "@Override\n\tpublic void emprestimo() {\n\n\t}", "public abstract void mo27385c();", "@Override\r\n\t\t\tpublic void buscar() {\n\r\n\t\t\t}", "@Override\n public void memoria() {\n \n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\r\n\tprotected void func03() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void smthAbstr() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void func02() {\n\t\t\t\t\r\n\t\t\t}", "@Override\n\tpublic void dosomething() {\n\t\t\n\t}", "protected boolean func_70814_o() { return true; }", "private void someUtilityMethod() {\n }", "private void someUtilityMethod() {\n }", "public abstract void mo30696a();", "abstract int pregnancy();", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\n\t\t\t\tpublic void a() {\n\n\t\t\t\t}", "@Override\n public void init() {\n\n }", "@Override\n void init() {\n }", "@Override\n\tpublic void leti() \n\t{\n\t}", "private TMCourse() {\n\t}", "public abstract void mo35054b();", "@Override\n public void init() {\n }", "@Override\n\tpublic void buscar() {\n\t\t\n\t}", "private Infer() {\n\n }", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tpublic void erstellen() {\n\t\t\n\t}", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "public final void mo51373a() {\n }", "protected void method_3848() {\r\n super.method_3848();\r\n }", "protected FanisamBato(){\n\t}", "public abstract Object mo1771a();", "public abstract void m15813a();", "public void gored() {\n\t\t\n\t}", "@Override\n public void get() {}", "@Override\n\tpublic void dibuja() {\n\t\t\n\t}", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "private Get() {}", "private Get() {}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "public abstract void mo27464a();", "public abstract String mo41079d();", "@Override\n\tpublic void classroom() {\n\t\t\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\n\tpublic void verkaufen() {\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void logic() {\n\n\t}", "public abstract void mo102899a();", "@SuppressWarnings(\"unused\")\n private void _read() {\n }", "public abstract void mo42329d();", "@Override\r\n\t\t\tpublic void test() {\n\t\t\t}", "@Override\r\n \tpublic void process() {\n \t\t\r\n \t}", "public void method_4270() {}", "public abstract void mo6549b();", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void function() {\n\t\t\n\t}", "protected void init() {\n // to override and use this method\n }" ]
[ "0.7375736", "0.7042321", "0.6922649", "0.6909494", "0.68470824", "0.6830288", "0.68062353", "0.6583185", "0.6539446", "0.65011257", "0.64917654", "0.64917654", "0.64733833", "0.6438831", "0.64330196", "0.64330196", "0.64295477", "0.6426414", "0.6420484", "0.64083177", "0.6406691", "0.6402136", "0.6400287", "0.63977665", "0.63784796", "0.6373787", "0.63716805", "0.63680965", "0.6353791", "0.63344383", "0.6327005", "0.6327005", "0.63259363", "0.63079315", "0.6279023", "0.6271251", "0.62518364", "0.62254924", "0.62218183", "0.6213994", "0.6204108", "0.6195944", "0.61826825", "0.617686", "0.6158371", "0.6138765", "0.61224854", "0.6119267", "0.6119013", "0.61006695", "0.60922325", "0.60922325", "0.6086324", "0.6083917", "0.607071", "0.6070383", "0.6067458", "0.60568124", "0.6047576", "0.6047091", "0.60342956", "0.6031699", "0.6026248", "0.6019563", "0.60169774", "0.6014913", "0.6011912", "0.59969044", "0.59951806", "0.5994921", "0.599172", "0.59913194", "0.5985337", "0.59844744", "0.59678656", "0.5966894", "0.5966894", "0.5966894", "0.5966894", "0.5966894", "0.5966894", "0.59647757", "0.59647757", "0.59616375", "0.5956373", "0.5952514", "0.59497356", "0.59454703", "0.5941018", "0.5934147", "0.5933801", "0.59318185", "0.5931161", "0.5929297", "0.5926942", "0.5925829", "0.5924853", "0.5923296", "0.5922199", "0.59202504", "0.5918595" ]
0.0
-1
/ access modifiers changed from: protected
public void onActivityResult(int i, int i2, Intent intent) { if (!this.eventDelegate.onActivityResult(i, i2, intent)) { super.onActivityResult(i, i2, intent); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n protected void prot() {\n }", "private stendhal() {\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void anular() {\n\n\t}", "private Rekenhulp()\n\t{\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "private abstract void privateabstract();", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "@Override\n\tprotected void interr() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "public void smell() {\n\t\t\n\t}", "public abstract Object mo26777y();", "protected void h() {}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "protected abstract Set method_1559();", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "public abstract void mo70713b();", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "protected Doodler() {\n\t}", "public abstract void mo27386d();", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "private PropertyAccess() {\n\t\tsuper();\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "public abstract void mo56925d();", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void init() {\n }", "@Override\n protected void getExras() {\n }", "@Override\n\tpublic void emprestimo() {\n\n\t}", "public abstract void mo27385c();", "@Override\r\n\t\t\tpublic void buscar() {\n\r\n\t\t\t}", "@Override\n public void memoria() {\n \n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\r\n\tprotected void func03() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void smthAbstr() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void func02() {\n\t\t\t\t\r\n\t\t\t}", "@Override\n\tpublic void dosomething() {\n\t\t\n\t}", "protected boolean func_70814_o() { return true; }", "private void someUtilityMethod() {\n }", "private void someUtilityMethod() {\n }", "public abstract void mo30696a();", "abstract int pregnancy();", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\n\t\t\t\tpublic void a() {\n\n\t\t\t\t}", "@Override\n public void init() {\n\n }", "@Override\n void init() {\n }", "@Override\n\tpublic void leti() \n\t{\n\t}", "private TMCourse() {\n\t}", "public abstract void mo35054b();", "@Override\n public void init() {\n }", "@Override\n\tpublic void buscar() {\n\t\t\n\t}", "private Infer() {\n\n }", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tpublic void erstellen() {\n\t\t\n\t}", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "public final void mo51373a() {\n }", "protected void method_3848() {\r\n super.method_3848();\r\n }", "protected FanisamBato(){\n\t}", "public abstract Object mo1771a();", "public abstract void m15813a();", "public void gored() {\n\t\t\n\t}", "@Override\n public void get() {}", "@Override\n\tpublic void dibuja() {\n\t\t\n\t}", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "private Get() {}", "private Get() {}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "public abstract void mo27464a();", "public abstract String mo41079d();", "@Override\n\tpublic void classroom() {\n\t\t\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\n\tpublic void verkaufen() {\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void logic() {\n\n\t}", "public abstract void mo102899a();", "@SuppressWarnings(\"unused\")\n private void _read() {\n }", "public abstract void mo42329d();", "@Override\r\n\t\t\tpublic void test() {\n\t\t\t}", "@Override\r\n \tpublic void process() {\n \t\t\r\n \t}", "public void method_4270() {}", "public abstract void mo6549b();", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void function() {\n\t\t\n\t}", "protected void init() {\n // to override and use this method\n }" ]
[ "0.7375736", "0.7042321", "0.6922649", "0.6909494", "0.68470824", "0.6830288", "0.68062353", "0.6583185", "0.6539446", "0.65011257", "0.64917654", "0.64917654", "0.64733833", "0.6438831", "0.64330196", "0.64330196", "0.64295477", "0.6426414", "0.6420484", "0.64083177", "0.6406691", "0.6402136", "0.6400287", "0.63977665", "0.63784796", "0.6373787", "0.63716805", "0.63680965", "0.6353791", "0.63344383", "0.6327005", "0.6327005", "0.63259363", "0.63079315", "0.6279023", "0.6271251", "0.62518364", "0.62254924", "0.62218183", "0.6213994", "0.6204108", "0.6195944", "0.61826825", "0.617686", "0.6158371", "0.6138765", "0.61224854", "0.6119267", "0.6119013", "0.61006695", "0.60922325", "0.60922325", "0.6086324", "0.6083917", "0.607071", "0.6070383", "0.6067458", "0.60568124", "0.6047576", "0.6047091", "0.60342956", "0.6031699", "0.6026248", "0.6019563", "0.60169774", "0.6014913", "0.6011912", "0.59969044", "0.59951806", "0.5994921", "0.599172", "0.59913194", "0.5985337", "0.59844744", "0.59678656", "0.5966894", "0.5966894", "0.5966894", "0.5966894", "0.5966894", "0.5966894", "0.59647757", "0.59647757", "0.59616375", "0.5956373", "0.5952514", "0.59497356", "0.59454703", "0.5941018", "0.5934147", "0.5933801", "0.59318185", "0.5931161", "0.5929297", "0.5926942", "0.5925829", "0.5924853", "0.5923296", "0.5922199", "0.59202504", "0.5918595" ]
0.0
-1
/ access modifiers changed from: protected
public void onNewIntent(Intent intent) { this.eventDelegate.onNewIntent(intent); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n protected void prot() {\n }", "private stendhal() {\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void anular() {\n\n\t}", "private Rekenhulp()\n\t{\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "private abstract void privateabstract();", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "@Override\n\tprotected void interr() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "public void smell() {\n\t\t\n\t}", "public abstract Object mo26777y();", "protected void h() {}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "protected abstract Set method_1559();", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "public abstract void mo70713b();", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "protected Doodler() {\n\t}", "public abstract void mo27386d();", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "private PropertyAccess() {\n\t\tsuper();\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "public abstract void mo56925d();", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void init() {\n }", "@Override\n protected void getExras() {\n }", "@Override\n\tpublic void emprestimo() {\n\n\t}", "public abstract void mo27385c();", "@Override\r\n\t\t\tpublic void buscar() {\n\r\n\t\t\t}", "@Override\n public void memoria() {\n \n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\r\n\tprotected void func03() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void smthAbstr() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void func02() {\n\t\t\t\t\r\n\t\t\t}", "@Override\n\tpublic void dosomething() {\n\t\t\n\t}", "protected boolean func_70814_o() { return true; }", "private void someUtilityMethod() {\n }", "private void someUtilityMethod() {\n }", "public abstract void mo30696a();", "abstract int pregnancy();", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\n\t\t\t\tpublic void a() {\n\n\t\t\t\t}", "@Override\n public void init() {\n\n }", "@Override\n void init() {\n }", "@Override\n\tpublic void leti() \n\t{\n\t}", "private TMCourse() {\n\t}", "public abstract void mo35054b();", "@Override\n public void init() {\n }", "@Override\n\tpublic void buscar() {\n\t\t\n\t}", "private Infer() {\n\n }", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tpublic void erstellen() {\n\t\t\n\t}", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "public final void mo51373a() {\n }", "protected void method_3848() {\r\n super.method_3848();\r\n }", "protected FanisamBato(){\n\t}", "public abstract Object mo1771a();", "public abstract void m15813a();", "public void gored() {\n\t\t\n\t}", "@Override\n public void get() {}", "@Override\n\tpublic void dibuja() {\n\t\t\n\t}", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "private Get() {}", "private Get() {}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "public abstract void mo27464a();", "public abstract String mo41079d();", "@Override\n\tpublic void classroom() {\n\t\t\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\n\tpublic void verkaufen() {\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void logic() {\n\n\t}", "public abstract void mo102899a();", "@SuppressWarnings(\"unused\")\n private void _read() {\n }", "public abstract void mo42329d();", "@Override\r\n\t\t\tpublic void test() {\n\t\t\t}", "@Override\r\n \tpublic void process() {\n \t\t\r\n \t}", "public void method_4270() {}", "public abstract void mo6549b();", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void function() {\n\t\t\n\t}", "protected void init() {\n // to override and use this method\n }" ]
[ "0.7375736", "0.7042321", "0.6922649", "0.6909494", "0.68470824", "0.6830288", "0.68062353", "0.6583185", "0.6539446", "0.65011257", "0.64917654", "0.64917654", "0.64733833", "0.6438831", "0.64330196", "0.64330196", "0.64295477", "0.6426414", "0.6420484", "0.64083177", "0.6406691", "0.6402136", "0.6400287", "0.63977665", "0.63784796", "0.6373787", "0.63716805", "0.63680965", "0.6353791", "0.63344383", "0.6327005", "0.6327005", "0.63259363", "0.63079315", "0.6279023", "0.6271251", "0.62518364", "0.62254924", "0.62218183", "0.6213994", "0.6204108", "0.6195944", "0.61826825", "0.617686", "0.6158371", "0.6138765", "0.61224854", "0.6119267", "0.6119013", "0.61006695", "0.60922325", "0.60922325", "0.6086324", "0.6083917", "0.607071", "0.6070383", "0.6067458", "0.60568124", "0.6047576", "0.6047091", "0.60342956", "0.6031699", "0.6026248", "0.6019563", "0.60169774", "0.6014913", "0.6011912", "0.59969044", "0.59951806", "0.5994921", "0.599172", "0.59913194", "0.5985337", "0.59844744", "0.59678656", "0.5966894", "0.5966894", "0.5966894", "0.5966894", "0.5966894", "0.5966894", "0.59647757", "0.59647757", "0.59616375", "0.5956373", "0.5952514", "0.59497356", "0.59454703", "0.5941018", "0.5934147", "0.5933801", "0.59318185", "0.5931161", "0.5929297", "0.5926942", "0.5925829", "0.5924853", "0.5923296", "0.5922199", "0.59202504", "0.5918595" ]
0.0
-1
TODO Autogenerated method stub
public static void main(String[] args) { String filePath = FilePath.FILE_PATH; try { // File 클래스는 자바에서 파일 및 폴더 객체를 다루는 클래스이다. // new File() : File 클래스의 인스턴스를 생성 // 실제 하드디스크에 물리적인 파일/폴더(디렉토리)를 생성하지 않는다. // 실제 파일/폴더(디렉토리)를 만들기 위해서는 File 클래스에 있는 함수를 호출해야 한다. // createNewFile(), mkdir(), mkdirs() File f = new File("aaaaaa"); System.out.println("f >>> : " + f); System.out.println("f.getName() >>> : " + f.getName()); boolean bf = f.createNewFile(); System.out.println("bf >>> : " + bf); boolean bdir = f.isDirectory(); System.out.println("bdir >>> : " + bdir); boolean bfile = f.isFile(); System.out.println("bfile >>> : " + bfile); String getPath = f.getPath(); // File에 입력된 경로 출력 System.out.println("getPath >>> : " + getPath); String getAbsolutePath = f.getAbsolutePath(); // 현재경로 + 입력된 경로(연산되지 않은 경로) System.out.println("getAbsolutePath >>> : " + getAbsolutePath); String getCanonicalPath = f.getCanonicalPath(); // 현재경로 + 입력된 경로(연산된 경로) System.out.println("getCanonicalPath >>> : " + getCanonicalPath); File f1 = new File(filePath + "/" + "aaaaaa.txt"); System.out.println("f1 >>> : " + f1); System.out.println("f1.getName() >>> : " + f1.getName()); boolean bf1 = f1.createNewFile(); System.out.println("bf1 >>> : " + bf1); boolean bdir1 = f1.isDirectory(); System.out.println("bdir1 >>> : " + bdir1); boolean bfile1 = f1.isFile(); System.out.println("bfile1 >>> : " + bfile1); String getPath1 = f1.getPath(); // File에 입력된 경로 출력 System.out.println("getPath1 >>> : " + getPath1); String getAbsolutePath1 = f1.getAbsolutePath(); // 현재경로 + 입력된 경로(연산되지 않은 경로) System.out.println("getAbsolutePath1 >>> : " + getAbsolutePath1); String getCanonicalPath1 = f1.getCanonicalPath(); // 현재경로 + 입력된 경로(연산된 경로) System.out.println("getCanonicalPath1 >>> : " + getCanonicalPath1); }catch(Exception io) { } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.66713095", "0.6567948", "0.652319", "0.648097", "0.64770466", "0.64586824", "0.64132667", "0.6376419", "0.62759", "0.62545097", "0.62371093", "0.62237984", "0.6201738", "0.619477", "0.619477", "0.61924416", "0.61872935", "0.6173417", "0.613289", "0.6127952", "0.6080854", "0.6076905", "0.6041205", "0.6024897", "0.60200036", "0.59985113", "0.5967729", "0.5967729", "0.5965808", "0.5949083", "0.5941002", "0.59236866", "0.5909713", "0.59030116", "0.589475", "0.58857024", "0.58837134", "0.586915", "0.58575684", "0.5850424", "0.5847001", "0.5824116", "0.5810248", "0.5809659", "0.58069366", "0.58069366", "0.5800507", "0.5792168", "0.5792168", "0.5792168", "0.5792168", "0.5792168", "0.5792168", "0.57900196", "0.5790005", "0.578691", "0.578416", "0.578416", "0.5774115", "0.5774115", "0.5774115", "0.5774115", "0.5774115", "0.5761079", "0.57592577", "0.57592577", "0.5749888", "0.5749888", "0.5749888", "0.5748457", "0.5733414", "0.5733414", "0.5733414", "0.57209575", "0.57154554", "0.57149583", "0.57140404", "0.57140404", "0.57140404", "0.57140404", "0.57140404", "0.57140404", "0.57140404", "0.571194", "0.57043016", "0.56993437", "0.5696782", "0.5687825", "0.5677794", "0.5673577", "0.5672046", "0.5669512", "0.5661156", "0.56579345", "0.5655569", "0.5655569", "0.5655569", "0.56546396", "0.56543446", "0.5653163", "0.56502634" ]
0.0
-1
This callback is overriden
@PreDestroy void destroy(InvocationContext ctx) throws Exception { SuperclassInterceptorMethodsTest.LIFECYCLE_CALLBACKS.add("c"); ctx.proceed(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\t\t\tpublic void callbackCall() {\n\t\t\t}", "@Override\n\tpublic void callback() {\n\t}", "@Override\n\tpublic void onCallback() {\n\t\t\n\t}", "@Override\n\t\t\t\t\t\t\t\t\tpublic void callback(int position) {\n\n\t\t\t\t\t\t\t\t\t}", "@Override\n\t\t\t\t\tpublic void onFinish() {\n\t\t\t\t\t}", "@Override\n\t\t\t\t\tpublic void onFinish() {\n\t\t\t\t\t}", "@Override\n\t\t\t\t\tpublic void onFinish() {\n\n\t\t\t\t\t}", "@Override\n public void onFinish() {\n }", "@Override\n public void onFinish() {\n }", "@Override\r\n public void onFinish() {\n }", "protected void onBegin() {}", "@Override\n public void onFinish() {\n\t\t\t\n }", "public void callback() {\n }", "@Override\r\n\tpublic void onCustomUpdate() {\n\t\t\r\n\t}", "@Override\n public void onCallBack(int pos) {\n }", "@Override\r\n\t\t\tpublic void onRequest() {\n\t\t\t\t\r\n\t\t\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void callback(Object o) {}", "@Override\n public void onFinish() {\n }", "@Override\n public void onFinished() {\n }", "@Override\n public void onFinished() {\n }", "@Override\n public void onComplete() {\n }", "@Override\n public void onComplete() {\n }", "@Override\n public void onComplete() {\n }", "@Override\n public void onComplete() {\n }", "@Override\n public void onComplete() {\n }", "@Override\n public void onComplete() {\n }", "@Override\n public void onComplete() {\n }", "@Override\n public void onComplete() {\n }", "@Override\n public void onComplete() {\n }", "@Override\n public void onComplete() {\n }", "@Override\n public void onComplete() {\n }", "@Override\n public void onComplete() {\n }", "@Override\n public void onFinished() {\n\n }", "protected void javaCallback() {\n\t}", "@Override\n public void onSetSuccess() {\n }", "@Override\n public void onSetSuccess() {\n }", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "public void onBegin() {\n\t\t\t\t\t\t\n\t\t\t\t\t}", "@Override\n public void onFinished() {\n\n }", "@Override\n public void onCompleted() {\n }", "@Override\n public void onCompleted() {\n }", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "@Override\n public void onCancelled(CancelledException arg0) {\n }", "@Override\n public void onCancelled(CancelledException arg0) {\n }", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n protected void onDataChanged() {\n }", "@Override\r\n\t\t\tpublic void onCompleted() {\n\r\n\t\t\t}", "@Override\n\t\tpublic void onFinish() {\n\t\t}", "@Override\n protected void onCancelled() {\n super.onCancelled();\n }", "@Override\n public void onCancelled(CancelledException arg0) {\n\n }", "@Override\r\n\t\tprotected void run() {\n\t\t\t\r\n\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void onCancelled(CancelledException arg0) {\n\n }", "@Override\n public void onSuccess() {\n }", "@Override\n\t\t\t\t\tpublic void onComplete() {\n\t\t\t\t\t}", "@Override\r\n\t\t\tpublic void onComplete() {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void onComplete() {\n\t\t\t\t\r\n\t\t\t}", "@Override\n\t\tpublic void onCompleted() {\n\t\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tprotected void postRun() {\n\n\t}", "@Override\n\tpublic void OnRequest() {\n\t\t\n\t}", "@Override\n public void onDataChanged() {\n\n }", "@Override\n protected void initialize() {\n\n \n }", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\r\n\t\t\tpublic void run() {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void run() {\n\t\t\t\t\r\n\t\t\t}", "@Override\n\t\tprotected void onPreExecute() \n\t\t{\n\t\t}", "@Override\n\t\tprotected void onCancelled() {\n\t\t\tsuper.onCancelled();\n\t\t\t\n\t\t}", "protected void onEnd() {}", "protected void onUpdate() {\r\n\r\n\t}", "@Override\n public void onSuccess() {\n }", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tprotected void listeners() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\r\n\tprotected void processFinish() {\n\r\n\t}", "@Override\r\n\tprotected void processFinish() {\n\r\n\t}", "@Override\r\n\tprotected void processFinish() {\n\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n protected void onFar() {\n }", "@Override\n protected void initialize() \n {\n \n }", "@Override\n protected void end() {\n \n }", "@Override\r\n protected void onProgressUpdate(Void... values) {\n super.onProgressUpdate(values);\r\n }", "@Override\n\t\t\tpublic void onCancelled() {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onCancelled() {\n\t\t\t\t\n\t\t\t}", "@Override\n public void onAdded() {\n }", "@Override\n public void update() {\n \n }", "@Override\n\tpublic void onProgressUpdate() {\n\n\t}", "@Override\n public void afterFinish() {\n \n }", "@Override\r\n public void onUpdate() {\n super.onUpdate();\r\n }", "@Override\n\tprotected void setListener() {\n\n\t}", "@Override\n\tprotected void setListener() {\n\n\t}", "void additionalCreationCallback() {\n }", "@Override\n\tpublic void dispatchBeforeFinish() {\n\t\t\n\t}", "@Override\r\n\tpublic void onNew() {\n\t\t\r\n\t}", "@Override\n public void onSuccess() {\n }", "@Override\r\n protected void end() {\r\n\r\n }", "@Override\n\t\t\tprotected void onPreExecute()\n\t\t\t{\n\n\t\t\t}" ]
[ "0.7601995", "0.74401194", "0.7313679", "0.7222469", "0.6870389", "0.6870389", "0.6822947", "0.6822663", "0.6728964", "0.6693481", "0.66795033", "0.66484016", "0.66290176", "0.66007143", "0.6592804", "0.6532", "0.6527398", "0.6527263", "0.65028614", "0.64886576", "0.64647", "0.64647", "0.64639634", "0.64639634", "0.64639634", "0.64639634", "0.64639634", "0.64639634", "0.64639634", "0.64639634", "0.64639634", "0.64639634", "0.64639634", "0.64639634", "0.6452178", "0.6418463", "0.6413009", "0.6413009", "0.64091665", "0.64015645", "0.63914084", "0.6389313", "0.6389313", "0.637481", "0.637481", "0.6372891", "0.6372891", "0.6360926", "0.6351446", "0.6348047", "0.63431394", "0.63285327", "0.63198775", "0.63107646", "0.6270937", "0.62369114", "0.6232127", "0.6229782", "0.6227869", "0.62062794", "0.62062794", "0.61758906", "0.61735725", "0.61716914", "0.6160877", "0.61602354", "0.615852", "0.6155696", "0.61526966", "0.61526966", "0.614983", "0.61472356", "0.6136699", "0.6136168", "0.6135184", "0.6125363", "0.6120064", "0.6116642", "0.6116127", "0.6116127", "0.6116127", "0.6111438", "0.61081475", "0.6096884", "0.6096482", "0.6085813", "0.6080205", "0.6080205", "0.60556674", "0.6045637", "0.6043337", "0.6034164", "0.60273117", "0.6025722", "0.6025722", "0.6024891", "0.6024859", "0.6024097", "0.60157937", "0.6012442", "0.6000687" ]
0.0
-1
OpenGL view. Go fullscreen
@Override protected void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); GLSurfaceView view = new GLSurfaceView(this); view.setEGLConfigChooser(8, 8, 8, 8, 16, 0); //Transparent background view.getHolder().setFormat(PixelFormat.TRANSLUCENT); //Transparent background view.setRenderer(new OpenGLRenderer(this)); setContentView(view); //Transition to Landing screen new Handler().postDelayed(new Runnable() { @Override public void run() { // This app main activity Intent i = new Intent(SplashActivity.this, SearchActivity.class); startActivity(i); finish(); } }, SPLASH_TIME_OUT); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void onSurfaceChanged(GL10 glUnused, int width, int height) {\n // Set the OpenGL viewport to fill the entire surface.\n glViewport(0, 0, width, height);\n }", "@Override\n public void onSurfaceChanged(GL10 glUnused, int width, int height) {\n glViewport(0, 0, width, height);\n\n this.width = width;\n this.height = height;\n setPerspectiveView();\n \n }", "@Override\n public void onSurfaceChanged(GL10 gl, int width, int height) {\n gl.glViewport(0, 0, width, height);\n // To prevent divide by zero\n float aspect = (float)width / height;\n // Set the viewport (display area) to cover the entire window.\n gl.glViewport(0, 0, width, height);\n // Setup perspective projection, with aspect ratio matches viewport\n // Select projection matrix.\n gl.glMatrixMode(GL10.GL_PROJECTION);\n // Reset projection matrix.\n gl.glLoadIdentity();\n // Use perspective projection.\n GLU.gluPerspective(gl, 70, aspect, 0.1f, 200.f);\n // Select model-view matrix.\n gl.glMatrixMode(GL10.GL_MODELVIEW);\n // Reset.\n gl.glLoadIdentity();\n }", "@Override\n\tpublic void onSurfaceChanged(GL10 gl, int width, int height) {\n\tgl.glViewport(0, 0, width, height);\n\t//set projection matrix as active matrix\n\tgl.glMatrixMode(GL10.GL_PROJECTION); \n\t//load identity matrix to multiply with next matrix operation\n\tgl.glLoadIdentity(); \n\t//set perspective projection(GL10,FovY,Aspect,zNear,zFar)\n\tGLU.gluPerspective(gl, 70,width/(float)height,0.1f, 10f);\n\t//set ModelView matrix as active\n\tgl.glMatrixMode(GL10.GL_MODELVIEW);\n\t}", "void glViewport(int x, int y, int width, int height);", "private void initialRenderPhase(final GL10 gl)\n {\n gl.glViewport(0, 0, width, height);\n gl.glClear(GL10.GL_COLOR_BUFFER_BIT);\n gl.glMatrixMode(GL10.GL_PROJECTION);\n gl.glLoadIdentity();\n GLU.gluOrtho2D(gl, 0, width, 0, height);\n }", "public void setFullscreen() {\n\n setFullscreen(true);\n }", "public void end() {\r\n GL11.glViewport(0, 0, GLContext.getCurrent().getWidth(), GLContext.getCurrent().getHeight());\r\n glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);\r\n }", "private void initOpenGlView() {\n setEGLContextClientVersion(2);\n setPreserveEGLContextOnPause(true);\n System.out.println(\"************************************************************* init OpenGlView ********************\");\n// setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);\n// setEGLConfigChooser(8, 8, 8, 8, 0, 0); // added 10.05\n// getHolder().setFormat(PixelFormat.TRANSLUCENT); // // added 10.05\n }", "private void initGL() {\r\n glClearColor(0.0f, 0.0f, 0.0f, 0.0f);\r\n glMatrixMode(GL_PROJECTION);\r\n glLoadIdentity();\r\n\r\n glOrtho(-320, 320, -240, 240, 1, -1);\r\n\r\n glMatrixMode(GL_MODELVIEW);\r\n glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);\r\n }", "@Override\n\tpublic void prepareScreen() {\n\t\tgl.glColor3d(0.0, 0.0, 0.0);\n\t\tgl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\t}", "public void display(GL2 gl) {}", "private void initOpenGL(){\n\t\tcaps = GL.createCapabilities();\n\t\tglViewport(0,0,WIDTH,HEIGHT);\n\t\tif(caps.OpenGL44)System.out.println(\"All OK\");\n\t\tglEnable(GL_DEPTH_TEST);\n\t\t//glPolygonMode(GL_BACK, GL_LINE);\n\t\tglClearColor(0.0f, 0.0f, 0.0f, 0.0f);\n\t}", "private static void setFullScreen() {\n\t\tif (Keyboard.isKeyDown(28) && Keyboard.isKeyDown(56)) {\n\t\t\tif (Display.isActive()) {\n\t\t\t\tif (!Display.isFullscreen()) {\n\t\t\t\t\tDisplayManager.setDisplayMode(DisplayManager.getMaxWidth(), DisplayManager.getMaxHeight(), true);\n\t\t\t\t Display.setVSyncEnabled(true);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tDisplayManager.setDisplayMode(DisplayManager.getMaxWidth(), DisplayManager.getMaxHeight(), false);\n\t\t\t\t Display.setVSyncEnabled(false);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public void setupOpenGL() {\n try {\n PixelFormat pixelFormat = new PixelFormat();\n ContextAttribs contextAtrributes = new ContextAttribs(3, 2)\n .withForwardCompatible(true)\n .withProfileCore(true);\n\n DisplayMode displayMode = new DisplayMode(WIDTH, HEIGHT);\n Display.setDisplayMode(displayMode);\n Display.setTitle(WINDOW_TITLE);\n Display.create(pixelFormat, contextAtrributes);\n\n GL11.glEnable(GL11.GL_DEPTH_TEST);\n GL11.glDepthFunc(GL11.GL_LEQUAL);\n\n GL11.glViewport(0, 0, WIDTH, HEIGHT);\n } catch (LWJGLException e) {\n e.printStackTrace();\n System.exit(-1);\n }\n\n // Setup an XNA like background color\n GL11.glClearColor(0.4f, 0.6f, 0.9f, 0f);\n\n // Map the internal OpenGL coordinate system to the entire screen\n GL11.glViewport(0, 0, WIDTH, HEIGHT);\n\n this.exitOnGLError(\"Error in setupOpenGL\");\n }", "@Override\r\n\tpublic void onSurfaceChanged(GL10 gl, int width, int height) {\n\t\tfloat aspect = (float)width/(float)(height==0?1:height);\r\n\t\tgl.glViewport(0, 0, width, height);\r\n\t\tgl.glMatrixMode(GL10.GL_PROJECTION);\r\n\t\tgl.glLoadIdentity();\r\n\r\n\t\tGLU.gluPerspective(gl, 45.0f, aspect, 0.1f, 200.0f);\r\n\t\tGLU.gluLookAt(gl, 5f, 5f, 5f, 0f, 0f, 0f, 0, 1, 0);\r\n\r\n\t}", "@Override\r\n\tpublic void onSurfaceChanged(GL10 gl, int width, int height) {\n\t\tLog.d(TAG, \"onSurfacechanged\");\r\n\t\tif (height == 0) height = 1; // To prevent divide by zero\r\n\t float aspect = (float)width / height;\r\n\t \r\n\t // Set the viewport (display area) to cover the entire window\r\n\t gl.glViewport(0, 0, width, height);\r\n\t \r\n\t // Setup perspective projection, with aspect ratio matches viewport\r\n\t gl.glMatrixMode(GL10.GL_PROJECTION); // Select projection matrix\r\n\t gl.glLoadIdentity(); // Reset projection matrix\r\n\t // Use perspective projection\r\n\t GLU.gluPerspective(gl, 45, aspect, 0.1f, 100.f);\r\n\t \r\n\t gl.glMatrixMode(GL10.GL_MODELVIEW); // Select model-view matrix\r\n\t gl.glLoadIdentity(); // Reset\r\n\t \r\n\t // You OpenGL|ES display re-sizing code here\r\n\t // ......\r\n\t}", "private void render() {\r\n while(!Display.isCloseRequested() && !Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)){\r\n try{\r\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); \r\n glLoadIdentity();\r\n \r\n \r\n\r\n Display.update();\r\n Display.sync(60);\r\n }\r\n catch(Exception e)\r\n {\r\n e.printStackTrace();\r\n }\r\n }\r\n Display.destroy();\r\n }", "public void onSurfaceChanged(GL10 na, int width, int height) {\n GLES20.glViewport(0, 0, width, height);\n }", "@Override\n\t\tpublic void render()\n\t\t{\n\t\t\tif(color.alpha() > 0)\n\t\t\t{\n\t\t\t\tbind();\n\t\t\t\tGL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);\n\t\t\t\tGL11.glBegin(GL11.GL_TRIANGLE_STRIP);\n\t\t\t\t\tfloat screenWidth = WindowManager.controller().width();\n\t\t\t\t\tfloat screenHeight = WindowManager.controller().height();\n\t\t\t\t\tGL11.glVertex2f(0, 0);\n\t\t\t\t\tGL11.glVertex2f(screenWidth, 0);\n\t\t\t\t\tGL11.glVertex2f(0, screenHeight);\n\t\t\t\t\tGL11.glVertex2f(screenWidth, screenHeight);\n\t\t\t\tGL11.glEnd();\n\t\t\t\trelease();\n\t\t\t}\n\t\t}", "@Override\n public void onFullscreen(boolean b) {\n if (!b) {\n finish();\n }\n }", "private void initGL() {\n\t\ttry {\n\t\t\tDisplay.setDisplayMode(new DisplayMode(displayWidth, displayHeight));\n\t\t\tDisplay.setVSyncEnabled(true);\n\t\t\tDisplay.setTitle(\"Shooter\");\n\t\t\tDisplay.create();\n\t\t} catch (LWJGLException e) {\n\t\t\te.printStackTrace();\n\t\t\tSystem.exit(0);\n\t\t}\n\t\t\n\t\t// init OpenGL\n\t\tglEnable(GL_TEXTURE_2D);\n\t\t\n\t\tglClearColor(0.0f, 0.0f, 0.0f, 0.0f);\n\t\t\n\t\t// enable alpha blending\n\t\tglEnable(GL_BLEND);\n\t\tglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);\n\t\t\n\t\tglViewport(0, 0, displayWidth, displayHeight);\n\t\t\n\t\tglMatrixMode(GL_PROJECTION);\n\t\tglLoadIdentity();\n\t\tglOrtho(0, displayWidth, displayHeight, 0, 1, -1);\n\t\tglMatrixMode(GL_MODELVIEW);\n\t}", "@Override\n public void onCreate(Bundle savedInstanceState)\n {\n super.onCreate(savedInstanceState);\n mGLView = new ClearGLSurfaceView(this, (SensorManager) getSystemService(SENSOR_SERVICE));\n setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);\n\t\tgetWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);\n setContentView(mGLView);\n }", "public synchronized void display() {\r\n\r\n\t\t// clear the screen and draw a yellow square\r\n\t\tgl.clear(GL.COLOR_BUFFER_BIT);\r\n\t\t// First rectangle\r\n\t\tgl.pushMatrix();\r\n\t\tgl.translate(-0.5, 0.0, 0.0);\r\n\t\tgl.rotate(spin, 0.0, 0.0, 1.0);\r\n\t\tgl.rect(-0.5, -0.5, 0.5, 0.5);\r\n\t\tgl.popMatrix();\r\n\t\t// Second rectangle\r\n\t\tgl.pushMatrix();\r\n\t\tgl.translate(0.5, 0.0, 0.0);\r\n\t\tgl.rotate(-spin, 0.0, 0.0, 1.0);\r\n\t\tgl.rect(-0.5, -0.5, 0.5, 0.5);\r\n\t\tgl.popMatrix();\r\n\t\tgl.flush(); // Make sure all commands have completed.\r\n\t\tgl.swap();\t // Swap the render buffer with the screen buffer\r\n\t}", "private void makeFullScreen(){\n requestWindowFeature(Window.FEATURE_NO_TITLE);\n // Make it full Screen\n getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);\n }", "@Override\n public void onSurfaceChanged(GL10 gl, int width, int height) {\n if (height == 0) height = 1; // To prevent divide by zero\n float aspect = (float)width / height;\n \n // Set the viewport (display area) to cover the entire window\n gl.glViewport(0, 0, width, height);\n \n // Setup perspective projection, with aspect ratio matches viewport\n gl.glMatrixMode(GL10.GL_PROJECTION); // Select projection matrix\n gl.glLoadIdentity(); // Reset projection matrix\n // Use perspective projection\n GLU.gluPerspective(gl, 45, aspect, 0.1f, 100.f);\n \n gl.glMatrixMode(GL10.GL_MODELVIEW); // Select model-view matrix\n gl.glLoadIdentity(); // Reset\n \n // You OpenGL|ES display re-sizing code here\n // ......\n }", "@Override\n public void onFrameAvailable(SurfaceTexture st) {\n mGLView.requestRender();\n }", "@Override\n public void onSurfaceChanged(GL10 gl, int width, int height) {\n Log.i(\"kike\", \"onSurfaceChanged\");\n GLES20.glViewport(0, 0, width, height);\n GLES20.glClearColor(0, 0, 0, 1);\n generateSquare();\n }", "public void onSurfaceChanged( GL10 gl, int width, int height ) {\n\t\tgl.glViewport( 0, 0, width, height );\n\t\t//gl.glViewport(0, 0, width, height);\n\t\tgl.glMatrixMode(GL10.GL_PROJECTION);\n\t\tgl.glLoadIdentity();\n\t\tGLU.gluPerspective(gl, 30.0f, (float)width / (float)height, 0.001f, 100.0f);\n\t\tgl.glViewport(0, 0, width, height);\n\n\t\tgl.glMatrixMode(GL10.GL_MODELVIEW);\n\t\tgl.glLoadIdentity();\n\t}", "public void onSurfaceChanged(GL10 glUnused, int width, int height)\n {\n GLES20.glViewport(0, 0, width, height);\n float ratio = (float) width / height;\n Matrix.frustumM(mProjMatrix, 0, -ratio, ratio, -1, 1, 3, 7);\n }", "public void previewOglRender();", "@Override\n\t\t public void toggledFullscreen(boolean fullscreen)\n\t\t {\n\t\t }", "private void initDisplay() throws LWJGLException {\n\n\t\tDisplay.setDisplayMode(Display.getDesktopDisplayMode());\n\t\tDisplay.setFullscreen(true);\n\t\twidth = Display.getDisplayMode().getWidth();\n\t\theight = Display.getDisplayMode().getHeight();\n\t\tDisplay.create();\n\t\tDisplay.setVSyncEnabled(true);\n\t}", "@Override\n public void onSurfaceChanged(GL10 unused, int width, int height) {\n GLES20.glViewport(0, 0, width, height);\n \n float ratio = (float) width / height;\n /*\n mWidth = width;\n mHeight = height;\n */\n \n // this projection matrix is applied to object coordinates\n // in the onDrawFrame() method\n /*\n Near / far clipping planes, in terms of units away from the camera\n Cannot be negative or 0, should not be close to 0\n */\n //Matrix.frustumM(mProjMatrix, 0, -ratio, ratio, -1, 1, 3, 7);\n Matrix.frustumM(mProjMatrix, 0, -ratio, ratio, -1, 1, 0.5f, 21);\n \n }", "private static void initGL() {\n glClearColor(152/255f, 175/255f, 199/255f, 0.0f);\n glMatrixMode(GL_PROJECTION);\n glLoadIdentity();\n GLU.gluPerspective(100.0f, (float)displayMode.getWidth()/(float)\n displayMode.getHeight(), 0.1f, 500);\n glMatrixMode(GL_MODELVIEW);\n glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);\n glClearDepth(1.0f);\n glEnable(GL_DEPTH_TEST);\n glEnable(GL_TEXTURE_2D);\n glEnableClientState(GL_VERTEX_ARRAY);\n glEnableClientState(GL_COLOR_ARRAY);\n glEnableClientState(GL_TEXTURE_COORD_ARRAY);\n glEnable(GL_LIGHTING);\n glEnable(GL_LIGHT0);\n glEnable(GL_NORMALIZE);\n\n }", "@Override\n public void onSurfaceChanged(GL10 unused, int width, int height) {\n GLES20.glViewport(0, 0, width, height);\n\n float ratio = (float) width / height;\n\n // this projection matrix is applied to object coordinates\n // in the onDrawFrame() method\n Matrix.frustumM(mProjectionMatrix, 0, -ratio, ratio, -1, 1, 3, 7);\n\n }", "public static Window createFullScreenWindow() {\n GraphicsEnvironment env = GraphicsEnvironment\n .getLocalGraphicsEnvironment();\n GraphicsDevice device = env.getDefaultScreenDevice();\n GraphicsConfiguration gc = device.getDefaultConfiguration();\n Frame f = new Frame(gc);\n f.setUndecorated(true);\n f.setIgnoreRepaint(true);\n device.setFullScreenWindow(f);\n //f.setSize(200,200);\n //f.setVisible(true);\n\n //f.createBufferStrategy(2);\n\n /*\n * mainFrame.createBufferStrategy(numBuffers); BufferStrategy\n * bufferStrategy = mainFrame.getBufferStrategy(); Graphics g =\n * bufferStrategy.getDrawGraphics(); \n * if (!bufferStrategy.contentsLost()) { //\n * render here!\n * \n * bufferStrategy.show(); g.dispose();\n */\n\n return f;\n }", "private void updateView(GL2 gl) {\r\n gl.glLoadIdentity();\r\n final float eyeX = (float) camera.getEye().get(0);\r\n final float eyeY = (float) camera.getEye().get(1);\r\n final float eyeZ = (float) camera.getEye().get(2);\r\n final float refX = (float) camera.getRef().get(0);\r\n final float refY = (float) camera.getRef().get(1);\r\n final float refZ = (float) camera.getRef().get(2);\r\n final float upX = (float) camera.getUp().get(0);\r\n final float upY = (float) camera.getUp().get(1);\r\n final float upZ = (float) camera.getUp().get(2);\r\n glu.gluLookAt(eyeX, eyeY, eyeZ, refX, refY, refZ, upX, upY, upZ);\r\n }", "@Override\n\tpublic void display(GLAutoDrawable glDrawable) {\n\t\tGL2 gl = glDrawable.getGL().getGL2();\n\n\t\t// turn on/off multi-sampling\n\t\tgl.glEnable(GL.GL_MULTISAMPLE);\n\t\t\n\t\t// turn on/off vertical sync\n\t\tgl.setSwapInterval(1);\n\t\t\n\t\t// clear the screen\n\t\tgl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_STENCIL_BUFFER_BIT);\n\t\t// switch to the model view matrix\n\t\tgl.glMatrixMode(GL2.GL_MODELVIEW);\n\t\t// initialize the matrix (0,0) is in the center of the window\n\t\tgl.glLoadIdentity();\n\n\t\t// render the scene\n\t\tthis.render(gl);\n\t\tthis.update();\n\t}", "public void makeFullscreen(long monitor){\n //Fullscreen, keep the size and the resolution\n\n //Skip if already fullscreen\n if(type == Type.FULLSCREEN){\n return;\n }\n\n //Retrieve the monitor's video mode\n monitorID = monitor;\n GLFWVidMode mode = glfwGetVideoMode(monitorID);\n\n //Change the window\n glfwSetWindowMonitor(\n handle,\n monitorID,\n 0,\n 0,\n size.x,\n size.y,\n mode.refreshRate()\n );\n position.set(0f, 0f);\n type = Type.FULLSCREEN;\n\n //Fire the resize event\n sizeMultiplexer.handle(new WindowSizeEvent(handle, size.x, size.y));\n }", "@Override\n\tpublic void onClick(View arg0) {\n\t\tmPlayer.setFullscreen(!isFullScreen);\n\t}", "public void run() {\n\n\t\ttry {\n\t\t\tDisplay.setDisplayMode(new DisplayMode(windowWidth, windowHeight));\n\t\t\tDisplay.setTitle(TITLE);\n\t\t\tDisplay.create();\n\t\t} catch (LWJGLException e) {\n\t\t\tSystem.err.println(\"Error: Failed to create display\");\n\t\t\te.printStackTrace();\n\t\t\tSystem.exit(0);\n\t\t}\n\n\t\t/*\n\t\t * Initialize LWJGL and OpenGL\n\t\t */\n\t\t{\n\t\t\tGL11.glViewport(0, 0, windowWidth, windowHeight);\n\t\t\tGL11.glEnable(GL11.GL_DEPTH_TEST);\n\t\t\tGL11.glDepthFunc(GL11.GL_LEQUAL);\n\t\t\tGL11.glShadeModel(GL11.GL_SMOOTH);\n\t\t\tGL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);\n\t\t\tGL11.glEnable(GL11.GL_BLEND);\n\t\t\tGL11.glAlphaFunc(GL11.GL_GREATER, 0.1f);\n\t\t\t// GL11.glEnable(GL11.GL_ALPHA_TEST);\n\t\t\tGL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);\n\t\t\tGL11.glClearColor(0.0f, 0.0f, 0.0f, 1f);\n\t\t}\n\n\t\ttry {\n\t\t\twhile (!(Display.isCloseRequested() || Keyboard.isKeyDown(Keyboard.KEY_Q))) {\n\t\t\t\t// Don't eat everything!!!\n\t\t\t\ttry {\n\t\t\t\t\tThread.sleep(16);\n\t\t\t\t} catch (InterruptedException e) {\n\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\n\t\t\t\tsetCamera();\n\n\t\t\t\t/*\n\t\t\t\t * Draw Code\n\t\t\t\t */\n\n\t\t\t\tsynchronized (model.drawableObjects) {\n\t\t\t\t\tfor (Drawable drawable : model.drawableObjects)\n\t\t\t\t\t\tdrawable.draw();\n\t\t\t\t}\n\n\t\t\t\t/*\n\t\t\t\t * End draw code\n\t\t\t\t */\n\n\t\t\t\tDisplay.update();\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\tSystem.err.println(\"Uncaught exception in View main loop: \" + e.getMessage()\n\t\t\t\t\t+ \"\\nCleaning up and exiting.\");\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\t/*\n\t\t * Clean up\n\t\t */\n\n\t\tmodel.endGame();\n\t\tcontroller.endGame();\n\t\tDisplay.destroy();\n\t}", "public void onSurfaceChanged(GL10 gl, int width, int height)\n {\n\n nativeInitialize(width, height);\n }", "@Override\n public boolean isFullScreen() {\n return false;\n }", "public void begin() {\r\n GL11.glViewport(0, 0, colorTexture.getWidth(), colorTexture.getHeight());\r\n bind();\r\n }", "public void onSurfaceChanged(GL10 gl, int width, int height) {\n\t\tgl.glEnable(GL10.GL_TEXTURE_2D);\n\t gl.glViewport(0, 0, width, height);\n\t float ratio = (float) width / height;\n\t gl.glMatrixMode(GL10.GL_PROJECTION);\n\t gl.glLoadIdentity();\n\t gl.glMatrixMode(GL10.GL_MODELVIEW);\n\t gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10);\n\n\t}", "@Override\n\tpublic void onToggleFullScreen() {\n\t\t_isFullScreen = !_isFullScreen;\n\t\tFrameLayout.LayoutParams mNewParams;\n\t\tif(_isFullScreen)\n\t\t{\n\t\t\tmNewParams = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);\n\t\t\tmNewParams.gravity = Gravity.TOP | Gravity.LEFT;\n\t\t}else\n\t\t{\n\t\t\tmNewParams = new FrameLayout.LayoutParams(400, 400);\n\t\t\tmNewParams.gravity = Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL;\n\t\t}\n\t\t\n\t\t_playerViewConroller.setLayoutParams(mNewParams);\n\t}", "public void makeFullScreen() {\n currentApiVersion = android.os.Build.VERSION.SDK_INT;\n final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE |\n View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |\n View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |\n View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;\n if (currentApiVersion >= Build.VERSION_CODES.KITKAT) {\n getWindow().getDecorView().setSystemUiVisibility(flags);\n final View decorView = getWindow().getDecorView();\n decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {\n @Override\n public void onSystemUiVisibilityChange(int visibility) {\n if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {\n decorView.setSystemUiVisibility(flags);\n }\n }\n });\n }\n }", "public void setFullScreen(DisplayMode dm) {\n JFrame frame = new JFrame();\n frame.setUndecorated(true);\n frame.setIgnoreRepaint(true);\n frame.setResizable(false);\n\n vc.setFullScreenWindow(frame);\n\n if (dm != null && vc.isDisplayChangeSupported()) {\n try {\n\n vc.setDisplayMode(dm);\n\n } catch (Exception e) {\n System.out.println(e.getMessage());\n }\n }\n\n // use two buffers\n frame.createBufferStrategy(2);\n\n }", "@Override\n\tpublic void onSurfaceChanged(final GL10 iGL10, final int width, final int height)\n\t{\n\t\tglViewport(0, 0, width, height);\n\t\t\n\t\tMatrixHelper.perspectiveM(mProjectionMatrix, 45, (float) width / (float) height, 1f, 10f);\n\t\tMatrix.setLookAtM(mViewMatrix, 0, 0f, 1.2f, 2.2f, 0f, 0f, 0f, 0f, 1f, 0f);\n\t}", "public void start() {\n try {\n //getting the capabilities object of GL2 profile\n final GLProfile profile = GLProfile.get(GLProfile.GL2);\n GLCapabilities capabilities = new GLCapabilities(profile);\n\n // The canvas\n final GLCanvas glcanvas = new GLCanvas(capabilities);\n Renderer s = new Renderer();\n glcanvas.addGLEventListener(s);\n glcanvas.addMouseListener(s);\n glcanvas.addMouseMotionListener(s);\n glcanvas.addKeyListener(s);\n glcanvas.setSize(1024, 780);\n //creating frame\n final Frame frame = new Frame (\" Budik\");\n final JButton btHelp = new JButton(\"?\");\n final Help help;\n help = new Help();\n JToolBar tlacitka = new JToolBar(\"Help\");\n tlacitka.add(btHelp);\n frame.add(tlacitka, BorderLayout.NORTH);\n btHelp.setMnemonic(KeyEvent.VK_F1);\n btHelp.addActionListener(new ActionListener() {\n @Override\n public void actionPerformed(ActionEvent e) {\n JDialog dialog = new JDialog(frame);\n JTextArea textArea = new JTextArea(help.getText());\n textArea.setBackground(help.getBackround());\n textArea.setEditable(false);\n dialog.add(textArea);\n dialog.setTitle(help.getTitle());\n dialog.setSize(new Dimension(800, 600));\n dialog.setLocationRelativeTo(frame);\n dialog.setModal(true);\n dialog.setVisible(true);\n }\n });\n\n\n\n frame.add(glcanvas);\n frame.setSize( 1024, 780 );\n frame.setVisible(true);\n frame.addWindowListener(new WindowAdapter() {\n @Override\n public void windowClosing(WindowEvent e) {\n super.windowClosing(e);\n System.exit(0);\n }\n });\n\n final FPSAnimator animator = new FPSAnimator(glcanvas,30,true);\n animator.start();\n\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public void onSurfaceChanged(GL2 gl, int w, int h) {\r\n gl.glViewport(0, 0, w, h);\r\n gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);\r\n gl.glLoadIdentity();\r\n aspectRatio = (float) w / (float) h;\r\n glu.gluPerspective(camera.getOpeningAngle(), aspectRatio, nearClippingPlane, farClippingPlane);\r\n gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);\r\n\r\n updateView(gl);\r\n }", "public void fullscreenChanged(FullscreenEvent e);", "public void setFullScreen(){\n\t\trequestWindowFeature(Window.FEATURE_NO_TITLE);\n\t\tgetWindow().setFlags(LayoutParams.FLAG_FULLSCREEN, LayoutParams.FLAG_FULLSCREEN);\n\t}", "@Action\n public final void onJButtonFullscreen() {\n\n final FullscreenImageJFrame frame =\n new FullscreenImageJFrame(\n ImageMediaManagerLogic.getImageBy(this.getLomd()));\n\n SWTGUIApp.getApplication().show(frame);\n\n this.refresh();\n\n }", "@Override\n\tpublic void initCameraGlSurfaceView() {\n\t\t\n\t}", "public GameScreen() {\n\n\t\tint midPointY = (int) (Const.GAME_HEIGHT / 2);\n\n\t\tworld = new GameWorld(midPointY);\n\t\trenderer = new GameRenderer(world);\n\n\t\tGdx.input.setInputProcessor(new InputHandler(world.getVentilatorUp(), world.getVentilatorDown()));\n\t\t// Gdx.input.setInputProcessor(new\n\t\t// InputHandler(world.getVentilatorTwo()));\n\t}", "public void toggleFullscreen() {\n if (!isFullscreen) {\n setExtendedState(JFrame.MAXIMIZED_BOTH);\n } else {\n setExtendedState(JFrame.NORMAL);\n }\n isFullscreen = !isFullscreen;\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_full_screen);\n }", "@Override\n\tpublic void onSurfaceChanged(GL10 gl, int width, int height) {\n\t\tgl.glViewport(0, 0, width, height);\n\n\t\t// Setup orthographic projection\n\t\tgl.glMatrixMode(GL10.GL_PROJECTION); // Activate Projection Matrix\n\t\tgl.glLoadIdentity(); // Load Identity Matrix\n\t\tgl.glOrthof( // Set Ortho Projection (Left,Right,Bottom,Top,Front,Back)\n\t\t\t\t0, width, 0, height, 1.0f, -1.0f);\n\n\t\ttetrisBoard._width = width;\n\t\ttetrisBoard._height = height;\n\t}", "public void startFullScreenView(int displayNumber) {\r\n\t\tif (fullScreenFrame == null) {\r\n\t\t\tfullScreenFrame = new JFrame();\r\n\t\t\tfullScreenFrame.setUndecorated(true);\r\n\t\t\tfullScreenFrame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);\r\n\t\t\tfullScreenFrame.addWindowListener(new WindowAdapter() {\r\n\t\t\t\tpublic void windowDeactivated(WindowEvent e) {\r\n\t\t\t\t\tfinal Container contentPane = fullScreenFrame.getContentPane();\r\n\t\t\t\t\tcontentPane.removeAll();\r\n\t\t\t\t\t// DebugUtils.println(\"Window Deactivated... Adding back to the old panel...\");\r\n\t\t\t\t\tscrollPane.setViewportView(new JPanel());\r\n\t\t\t\t\tscrollPane.repaint();\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t\tfinal GraphicsEnvironment localGraphicsEnvironment = GraphicsEnvironment\r\n\t\t\t\t.getLocalGraphicsEnvironment();\r\n\t\tfinal GraphicsDevice[] screenDevices = localGraphicsEnvironment.getScreenDevices();\r\n\t\tif (displayNumber >= 0 && displayNumber < screenDevices.length) {\r\n\t\t\tscreenDevices[displayNumber].setFullScreenWindow(fullScreenFrame);\r\n\t\t} else {\r\n\t\t\tscreenDevices[0].setFullScreenWindow(fullScreenFrame);\r\n\t\t}\r\n\r\n\t\tfullScreenFrame.setVisible(true);\r\n\t}", "public void onSurfaceCreated(GL2 gl) {\r\n gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);\r\n gl.glLoadIdentity();\r\n\r\n // Perspective\r\n final int width = SCREEN_WIDTH;\r\n final int height = SCREEN_HEIGHT;\r\n aspectRatio = (float) width / (float) height;\r\n glu.gluPerspective(camera.getOpeningAngle(), aspectRatio, nearClippingPlane, farClippingPlane);\r\n\r\n // Viewport\r\n gl.glViewport(0, 0, width, height);\r\n gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);\r\n\r\n // Depth\r\n gl.glEnable(GL2.GL_DEPTH_TEST);\r\n\r\n // which is the front? the one which is drawn counter clockwise\r\n gl.glFrontFace(GL2.GL_CCW);\r\n // which one should NOT be drawn\r\n gl.glCullFace(GL2.GL_BACK);\r\n\r\n // define the color we want to be displayed as the \"clipping wall\"\r\n gl.glClearColor((float) (CLEAR_COLOR.get(0)), (float) (CLEAR_COLOR.get(1)), (float) (CLEAR_COLOR.get(2)), OPAQUE);\r\n\r\n // Flat shading\r\n gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_FILL);\r\n\r\n // Set a light, just use the first one from the root node.\r\n if (renderFrame != null && renderFrame.getRoot().getNumberOfLightSources() > 0) {\r\n LightSource lightSource = renderFrame.getRoot().getLightSource(0);\r\n float lightAmbient[] = { 1, 1, 1, 1 };\r\n float lightSpecular[] = { 1, 1, 1, 1 };\r\n float lightPosition[] = lightSource.getPosition().floatData();\r\n float lightDiffuse[] = lightSource.getColor().floatData();\r\n gl.glEnable(GL2.GL_LIGHT0);\r\n gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_AMBIENT, lightAmbient, 0);\r\n gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_SPECULAR, lightSpecular, 0);\r\n gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_DIFFUSE, lightDiffuse, 0);\r\n gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_POSITION, lightPosition, 0);\r\n }\r\n\r\n updateView(gl);\r\n }", "@Override\n public void onSurfaceChanged(GL10 gl, int width, int height) {\n Log.d(LOGTAG, \"GLRenderer.onSurfaceChanged\");\n\n vuforiaAppSession.onSurfaceChanged(width, height);\n }", "private void loop() {\n GLCapabilities capabilities = GL.createCapabilities();\n\n // Set the clear color\n screen.setWindow(this);\n screen.init();\n\n // Run the rendering loop until the user has attempted to close\n // the window or has pressed the ESCAPE key.\n long before = System.currentTimeMillis() - 1;\n while (glfwWindowShouldClose(windowID) != GL11.GL_TRUE) {\n float secs = (System.currentTimeMillis() - before) / 1000f;\n before = System.currentTimeMillis() - 1;\n screen.update(secs);\n screen.draw();\n\n keyboard.update();\n mouse.update();\n\n glfwSwapBuffers(windowID);\n glfwPollEvents();\n }\n\n screen.close();\n }", "private void initOpenGL()\n\t{\n\t\t// Create an OpenGL ES 2.0 context.\n\t\tsetEGLContextClientVersion(2);\n\n\t\t// Set the drawing quality.\n\t\t// Alpha isn't needed and the color choice is limited anyway, so we can get away with this setting.\n\t\tgetHolder().setFormat(PixelFormat.RGB_565);\n\t\tsetEGLConfigChooser(5, 6, 5, 0, 0, 0);\n\n\t\t// Prepare the renderer.\n\t\trenderer = new GLRenderer();\n\t\tsetRenderer(renderer);\n\n\t\t// Choose to only render the view on demand.\n\t\tsetRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);\n\n\t\t// Disable the unneeded depth test and stencil test.\n\t\tGLES20.glDisable(GLES20.GL_DEPTH_TEST);\n\t\tGLES20.glDisable(GLES20.GL_STENCIL_TEST);\n\n\t\t// Render the canvas for the first time.\n\t\trequestRender();\n\t}", "@Override\n public void onSurfaceChanged(GL10 gl, int width, int height) {\n onSurfaceChanged(width, height);\n }", "public void drawFloor() {\r\n GLES20.glUseProgram(program);\r\n\r\n // Set ModelView, MVP, position, normals, and color.\r\n GLES20.glUniform3fv(lightPosParam, 1, lightPosInEyeSpace, 0);\r\n GLES20.glUniformMatrix4fv(modelParam, 1, false, model, 0);\r\n GLES20.glUniformMatrix4fv(modelViewParam, 1, false, modelView, 0);\r\n GLES20.glUniformMatrix4fv(modelViewProjectionParam, 1, false, modelViewProjection, 0);\r\n GLES20.glVertexAttribPointer(positionParam, COORDS_PER_VERTEX, GLES20.GL_FLOAT, false, 0, vertices);\r\n GLES20.glVertexAttribPointer(normalParam, 3, GLES20.GL_FLOAT, false, 0, normals);\r\n GLES20.glVertexAttribPointer(colorParam, 4, GLES20.GL_FLOAT, false, 0, colors);\r\n\r\n GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, 6);\r\n\r\n checkGLError(\"drawing floor\");\r\n }", "@Override\n\tpublic void show() {\n\t worldRenderer = new WorldRenderer(game);\n\t\tGdx.input.setCatchBackKey(true);\n\t\t// TODO Auto-generated method stub\n\t\t\n\t}", "public void display(GLAutoDrawable gLDrawable) {\n final GL2 gl = gLDrawable.getGL().getGL2(); \n gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT); //clear buffers\n gl.glMatrixMode(GL2.GL_MODELVIEW);\n gl.glLoadIdentity();\t\n\n EffectsManager.getManager().updateLights(gl);\n //eye positition is set by Animator class, it looks at 0, 0, 0\n glu.gluLookAt(eyeLocation.x, eyeLocation.y, eyeLocation.z, 0, 0, 0, 0, 1, 0);\n \n gl.glPushMatrix();\n gl.glBegin(GL2.GL_QUADS);\n \n Random rand = new Random(100);\n \n for (QuadFace f : mesh) {\n \tfor (Vector3f v : f.getVertices()) {\n \t\tVector3f norm = normals.get(v);\n \t\tgl.glColor3f(rand.nextFloat(), rand.nextFloat(), rand.nextFloat());\n \t\tgl.glNormal3f(norm.x, norm.y, norm.z);\n \t\tgl.glVertex3f(v.x, v.y, v.z);\n \t}\n }\n gl.glEnd();\n gl.glPopMatrix();\n gl.glFlush(); \n }", "public void initGLState() {\n\n\t\tm.setPerspective(fovy, aspect, zNear, zFar);\n\t\tglMatrixMode(GL_PROJECTION);\n\t\tglLoadIdentity();\n\n\t\tm.get(fb);\n\n\t\tglLoadMatrixf(fb);\n\n\t\tglMatrixMode(GL_MODELVIEW);\n\t\tglLoadIdentity();\n\n\t\t/* Smooth-Shading soll benutzt werden */\n\t\tglEnable(GL_NORMALIZE);\n\t\tglShadeModel(GL_SMOOTH);\n\t\tinitLighting();\n\t}", "@Override\n\tpublic void onDrawFrame(GL10 gl) {\n\t\tLibNative.render();\n\t}", "@Override\r\n\tpublic void resize(GL10 gl, int w, int h) {\n\t\t if (h == 0) \r\n\t\t\t h = 1;\r\n\r\n\t gl.glViewport(0, 0, w, h); // Reset The Current Viewport And Perspective Transformation\r\n\t gl.glMatrixMode(GL10.GL_PROJECTION); // Select The Projection Matrix\r\n\t gl.glLoadIdentity(); // Reset The Projection Matrix\r\n\t GLU.gluPerspective(gl, 45.0f, (float) w / (float) h, 0.1f, 100.0f); // Calculate The Aspect Ratio Of The Window\r\n\t GLU.gluLookAt(gl, 0, 0, -5, 0, 0, 0, 0, 1, 0);\r\n\t gl.glMatrixMode(GL10.GL_MODELVIEW); // Select The Modelview Matrix\r\n\t gl.glLoadIdentity(); // Reset The ModalView Matrix\r\n\t}", "public void display(GLAutoDrawable glDrawable) {\n\n cnt++;\n depth = (cnt/50)%6;\n\n if (cnt%60==0) {\n dalpha = -dalpha;\n dbeta = -dbeta;\n dgama = -dgama;\n }\n\n alpha += dalpha;\n beta += dbeta;\n gama += dgama;\n\n gl.glClear(GL.GL_COLOR_BUFFER_BIT|\n GL.GL_DEPTH_BUFFER_BIT);\n\n viewPort1();\n drawSolar(WIDTH, cnt, WIDTH/3, cnt);\n // the objects' centers are retrieved from above call\n\n viewPort2();\n drawSolar(WIDTH/4, cnt, WIDTH/12, cnt);\n\n viewPort3();\n drawSolar(WIDTH/4, cnt, WIDTH/12, cnt);\n\n viewPort4();\n drawRobot(O, A, B, C, alpha, beta, gama);\n\ttry {\n\t\tThread.sleep(10);\n\t} catch (Exception ignore) {\n\t}\n }", "private void ini_TabMainView()\r\n\t{\r\n\r\n\t\tif (splashEndTime > System.currentTimeMillis()) return;\r\n\r\n\t\tLogger.DEBUG(\"ini_TabMainView\");\r\n\t\tGL.that.removeRenderView(this);\r\n\t\t((GdxGame) GL.that).switchToMainView();\r\n\r\n\t\tGL.setIsInitial();\r\n\t}", "@FXML\n private void handleFullScreen() {\n if (primaryStage.isFullScreen()) {\n primaryStage.setFullScreen(false);\n } else {\n primaryStage.setFullScreen(true);\n }\n }", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\trequestWindowFeature(Window.FEATURE_NO_TITLE);//no title bar\n\t\tgetWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);//fullscreen\n\t\tglSurfaceView = new GLSurfaceView(this);//initialize GLSurfaceView\n\t\tglSurfaceView.setRenderer(new myRenderer());//set renderer\n\t\tsetContentView(glSurfaceView);//set surface as content\n\t}", "public void render(){ \r\n\t\tGL11.glPushMatrix();\r\n\t\tGL11.glTranslatef(x, y, z);\r\n\t\tGL11.glColor4f(Color.x, Color.y, Color.z, (float)(Math.random())); //Color.vx\r\n\t\tVGO v=getModel();\r\n\t\tv.orientPlain(r);\r\n\t\tv.orient(base);\r\n\t\t\r\n\t\ttFling+=0.01f;\r\n\t\tif(tFling>5){\r\n\t\t\ttHide=tActive;\r\n\t\t\ttActive+=0.1f;\r\n\t\t\tif(tHide>=1){\r\n\t\t\t\ttHide=0f;\r\n\t\t\t\ttActive=0.1f;\r\n\t\t\t}\r\n\t\t\ttFling=0f;\r\n\t\t}\r\n\t\t\r\n\t\tv.render();//tHide,tActive,tFling,1);\r\n\t\tGL11.glPopMatrix();\r\n\t}", "public void init(int width, int height) {\n try {\n Display.setDisplayMode(new DisplayMode(width, height));\n Display.create();\n } catch (LWJGLException ex) {\n System.exit(0);\n }\n\n GL11.glEnable(GL11.GL_TEXTURE_2D);\n GL11.glEnable(GL11.GL_BLEND);\n GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);\n GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE);\n GL11.glMatrixMode(GL11.GL_PROJECTION);\n GL11.glLoadIdentity();\n GL11.glOrtho(0, GameConstants.WINDOW_WIDTH, 0, GameConstants.WINDOW_HEIGHT, 1, -1);\n GL11.glMatrixMode(GL11.GL_MODELVIEW);\n }", "private void setCamera(GL2 gl, GLU glu)\n {\n Boundary bc = simulation.getBoundary();\n int w = (int) (bc.getMaxSize(0)-bc.getMinSize(0));\n int h = (int) (bc.getMaxSize(1)-bc.getMinSize(1));\n\n gl.glViewport(0, 0, w, h);\n\n\n gl.glMatrixMode(GL2.GL_PROJECTION);\n gl.glLoadIdentity();\n //opening angle, ratio of height and width, near and far\n glu.gluPerspective(80.0, 1,0.1,3*( bc.getMaxSize(2)-bc.getMinSize(2)));\n\n gl.glTranslatef(0.5f*(float) bc.getMinSize(0),-0.5f*(float) bc.getMinSize(1),1.5f*(float) bc.getMinSize(2));\n // gl.glTranslatef(0.5f*(float) (bc.getMaxSize(0)+bc.getMinSize(0)),0.5f*(float)(bc.getMaxSize(1)+ bc.getMinSize(1)),(float) -(bc.getMaxSize(2)-bc.getMinSize(2)));\n\n }", "public static void goFullScreen(Activity activity) {\r\n activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,\r\n WindowManager.LayoutParams.FLAG_FULLSCREEN);\r\n }", "public void DrawScreen() {\r\n DrawScreen(0, false, null);\r\n }", "public void begin() {\n\t\tview.setVisible(true);\n\t}", "private void fullscreen() {\n Intent intent = DocumentImageFullScreenActivity.newIntent( getContext(), adapter.getItems(), index );\n startActivityForResult(intent, REQUEST_CODE_INDEX);\n }", "public native void renderOneFrame();", "public void actionPerformed(ActionEvent e)\n\t{\n\t\ttoggleFullScreen();\n\t}", "public void update(GL2 gl){}", "public void showLobby() {\n \t\tgameMain.showScreen(lobby);\n \t}", "@Override\n public void init(GLAutoDrawable gld) {\n GL2 gl = gld.getGL().getGL2();\n glu = new GLU();\n\n gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);\n gl.glViewport(-500, -500, 500, 500);\n gl.glMatrixMode(GL2.GL_PROJECTION);\n gl.glLoadIdentity();\n glu.gluOrtho2D(-500, 500, -500, 500);\n }", "public GameWindow() {\r\n\r\n\t\tsuper(SWT.CLOSE | SWT.TITLE | SWT.MIN | SWT.DOUBLE_BUFFERED);\r\n\r\n\t\tshell.setText(WINDOW_TITLE);\r\n\t\tshell.setBackground(display.getSystemColor(SWT.COLOR_BLACK));\r\n\t\tshell.setBackgroundMode(SWT.INHERIT_DEFAULT);\r\n\t\tshell.addShellListener(new ShellAdapter() {\r\n\t\t\t@Override\r\n\t\t\tpublic void shellClosed(ShellEvent event) {\r\n\t\t\t\tclose();\r\n\t\t\t\tevent.doit = false;\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t// Set up the OpenGL canvas\r\n\t\tGLData gldata = new GLData();\r\n\t\tgldata.doubleBuffer = true;\r\n\t\tgldata.sampleBuffers = 1;\r\n\t\tgldata.samples = 4;\r\n\t\tcanvas = new GLCanvas(shell, SWT.NONE, gldata);\r\n\t}", "boolean isDesktopGL();", "public void display(GLAutoDrawable drawable){\n GL4 gl = (GL4) GLContext.getCurrentGL();\n \n gl.glClear(GL_DEPTH_BUFFER_BIT);\n \n // not needed if bkg is black\n float bkg[] = { 1.0f, 1.0f, 1.0f, 1.0f };\n FloatBuffer bkgBuffer = Buffers.newDirectFloatBuffer(bkg);\n gl.glClearBufferfv(GL_COLOR, 0, bkgBuffer);\n\n \n gl.glUseProgram(rendering_program); // loads program from init with the two shaders\n \n // define perspective matrix \n //perspective\n float aspect = (float) myCanvas.getWidth()/(float) myCanvas.getHeight();\n Matrix3D pMat = this.perspectiveMethod(60.0f, aspect, 0.1f, 100.0f);\t\t//for persective projection /zentrische Projektion\n Matrix3D oMat = this.orthographicMethod(1.0f, -1.0f, 1.0f, -1.0f, 0.1f, 100.0f); //for orthographic projection\n \n \n //copy perspective and MV matricies to corressponding uniform variables\n int mv_loc = gl.glGetUniformLocation(rendering_program, \"mv_matrix\");\n int proj_loc = gl.glGetUniformLocation(rendering_program, \"proj_matrix\");\n \n //build view matrix\n Matrix3D vMat = new Matrix3D();\n vMat.translate(-cameraX, -cameraY, -cameraZ);\n \n //build model matrix\n Matrix3D mMat = new Matrix3D(); //for right now we dont do anything (rotate, translate etc.) in with the mMat in this project\n\n Matrix3D mvMat = new Matrix3D();\n mvMat.concatenate(vMat);\t\t\t//first view matrix \n mvMat.concatenate(mMat);\t\t\t//second we put the model matrix on it (A * B)\n \n\n //plug the mvMat and pMat into the shader uniform variables \n gl.glUniformMatrix4fv(mv_loc, 1, false, mvMat.getFloatValues(),0);\n gl.glUniformMatrix4fv(proj_loc, 1, false, pMat.getFloatValues(),0);\n \n \n //be sure to bind the vbo before assigning the attribute pointer\n gl.glBindBuffer(GL_ARRAY_BUFFER, vbo[0]); \n // now set the \"location = 0\" info in the shaders to the point info from vbo[0]\n gl.glVertexAttribPointer(0, 3, GL_FLOAT, false, 0, 0);\n gl.glEnableVertexAttribArray(0);\n \n gl.glBindBuffer(GL_ARRAY_BUFFER, vbo[1]);\n gl.glVertexAttribPointer(1, 3, GL_FLOAT, false, 0, 0);\n gl.glEnableVertexAttribArray(1);\n \n gl.glLineWidth(10.0f);\n \n gl.glEnable(GL_DEPTH_TEST);\n gl.glDrawArrays(GL_LINES, 0, 4);\n\n }", "public void onSurfaceCreated(GL10 gl, EGLConfig config) {\n gl.glDisable(GL10.GL_DITHER);\n\n /*\n * Some one-time OpenGL initialization can be made here\n * probably based on features of this particular context\n */\n gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT,\n GL10.GL_FASTEST);\n\n float ratio = (float) width / height;\n gl.glMatrixMode(GL10.GL_PROJECTION);\n gl.glLoadIdentity();\n gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10);\n\n if (mTranslucentBackground) {\n gl.glClearColor(0,0,0,0);\n } else {\n gl.glClearColor(0.07f, 0.639f, 0.7f, 1f);\n }\n gl.glMatrixMode(GL10.GL_MODELVIEW);\n gl.glEnable(GL10.GL_CULL_FACE);\n gl.glShadeModel(GL10.GL_FLAT);\n gl.glLineWidth(2f);\n\n //lighting\n // Define the ambient component of the first light\n gl.glEnable(GL10.GL_LIGHTING);\n gl.glEnable(GL10.GL_LIGHT0);\n gl.glEnable(GL10.GL_LIGHT1);\n gl.glEnable(GL10.GL_LIGHT2);\n\n float lightColor[] = {0.07f, 0.639f, 0.7f, 1f};\n FloatBuffer light0Ambient = FloatBuffer.wrap(lightColor);\n float light1PositionVector[] = {1f, 0f, 0f, 0f};\n FloatBuffer light1Position = FloatBuffer.wrap(light1PositionVector);\n float light2PositionVector[] = {-1f, 0f, 0f, 0f};\n FloatBuffer light2Position = FloatBuffer.wrap(light2PositionVector);\n\n gl.glLightfv(GL10.GL_LIGHT1, GL10.GL_AMBIENT, light0Ambient);\n gl.glLightfv(GL10.GL_LIGHT1, GL10.GL_POSITION, light1Position);\n gl.glLightfv(GL10.GL_LIGHT2, GL10.GL_AMBIENT, light0Ambient);\n gl.glLightfv(GL10.GL_LIGHT2, GL10.GL_POSITION, light2Position);\n }", "public MainFullScreenOnly() {\n // Find out the current display width and height\n \n // Get the default graphic device and try full screen mode\n GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment()\n .getDefaultScreenDevice();\n if (device.isFullScreenSupported()) { // Go for full-screen mode\n this.setUndecorated(true); // Don't show title and border\n this.setResizable(false);\n //this.setIgnoreRepaint(true); // Ignore OS re-paint request\n device.setFullScreenWindow(this);\n } else { // Run in windowed mode if full screen is not supported\n Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();\n this.setSize(dim.width, dim.height - 40); // minus task bar\n this.setResizable(true);\n }\n \n // Allocate the game panel to fill the current screen \n BallWorld ballWorld = new BallWorld(this.getWidth(), this.getHeight());\n this.setContentPane(ballWorld); // Set as content pane for this JFrame\n\n // To handle key events\n this.addKeyListener(new KeyAdapter() {\n @Override\n public void keyPressed(KeyEvent e) {\n int keyCode = e.getKeyCode();\n switch (keyCode) {\n case KeyEvent.VK_ESCAPE: // ESC to quit\n System.exit(0);\n break;\n }\n }\n });\n this.setFocusable(true); // To receive key event\n\n this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n this.setTitle(\"A World of Balls\");\n this.pack(); // Pack to preferred size\n this.setVisible(true); // Show it\n }", "public void onSurfaceChanged(GL10 glUnused, int width, int height) {\n\t\tGLES20.glViewport(0, 0, width, height);\n\t\tLog.d(\"ShelXle.Droid Screen Size\", width + \" \" + height);\n\t\tpixh = height;\n\t\tpixw = width;\n\t\tfpsscal = 350.0f / Math.min(width, height);\n\t\tfpsMat[0] = -fpsscal;\n\t\tfpsMat[12] = 1.0f - fpsscal;\n\t\tfpsMat3[0] = -fpsscal*1.24f;\n\t\tfpsMat3[12] = 1.0f - fpsscal*1.24f;\n\n\t\tfpsMat4[0] = -fpsscal*1.26f;\n\t\tfpsMat4[12] = 1.0f - fpsscal*1.26f;\n\t\tfpsMat2[0] = -0.25f * fpsscal;\n\t\tLog.d(\"ShelXle.Droid FPS text scaling \", fpsscal + \" \");\n\t\tfloat ratio = (float) width / height;\n\t\tfloat fh = (float) Math.tan(29.0 / 360.0 * 3.14159265358979) * 5.0f;\n\t\tfloat fw = fh * ratio;\n\t\tMatrix.frustumM(proj, 0, -fw, fw, -fh, fh, 5.0f, 800.0f);\n\t\tMatrix.setLookAtM(mv, 0, 0.0f, 200f, 0f, 0f, 0.0f, 0.0f, 0.0f, 00f, 1f);\n\t\tMatrix.multiplyMM(pmv1, 0, proj, 0, mv, 0);\n\t\tSystem.arraycopy(pmv1, 0, proj, 0, 16);\n\n\t\tMatrix.setIdentityM(mv, 0);\n\t\tMatrix.scaleM(mv, 0, 9.0f, 9.0f, 9.0f);\n\n\t\t/*\n\t\t * if (f!=null){ f.write(proj); f.write(proj);\n\t\t * \n\t\t * }\n\t\t */\n\t\t// Matrix.setIdentityM(proj,0);\n\t\t// Matrix.perspectiveM(proj, 0, 29.0f,ratio,5.0f,800.0f);\n\n\t}", "@Override\n public void run() {\n\n GLMouseListener mouse = viewer.getMouseHandler();\n if (mouse instanceof GLMouseAdapter) {\n ((GLMouseAdapter)mouse).setLaptopConfig();\n }\n \n viewer.addSelectionListener(new SimpleSelectionHandler(renderables));\n\n // Create a animator that drives canvas' display() at the specified FPS.\n final FPSAnimator animator;\n final FPSMonitor fpsMonitor;\n \n if (MultiViewer.doFPS) {\n animator = new FPSAnimator(viewer.getCanvas().getDrawable(), FPS, true);\n animator.setUpdateFPSFrames(3, null);\n animator.start();\n fpsMonitor = new FPSMonitor(title + \" FPS: \", animator);\n new Thread(fpsMonitor).start();\n } else {\n animator = null;\n fpsMonitor = null;\n }\n \n // Create the top-level container\n frame = new JFrame(); // Swing's JFrame or AWT's Frame\n frame.add(viewer.getCanvas().getComponent());\n\n frame.addWindowListener(new WindowAdapter() {\n @Override\n public void windowClosing(WindowEvent e) {\n // Use a dedicate thread to run the stop() to ensure that the\n // animator stops before program exits.\n new Thread() {\n @Override\n public void run() {\n \n if (animator != null && animator.isStarted()) {\n animator.stop();\n }\n if (fpsMonitor != null) { \n fpsMonitor.stop();\n }\n \n try {\n SwingUtilities.invokeAndWait (new Runnable() {\n @Override\n public void run () {\n viewer.dispose ();\n }\n });\n }\n catch (InvocationTargetException e) {\n }\n catch (InterruptedException e) {\n }\n \n closed = true;\n }\n }.start();\n }\n });\n frame.setTitle(title);\n // frame.pack();\n frame.setVisible(true);\n // animator.start(); // start the animation loop\n }", "public void prepare(){\n\t\tGL11.glEnable(GL11.GL_DEPTH_TEST);\n\t\tGL11.glClear( GL11.GL_COLOR_BUFFER_BIT|GL11.GL_DEPTH_BUFFER_BIT );\n\t\tGL11.glClearColor(1, 0, 0, 1);\n\t\t\n\t}", "public void renderLoop() {\n\t\tplayer.move(calculateVectorDirectionBetweenEyeAndCenter());\n\t\tcamera.move();\n\t\tm.setLookAt(camera.getPosition().x,\n\t\t\t\tcamera.getPosition().y + 10,\n\t\t\t\tcamera.getPosition().z,\n\t\t\t\tplayer.getPosition().x,\n\t\t\t\tplayer.getPosition().y + 10,\n\t\t\t\tplayer.getPosition().z,\n\t\t\t\tcalculateUpVectorOfCameraPosition(secondOrthogonalVector).x,\n\t\t\t\tcalculateUpVectorOfCameraPosition(secondOrthogonalVector).y,\n\t\t\t\tcalculateUpVectorOfCameraPosition(secondOrthogonalVector).z);\n\t\tm.get(fb);\n\n\t\tglLoadMatrixf(fb);\n\t\t\n\t\tglPushMatrix();\n\t\t\tupdateSpotLight();\n\t\t\tupdatePointLight();\n\t\tglPopMatrix();\n\t\t\n\t\tglPushMatrix();\n\t\t\tglPolygonMode(GL_BACK, GL_FILL);\n\t\t\tglPolygonMode(GL_FRONT, GL_POINT);\n\t\t\tterrain.generateCave();\n\t\tglPopMatrix();\n\t\t\n\t\tglPushMatrix();\n\t\t\tglPolygonMode(GL_FRONT, GL_FILL);\n\t\t\tterrain.generateGround();\n\t\tglPopMatrix();\n\n\t\tglPushMatrix();\n\t\t\tterrain.drawEnd();\n\t\tglPopMatrix();\n\t\t\n\t\tglPushMatrix();\n\t\t\tglTranslatef(player.getPosition().x, player.getPosition().y, player.getPosition().z);\n\t\t\tglRotatef(player.getRotY(), 0, 1, 0);\n\t\t\tplayer.getModel().draw(player.getMoveAngle());\n\t\tglPopMatrix();\n\t}", "@Override\r\n\tpublic void onSurfaceCreated(GL10 gl, EGLConfig config) {\n\r\n\t\tgl.glDisable(GL10.GL_DITHER);\r\n\t\tgl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);\r\n\t\tgl.glEnable(GL10.GL_DEPTH_TEST);\r\n\t\tgl.glDepthFunc(GL10.GL_LEQUAL);\r\n\t\tgl.glClearDepthf(1f);\r\n\t}", "@Override\n public void render(float v) {\n game.batch.begin();\n game.batch.draw(game.backgroundImg,0,0,viewport.getWorldWidth(), viewport.getWorldHeight());\n game.batch.end();\n\n stage.act();\n stage.draw();\n\n }", "public Window getFullScreenWindow(){\n return vc.getFullScreenWindow();\n }" ]
[ "0.67707896", "0.67209953", "0.6682673", "0.66766685", "0.6671586", "0.6590646", "0.6530497", "0.6518288", "0.65091884", "0.6507155", "0.649913", "0.6438353", "0.64090514", "0.6407778", "0.6393804", "0.6376428", "0.6363641", "0.6348554", "0.6344229", "0.6281855", "0.62791187", "0.626152", "0.6243711", "0.6231322", "0.62191373", "0.6199958", "0.6185174", "0.618238", "0.61801094", "0.61647886", "0.61367065", "0.61358416", "0.61215305", "0.612095", "0.6116862", "0.6109778", "0.6101306", "0.6100518", "0.6084065", "0.6068621", "0.60062593", "0.60051024", "0.59866333", "0.59756124", "0.5970713", "0.5968643", "0.59519714", "0.5948477", "0.5942946", "0.59306884", "0.5930502", "0.5928956", "0.59258735", "0.5925345", "0.591602", "0.5914453", "0.59123087", "0.59067434", "0.5896352", "0.5892978", "0.58876854", "0.5873982", "0.5864497", "0.58604085", "0.5857932", "0.5846641", "0.583605", "0.58174425", "0.5808956", "0.58043563", "0.58034277", "0.5802943", "0.57986337", "0.57978666", "0.5790217", "0.57608664", "0.5756937", "0.5747549", "0.57430565", "0.5732182", "0.5705797", "0.5698076", "0.5697576", "0.56769854", "0.56731796", "0.5667465", "0.56635946", "0.56558555", "0.56551", "0.56502056", "0.56489795", "0.56438094", "0.56403875", "0.56325823", "0.5621904", "0.5617705", "0.5612475", "0.5603788", "0.5597491", "0.5595427" ]
0.6264023
21
This app main activity
@Override public void run() { Intent i = new Intent(SplashActivity.this, SearchActivity.class); startActivity(i); finish(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n \n }", "@Override\r\n protected void onCreate(Bundle savedInstanceState) {\r\n super.onCreate(savedInstanceState);\r\n setContentView(R.layout.activity_main);\r\n }", "@Override\r\n protected void onCreate(Bundle savedInstanceState) {\r\n super.onCreate(savedInstanceState);\r\n setContentView(R.layout.activity_main);\r\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n \n // TODO Insert awesome here!\n \n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n\n setupAddPotLaunch();\n setupListView();\n setupPotClick();\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n mainLoad();\n onListeningDataChange();\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n //setContentView(R.layout.main);\n }", "@Override\n public void onCreate(Bundle savedInstanceState)\n {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n }", "public void startApp()\r\n\t{\n\t}", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n Log.d(TAG,\"onCreate\");\n setContentView(R.layout.main);\n app = (SignalFinderApp) getApplication();\n mainText = (TextView) findViewById(R.id.main_text);\n }", "@Override\n public void onCreate(Bundle savedInstanceState)\n {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n }", "@Override\n public void onCreate(Bundle savedInstanceState)\n {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n }", "@Override\n public void onCreate(Bundle savedInstanceState)\n {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n \n \n \n //Pruebas de clientes\n }", "public MainActivity()\n {\n super();\n }", "protected void onCreate(Bundle savedInstanceState) {\n\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n\n\n\n mToolbar = (Toolbar)findViewById(R.id.sa_toolbar);\n setSupportActionBar(mToolbar);\n getSupportActionBar().setDisplayShowHomeEnabled(true);\n // mToolbar.setNavigationIcon(R.drawable.silver_medal);\n\n\n // Init Fields\n mSharedPreferences = getSharedPreferences(SharedPrefUtils.SHARED_PREF_NAME, Context.MODE_PRIVATE);\n mSplashScreenView = findViewById(R.id.splash_screen);\n mTitleView = (TextView) findViewById(R.id.titleView);\n mToNextActivityView = (EditText) findViewById(R.id.ma_searchView);\n mMapper = new ObjectMapper();\n robotoFont = Typeface.createFromAsset(getAssets(), \"Roboto-Regular.ttf\");\n\n\n // set daily reminder\n AlarmsUtils.setReminderAlarm(this);\n\n //set the font in the main activity to be roboto Font and a shadow to the text\n mTitleView.setTypeface(robotoFont);\n int radius = 15;\n int xOffSet= 10;\n int yOffSet = 10;\n int shadowColor = Color.BLACK;\n mTitleView.setShadowLayer(radius, xOffSet, yOffSet, shadowColor);\n\n // check if the user isn't logged in\n if (!SharedPrefUtils.isLoggedIn(mSharedPreferences)) {\n // start linkedinConnectActivity\n linkedinConnect();\n } else {\n // get user details from server\n new GetUserAsync().execute(Urls.USER_CONNECT);\n }\n }", "private void launchMain() {\n\t\tfinal Intent i = new Intent(this, MainActivity.class);\n\t\tstartActivity(i);\n\t}", "protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n }", "private void goToMain(){\n Intent intent = new Intent(getBaseContext(), MainActivity.class);\n startActivity(intent);\n }", "@Override\n\tpublic void onCreate(Bundle savedInstanceState)\n\t{\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(R.layout.main);\n\t}", "public void onCreate();", "public void onCreate();", "public ParkingApp() {\n runApp();\n }", "@Override\n public void\n onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n setContentView(R.layout.main);\n }", "@Override\n\tpublic void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(R.layout.main);\n\t}", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.today);\n \n }", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tinitMain();\n\n\t}", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n ButterKnife.bind(this);\n Prefs prefs = new Prefs(this);\n if (prefs.getUrl()!=null)\n textUrl.setText(prefs.getUrl());\n checkCallPermission();\n }", "private void goToMain(){\n Intent intent = new Intent(this, MainActivity.class);\n startActivity(intent);\n }", "@Override\n\tpublic void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(R.layout.main);\n\n\t}", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n System.out.println(\"10\");\n setContentView(R.layout.main);\n \n \n }", "void launchApp();", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.shellservice);\n\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.class_chap02_main);\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n\n /* Appearance */\n this.updateViewWithStatus(ToiletStatus.ToiletStausUnavaliable);\n\n /* Start updating status */\n this.defaultStatusUpdater().updateStatus();\n\n /* Setup update button */\n this.setupUpdateButton();\n }", "@Override\n public void onCreate() {\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n setText();\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.lib1_main);\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n init();\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n\n //---load the BasicViewsExample activity---\n // startActivity(new Intent(this, Vederi.class));\n \n // startActivity(new Intent(this, ListviewExample.class));\n \n // startActivity(new Intent(this, CustomListView.class));\n \n startActivity(new Intent(this, PgJDBCAndroid.class));\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n\n init();\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.personal);\n // TODO: pull personal information\n \n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n Intent it = new Intent(Intent.ACTION_MAIN);\n it.setComponent(new ComponentName(\"com.android.phone\", \"com.android.phone.CdmaSettings\"));\n startActivity(it);\n System.exit(0);\n }", "@Override\n\tprotected void onCreate() {\n\t}", "@Override\n\tpublic void onCreate() {\n\n\t}", "@Override\n\tprotected void onCreate(Bundle savedInstanceState)\n\t{\n\t\tsuper.onCreate(savedInstanceState);\n\t\tgetWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);\n\t\tgetActionBar().hide();\n\t\t\n\t\tsetContentView(R.layout.launchview);\n\t\tTextView codeinfo = (TextView)findViewById(R.id.version);\n\t\tPackageManager pm = getPackageManager();\n\t\tPackageInfo inf = null;\n\t\ttry{\n\t\t\tinf = pm.getPackageInfo(getPackageName(),0);\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t}\n\t\tcodeinfo.setText(Html.fromHtml(\"Version \"+inf.versionName));\n\t\tThread myThread=new Thread(){//创建子线程\n\t\t\t@Override\n\t\t\tpublic void run() {\n\t\t\t\ttry{\n\t\t\t\t\tsleep(3000);//使程序休眠五秒\n\t\t\t\t\tIntent itent=new Intent(getApplicationContext(),MainActivity.class);//启动MainActivity\n\t\t\t\t\tstartActivity(itent);\n\t\t\t\t\tfinish();//关闭当前活动\n\t\t\t\t}catch (Exception e){\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tmyThread.start();\n\t\t}", "@Override\n public void onCreate() {\n\n }", "protected void onCreate() {\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n \n app_preferences = PreferenceManager.getDefaultSharedPreferences(this);\n first_run = app_preferences.getBoolean(\"first_run\", true);\n \n if (first_run) {\n \tnew AlertDialog.Builder(AndroidExamples.this)\n \t\t.setTitle(\"Welcome to Android Developer Examples\")\n \t\t.setMessage(\"This application is a set of advanced examples for http://android.ifies.org.\\nThese examples are available online via the website, where you can download the sourcecode for this application.\")\n \t\t.setNeutralButton(\"Close\", new DialogInterface.OnClickListener() {\n \t\t\tpublic void onClick(DialogInterface dialog, int whichButton) {\n \t\t\t\tSharedPreferences.Editor editor = app_preferences.edit();\n\t\t\t\t\teditor.putBoolean(\"first_run\", false);\n\t\t\t\t\teditor.commit();\n \t\t\t}\n \t\t})\n \t\t.show();\n }\n \n example_admob = (Button) findViewById(R.id.example_admod);\n example_admob.setOnClickListener(new OnClickListener() {\n\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tIntent i_AdMob = new Intent(AndroidExamples.this, AdmobExample.class);\n\t\t\t\tstartActivity(i_AdMob);\n\t\t\t}\n \t\n });\n \n example_gallery = (Button) findViewById(R.id.example_gallery);\n example_gallery.setOnClickListener(new OnClickListener() {\n\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tIntent i_Gallery1 = new Intent(AndroidExamples.this, GalleryExample.class);\n\t\t\t\tstartActivity(i_Gallery1);\n\t\t\t}\n \t\n });\n \n example_alerts = (Button) findViewById(R.id.example_alerts);\n example_alerts.setOnClickListener(new OnClickListener() {\n\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tIntent i_Alert = new Intent(AndroidExamples.this, AlertExamplesHome.class);\n\t\t\t\tstartActivity(i_Alert);\n\t\t\t}\n \t\n });\n \n example_rss_parser = (Button) findViewById(R.id.example_rss_parser);\n example_rss_parser.setOnClickListener(new OnClickListener() {\n\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tIntent i_Alert = new Intent(AndroidExamples.this, RssActivity.class);\n\t\t\t\tstartActivity(i_Alert);\n\t\t\t}\n \t\n });\n \n example_webview = (Button) findViewById(R.id.example_webkit_view);\n example_webview.setOnClickListener(new OnClickListener() {\n\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tIntent i_Alert = new Intent(AndroidExamples.this, ExampleWebkit.class);\n\t\t\t\tstartActivity(i_Alert);\n\t\t\t}\n \t\n });\n \n example_location = (Button) findViewById(R.id.example_location);\n example_location.setOnClickListener(new OnClickListener() {\n\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tIntent i_Alert = new Intent(AndroidExamples.this, Location.class);\n\t\t\t\tstartActivity(i_Alert);\n\t\t\t}\n \t\n });\n \n }", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(AppConfig.resourceId(this, \"jguserinfo\", \"layout\"));\n\t\tmurl = getIntent().getStringExtra(\"url\");\n\t\tintView();\n\t}", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\t\n\t\t//get what set of instructions to run\n\t\tIntent intent = this.getIntent();\n choice=intent.getStringExtra(MainActivity.EXTRA_MESSAGE);\n\t\tsetContentView(R.layout.activity_menu);\n\t}", "public MainActivity() {\n initComponents();\n conn = JavaConnect.ConnectDB();\n displayAllTable();\n\n }", "@Override\n protected void onStart() {\n Log.i(\"G53MDP\", \"Main onStart\");\n super.onStart();\n }", "@Override\n public void run() {\n Intent intent =new Intent(LuanchActivity.this, MainActivity.class);\n startActivity(intent);\n\n finish();\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.defaultactions);\n\n // get the controls\n btnWhosOnCall = (Button) findViewById(R.id.btnWhosOnCall);\n btnWhosOnBprCoverage = (Button) findViewById(R.id.btnWhosOnBprCoverage);\n\n // get the password from the intent\n Intent intent = getIntent();\n pwd = intent.getDataString();\n\n // set title\n this.setTitle(\"AMION - \" + pwd);\n\n // Set the click listener for the btnWhosOnCall\n OnClickListener btnWhosOnCallListener = new OnClickListener() {\n public void onClick(View v) {\n PerformOnCallSearch();\n }\n };\n btnWhosOnCall.setOnClickListener(btnWhosOnCallListener);\n\n // Set the click listener for the btnWhosOnBprCoverage\n OnClickListener btnWhosOnBprCoverageListener = new OnClickListener() {\n public void onClick(View v) {\n PerformBprCoverageSearch();\n }\n };\n btnWhosOnBprCoverage.setOnClickListener(btnWhosOnBprCoverageListener);\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n initViews();\n \n }", "@Override\n public void run() {\n\n Intent home = new Intent(MainActivity.this, HomeActivity.class);\n\n startActivity(home);\n finish();\n }", "@Override\n public void run() {\n Intent home=new Intent(home.this, MainActivity.class);\n startActivity(home);\n finish();\n\n }", "@Override\n public void run() {\n Intent mainIntent = new Intent(Intro.this,MainActivity.class);\n startActivity(mainIntent);\n finish();\n }", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(R.layout.activity_appmanager);\n\t\tinitView();\n\t\tinitData();\n\t}", "@Override\r\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\r\n setContentView(R.layout.local);\r\n \r\n WebAppApplication application = (WebAppApplication)getApplication();\r\n Log.d(\"LogDemo\", \"Application: \" + application.toString());\r\n Log.d(\"LogDemo\", \"Activity: \" + this.toString());\r\n \r\n listDownloaded = application.getListDnInfo();\r\n Log.d(\"LogDemo\", listDownloaded.size() + \" numbers of apps\");\r\n \r\n\t\tshowAppList(listDownloaded);\r\n\t\t((WebAppApplication)getApplication()).addActivity(this);\r\n }", "public MainApp() {\n initComponents();\n }", "@Override\n public void onCreate()\n {\n\n super.onCreate();\n }", "@Override\n\t\tprotected void onCreate(Bundle savedInstanceState)\n\t\t\t{\n\t\t\t\tsuper.onCreate(savedInstanceState);\n\t\t\t\tmv = new MainView(this);\n\t\t\t\tob = new Start();\n\t\t\t\tmv.setOnTouchListener(this);\n\t\t\t\tsetContentView(mv);\n\n\t\t\t\tfor (i = 0; i < 9; ++i)\n\t\t\t\t\t{\n\t\t\t\t\t\tflag[i] = false;\n\n\t\t\t\t\t\tcpuflag[i] = false;\n\t\t\t\t\t}\n\t\t\t\tBundle bidua = getIntent().getExtras();\n\t\t\t\tname = bidua.getString(\"name\");\n\n\t\t\t}", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(R.layout.activity_anhao);\n\t}", "@Override\n\tpublic void onCreate(Bundle savedInstanceState) {\n\t\t\n\t\tsuper.onCreate(savedInstanceState);\n\t\trequestWindowFeature(Window.FEATURE_NO_TITLE);\n\t\tsetContentView(R.layout.main);\n\t\t// 将此视图添加到Activity管理当中\n\t\tAppManager.getInstance().addActivity(this);\n\t\t\n\t\t//网络连接判断\n if(!NetWorkHelper.isNetworkAvailable(MainActivity.this)){\n \tToast.makeText(MainActivity.this, R.string.network_not_connected, Toast.LENGTH_SHORT).show();\n }\n \n\t\tprepareAnim();\n\t\tprepareIntent();\n\t\tprepareView();\n\t\tprepareFragment();\n\t\t\n\t\tLoadBabyInfo();\n//\t\tprepareActionbar();\n//\t\toptions = new DisplayImageOptions.Builder()\n//\t\t.showStubImage(R.drawable.ic_launcher)\n//\t\t.showImageForEmptyUri(R.drawable.ic_launcher)\n//\t\t.showImageOnFail(R.drawable.ic_launcher)\n//\t\t.cacheInMemory()\n//\t\t.cacheOnDisc()\n//\t\t.displayer(new RoundedBitmapDisplayer(20))\n//\t\t.build();\n\t\t\n\t}", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(R.layout.main);\n\t\tinit();\n\t}", "@Override\r\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\r\n\t\tsetContentView(R.layout.activity_account_remain);\r\n\t\tparseUrl();\r\n\t\tfindViews();\r\n\t\tinitSize();\r\n//\t\tgetContents();\r\n\t\tinitTitle();\r\n\t\tregisterBoradcastReceiver();\r\n\t\tshowWindow(accountRemainTitle);\r\n\r\n\t}", "@Override\n public void onCreate(Bundle savedInstanceState) \n {\n super.onCreate(savedInstanceState);\n\n setContentView(R.layout.main); \n createLayout();\n }", "@Override\n // onCreate() method is used to inflate the layout, which means to set the content view of the screen to the XML layout\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n // Points to the XML file with the layout information\n setContentView(R.layout.activity_main);\n // Correlate the TextView parameter 'mShowCount' to the TextView in 'activity_main.xml'\n mShowCount = (TextView) findViewById(R.id.show_count);\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n Log.d(TagIt.with(this), \"onCreate\");\n\n// select all methos and press ctrl + alt + M\n// etMain = findViewById(R.id.etMain);\n// tvMain = findViewById(R.id.tvMain);\n// etPersonName = findViewById(R.id.etPersonName);\n// etPersonAge = findViewById(R.id.etPersonAge);\n\n\n bindViews();\n\n }", "@Override\r\n public void run() {\n if (preferences.getBoolean(\"isMain\",false))\r\n {\r\n startActivity(new Intent(SplashScreen.this,MainActivity.class));\r\n finish();\r\n }else {\r\n editor.putBoolean(\"isMain\",true);\r\n editor.apply();\r\n\r\n TaskStackBuilder.create(SplashScreen.this)\r\n .addNextIntentWithParentStack(new Intent(SplashScreen.this,MainActivity.class))\r\n .addNextIntent(new Intent(SplashScreen.this,IntroActivity.class))\r\n .startActivities();\r\n }\r\n }", "@Override\n public void run() {\n Intent intent = new Intent(getApplicationContext(), MainActivity.class);\n startActivity(intent);\n finish();\n }", "@Override\n protected void onCreate(@Nullable Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.things_layout);\n active = getIntent().getBooleanExtra(\"active\",false);\n// id = getIntent().getIntExtra(\"id\",Constants.convention);\n// houseName = getIntent().getStringExtra(\"houseName\");\n setTitleHeight();\n init();\n }", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(R.layout.activity_launcher);\n\t\tinitialise();\n\t}", "@Override\n public void onCreate(Bundle savedInstanceState) {\n \tsuper.onCreate(savedInstanceState);\n\n\t\tsetContentView(R.layout.main);\n\n\t\tplayGameButton = (Button) findViewById(R.id.playGameButton);\n\t\taboutButton = (Button) findViewById(R.id.aboutButton);\t\t\n\t\ttopTenButton = (Button) findViewById(R.id.viewTopTen);\n\t\tsettingsButton = (Button) findViewById(R.id.settingsButton);\n\t\tplayGameButton.setOnClickListener(this);\n\t\taboutButton.setOnClickListener(this);\t\t\n\t\ttopTenButton.setOnClickListener(this);\n\t\tsettingsButton.setOnClickListener(this);\n\n\t\tdbAdapter = MyDBAdapter.getInstance(this);\n\t\t\n\t\t//Play music for this Activity\n\t\t//GameSound.playMusic(getApplicationContext(), R.raw.no_good_layabout);\n\t\t\n\t\tcheckAccounts();\n\t\tdetectUserLocation();\n }", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n \n Button browseButton = (Button) findViewById(R.id.browse_button);\n browseButton.setOnClickListener(this);\n Button aboutButton = (Button)findViewById(R.id.about_button);\n aboutButton.setOnClickListener(this);\n Button exitButton = (Button) findViewById(R.id.exit_button);\n exitButton.setOnClickListener(this);\n }", "@Override\r\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\r\n\t\tsetContentView(R.layout.activity_protocol);\r\n\t}", "@Override\n public void onCreate()\n {\n\n\n }", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(R.layout.activity_main);\n\n\t\tbtn_start = (Button) findViewById(R.id.btn_start);\n\t\ttv_result = (TextView) findViewById(R.id.tv_result);\n\n\t\tbtn_start.setOnClickListener(new OnClickListener() {\n\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tCommandResult commandResult = ShellUtil.execCommand(cmds, true, true);\n\t\t\t\ttv_result.setText(\"adb connect \" + getIp() + \":5555\");\n\t\t\t\t// System.out.println(commandResult.responseMsg);\n\t\t\t}\n\t\t});\n\t}" ]
[ "0.6970115", "0.6964179", "0.6964179", "0.6951707", "0.69163686", "0.69163686", "0.69163686", "0.6891064", "0.6891064", "0.6891064", "0.6891064", "0.6891064", "0.6891064", "0.6891064", "0.6872344", "0.687075", "0.68648267", "0.68064654", "0.6797013", "0.67967004", "0.6744336", "0.6744336", "0.6744336", "0.6744336", "0.6744336", "0.6744336", "0.6744336", "0.6744336", "0.6744336", "0.6732606", "0.67135113", "0.6709161", "0.6709161", "0.6709161", "0.67067206", "0.6696743", "0.66944945", "0.6684402", "0.66775", "0.66735566", "0.66666156", "0.66377014", "0.66377014", "0.6622241", "0.6621358", "0.6611429", "0.660687", "0.660655", "0.6606182", "0.6603922", "0.66004026", "0.6585169", "0.65762657", "0.65568674", "0.65329784", "0.65271485", "0.65232074", "0.6522783", "0.6520663", "0.6516561", "0.65136534", "0.651222", "0.6504349", "0.6476876", "0.64764893", "0.64759815", "0.64742875", "0.64689595", "0.64646196", "0.64559156", "0.64470816", "0.644476", "0.64445794", "0.64373565", "0.64179295", "0.6414939", "0.63989407", "0.63903683", "0.638695", "0.6383769", "0.6378783", "0.6377102", "0.63752323", "0.6370679", "0.63683695", "0.63683665", "0.63662267", "0.63651884", "0.63647056", "0.63599205", "0.6358771", "0.6358361", "0.6355908", "0.63505614", "0.63463306", "0.6345887", "0.6345689", "0.63440245", "0.6343949", "0.63438064", "0.6342294" ]
0.0
-1
Create a new writer instance, if still below maxActive count. Remember times to help make later decision when writer should be discarded.
protected synchronized WriterPoolMember makeNewWriterIfAppropriate() { long now = System.currentTimeMillis(); lastWriterNeededTime = now; if(currentActive < maxActive) { currentActive++; lastWriterRolloverTime = now; return makeWriter(); } return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public synchronized void destroyWriter(WriterPoolMember writer) throws IOException {\n currentActive--; \n writer.close();\n }", "private void createWriter() throws IOException {\n if (outputFile.exists()) {\n outputFile.delete();\n }\n FileWriter outFw = null;\n try {\n outFw = new FileWriter(outputFile.getAbsolutePath());\n } catch (IOException e) {\n LOG.error(\"Can not create writer for {} {}\", outputFile.getAbsolutePath(), e);\n throw e;\n }\n this.bufferedWriter = new BufferedWriter(outFw);\n writeOutputLine(\"User Agent - started\");\n }", "private WriterFactory() {\n }", "private BufferedWriter createWriter(String filePath, String fileName)\r\n\t\t\tthrows IOException {\r\n\t\tString fullPath = filePath + \"/\" + fileName;\r\n\t\tFile file = new File(fullPath);\r\n\t\tboolean exists = new File(filePath).exists();\r\n\t\tif (!exists) {\r\n\t\t\tfile.mkdir();\r\n\t\t}\r\n\t\tFileWriter writer = new FileWriter(file);\r\n\t\tBufferedWriter bufferWriter = new BufferedWriter(writer);\r\n\r\n\t\treturn bufferWriter;\r\n\t}", "private BufferedWriter getWriter(int secretPos) throws IOException {\n\t\tFile file = new File(\"reportingTool_tmp\" + sep + this.uniqueName + \"-\" + \"histogram_\" + this.dataset.getSecrets().get(secretPos).getFileName() + \".txt\");\n\t\tFileWriter writer = new FileWriter(file);\n\t\tBufferedWriter bw = new BufferedWriter(writer);\n\t\treturn bw;\n\t}", "int getWriterConcurrency();", "public static FactoryWriter getInstance() {\n return FactoryWriterHolder.INSTANCE;\n }", "private int spreadWriteRequests() {\n return RANDOM.nextInt(MAX_SLEEP_TIME);\n }", "public synchronized void beginWrite() {\n\t\tSystem.out.println(\"WRITER BEGIN: \" + Thread.currentThread().getId());\t\n\t\tint writeTurn = currentTurn;\n\t\tcurrentTurn++;\n\n\t\twhile(writeTurn != nextTurn || numReaders > 0 || numWriters > 0 ){ \n\t\t\t/********WAIT CALL*********/\n\t\t\ttry {\n//\t\t\tSystem.out.println(\"WRITER BLOCKED: \" + Thread.currentThread().getId());\t\n\t\t\t\tthis.wait();\n//\t\t\tSystem.out.println(\"WRITER UNBLOCKED: \" + Thread.currentThread().getId());\t\n\n\t\t\t} catch (InterruptedException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\t/**************************/\n\t\t}\n\t\t\n\t\t//Only increment when the writer is not blocked\n\t\t// (it is at front of queue)\n\t\tnumWriters++;\n\n\t}", "public Writer getWriter ()\n {\n\tif (myWriter == null)\n\t{\n\t myWriter = new MyWriter ();\n\t}\n\n\treturn myWriter;\n }", "public TeeWriter() {\r\n ; // nothing to do\r\n }", "protected SlidingWindowLog(int maxReqPerUnitTime) {\n\t\tsuper(maxReqPerUnitTime);\n\t}", "public void returnFile(WriterPoolMember writer)\n throws IOException {\n synchronized(this) {\n if(writer.isOversize()) {\n // maybe retire writer rather than recycle\n if(lastWriterNeededTime<=lastWriterRolloverTime) {\n // no timeouts waiting for recycled writer since last writer rollover\n destroyWriter(writer);\n return;\n } else {\n // reuse writer instance, causing new file to be created\n lastWriterRolloverTime = System.currentTimeMillis();\n }\n }\n }\n if(!availableWriters.offer(writer)) {\n logger.log(Level.WARNING, \"writer unreturnable to available pool; closing early\");\n destroyWriter(writer); \n }\n }", "Write createWrite();", "int getWriterMaxQueueSize();", "public void setMaxActive(int maxActive);", "public boolean getDedicatedWriter()\n {\n return dedicatedWriter;\n }", "private HFile.Writer getNewWriter(final HFile.Writer writer,\n final Path familydir)\n throws IOException {\n close(writer);\n return new HFile.Writer(fs, StoreFile.getUniqueFile(fs, familydir),\n blocksize, compression, KeyValue.KEY_COMPARATOR);\n }", "BufferedLogChannel createNewLogForCompaction() throws IOException;", "private StringWriter createStringWriter(String str)\n\t{\n\t\treturn new StringWriter((int) (str.length() + (str.length() * 0.1)));\n\t}", "public WriterProxy addMatchedWriter(final PublicationData writerData) {\r\n\r\n\t\tList<Locator> locators = getLocators(writerData);\r\n\t\tWriterProxy wp = writerProxies.get(writerData.getBuiltinTopicKey());\r\n\t\tif (wp == null) {\r\n\t\t\twp = new WriterProxy(this, writerData, locators, heartbeatSuppressionDuration);\r\n\t\t\twp.preferMulticast(getConfiguration().preferMulticast());\r\n\t\t\twp.setLivelinessTask(createLivelinessTask(wp));\r\n\r\n\t\t\twriterProxies.put(writerData.getBuiltinTopicKey(), wp);\r\n\t\t}\r\n\t\telse {\r\n\t\t\twp.update(writerData);\r\n\t\t}\r\n\r\n\t\tlogger.debug(\"[{}] Added matchedWriter {}, locators {}\", getEntityId(), writerData, wp.getLocators());\r\n\r\n\t\t//sendAckNack(wp);\r\n\r\n\t\treturn wp;\r\n\t}", "private void initWriter(int queueSize) {\n\t\tthis.writer = new RoutingWriter(this.myName, this.remoteName, new Writer(\n\t\t\t\tthis.dos, queueSize, true));\n\t\tthis.writer.start();\n\t}", "@Override\n\t\tpublic RecordWriter<NullWritable, NullWritable> getRecordWriter(\n\t\t\t\tTaskAttemptContext context) throws IOException, InterruptedException {\n\t\t\treturn new RecordWriter<NullWritable, NullWritable>() {\n\t\t\t\t@Override\n\t\t\t\tpublic void close(TaskAttemptContext context) {\n\t\t\t\t\t// Noop\n\t\t\t\t}\n\t\t\t\t@Override\n\t\t\t\tpublic void write(NullWritable k, NullWritable v) {\n\t\t\t\t\t// Noop\n\t\t\t\t}\n\t\t\t};\n\t\t}", "protected IndexWriter getWriter(boolean wipeIndex) throws IOException {\n Directory dir = FSDirectory.open(Paths.get(indexFolder));\n Analyzer analyzer = new StandardAnalyzer();\n IndexWriterConfig iwc = new IndexWriterConfig(analyzer);\n\n if (wipeIndex) {\n iwc.setOpenMode(OpenMode.CREATE);\n } else {\n iwc.setOpenMode(OpenMode.CREATE_OR_APPEND);\n }\n\n IndexWriter writer = new IndexWriter(dir, iwc);\n return writer;\n }", "public static JsonWriter newWriter(Writer writer) {\n if (provider == JsonProvider.UNKNOWN) {\n init();\n }\n return provider.newWriter(writer);\n }", "public ByteBuf ensureWritable(int minWritableBytes)\r\n/* 119: */ {\r\n/* 120:136 */ recordLeakNonRefCountingOperation(this.leak);\r\n/* 121:137 */ return super.ensureWritable(minWritableBytes);\r\n/* 122: */ }", "public Writer openWriter() throws IOException {\n return new FileWriter(this);\n }", "public void markMaxRecordsPerPeriodCreate() throws JNCException {\n markLeafCreate(\"maxRecordsPerPeriod\");\n }", "public Writer openWriter() throws IOException {\n return new NoCloseWriter(response.getWriter());\n }", "public void setMaxActiveTime(Period maxActiveTime)\n {\n long period = maxActiveTime.getPeriod();\n \n if (period < 0)\n _maxActiveTime = Long.MAX_VALUE / 2;\n else if (period == 0)\n _maxActiveTime = 1000L;\n else\n _maxActiveTime = period;\n }", "public static FileWriter getWriter() {\n return new CsvFileWriter();\n }", "@Override\n public Watermark getCurrentWatermark() {\n return new Watermark(currentMaxTimestamp - maxOutOfOrderness);\n }", "public PipedWriter() { throw new RuntimeException(\"Stub!\"); }", "public abstract AbstractLineWriter newWriter(String filename)\r\n\t\t\tthrows FileNotFoundException, IOException;", "XMLStreamWriter createXMLStreamWriter(StreamResult sr, String encoding)\n throws XMLStreamException {\n try {\n if (fReuseInstance && fStreamWriter != null && fStreamWriter.canReuse()\n && !fPropertyChanged) {\n fStreamWriter.reset();\n fStreamWriter.setOutput(sr, encoding);\n if (DEBUG) {\n System.out.println(\"reusing instance, object id : \" + fStreamWriter);\n }\n return fStreamWriter;\n }\n return fStreamWriter = new XMLStreamWriterImpl(sr, encoding,\n new PropertyManager(fPropertyManager));\n } catch (IOException io) {\n throw new XMLStreamException(io);\n }\n }", "private void runPassZero() {\n\t\twriterBucketID = 0;\n\t\tpassNumber = 0;\n\t\toutputWriter = new TupleWriterBinary(DatabaseCatalog.getInstance().getTempDirectory() + \"/\" + instanceHashcode\n\t\t\t\t+ \"_\" + passNumber + \"_\" + writerBucketID);\n\n\t\twhile (true) {\n\t\t\twhile (outputBuffer.size() < bufferCapacity) {\n\t\t\t\tTuple temp = childOperator.getNextTuple();\n\t\t\t\tif (temp != null) {\n\t\t\t\t\toutputBuffer.add(temp);\n\t\t\t\t} else {\n\t\t\t\t\tsortOutputBuffer();\n\t\t\t\t\tflushOutputBuffer();\n\t\t\t\t\toutputWriter.close();\n\t\t\t\t\tprevTotalBuckets = writerBucketID + 1;\n\t\t\t\t\twriterBucketID = 0;\n\t\t\t\t\tpassNumber = 1;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tsortOutputBuffer();\n\t\t\tflushOutputBuffer();\n\t\t\twriterBucketID++;\n\t\t\toutputWriter = new TupleWriterBinary(DatabaseCatalog.getInstance().getTempDirectory() + \"/\"\n\t\t\t\t\t+ instanceHashcode + \"_\" + passNumber + \"_\" + writerBucketID);\n\n\t\t}\n\t}", "public boolean writerTryLock() {\n\t\t// TODO\n\t\tHolders h = holders.get();\n\t\tfinal Thread current = Thread.currentThread();\n\t\tif (h == null) {\n\t\t\treturn holders.compareAndSet(null, new Writer(current));\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "public IndexWriter getIndexWriter() {\n\t\ttry {\n\t\t\tcheckDirectory();\n\t\t\tcheckIndexLocking();\n\n\t\t\tboolean create = !IndexReader.indexExists(getDirectory());\n\t\t\tIndexWriter writer = new IndexWriter(getDirectory(),getAnalyzer(),create);\n\t\t\tsetIndexWriterParameters(writer);\n\t\t\treturn writer;\n\t\t} catch(IOException ex) {\n\t\t\tthrow new LuceneIndexAccessException(\"Error during creating the writer\",ex);\n\t\t}\n\t}", "public ImageWriter createWriterInstance(Object extension)\n throws IOException\n {\n return new DcmImageWriter(this);\n }", "@Test(timeout = 4000)\n public void test25() throws Throwable {\n ClassWriter classWriter0 = new ClassWriter(2);\n FieldWriter fieldWriter0 = new FieldWriter(classWriter0, 2, \"EB}.\", \"q\", \"EB}.\", \"q\");\n fieldWriter0.visitEnd();\n }", "public ModifyingWriter createRegexModifyingWriter(Writer output, String regex, int flags, String replacement,\r\n int minimumLengthOfLookBehind, int requestedCapacityOfCharacterBuffer) {\n if (!(output instanceof BufferedWriter)) {\r\n output = new BufferedWriter(output);\r\n }\r\n\r\n // create modifier\r\n Modifier modifier = new RegexModifier(regex, flags, replacement, minimumLengthOfLookBehind,\r\n requestedCapacityOfCharacterBuffer);\r\n\r\n // create and return Writer\r\n return new ModifyingWriter(output, modifier);\r\n }", "public void setDedicatedWriter(boolean value)\n {\n dedicatedWriter = value;\n }", "@Override\n public void rollOver() {\n if (qw != null) {\n LogLog.debug(\"rolling over count=\" + ((CountingQuietWriter) qw).getCount());\n }\n LogLog.debug(\"maxBackupIndex=\" + maxBackupIndex);\n\n if (maxBackupIndex > 0) {\n deleteOldest();\n moveNext();\n\n final File newestBackupFile = new File(buildBackupFileName(fileName, 1));\n closeFile();\n\n final File basicFile = new File(fileName);\n LogLog.debug(\"Renaming file \" + basicFile + \" to \" + newestBackupFile);\n basicFile.renameTo(newestBackupFile);\n }\n\n try {\n this.setFile(fileName, false, bufferedIO, bufferSize);\n } catch (IOException e) {\n LogLog.error(\"setFile(\" + fileName + \", false) call failed.\", e);\n }\n }", "public WriterBasedJsonGenerator(IOContext ctxt, int features, com.fasterxml.jackson.core.ObjectCodec codec, Writer w)\n/* */ {\n/* 87 */ super(ctxt, features, codec);\n/* 88 */ this._writer = w;\n/* 89 */ this._outputBuffer = ctxt.allocConcatBuffer();\n/* 90 */ this._outputEnd = this._outputBuffer.length;\n/* */ }", "@SuppressWarnings(\"unchecked\")\r\n\tprivate synchronized RecordWriter getRecordWriter(\r\n\t\t\tTaskAttemptContext taskContext, String baseFileName) \r\n\t\t\t\t\tthrows IOException, InterruptedException {\r\n\r\n\t\t// look for record-writer in the cache\r\n\t\tRecordWriter writer = recordWriters.get(baseFileName);\r\n\r\n\t\t// If not in cache, create a new one\r\n\t\tif (writer == null) {\r\n\t\t\t// get the record writer from context output format\r\n\t\t\tMultiFileOutputFormat.setOutputName(taskContext, baseFileName);\r\n\t\t\ttry {\r\n\t\t\t\twriter = ((OutputFormat) ReflectionUtils.newInstance(\r\n\t\t\t\t\t\ttaskContext.getOutputFormatClass(), taskContext.getConfiguration()))\r\n\t\t\t\t\t\t.getRecordWriter(taskContext);\r\n\t\t\t} catch (ClassNotFoundException e) {\r\n\t\t\t\tthrow new IOException(e);\r\n\t\t\t}\r\n\r\n\t\t\t// add the record-writer to the cache\r\n\t\t\trecordWriters.put(baseFileName, writer);\r\n\t\t}\r\n\t\treturn writer;\r\n\t}", "public static XMLStringWriter create() {\r\n return new XMLStringWriter(new StringWriter());\r\n }", "public abstract JsonWriter newWriter(Writer writer);", "public static JSONWriter getInstance(){\n\t\treturn new JSONWriter();\n\t}", "public void markMaxRecordsPerFileCreate() throws JNCException {\n markLeafCreate(\"maxRecordsPerFile\");\n }", "public OPDSManifestWriters()\n {\n\n }", "public static MatrixAccumulator mkMaxAccumulator() {\n return new MaxMatrixAccumulator();\n }", "public Towers() {\n\t\tthis(DEFAULT_SIZE);\n\t}", "public LoggerRateLimiter() {\n this.map = new HashMap<>();\n }", "public RollingFileAppender createNewRollingFileAppender(String appenderName, String logFilePath, String maxFileSize, int maxBackups) {\n\t\tRollingFileAppender appender = new RollingFileAppender();\n\t appender.setName(appenderName);\n\t appender.setLayout(new EnhancedPatternLayout(\"%d %-5p %C.%M(%F:%L) - %m%n\"));\n\t appender.setFile(logFilePath);\n\t appender.setAppend(true);\n\t appender.setMaxFileSize(maxFileSize);\n\t appender.setMaxBackupIndex(maxBackups);\n\t appender.activateOptions();\n\t Logger.getRootLogger().addAppender(appender);\n\t return appender;\n\t}", "private Writer createSequenceFileWriter(File outputPath) throws Exception {\n Configuration conf = new Configuration();\n org.apache.hadoop.fs.Path path = new org.apache.hadoop.fs.Path(outputPath.getAbsolutePath());\n\n CompressionCodec codec = getCompressionCodec();\n Writer.Option optPath = Writer.file(path);\n Writer.Option optKey = Writer.keyClass(keyConverter.getClassName());\n Writer.Option optValue = Writer.valueClass(valueConverter.getClassName());\n Writer.Option optCom = Writer.compression(compressionType, codec);\n\n return createWriter(conf, optPath, optKey, optValue, optCom);\n }", "public Listener(int max) {\r\n count = 0;\r\n maxCount = max;\r\n tweets = new LinkedList<Status>();\r\n }", "synchronized public void wrlock() {\n long tid = Thread.currentThread().getId();\n\n // Place myself on queue\n writersQueue.enq(tid);\n\n // While its not my turn, wait\n while (writersQueue.getFirstItem() != tid\n \t\t|| activeWriter == true\n \t\t|| activeReaders > 0\n \t\t|| (bias == 'R' && readersQueue.isEmpty() == false)) {\n \ttry {\n\t\t\t\twait();\n\t\t\t} catch (InterruptedException e) {\n\t\t\t\tSystem.out.println(e.getMessage());\n\t\t\t}\n }\n\n // Its my turn, remove myself from queue\n writersQueue.deq();\n\n // DEBUG\n if (activeWriter == true\n \t\t|| activeReaders > 0\n \t\t|| (bias == 'R' && readersQueue.isEmpty() == false)) {\n \tSystem.out.println(\"BUG IN WRITER\");\n }\n\n // I am now an active writer!\n activeWriter = true;\n\t}", "public boolean writerTryLock() {\n final Thread current = Thread.currentThread();\n // already held by the current thread\n if ((holder.get() instanceof Writer) && (holder.get().thread == current)) {\n throw new IllegalStateException();\n }\n else if (holder.compareAndSet(null, new Writer(current))) return true;\n return false;\n }", "private void createTotalTime(BufferedWriter writer) throws IOException {\r\n\t\tMap<String, String> dataMap = data.getTotalTime();\r\n\t\tString parent = \"<div style='width: 260px;background-color: #FFFFFF;box-shadow: 1px 1px 1px #888888;height: 85px;position: absolute;top: 67px;left: 281px;'>\";\r\n\t\tString subChild = \"<label style='position: absolute;margin-top: 5px;'>\";\r\n\t\tString totalTimeLabel = \"<span style='font-weight: bold;color: #000000;padding-left: 8px;font-family: Roboto, sans-serif;'>Total Time</span></label>\";\r\n\t\tString subChild1 = \"<label style='margin-top: 57px;position: absolute;'>\";\r\n\t\tString totatlTime = \"<span style='font-weight: bold;color: #000000;padding-left: 8px;font-family: Roboto, sans-serif;'>\"\r\n\t\t\t\t+ dataMap.get(\"total-time\") + \"</span></label></div>\";\r\n\t\twriter.write(parent + subChild + totalTimeLabel + subChild1\r\n\t\t\t\t+ totatlTime);\r\n\r\n\t\tString startTimePanel = \"<div style='width: 260px;background-color: #00E676;box-shadow: 1px 1px 1px #888888;height: 85px;position: absolute;top: 67px;left: 554px;'>\";\r\n\t\tString labelTime = \"<label style='position: absolute;margin-left: 8px;'>\";\r\n\t\tString startTimeLabel = \"<span style='font-weight: bold;color: gray;padding-top: 3px;font-family: Roboto, sans-serif;'>Start Time</span></label>\";\r\n\t\tString timeContainer = \"<label style='position: absolute;margin-top: 58px;padding-left: 118px;font-weight: bold;color: white;'><span style='font-family: Roboto, sans-serif;font-size:smaller'>\";\r\n\t\tString startTime = dataMap.get(\"start-time\") + \"</span></label></div>\";\r\n\t\twriter.write(startTimePanel + labelTime + startTimeLabel\r\n\t\t\t\t+ timeContainer + startTime);\r\n\r\n\t\tString endTimePanel = \"<div style='width: 260px;background-color: #F44336;box-shadow: 1px 1px 1px #888888;height: 85px;position: absolute;top: 67px;left: 828px;'>\";\r\n\t\tString endlabelTime = \"<label style='position: absolute;margin-left: 8px;'>\";\r\n\t\tString endTimeLabel = \"<span style='font-weight: bold;color: gray;padding-top: 3px;font-family: Roboto, sans-serif;'>End Time</span></label>\";\r\n\t\tString endTimeContainer = \"<label style='position: absolute;margin-top: 58px;padding-left: 118px; font-weight: bold;color: white;'><span style='font-family: Roboto, sans-serif;font-size:smaller'>\";\r\n\t\tString endTime = dataMap.get(\"end-time\") + \"</span></label></div>\";\r\n\t\twriter.write(endTimePanel + endlabelTime + endTimeLabel\r\n\t\t\t\t+ endTimeContainer + endTime);\r\n\r\n\t}", "public void enemyCreator() { // Creates enemies\n \tif(createFrame >= createTime) {\n \t\tfor(int i = 0; i < enemies.length; i++) {\n \t\t\tif(!enemies[i].isAlive) { // If the enemy is no longer alive\n \t\t\t\tenemies[i].Create(0); // Create a new one\n \t\t\t\tbreak;\n \t\t\t} \t\t\t\t\n \t\t}\n \t\tcreateFrame = 0;\n \t}\n \telse\n \t\tcreateFrame += 1;\n \t\n \tif(killCount == 10){ // Every ten enemies\n \t\tkillCount = 0;\n \t\tif(createTime > 700)\n \t\t\tcreateTime -= 275; // Increase spawn rate\n \t\t\n \t\tif(Enemy.moveSpeed > 8)\t\n \t\t\t\tEnemy.moveSpeed -= 2; // Increase enemy movement speed\n \t\tif(killed > 100)\n \t\t\tBlock.healthTime += 25; // Increase enemy health\n \t\telse if(killed > 200)\n \t\t\tBlock.healthTime += 30;\n \t\telse\n \t\t\tBlock.healthTime += 20;\n \t}\n }", "boolean isUsedForWriting();", "public interface BackPressuredWriteStream<T> extends WriteStream<T> {\n\n static <T> BackPressuredWriteStream create(Handler<T> writeHandler) {\n return new BackPressuredWriteStreamImpl<T>(writeHandler);\n }\n\n static <T> BackPressuredWriteStream createThrottled(Handler<T> writeHandler, long quotaPeriod, int quota, String persistentQuotaTimeFile, Vertx vertx) {\n return new ThrottleStreamImpl(writeHandler, quotaPeriod, quota, persistentQuotaTimeFile, vertx);\n }\n\n void drop();\n\n long getQueueSize();\n}", "boolean getHasWriteBehindWriter();", "public Counter() {\n //this.max = max;\n }", "public SocketChannelConfig setWriteSpinCount(int writeSpinCount)\r\n/* 308: */ {\r\n/* 309:298 */ super.setWriteSpinCount(writeSpinCount);\r\n/* 310:299 */ return this;\r\n/* 311: */ }", "public void testCreateProxy() throws Exception {\n XMLStreamWriter result = openFilteredWriter(new StringWriter(), factory);\n\n assertNotNull(result);\n }", "protected void setQWForFiles(Writer writer)\r\n\t{\r\n\t\tqw = new CountingQuietWriter(writer, errorHandler);\r\n\t}", "public TesterPSO() {\n\t\tlogWriter = new Writer();\n\t\tMAX_RUN = 50;\n\t\truntimes = new long[MAX_RUN];\n\t}", "@Test(timeout = 4000)\n public void test00() throws Throwable {\n ClassWriter classWriter0 = new ClassWriter(964);\n classWriter0.index = (-15);\n FieldWriter fieldWriter0 = new FieldWriter(classWriter0, (-15), \"O8\", \"O8\", \"O8\", \"O8\");\n ByteVector byteVector0 = classWriter0.pool;\n fieldWriter0.put(byteVector0);\n }", "public void purgeQueueAndPersist() {\n // Return if the writer is not enabled.\n if (PerformanceAnalyzerConfigAction.getInstance() == null) {\n return;\n } else if (!controller.isPerformanceAnalyzerEnabled()) {\n // If PA is disabled, then we return as we don't want to generate\n // new files. But we also want to drain the queue so that when it is\n // enabled next, we don't have the current elements as they would be\n // old.\n if (PerformanceAnalyzerMetrics.metricQueue.size() > 0) {\n List<Event> metrics = new ArrayList<>();\n PerformanceAnalyzerMetrics.metricQueue.drainTo(metrics);\n LOG.info(\n \"Performance Analyzer no longer enabled. Drained the\"\n + \"queue to remove stale data.\");\n }\n return;\n }\n\n LOG.debug(\"Starting to purge the queue.\");\n List<Event> metrics = new ArrayList<>();\n PerformanceAnalyzerMetrics.metricQueue.drainTo(metrics);\n LOG.debug(\"Queue draining successful.\");\n\n long currentTimeMillis = System.currentTimeMillis();\n\n // Calculate the timestamp on the file. For example, lets say the\n // purging started at time 12.5 then all the events between 5-10\n // are written to a file with name 5.\n long timeBucket =\n PerformanceAnalyzerMetrics.getTimeInterval(\n currentTimeMillis, MetricsConfiguration.SAMPLING_INTERVAL)\n - MetricsConfiguration.SAMPLING_INTERVAL;\n\n // When we are trying to collect the metrics for the 5th-10th second,\n // but doing that in the 12.5th second, there is a chance that a\n // collector ran in the 11th second and pushed the metrics in the\n // queue. This thread, should be able to filter them and write them\n // to their appropriate file, which should be 10 and not 5.\n long nextTimeBucket = timeBucket + MetricsConfiguration.SAMPLING_INTERVAL;\n\n List<Event> currMetrics = new ArrayList<>();\n List<Event> nextMetrics = new ArrayList<>();\n\n for (Event entry : metrics) {\n if (entry.epoch == timeBucket) {\n currMetrics.add(entry);\n } else if (entry.epoch == nextTimeBucket) {\n nextMetrics.add(entry);\n } else {\n // increment stale_metrics count when metrics to be collected is falling behind the\n // current bucket\n PerformanceAnalyzerApp.WRITER_METRICS_AGGREGATOR.updateStat(\n WriterMetrics.STALE_METRICS, \"\", 1);\n }\n }\n\n LOG.debug(\"Start serializing and writing to file.\");\n writeAndRotate(currMetrics, timeBucket, currentTimeMillis);\n if (!nextMetrics.isEmpty()) {\n // The next bucket metrics don't need to be considered for\n // rotation just yet. So, we just write them to the\n // <nextTimeBucket>.tmp\n eventLogFileHandler.writeTmpFile(nextMetrics, nextTimeBucket);\n }\n LOG.debug(\"Writing to disk complete.\");\n }", "public Builder clearMaxCount() {\n bitField0_ = (bitField0_ & ~0x00000002);\n maxCount_ = 0;\n onChanged();\n return this;\n }", "public IndexWriter getIndexWriter(boolean create) throws IOException {\n // Followed online tutorial\n if(indexWriter == null) {\n try {\n // Make sure and store to /var/lib/lucene/ per the spec\n Directory indexDir = FSDirectory.open(new File(\"/var/lib/lucene/index1\"));\n IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_4_10_2, new StandardAnalyzer());\n indexWriter = new IndexWriter(indexDir, config);\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return indexWriter;\n }", "public synchronized static FASTAWriter getFASTAWriter(String filename) {\r\n // get the appropriate factory\r\n FASTAWriterFactory factory = (FASTAWriterFactory) getFASTAWriterFactory(filename);\r\n // return null if none exist\r\n if (factory == null) {\r\n return null;\r\n }\r\n \r\n // make the reader\r\n FASTAWriter writer = factory.newInstance(filename);\r\n \r\n // return a new FASTAReader instance\r\n return writer;\r\n }", "public WstxOutputFactory() {\n mConfig = WriterConfig.createFullDefaults();\n }", "public DuplicatorExecutor(final Studio studio, \n final DisplayWindow theWindow, \n final String newName, \n final Map<String, Integer> mins,\n final Map<String, Integer> maxes,\n final LinkedHashMap<String, Boolean> channels,\n final Datastore.SaveMode saveMode,\n final String filePath) {\n\n studio_ = studio;\n theWindow_ = theWindow;\n newName_ = newName;\n mins_ = mins;\n maxes_ = maxes;\n channels_ = channels;\n saveMode_ = saveMode;\n filePath_ = filePath;\n }", "@Override\n\tpublic void setWriteQueueMaxSize(int maxSize) {\n\t\t\n\t}", "public void enableWriter(boolean enabled) {\n this.useWriter = enabled;\n }", "@Override\n public void setMaxWriteSize(int maxWriteSize) {\n mMaxWriteSize = maxWriteSize;\n }", "CompressingMessageWriter(MessageWriter wr) {\n this.writer = wr;\n }", "public void honourFreeBufferCount() {\n // Check if there are enough free launchers\n int freeCount = getFreeLaunchers().size();\n\n while (freeCount < freeBufferCount) {\n if (getTotalLaunchers().size() > maxCount) {\n log.warn(\"Specified Maximum Concurrency has been exceeded, but scaling up will be permitted. If this \" +\n \"message appears often increase maximum concurrency.\");\n }\n\n log.info(\"Scaling UP: REASON -> [Free Count] \" + freeCount + \" < [Free Gap] \" + freeBufferCount);\n scaleUp(\"honourFreeBufferCount\");\n freeCount = getFreeLaunchers().size();\n }\n }", "public void reopen() throws IOException {\r\n writer.close();\r\n writer = new BufferedWriter(new java.io.FileWriter(file));\r\n }", "protected void timerTask() {\n // Oldest time to allow\n final long oldestTime = System.currentTimeMillis() - 3480000;\n \n synchronized (openFiles) {\n final Collection<String> old = new ArrayList<>(openFiles.size());\n for (Map.Entry<String, OpenFile> entry : openFiles.entrySet()) {\n if (entry.getValue().lastUsedTime < oldestTime) {\n StreamUtils.close(entry.getValue().writer);\n old.add(entry.getKey());\n }\n }\n \n openFiles.keySet().removeAll(old);\n }\n }", "private IndexWriter getIndexWriter() throws IOException {\n\n\t\tAnalyzer a = getAnaLyzer();\n\n\t\tif (idxWriter == null) {\n\n\t\t\tindexPath = this.analyzer + \" index-directory\";\n\t\t\tDirectory indexDir = FSDirectory.open(Paths.get(indexPath));\n\t\t\tIndexWriterConfig config = new IndexWriterConfig(a);\n\n\t\t\tconfig.setOpenMode(OpenMode.CREATE);\n\n\t\t\tidxWriter = new IndexWriter(indexDir, config);\n\t\t}\n\n\t\treturn idxWriter;\n\t}", "public Writer getWriter(String cliParameter) {\n Writer writer = null;\n if(\"csv\".equals(cliParameter)){\n writer = new WriterCSV();\n }\n \n return writer;\n }", "long getWriterQueueLength();", "public boolean shouldNotWrite(final Object instance, final ObjectStreamWriter writer)\n {\n Objects.requireNonNull(instance);\n Objects.requireNonNull(writer);\n String id = registry.get(instance);\n if (id != null)\n {\n //if already exists then write the id and stop\n writer.writeObject(id);\n return true;\n }\n //else create an id, write it, and continue writing the object\n id = UUID.randomUUID().toString();\n registry.put(instance, id);\n writer.writeObject(id);\n return false;\n }", "public FileHandler createRollingLogHandler ( String \tfileName\r\n\t\t\t\t\t\t\t\t\t\t\t\t, int \t\tlimitFileSize\r\n\t\t\t\t\t\t\t\t\t\t\t\t, int \t\tmaximumFileNumbers\r\n\t\t\t\t\t\t\t\t\t\t\t\t, boolean\tappend\r\n\t\t\t\t\t\t\t\t\t\t\t\t) {\r\n\t\t\r\n\t\tFileHandler logHandler = null;\r\n\t\t\r\n\t try {\r\n\t \t\r\n logHandler = new FileHandler(fileName, limitFileSize, maximumFileNumbers, append);\r\n\t\t\t\r\n\t\t} catch (SecurityException | IOException e) {\r\n\t\t\t\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t \r\n\t return logHandler;\r\n\t}", "private int createAndAddLobby(int maxPlayers, String lobbyName, int trackID){\n\n\t\tDebugOutputHandler.printDebug(\"A new Lobby has been created\");\n\t\tLobby newLobby = new Lobby(++lobbyIdCounter, maxPlayers, lobbyName, trackID, this);\n\t\tif(lobbyMap.get(lobbyIdCounter) == null){\n\t\t\tlobbyMap.put(lobbyIdCounter, newLobby);\n\t\t\treturn lobbyIdCounter;\n\t\t}else{\n\t\t\treturn -1;\n\t\t}\n\t}", "private TimeSeries initMovingTimeSeries(int maxBarCount) {\n //TimeSeries series = CsvTradesLoader.loadBitstampSeries();\n //TimeSeries series = CsvTicksLoader.load(\"EURUSD_Daily_201701020000_201712290000.csv\");\n //TimeSeries series = CsvTicksLoader.load(\"2019_D.csv\");\n\n TimeSeries series = new BaseTimeSeries(selected.getPeriod().getName());\n\n for (PeriodBar periodBar : selected.getPeriod().getBars()) {\n ZonedDateTime time = periodBar.getEndTime();\n double open = periodBar.getOpenPrice().doubleValue();\n double close = periodBar.getClosePrice().doubleValue();\n double max = periodBar.getMaxPrice().doubleValue();\n double min = periodBar.getMinPrice().doubleValue();\n double vol = periodBar.getVolume().doubleValue();\n\n series.addBar(new BaseBar(time, open, max, min, close, vol));\n }\n\n System.out.print(\"Initial bar count: \" + series.getBarCount());\n // Limitating the number of bars to maxBarCount\n series.setMaximumBarCount(maxBarCount);\n LAST_BAR_CLOSE_PRICE = series.getBar(series.getEndIndex()).getClosePrice();\n System.out.println(\" (limited to \" + maxBarCount + \"), close price = \" + LAST_BAR_CLOSE_PRICE);\n\n //live = CsvTicksLoader.load(\"2020_D.csv\");\n //live = CsvTicksLoader.load(\"2020_D.csv\");\n\n live = new BaseTimeSeries(selected.getName());\n\n for (ForwardTestBar forwardTestBar : selected.getBars()) {\n ZonedDateTime time = forwardTestBar.getEndTime();\n double open = forwardTestBar.getOpenPrice().doubleValue();\n double close = forwardTestBar.getClosePrice().doubleValue();\n double max = forwardTestBar.getMaxPrice().doubleValue();\n double min = forwardTestBar.getMinPrice().doubleValue();\n double vol = forwardTestBar.getVolume().doubleValue();\n\n live.addBar(new BaseBar(time, open, max, min, close, vol));\n }\n\n return series;\n }", "MyConsumer(BlockingQueue<Integer> sharedBuffer,Integer bufferSize,Integer waitingPeriodMin,Integer waitingPeriodMax,Integer terminationTime,String fileName){\r\n\t\tthis.sharedBuffer = sharedBuffer;\r\n\t\tthis.bufferSize=bufferSize;\r\n\t\tthis.waitingPeriodMin=waitingPeriodMin;\r\n\t\tthis.waitingPeriodMax= waitingPeriodMax;\r\n\t\tthis.terminationTime=terminationTime;\r\n\t\trandom = new Random();\r\n\t\ttry{\r\n\t\t\t File outFile = new File(fileName);\r\n\t\t\t outStream = new PrintStream(new FileOutputStream(outFile));\r\n\t\t\t}catch(Exception e){\r\n\t\t\t\t\r\n\t\t\t}\r\n\t }", "private static BufferedWriter createFileWriter(String filePath) {\n String[] pathComponents = filePath.split(\"/data/\");\n //to avoid heavy nesting in output, replace nested directory with filenames\n\n String output = pathComponents[0] + \"/out/rule_comparisons/\" + pathComponents[1].replace(\"/\",\"-\");\n\n File file = new File(output);\n try {\n //create file in this location if one does not exist\n if (!file.exists()) {\n file.createNewFile();\n }\n return new BufferedWriter(new FileWriter(file));\n } catch (IOException e) {\n e.printStackTrace();\n }\n return null;\n }", "private WriteCheckpointPages(\n final CheckpointMetricsTracker tracker,\n final Collection<FullPageId> writePageIds,\n final ConcurrentLinkedHashMap<PageStore, LongAdder> updStores,\n final CountDownFuture doneFut,\n final int totalPagesToWrite,\n final Runnable beforePageWrite,\n final ExecutorService retryWriteExecutor\n ) {\n this.tracker = tracker;\n this.writePageIds = writePageIds;\n this.updStores = updStores;\n this.doneFut = doneFut;\n this.totalPagesToWrite = totalPagesToWrite;\n this.beforePageWrite = beforePageWrite;\n this.retryWriteExecutor = retryWriteExecutor;\n }", "private void createWaveTimer()\n\t{\n\t\twaveTimer = new WaveTimer(\n\t\t\t\titemManager.getImage(INFERNAL_CAPE),\n\t\t\t\tthis,\n\t\t\t\tInstant.now().minus(Duration.ofSeconds(6)),\n\t\t\t\tnull\n\t\t);\n\t\tif (config.waveTimer())\n\t\t{\n\t\t\tinfoBoxManager.addInfoBox(waveTimer);\n\t\t}\n\t}", "@Test(timeout = 4000)\n public void test15() throws Throwable {\n ClassWriter classWriter0 = new ClassWriter(11);\n FieldWriter fieldWriter0 = new FieldWriter(classWriter0, 11, \"\", \"\", \"\", (Object) null);\n ByteVector byteVector0 = classWriter0.pool;\n fieldWriter0.put(byteVector0);\n }", "public HoldingQueue(int maxSize) {\n this.maxSize = maxSize;\n holdingQueue = new ArrayList<Person>(maxSize);\n numPeople = 0;\n }", "public WriterOptions bufferSize(int value) {\n bufferSizeValue = value;\n return this;\n }", "@Test\n public void testWriteElements() {\n Random rnd = new Random();\n ReadablePeriod ObjectToWrite = new MutablePeriod(1+rnd.nextInt(12),rnd.nextInt(60),rnd.nextInt(60),rnd.nextInt(1000));\n ReadablePeriodXMLWriter instance = new ReadablePeriodXMLWriter();\n Element tempElement = instance.writeElements(ObjectToWrite);\n ReadablePeriod result = instance.readElements(tempElement);\n assertEquals(ObjectToWrite, result);\n }", "protected void closeNotSuccessful() {\n\t\tthis.writer.deblockQueue();\n\t}", "@Test(timeout = 4000)\n public void test19() throws Throwable {\n ClassWriter classWriter0 = new ClassWriter(5679);\n FieldWriter fieldWriter0 = new FieldWriter(classWriter0, 642, \"of)xo*\", \"g)_Yx/_KT\", \"X\", \"g)_Yx/_KT\");\n fieldWriter0.visitEnd();\n }", "public LimitBuilder limit() {\n return memory.limit();\n }" ]
[ "0.5059046", "0.4805242", "0.48026943", "0.47889194", "0.47687423", "0.4715992", "0.4697263", "0.4674428", "0.46694303", "0.46586788", "0.46570396", "0.46440744", "0.46345782", "0.46235335", "0.4586648", "0.4581302", "0.45731205", "0.45696533", "0.4552665", "0.45503682", "0.45436224", "0.45399234", "0.45147973", "0.4498931", "0.4479318", "0.4472484", "0.4457425", "0.44515714", "0.44425562", "0.44275638", "0.44090867", "0.4386505", "0.4377265", "0.43752936", "0.43430233", "0.43409878", "0.43324623", "0.43291283", "0.43199736", "0.4317781", "0.43163392", "0.43004304", "0.43002266", "0.4295662", "0.42944694", "0.42832783", "0.42796868", "0.42708272", "0.42677143", "0.4259648", "0.42452177", "0.42424035", "0.4215093", "0.41887903", "0.41829813", "0.41817474", "0.41677627", "0.41674992", "0.41623917", "0.41592866", "0.41530964", "0.41455698", "0.41441566", "0.41388416", "0.41387558", "0.41373757", "0.41370857", "0.4136144", "0.4129668", "0.41287863", "0.4126183", "0.4121913", "0.4115075", "0.41060087", "0.4103633", "0.4098225", "0.40710554", "0.40709665", "0.406772", "0.4066257", "0.40525374", "0.4044985", "0.40421107", "0.40404326", "0.4035584", "0.40344915", "0.40322366", "0.40241522", "0.40238208", "0.40218657", "0.40148634", "0.40136215", "0.40118682", "0.40088072", "0.40079945", "0.40060517", "0.4004621", "0.40025535", "0.3999441", "0.39984423" ]
0.7595621
0
Discard a previouslyused writer, cleanly closing it and leaving it out of the pool.
public synchronized void destroyWriter(WriterPoolMember writer) throws IOException { currentActive--; writer.close(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected void closeNotSuccessful() {\n\t\tthis.writer.deblockQueue();\n\t}", "public void discardContent() {\n dispose();\n }", "public void close(){\r\n\t\tif (this.fileWriter != null){\r\n\t\t\ttry {\r\n\t\t\t\tthis.fileWriter.flush();\r\n\t\t\t\tthis.fileWriter.close();\r\n\t\t\t\tthis.fileWriter = null;\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\tlogger.error(\"Cannot close the file handle \"+this.myfilename+\". Your results might be lost. Cause: \"+e.getMessage());\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\r\n\t\t}\r\n\t}", "protected void discard() {\r\n discarded = true;\r\n onDiscard();\r\n }", "public void closeWriter () {\n try {\n writer.close();\n indexDir.close();\n indexHandler = null;\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "public void discard();", "@Override\n public void destroy() {\n if (fileWriter != null) {\n try {\n fileWriter.close();\n } catch (IOException e) {\n }\n }\n }", "public synchronized void dropReaders() throws IOException {\n\t\tif (mReader != null) {\n\t\t\tmReader.decreaseRef();\n\t\t\tmReader = null;\n\t\t}\n\t\tif (mMergeReader != null) {\n\t\t\tmMergeReader.decreaseRef();\n\t\t\tmMergeReader = null;\n\t\t}\n\t\tdecreaseRef();\n\t}", "public void discard() {\n }", "@Override\r\n\tpublic void discard(Resources toDiscard) {\n\t\t\r\n\t}", "public void returnFile(WriterPoolMember writer)\n throws IOException {\n synchronized(this) {\n if(writer.isOversize()) {\n // maybe retire writer rather than recycle\n if(lastWriterNeededTime<=lastWriterRolloverTime) {\n // no timeouts waiting for recycled writer since last writer rollover\n destroyWriter(writer);\n return;\n } else {\n // reuse writer instance, causing new file to be created\n lastWriterRolloverTime = System.currentTimeMillis();\n }\n }\n }\n if(!availableWriters.offer(writer)) {\n logger.log(Level.WARNING, \"writer unreturnable to available pool; closing early\");\n destroyWriter(writer); \n }\n }", "public void drain() {\n\t\tsynchronized (list) {\n\t\t\tfor (int i = 0; i < list.size(); ++i) {\n\t\t\t\tPooled<T> pt = list.remove();\n\t\t\t\tcreator.destroy(pt.content);\n\t\t\t\tpt.logTarget.log(\"Pool drained \", creator.toString());\n\t\t\t}\n\t\t\tcount = spares = 0;\n\t\t}\n\n\t}", "void close(boolean evictOnClose) throws IOException;", "protected final void close()\n {\n try {\n _reader.close();\n _reader = null;\n } catch ( IOException except ) { }\n }", "private void disconnect() {\n if (readerThread != null)\n readerThread.kill();\n if (writerThread != null)\n writerThread.kill();\n if (nonblockReader != null) {\n nonblockReader.close();\n }\n isConnected = false;\n }", "public void reopen() throws IOException {\r\n writer.close();\r\n writer = new BufferedWriter(new java.io.FileWriter(file));\r\n }", "public void close() {\n this.output = null;\n }", "public void dispose() {\n\t\twhile(unackHead != null) {\n\t\t\tcancel(unackHead);\n\t\t\tunackHead = unackHead.next;\n\t\t}\n\t\tif(curChunker != null)\n\t\t\tcurChunker.dispose();\n\t}", "void drain() {\n if (stdOutReader != null) {\n stdOutReader.drain();\n }\n if (stdErrReader != null) {\n stdErrReader.drain();\n }\n }", "public void close() throws IOException {\r\n reader.close();\r\n reader = null;\r\n }", "void discard();", "void discard();", "@Override\n public void release() {\n output = null;\n super.release();\n }", "public static void cleanResources() {\n\t\tscanner.close();\n\t\treturn;\n\t}", "@Override\n public void dispose() {\n file = null;\n }", "public void disconnect() {\n if (reader != null) {\n reader.stop();\n }\n\n }", "public void writerUnlock() throws Exception {\n\t\t// TODO\n\t\tif(holders.get() instanceof ReaderList){\n\t\t\tthrow new Exception(\"Lock was held by a reader, one should use readerUnlock()\");\n\t\t}else if(holders.get() == null){\n\t\t\tthrow new Exception(\"Lock was not held by anyone\");\n\t\t}\n\t\tfinal Thread current = Thread.currentThread();\n\t\tif(((Writer)holders.get()).thread.equals(current)){\n\t\t\tholders.compareAndSet(holders.get(), null);\n\t\t}else{\n\t\t\tthrow new Exception(\"Lock was not held by this thread \");\n\t\t}\n\t}", "@Override\r\n public void close() throws IOException {\r\n IOException ioException = null;\r\n for (WriterInfo writerInfo : mWriters) {\r\n try {\r\n Writer writer = writerInfo.getWriter();\r\n if (writerInfo.getOwned()) {\r\n writer.close();\r\n } else {\r\n writer.flush();\r\n }\r\n } catch(IOException ioex) {\r\n ioException = ioex;\r\n }\r\n }\r\n if (ioException != null) {\r\n throw ioException;\r\n }\r\n }", "public void shutdown() {\n try {\n this.writer.close();\n } catch (IOException e) {\n log.warn(i18n.getString(\"problemCloseOutput\", e), e);\n }\n }", "public void release()\r\n throws IOException\r\n {\r\n // nothing needs to be done\r\n }", "@Override\n protected synchronized void removeReader(ChannelHandlerReadSubscription subscription) {\n super.removeReader(subscription);\n }", "public void release() throws IOException;", "@Override\n public void dispose() {\n if (currentExpression != null) {\n getDirector().disconnectReadExpression(currentExpression);\n }\n currentExpression = null;\n }", "@Override\r\n\tpublic PrintWriter getWriter() throws IOException {\n\t\treturn null;\r\n\t}", "private void dispose() {\n\t\t\t\r\n\t\t\tif (TRACE) {\r\n\t\t\t\tSystem.out.println(\"Disposing thread \" + workerNo);\r\n\t\t\t}\r\n\t\t\tcontrolLock.lock();\r\n\t\t\ttry {\r\n\t\t\t\tthreads.remove(thread.getId());\r\n\t\t\t}\r\n\t\t\tfinally {\r\n\t\t\t\tcontrolLock.unlock();\r\n\t\t\t}\r\n\t\t}", "@Override\n\t\tpublic void unlock() {\n\n\t\t\tsynchronized (lock) {\n\t\t\t\twriters--;\n\t\t\t\tlock.notifyAll();\n\t\t\t}\n\t\t}", "private void close() {\n\t\t\tassert this.sendLock.writeLock().isHeldByCurrentThread();\n\t\t\tthis.dead = true;\n\t\t\tStoreRequest s = writesByRows.remove(this.row);\n\t\t\t// This request was THE only request for its row\n\t\t\tassert this == s;\n\t\t\tlogger.fine(this.toString() + \" sent on \" + new Date(System.currentTimeMillis()) + \" and not replanned\");\n\t\t}", "public void dispose()\n {\n while( m_count > 0 )\n {\n int i = m_count - 1;\n try\n {\n m_factory.decommission( m_pool[ i ] );\n }\n catch( Exception e )\n {\n // To be backwards compatible, we have to support the logger having not been set.\n if( ( getLogger() != null ) && ( getLogger().isDebugEnabled() ) )\n {\n getLogger().debug( \"Error decommissioning object\", e );\n }\n }\n m_pool[ i ] = null;\n m_count--;\n }\n }", "public void resetWriter() {\n\t\tinit();\n\t}", "public void purge() {\n\t\tIterator<T> it = iterator();\n\t\twhile (it.hasNext()) {\n\t\t\tit.next();\n\t\t}\n\t}", "@Override\n protected synchronized void removeWrite(ChannelHandlerWriteSubscription subscription) {\n super.removeWrite(subscription);\n }", "public synchronized void close() throws IOException {\n\t\tif (journalWriter == null) {\n\t\t\treturn; // already closed\n\t\t}\n\t\tfor (Entry entry : new ArrayList<Entry>(lruEntries.values())) {\n\t\t\tif (entry.currentEditor != null) {\n\t\t\t\tentry.currentEditor.abort();\n\t\t\t}\n\t\t}\n\t\ttrimToSize();\n\t\tjournalWriter.close();\n\t\tjournalWriter = null;\n\t}", "@Override\n\tprotected void cleanup(Reducer<LongWritable, Text, Text, Text>.Context context)\n\t\t\tthrows IOException, InterruptedException {\n\t\tsuper.cleanup(context);\n\t\toutput.close();\n\t}", "public synchronized void discardPage(PageId pid) {\n // some code goes here\n // only necessary for lab5\n bufferPool.remove(pid);\n }", "public static void writeDontCloseStream(Element document,Writer writerW) throws IOException\r\n {\n XMLWriter writer = new XMLWriter(writerW);\r\n writer.write( document );\r\n }", "public void removeAllTextWriter() {\r\n\t\tBase.removeAll(this.model, this.getResource(), TEXTWRITER);\r\n\t}", "public void removeAllOriginalTextWriter() {\r\n\t\tBase.removeAll(this.model, this.getResource(), ORIGINALTEXTWRITER);\r\n\t}", "protected void close() {\n\t\tthis.writer.stop();\n\t\tsynchronized (this.writer.writer) {\n\t\t\twhile (!this.writer.isFinished()) {\n\t\t\t\ttry {\n\t\t\t\t\tthis.writer.writer.wait();\n\t\t\t\t}\n\t\t\t\tcatch (InterruptedException e) {\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\ttry {\n\t\t\tthis.btc.close();\n\t\t}\n\t\tcatch (IOException e) {\n\t\t}\n\n\t\tthis.closed = true;\n\t}", "public void dispose() {\n processDispose(false);\n }", "@Override\n\t\tpublic void close() {\n\t\t\ttplItr = null;\n\t\t}", "public void cleanup() {\n this.close();\n this.delete(this.backingFileBasename + RECORDING_OUTPUT_STREAM_SUFFIX);\n this.delete(this.backingFileBasename + RECORDING_INPUT_STREAM_SUFFIX);\n }", "public void closeWriter() throws IOException{\n if(isOpen){\n dataWriter.close();\n }\n }", "void drainFused() {\n int n;\n int n2 = 1;\n Subscriber<T> subscriber = this.actual;\n SimpleQueueWithConsumerIndex<Object> simpleQueueWithConsumerIndex = this.queue;\n do {\n if (this.cancelled) {\n simpleQueueWithConsumerIndex.clear();\n return;\n }\n Throwable throwable = (Throwable)this.error.get();\n if (throwable != null) {\n simpleQueueWithConsumerIndex.clear();\n subscriber.onError(throwable);\n return;\n }\n n = simpleQueueWithConsumerIndex.producerIndex() == this.sourceCount ? 1 : 0;\n if (!simpleQueueWithConsumerIndex.isEmpty()) {\n subscriber.onNext(null);\n }\n if (n != 0) {\n subscriber.onComplete();\n return;\n }\n n2 = n = this.addAndGet(-n2);\n } while (n != 0);\n }", "@Override\n protected final void deallocate() {\n ByteBuf wrapped = unwrap();\n recyclerHandle.recycle(this);\n wrapped.release();\n }", "public void close() throws IOException\n {\n writer.close();\n }", "public ByteBuf discardReadBytes()\r\n/* 107: */ {\r\n/* 108:124 */ recordLeakNonRefCountingOperation(this.leak);\r\n/* 109:125 */ return super.discardReadBytes();\r\n/* 110: */ }", "public void unlock() {\n try {\n if (lock != null)\n lock.release();\n if (channel != null)\n channel.close();\n }\n catch (Exception e) {\n throw new ReviewedStingException(\"An error occurred while unlocking file\", e);\n }\n }", "public void close() throws IOException {\r\n writer.close();\r\n }", "@Override\n public void cleanup() throws Exception {\n outputStream.close();\n }", "public void deallocate() {\n\tsetLoaded(false);\n\n if (!externalAudioPlayer) {\n if (audioPlayer != null) {\n audioPlayer.close();\n audioPlayer = null;\n }\n }\n \n\tif (!externalOutputQueue) {\n\t outputQueue.close();\n\t}\n }", "public void close(){\n\t\ttry {\n\t\t\tout.close();\n\t\t\tout = null;\n\t\t}\n\t\tcatch (IOException e){\n\t\t\tSystem.out.println(\"Problem closing file.\");\n\t\t\tSystem.exit(0);\n\t\t}\n\t}", "private void cleanup(InputStream in) {\n try {\n if (reader != null)\n reader.close();\n if (in != null)\n in.close();\n reader = null;\n }\n catch (Exception ex) {\n // ignore!\n }\n }", "public final void dispose() {\n lock.writeLock().lock();\n try {\n if (available) {\n available = false;\n _dispose();\n }\n } finally {\n lock.writeLock().unlock();\n }\n }", "public void discard() {\r\n\t\tif(this.markedStack.isEmpty()) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis.markedStack.removeLast();\r\n\t}", "public void toss() {\n\t\t\tif (pool != null) {\n\t\t\t\tpool.creator.destroy(content);\n\t\t\t}\n\t\t\t// Don't allow finalize to put it back in.\n\t\t\tpool = null;\n\t\t}", "private void close() {\n try {\n if (reader != null) {\n this.reader.close();\n }\n if (writer != null) {\n this.writer.close();\n }\n }\n catch (IOException e) {\n log.error(e);\n log.debug(Constants.STREAM_IS_CLOSED);\n }\n }", "private static void j_unlock() {\r\n\t\tFileChannel channel = globalFileChannel;\r\n\t\tFileLock lock = globalFileLock;\r\n\t\tglobalFileChannel = null;\r\n\t\tglobalFileLock = null;\r\n\t\ttry {\r\n\t\t\tlock.release();\r\n\t\t} catch (Throwable t) {\r\n\t\t\t;\r\n\t\t}\r\n\t\ttry {\r\n\t\t\tchannel.close();\r\n\t\t} catch (Throwable t) {\r\n\t\t\t;\r\n\t\t}\r\n\t}", "public WriterProxy removeMatchedWriter(PublicationData writerData) {\r\n\t\tlogger.debug(\"[{}] Removing matchedWriter {}\", getEntityId(), writerData.getBuiltinTopicKey());\r\n\t\tWriterProxy proxy = writerProxies.remove(writerData.getBuiltinTopicKey());\r\n\r\n\t\treturn proxy;\r\n\t}", "@Override\n public void remove() throws IOException {\n try {\n if (connection != null) {\n connection.close(session);\n }\n connection = null;\n session = null;\n } catch (Exception ex) {\n throw new IOException(ex);\n }\n }", "public static void close( Writer writer )\n {\n if ( writer != null )\n {\n try\n {\n writer.close();\n }\n catch ( IOException e )\n {\n log.error( \"Error closing writer: \" + writer, e );\n }\n }\n }", "@TestMethod(\"testClose\")\n public void close() throws IOException {\n writer.close();\n }", "public void deleteCurrWorker() {\n this.currWorker = null;\n }", "synchronized public void rdlock() {\n\t\tlong tid = Thread.currentThread().getId();\n\n\t\t// Place myself on queue\n\t\treadersQueue.enq(tid);\n\n\t\t// While its not my turn, wait\n\t\twhile (readersQueue.getFirstItem() != tid\n\t\t\t\t|| activeWriter == true\n\t\t\t\t|| activeReaders >= maxReaders\n\t\t\t\t|| (bias == 'W' && writersQueue.isEmpty() == false)) {\n\t\t\ttry {\n\t\t\t\twait();\n\t\t\t} catch (InterruptedException e) {\n\t\t\t\tSystem.out.println(e.getMessage());\n\t\t\t}\n\t\t}\n\n\t\t// Its my turn, remove myself from queue\n\t\treadersQueue.deq();\n\n\t\t// DEBUG\n if (activeWriter == true\n \t\t|| activeReaders >= maxReaders\n \t\t|| (bias == 'W' && writersQueue.isEmpty() == false)) {\n \tSystem.out.println(\"BUG IN READER\");\n }\n\n\t\t// I am now an active reader!\n\t\tactiveReaders++;\n\n\t\t// Signal all, so other readers may continue\n\t\tnotifyAll();\n\t}", "private synchronized void popBuffer() {\n IoBuffer buf = data.removeFirst();\n if(marked) {\n resetCache.push(buf);\n if(!data.isEmpty()) {\n data.getFirst().mark();\n }\n } else {\n buf.free();\n }\n }", "public void clear() throws FileQueueClosedException;", "public void forceClose()\n {\n if (_isClosed)\n return;\n \n _isClosed = true;\n \n if (log.isLoggable(Level.FINE))\n log.fine(\"closing pool \" + getName());\n }", "static void dispose() {\n for (final Writer w : logFiles.values()) {\n try {\n w.close();\n } catch (IOException ioe) {\n // don't care\n }\n }\n logFiles.clear();\n }", "private void removeClient(PrintWriter out) {\n\t\tsynchronized (clients) {\n\t\t\tclients.remove(out);\n\t\t}\n\t}", "private void cleanup() {\n if (mPosterBytes != null) {\n try {\n mPosterBytes.close();\n } catch (IOException ignored) {\n // Ignored.\n } finally {\n mPosterBytes = null;\n }\n }\n }", "private synchronized void removeStreams() {\n Iterator<Map.Entry<Query, Long>> it = sheduledRemovals.entrySet().iterator();\n\n while (it.hasNext()) {\n Map.Entry<Query, Long> entry = it.next();\n if (entry.getValue() < System.currentTimeMillis()) {\n it.remove();\n Closeable stream = streams.get(entry.getKey());\n try {\n stream.close();\n }catch (IOException e){\n // TweetStreams can not throw IO-Exceptions on close.\n // Nothing to do here\n }\n streams.remove(entry.getKey());\n counts.remove(entry.getKey());\n }\n }\n }", "public void flushBuffers()\n throws IOException\n {\n pool.moveToStart();\n Buffer buffer;\n while (pool.getValue() != null)\n {\n buffer = pool.remove();\n if (buffer.isDirty())\n {\n file.seek(buffer.getBlockNumber() * BLOCK_SIZE);\n file.write(buffer.readBlock());\n diskWrites++;\n }\n }\n }", "public void closeCSVStream() {\n\t\ttry {\n\t\t\twriter.close();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void finalize()\n\t{\n\t\tif (!isClosed) {\n\t\t\t// System.out.println(\"SimWriter: finalize() - writing closing bracket to file...\");\n\t\t\twList.writeToFile(\"\\n ]\", 0);\n\t\t\tisClosed = true;\n\t\t}\n\t\t//System.out.println(\"SimWriter: finalize() done\");\n\t}", "public void dispose() {\r\n // Remove from existing Customer render groups.\r\n leaveRenderGroups();\r\n }", "@Override\n public void dispose(){\n if(handle <= 0) return;\n free(handle);\n handle = 0;\n }", "protected synchronized void cleanup() {\n frameStorage.clear();\n if (frameIterator != null) {\n try {\n frameIterator.close();\n } catch (IOException ex) {\n logger.error(Thread.currentThread().getName() + \" IOException while closing the mediaReader\", ex);\n }\n }\n status = Status.STOPPED;\n frameIterator = null;\n }", "public void close() {\n\t\tif (taxonomyAccessor != null && taxonomyWriter != null) {\n\t\t\ttaxonomyAccessor.release(taxonomyWriter);\n\t\t}\n\t}", "public static void closeResources() {\n try {\n if (inputStream != null) {\n inputStream.close();\n }\n } catch (IOException ex) {\n ex.printStackTrace();\n }\n\n try {\n if (inputStreamReader != null) {\n inputStreamReader.close();\n }\n } catch (IOException ex) {\n ex.printStackTrace();\n }\n\n try {\n if (reader != null) {\n reader.close();\n }\n } catch (IOException ex) {\n ex.printStackTrace();\n }\n\n try {\n if (writer != null) {\n writer.close();\n }\n } catch (IOException ex) {\n ex.printStackTrace();\n }\n\n try {\n if (outputStream != null) {\n outputStream.close();\n }\n } catch (IOException ex) {\n ex.printStackTrace();\n }\n\n try {\n if (outputStreamWriter != null) {\n outputStreamWriter.close();\n }\n } catch (IOException ex) {\n ex.printStackTrace();\n }\n\n try {\n if (writer != null) {\n writer.close();\n }\n } catch (IOException ex) {\n ex.printStackTrace();\n }\n\n }", "@Override\r\n\tpublic void disconnect() throws IOException {\n\t\tif (this.mode.equals(\"r\")) {\r\n\t\t\tthis.scanner.close();\r\n\t\t} else {\r\n\t\t\tthis.writer.close();\r\n\t\t}\r\n\t}", "@Override public void close() throws IOException {\r\n\t\tif (closed) return;\r\n\t\tfor (Reader reader: readerQueue) {\r\n\t\t\treader.close();\r\n\t\t}\r\n\t\tclosed = true;\r\n\t}", "protected final void unlockWrite() {\n m_lock.writeLock().unlock();\n }", "public synchronized void closeAndRemoveAllOpenedReaders() throws IOException {\n Iterator<Map.Entry<String, TsFileSequenceReader>> iterator =\n closedFileReaderMap.entrySet().iterator();\n while (iterator.hasNext()) {\n Map.Entry<String, TsFileSequenceReader> entry = iterator.next();\n entry.getValue().close();\n if (resourceLogger.isDebugEnabled()) {\n resourceLogger.debug(\"{} closedTsFileReader is closed.\", entry.getKey());\n }\n closedReferenceMap.remove(entry.getKey());\n iterator.remove();\n }\n iterator = unclosedFileReaderMap.entrySet().iterator();\n while (iterator.hasNext()) {\n Map.Entry<String, TsFileSequenceReader> entry = iterator.next();\n entry.getValue().close();\n if (resourceLogger.isDebugEnabled()) {\n resourceLogger.debug(\"{} unclosedTsFileReader is closed.\", entry.getKey());\n }\n unclosedReferenceMap.remove(entry.getKey());\n iterator.remove();\n }\n }", "public void dispose() {\n Collection<File> values = compareFiles.values();\n for (File file : values) {\n file.delete();\n }\n\n compareFiles.clear();\n }", "public void close() throws IOException {\n\t\tin.close();\n \n\t\t// Release the buffer\n\t\tdataIn = null;\n\t\tbuffer = null;\n\t\tif(readRecordsCounter != null) {\n\t\t readRecordsCounter.increment(numRecordsRead);\n\t\t}\n\n\t\t// Return the decompressor\n\t\tif (decompressor != null) {\n\t\t decompressor.reset();\n\t\t CodecPool.returnDecompressor(decompressor);\n\t\t decompressor = null;\n\t\t}\n\t }", "@Override\n public void close() throws IOException {\n textArea = null;\n }", "@Override\n public void close() throws IOException\n {\n\n // do nothing\n }", "public void removeFileInstance()\n {\n this.source = null;\n this.data = null;\n }", "private void close() {\n/* */ try {\n/* 253 */ if (this.dataReader != null) {\n/* 254 */ this.dataReader.close();\n/* 255 */ this.dataReader = null;\n/* */ } \n/* 257 */ } catch (SQLException e) {\n/* 258 */ logger.log(Level.SEVERE, (String)null, e);\n/* */ } \n/* */ try {\n/* 261 */ if (this.pstmt != null) {\n/* 262 */ this.pstmt.close();\n/* 263 */ this.pstmt = null;\n/* */ } \n/* 265 */ } catch (SQLException e) {\n/* 266 */ logger.log(Level.SEVERE, (String)null, e);\n/* */ } \n/* */ }", "public void removeStreamManager(String name);", "@Override\n public void cleanup() {\n if (this.inputStream != null) {\n try {\n this.inputStream.close();\n }\n catch (IOException var1_1) {}\n }\n this.defaultFetcher.cleanup();\n }" ]
[ "0.6282742", "0.59018517", "0.5681156", "0.55712235", "0.556002", "0.5542687", "0.5542027", "0.55271864", "0.5516566", "0.5487935", "0.5472413", "0.54088813", "0.53036493", "0.52704734", "0.52516735", "0.5240701", "0.5240254", "0.522059", "0.5210335", "0.5197865", "0.51671046", "0.51671046", "0.5167062", "0.5141766", "0.5134255", "0.5113801", "0.50998205", "0.50951374", "0.5078881", "0.506852", "0.50460595", "0.5034718", "0.5020222", "0.5003458", "0.50013435", "0.49874228", "0.4980995", "0.4979146", "0.4969222", "0.49500418", "0.49442136", "0.49348685", "0.49273983", "0.49192256", "0.49138096", "0.49129695", "0.49115005", "0.49046257", "0.4888486", "0.48745593", "0.48692837", "0.48549402", "0.4854484", "0.48489627", "0.48466703", "0.4846292", "0.48371542", "0.48360068", "0.48357344", "0.4821687", "0.4818549", "0.48159602", "0.48108938", "0.4800051", "0.47990736", "0.4771274", "0.47626057", "0.47577474", "0.47489527", "0.47444904", "0.47318423", "0.47180977", "0.47171947", "0.47082102", "0.47058314", "0.47046202", "0.47028035", "0.4688056", "0.46837944", "0.4674773", "0.4670892", "0.46648896", "0.465936", "0.4646812", "0.46445942", "0.46396637", "0.46310145", "0.46289438", "0.46247", "0.4620467", "0.4619518", "0.4617138", "0.46149114", "0.4608464", "0.46043757", "0.45983982", "0.45907423", "0.45867094", "0.45860296", "0.4582923" ]
0.64848834
0
Return a writer, for likely reuse unless (1) writer's current file has reached its target size; and (2) there's been no demand for additional writers since the last time a new writerfile was rolledover. In that case, the possiblysuperfluous writer instance is discarded.
public void returnFile(WriterPoolMember writer) throws IOException { synchronized(this) { if(writer.isOversize()) { // maybe retire writer rather than recycle if(lastWriterNeededTime<=lastWriterRolloverTime) { // no timeouts waiting for recycled writer since last writer rollover destroyWriter(writer); return; } else { // reuse writer instance, causing new file to be created lastWriterRolloverTime = System.currentTimeMillis(); } } } if(!availableWriters.offer(writer)) { logger.log(Level.WARNING, "writer unreturnable to available pool; closing early"); destroyWriter(writer); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected synchronized WriterPoolMember makeNewWriterIfAppropriate() {\n\t long now = System.currentTimeMillis();\n\t lastWriterNeededTime = now; \n if(currentActive < maxActive) {\n currentActive++;\n lastWriterRolloverTime = now; \n return makeWriter(); \n }\n return null; \n }", "public Writer getWriter ()\n {\n\tif (myWriter == null)\n\t{\n\t myWriter = new MyWriter ();\n\t}\n\n\treturn myWriter;\n }", "private HFile.Writer getNewWriter(final HFile.Writer writer,\n final Path familydir)\n throws IOException {\n close(writer);\n return new HFile.Writer(fs, StoreFile.getUniqueFile(fs, familydir),\n blocksize, compression, KeyValue.KEY_COMPARATOR);\n }", "protected PrintWriter getTargetWriter() throws IOException {\n\t\tif (this.targetWriter == null) {\n\t\t\tthis.targetWriter = this.response.getWriter();\n\t\t}\n\t\treturn this.targetWriter;\n\t}", "protected IndexWriter getWriter(boolean wipeIndex) throws IOException {\n Directory dir = FSDirectory.open(Paths.get(indexFolder));\n Analyzer analyzer = new StandardAnalyzer();\n IndexWriterConfig iwc = new IndexWriterConfig(analyzer);\n\n if (wipeIndex) {\n iwc.setOpenMode(OpenMode.CREATE);\n } else {\n iwc.setOpenMode(OpenMode.CREATE_OR_APPEND);\n }\n\n IndexWriter writer = new IndexWriter(dir, iwc);\n return writer;\n }", "public boolean getDedicatedWriter()\n {\n return dedicatedWriter;\n }", "public Writer openWriter() throws IOException {\n return new FileWriter(this);\n }", "public IndexWriter getIndexWriter() {\n\t\ttry {\n\t\t\tcheckDirectory();\n\t\t\tcheckIndexLocking();\n\n\t\t\tboolean create = !IndexReader.indexExists(getDirectory());\n\t\t\tIndexWriter writer = new IndexWriter(getDirectory(),getAnalyzer(),create);\n\t\t\tsetIndexWriterParameters(writer);\n\t\t\treturn writer;\n\t\t} catch(IOException ex) {\n\t\t\tthrow new LuceneIndexAccessException(\"Error during creating the writer\",ex);\n\t\t}\n\t}", "int getWriterMaxQueueSize();", "boolean getHasWriteBehindWriter();", "public final Writer wrapAsRawWriter()\n {\n return mWriter.wrapAsRawWriter();\n }", "private BufferedWriter getWriter(int secretPos) throws IOException {\n\t\tFile file = new File(\"reportingTool_tmp\" + sep + this.uniqueName + \"-\" + \"histogram_\" + this.dataset.getSecrets().get(secretPos).getFileName() + \".txt\");\n\t\tFileWriter writer = new FileWriter(file);\n\t\tBufferedWriter bw = new BufferedWriter(writer);\n\t\treturn bw;\n\t}", "@Override\r\n\tpublic PrintWriter getWriter() throws IOException {\n\t\treturn null;\r\n\t}", "@Override\n public void rollOver() {\n if (qw != null) {\n LogLog.debug(\"rolling over count=\" + ((CountingQuietWriter) qw).getCount());\n }\n LogLog.debug(\"maxBackupIndex=\" + maxBackupIndex);\n\n if (maxBackupIndex > 0) {\n deleteOldest();\n moveNext();\n\n final File newestBackupFile = new File(buildBackupFileName(fileName, 1));\n closeFile();\n\n final File basicFile = new File(fileName);\n LogLog.debug(\"Renaming file \" + basicFile + \" to \" + newestBackupFile);\n basicFile.renameTo(newestBackupFile);\n }\n\n try {\n this.setFile(fileName, false, bufferedIO, bufferSize);\n } catch (IOException e) {\n LogLog.error(\"setFile(\" + fileName + \", false) call failed.\", e);\n }\n }", "public static BufferedWriter getWriter(String fileName) throws IOException {\n return getWriter(getPath(fileName));\n }", "@SuppressWarnings(\"unchecked\")\r\n\tprivate synchronized RecordWriter getRecordWriter(\r\n\t\t\tTaskAttemptContext taskContext, String baseFileName) \r\n\t\t\t\t\tthrows IOException, InterruptedException {\r\n\r\n\t\t// look for record-writer in the cache\r\n\t\tRecordWriter writer = recordWriters.get(baseFileName);\r\n\r\n\t\t// If not in cache, create a new one\r\n\t\tif (writer == null) {\r\n\t\t\t// get the record writer from context output format\r\n\t\t\tMultiFileOutputFormat.setOutputName(taskContext, baseFileName);\r\n\t\t\ttry {\r\n\t\t\t\twriter = ((OutputFormat) ReflectionUtils.newInstance(\r\n\t\t\t\t\t\ttaskContext.getOutputFormatClass(), taskContext.getConfiguration()))\r\n\t\t\t\t\t\t.getRecordWriter(taskContext);\r\n\t\t\t} catch (ClassNotFoundException e) {\r\n\t\t\t\tthrow new IOException(e);\r\n\t\t\t}\r\n\r\n\t\t\t// add the record-writer to the cache\r\n\t\t\trecordWriters.put(baseFileName, writer);\r\n\t\t}\r\n\t\treturn writer;\r\n\t}", "public synchronized static FASTAWriter getFASTAWriter(String filename) {\r\n // get the appropriate factory\r\n FASTAWriterFactory factory = (FASTAWriterFactory) getFASTAWriterFactory(filename);\r\n // return null if none exist\r\n if (factory == null) {\r\n return null;\r\n }\r\n \r\n // make the reader\r\n FASTAWriter writer = factory.newInstance(filename);\r\n \r\n // return a new FASTAReader instance\r\n return writer;\r\n }", "public RecordWriter<ImmutableBytesWritable, KeyValue> getRecordWriter(TaskAttemptContext context)\n throws IOException, InterruptedException {\n final Path outputPath = FileOutputFormat.getOutputPath(context);\n final Path outputdir = new FileOutputCommitter(outputPath, context).getWorkPath();\n Configuration conf = context.getConfiguration();\n final FileSystem fs = outputdir.getFileSystem(conf);\n // These configs. are from hbase-*.xml\n final long maxsize = conf.getLong(\"hbase.hregion.max.filesize\", 268435456);\n final int blocksize = conf.getInt(\"hfile.min.blocksize.size\", 65536);\n // Invented config. Add to hbase-*.xml if other than default compression.\n final String compression = conf.get(\"hfile.compression\",\n Compression.Algorithm.NONE.getName());\n\n return new RecordWriter<ImmutableBytesWritable, KeyValue>() {\n // Map of families to writers and how much has been output on the writer.\n private final Map<byte [], WriterLength> writers =\n new TreeMap<byte [], WriterLength>(Bytes.BYTES_COMPARATOR);\n private byte [] previousRow = HConstants.EMPTY_BYTE_ARRAY;\n private final byte [] now = Bytes.toBytes(System.currentTimeMillis());\n\n public void write(ImmutableBytesWritable row, KeyValue kv)\n throws IOException {\n long length = kv.getLength();\n byte [] family = kv.getFamily();\n WriterLength wl = this.writers.get(family);\n if (wl == null || ((length + wl.written) >= maxsize) &&\n Bytes.compareTo(this.previousRow, 0, this.previousRow.length,\n kv.getBuffer(), kv.getRowOffset(), kv.getRowLength()) != 0) {\n // Get a new writer.\n Path basedir = new Path(outputdir, Bytes.toString(family));\n if (wl == null) {\n wl = new WriterLength();\n this.writers.put(family, wl);\n if (this.writers.size() > 1) throw new IOException(\"One family only\");\n // If wl == null, first file in family. Ensure family dir exits.\n if (!fs.exists(basedir)) fs.mkdirs(basedir);\n }\n wl.writer = getNewWriter(wl.writer, basedir);\n Log.info(\"Writer=\" + wl.writer.getPath() +\n ((wl.written == 0)? \"\": \", wrote=\" + wl.written));\n wl.written = 0;\n }\n kv.updateLatestStamp(this.now);\n wl.writer.append(kv);\n wl.written += length;\n // Copy the row so we know when a row transition.\n this.previousRow = kv.getRow();\n }\n\n /* Create a new HFile.Writer. Close current if there is one.\n * @param writer\n * @param familydir\n * @return A new HFile.Writer.\n * @throws IOException\n */\n private HFile.Writer getNewWriter(final HFile.Writer writer,\n final Path familydir)\n throws IOException {\n close(writer);\n return new HFile.Writer(fs, StoreFile.getUniqueFile(fs, familydir),\n blocksize, compression, KeyValue.KEY_COMPARATOR);\n }\n\n private void close(final HFile.Writer w) throws IOException {\n if (w != null) {\n StoreFile.appendMetadata(w, System.currentTimeMillis(), true);\n w.close();\n }\n }\n\n public void close(TaskAttemptContext c)\n throws IOException, InterruptedException {\n for (Map.Entry<byte [], WriterLength> e: this.writers.entrySet()) {\n close(e.getValue().writer);\n }\n }\n };\n }", "public static BufferedWriter get(Writer out) {\n if(out == null || out instanceof BufferedWriter) {\n return (BufferedWriter)out;\n }\n return new BufferedWriter(out);\n }", "public Writer openWriter() throws IOException {\n return new NoCloseWriter(response.getWriter());\n }", "public ByteBuf ensureWritable(int minWritableBytes)\r\n/* 119: */ {\r\n/* 120:136 */ recordLeakNonRefCountingOperation(this.leak);\r\n/* 121:137 */ return super.ensureWritable(minWritableBytes);\r\n/* 122: */ }", "public Writer getWritier(String writerType) {\n if (writerType == null) {\n return null;\n }\n if (writerType.equalsIgnoreCase(CSV)) {\n return new CSVWriter();\n }\n return null;\n }", "@Override\n public PrintWriter getWriter() throws IOException {\n return this.writer;\n }", "public String getWriter() {\r\n return writer;\r\n }", "public Writer getWriter() \r\n\t{\r\n\tif (null == writer)\r\n\t\twriter = new PrintWriter(System.out);\r\n\treturn writer;\r\n\t}", "private BufferedWriter abrirArquivoEscrita() {\n\t\ttry{\n\t\t\tBufferedWriter file = null;\n\t\t\tfile = new BufferedWriter(new FileWriter(caminho));\n\t\t\treturn file;\n\t\t}catch(Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn null;\n\t}", "public static FileWriter getWriter() {\n return new CsvFileWriter();\n }", "public static Writer wrapWriter(StyledPrintWriter w) {\n return new WrappedWriter(w);\n }", "public ModifyingWriter createRegexModifyingWriter(Writer output, String regex, int flags, String replacement,\r\n int minimumLengthOfLookBehind, int requestedCapacityOfCharacterBuffer) {\n if (!(output instanceof BufferedWriter)) {\r\n output = new BufferedWriter(output);\r\n }\r\n\r\n // create modifier\r\n Modifier modifier = new RegexModifier(regex, flags, replacement, minimumLengthOfLookBehind,\r\n requestedCapacityOfCharacterBuffer);\r\n\r\n // create and return Writer\r\n return new ModifyingWriter(output, modifier);\r\n }", "int getWriterConcurrency();", "public PrintWriter getLogWriter() throws ResourceException {\n log.finest(\"getLogWriter()\");\n return logwriter;\n }", "public BufferedMCLWriter getWriter() {\n\t\treturn writer;\n\t}", "public static FactoryWriter getInstance() {\n return FactoryWriterHolder.INSTANCE;\n }", "public abstract JsonWriter newWriter(Writer writer);", "public boolean writerTryLock() {\n\t\t// TODO\n\t\tHolders h = holders.get();\n\t\tfinal Thread current = Thread.currentThread();\n\t\tif (h == null) {\n\t\t\treturn holders.compareAndSet(null, new Writer(current));\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "public static TeaFileWriter getWriter(String fileFormat) {\r\n\t\t\r\n\t\tfor(FileFormats ff : FileFormats.values()) {\r\n\t\t\tif(ff.equals(fileFormat)) {\r\n\t\t\t\treturn ff.writer;\r\n\t\t\t}\r\n\t\t}\r\n\t\t// Default. Should never happen :)\r\n\t\treturn new TextWriter();\r\n\t}", "public static JsonWriter newWriter(Writer writer) {\n if (provider == JsonProvider.UNKNOWN) {\n init();\n }\n return provider.newWriter(writer);\n }", "public void sizeRollover()\r\n\t{\r\n\t\tif (ROLLMODEL1.equals(this.getRolloverModel()))\r\n\t\t{\r\n\t\t\trollingIndex = rollingIndex + 1;\r\n\t\t\ttry\r\n\t\t\t{\r\n\t\t\t\tsetFile(fileName, true, bufferedIO, bufferSize);// Creates new file with new date stamp\r\n\t\t\t} catch (IOException e)\r\n\t\t\t{\r\n\t\t\t\tLogLog.error(\"SetFile(\" + fileName + \", false) call failed.\", e);\r\n\t\t\t}\r\n\t\t} else if (ROLLMODEL2.equals(this.getRolloverModel()))\r\n\t\t{\r\n\t\t\tFile target;\r\n\t\t\tFile file;\r\n\t\t\tif (qw != null)\r\n\t\t\t{\r\n\t\t\t\tlong size = ((CountingQuietWriter) qw).getCount();\r\n\t\t\t\tLogLog.debug(\"rolling over count=\" + size);\r\n\t\t\t\t// if operation fails, do not roll again until\r\n\t\t\t\t// maxFileSize more bytes are written\r\n\t\t\t\tnextRollover = size + maxFileSize;\r\n\t\t\t}\r\n\t\t\tLogLog.debug(\"maxBackupIndex=\" + this.getMaxBackupIndex());\r\n\t\t\tboolean renameSucceeded = true;\r\n\t\t\t// If maxBackups <= 0, then there is no file renaming to be done.\r\n\t\t\tif (this.getMaxBackupIndex() > 0)\r\n\t\t\t{\r\n\t\t\t\t// Delete the oldest file\r\n\t\t\t\tfile = new File(constructFileName(fileName, this.getMaxBackupIndex(), \"\"));\r\n\t\t\t\tif (file.exists())\r\n\t\t\t\t\trenameSucceeded = file.delete();\r\n\r\n\t\t\t\t// Map {(maxBackupIndex - 1), ..., 2, 1} to {maxBackupIndex, ..., 3, 2}\r\n\t\t\t\tfor (int i = this.getMaxBackupIndex() - 1; i >= 1 && renameSucceeded; i--)\r\n\t\t\t\t{\r\n\t\t\t\t\tfile = new File(constructFileName(fileName, i, \"\"));\r\n\t\t\t\t\tif (file.exists())\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\ttarget = new File(constructFileName(fileName, i + 1, \"\"));\r\n\t\t\t\t\t\tLogLog.debug(\"Renaming file \" + file + \" to \" + target);\r\n\t\t\t\t\t\trenameSucceeded = file.renameTo(target);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (renameSucceeded)\r\n\t\t\t\t{\r\n\t\t\t\t\ttarget = new File(constructFileName(fileName, 1, \"\"));\r\n\t\t\t\t\tthis.closeFile();\r\n\t\t\t\t\tfile = new File(fileName);\r\n\t\t\t\t\tLogLog.debug(\"Renaming file \" + file + \" to \" + target);\r\n\t\t\t\t\trenameSucceeded = file.renameTo(target);\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// if file rename failed, reopen file with append = true\r\n\t\t\t\t\t//\r\n\t\t\t\t\tif (!renameSucceeded)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\ttry\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tthis.setFile(fileName, true, bufferedIO, bufferSize);\r\n\t\t\t\t\t\t} catch (IOException e)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tLogLog.error(\"setFile(\" + fileName + \", true) call failed.\", e);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t//\r\n\t\t\t// if all renames were successful, then\r\n\t\t\t//\r\n\t\t\tif (renameSucceeded)\r\n\t\t\t{\r\n\t\t\t\ttry\r\n\t\t\t\t{\r\n\t\t\t\t\t// This will also close the file. This is OK since multiple\r\n\t\t\t\t\t// close operations are safe.\r\n\t\t\t\t\tthis.setFile(fileName, false, bufferedIO, bufferSize);\r\n\t\t\t\t\tnextRollover = 0;\r\n\t\t\t\t} catch (IOException e)\r\n\t\t\t\t{\r\n\t\t\t\t\tLogLog.error(\"setFile(\" + fileName + \", false) call failed.\", e);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public abstract AbstractLineWriter newWriter(String filename)\r\n\t\t\tthrows FileNotFoundException, IOException;", "@Override\n public Writer getOutputStreamWriter() throws IOException {\n return new OutputStreamWriter(getOutputStream());\n }", "private PrintWriter getOutWriter(StringWriter outStr, String outFile)\n\t throws IOException {\n\tPrintWriter outWriter = null;\n\t// create the output writer\n\tif (outStr == null) {\n\t // create file writer\n\t // output file\n\t FileWriter fw = new FileWriter(outFile);\n\t BufferedWriter bw = new BufferedWriter(fw);\n\t outWriter = new PrintWriter(bw);\n\t} else {\n\t // create string writer\n\t // output to string\n\t BufferedWriter bw = new BufferedWriter(outStr);\n\t outWriter = new PrintWriter(bw);\n\t}\n\treturn outWriter;\n }", "public static BufferedWriter getWriter(File file) throws IOException {\n return getWriter(file.toPath());\n }", "public WriterProxy addMatchedWriter(final PublicationData writerData) {\r\n\r\n\t\tList<Locator> locators = getLocators(writerData);\r\n\t\tWriterProxy wp = writerProxies.get(writerData.getBuiltinTopicKey());\r\n\t\tif (wp == null) {\r\n\t\t\twp = new WriterProxy(this, writerData, locators, heartbeatSuppressionDuration);\r\n\t\t\twp.preferMulticast(getConfiguration().preferMulticast());\r\n\t\t\twp.setLivelinessTask(createLivelinessTask(wp));\r\n\r\n\t\t\twriterProxies.put(writerData.getBuiltinTopicKey(), wp);\r\n\t\t}\r\n\t\telse {\r\n\t\t\twp.update(writerData);\r\n\t\t}\r\n\r\n\t\tlogger.debug(\"[{}] Added matchedWriter {}, locators {}\", getEntityId(), writerData, wp.getLocators());\r\n\r\n\t\t//sendAckNack(wp);\r\n\r\n\t\treturn wp;\r\n\t}", "public Writer getWriter(String cliParameter) {\n Writer writer = null;\n if(\"csv\".equals(cliParameter)){\n writer = new WriterCSV();\n }\n \n return writer;\n }", "long getWriterQueueLength();", "private PrintWriter getWriter(String signature) throws IOException {\n\n\tFile f = signature2file.get(signature);\n\n\tif (f == null) {\n\n\t throw new IllegalStateException(\"Supposed to have file name for \"\n\t\t + signature + \", but don't???\");\n\t}\n\n\t// Create a FileWriter with 'append'\n\treturn new PrintWriter(new FileWriter(f, true));\n }", "protected java.io.PrintWriter getPrintWriter(java.io.Writer writer){\n if (writer instanceof java.io.PrintWriter){\n return (java.io.PrintWriter)writer;\n }\n return new java.io.PrintWriter(writer);\n }", "public static RestorableTsFileIOWriter getWriterForAppendingDataOnCompletedTsFile(File file)\n throws IOException {\n long position = file.length();\n\n try (TsFileSequenceReader reader = new TsFileSequenceReader(file.getAbsolutePath(), false)) {\n // this tsfile is complete\n if (reader.isComplete()) {\n reader.loadMetadataSize();\n position = reader.getFileMetadataPos();\n }\n }\n\n if (position != file.length()) {\n // if the file is complete, we will remove all file metadatas\n try (FileChannel channel =\n FileChannel.open(Paths.get(file.getAbsolutePath()), StandardOpenOption.WRITE)) {\n channel.truncate(position - 1); // remove the last marker.\n }\n }\n return new RestorableTsFileIOWriter(file);\n }", "public static BufferedWriter getWriter(OutputStream out) {\n try {\n return new BufferedWriter(new OutputStreamWriter(out, StandardCharsets.UTF_8));\n } catch(Throwable ignored) {\n }\n return null;\n }", "public boolean writerTryLock() {\n final Thread current = Thread.currentThread();\n // already held by the current thread\n if ((holder.get() instanceof Writer) && (holder.get().thread == current)) {\n throw new IllegalStateException();\n }\n else if (holder.compareAndSet(null, new Writer(current))) return true;\n return false;\n }", "public PrintWriter getLogWriter() throws ResourceException {\n return logWriter;\n }", "public FileHandler createRollingLogHandler ( String \tfileName\r\n\t\t\t\t\t\t\t\t\t\t\t\t, int \t\tlimitFileSize\r\n\t\t\t\t\t\t\t\t\t\t\t\t, int \t\tmaximumFileNumbers\r\n\t\t\t\t\t\t\t\t\t\t\t\t, boolean\tappend\r\n\t\t\t\t\t\t\t\t\t\t\t\t) {\r\n\t\t\r\n\t\tFileHandler logHandler = null;\r\n\t\t\r\n\t try {\r\n\t \t\r\n logHandler = new FileHandler(fileName, limitFileSize, maximumFileNumbers, append);\r\n\t\t\t\r\n\t\t} catch (SecurityException | IOException e) {\r\n\t\t\t\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t \r\n\t return logHandler;\r\n\t}", "public static BufferedWriter getWriter(Path path) throws IOException {\n return Files.newBufferedWriter(path);\n }", "@Override\n\t\tpublic RecordWriter<NullWritable, NullWritable> getRecordWriter(\n\t\t\t\tTaskAttemptContext context) throws IOException, InterruptedException {\n\t\t\treturn new RecordWriter<NullWritable, NullWritable>() {\n\t\t\t\t@Override\n\t\t\t\tpublic void close(TaskAttemptContext context) {\n\t\t\t\t\t// Noop\n\t\t\t\t}\n\t\t\t\t@Override\n\t\t\t\tpublic void write(NullWritable k, NullWritable v) {\n\t\t\t\t\t// Noop\n\t\t\t\t}\n\t\t\t};\n\t\t}", "public ReaderWriterProvider readerWriterProvider() { return _readerProvider; }", "public PipedWriter() { throw new RuntimeException(\"Stub!\"); }", "private IndexWriter getIndexWriter() throws IOException {\n\n\t\tAnalyzer a = getAnaLyzer();\n\n\t\tif (idxWriter == null) {\n\n\t\t\tindexPath = this.analyzer + \" index-directory\";\n\t\t\tDirectory indexDir = FSDirectory.open(Paths.get(indexPath));\n\t\t\tIndexWriterConfig config = new IndexWriterConfig(a);\n\n\t\t\tconfig.setOpenMode(OpenMode.CREATE);\n\n\t\t\tidxWriter = new IndexWriter(indexDir, config);\n\t\t}\n\n\t\treturn idxWriter;\n\t}", "private FilePart rollOver() throws IOException {\n/* 251 */ if (this.currentLastBytePos > -1) {\n/* 252 */ throw new IllegalStateException(\"Current currentLastCharPos unexpectedly positive... last readLine() should have returned something! currentLastCharPos=\" + this.currentLastBytePos);\n/* */ }\n/* */ \n/* */ \n/* 256 */ if (this.no > 1L) {\n/* 257 */ return new FilePart(this.no - 1L, ReversedLinesFileReader.this.blockSize, this.leftOver);\n/* */ }\n/* */ \n/* 260 */ if (this.leftOver != null) {\n/* 261 */ throw new IllegalStateException(\"Unexpected leftover of the last block: leftOverOfThisFilePart=\" + new String(this.leftOver, ReversedLinesFileReader.this.encoding));\n/* */ }\n/* */ \n/* 264 */ return null;\n/* */ }", "private BufferedWriter createWriter(String filePath, String fileName)\r\n\t\t\tthrows IOException {\r\n\t\tString fullPath = filePath + \"/\" + fileName;\r\n\t\tFile file = new File(fullPath);\r\n\t\tboolean exists = new File(filePath).exists();\r\n\t\tif (!exists) {\r\n\t\t\tfile.mkdir();\r\n\t\t}\r\n\t\tFileWriter writer = new FileWriter(file);\r\n\t\tBufferedWriter bufferWriter = new BufferedWriter(writer);\r\n\r\n\t\treturn bufferWriter;\r\n\t}", "@Override\n public int getMaxWriteSize() {\n return mMaxWriteSize;\n }", "public Mol2Writer(Writer out) {\n \tlogger = new LoggingTool(this);\n \ttry {\n \t\tif (out instanceof BufferedWriter) {\n writer = (BufferedWriter)out;\n } else {\n writer = new BufferedWriter(out);\n }\n } catch (Exception exc) {\n }\n }", "public PrintWriter getMessageWriter() {\n synchronized (TestResult.this) {\n synchronized (this) {\n checkMutable();\n // if it is mutable, it must have a message stream,\n // which will be the first entry\n return buffers[0].getPrintWriter();\n }\n }\n }", "XMLWriter getStringWriter() {\n\t\tOutputFormat format = new OutputFormat(\" \", true);\n\t\tformat.setTrimText(true);\n\t\tStringWriter sw = new StringWriter();\n\t\ttry {\n\t\t\tstringWriter = new XMLWriter(sw, format);\n\t\t} catch (Exception e) {\n\t\t\tprtln(\"getStringWriter(): \" + e);\n\t\t}\n\n\t\tprtln(\" ... format.encoding: \" + format.getEncoding());\n\t\tprtln(\" ... format.isNewLines: \" + format.isNewlines());\n\t\tprtln(\" ... format.isTrimText: \" + format.isTrimText());\n\t\tprtln(\" ... format.indent: \\'\" + format.getIndent() + \"\\'\");\n\n\t\tstringWriter.setEscapeText(false);\n\t\tif (stringWriter.isEscapeText()) {\n\t\t\tprtln(\" ... isEscapeText\");\n\t\t} else {\n\t\t\tprtln(\" ... is NOT escapeText\");\n\t\t}\n\t\treturn stringWriter;\n\t}", "public MockSNSWriter getMockWriter()\n {\n return (MockSNSWriter)writer;\n }", "private static PrintWriter erstelleWriterInDatei(File datei)\r\n\t{\r\n\t\tPrintWriter schreiber = null;\r\n\t\ttry\r\n\t\t{\r\n\t\t\tschreiber = new PrintWriter(datei);\r\n\t\t} catch (FileNotFoundException e)\r\n\t\t{\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\treturn schreiber;\r\n\t}", "private PrintWriter createOutputFile(String outputFile) throws IOException {\n return new PrintWriter(new BufferedWriter(new FileWriter(outputFile)));\n }", "public abstract JsonWriter newWriter(OutputStream out);", "public static JsonWriter newWriter(OutputStream out) {\n if (provider == JsonProvider.UNKNOWN) {\n init();\n }\n return provider.newWriter(out);\n }", "protected RecordWriter<WritableComparable<?>,\n HCatRecord> getRecordWriter() {\n return hCatRecordWriter;\n }", "public static XMLStringWriter create() {\r\n return new XMLStringWriter(new StringWriter());\r\n }", "public static ISWFWriterFactory getSWFWriterFactory(File sizeReport)\n {\n if (sizeReport != null)\n return new SWFWriterFactory(sizeReport);\n\n return SWFWriter.DEFAULT_SWF_WRITER_FACTORY;\n }", "public synchronized void destroyWriter(WriterPoolMember writer) throws IOException {\n currentActive--; \n writer.close();\n }", "@Override\n public LogWriter getLogWriter() {\n return logWriter;\n }", "public WriterProxy removeMatchedWriter(PublicationData writerData) {\r\n\t\tlogger.debug(\"[{}] Removing matchedWriter {}\", getEntityId(), writerData.getBuiltinTopicKey());\r\n\t\tWriterProxy proxy = writerProxies.remove(writerData.getBuiltinTopicKey());\r\n\r\n\t\treturn proxy;\r\n\t}", "private static synchronized DocumentBuilder getDocumentBuilder()\n {\n DocumentBuilder builder = null;\n if (canReuseBuilders && builderPool.size() > 0)\n {\n builder = builderPool.pollFirst().get();\n }\n if (builder == null)\n {\n if(!canReuseBuilders || currentBuildersCount < maxBuildersCount)\n {\n try\n {\n builder = builderFactory.newDocumentBuilder();\n builder.setErrorHandler(errorHandler);\n ++currentBuildersCount;\n }\n catch(Exception e)\n {\n /* this is a fatal error */\n throw new RuntimeException(\"could not create a new XML DocumentBuilder instance\", e);\n }\n }\n else\n {\n try\n {\n LOGGER.warn(\"reached XML DocumentBuilder pool size limit, current thread needs to wait; you can increase pool size with the {} system property\", BUILDER_MAX_INSTANCES_KEY);\n builder = builderPool.takeFirst().get();\n }\n catch(InterruptedException ie)\n {\n LOGGER.warn(\"caught an InterruptedException while waiting for a DocumentBuilder instance\");\n }\n }\n }\n return builder;\n }", "public MockJspWriter(Writer targetWriter) {\n\t\tthis(null, targetWriter);\n\t}", "public SocketChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark)\r\n/* 338: */ {\r\n/* 339:328 */ super.setWriteBufferHighWaterMark(writeBufferHighWaterMark);\r\n/* 340:329 */ return this;\r\n/* 341: */ }", "public Reader newReader() {\n synchronized (allReaders) {\n Reader reader = new Reader(this);\n allReaders.add(reader);\n return reader;\n }\n }", "private static File getWeededOut() {\n\t\tFile[] files = cacheFolder.listFiles();\n\t\tif (files != null) {\n\t\t\tint count = files.length;\n\t\t\tif (count > CACHE_CAPACITY) {\n\n\t\t\t\tFile ret = files[0];\n\n\t\t\t\tfor (File bean : files) {\n\n\t\t\t\t\tif (ret.lastModified() > bean.lastModified())\n\t\t\t\t\t\tret = bean;\n\t\t\t\t}\n\t\t\t\tfiles = null;\n\t\t\t\treturn ret;\n\t\t\t} else {\n\t\t\t\tfiles = null;\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t}\n\t\tfiles = null;\n\t\treturn null;\n\t}", "boolean isUsedForWriting();", "public PrintWriter getWriter() throws IOException {\n return this.response.getWriter();\n }", "public Object getOutputTarget()\n/* */ {\n/* 101 */ return this._writer;\n/* */ }", "public BluetoothGattCharacteristic getWriterCharacteristic() {\n return mWriterCharacteristic;\n }", "public AbstractShapeBuilder.Shrinkage getShrinkage() {\n if (shrinkage == null)\n shrinkage = new AbstractShapeBuilder.Shrinkage(this);\n return shrinkage;\n }", "public Stream<T> getRemainingStream() {\n try (CloseableStreamIterator<T> self = this) {\n Stream<T> result = toStream(this.iterator)\n .onClose(this.stream::close);\n\n this.stream = null;\n this.iterator = null;\n\n return result;\n }\n }", "XMLStreamWriter createXMLStreamWriter(StreamResult sr, String encoding)\n throws XMLStreamException {\n try {\n if (fReuseInstance && fStreamWriter != null && fStreamWriter.canReuse()\n && !fPropertyChanged) {\n fStreamWriter.reset();\n fStreamWriter.setOutput(sr, encoding);\n if (DEBUG) {\n System.out.println(\"reusing instance, object id : \" + fStreamWriter);\n }\n return fStreamWriter;\n }\n return fStreamWriter = new XMLStreamWriterImpl(sr, encoding,\n new PropertyManager(fPropertyManager));\n } catch (IOException io) {\n throw new XMLStreamException(io);\n }\n }", "public MockJspWriter(HttpServletResponse response, Writer targetWriter) {\n\t\tsuper(DEFAULT_BUFFER, true);\n\t\tthis.response = (response != null ? response : new MockHttpServletResponse());\n\t\tif (targetWriter instanceof PrintWriter) {\n\t\t\tthis.targetWriter = (PrintWriter) targetWriter;\n\t\t}\n\t\telse if (targetWriter != null) {\n\t\t\tthis.targetWriter = new PrintWriter(targetWriter);\n\t\t}\n\t}", "public int ensureWritable(int minWritableBytes, boolean force)\r\n/* 125: */ {\r\n/* 126:142 */ recordLeakNonRefCountingOperation(this.leak);\r\n/* 127:143 */ return super.ensureWritable(minWritableBytes, force);\r\n/* 128: */ }", "public Builder setWriteBufferSize(int writeBufferSize) {\n writeBufferSize_ = Arguments.requirePositiveOrZero(writeBufferSize, \"writeBufferSize\");\n return this;\n }", "public RollingFileAppender createNewRollingFileAppender(String appenderName, String logFilePath, String maxFileSize, int maxBackups) {\n\t\tRollingFileAppender appender = new RollingFileAppender();\n\t appender.setName(appenderName);\n\t appender.setLayout(new EnhancedPatternLayout(\"%d %-5p %C.%M(%F:%L) - %m%n\"));\n\t appender.setFile(logFilePath);\n\t appender.setAppend(true);\n\t appender.setMaxFileSize(maxFileSize);\n\t appender.setMaxBackupIndex(maxBackups);\n\t appender.activateOptions();\n\t Logger.getRootLogger().addAppender(appender);\n\t return appender;\n\t}", "public SimpleLock writeLock() {\n\n\t\treturn writerLock;\n\t}", "@Override\n protected boolean shouldSwitchWriterInCurrentLocation(DecoratedKey key)\n {\n final long uncompressedBytesWritten = sstableWriter.currentWriter().getFilePointer();\n if (boundaries.advanceTo(key.getToken()) && uncompressedBytesWritten > 0)\n {\n logger.debug(\"Switching writer at boundary {}/{} index {}, with uncompressed size {} for {}.{}\",\n key.getToken(), boundaries.shardStart(),\n boundaries.shardIndex(),\n FBUtilities.prettyPrintMemory(uncompressedBytesWritten),\n cfs.getKeyspaceName(), cfs.getTableName());\n return true;\n }\n\n return false;\n }", "private Writer createSequenceFileWriter(File outputPath) throws Exception {\n Configuration conf = new Configuration();\n org.apache.hadoop.fs.Path path = new org.apache.hadoop.fs.Path(outputPath.getAbsolutePath());\n\n CompressionCodec codec = getCompressionCodec();\n Writer.Option optPath = Writer.file(path);\n Writer.Option optKey = Writer.keyClass(keyConverter.getClassName());\n Writer.Option optValue = Writer.valueClass(valueConverter.getClassName());\n Writer.Option optCom = Writer.compression(compressionType, codec);\n\n return createWriter(conf, optPath, optKey, optValue, optCom);\n }", "public WARCWriter(final AtomicInteger serialNo,\n \t\tfinal OutputStream out, final File f,\n \t\tfinal WARCWriterPoolSettings settings)\n throws IOException {\n super(serialNo, out, f, settings);\n }", "public ClassWriter getClassWriter() {\n\t\treturn classWriter;\n\t}", "private ByteChunker nextChunker() {\n\t\tif(curChunker != null)\n\t\t\tcurChunker.dispose();\n\t\treturn curChunker = sendQ.poll();\n\t}", "public void reopen() throws IOException {\r\n writer.close();\r\n writer = new BufferedWriter(new java.io.FileWriter(file));\r\n }", "CompressingMessageWriter(MessageWriter wr) {\n this.writer = wr;\n }", "private StringWriter createStringWriter(String str)\n\t{\n\t\treturn new StringWriter((int) (str.length() + (str.length() * 0.1)));\n\t}", "public WriterLog getDefaultLog() {\r\n if (defaultLog == null) {\r\n synchronized (this) {\r\n if (defaultLog == null) {\r\n defaultLog = new DefaultLog();\r\n }\r\n }\r\n }\r\n return defaultLog;\r\n }" ]
[ "0.6646529", "0.5765986", "0.5552889", "0.5441869", "0.53329504", "0.52401626", "0.52400136", "0.5127546", "0.5097927", "0.5066057", "0.50259924", "0.50150806", "0.5011888", "0.4999555", "0.4975466", "0.4970929", "0.4970404", "0.49565336", "0.49492204", "0.49363816", "0.49216202", "0.4913381", "0.49094674", "0.49047983", "0.48999894", "0.48823395", "0.48818544", "0.48637697", "0.4815644", "0.47938088", "0.47812384", "0.47460273", "0.47033155", "0.46755403", "0.46755362", "0.46542156", "0.46428218", "0.46415538", "0.4627606", "0.46221766", "0.45973203", "0.45962286", "0.4573505", "0.45483425", "0.45407465", "0.45382684", "0.45292908", "0.4529254", "0.45188013", "0.45155886", "0.44771338", "0.44612563", "0.4434319", "0.44325188", "0.43876225", "0.4368507", "0.43631616", "0.4361053", "0.4344137", "0.4341491", "0.43333063", "0.43192562", "0.43097022", "0.42801118", "0.42742476", "0.42567855", "0.42532417", "0.4240936", "0.42364398", "0.42346546", "0.42200056", "0.42097655", "0.42040095", "0.41971496", "0.41900146", "0.41821095", "0.41792363", "0.41759655", "0.4169388", "0.415264", "0.41414887", "0.4134677", "0.41321275", "0.41311172", "0.41305268", "0.41278008", "0.4126643", "0.41237682", "0.40965122", "0.4074826", "0.40502954", "0.40498307", "0.40494415", "0.4045522", "0.4038794", "0.40381896", "0.40322515", "0.40261203", "0.4024074", "0.40188196" ]
0.64421463
1
Close and discard a writer that experienced a potentiallycorrupting error.
public synchronized void invalidateFile(WriterPoolMember f) throws IOException { try { destroyWriter(f); } catch (Exception e) { // Convert exception. throw new IOException(e.getMessage()); } // It'll have been closed. Rename with an '.invalid' suffix so it // gets attention. File file = f.getFile(); file.renameTo(new File(file.getAbsoluteFile() + WriterPoolMember.INVALID_SUFFIX)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected void closeNotSuccessful() {\n\t\tthis.writer.deblockQueue();\n\t}", "public void shutdown() {\n try {\n this.writer.close();\n } catch (IOException e) {\n log.warn(i18n.getString(\"problemCloseOutput\", e), e);\n }\n }", "public void close() throws DukeException {\n try {\n this.writer.close();\n } catch (IOException e) {\n throw Ui.ioException(e);\n }\n }", "public void closeWriter() throws IOException{\n if(isOpen){\n dataWriter.close();\n }\n }", "public void reopen() throws IOException {\r\n writer.close();\r\n writer = new BufferedWriter(new java.io.FileWriter(file));\r\n }", "public void closeWriter () {\n try {\n writer.close();\n indexDir.close();\n indexHandler = null;\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "@Override\n public void corrupt(File file) throws IOException\n {\n FileChannel.open(file.toPath(), StandardOpenOption.WRITE).truncate(file.length() - CodecUtil.footerLength() - 2).close();\n }", "public void close(){\r\n\t\tif (this.fileWriter != null){\r\n\t\t\ttry {\r\n\t\t\t\tthis.fileWriter.flush();\r\n\t\t\t\tthis.fileWriter.close();\r\n\t\t\t\tthis.fileWriter = null;\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\tlogger.error(\"Cannot close the file handle \"+this.myfilename+\". Your results might be lost. Cause: \"+e.getMessage());\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\r\n\t\t}\r\n\t}", "@Override\n public void corrupt(File file) throws IOException\n {\n try (FileChannel channel = FileChannel.open(file.toPath(), StandardOpenOption.WRITE))\n {\n channel.truncate(file.length() - CodecUtil.footerLength() - 2);\n }\n }", "@TestMethod(\"testClose\")\n public void close() throws IOException {\n writer.close();\n }", "public void close() throws IOException\n {\n writer.close();\n }", "@Override\n public void destroy() {\n if (fileWriter != null) {\n try {\n fileWriter.close();\n } catch (IOException e) {\n }\n }\n }", "public void close() throws IOException {\r\n writer.close();\r\n }", "public static void close( Writer writer )\n {\n if ( writer != null )\n {\n try\n {\n writer.close();\n }\n catch ( IOException e )\n {\n log.error( \"Error closing writer: \" + writer, e );\n }\n }\n }", "@Override\n public void cleanup() throws Exception {\n outputStream.close();\n }", "public void close() throws IOException {\r\n reader.close();\r\n reader = null;\r\n }", "private void close() {\n try {\n if (reader != null) {\n this.reader.close();\n }\n if (writer != null) {\n this.writer.close();\n }\n }\n catch (IOException e) {\n log.error(e);\n log.debug(Constants.STREAM_IS_CLOSED);\n }\n }", "void close(boolean evictOnClose) throws IOException;", "@Override\r\n public void close() throws IOException {\r\n IOException ioException = null;\r\n for (WriterInfo writerInfo : mWriters) {\r\n try {\r\n Writer writer = writerInfo.getWriter();\r\n if (writerInfo.getOwned()) {\r\n writer.close();\r\n } else {\r\n writer.flush();\r\n }\r\n } catch(IOException ioex) {\r\n ioException = ioex;\r\n }\r\n }\r\n if (ioException != null) {\r\n throw ioException;\r\n }\r\n }", "private void cerrarEnviar() {\n \t try {\r\n \t bis.close();\r\n bos.close();\r\n \t }catch(Exception e ) {}\r\n\t}", "@Test\n\tpublic void testBadRead(){\n\t\ttry{\n\t\t\tXMLReader reader = new XMLReader(\"nonExistent\");\n\t\t\treader.close();\n\t\t\tfail(\"XMLReader should not have been able to read nonexistent file\");\n\t\t} catch (FileNotFoundException e){\n\t\t}\n\t}", "private void ensureWrite() throws IOException {\n if (!reading) return;\n resetForWrite();\n }", "@Override\n public void close() {\n if (complete.compareAndSet(false, true)) {\n rc = BKException.Code.UnexpectedConditionException;\n writeSet.recycle();\n }\n entryImpl.close();\n }", "protected final void close()\n {\n try {\n _reader.close();\n _reader = null;\n } catch ( IOException except ) { }\n }", "static void cerrarSalida(){\n if (escritor!=null){\n try {\n escritor.close();\n } catch (IOException ex) {\n System.out.println(\"Error al cerrar el archivo\");\n }\n }\n }", "private void ensureOpen() throws IOException {\n if (out == null) {\n throw new IOException(\n/* #ifdef VERBOSE_EXCEPTIONS */\n/// skipped \"Stream closed\"\n/* #endif */\n );\n }\n }", "@AfterMethod\n public void closeBrowser() throws IOException, WriteException {\n\n writableFile.write();\n writableFile.close();\n readableFile.close();\n driver.quit();\n }", "private void cerrarRecibir() {\n \t try {\r\n \t \tout.flush(); \r\n \t in.close();\r\n \t out.close(); \r\n \t }catch(Exception e) {}\r\n\t}", "protected void close() {\n\t\tthis.writer.stop();\n\t\tsynchronized (this.writer.writer) {\n\t\t\twhile (!this.writer.isFinished()) {\n\t\t\t\ttry {\n\t\t\t\t\tthis.writer.writer.wait();\n\t\t\t\t}\n\t\t\t\tcatch (InterruptedException e) {\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\ttry {\n\t\t\tthis.btc.close();\n\t\t}\n\t\tcatch (IOException e) {\n\t\t}\n\n\t\tthis.closed = true;\n\t}", "public void closeFile() throws IOException {\n finstream.close();\n writer.close();\n }", "private void flushWrite() throws IOException, BadDescriptorException {\n if (reading || !modes.isWritable() || buffer.position() == 0) return; // Don't bother\n \n int len = buffer.position();\n buffer.flip();\n int n = descriptor.write(buffer);\n \n if(n != len) {\n // TODO: check the return value here\n }\n buffer.clear();\n }", "public void closeReader() throws IOException{\n if(isOpen){\n csvReader.close();\n }\n\n }", "public synchronized void destroyWriter(WriterPoolMember writer) throws IOException {\n currentActive--; \n writer.close();\n }", "public void closeCsvFile()\n{\n try {\n \n fileWriter.flush(); \n fileWriter.close(); \n \n } catch (IOException e) { \n \n System.out.println(\"Error while flushing/closing fileWriter !!!\"); \n e.printStackTrace(); \n } \n \n}", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "void close() throws IOException;", "private BufferedWriter abrirArquivoEscrita() {\n\t\ttry{\n\t\t\tBufferedWriter file = null;\n\t\t\tfile = new BufferedWriter(new FileWriter(caminho));\n\t\t\treturn file;\n\t\t}catch(Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn null;\n\t}", "public static void writeDontCloseStream(Element document,Writer writerW) throws IOException\r\n {\n XMLWriter writer = new XMLWriter(writerW);\r\n writer.write( document );\r\n }", "public void close() throws IOException {\n reset();\n _reader.close();\n }", "@Override\n public void closeExportWriter() {\n }", "private void invalidateBuffer() throws IOException, BadDescriptorException {\n if (!reading) flushWrite();\n int posOverrun = buffer.remaining(); // how far ahead we are when reading\n buffer.clear();\n if (reading) {\n buffer.flip();\n // if the read buffer is ahead, back up\n FileChannel fileChannel = (FileChannel)descriptor.getChannel();\n if (posOverrun != 0) fileChannel.position(fileChannel.position() - posOverrun);\n }\n }", "public void close() throws IOException {\n FileOutputStream out = new FileOutputStream(fileName);\n wb.write(out);\n\n out.close();\n wb.close();\n }", "@Override\r\n\tpublic final void close() throws IOException {\r\n\t\tf.close();\r\n\t\tf = null;\r\n\t}", "@Override\n protected boolean continueOnWriteError() {\n return true;\n }", "public synchronized void flush() {\n\t\ttry {\n\t\t\tcloseWriter();\n\t\t} catch(IOException ioe ) {\n\t\t\tioe.printStackTrace();\n\t\t}\n\n\t\ttry {\n\t\t\topenWriter(true);\n\t\t} catch(IOException ioe ) {\n\t\t\tioe.printStackTrace();\n\t\t}\n\t}", "public synchronized void close() {\n\t\ttry {\n\t\t\tif (reader != null) reader.close();\n\t\t\tif (writer != null) writer.close();\n\t\t\tif (fromMonet != null) fromMonet.close();\n\t\t\tif (toMonet != null) toMonet.close();\n\t\t\tif (con != null) con.close();\n\t\t\tif (debug && log instanceof FileWriter) log.close();\n\t\t} catch (IOException e) {\n\t\t\t// ignore it\n\t\t}\n\t}", "public synchronized void close() throws IOException {\n\t\tif (journalWriter == null) {\n\t\t\treturn; // already closed\n\t\t}\n\t\tfor (Entry entry : new ArrayList<Entry>(lruEntries.values())) {\n\t\t\tif (entry.currentEditor != null) {\n\t\t\t\tentry.currentEditor.abort();\n\t\t\t}\n\t\t}\n\t\ttrimToSize();\n\t\tjournalWriter.close();\n\t\tjournalWriter = null;\n\t}", "void close() throws EDIStreamException;", "protected boolean continueOnWriteError() {\n/* 348 */ return true;\n/* */ }", "private void fecharArquivoEscrita(BufferedWriter file) {\n\t\ttry {\n\t\t\tfile.close();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void close(){\n\t\ttry {\n\t\t\tout.close();\n\t\t\tout = null;\n\t\t}\n\t\tcatch (IOException e){\n\t\t\tSystem.out.println(\"Problem closing file.\");\n\t\t\tSystem.exit(0);\n\t\t}\n\t}", "@Test\n public void testCorruptTruncatedHFile() throws IOException {\n Path f = new Path(TestHFile.ROOT_DIR, testName.getMethodName());\n HFileContext context = new HFileContextBuilder().build();\n Writer w = HFile.getWriterFactory(TestHFile.conf, TestHFile.cacheConf).withPath(this.fs, f).withFileContext(context).create();\n writeSomeRecords(w, 0, 100, false);\n w.close();\n Path trunc = new Path(f.getParent(), \"trucated\");\n TestHFile.truncateFile(TestHFile.fs, w.getPath(), trunc);\n try {\n Reader r = HFile.createReader(TestHFile.fs, trunc, TestHFile.cacheConf, true, TestHFile.conf);\n } catch (CorruptHFileException che) {\n // Expected failure\n return;\n }\n Assert.fail(\"Should have thrown exception\");\n }", "public void close() throws IOException;", "public void close() throws IOException;", "public void close() throws IOException;", "public void close() throws IOException;", "public void close() throws IOException;", "public void close() throws IOException;", "public void close() throws IOException;", "public void close() throws IOException;", "public void closeCSVStream() {\n\t\ttry {\n\t\t\twriter.close();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "private void cerrarSalNuevoMaest(){\n try{\n if(salNuevoMaest != null)\n salNuevoMaest.close();\n }\n catch(IOException iOException){\n System.err.println(\"Error al cerrar el archivo. Terminado.\");\n System.exit(1);\n }\n }", "public void close() throws IOException {\n reader.close();\n }", "public void setErrorOnWriterUsage(boolean throwExceptionWhenUsingWriter) {\n this.throwExceptionOnWriterUsage = throwExceptionWhenUsingWriter;\n }", "@Override\n public void close()\n {\n if (closed) {\n return;\n }\n closed = true;\n\n try {\n stats.addMaxCombinedBytesPerRow(recordReader.getMaxCombinedBytesPerRow());\n recordReader.close();\n }\n catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n }", "protected void tearDown() throws Exception {\n _reader.close();\n }", "public void close() throws Exception{\r\n\tout.close();\r\n}", "private void close() throws CorruptIndexException, IOException {\n\n\t\tidxWriter.forceMerge(1);\n\t\tidxWriter.commit();\n\t\tidxWriter.close();\n\t}", "public static void closeFileWriter(FileWriter fileWriter) {\n\n try {\n\n if (fileWriter != null) {\n fileWriter.close();\n }\n\n } catch (Exception e) {\n logger.error(e);\n } finally {\n fileWriter = null;\n }\n\n }", "public void close() {\n try { out.flush(); } catch (Exception e) {}; // just to be sure\n \n cleanup();\n }", "public void close(){\n\t\ttry{\n\t\t\tflush();\n\t\t\tse.close();\n\t\t}catch(IOException ioex){\n\t\t\tfailures = true;\n\t\t}\n\t}", "public boolean closeRead() throws Exception;", "private void closeOutput() throws Exception \n { Close the fifo file...\n //\n data.fifoStream.close();\n data.fifoStream=null;\n \n // wait for the INSERT statement to finish and check for any\n // error and/or warning...\n // \n data.sqlRunner.join();\n SqlRunner sqlRunner = data.sqlRunner;\n data.sqlRunner = null;\n sqlRunner.checkExcn();\n \n //wait for UNIX/Linux Process to be finished\n data.sqlProcess.waitFor();\n \n data.sqlOutputStream.close();\n data.sqlOutputStream=null;\n }", "void close(){\n try{\n debugWriter.write(\"quit\\n\");\n debugWriter.flush();\n Thread.sleep(100);\n debugWriter.write(\"yes\\n\");\n debugWriter.flush();\n Thread.sleep(100);\n debugWriter.close();\n debugReader.kill();\n debugReader.interrupt();\n debugReader.kill();\n debugger.destroy();\n }catch(Exception e){\n System.out.println(\"Close exception\");\n //Eat it\n }\n }", "private void checkIfClosed(int i) throws IOException {\n if (i == -1) {\n throw new IOException();\n }\n }", "@Test\n\tdefault void testUnalllowedWriting() {\n\t\tperformStreamTest(stream -> {\n\t\t\tassertThrows(IllegalAccessException.class, () -> stream.writeByte((byte) 42, 69));\n\t\t});\n\t}", "@Override\n public void close() throws IOException {\n\n if (!responseBody.delete()) {\n LOGGER.warn(\"Cannot delete response body\");\n }\n\n if (!responseBody.getParentFile().delete()) {\n LOGGER.warn(\"Cannot delete response body's parent file\");\n }\n }", "public void discardContent() {\n dispose();\n }", "public void close(boolean failure) {\n if (close) {\n try {\n writer.close();\n } catch (IOException e) {\n throw new SpawnException(REDIRECT_OUTPUT_FAILURE, e);\n }\n }\n }", "public static void close( Reader reader )\n {\n if ( reader != null )\n {\n try\n {\n reader.close();\n }\n catch ( IOException e )\n {\n log.error( \"Error closing reader: \" + reader, e );\n }\n }\n }", "void cleanUp() throws IOException;", "void close() throws FileSystemException;", "@Override\r\n\tpublic void disconnect() throws IOException {\n\t\tif (this.mode.equals(\"r\")) {\r\n\t\t\tthis.scanner.close();\r\n\t\t} else {\r\n\t\t\tthis.writer.close();\r\n\t\t}\r\n\t}", "public boolean close() {\n \n if (writer != null)\n writer.close();\n \n if (oos != null) {\n try {\n oos.close();\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n \n return false;\n }\n }\n \n if (ois != null) {\n try {\n ois.close();\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n \n return false;\n }\n }\n \n return true;\n }", "public void endWrite() throws ThingsException;", "public void cleanup() {\n this.close();\n this.delete(this.backingFileBasename + RECORDING_OUTPUT_STREAM_SUFFIX);\n this.delete(this.backingFileBasename + RECORDING_INPUT_STREAM_SUFFIX);\n }", "private void cerrarSalRegistro(){\n try{\n if(salRegistro != null)\n salRegistro.close();\n }\n catch(IOException iOException){\n System.err.println(\"Error al cerrar el archivo. Terminado.\");\n System.exit(1);\n }\n }", "public void unload() throws IOException;", "public static void endWrite()\r\n\t{\r\n\t\r\n\t}", "protected void close()\n {\n out.close();\n }", "@Override\n public void close() throws IOException\n {\n\n // do nothing\n }" ]
[ "0.6158", "0.5676935", "0.5649073", "0.56112087", "0.55446965", "0.5541532", "0.54643", "0.54427385", "0.5373924", "0.53690594", "0.5368794", "0.5368466", "0.5368184", "0.53035647", "0.5273448", "0.5160552", "0.5117514", "0.5096367", "0.5082978", "0.5079656", "0.5053708", "0.503289", "0.5030092", "0.5023421", "0.49985632", "0.4970437", "0.49637702", "0.4944642", "0.49167192", "0.49156764", "0.49045748", "0.48992214", "0.48700657", "0.48561755", "0.48277798", "0.48277798", "0.48277798", "0.48277798", "0.48277798", "0.48277798", "0.48277798", "0.48277798", "0.48277798", "0.48277798", "0.48277798", "0.48014554", "0.4796287", "0.47938526", "0.47897118", "0.47825813", "0.47753507", "0.4771452", "0.47680342", "0.47620133", "0.47605824", "0.4752739", "0.47505572", "0.47446376", "0.47419935", "0.47416997", "0.47356042", "0.47174075", "0.47174075", "0.47174075", "0.47174075", "0.47174075", "0.47174075", "0.47174075", "0.47174075", "0.47045577", "0.4698372", "0.46972868", "0.4684965", "0.46806645", "0.46776897", "0.46536085", "0.4646087", "0.4631719", "0.46283478", "0.46214285", "0.4608038", "0.46040046", "0.46021128", "0.45989642", "0.45967197", "0.45932767", "0.45884952", "0.45878172", "0.45855734", "0.4584258", "0.4558916", "0.45514375", "0.45480028", "0.4538372", "0.4528633", "0.4525345", "0.45239946", "0.45149958", "0.45104644", "0.45075333" ]
0.47415498
60
Returns the atomic integer used to generate serial numbers for files.
public AtomicInteger getSerialNo() { return serialNo; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int getAtomicNumber() {\n }", "public int nextSerialNumber(){\n serialNumber++;\n return serialNumber;\n }", "public abstract long NewFileNumber();", "public static Integer getTransactionNumber() {\n\t\tRandom r = new Random(System.currentTimeMillis());\n\t\treturn r.nextInt(100000) * 00001;\n\n\t}", "public int make() { return this.atomicId.incrementAndGet(); }", "long getSeqnum();", "long getSeqnum();", "long getSeqnum();", "long getSeqnum();", "long getSeqnum();", "long getSeqnum();", "long getSeqnum();", "public Integer getFileNo() {\n return fileNo;\n }", "public int getSerialNum()\r\n\t{\r\n\t\treturn(serialNum);\r\n\t}", "private String generateOrderNumber() {\n return OBJ_PREFIX + ID_GENERATOR.getAndIncrement();\n }", "@Field(3) \n\tpublic int SequenceNo() {\n\t\treturn this.io.getIntField(this, 3);\n\t}", "private synchronized int getNewTransactionId() throws IOException {\n File file = new File(TA_ID_FILE_NAME);\n int transactionId = 0;\n\n if (file.exists()) {\n FileReader freader = new FileReader(file);\n BufferedReader breader = new BufferedReader(freader);\n\n String stringtaid = breader.readLine();\n transactionId = Integer.parseInt(stringtaid);\n\n breader.close();\n } else {\n file.createNewFile();\n }\n\n FileWriter writer = new FileWriter(TA_ID_FILE_NAME);\n writer.write(Integer.toString(transactionId + 1));\n writer.close();\n\n return transactionId;\n }", "static synchronized long getNextSeqNumber() {\n return seqNumber++;\n }", "public AtomicInteger getAtomicId() { return this.atomicId; }", "public java.math.BigInteger getSerialNumber() {\r\n return serialNumber;\r\n }", "private long getSeqNum() throws Exception {\n\t\tSystem.out.println(\"seq: \" + seq);\n\t\tif (seq == 256) {\n\t\t\tseq = 0;\n\t\t}\n\t\treturn seq++;\n\t}", "private String sequenceNumberGenerator() {\n\t\tint sequenceId = 0;\n\t\tRid entity = null;\n\t\ttry {\n\t\t\tentity = ridRepository.findLastRid();\n\t\t} catch (DataAccessException | DataAccessLayerException e) {\n\t\t\tthrow new RidException(RidGeneratorExceptionConstant.RID_FETCH_EXCEPTION.getErrorCode(),\n\t\t\t\t\tRidGeneratorExceptionConstant.RID_FETCH_EXCEPTION.errorMessage, e);\n\t\t}\n\t\ttry {\n\t\t\tif (entity == null) {\n\t\t\t\tentity = new Rid();\n\t\t\t\tsequenceId = sequenceInitialValue;\n\t\t\t\tentity.setCurrentSequenceNo(sequenceInitialValue);\n\t\t\t\tridRepository.save(entity);\n\t\t\t} else {\n\t\t\t\tif (entity.getCurrentSequenceNo() == sequenceEndvalue) {\n\t\t\t\t\tsequenceId = sequenceInitialValue;\n\t\t\t\t\tridRepository.updateRid(sequenceInitialValue, entity.getCurrentSequenceNo());\n\t\t\t\t} else {\n\t\t\t\t\tsequenceId = entity.getCurrentSequenceNo() + 1;\n\t\t\t\t\tridRepository.updateRid(sequenceId, entity.getCurrentSequenceNo());\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (DataAccessException | DataAccessLayerException e) {\n\t\t\tthrow new RidException(RidGeneratorExceptionConstant.RID_UPDATE_EXCEPTION.getErrorCode(),\n\t\t\t\t\tRidGeneratorExceptionConstant.RID_UPDATE_EXCEPTION.errorMessage, e);\n\t\t}\n\t\treturn String.format(sequenceFormat, sequenceId);\n\t}", "long getNextSequenceNumber();", "long getSequenceNumber();", "public int getId() {\n // some code goes here\n int id = f.getAbsoluteFile().hashCode();\n //System.out.println(id);\n return id;\n }", "public int getSerialNumber() {\n\t\treturn serialNumber;\n\t}", "private static String getUniqueId()\n\t{\n\t\tfinal int limit = 100000000;\n\t\tint current;\n\t\tsynchronized (DiskFileItem.class)\n\t\t{\n\t\t\tcurrent = counter.nextInt();\n\t\t}\n\t\tString id = Integer.toString(current);\n\n\t\t// If you manage to get more than 100 million of ids, you'll\n\t\t// start getting ids longer than 8 characters.\n\t\tif (current < limit)\n\t\t{\n\t\t\tid = (\"00000000\" + id).substring(id.length());\n\t\t}\n\t\treturn id;\n\t}", "int getSequenceNumber();", "private synchronized int generateJobID() {\n\t\t/* generate JobID */\n\t\tint jobID = lastJobID;\n\t\tlastJobID += 1;\n\t\treturn jobID;\n\t}", "public static String createPID()\r\n\t{\r\n\t\tunique_count++;\r\n\t\tif(unique_count >= 100) unique_count = 0;\r\n\t\tString str_num = String.format(\"%02d\", unique_count);\r\n\t\t\r\n\t\tSimpleDateFormat dateFormat = new SimpleDateFormat(\"yyMMddHHmmss\");\r\n\t\tString pid = dateFormat.format(new Date()) + str_num;\r\n\t\treturn pid;\r\n\t}", "private long getNextSequenceNumber() {\n return System.nanoTime();\n }", "public static int getNumber(RandomAccessFile raf, int i) throws IOException {\n raf.seek(i*4);\n return raf.readInt();\n }", "public static int getFileID() {\n\t\treturn StringArray.fileID;\n\t}", "public BigInteger getSerialNumber() {\n return serialNumber;\n }", "public BigDecimal getSERIAL_NO() {\r\n return SERIAL_NO;\r\n }", "public BigDecimal getSERIAL_NO() {\r\n return SERIAL_NO;\r\n }", "private int aleatorizarNumero() {\n\t\tint aux;\n\t\taux = r.getIntRand(13) + 1;\n\t\treturn aux;\n\t}", "public byte get_seqnum() {\n return (byte)getSIntElement(offsetBits_seqnum(), 8);\n }", "public int getSeqNumber() {\n return buffer.getShort(2) & 0xFFFF;\n }", "public short getFileID() \r\n\t //@ requires [?f]valid_id(this);\r\n\t //@ ensures [f]valid_id(this);\r\n\t{\r\n\t\t////@ open [f]valid_id(this); // auto\r\n\t\treturn fileID;\r\n\t\t//@ close [f]valid_id(this);\r\n\t}", "public short getFileID() \r\n\t //@ requires [?f]valid_id(this);\r\n\t //@ ensures [f]valid_id(this);\r\n\t{\r\n\t\t////@ open [f]valid_id(this); // auto\r\n\t\treturn fileID;\r\n\t\t//@ close [f]valid_id(this);\r\n\t}", "public static int getFileNum(File f)\r\n\t{\r\n\t\tString fileStr = f.toString().substring(2);\r\n\t\t\r\n\t\tint num = Integer.parseInt(fileStr.substring(13, fileStr.length()-5));\r\n\t\treturn num;\r\n\t}", "public synchronized long getNextTransactionID(){\n\t\treturn this.id++;\n\t}", "public long getSerial() {\n\t\treturn this.serialNumber;\n\t}", "@Override\n public String generateUniqueID() {\n return LIBRARY_CODE + \"_B_\" + counter;\n }", "@Override\n public String generateUniqueID() {\n return LIBRARY_CODE + \"_B_\" + counter;\n }", "public long getSequenceNumber();", "java.lang.String getSerialNumber();", "java.lang.String getSerialNumber();", "public String getAndIncrement() {\n Integer value = transactionId.get();\n transactionId.set(value + 1);\n return String.format(\"T_%08d\", value);\n }", "public long sequenceNumber() {\n return sequenceNumber;\n }", "public String getFileNumber() {\n\t\treturn fileNumber;\n\t}", "public int genID() {\n int uid = this.hashCode();\n if (uid < 0) {\n uid = Math.abs(uid);\n uid = uid * 15551;\n }\n return uid;\n }", "protected long getRecordNumber() {\n\t\treturn _nextRecordNumber.getAndIncrement();\n\t}", "private int getNum() {\r\n int i = currentNum.incrementAndGet();\r\n if (i < 0)\r\n i = -i;\r\n return i % n;\r\n }", "public static int getNumeroId(){\r\n idConsecutivo++;\r\n return idConsecutivo;\r\n }", "private static int getNumber() {\n LOG.info(\"Generating Value\");\n return 1 / 0;\n }", "public long getOrderNumber() {\n return (long) (Math.random() * 999999999999L);\n }", "public int getSequenceNumber();", "public int getId() {\n // some code goes here\n \treturn m_f.getAbsoluteFile().hashCode();\n }", "private long generateID() {\n\t\treturn ++lastID;\n\t}", "static synchronized int nextID() {\n\t\treturn g_nID++;\n\t}", "private static synchronized String getNextID() {\r\n\t\tlastID = lastID.add(BigInteger.valueOf(1));\r\n\t\t\r\n\t\treturn lastID.toString();\r\n\t}", "public static long getID() {\n int localizador = 0;\n Long min = 1000000000L;\n Long max = 9999999999L;\n\n do {\n localizador = (int) Math.floor(Math.random() * (max - min + 1) + min);\n } while (Integer.toString(localizador).length() != 10);\n return localizador;\n }", "long getOriginseqnum();", "public Integer getCocSerialNo() {\n\t\treturn cocSerialNo;\n\t}", "public byte getSyncID() {\n synchronized (this.syncID) {\n return this.syncID[0];\n }\n }", "@Transactional\n\tpublic String generateJobNumber(CorporateEntity corporateEntity){\n\t\tDocumentNumber docNo = null;\n\t\tString jobNumber = null;\n\n\t\tdocNo = documentNumberDAO.findById(new DocumentNumberPK(corporateEntity.getCorpId(), DocumentNumberDAO.DOMAIN_FLEET_MAINTENANCE)).orElse(null);\t\t\n\t\n\t\tjobNumber = docNo.getPreFix() + String.format(\"%08d\", docNo.getNextNo());\n\t\t\n\t\tdocNo.setNextNo(docNo.getNextNo() + 1);\n\t\tdocNo = documentNumberDAO.saveAndFlush(docNo);\t\n\t\t\n\t\treturn jobNumber;\n\t}", "public long getSequenceNum() {\n return sequenceNum;\n }", "private String genrateOrderTrakingnumber() {\n return UUID.randomUUID().toString();\n }", "public int getId() {\n // some code goes here\n return f.getAbsoluteFile().hashCode();\n //throw new UnsupportedOperationException(\"implement this\");\n }", "public short getFileID() \r\n\t //@ requires [?f]valid_id(this);\r\n\t //@ ensures [f]valid_id(this);\r\n\t{\r\n\t\t////@ open [f]valid_id(this); // auto\r\n\t\tFile thiz = this;\r\n\t\treturn fileID;\r\n\t\t//@ close [f]valid_id(this); // todo\r\n\t}", "public int getSeqNo();", "public int getSeqNo();", "public static int size_seqnum() {\n return (8 / 8);\n }", "private synchronized int getNewLSN() throws IOException {\n File file = new File(LSN_FILE_NAME);\n int lsn = 0;\n\n if (file.exists()) {\n FileReader freader = new FileReader(file);\n BufferedReader breader = new BufferedReader(freader);\n\n String stringlsn = breader.readLine();\n lsn = Integer.parseInt(stringlsn);\n\n breader.close();\n } else {\n file.createNewFile();\n }\n\n FileWriter writer = new FileWriter(LSN_FILE_NAME);\n writer.write(Integer.toString(lsn + 1));\n writer.close();\n\n return lsn;\n }", "public int get_infos_seq_num() {\n return (int)getUIntBEElement(offsetBits_infos_seq_num(), 16);\n }", "public long getAtomicLong(){return atomicLong.incrementAndGet();}", "private int read_int(RandomAccessFile file) throws IOException {\n int number = 0;\n for (int i = 0; i < 4; ++i) {\n number += (file.readByte() & 0xFF) << (8 * i);\n }\n return number;\n }", "public static int offset_seqnum() {\n return (264 / 8);\n }", "private static int nextInstanceID()\n {\n return baseID.incrementAndGet();\n }", "public static String generateMfactID() {\n\tmfactID++;\n\treturn String.valueOf(mfactID);\n }", "public String generateReferenceId(){\n String lastSequenceNumber = databaseAccessResource.getLastRequestSequenceNumber();\n //ToDo : write the logic to generate the next sequence number.\n return null;\n }", "public int id() {\n return _num;\n }", "public int getSequenceNumber() {\n return mSequenceGenerator.incrementAndGet();\n }", "int getTransactionNum();", "public int getSequenceNum() {\n\t\treturn sequenceNumber;\n\t}", "private Long createId() {\n return System.currentTimeMillis() % 1000;\n }", "protected void incrementSeqNum() {\n intToNetworkByteOrder(mySeqNum++, sequenceNum, 0, 4);\n }", "private static int nextID() {\r\n\t\treturn ID++;\r\n\t}", "public String getNextIdentifier() {\r\n if (!vocabularyFolder.isNumericConceptIdentifiers()) {\r\n return \"\";\r\n } else {\r\n try {\r\n int identifier = vocabularyService.getNextIdentifierValue(vocabularyFolder.getId());\r\n return Integer.toString(identifier);\r\n } catch (ServiceException e) {\r\n LOGGER.error(e);\r\n return \"\";\r\n }\r\n }\r\n }", "public long getSequenceNo() {\n\treturn sequenceNo;\n }", "@Override\n \tpublic long getLatestSequenceNumber() {\n \t\tsharedLock.lock();\n \t\ttry {\n \t\t\treturn sequenceNumber;\n \t\t} finally {\n \t\t\tsharedLock.unlock();\n \t\t}\n \t}", "public byte getISerialNumber() {\r\n\t\treturn iSerialNumber;\r\n\t}", "public synchronized int getiNumber(String fileName, boolean fCreate)\n {\n int iNumber = -1;\n int firstEmpty = -1;\n\n // Bad parameter\n if (fileName == null)\n {\n return -1;\n }\n\n // Return an error if the filename is too long\n if (fileName.length() > maxChars)\n {\n return -1;\n }\n\n // Must provide at least one character\n if (fileName.length() < 1)\n {\n return -1;\n }\n \n // Search the vector for the filename, \n // keeping track of the first empty element\n for (int i = 0; i < files.size(); i++)\n {\n if (files.get(i).equals(fileName))\n {\n iNumber = i;\n break;\n }\n else if (files.get(i).equals(\"\") && firstEmpty < 0)\n { \n // Confirm that the Inode is not being used.\n // (Inodes with count > 0 that aren't in the\n // directory are probably marked for deletion)\n Inode inode = new Inode(i);\n\n if (inode.getCount() < 1)\n {\n firstEmpty = i;\n }\n }\n }\n\n // If the file cannot be found, create a new one \n // at the first empty element.\n if (iNumber < 0 && fCreate)\n {\n // Out of directory space\n if (firstEmpty < 0)\n {\n return -1;\n }\n \n // Add the listing\n iNumber = firstEmpty;\n files.removeElementAt(iNumber);\n files.add(iNumber, fileName);\n flush();\n }\n\n return iNumber;\n }", "private static int generateCircleId(){\n return snextCircleId.incrementAndGet();\n\n }", "private int randomHelper() {\n\t\tRandom rand = new Random();\n\t\tint randomNum = rand.nextInt((10000 - 1) + 1) + 1;\n\t\treturn randomNum;\n\t}", "public int getCSeqNumber() {\n return cSeqHeader.getSequenceNumber();\n }", "public String serialNumber() {\n return this.innerProperties() == null ? null : this.innerProperties().serialNumber();\n }", "public void getInteger(int seqid);" ]
[ "0.7231908", "0.7208971", "0.6658329", "0.63911015", "0.63605076", "0.63436496", "0.63436496", "0.63436496", "0.63436496", "0.63436496", "0.63436496", "0.63436496", "0.6294034", "0.6287157", "0.6237252", "0.6194156", "0.61812186", "0.61700994", "0.61528873", "0.61077666", "0.60992104", "0.60815", "0.6059671", "0.6051855", "0.6024592", "0.60158634", "0.600152", "0.5993662", "0.5992199", "0.5991009", "0.59862804", "0.5971339", "0.596083", "0.59483993", "0.594681", "0.594681", "0.59385395", "0.5926617", "0.59168094", "0.59147936", "0.59147936", "0.59139496", "0.5913076", "0.59014904", "0.5898044", "0.5898044", "0.588561", "0.58851653", "0.58851653", "0.58704466", "0.5864736", "0.5841681", "0.5837301", "0.5806901", "0.5792296", "0.5771759", "0.576497", "0.57580423", "0.5757825", "0.5757057", "0.5753287", "0.5746944", "0.5724118", "0.57206607", "0.56927353", "0.56753874", "0.56753844", "0.5668672", "0.5666256", "0.5659759", "0.56539047", "0.56192917", "0.56093776", "0.56093776", "0.56013334", "0.55941963", "0.55910176", "0.55751187", "0.5575037", "0.5570358", "0.5565822", "0.5565747", "0.5544504", "0.55409354", "0.55399156", "0.5539848", "0.55340165", "0.55339533", "0.5524614", "0.5523363", "0.5522947", "0.5521684", "0.5509237", "0.5503746", "0.54958606", "0.5490674", "0.5484481", "0.54815084", "0.54798895", "0.54767364" ]
0.69886076
2
Created by 35429 on 2017/5/23.
public interface IRegModel extends BaseModel { void sendValidateRequest(ValidateRequest validateRequest, OnRequestResponse<ValidateResponse> onRequestResponse); void sendRegRequest(RegRequest regRequest, OnRequestResponse<RegResponse> onRequestResponse); void sendValiadateConfirmRequest(RegRequest regRequest, OnRequestResponse<ValidateResponse> onRequestResponse); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void perish() {\n \n }", "private stendhal() {\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "public final void mo51373a() {\n }", "public void mo38117a() {\n }", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "private static void cajas() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "private void m50366E() {\n }", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "public void mo6081a() {\n }", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "private Rekenhulp()\n\t{\n\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n public void init() {\n }", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n void init() {\n }", "public void gored() {\n\t\t\n\t}", "private void kk12() {\n\n\t}", "public void mo55254a() {\n }", "public Pitonyak_09_02() {\r\n }", "public void mo21877s() {\n }", "private void poetries() {\n\n\t}", "@Override\n\tpublic void jugar() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n protected void initialize() {\n\n \n }", "Petunia() {\r\n\t\t}", "public void mo12930a() {\n }", "@Override\n public void memoria() {\n \n }", "@Override\n\tpublic void nghe() {\n\n\t}", "private void init() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n public void init() {}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n public void init() {\n\n }", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic int mettreAJour() {\n\t\treturn 0;\n\t}", "public void mo21779D() {\n }", "protected void mo6255a() {\n }", "public void mo3376r() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void init() {}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "public void mo12628c() {\n }", "@Override\n protected void init() {\n }", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "public void mo21825b() {\n }", "private UsineJoueur() {}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "public void mo9848a() {\n }", "public void mo21878t() {\n }", "@Override\n protected void initialize() \n {\n \n }", "public void mo1531a() {\n }", "public abstract void mo70713b();", "@Override\n public int describeContents() { return 0; }", "public void m23075a() {\n }", "public void mo21793R() {\n }", "public final void mo91715d() {\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}" ]
[ "0.60417867", "0.60226214", "0.5819325", "0.57995284", "0.57687914", "0.5734733", "0.5734733", "0.5721508", "0.5709466", "0.57054216", "0.5689862", "0.5680437", "0.565743", "0.5646657", "0.56194866", "0.5604376", "0.5599708", "0.5599571", "0.55981046", "0.55958307", "0.5582258", "0.5582258", "0.5582258", "0.5582258", "0.5582258", "0.5582258", "0.5582258", "0.5575171", "0.55672497", "0.55672497", "0.55583715", "0.55489546", "0.55344486", "0.5522899", "0.5519565", "0.55029845", "0.5498969", "0.5492569", "0.5492569", "0.5492569", "0.5492569", "0.5492569", "0.5490219", "0.5488559", "0.5485379", "0.54795706", "0.54745555", "0.5473966", "0.54705936", "0.546484", "0.5460632", "0.54463816", "0.5438935", "0.5434141", "0.54266006", "0.5422721", "0.5421692", "0.54212177", "0.541664", "0.5414495", "0.54116935", "0.5400065", "0.5400065", "0.53970927", "0.53970927", "0.53970927", "0.5390126", "0.538479", "0.5378145", "0.537032", "0.53660536", "0.53660536", "0.53660536", "0.53660536", "0.53660536", "0.53660536", "0.5360491", "0.5360491", "0.5360491", "0.53604686", "0.53579533", "0.5357487", "0.5354405", "0.535419", "0.53471047", "0.53459954", "0.53459954", "0.53459954", "0.53457296", "0.53451633", "0.5342376", "0.5336664", "0.5333072", "0.533057", "0.5330113", "0.5326017", "0.5318689", "0.53162736", "0.5314167", "0.53088427", "0.5304471" ]
0.0
-1
Created by Mark on 11.11.2016.
public interface UserDao extends EntityDao<User> { User findByLogin(String login); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void perish() {\n \n }", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "private stendhal() {\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n public void init() {\n\n }", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n public int describeContents() { return 0; }", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n protected void initialize() {\n\n \n }", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "public final void mo51373a() {\n }", "@Override\n public void init() {\n }", "@Override\n void init() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n public void init() {}", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\r\n\tpublic void init() {}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n public void init() {\n\n }", "@Override\n public void init() {\n\n }", "@Override\n protected void init() {\n }", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "private void init() {\n\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "private void poetries() {\n\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "protected boolean func_70814_o() { return true; }", "@Override\n public void initialize() { \n }", "public void gored() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\n\tpublic void jugar() {\n\t\t\n\t}", "@Override\n\tpublic void init()\n\t{\n\n\t}", "private static void cajas() {\n\t\t\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "public void mo38117a() {\n }", "@Override\n\tprotected void initialize() {\n\t}", "@Override\n\tprotected void initialize() {\n\t}", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\n public void initialize() {}", "@Override\n public void initialize() {}", "@Override\n public void initialize() {}", "@Override\n\t\tpublic void init() {\n\t\t}", "private void m50366E() {\n }", "@Override public int describeContents() { return 0; }", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\n public void init() {\n }", "private Rekenhulp()\n\t{\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\tpublic void einkaufen() {\n\t}", "private MetallicityUtils() {\n\t\t\n\t}", "@Override\n public void initialize() {\n \n }", "@Override\n public int getSize() {\n return 1;\n }", "public void mo4359a() {\n }", "@Override\n\tpublic void initialize() {\n\t\t\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "private void kk12() {\n\n\t}", "@Override\r\n\tpublic final void init() {\r\n\r\n\t}", "protected MetadataUGWD() {/* intentionally empty block */}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\n public int retroceder() {\n return 0;\n }", "private void init() {\n\n\n\n }", "@Override\r\n\tprotected void doF4() {\n\t\t\r\n\t}" ]
[ "0.5918705", "0.5791732", "0.5750797", "0.57348233", "0.5624454", "0.5624454", "0.5615384", "0.56021124", "0.5597179", "0.55550164", "0.55420846", "0.55420846", "0.55420846", "0.55420846", "0.55420846", "0.55402434", "0.5529783", "0.55282986", "0.5527451", "0.5520724", "0.5518155", "0.55163205", "0.5497052", "0.54918444", "0.54918444", "0.54918444", "0.54918444", "0.54918444", "0.54918444", "0.54777443", "0.5474934", "0.5474934", "0.54746413", "0.5470825", "0.54605955", "0.5460091", "0.5439146", "0.54369044", "0.5426883", "0.54247177", "0.54204327", "0.54204327", "0.5409597", "0.5409154", "0.5403953", "0.5403953", "0.5403953", "0.5402027", "0.5397494", "0.5397494", "0.5397494", "0.5396251", "0.5385946", "0.5385946", "0.5385946", "0.53832144", "0.53692317", "0.5360501", "0.5348941", "0.53475654", "0.53468806", "0.5342592", "0.5339083", "0.5337478", "0.53308713", "0.53251195", "0.53171885", "0.53016186", "0.5297968", "0.5297968", "0.5291903", "0.52762496", "0.52761835", "0.52761835", "0.52748543", "0.52696854", "0.52695036", "0.5266053", "0.5266053", "0.5266053", "0.525932", "0.52531224", "0.52523017", "0.5243987", "0.52322954", "0.52262044", "0.5213752", "0.52064145", "0.51978064", "0.51944005", "0.51913124", "0.5191196", "0.5182514", "0.51807636", "0.51802623", "0.5178755", "0.51768774", "0.51671493", "0.5161693", "0.5158272", "0.5152646" ]
0.0
-1
excelHandle.copyExcelFristRun(); excelHandle.copyExcelFristRun(); excelHandle.copyExcelSecondRun(); excelHandle.getNameByPackage(Constant.excel_topapps, Constant.txt_openFail, 17541, 22541); excelHandle.snFindID(Constant.excel_topapps, "C:\\Users\\zhaoguofeng\\Desktop\\temp.txt", 3); excelHandle.snFindID(Constant.excel_topapps, Constant.txt_inexitApk); excelHandle.packageFindApkName(Constant.serverPath, false, "C:\\Users\\zhaoguofeng\\Desktop\\temp.txt"); excelHandle.genDownload(Constant.excel_topapps); excelHandle.packageFindApkName(Constant.serverPath, "E:\\3W_Apps\\temp.xls"); excelHandle.packageFindApkName(Constant.serverPath, "E:\\3W_Apps\\20150828\\fold_TextExcel\\3wflyme4.xls"); excelHandle.nameFindPackage(Constant.excel_topapps, Constant.fold_TextExcel + "flyme5_iof.xls", 3);
public static void main(String args[]) { excelHandle.genExecl(Constant.excel_topapps, Constant.excel_inexitApk, Constant.txt_inexitApk); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void main(String[] args) throws Exception {\n\t\tSystem.setProperty(\"webdriver.chrome.driver\", \"C:\\\\chromedriver.exe\");\r\n\t\t\t\t\r\n\t\tFile src = new File (\"C:\\\\Users\\\\vkoloyu\\\\test.xlsx\");\r\n\t\t//input stream class\r\n\t\tFileInputStream fis = new FileInputStream (src);\r\n\t\t//load full workbook XSSF by xlsx\r\n\t\tXSSFWorkbook wb = new XSSFWorkbook(fis);\r\n\t\t//focus on sheet1 index0\r\n\t\tXSSFSheet sheet1 = wb.getSheetAt(0);\r\n\t\t\r\n\t\t\r\n\tRun r = new Run();\r\n\t\r\n\t\r\n\t\r\n\t\r\n\tfor (int i=0; i<3; i++){\r\n\t\r\n\tString em = (i+\"[email protected]\");\r\n\tsheet1.createRow(i+1).createCell(0).setCellValue(em);\r\n\tFileOutputStream fout = new FileOutputStream (src);\r\n\twb.write(fout);\r\n\tr.run(em, \"fghfghghjghk\");\r\n\t\r\n\t\r\n\t\r\n\t}\r\n\twb.close();\r\n\t\r\n\t\t\r\n\t\r\n\t\r\n\t\r\n\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t}", "public static void main(String[] args) throws Exception {\n\t\t\tfor (int k = 1; k<= 8; k++) \r\n\t\t\t{\r\n\t\t\t\tAVIS.CommonFunctions.ReadWriteExcel rw = new AVIS.CommonFunctions.ReadWriteExcel(\"C:\\\\Downloads\\\\Selenium\\\\AVIS\\\\TestData\\\\AVIS_GUIDelayed_CheckOut.xlsx\");\r\n\t\t\t\tString TestExecute = rw.getCellData(\"Avis_GUI\", k ,2);\r\n\t\t\t\r\n\t\t\t\tif (TestExecute.equals(\"Y\"))\r\n\t\t\t\t{\t\r\n\t\t\t\tString Testcasename =rw.getCellData(\"Avis_GUI\", k, 4);\r\n\t\t\t\tString TestUrl = rw.getCellData(\"Avis_GUI\", k, 7);\r\n\t\t\t\tString TestStn = rw.getCellData(\"Avis_GUI\", k, 8);\r\n\t\t\t\tString Testqauser = rw.getCellData(\"Avis_GUI\", k, 9);\r\n\t\t\t\tString Testqapwd = rw.getCellData(\"Avis_GUI\", k, 10);\r\n\t\t\t\tString LastName = rw.getCellData(\"Avis_GUI\", k, 11);\r\n\t\t\t\tString FirstName = rw.getCellData(\"Avis_GUI\", k, 12);\r\n\t\t\t\tString CheckOutDate = rw.getCellData(\"Avis_GUI\", k, 13);\r\n\t\t\t\tString CheckOutTime = rw.getCellData(\"Avis_GUI\", k, 14);\r\n\t\t\t\tString InStation = rw.getCellData(\"Avis_GUI\", k, 15);\r\n\t\t\t\tString CheckInDate = rw.getCellData(\"Avis_GUI\", k, 16);\r\n\t\t\t\tString CheckInTime = rw.getCellData(\"Avis_GUI\", k, 17);\r\n\t\t\t\tString CarGroup = rw.getCellData(\"Avis_GUI\", k, 18);\r\n\t\t\t\tString Awd = rw.getCellData(\"Avis_GUI\", k, 19);\r\n\t\t\t\tString CreditDeb_Card = rw.getCellData(\"Avis_GUI\", k, 20);\r\n\t\t\t\tString CardNumber = rw.getCellData(\"Avis_GUI\", k, 21);\r\n\t\t\t\tString Month = rw.getCellData(\"Avis_GUI\", k, 22);\r\n\t\t\t\tString Year = rw.getCellData(\"Avis_GUI\", k, 23);\r\n\t\t\t\tString Reason = rw.getCellData(\"Avis_GUI\", k, 24);\r\n\t\t\t\tString Insurance = rw.getCellData(\"Avis_GUI\", k, 25);\r\n\t\t\t\tString Counterproduct = rw.getCellData(\"Avis_GUI\", k, 26);\r\n\r\n\t\t\t//System.out.println(\"Test case name is :\" +TestCaseName);\r\n\t\t\tThread.sleep(5000);\r\n\t\t\tSystem.setProperty(\"webdriver.chrome.driver\", \"C:\\\\Downloads\\\\Selenium\\\\chromedriver.exe\");\r\n\t\t\tChromeOptions options = new ChromeOptions(); \r\n\t\t\toptions.addArguments(\"disable-infobars\"); \r\n\t\t\tWebDriver driver=new ChromeDriver(options);\r\n\t\t\t//String TestUrlEnd = TestUrl+TestStn;\r\n\t\t\tdriver.get(\"https://uat.ccrgservices.com/wizardgui/ui/wizard.jsf?mnemonic=jfk\");\r\n\t\t\tdriver.manage().window().maximize();\r\n\t\t\tAVIS.CommonFunctions.GUIFunctions functions = new AVIS.CommonFunctions.GUIFunctions(driver);\r\n\t\t\t//functions.link(tokenURL, thinClient);\r\n\t\t\t/* Login */\r\n\t\t\tfunctions.login(Testqauser, Testqapwd);\r\n\t\t\t//functions.login(\"qa.user\", \"Avis2018#\");\r\n\t\t\tdriver.navigate().refresh();\r\n\t\t\t\r\n\t\t\r\n\t\t\tThread.sleep(5000);\r\n\t\t\tdriver.findElement(By.xpath(\"//input[@id='searchString']\")).sendKeys(\"0988-6083-US-4\");\r\n\t\t\tThread.sleep(5000);\r\n\t\t\tdriver.findElement(By.xpath(\"//input[@id='searchCommandLink']\")).click();\r\n\t\t\tThread.sleep(5000);\r\n\t\t\tdriver.findElement(By.xpath(\"//span[@id='delayBtn']\")).click();\r\n\t\t\t//Ra number\r\n\t\t\t//\r\n\t\t\t//701215944\r\n\t\t\tdriver.findElement(By.xpath(\"//input[@id='menulist:checkoutContainer:checkoutForm:raNo']\")).sendKeys(\"701215933\");\r\n\t\t\t//agent Id\r\n\t\t\tdriver.findElement(By.xpath(\"//input[@id='menulist:checkoutContainer:checkoutForm:agentId']\")).sendKeys(\"12345\");\r\n\t\t\t//outdate\r\n\t\t\t//input[@id='menulist:checkoutContainer:checkoutForm:outdate1_hid']\r\n\t\t\t//checkoutdate\r\n\t\t\tdriver.findElement(By.xpath(\"//input[@id='menulist:checkoutContainer:checkoutForm:outdate1_hid']\")).sendKeys(\"10/07/18\");\r\n\t\t\t//checkintime\r\n\t\t\tdriver.findElement(By.xpath(\"//input[@id='menulist:checkoutContainer:checkoutForm:outdate2']\")).sendKeys(\"10:00 AM\");\r\n\t\t\t//MVA number\r\n\t\t\tdriver.findElement(By.xpath(\"//div[@ng-show='!isOffline']//input[@id='menulist:checkoutContainer:checkoutForm:mvaOrParkingSpace']\")).sendKeys(\"\");\r\n\t\t\t//mileage\r\n\t\t\tdriver.findElement(By.xpath(\"//input[@id='menulist:checkoutContainer:checkoutForm:mileage']\")).sendKeys(\"\");\r\n\t\t\t\r\n\t\t\t//div[@id='ajaxStatusPanel']//div[@class='modal-body']\r\n\t\t\t//click on delay continue\r\n\t\t\tdriver.findElement(By.xpath(\"//input[@id='footerForm:continueVehicleDelayButton']\")).click();\r\n\t\t\tdriver.findElement(By.xpath(\"//div[@ng-show='!isOffline']//input[@id='menulist:checkoutContainer:checkoutForm:mvaOrParkingSpace']\")).sendKeys(\"64459010\");\r\n\t driver.findElement(By.xpath(\"//input[@id='menulist:checkoutContainer:checkoutForm:mileage']\")).click();\r\n\t driver.findElement(By.xpath(\"//input[@id='menulist:checkoutContainer:checkoutForm:mileage']\")).clear();\r\n\t driver.findElement(By.xpath(\"//input[@id='menulist:checkoutContainer:checkoutForm:mileage']\")).sendKeys(\"1200\");\r\n\t \r\n\t\t\t}\r\n\t\t }\r\n\t\t}", "public static void main(String[] args) throws Exception {\r\n\t\t\r\n\t\tAccessDBParser.doInit();\r\n\t\t\r\n//\t\tString ff0812A = \"D:/ForBdcom/0812_PP/0812A.xlsx\";\r\n//\t\tString ff0812B = \"D:/ForBdcom/0812_PP/0812B.xlsx\";\r\n//\t\t\r\n//\t\tString ff0813A = \"D:/ForBdcom/0813_PP/0813A1.xlsx\";\r\n//\t\tString ff0813B = \"D:/ForBdcom/0813_PP/0813B1.xlsx\";\r\n//\t\t\r\n//\t\tString ff0814A = \"D:/ForBdcom/0814_PP/0814A.xlsx\";\r\n//\t\tString ff0814B = \"D:/ForBdcom/0814_PP/0814B.xlsx\";\r\n\t\t\r\n//\t\tString ff0815A = \"D:/ForBdcom/0815_PP/0815A.xlsx\";\r\n//\t\tString ff0815B = \"D:/ForBdcom/0815_PP/0815B.xlsx\";\r\n\t\t\r\n//\t\tString ff0819A = \"D:/ForBdcom/0819_PP/0819A.xlsx\";\r\n//\t\tString ff0819B = \"D:/ForBdcom/0819_PP/0819B.xlsx\";\r\n\t\t\r\n\t\tString ff0820A = \"D:/ForBdcom/0820_PP/0820A.xlsx\";\r\n\t\tString ff0821A = \"D:/ForBdcom/0821_PP/0821A.xlsx\";\r\n\t\tString ff0822A = \"D:/ForBdcom/0822_PP/0822A.xlsx\";\r\n\t\t\r\n\t\tdoParse(ff0820A);\r\n\t\tdoParse(ff0821A);\r\n\t\tdoParse(ff0822A);\r\n\t\t\r\n\t\tSystem.out.println( KWObj.pnnullCounter );\r\n\r\n\t\t\r\n\t}", "public void startTest() throws Throwable\n {\n ExcelFileUtil excel= new ExcelFileUtil();\n // iterate all row in masterTestCases sheet\n\n for(int i=1;i<=excel.rowCount(\"MasterTestCases\");i++)\n {\n String ModuleStatus=\"\";\n if(excel.getData(\"MasterTestCases\", i, 2).equalsIgnoreCase(\"Y\"))\n {\n //store module name to TCModule\n String TCModule =excel.getData(\"MasterTestCases\", i, 1);\n report=new ExtentReports(\"./Reports/\"+TCModule+Muvi_Functions.generateDate()+\".html\");\n //iterate all rows in TCModule\n for(int j=1;j<=excel.rowCount(TCModule);j++)\n {\n test=report.startTest(TCModule);\n //read al the columns from TCMocule\n String Description=excel.getData(TCModule, j, 0);\n String Object_Type=excel.getData(TCModule, j, 1);\n String Locator_Type=excel.getData(TCModule, j, 2);\n String Locator_Value=excel.getData(TCModule, j, 3);\n String Test_Data=excel.getData(TCModule, j, 4);\n //System.out.println(Description+\" \"+Object_Type);\n //calling the method from function library\n try{\n if(Object_Type.equalsIgnoreCase(\"startBrowser\"))\n {\n System.out.println(\"Executing startBroswer\");\n driver= Muvi_Functions.startBrowser(driver);\n System.out.println(\"Executing startBroswer\");\n }else if (Object_Type.equalsIgnoreCase(\"openApplication\"))\n {\n Muvi_Functions.openApplication(driver);\n test.log(LogStatus.INFO, Description);\n System.out.println(\"Executing openApplication\");\n }else if (Object_Type.equalsIgnoreCase(\"waitForElement\"))\n {\n Muvi_Functions.waitForElement(driver, Locator_Type, Locator_Value, Test_Data);\n test.log(LogStatus.INFO, Description);\n System.out.println(\"Executing waitForElement\");\n }else if (Object_Type.equalsIgnoreCase(\"typeAction\"))\n {\n Muvi_Functions.typeAction(driver, Locator_Type, Locator_Value, Test_Data);\n test.log(LogStatus.INFO, Description);\n System.out.println(\"Executing typeAction\");\n }else if (Object_Type.equalsIgnoreCase(\"clickAction\"))\n {\n Muvi_Functions.clickAction(driver, Locator_Type, Locator_Value);\n test.log(LogStatus.INFO, Description);\n System.out.println(\"Executing clickAction\");\n }else if (Object_Type.equalsIgnoreCase(\"selectAction\"))\n {\n Muvi_Functions.selectAction(driver, Locator_Type, Locator_Value);\n test.log(LogStatus.INFO, Description);\n System.out.println(\"Executing selectAction\");\n } else if (Object_Type.equalsIgnoreCase(\"selectStartDate\"))\n {\n Muvi_Functions.selectStartDate(driver, Locator_Type, Locator_Value);\n test.log(LogStatus.INFO, Description);\n System.out.println(\"Executing selectStartDate\");\n }\n else if (Object_Type.equalsIgnoreCase(\"switchWindow\"))\n {\n Muvi_Functions.switchWindow(driver);\n test.log(LogStatus.INFO, Description);\n System.out.println(\"Executing switchWindow\");\n }else if (Object_Type.equalsIgnoreCase(\"isElementVisible\"))\n {\n Muvi_Functions.isElementVisible(driver, Locator_Type, Locator_Value);\n test.log(LogStatus.INFO, Description);\n System.out.println(\"Executing isElementVisible\");\n }else if (Object_Type.equalsIgnoreCase(\"hoverOver\"))\n {\n Muvi_Functions.hoverOver(driver, Locator_Type, Locator_Value);\n test.log(LogStatus.INFO, Description);\n System.out.println(\"Executing hoverOver\");\n }else if (Object_Type.equalsIgnoreCase(\"uploadTopBanner\"))\n {\n Muvi_Functions.uploadTopBanner(driver);\n test.log(LogStatus.INFO, Description);\n System.out.println(\"Executing uploadTopBanner\");\n }\n else if (Object_Type.equalsIgnoreCase(\"uploadPoster\"))\n {\n Muvi_Functions.uploadPoster(driver);\n test.log(LogStatus.INFO, Description);\n System.out.println(\"Executing uploadPoster\");\n }\n else if (Object_Type.equalsIgnoreCase(\"profilePicture\"))\n {\n Muvi_Functions.profilePicture(driver);\n test.log(LogStatus.INFO, Description);\n System.out.println(\"Executing profilePicture\");\n }\n else if (Object_Type.equalsIgnoreCase(\"uploadVideo\"))\n {\n Muvi_Functions.uploadVideo(driver);\n test.log(LogStatus.INFO, Description);\n System.out.println(\"Executing uploadVideo\");\n }\n else if (Object_Type.equalsIgnoreCase(\"verifyUpload\"))\n {\n Muvi_Functions.verifyUpload(driver);\n test.log(LogStatus.INFO, Description);\n System.out.println(\"Executing verifyUpload\");\n }\n\n else if (Object_Type.equalsIgnoreCase(\"closeBrowser\"))\n {\n Muvi_Functions.closeBrowser(driver);\n test.log(LogStatus.INFO, Description);\n System.out.println(\"Executing closeBrowser\");\n }\n\n\n //write as pass into status column\n excel.setCellData(TCModule, j, 5, \"PASS\");\n test.log(LogStatus.PASS, Description);\n ScreenShot.Takescreen(driver,Description);\n ModuleStatus=\"TRUE\";\n\n }\n catch(Exception e)\n {\n excel.setCellData(TCModule, j, 5, \"FAIL\");\n ModuleStatus=\"FALSE\";\n if(ModuleStatus.equalsIgnoreCase(\"FALSE\"))\n {\n excel.setCellData(\"MasterTestCases\", i, 3, \"FAIL\");\n Thread.sleep(2000);\n test.log(LogStatus.FAIL, \"Test Fail\");\n ScreenShot.Takescreen(driver,Description);\n }\n System.out.println(e.getMessage());\n break;\n }\n if(ModuleStatus.equalsIgnoreCase(\"TRUE\"))\n {\n excel.setCellData(\"MasterTestCases\", i, 3, \"PASS\");\n }\n report.flush();//push reports to html\n report.endTest(test);\n }\n\n }\n else\n {\n //write as not executed in master testcases in status coulmn for flag N\n excel.setCellData(\"MasterTestCases\", i,3, \"Not Executed\");\n\n }\n }\n }", "public static void main(String[] args) throws Exception {\n\n insureExcelType(\"F:/AAA/QP2-04 附录 A 产品申请表 10.xlsx\");\n// String cellValueAt = getCellValueAt(15,8);\n// String cellValueAt1 = getCellValueAt(29,10);\n// String cellValueAt2 = getCellValueAt(30,10);\n// System.out.println(cellValueAt);\n// System.out.println(cellValueAt1);\n// System.out.println(cellValueAt2);\n\n// setCellValueAt(16, 10, new Date());\n// fileOutPut(\"F:/\",\"yyy.xlsx\");\n\n\n String path = \"F:\\\\壁纸\\\\timg (3).jpg\";\n setImg(path, 30, 34, 0, 4);\n\n// String cellValueAt = getCellValueAt(1, 27, 5);\n// System.out.println(cellValueAt);\n// setCellValueAt(1, 28, 5, new Date());\n fileOutPut(\"F:/\",\"yyy.xlsx\");\n\n }", "public void main(String[] args) throws Exception {\n\t\t\r\n\t\t\r\n File src= new File(\"C:/data.xls\");\r\n System.out.println(\"Excel located\");\r\n \r\n Workbook wb=Workbook.getWorkbook(src);\r\n Sheet sheet=wb.getSheet(0);\r\n System.out.println(\"Workbook loaded\");\r\n \r\n/* String data00=wb.getSheet(0).getCell(0, 0).getContents();\r\n System.out.println(\"Data is \" +data00);\r\n \r\n String data01=wb.getSheet(0).getCell(1, 0).getContents();\r\n System.out.println(\"Data is \" +data01);*/\r\n \r\n int rowCount=sheet.getRows();\r\n \r\n for(int i=0; i<rowCount; i++)\r\n { \t\t\r\n \t System.setProperty(\"webdriver.chrome.driver\", \"C:\\\\Sid_Folder\\\\Selenium\\\\Chromedriver\\\\chromedriver_win32\\\\chromedriver.exe\");\r\n\t\t\tdriver=new ChromeDriver();\r\n\t\t\tdriver.manage().deleteAllCookies();\r\n\t\t\tdriver.manage().window().maximize();\r\n\t\t\tdriver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);\r\n\t\t\tdriver.manage().timeouts().pageLoadTimeout(30,TimeUnit.SECONDS);\r\n\t\t\t\r\n\t\t\tdriver.get(\"http://ttipsweb01q.tbccorp.com/ntwtips/\");\r\n\t\t\tThread.sleep(5000);\r\n \t String username= sheet.getCell(0, i).getContents();\r\n \t\tString password=sheet.getCell(1, i).getContents();\r\n\t\t\tdriver.findElement(By.id(\"fldAccount\")).sendKeys(username);\r\n\t\t\tdriver.findElement(By.id(\"fldPassword\")).sendKeys(password);\r\n\t\t\tdriver.findElement(By.xpath(\"//button[@type='submit']\")).click();\r\n System.out.println(\"username is\" +username);\r\n System.out.println(\"Password is\" +password);\r\n driver.close();\r\n }\r\n \r\n\t}", "public static void main(String[] args) {\n Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(),\n new ConfigurationActivator(),\n new StandaloneModeActivator(),\n new ModuleHealActivator(),\n new StateServiceActivator(),\n new ChartBaseActivator(),\n new SchedulerActivator(),\n new ReportBaseActivator(),\n new RestrictionActivator(),\n new ReportActivator(),\n new WriteActivator());\n SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl());\n String envpath = \"//Applications//FineReport10_325//webapps//webroot//WEB-INF\";\n SimpleWork.checkIn(envpath);\n I18nResource.getInstance();\n module.start();\n\n\n ResultWorkBook rworkbook = null;\n try {\n // read the workbook\n TemplateWorkBook workbook = TemplateWorkBookIO.readTemplateWorkBook(\"//doc//Primary//Parameter//Parameter.cpt\");\n // get the parameters and set value\n Parameter[] parameters = workbook.getParameters();\n parameters[0].setValue(\"华东\");\n // define a parameter map to execute the workbook\n java.util.Map parameterMap = new java.util.HashMap();\n for (int i = 0; i < parameters.length; i++) {\n parameterMap.put(parameters[i].getName(), parameters[i]\n .getValue());\n }\n\n FileOutputStream outputStream;\n\n // unaltered export to xls\n outputStream = new FileOutputStream(new File(\"//Users//susie//Downloads//ExcelExport.xls\"));\n ExcelExporter excel = new ExcelExporter();\n excel.setVersion(true);\n excel.export(outputStream, workbook.execute(parameterMap,new WriteActor()));\n\n // unaltered export to xlsx\n outputStream = new FileOutputStream(new File(\"//Users//susie//Downloads//ExcelExport.xlsx\"));\n StreamExcel2007Exporter excel1 = new StreamExcel2007Exporter();\n excel.export(outputStream, workbook.execute(parameterMap,new WriteActor()));\n\n // full page export to xls\n outputStream = new FileOutputStream(new File(\"//Users//susie//Downloads//PageExcelExport.xls\"));\n PageExcelExporter page = new PageExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(workbook.execute(parameterMap,new WriteActor())));\n page.setVersion(true);\n page.export(outputStream, workbook.execute(parameterMap,new WriteActor()));\n\n // full page export to xlsx\n outputStream = new FileOutputStream(new File(\"//Users//susie//Downloads//PageExcelExport.xlsx\"));\n PageExcel2007Exporter page1 = new PageExcel2007Exporter(ReportUtils.getPaperSettingListFromWorkBook(rworkbook));\n page1.export(outputStream, workbook.execute(parameterMap,new WriteActor()));\n\n // page to sheet export to xls\n outputStream = new FileOutputStream(new File(\"//Users//susie//Downloads//PageSheetExcelExport.xls\"));\n PageToSheetExcelExporter sheet = new PageToSheetExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(workbook.execute(parameterMap,new WriteActor())));\n sheet.setVersion(true);\n sheet.export(outputStream, workbook.execute(parameterMap,new WriteActor()));\n\n // page to sheet export to xlsx\n outputStream = new FileOutputStream(new File(\"//Users//susie//Downloads//PageSheetExcelExport.xlsx\"));\n PageToSheetExcel2007Exporter sheet1 = new PageToSheetExcel2007Exporter(ReportUtils.getPaperSettingListFromWorkBook(rworkbook));\n sheet1.export(outputStream, workbook.execute(parameterMap,new WriteActor()));\n\n // Large data volume export to xls\n outputStream = new FileOutputStream(new File(\"//Users//susie//Downloads//LargeExcelExport.zip\"));\n LargeDataPageExcelExporter large = new LargeDataPageExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(workbook.execute(parameterMap,new WriteActor())), true);\n\n // Large data volume export to xlsx\n // outputStream = new FileOutputStream(new File(\"//Users//susie//Downloads//LargeExcelExport.xlsx\"));\n // LargeDataPageExcel2007Exporter large = new LargeDataPageExcel2007Exporter(ReportUtils.getPaperSettingListFromWorkBook(rworkbook), true);\n large.export(outputStream, workbook.execute(parameterMap,new WriteActor()));\n\n outputStream.close();\n module.stop();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public static void main(String[] args) {\n\n String filePath = \"/Users/hubery/Desktop/泛金融销户/泛金融销户账户.xlsx\";\n String filePath1 = \"/Users/hubery/Desktop/泛金融销户/泛金融销户账户_bak.xlsx\";\n File excelFile = new File(filePath);\n\n try {\n Map<Integer, Map<Integer, Object>> content = readSheetContent(excelFile, 0);\n\n for (Map<Integer, Object> map : content.values()) {\n\n for (Object obj : map.values()) {\n System.out.print(obj + \"\\t\");\n }\n System.out.println();\n }\n\n writeNewSheet(new File(filePath1), content);\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n }", "private void Start() throws Exception, Throwable{\n \n POI poi = new POI();\n \n \n\n try //( InterfaceCon = orcTST.GetConnSession())\n {\n //Коннектимся к базам\n if (InterfaceCon == null)\n { \n //Ходим в фаил с коннектами получае параметры коннектимся к ORACLE \n InterfaceCon = OraConFile.get_connect_from_file(\"INTERFACE\");\n }\n\n \n //Работа авто шедулера, ставим отчеты в очередь по достижении определенного периода\n CallableStatement callableStatement = InterfaceCon.prepareCall(\"{call REPORTS_WORK.AUTO_SHEDULER }\");\n callableStatement.executeUpdate();\n callableStatement.close();\n\n \n \n //Коннект к базе по умолчанию \n v_REP_ID = 0; \n v_PC_OPER_ID =0 ; \n //\n // System.out.println(\"Проверка очереди отчетов!\");\n //\n Statement pst_param1 = InterfaceCon.createStatement();\n String query = \"SELECT to_number(pcp.value) as REP_ID, pc.id as OPER_ID \" +\n \" FROM PC_OPER pc , Pc_Oper_Params pcp \" +\n \" WHERE pc.op_status in ('ENTRY') \" +\n \" AND pc.op_code = 'CREATE_REPORT' \" +\n \" and pc.id = pcp.oid_pc_oper \" +\n \" and pcp.param = 'REP_ID' \" +\n \" and rownum = 1 \" +\n \" and pc.id not in (select t.oid_pc_oper as ID from REPORTS_RESULT t where t.oid_pc_oper = pc.id)\" ;\n \n //Получаем заказ отчета\n ResultSet resultSet1 = pst_param1.executeQuery(query) ;\n //Получаем заказ отчета\n while (resultSet1.next())\n {\n v_REP_ID = resultSet1.getInt(\"REP_ID\");\n v_PC_OPER_ID = resultSet1.getInt(\"OPER_ID\");\n } \n //Закрываем открытые курсоры, ORA-01000: количество открытых курсоров превысило допустимый максимум\n pst_param1.close();\n resultSet1.close();\n \n \n if ( v_REP_ID != 0 && v_PC_OPER_ID != 0)\n {\n //Создаем новый поток обработки отчета \n new Thread(() -> {\n try {\n //\n System.out.println(\"Обработка заказа \"+v_PC_OPER_ID+ \" начата\");\n //\n oper_log.set_log(v_PC_OPER_ID,\"Обработка заказа \"+v_PC_OPER_ID+ \" начата\");\n poi.GetblobExcel(v_REP_ID, v_PC_OPER_ID);\n \n //\n System.out.println(\"Обработка заказа \"+v_PC_OPER_ID+ \" завершена!!!!\");\n //\n oper_log.set_log(v_PC_OPER_ID,\"Обработка заказа \"+v_PC_OPER_ID+ \" завершена!!!!\");\n // orcTST.close(); \n v_REP_ID = 0;\n v_PC_OPER_ID =0 ;\n } catch (Throwable ex) {\n System.out.println(\"ошибка !!!!\"+ex.toString());\n \n Logger.getLogger(FiveMinuteSinhro.class.getName()).log(Level.SEVERE, null, ex.toString());\n try {\n oper_log.set_log( v_PC_OPER_ID,\"Ошибка! - \" + ex.toString());\n } catch (Throwable ex1) {\n Logger.getLogger(FiveMinuteSinhro.class.getName()).log(Level.SEVERE, null, ex1);\n }\n\n }\n }).start(); \n } \n \n } catch (Exception e) { \n System.out.println(\"Ошибка в методе Start с ошибкой\" +e.toString()); \n Logger.getLogger(FiveMinuteSinhro.class.getName()).log(Level.SEVERE, null, e.toString());\n try( Connection InterfaceCon1 = OraConFile.get_connect_from_file(\"INTERFACE\");)\n {\n InterfaceCon = null;\n try (CallableStatement callableStatement = InterfaceCon1.prepareCall(\"{call PC_OPER_WORK.PC_OPER_ERR (?, ?) }\")) {\n callableStatement.setInt(1, v_PC_OPER_ID);\n callableStatement.setString(2, e.toString());\n callableStatement.executeUpdate();\n }\n InterfaceCon1.close();\n InterfaceCon.close();\n } catch (Exception ex) \n { \n InterfaceCon = null; \n System.out.println(\"Ошибка в методе Start при попытке записать ошибку в базу с ошибкой\"+ex.toString()); \n \n Logger.getLogger(FiveMinuteSinhro.class.getName()).log(Level.SEVERE, null, ex.toString()); \n \n }\n } \n \n /* IMINCIDENTS inc = new IMINCIDENTS();\n IMPROBLEMS imp = new IMPROBLEMS();\n IMTASKS imt = new IMTASKS();\n RONTRANS rt = new RONTRANS();\n RONINKAS ron = new RONINKAS();\n AUDITMP am = new AUDITMP();\n AUDITFUNC af = new AUDITFUNC();\n AUDITACTION aa = new AUDITACTION();\n Ronevent rone = new Ronevent();\n LASTSTATUS last = new LASTSTATUS();*/\n /* new Thread(() -> {\n try {\n inc.take_IMINCIDENTS();\n } catch (Exception ex) {\n Logger.getLogger(FiveMinuteSinhro.class.getName()).log(Level.SEVERE, null, ex);\n }\n }).start(); \n new Thread(() -> {\n try {\n imp.take_IMPROBLEMS();\n } catch (Exception ex) {\n Logger.getLogger(FiveMinuteSinhro.class.getName()).log(Level.SEVERE, null, ex);\n }\n }).start(); \n new Thread(() -> {\n try {\n imt.take_IMTASKS();\n } catch (Exception ex) {\n Logger.getLogger(FiveMinuteSinhro.class.getName()).log(Level.SEVERE, null, ex);\n }\n }).start(); \n new Thread(() -> {\n try {\n rt.take_RONTRANS();\n } catch (Exception ex) {\n Logger.getLogger(FiveMinuteSinhro.class.getName()).log(Level.SEVERE, null, ex);\n }\n }).start(); \n new Thread(() -> {\n try {\n ron.take_RONINKAS();\n } catch (Exception ex) {\n Logger.getLogger(FiveMinuteSinhro.class.getName()).log(Level.SEVERE, null, ex);\n }\n }).start();\n new Thread(() -> {\n try {\n am.take_AUDITMP();\n } catch (Exception ex) {\n Logger.getLogger(FiveMinuteSinhro.class.getName()).log(Level.SEVERE, null, ex);\n }\n }).start();\n new Thread(() -> {\n try {\n af.take_AUDITFUNC();\n } catch (Exception ex) {\n Logger.getLogger(FiveMinuteSinhro.class.getName()).log(Level.SEVERE, null, ex);\n }\n }).start();\n new Thread(() -> {\n try {\n aa.take_AUDITACTION();\n } catch (Exception ex) {\n Logger.getLogger(FiveMinuteSinhro.class.getName()).log(Level.SEVERE, null, ex);\n }\n }).start();\n new Thread(() -> {\n try {\n rone.take_Ronevent();\n } catch (Exception ex) {\n Logger.getLogger(FiveMinuteSinhro.class.getName()).log(Level.SEVERE, null, ex);\n }\n }).start();\n new Thread(() -> {\n try {\n last.take_LASTSTATUS();\n } catch (Exception ex) {\n Logger.getLogger(FiveMinuteSinhro.class.getName()).log(Level.SEVERE, null, ex);\n }\n }).start();*/\n }", "public static void main(String[] args) throws IOException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {\n\n\t\tGmailMethodClass gm=new GmailMethodClass();\n\t\tMethod m[]=gm.getClass().getMethods();\n\t\t\n\t\tFileInputStream fis=new FileInputStream(\"‪‪C:\\\\Users\\\\RUHI\\\\Desktop\\\\Gmail.xlsx\");\n\t\tXSSFWorkbook wb=new XSSFWorkbook(fis);\n\t\tXSSFSheet rsh1=wb.getSheetAt(0);\n\t\tint nur1=rsh1.getPhysicalNumberOfRows();\n\t\t\n\t\tXSSFSheet rsh2=wb.getSheetAt(0);\n\t\tint nur2=rsh2.getPhysicalNumberOfRows();\n\t\tint nuc2=rsh2.getRow(0).getPhysicalNumberOfCells();\n\t\t\n\t\tfor(int i=1;i<nur1;i++) {\n\t\t\tString runmode=rsh1.getRow(i).getCell(2).getStringCellValue();\n\t\t\tString tid = rsh1.getRow(i).getCell(0).getStringCellValue();\n\t\t\t\n\t\t\tif(runmode.equalsIgnoreCase(\"yes\")){\n\t\t\t\tfor(int j=1;j<nur2;j++) {\n\t\t\t\t\tString sid=rsh2.getRow(j).getCell(0).getStringCellValue();\n\t\t\t\t\t\n\t\t\t\t\tif(tid.equalsIgnoreCase(sid)){\n\t\t\t\t\t\tString method=rsh2.getRow(j).getCell(2).getStringCellValue();\n\t\t\t\t\t\tString l=rsh2.getRow(j).getCell(3).getStringCellValue();\n\t\t\t\t\t\tString d=rsh2.getRow(j).getCell(4).getStringCellValue();\n\t\t\t\t\t\tString c=rsh2.getRow(j).getCell(5).getStringCellValue();\n\t\t\t\t\t\t\n\t\t\t\t\t\t for(int k=0;k<m.length;k++) {\n\t\t\t\t\t\t \tif( method.equalsIgnoreCase(m[k].getName())){\n\t\t\t\t\t\t \t\tString res=(String)m[k].invoke(gm, l,d,c);\n\t\t\t\t\t\t \t\tXSSFCell cell=rsh2.getRow(j).getCell(6);\n\t\t\t\t\t\t \t\tcell.setCellValue(res);\n\tfout = new FileOutputStream(\"‪C:\\\\Users\\\\RUHI\\\\Desktop\\\\gmailexcel1.xlsx\");\n\t\t\t\t\t\t \t\t\n\t\t\t\t\t\t \t}\n\t\t\t\t\t\t }\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\twb.write(fout);\t\n\t\twb.close();\t\n\t\t\n\t\t\n\t}", "public void giftOverviewInitialPage(WebDriver driver) throws InvalidFormatException, InterruptedException\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tExcelLib xllib = new ExcelLib();\r\n\t\t\t\r\n\t\t\trowCount= xllib.getRowCount(\"GiftOverview\");\r\n\t\t\tlog.info(\"*********************Gift Overview Logger Initialized***********************************************************************************************************************************************************************\");\r\n\t\t\tlog.info(\"Purchaser Email ||\"+\" Amount ||\" + \" Reason ||\" + \" Add Credits || \" + \" Subtract Credits || \" + \" Credit Status ||\" + \" First Name || \" + \" Last Name || \" + \" Credit Type || \" + \" Amount(Credited/Redeem) || \" + \" Sub Category || \" + \" Credit Time ||\" + \" Source\");\r\n\t \t\tlog.info(\"********************************************************************************************************************************************************************************************************************************\");\r\n\t\t\tfor (i = 1; i <= rowCount; i++) \r\n\t\t\t{\t\t\t\t\r\n\t\t\t\t//Reading View Edit Tickets values\r\n\t\t\t\tpurchaserEmail = xllib.getExcelData(\"GiftOverview\", i, 0);\r\n\t\t \t\tcode = xllib.getExcelData(\"GiftOverview\", i, 1);\r\n\t\t \t\t\r\n\t\t \t\t//Search criteria\r\n\t\t\t\tsearchCriteria(driver);\r\n\t\t\t\t\r\n\t\t \t\t//Calling gift Overview Actions method\r\n\t\t\t\trefundGiftActions(driver);\r\n\t\t \t\t\r\n\t\t\t\t//Calling clicking on go back link method\r\n\t\t\t\t//clickingOnGoBackLink(driver);\r\n\t\t\t\t\r\n\t\t \t\tif(verifyRefundStatus)\r\n\t\t\t\t{\r\n\t\t\t\t\tisTestPassed=\"PASS\";\r\n\t\t\t\t\txllib.writeToExcel(\"GiftOverview\", i, 2, isTestPassed);\r\n\t\t\t\t\txllib.writeToExcel(\"GiftOverview\", i, 3, membershipRefundID);\r\n\t\t\t\t\txllib.writeToExcel(\"GiftOverview\", i, 4, chargeID);\r\n\t\t\t\t\txllib.writeToExcel(\"GiftOverview\", i, 5, totalCashToRefund);\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(verifyCreditsRefundID)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\txllib.writeToExcel(\"GiftOverview\", i, 6, creditsRefundID);\r\n\t\t\t\t\t}\r\n\t\t\t\t}else\r\n\t\t\t\t{\r\n\t\t\t\t\tisTestPassed=\"FAIL\";\r\n\t\t\t\t\txllib.writeToExcel(\"GiftOverview\", i, 2, isTestPassed);\r\n\t\t\t\t\txllib.writeToExcel(\"GiftOverview\", i, 3, isTestPassed);\r\n\t\t\t\t\txllib.writeToExcel(\"GiftOverview\", i, 4, isTestPassed);\r\n\t\t\t\t\txllib.writeToExcel(\"GiftOverview\", i, 5, isTestPassed);\r\n\t\t\t\t\txllib.writeToExcel(\"GiftOverview\", i, 6, isTestPassed);\r\n\t\t\t\t}\r\n\t\t\t }//End of FOR LOOP\r\n\t\t }catch(NullPointerException e)\r\n\t\t {\r\n\t\t\t e.printStackTrace();\r\n\t\t }\r\n\t}", "public static void main(String[] args) throws InterruptedException, RowsExceededException, BiffException, WriteException, IOException {\n\t\tSystem.setProperty(\"webdriver.chrome.driver\",\"C:\\\\Users\\\\User\\\\Desktop\\\\SeleniumSoftwares\\\\chromedriver.exe\");\r\n\t\t\tWebDriver driver = new ChromeDriver();\r\n\t\tdriver.get(\"http://www.facebook.com\");\r\n\t\t\r\n\t\tdriver.manage().window().maximize();\r\n\t\t\r\n\t//Excel File Location\r\n\t\t\r\n\t//\tString filename = \"C:\\\\Users\\\\User\\\\Desktop\\\\SeleniumSoftwares\\\\RandomData.xls\";\r\n\t//\tString SheetName =\"Sheet1\";\r\n\t\tString filename = \"C:\\\\Users\\\\User\\\\Desktop\\\\SeleniumSoftwares\\\\Data.xls\";\r\n\t\t String SheetName = \"Sheet3\";\r\n\t\t\t\t \r\n\tWebElement fname=driver.findElement(By.name(\"firstname\"));\r\n\t\r\n\tWebElement lname=driver.findElement(By.name(\"lastname\"));\r\n\tWebElement email=driver.findElement(By.name(\"reg_email__\"));\r\n\tfor(int i=1; i<=5; i++)\r\n\t{\r\n\t\tfname.sendKeys(GenerateRandomData.randomString(8));\r\n\t String myf =fname.getAttribute(\"value\");\r\n\t System.out.println(myf);\r\n\t if((myf.equalsIgnoreCase(\"Shravan\"))==true)\r\n\t {\r\n\t\r\n\t //Capture Data\r\n\t //RandomExcelUDF.RandomExcelData(filename, SheetName, \"TC_01\", \"Capture FirstName\",\"Shravan\", myf,\"PASSED\");\r\n\t\tExcelUDF.FnMultipleCellsExcel(filename, SheetName, \"TC01\",\"Capture FirstName\",\"Shravan\", myf,\"PASSED\"); \r\n\t }\r\n\t else\r\n\t {\r\n\t\t //Capture Data\r\n\t\t// RandomExcelUDF.RandomExcelData(filename, Sheetname, \"TC_01\", \"Capture FirstName\",\"Shravan\", myf,\"FAILED\");\r\n\t\t\tExcelUDF.FnMultipleCellsExcel(filename, SheetName, \"TC01\",\"Capture FirstName\",\"Shravan\", myf,\"FAILED\");\r\n\t }\r\n\t \r\n\t \r\n\t //lname.sendKeys(GenerateRandomData.randomString(8).toLowerCase());\r\n\t//email.sendKeys(GenerateRandomData.randomString(8).concat(\"@gmail.com\"));\r\n\tThread.sleep(5000);\r\n\tfname.clear();\r\n\t//lname.clear();\r\n\t//email.clear();\r\n\t}\r\n\t\r\n\tdriver.close();\r\n\tdriver.quit();\r\n\t}", "public static void writeInFile(String fileName,String sheetName, String cntry, String menu,String subMenu,String subMenu_1,String ActualEng_Title,String Overridden_Title,String xmlURL) throws IOException {\n\r\n\t\tFile myFile = new File(\"./\" + fileName);\r\n\r\n\t\t//Create an object of FileInputStream class to read excel file\r\n\r\n\t\tFileInputStream inputStream = new FileInputStream(myFile);\r\n\r\n\t\tWorkbook myWorkbook = null;\r\n\r\n\t\t//Find the file extension by spliting file name in substring and getting only extension name\r\n\r\n\t\tString fileExtensionName = fileName.substring(fileName.indexOf(\".\"));\r\n\r\n\t\t//Check condition if the file is xlsx file\t\r\n\r\n\t\tif(fileExtensionName.equals(\".xlsx\")){\r\n\r\n\t\t\t//If it is xlsx file then create object of XSSFWorkbook class\r\n\r\n\t\t\tmyWorkbook = new XSSFWorkbook(inputStream);\r\n\t\t\tSystem.out.println(\"Extension of file \"+fileName +\" is .xlsx\");\r\n\r\n\t\t}\r\n\r\n\t\t//Check condition if the file is xls file\r\n\r\n\t\telse if(fileExtensionName.equals(\".xls\")){\r\n\r\n\t\t\t//If it is xls file then create object of XSSFWorkbook class\r\n\r\n\t\t\tmyWorkbook = new HSSFWorkbook(inputStream);\r\n\t\t\tSystem.out.println(\"Extension of file \"+fileName +\" is .xlx\");\r\n\r\n\t\t}\r\n\r\n\t\t//Read sheet inside the workbook by its name\r\n\r\n\t\tSheet mySheet = myWorkbook.getSheet(sheetName);\r\n\r\n\t\t//Find number of rows in excel file\r\n\r\n\t\tint rowCount = mySheet.getLastRowNum() - mySheet.getFirstRowNum();\r\n\r\n\r\n\t\tRow row = mySheet.getRow(0);\r\n\r\n\t\t//Create a new row and append it at last of sheet\r\n\r\n\t\tRow newRow = mySheet.createRow(rowCount+1);\r\n\r\n\r\n\t\t//Create a loop over the cell of newly created Row\r\n\t\tfor(int colCnt=0;colCnt<=6;colCnt++)\r\n\t\t{ \r\n\t\t\tCell cell = newRow.createCell(colCnt);\r\n\r\n\t\t\tif(colCnt==0)\r\n\t\t\t{\r\n\t\t\t\tcell.setCellValue(cntry);\r\n\t\t\t}\r\n\t\t\telse if(colCnt==1)\r\n\t\t\t{\r\n\t\t\t\tcell.setCellValue(menu);\r\n\t\t\t}\r\n\t\t\telse if(colCnt==2)\r\n\t\t\t{\r\n\t\t\t\tcell.setCellValue(subMenu);\r\n\t\t\t}\r\n\t\t\telse if(colCnt==3)\r\n\t\t\t{\r\n\t\t\t\tcell.setCellValue(subMenu_1);\r\n\t\t\t}\r\n\t\t\telse if(colCnt==4)\r\n\t\t\t{\r\n\t\t\t\tcell.setCellValue(ActualEng_Title);\r\n\t\t\t}\r\n\t\t\telse if(colCnt==5)\r\n\t\t\t{\r\n\t\t\t\tcell.setCellValue(Overridden_Title);\r\n\t\t\t}\r\n\t\t\telse if(colCnt==6)\r\n\t\t\t{\r\n\t\t\t\tcell.setCellValue(xmlURL);\r\n\t\t\t}\r\n\t\t}\r\n\t\t/* for(int j = 0; j < row.getLastCellNum(); j++){\r\n\r\n\t //Fill data in row\r\n\r\n\t Cell cell = newRow.createCell(j);\r\n\r\n\t cell.setCellValue(\"test\");\r\n\r\n\t }*/\r\n\r\n\t\t//Close input stream\r\n\r\n\t\tinputStream.close();\r\n\r\n\t\t//Create an object of FileOutputStream class to create write data in excel file\r\n\r\n\t\tFileOutputStream opStream = new FileOutputStream(myFile);\r\n\r\n\t\t//write data in the excel file\r\n\r\n\t\tmyWorkbook.write(opStream);\r\n\t\t//close output stream\r\n\t\topStream.close();\r\n\t\t//\tfor(int i = 0;i<=objectArr.length-1;i++ ){\r\n\r\n\t\t// Cell cell = row.createCell(i);\r\n\t\t// cell.setCellValue(objectArr[i]);\r\n\r\n\t\t// }\r\n\r\n\t\t//File myFile = new File(\"./Controller.xlsx\");\r\n\t\t// FileOutputStream os = new FileOutputStream(myFile);\r\n\t\t//\tmyWorkBook.write(os);\r\n\t\tSystem.out.println(\"Controller Sheet Creation finished ...\");\r\n\t\t//\tos.close();\r\n\r\n\r\n\t}", "public static void main(String[] args) throws IOException {\n\t\tSystem.getProperty(\"user.dir\");\n\t\tFileOutputStream fileout = new FileOutputStream(\"C:\\\\Workspace\\\\Module7\\\\Workbook.xls\");\n\t\tHSSFWorkbook wb = new HSSFWorkbook();\n\t\t\n\t\t\n\t\t//creating sheet\n\t\t\n\t\tHSSFSheet sheet1 = wb.createSheet(\"First Sheet\");\n\t\tHSSFSheet sheet2 = wb.createSheet(\"Second sheet\");\n\t\t\n\t\t\n\t\t//Creating rows and cells\n\t\tfor (int i=0; i<100; i++)\n\t\t{\n\t\t\tHSSFRow row = sheet1.createRow(i);\n\t\t\tfor (int j=0; j<4; j++)\n\t\t\t{\n\t\t\t\tHSSFCell cell = row.createCell(j);\n\t\t\t\tcell.setCellValue(j);\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\twb.write(fileout);\n\t\tfileout.close();\n\t\t\n\t\tString ProjectLocation = System.getProperty(\"user.dir\");\n\t\t\n\t\tSystem.out.println(ProjectLocation);\n\t\t\n\t\tFileOutputStream FO = new FileOutputStream (ProjectLocation + \"\\\\Playing.xls\");\n\t\tHSSFWorkbook wb2 = new HSSFWorkbook ();\n\t\t\n\t\tHSSFSheet sheet3 = wb.createSheet(\"new sheet\");\n\t\tHSSFRow row1 = sheet3.createRow(0);\n\t\trow1.createCell(0).setCellValue(true);\n\t\trow1.createCell(1).setCellValue(2);\n\t\t\n\t\t\n\t\twb2.write(FO);\n\t\tFO.close();\n\t\t\n\t /*HSSFWorkbook wb = new HSSFWorkbook();\n\t HSSFSheet sheet = wb.createSheet(\"new sheet\");\n\t HSSFRow row = sheet.createRow((short)2);\n\t row.createCell(0).setCellValue(1.1);\n\t row.createCell(1).setCellValue(new Date());\n\t row.createCell(2).setCellValue(Calendar.getInstance());\n\t row.createCell(3).setCellValue(\"a string\");\n\t row.createCell(4).setCellValue(true);\n\t row.createCell(5).setCellType(Cell.CELL_TYPE_ERROR);\n\n\t // Write the output to a file\n\t FileOutputStream fileOut = new FileOutputStream(\"workbook2.xls\");\n\t wb.write(fileOut);\n\t fileOut.close();*/\n\t\t}", "public static void main(String[] args) throws Exception\r\n\t{\n\t\tFile f=new File(\"w2smskwd.xls\");\r\n\t\t// open excel file for reading\r\n\t\tWorkbook rwb=Workbook.getWorkbook(f);\r\n\t\tSheet rsh1=rwb.getSheet(0); // 0 for sheet1(tests)\r\n\t\tint nour1=rsh1.getRows();\r\n\t\tint nouc1=rsh1.getColumns();\r\n\t\tSheet rsh2=rwb.getSheet(1); // 1 for sheet2(steps)\r\n\t\tint nour2=rsh2.getRows();\r\n\t\tint nouc2=rsh2.getColumns();\r\n\t\t\r\n\t\t// open same excel for result writing\r\n\t\tWritableWorkbook wwb=Workbook.createWorkbook(f,rwb);\r\n\t\tWritableSheet wsh1=wwb.getSheet(0); //0 means sheet1\r\n\t\tWritableSheet wsh2=wwb.getSheet(1); //1 means sheet2\r\n\t\t\r\n\t\t//set font style,color and cell alignment heading\r\n\t\tWritableFont wf=new WritableFont(WritableFont.TIMES,11,WritableFont.BOLD);\r\n\t\twf.setColour(Colour.BLUE);\r\n\t\tWritableCellFormat wcf=new WritableCellFormat(wf);\r\n\t\twcf.setAlignment(Alignment.JUSTIFY);\r\n\t\twcf.setAlignment(Alignment.CENTRE);\r\n\t\t\t\t\r\n\t\t//set font style,color and cell alignment for Test PASSED\r\n\t\tWritableFont wf1=new WritableFont(WritableFont.TIMES,11);\r\n\t\twf1.setColour(Colour.GREEN);\r\n\t\tWritableCellFormat wcf1=new WritableCellFormat(wf1);\r\n\t\twcf1.setAlignment(Alignment.JUSTIFY);\r\n\t\twcf1.setAlignment(Alignment.CENTRE);\r\n\t\t\t\t\r\n\t\t//set font style,color and cell alignment for Test FAILED\r\n\t\tWritableFont wf2=new WritableFont(WritableFont.TIMES,11);\r\n\t\twf2.setColour(Colour.RED);\r\n\t\tWritableCellFormat wcf2=new WritableCellFormat(wf2);\r\n\t\twcf2.setAlignment(Alignment.JUSTIFY);\r\n\t\twcf2.setAlignment(Alignment.CENTRE);\r\n\t\t\t\t\r\n\t\t//take results heading as date and time format\r\n\t\tSimpleDateFormat sf=new SimpleDateFormat(\"dd-MM-yyyy-hh-mm-ss\");\r\n\t\tDate dt=new Date();\r\n\t\tString cname=sf.format(dt);\r\n\t\t\r\n\t\t// set name to result column in sheet1\r\n\t\tLabel l1=new Label(nouc1,0,cname,wcf);\r\n\t\twsh1.addCell(l1);\r\n\t\t// set name to result column in sheet2\r\n\t\tLabel l2=new Label(nouc2,0,cname,wcf);\r\n\t\twsh2.addCell(l2);\r\n\t\t// create objects to methods class\r\n\t\tW2smsmethods ms=new W2smsmethods();\r\n\t\t// collect methods info using methods class object\r\n\t\tMethod m[]=ms.getClass().getMethods();\r\n\t\t// keyword driven\r\n\t\ttry \r\n\t\t{\r\n\t\t\t//calling methods one after another\r\n\t\t\t//1st row (index=0) have names of columns in sheet1\r\n\t\t\tfor(int i=1;i<nour1;i++) // from 2nd row(index=1)\r\n\t\t\t{\r\n\t\t\t\tint flag=0;\r\n\t\t\t\t// get tid and mode from sheet1\r\n\t\t\t\tString tid=rsh1.getCell(0, i).getContents();\r\n\t\t\t\tString mode=rsh1.getCell(2, i).getContents();\r\n\t\t\t\tif(mode.equalsIgnoreCase(\"yes\"))\r\n\t\t\t\t{\r\n\t\t\t\t\t//1st row (index=0)have names of columns of sheet2\r\n\t\t\t\t\tfor(int j=1;j<nour2;j++) // from 2nd row(index=1)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tString sid=rsh2.getCell(0, j).getContents();\r\n\t\t\t\t\t\tif(tid.equalsIgnoreCase(sid))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t//take step details from sheet2\r\n\t\t\t\t\t\t\tString mn=rsh2.getCell(2, j).getContents();\r\n\t\t\t\t\t\t\tString e=rsh2.getCell(3, j).getContents();\r\n\t\t\t\t\t\t\tString d=rsh2.getCell(4, j).getContents();\r\n\t\t\t\t\t\t\tString c=rsh2.getCell(5, j).getContents();\r\n\t\t\t\t\t\t\tSystem.out.println(mn+\" \"+e+\" \"+d+\" \"+c);\r\n\t\t\t\t\t\t\tfor(int k=0;k<m.length;k++)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tif(m[k].getName().equals(mn))\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tString r=(String) m[k].invoke(ms, e,d,c);\r\n\t\t\t\t\t\t\t\t\tLabel lb=new Label(nouc2,j,r,wcf1);\r\n\t\t\t\t\t\t\t\t\twsh2.addCell(lb);\r\n\t\t\t\t\t\t\t\t\tif(r.equalsIgnoreCase(\"unknown browser\"))\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\twwb.write();\r\n\t\t\t\t\t\t\t\t\t\twwb.close();\r\n\t\t\t\t\t\t\t\t\t\trwb.close();\r\n\t\t\t\t\t\t\t\t\t\tSystem.exit(0); //force stop run\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tif(r.contains(\"Failed\") || r.contains(\"failed\") || r.contains(\"interrupted\") || r.contains(\"Interrupted\"))\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\tflag=1;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tbreak; //terminate from loop for k \r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t} \r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tbreak; //terminate from loop if tid not equal to sid\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} \r\n\t\t\t\t\tif(flag==0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tLabel l=new Label(nouc1,i,\"passed\",wcf1);\r\n\t\t\t\t\t\twsh1.addCell(l);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tLabel l=new Label(nouc1,i,\"failed\",wcf2);\r\n\t\t\t\t\t\twsh1.addCell(l);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\tcatch(Exception ex)\r\n\t\t{\r\n\t\t\tSystem.out.println(ex.getMessage());\r\n\t\t}\r\n\t\t//to autofit width of excel column size(sheet1)\r\n\t\tCellView cv=rsh1.getColumnView(nouc1);\r\n\t\tcv.setAutosize(true);\r\n\t\twsh1.setColumnView(nouc1, cv);\r\n\t\t\r\n\t\t//to autofit width of excel column size(sheet2)\r\n\t\tCellView cv1=rsh2.getColumnView(nouc2);\r\n\t\tcv.setAutosize(true);\r\n\t\twsh2.setColumnView(nouc2, cv1);\r\n\t\t//save and close excel\r\n\t\twwb.write();\r\n\t\twwb.close();\r\n\t\trwb.close();\r\n\t\t\r\n\t}", "public static void main(String[] args) throws InterruptedException, IOException, BiffException, WriteException, WriteException {\n Workbook readableFile= Workbook.getWorkbook(new File(\"src/Resource/WeightWatchers.xls\"));\n //define the worksheet for the data\n Sheet readableSheet= readableFile.getSheet(0);\n //Get count of all non empty rows\n int rowCount= readableSheet.getRows();\n //Create duplicate workbook to wirte back\n WritableWorkbook writeableFile = Workbook.createWorkbook(new File(\"src/Resource/WeightWatchers_Result.xls\"),readableFile);\n //Define the writable worksheet\n WritableSheet wSheet= writeableFile.getSheet(0);\n\n // define the path of chrome driver\n System.setProperty(\"webdriver.chrome.driver\",\"src/Resource/chromedriver.exe\");\n //set pre arguments using chrome options\n ChromeOptions options= new ChromeOptions();\n options.addArguments(\"start-maximized\",\"incognito\");\n //define the chrome driver\n WebDriver driver = new ChromeDriver(options);\n\n\n for(int i = 1; i < rowCount; i++){\n String Zipcode=wSheet.getCell(0,i).getContents();\n\n // navigate to Weight Watchers\n driver.navigate().to(\"https://www.weightwatchers.com/us/\");\n Thread.sleep(4000);\n\n //verify the page is Weight Loss Program\n String actualTitle= driver.getTitle();\n if(actualTitle.equals(\"Weight Loss Program, Recipes & Help | Weight Watchers\")){\n System.out.println(\"Title Matches\");\n }else {\n System.out.println(\"Title does not Match \" + actualTitle);\n }\n\n // CLick on \"Find a Studio\"\n driver.findElement(By.xpath(\"//*[@class='find-a-meeting']\")).click();\n Thread.sleep(2000);\n // Click on X\n driver.findElement(By.xpath(\"//*[@class='bx-close-xsvg']\")).click();\n Thread.sleep(2000);\n\n // verify the page is Find a Studio and Meeting Near You\n String correctTitle= driver.getTitle();\n if (correctTitle.equals(\"Find a Studio & Meeting Near You |\")){\n System.out.println(\"Title Matches\");\n }else{\n System.out.println(\"Title does not Match \" + correctTitle);\n }\n\n Reusable_Methods.type(driver, \"//*[@id='meetingSearch']\", Zipcode,\"Enter Location\");\n Reusable_Methods.click(driver,\"//*[@spice='SEARCH_BUTTON']\",\"Search Enter\");\n Thread.sleep(5000);\n\n //Store the Search Result\n String searchResult= driver.findElement(By.xpath(\"//*[@class='location__name']\")).getText();\n Thread.sleep(1500);\n //Capture location Result\n String locationDistance=driver.findElement(By.xpath(\"//*[@class='location__distance']\")).getText();\n Thread.sleep(3000);\n // Capture Operation Hours Result\n String operationHours=driver.findElement(By.xpath(\"//*[@class='schedule__time']\")).getText();\n Thread.sleep(2000);\n\n Reusable_Methods.clickByIndex(driver, \"//*[@class='location__address']\", 0, \"address name\");\n\n Label resultAndDistance= new Label(1,i,searchResult + locationDistance);\n wSheet.addCell(resultAndDistance);\n Label operationHour= new Label(2,i,operationHours);\n wSheet.addCell(operationHour);\n\n }//end of for loop\n\n readableFile.close();\n writeableFile.write();\n writeableFile.close();\n\n driver.quit();\n\n }", "@Test\r\n\t public void writeExcel(String fileName,String sheetName,String dataToWrite) throws IOException{\n\t \r\n\t File file = new File(\"D:\\\\output.xls\");\r\n\t \r\n\t //Create an object of FileInputStream class to read excel file\r\n\t \r\n\t FileInputStream inputStream = new FileInputStream(file);\r\n\t \r\n\t \t \r\n\t //Find the file extension by spliting file name in substing and getting only extension name\r\n\t \r\n\t String fileExtensionName = fileName.substring(fileName.indexOf(\".\"));\r\n\t \r\n\t //Check condition if the file is xlsx file\r\n\t \r\n\t Workbook guru99Workbook = null;\r\n\t \r\n\t\t\tif(fileExtensionName.equals(\".xlsx\")){\r\n\t \r\n\t //If it is xlsx file then create object of XSSFWorkbook class\r\n\t \r\n\t guru99Workbook = new XSSFWorkbook(inputStream);\r\n\t \r\n\t }\r\n\t \r\n\t //Check condition if the file is xls file\r\n\t \r\n\t else if(fileExtensionName.equals(\".xls\")){\r\n\t \r\n\t //If it is xls file then create object of XSSFWorkbook class\r\n\t \r\n\t guru99Workbook = new HSSFWorkbook(inputStream);\r\n\t \r\n\t }\r\n\t \r\n\t \r\n\t \r\n\t //Read excel sheet by sheet name \r\n\t \r\n\t HSSFSheet sheet = (HSSFSheet) guru99Workbook.getSheet(sheetName);\r\n\t \r\n\t //Get the current count of rows in excel file\r\n\t \r\n\t int rowCount = sheet.getLastRowNum()-sheet.getFirstRowNum();\r\n\t \r\n\t //Get the first row from the sheet\r\n\t \r\n\t Row row = sheet.getRow(0);\r\n\t \r\n\t //Create a new row and append it at last of sheet\r\n\t \r\n\t Row newRow = sheet.createRow(rowCount+1);\r\n\t \r\n\t //Create a loop over the cell of newly created Row\r\n\t \r\n\t for(int j = 0; j < row.getLastCellNum(); j++){\r\n\t \r\n\t //Fill data in row\r\n\t \r\n\t Cell cell = newRow.createCell(j);\r\n\t \r\n\t cell.setCellValue(dataToWrite);\r\n\t \r\n\t }\r\n\t \r\n\t //Close input stream\r\n\t \r\n\t inputStream.close();\r\n\t \r\n\t //Create an object of FileOutputStream class to create write data in excel file\r\n\t \r\n\t FileOutputStream outputStream = new FileOutputStream(file);\r\n\t \r\n\t //write data in the excel file\r\n\t \r\n\t guru99Workbook.write(outputStream);\r\n\t \r\n\t //close output stream\r\n\t \r\n\t outputStream.close();\t \r\n\t \r\n\t }", "public static ArrayList<String> getData3() throws Exception {\n\t\tString filepath = \"F:\\\\Selenium Practice\\\\Framework\\\\TestData\\\\TestData.xlsx\";\n\t\tFile f = new File(filepath);\n\t\tFileInputStream str = new FileInputStream(f);\n\t\tWorkbook w = new XSSFWorkbook(str);\n\t\tArrayList<String> a = new ArrayList<String>();\n\t\tString name = \"\";\n\t\tint nos = w.getNumberOfSheets();\n\t\tfor (int i = 0; i < nos; i++) {\n\t\t\tif (w.getSheetName(i).equalsIgnoreCase(\"TestData\")) {\n\t\t\t\tSheet sh = w.getSheetAt(i);\n\t\t\t\tIterator<Row> rt1 = sh.rowIterator();\n\t\t\t\tRow r1 = rt1.next();\n\t\t\t\tIterator<Cell> ct1 = r1.cellIterator();\n\t\t\t\tint column = 0, k = 0;\n\t\t\t\twhile (ct1.hasNext()) {\n\t\t\t\t\tCell c1 = ct1.next();\n\t\t\t\t\tif (c1.getStringCellValue().equalsIgnoreCase(\"TestCase\")) {\n\t\t\t\t\t\tcolumn = k;\n\t\t\t\t\t}\n\t\t\t\t\tk++;\n\t\t\t\t}\n\t\t\t\tSystem.out.println(\"TestCase Column Index: \" + column);\n\t\t\t\twhile (rt1.hasNext()) {\n\t\t\t\t\tRow r2 = rt1.next();\n\t\t\t\t\tif (r2.getCell(column).getStringCellValue().equalsIgnoreCase(\"TC01\")) {\n\t\t\t\t\t\tIterator<Cell> ct2 = r2.cellIterator();\n\t\t\t\t\t\twhile (ct2.hasNext()) {\n\t\t\t\t\t\t\tCell c3 = ct2.next();\n\t\t\t\t\t\t\tint ct = c3.getCellType();\n\t\t\t\t\t\t\tswitch (ct) {\n\t\t\t\t\t\t\tcase Cell.CELL_TYPE_NUMERIC:\n\t\t\t\t\t\t\t\tif (ct == 0) {\n\t\t\t\t\t\t\t\t\tif (DateUtil.isCellDateFormatted(c3)) {\n\t\t\t\t\t\t\t\t\t\tSimpleDateFormat form = new SimpleDateFormat(\"dd-MMM-yy\");\n\t\t\t\t\t\t\t\t\t\tname = form.format(c3.getDateCellValue());\n\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tdouble d = c3.getNumericCellValue();\n\t\t\t\t\t\t\t\t\t\tlong l = (long) d;\n\t\t\t\t\t\t\t\t\t\tname = String.valueOf(l);\n\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase Cell.CELL_TYPE_STRING:\n\t\t\t\t\t\t\t\tif (ct == 1) {\n\t\t\t\t\t\t\t\t\tname = c3.getStringCellValue();\n\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ta.add(name);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\t\treturn a;\n\t}", "private static void showExcel(Experiment e1, ArrayList<Institution> bank) {\n\n\n\n\t\tfinal String INPUT_DIR=\"D:/Users/atsushi/Desktop/実験結果/\";\n\t\tWorkbook book=null;\n\n\t\ttry{\n\t\t\tbook = new HSSFWorkbook();\n\t\t\tFileOutputStream fileOut=new FileOutputStream(\"workbook.xls\");\n\t\t\tString safename=WorkbookUtil.createSafeSheetName(\"[OutPut]\");\n\t\t\tString safename1=WorkbookUtil.createSafeSheetName(\"[Bank]\");\n\t\t\tString safename2=WorkbookUtil.createSafeSheetName(\"[Firm]\");\n\t\t\tSheet sheet1=book.createSheet(safename);\n\t\t\tSheet sheet2=book.createSheet(safename1);\n\t\t\tSheet sheet3=book.createSheet(safename2);\n\t\t\tCreationHelper createHelper=book.getCreationHelper();\n\n\t\t\t//100タームごとに改行\n\t\t\tint rowterm=e1.getTerm()/100+1;\n\t\t\tint term=e1.getTerm();\n\t\t\tint xterm=100;\n\t\t\tint a=0,b=xterm-1;\n\t\t\t//if(e1.getTerm()>100) {xterm=100;a=0;b=xterm-1;}else {xterm=0;a=0;b=e1.getTerm()-1;}\n\t\t\tfor(int x=0;x<rowterm;x++){\n\t\t\tRow row = sheet1.createRow((short)x);//行\n\t\t\tRow row1=sheet1.createRow((short)(x+rowterm+2));\n\t\t\tRow row2=sheet1.createRow((short)(x+rowterm*2+2));\n\t\t\tRow row3=sheet1.createRow((short)(x+rowterm*3+2));\n\t\t\tRow row4=sheet1.createRow((short)(x+rowterm*4+2));\n\t\t\tRow row5=sheet1.createRow((short)(x+rowterm*5+2));\n\t\t\tRow row6=sheet1.createRow((short)(x+rowterm*6+2));\n\t\t\tRow row7=sheet1.createRow((short)(x+rowterm*7+2));\n\t\t\tRow row8=sheet1.createRow((short)(x+rowterm*8+2));\n\t\t\tRow row9=sheet1.createRow((short)(x+rowterm*9+2));\n\t\t\tRow row10=sheet1.createRow((short)(x+rowterm*10+2));\n\t\t\tRow row11=sheet1.createRow((short)(x+rowterm*11+2));\n\t\t\tRow row12=sheet1.createRow((short)(x+rowterm*12+2));\n\t\t\tRow row13=sheet1.createRow((short)(x+rowterm*11+2));\n\n\t\t\tint j=0;\n\t\t\tfor(j=a;j<=b;j++){\n\t\t\trow.createCell(j-(x*xterm)).setCellValue(e1.getAgrregateOP(j));\n\t\t\trow1.createCell(j-(x*xterm)).setCellValue(e1.getGrowthRateOP(j));\n\t\t\trow2.createCell(j-(x*xterm)).setCellValue(e1.getFailedFirm(j));\n\t\t\trow3.createCell(j-(x*xterm)).setCellValue(e1.getFailedFirmrate(j));\n\t\t\trow4.createCell(j-(x*xterm)).setCellValue(e1.getBadLoan(j));\n\t\t\trow5.createCell(j-(x*xterm)).setCellValue(e1.getAVGInterest(j));\n\t\t\trow6.createCell(j-(x*xterm)).setCellValue(e1.getMoneyStock(j));\n\t\t\trow7.createCell(j-(x*xterm)).setCellValue(e1.getCreditMoney(j));\n\t\t\trow8.createCell(j-(x*xterm)).setCellValue(e1.getResidual(j));\n\t\t\trow9.createCell(j-(x*xterm)).setCellValue(e1.getGrossDemand(j));\n\t\t\trow10.createCell(j-(x*xterm)).setCellValue(e1.getGrossSupply(j));\n\t\t\trow11.createCell(j-(x*xterm)).setCellValue(e1.getRejectFinancing(j));\n\n\n\t\t //cell.setCellValue(createHelper.createRichTextString(\"sample String\"));\n\t\t\t}\n\t\t\t/*\n\t\t\tfor(j=a;j<e1.getAliveBank();j++) {\n\t\t\t\trowx.createCell(j-(x*e1.getAliveBank())).setCellValue(e1.getBankCAR(j));\n\t\t\t}*/\n\t\t\tif(term>100){\n\t\t\tif(term-1>xterm+j){\n\t\t\t\tif(term-j-1>xterm){\n\t\t\t\t\ta=j;b=j+xterm-1;\n\t\t\t\t}}else{\n\t\t\t\t\ta=j;\n\t\t\t\t\tb=term-1;\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t}\n\n\t\t\t//企業list\n\t\t\te1.setSortFirmK();\n\t\t\tint rowfirm=e1.getalivefirm()/100;\n\t\t\tint firmnode=e1.getalivefirm();\n\t\t\tint fn=100;\n\t\t\tint c=0,d=fn-1;\n\t\t\tint t=0;\n\n\t\t\tRow row00= sheet3.createRow((short)t);\n\t\t\trow00.createCell(0).setCellValue(\"総資産\");\n\t\t\tRow row02=sheet3.createRow((short)t+15);\n\t\t\trow02.createCell(0).setCellValue(\"取引先\");\n\t\t\tRow row04=sheet3.createRow((short)t+30);\n\t\t\trow04.createCell(0).setCellValue(\"Leverage\");\n\t\t\tRow row06=sheet3.createRow((short)t+45);\n\t\t\trow06.createCell(0).setCellValue(\"ChoiveLeverage\");\n\t\t\tRow row08=sheet3.createRow((short)t+60);\n\t\t\trow08.createCell(0).setCellValue(\"RejectOrder\");\n\t\t\tRow row010=sheet3.createRow((short)t+75);\n\t\t\trow010.createCell(0).setCellValue(\"NonBuffer\");\n\t\t\t\tfor(int x=0;x<rowfirm;x++){\n\t\t\t\t/*\n\t\t\t\t\tRow row0= sheet3.createRow((short)x);\n\t\t\t\t\trow0.createCell(0).setCellValue(\"総資産\");\n\t\t\t\t\t*/\n\t\t\t\t\tRow row1 = sheet3.createRow((short)x+1);//行\n\t\t\t\t\tRow row3 = sheet3.createRow((short)x+16);\n\t\t\t\t\tRow row5 = sheet3.createRow((short)x+31);\n\t\t\t\t\tRow row7 = sheet3.createRow((short)x+46);\n\t\t\t\t\tRow row9 =sheet3.createRow((short)x+61);\n\t\t\t\t\tRow row11 =sheet3.createRow((short)x+76);\n\t\t\t\tint j=0;\n\t\t\t\tfor(j=c;j<=d;j++){\n\t\t\t\t\t//System.out.print(d);\n\t\t\t\t\trow1.createCell(j-(x*fn)).setCellValue(e1.getFirmK(j));\n\t\t\t\t\trow3.createCell(j-(x*fn)).setCellValue(e1.getFirmCandidateNum(j));\n\t\t\t\t\trow5.createCell(j-(x*fn)).setCellValue(e1.getFirmLeverage(j));\n\t\t\t\t\trow7.createCell(j-(x*fn)).setCellValue(e1.getFirmnextLeverage(j));\n\t\t\t\t\trow9.createCell(j-(x*fn)).setCellValue(e1.getFirmRejectOrderNum(j));\n\t\t\t\t\trow11.createCell(j-(x*fn)).setCellValue(e1.getFirmNonBufferNum(j));\n\t\t\t\t}\n\n\t\t\t\tif(firmnode-1>fn+j){\n\t\t\t\t\tif(firmnode-j-1>fn){\n\t\t\t\t\t\tc=j;d=j+fn-1;\n\t\t\t\t\t}}else{\n\t\t\t\t\t\tc=j;\n\t\t\t\t\t\td=firmnode-1;\n\t\t\t\t\t}\n\t\t\t}\n\t\t\t\t/*\n\t\t\t\tif(rowfirm==0) {\n\t\t\t\t\tint x=0;\n\t\t\t\t\tRow row0= sheet3.createRow((short)x);\n\t\t\t\t\trow0.createCell(0).setCellValue(\"総資産\");\n\t\t\t\t\tRow row1 = sheet3.createRow((short)x);//行\n\t\t\t\t\tRow row2=sheet3.createRow((short)x+15);\n\t\t\t\t\trow2.createCell(0).setCellValue(\"取引先\");\n\t\t\t\t\tRow row3 = sheet3.createRow((short)x);\n\t\t\t\t\tRow row4=sheet3.createRow((short)x+30);\n\t\t\t\t\trow4.createCell(0).setCellValue(\"Leverate\");\n\t\t\t\t\tRow row5 = sheet3.createRow((short)x);\n\t\t\t\t\tRow row6=sheet3.createRow((short)x+45);\n\t\t\t\t\trow6.createCell(0).setCellValue(\"ChoiveLeverage\");\n\t\t\t\t\tRow row7 = sheet3.createRow((short)x);\n\t\t\t\t\t//Row row8 = sheet3.createRow((short)x);\n\t\t\t\t\t//Row row9=sheet3.createRow((short)x+20);\n\t\t\t\tfor(int i=0;i<firmnode;i++) {\n\t\t\t\t\trow1.createCell(i).setCellValue(e1.getFirmK(i));\n\t\t\t\t\trow3.createCell(i).setCellValue(e1.getFirmCandidateNum(i));\n\t\t\t\t\trow5.createCell(i).setCellValue(e1.getFirmLeverage(i));\n\t\t\t\t\trow7.createCell(i).setCellValue(e1.getFirmnextLeverage(i));\n\t\t\t\t\t//row4.createCell(i).setCellValue(e1.getFirmLevNowEvalue(i));\n\t\t\t\t}\n\t\t\t\t}\n*/\n\n\t\t\t//銀行リスト\n\n\t\t\tint banknode=e1.getAliveBank();\n\n\t\t\tfor(int x=0;x<1;x++) {\n\t\t\tRow row0=sheet2.createRow((short)x);\n\t\t\tRow row1=sheet2.createRow((short)x+2);\n\t\t\trow1.createCell(0).setCellValue(\"CAR\");\n\t\t\tRow row2=sheet2.createRow((short)x+3);\n\t\t\tRow row3=sheet2.createRow((short)x+4);\n\t\t\trow3.createCell(0).setCellValue(\"企業への貸付:IBloan:IBborrow\");\n\t\t\tRow row4=sheet2.createRow((short)x+5);\n\t\t\tRow row5=sheet2.createRow((short)x+6);\n\t\t\tRow row6=sheet2.createRow((short)x+7);\n\t\t\tRow row7=sheet2.createRow((short)x+8);\n\t\t\trow7.createCell(0).setCellValue(\"銀行資産規模K\");\n\t\t\tRow row8=sheet2.createRow((short)x+9);\n\t\t\tRow row9=sheet2.createRow((short)x+10);\n\t\t\trow9.createCell(0).setCellValue(\"銀行buffer\");\n\t\t\tRow row10=sheet2.createRow((short)x+11);\n\t\t\tRow row11=sheet2.createRow((short)x+12);\n\t\t\trow11.createCell(0).setCellValue(\"銀行総badloan\");\n\t\t\tRow row12=sheet2.createRow((short)x+13);\n\t\t\tRow row13=sheet2.createRow((short)x+14);\n\t\t\trow13.createCell(0).setCellValue(\"銀行residual\");\n\t\t\tRow row14=sheet2.createRow((short)x+15);\n\t\t\tRow row15=sheet2.createRow((short)x+16);\n\t\t\trow15.createCell(0).setCellValue(\"銀行総LFlistsize\");\n\t\t\tRow row16=sheet2.createRow((short)x+17);\n\t\t\tRow row17=sheet2.createRow((short)x+18);\n\t\t\trow17.createCell(0).setCellValue(\"銀行市場性資産\");\n\t\t\tRow row18=sheet2.createRow((short)x+19);\n\t\t\tRow row19=sheet2.createRow((short)x+20);\n\t\t\trow19.createCell(0).setCellValue(\"ClientNumber\");\n\t\t\tRow row20=sheet2.createRow((short)x+21);\n\n\t\t\tfor(int i=0;i<banknode;i++) {\n\t\t\trow0.createCell(i).setCellValue(e1.getBankId(i));\n\t\t\trow2.createCell(i).setCellValue(e1.getBankCAR(i));\n\t\t\trow4.createCell(i).setCellValue(e1.getBankLf(i));\n\t\t\trow5.createCell(i).setCellValue(e1.getBankLb(i));\n\t\t\trow6.createCell(i).setCellValue(e1.getBankBb(i));\n\t\t\trow8.createCell(i).setCellValue(e1.getBankK(i));\n\t\t\trow10.createCell(i).setCellValue(e1.getBankBuffer(i));\n\t\t\trow12.createCell(i).setCellValue(e1.getBankGrossBadLoan(i));\n\t\t\trow14.createCell(i).setCellValue(e1.getBankResidual(i));\n\t\t\trow16.createCell(i).setCellValue(e1.getBankLFSize(i));\n\t\t\trow18.createCell(i).setCellValue(e1.getBankLiqAsset(i));\n\t\t\trow20.createCell(i).setCellValue(e1.getBankClientNum(i));\n\t\t\t}\n\t\t\t/*\n\t\t\tfor(int i=0;i<bank.get(0).levlist.size();i++) {\n\t\t\t\trow18.createCell(i).setCellValue(e1.getBanklevlevelvalue(i));\n\t\t\t}\n\t\t\t*/\n\n\n\n\n\n\t\t\t}\n\t\t book.write(fileOut);\n\t\t //fileOut.close();\n\n\t\t // 1つ目のセルを作成 ※行と同じく、0からスタート\n\t\t //Cell a1 = row.createCell(0); // Excel上、「A1」の場所\n\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t}finally{\n\n\n\t\t}\n\n\n\t}", "public static void main(String[] args) throws InterruptedException {\n\t\tXls_Reader reader = new Xls_Reader(\"/Users/omaidmomand/Desktop/ExeclData/ExcelConfig.xlsx\");\n\t\treader.addColumn(\"Mortgage\", \"Status\");\n\t\tint rowCount = reader.getRowCount(\"Mortgage\");\n\t\tfor (int rowNum = 2; rowNum <= rowCount; rowNum++) {\n\t\t\tString homeValue = reader.getCellData(\"Mortgage\", \"Home_Value\", rowNum);\n\t\t\tSystem.out.println(homeValue);\n\t\t\tString downPayment = reader.getCellData(\"Mortgage\", \"Down_Payment\", rowNum);\n\t\t\tSystem.out.println(downPayment);\n\t\t\tString loanAmount = reader.getCellData(\"Mortgage\", \"Loan_Amount\", rowNum);\n\t\t\tSystem.out.println(loanAmount);\n\t\t\tString intersetRate = reader.getCellData(\"Mortgage\", \"Loan_Amount\", rowNum);\n\t\t\tSystem.out.println(intersetRate);\n\t\t\tString loanTerm = reader.getCellData(\"Mortgage\", \"Long_Term\", rowNum);\n\t\t\tSystem.out.println(loanTerm);\n\t\t\tString Date = reader.getCellData(\"Mortgage\", \"Start_Date\", rowNum);\n\t\t\tSystem.out.println(Date);\n\t\t\tString startYear = reader.getCellData(\"Mortgage\", \"Start_Year\", rowNum);\n\t\t\tSystem.out.println(startYear);\n\t\t\tString propertyTax = reader.getCellData(\"Mortgage\", \"Property_Tax\", rowNum);\n\t\t\tSystem.out.println(propertyTax);\n\t\t\tString pmi = reader.getCellData(\"Mortgage\", \"PMI\", rowNum);\n\t\t\tSystem.out.println(pmi);\n\t\t\tString hoi = reader.getCellData(\"Mortgage\", \"Home_Insurance\", rowNum);\n\t\t\tSystem.out.println(hoi);\n\t\t\tString hoa = reader.getCellData(\"Mortgage\", \"Monthly_HOA\", rowNum);\n\t\t\tSystem.out.println(hoa);\n\t\t\tString loanType = reader.getCellData(\"Mortgage\", \"Loan_Type\", rowNum);\n\t\t\tSystem.out.println(loanType);\n\t\t\tString buyRefi = reader.getCellData(\"Mortgage\", \"Home_Value\", rowNum);\n\t\t\tSystem.out.println(buyRefi);\n\t\t\tString creditRating = reader.getCellData(\"Mortgage\", \"Credit_Rating\", rowNum);\n\t\t\tSystem.out.println(creditRating);\n\n\t\t\tSystem.setProperty(\"webdriver.chrome.driver\",\n\t\t\t\t\t\"/Users/omaidmomand/eclipse-workspace/AutomationFrameWork/folder/chromedriver\");\n\t\t\tdriver = new ChromeDriver();\n\t\t\tdriver.get(\"https://www.mortgagecalculator.org/\");\n\t\t\tdriver.manage().window().maximize();\n\t\t\tdriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);\n\t\t\tdriver.findElement(By.id(\"homeval\")).clear();\n\t\t\tdriver.findElement(By.id(\"homeval\")).sendKeys(homeValue);\n\t\t\tdriver.findElement(By.id(\"downpayment\")).clear();\n\t\t\tdriver.findElement(By.id(\"downpayment\")).sendKeys(downPayment);\n\t\t\tdriver.findElement(By.id(\"loanamt\")).clear();\n\t\t\tdriver.findElement(By.id(\"loanamt\")).sendKeys(loanAmount);\n\t\t\tdriver.findElement(By.id(\"intrstsrate\")).clear();\n\t\t\tdriver.findElement(By.id(\"intrstsrate\")).sendKeys(intersetRate);\n\t\t\tdriver.findElement(By.id(\"loanterm\")).clear();\n\t\t\tdriver.findElement(By.id(\"loanterm\")).sendKeys(loanTerm);\n\t\t\tSelect startDate = new Select(driver.findElement(By.name(\"param[start_month]\")));\n\t\t\tstartDate.selectByVisibleText(Date);\n\t\t\tdriver.findElement(By.id(\"start_year\")).clear();\n\t\t\tdriver.findElement(By.id(\"start_year\")).sendKeys(startYear);\n\t\t\tdriver.findElement(By.id(\"pptytax\")).clear();\n\t\t\tdriver.findElement(By.id(\"pptytax\")).sendKeys(propertyTax);\n\t\t\tdriver.findElement(By.id(\"pmi\")).clear();\n\t\t\tdriver.findElement(By.id(\"pmi\")).sendKeys(pmi);\n\t\t\tdriver.findElement(By.id(\"hoi\")).clear();\n\t\t\tdriver.findElement(By.id(\"hoi\")).sendKeys(hoi);\n\t\t\tdriver.findElement(By.id(\"hoa\")).clear();\n\t\t\tdriver.findElement(By.id(\"hoa\")).sendKeys(hoa);\n\t\t\tThread.sleep(2000);\n\t\t\tSelect loan = new Select(driver.findElement(By.name(\"param[milserve]\")));\n\t\t\tloan.selectByVisibleText(loanType);\n\t\t\tSelect buyOrRefi = new Select(driver.findElement(By.name(\"param[refiorbuy]\")));\n\t\t\tbuyOrRefi.selectByVisibleText(buyRefi);\n\t\t\tThread.sleep(2000);\n\t\t\tSelect credit = new Select(driver.findElement(By.id(\"credit_rating\")));\n\t\t\tcredit.selectByVisibleText(creditRating);\n\t\t\tdriver.findElement(By.xpath(\"//input[@name='cal']\")).click();\n\t\t\treader.setCellData(\"Mortgage\", \"Status\", rowNum, \"Pass\");\n //reader.addColumn(\"Mortgage\", \"Status\");\n\t\t\tdriver.close();\n\n\t\t}\n\t}", "public static void main(String[] args) throws Exception {\n\t\t String filename =\"C:\\\\Users\\\\sures\\\\OneDrive\\\\Documents\\\\Testing\\\\Mydata.xlsx\";\r\n\t\tString sheetname=\"Sheet5\";\r\n\t\t\r\n\t\t///set browser path \r\n\t\tSystem.setProperty(\"webdriver.chrome.driver\", \"C://Drivers//chromedriver.exe\");\r\n\t\t\r\n\t\t\r\n\t\t///create browser instance\r\n\t\tWebDriver myDriver = new ChromeDriver();\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t///open test app \r\n\t\tmyDriver.navigate().to(\"http://www.facebook.com\");\r\n\t\t\r\n\t\t///capture B title \r\n\t\tString ActualBTitle = myDriver.getTitle();\r\n\t\tif(ActualBTitle.equalsIgnoreCase(\"Facebook - Log In or Sign Up\"))\r\n\t\t{\r\n\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 1,2,\"FB Homepage displayed\");\r\n\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 1, 3, \"Passed\");\t\t\t\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 1,2,\"FB Homepage not displayed\");\r\n\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 1, 3, \"Failed\");\r\n\t\t\t\r\n\t\t}\r\n\t\t//identify the login email\r\n\t\t\t\tWebElement myemail=myDriver.findElement(By.id(\"email\"));\r\n\t\t\t\t/////login emai displayed or not \r\n\t\t\t\tif(myemail.isDisplayed())\r\n\t\t\t\t{\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 2, 2, \"Login email displayed\");\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname,2, 3, \"Passed\");\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 2, 2, \"Login email not displayed\");\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 2, 3, \"Failed\");\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t///login email enabled or not \r\n\t\t\t\tif((myemail.isEnabled())==true)\r\n\t\t\t\t{\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 3, 2, \"Login email is enabled\");\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 3, 3, \"Passed\");\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 3, 2, \"Login email is not enabled\");\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 3, 3, \"Failed\");\r\n\t\t\t\t}\r\n\t\t\t\t///data read from excel and sheet is myData\r\n\t\t\t\tString myLoginEmail = poiexcelUDF.fnreadfrompoiexcel(filename, \"Sheet4\", 1, 0);\r\n\t\t\t\t\r\n\t\t\t\tmyemail.sendKeys(myLoginEmail);\r\n\t\t\t\t//capture data fro app\r\n\t\t\t\tString mylogindata=myemail.getAttribute(\"value\");\r\n\t\t\t\tif(myLoginEmail.equalsIgnoreCase(mylogindata))\r\n\t\t\t\t{\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 4,2,\"data is entered\");\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 4, 3, \"passed\");\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 4, 2, \"data is not entered\");\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 4, 3, \"failed\");\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t//identify pwdWebElement\r\n\t\t\t\tWebElement mypwd=myDriver.findElement(By.id(\"pass\"));\r\n\r\n\t\t\t\tif(mypwd.isDisplayed())\r\n\t\t\t\t{\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 5, 2,\"pwd is displayed\");\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 5, 3, \"passed\");\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 5, 2, \"pwd is not displayed\");\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 5, 3, \"failed\");\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t///pwd is enabled or not\r\n\t\t\t\tif(mypwd.isDisplayed())\r\n\t\t\t\t{\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 6, 2, \"pwd is enabled\");\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 6, 3, \" passed\");\r\n\t\t\t\t\t//identify pwdWebElement\r\n\t\t\r\n //data read from excel sheet is my data\r\n\t\t\t\t\tString pwd=poiexcelUDF.fnreadfrompoiexcel(filename, \"Sheet4\", 1, 1);\r\n\t\t\t\t\tmypwd.sendKeys(pwd);\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 6, 2, \"pwd is not enabled\");\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 6, 3, \"failed\");\r\n\t\t\t\t}\r\n\t\t\t\t///identify the login button\r\n\t\t\t\tWebElement loginb=myDriver.findElement(By.name(\"login\"));\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t///login button displayed or not \r\n\t\t\t\tif(loginb.isDisplayed())\r\n\t\t\t\t{\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 7, 2, \"login button is displayed\");\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 7, 3, \"passed\");\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 7, 2, \"login button is not displayed\");\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 7, 3, \"failed\");\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t///login button enabled or not \r\n\t\t\t\tif(loginb.isEnabled())\r\n\t\t\t\t{\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 8, 2, \"login button is enabled\");\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 8, 3, \"passed\");\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 8, 2, \"is not enabled\");\r\n\t\t\t\t\tpoiexcelUDF.fnwriteinexcel(filename, sheetname, 8, 3, \"failed\");\r\n\t\t\t\t}\r\n\t\t\t\tloginb.click();\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\r\n\r\n\t}", "public static void demo3() throws IOException, Exception {\n\n // HSSFWorkbook, File\n NPOIFSFileSystem fs = new NPOIFSFileSystem(new File(\"file.xls\"));\n HSSFWorkbook wb = new HSSFWorkbook(fs.getRoot(), true);\n fs.close();\n\n // HSSFWorkbook, InputStream, needs more memory\n NPOIFSFileSystem fs2 = new NPOIFSFileSystem(new FileInputStream(\"MyExcel.xlsx\"));\n HSSFWorkbook wb2 = new HSSFWorkbook(fs2.getRoot(), true);\n\n // XSSFWorkbook, File\n OPCPackage pkg = OPCPackage.open(new File(\"file.xlsx\"));\n XSSFWorkbook wb3 = new XSSFWorkbook(pkg);\n pkg.close();\n\n // XSSFWorkbook, InputStream, needs more memory\n OPCPackage pkg2 = OPCPackage.open(new FileInputStream(\"MyExcel.xlsx\"));\n XSSFWorkbook wb4 = new XSSFWorkbook(pkg);\n pkg.close();\n }", "public static void main (String [] args) throws IOException{\nFileInputStream fis = new FileInputStream(\"‪‪C://Users//dell//Desktop//data1.xls\");\r\nWorkbook workbook=WorkbookFactory.create(fis);\r\n\r\nSheet sheet1 = workbook.getSheet(\"Sheet2\");\r\n\r\nRow row0 = sheet1.getRow(0);\r\nCell cell00 = row0.getCell(0);\r\nString cellvalue00 = cell00.getStringCellValue();\r\nSystem.out.println(\"cell value is:\"+cellvalue00);\r\nCell cell01 = row0.getCell(1);\r\nString cellvalue01 = cell01.getStringCellValue();\r\nSystem.out.println(\"cell value is:\"+cellvalue01);\r\nRow row1 = sheet1.getRow(1);\r\nCell cell10 = row1.getCell(0);\r\nString cellvalue10 = cell10.getStringCellValue();\r\nSystem.out.println(\"cell value is:\"+cellvalue10);\r\nCell cell11 = row1.getCell(1);\r\nString cellvalue11 = cell11.getStringCellValue();\r\nSystem.out.println(\"cell value is:\"+cellvalue11);\r\n\r\n\r\n}", "public static void main(String args[]) throws WorkSheetNotFoundException, CellNotFoundException, FileNotFoundException, IOException{\r\n /*\r\n //Test 1 - Creating empty XLS\r\n FileOutputStream fo=new FileOutputStream(\"Result.xls\");\r\n WorkBookHandle h=new WorkBookHandle();\r\n WorkSheetHandle y = h.getWorkSheet(\"Sheet1\");\r\n y.add(\"aa\", \"A1\");\r\n h.writeBytes(fo);\r\n fo.close();\r\n */ \r\n \r\n }", "public static void main(String[] args) throws IOException,InterruptedException {\n\t\t\tChromeOptions option=new ChromeOptions();\r\n\t\t\toption.addArguments(\"--disable-notifications\");\r\n\t\t\tWebDriver driver=new ChromeDriver(option);\r\n\t\t\tdriver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);\r\n\t\t\tdriver.manage().window().maximize();\r\n\t\t\tdriver.get(\"https://www.bluestone.com\");\r\n\t\t\tActions action=new Actions(driver);\r\n\t\t\tString sheetName=\"Sheet1\";\r\n\t\t\tString path=\"./data/ringdata.xlsx\";\r\n\t\t\tWebElement element=driver.findElement(By.xpath(\"//div[@class='bottom-header']/descendant::nav/ul/li\"));\r\n\t\t\taction.moveToElement(element).perform();\r\n\t\t\tString mainmenu=\"//div[@class='bottom-header']/descendant::nav/ul/li/a[contains(text(),'Rings')]/following-sibling::div/descendant::div/div[@class='wh-submenu-header']\";\r\n\t\t WebElement subElement=driver.findElement(By.xpath(mainmenu));\r\n\t\t driver.findElement(By.xpath(\"//div[@class='bottom-header']/descendant::nav/ul/li/a[contains(text(),'Rings')]/following-sibling::div/descendant::div/div[@class='wh-submenu-header'and contains(text(),'Popular Ring Types')]/parent::div/ul/li/a[contains(text(),'Diamond')]\")).click();\r\n\t\t\tList<WebElement> priceVal=driver.findElements(By.xpath(\"//div[@class='inner pd-gray-bg']/descendant::span[@id='bst-discounted-price']\"));\r\n\t\t\tfor(int i=0;i<priceVal.size();i++)\r\n\t\t\t{\r\n\t\t\t\tString s=priceVal.get(i).getText();\r\n\t\t\t\tSystem.out.println(s);\r\n\t\t\t\tsetExcelData(path, sheetName, i, 0,s );\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\tThread.sleep(1000);\r\n\t\t\tWebElement sort=driver.findElement(By.xpath(\"//section[@class='block sort-by pull-right']\"));\r\n\t\t\tJavascriptExecutor js=(JavascriptExecutor)driver;\r\n\t\t\tjs.executeScript(\"window.scrollBy(0,150)\");\r\n\t\t\taction.moveToElement(sort).perform();\r\n\t\t\tThread.sleep(1000);\r\n\t\t\tdriver.findElement(By.xpath(\"//div[@id='view-sort-by']/div/a[text()='Price Low to High ']\")).click();\r\n\t\t\tThread.sleep(2000);\r\n\t\t\tList<WebElement> priceVal2=driver.findElements(By.xpath(\"//div[@class='inner pd-gray-bg']/descendant::span[@id='bst-discounted-price']\"));\r\n\t\t\tint count=priceVal.size();\r\n\t\t\tfor(int i=0;i<priceVal2.size();i++,count++)\r\n\t\t\t{\r\n\t\t\t\tString s=priceVal2.get(i).getText();\r\n\t\t\t\tSystem.out.println(s);\r\n\t\t\t\tsetExcelData(path, sheetName,i, 1,s );\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}", "public void parsingExcel() {\n theresFile = new File(pathTo).exists();\n if (theresFile) {\n try {\n FileInputStream myxls = new FileInputStream(pathTo);\n Workbook workbook = WorkbookFactory.create(myxls);\n //getting the sheet at index zero\n Sheet sheet = workbook.getSheetAt(0);\n int lastRow = sheet.getLastRowNum();\n System.out.println(\"currentID: \" + currentID);\n Row row2 = sheet.createRow(lastRow + 1);\n Data data = new Data(currentID++, jTextField1.getText(), jTextField2.getText(),\n jTextFieldModel.getText(), jTextFieldSerialN.getText(),\n Integer.parseInt(jTextFieldComments.getText()), jTextAreaDescription.getText());\n\n for (int i = 0; i < 7; i++) {\n Cell cell4 = row2.createCell(i);\n switch (i) {\n case 0:\n cell4.setCellValue(data.getID());\n break;\n case 1:\n cell4.setCellValue((String) data.getName());\n break;\n case 2:\n cell4.setCellValue((String) data.getDevice());\n break;\n case 3:\n cell4.setCellValue((String) data.getDeviceModel());\n break;\n case 4:\n cell4.setCellValue((String) data.getSerialNumber());\n break;\n case 5:\n cell4.setCellValue((int) data.getOptional());\n break;\n case 6:\n cell4.setCellValue((String) data.getDecription());\n break;\n }\n\n }\n FileOutputStream outputStream = new FileOutputStream(pathTo);\n workbook.write(outputStream);\n workbook.close();\n } catch (IOException ex) {\n Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);\n } catch (EncryptedDocumentException ex) {\n Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);\n }\n } else {\n if (jTextFieldComments.getText().equals(\"\") || jTextFieldComments.getText().equals(null)) {\n JOptionPane.showMessageDialog(null, \"Morate uneti količinu\");\n } else {\n try {\n Data data = new Data(1, jTextField1.getText(), jTextField2.getText(),\n jTextFieldModel.getText(), jTextFieldSerialN.getText(),\n Integer.parseInt(jTextFieldComments.getText()), jTextAreaDescription.getText());\n writtingExcelFile(makingExcelWorkbook(data));\n } catch (FileNotFoundException ex) {\n Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);\n }\n }\n }\n\n// try {\n// FileInputStream myxls = new FileInputStream(pathTo);\n// HSSFWorkbook studentsSheet = new HSSFWorkbook(myxls);\n// HSSFSheet worksheet = studentsSheet.getSheetAt(0);\n// int lastRow = worksheet.getLastRowNum();\n// System.out.println(lastRow);\n// Row row = worksheet.createRow(++lastRow);\n// row.createCell(1).setCellValue(\"Dr.Hola\");\n// myxls.close();\n// FileOutputStream output_file =new FileOutputStream(new File(\"poi-testt.xls\")); \n// //write changes\n// studentsSheet.write(output_file);\n// output_file.close();\n// System.out.println(\" is successfully written\");\n// } catch (Exception e) {\n// }\n }", "public static void main(String[] args) throws UnsupportedEncodingException, FileNotFoundException {\n InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(\"riddles.xls\");\n\t\t\n InputStream is = new FileInputStream(new File(\"C:\\\\Users\\\\sean\\\\workspace\\\\mlymoon\\\\src\\\\main\\\\resources\\\\riddles.xls\"));\n\t\tExcelUtil eu = new ExcelUtil();\n List<Object> ls = eu.importDataFromExcel(new Item(), in, \"riddles.xls\");\n for(Object item : ls){\n \t Item i = (Item) item;\n \t System.out.println(i.getAnswer()+\"##\"+i.getConundrum());\n }\n String[] excelHeader = { \"所属区域(地市)\", \"机房\", \"机架资源情况\", \n \t \"\", \"端口资源情况\", \"机位资源情况\", \"\", \"\", \"设备资源情况\", \n \t \"\", \"\", \"IP资源情况\", \"\", \"\", \"\", \"\", \"网络设备数\" };\n /*ApplicationContext context = \n\t new ClassPathXmlApplicationContext(\"appContext.xml\");\n\t CustomerService customerService = context.getBean(\"customerService\",CustomerService.class);\n List<Customer> customers=customerService.findAll(null, null);\n FileOutputStream fout = new FileOutputStream(\"I:/students.xls\"); \n\t\tExcelUtil eu = new ExcelUtil();\n\t\teu.exportDataToExcel(customers, excelHeader, \"dddddd\", fout);*/\n\t}", "public void processInput(Exchange exchange) {\n String fileName = (String) exchange.getIn().getHeaders().get(Exchange.FILE_NAME);\n logger.info(\"fileProcessing:{}\",fileName);\n try {\n List<DailyReconcilationRecord> dailyReconcilationRecordList = (List<DailyReconcilationRecord>)exchange.getIn().getBody();\n try (XSSFWorkbook xssfWorkbook = new XSSFWorkbook()) {\n XSSFSheet lasSheet = xssfWorkbook.createSheet(ReCAPConstants.DAILY_RR_LAS);\n xssfWorkbook.setSheetOrder(ReCAPConstants.DAILY_RR_LAS, 0);\n int i = 0;\n setColumnWidthForSheet(lasSheet);\n CellStyle cellStyle = xssfWorkbook.createCellStyle();\n cellStyle.setAlignment(HorizontalAlignment.LEFT);\n logger.info(\"started creating las sheet\");\n for (DailyReconcilationRecord dailyReconcilationRecord : dailyReconcilationRecordList) {\n XSSFRow row = lasSheet.createRow(i);\n createCell(xssfWorkbook, row,cellStyle, dailyReconcilationRecord.getRequestId(), 0);\n createCell(xssfWorkbook, row,cellStyle, dailyReconcilationRecord.getBarcode(), 1);\n createCell(xssfWorkbook, row,cellStyle, dailyReconcilationRecord.getCustomerCode(), 2);\n createCell(xssfWorkbook, row,cellStyle, dailyReconcilationRecord.getStopCode(), 3);\n createCell(xssfWorkbook, row,cellStyle, dailyReconcilationRecord.getPatronId(), 4);\n createCell(xssfWorkbook, row,cellStyle, dailyReconcilationRecord.getCreateDate(), 5);\n createCell(xssfWorkbook, row,cellStyle, dailyReconcilationRecord.getLastUpdatedDate(), 6);\n createCell(xssfWorkbook, row,cellStyle, dailyReconcilationRecord.getRequestingInst(), 7);\n createCell(xssfWorkbook, row,cellStyle, dailyReconcilationRecord.getOwningInst(), 8);\n createCell(xssfWorkbook, row,cellStyle, dailyReconcilationRecord.getDeliveryMethod(), 9);\n createCell(xssfWorkbook, row,cellStyle, dailyReconcilationRecord.getStatus(), 10);\n createCell(xssfWorkbook, row,cellStyle, dailyReconcilationRecord.getErrorCode(), 11);\n createCell(xssfWorkbook, row,cellStyle, dailyReconcilationRecord.getErrorNote(), 12);\n i++; \n }\n logger.info(\"completed creating las sheet\");\n Sheet readLasSheet = xssfWorkbook.getSheetAt(0);\n XSSFSheet scsbSheet = xssfWorkbook.createSheet(ReCAPConstants.DAILY_RR_SCSB);\n xssfWorkbook.setSheetOrder(ReCAPConstants.DAILY_RR_SCSB, 1);\n createHeader(scsbSheet);\n XSSFCellStyle dateCellStyle = getXssfCellStyleForDate(xssfWorkbook);\n logger.info(\"started creating scsb sheet\");\n for (int j = 1; j <= readLasSheet.getLastRowNum(); j++) {\n readValuesFromLasSheet(xssfWorkbook, readLasSheet, scsbSheet, dateCellStyle, j);\n }\n logger.info(\"completed creating scsb sheet\");\n compareLasAndScsbSheets(xssfWorkbook,cellStyle);\n SimpleDateFormat simpleDateFormat = new SimpleDateFormat(ReCAPConstants.DAILY_RR_FILE_DATE_FORMAT);\n FileOutputStream fileOutputStream = new FileOutputStream(filePath + \"/\" + ReCAPConstants.DAILY_RR + simpleDateFormat.format(new Date()) + \".xlsx\");\n xssfWorkbook.write(fileOutputStream);\n fileOutputStream.flush();\n fileOutputStream.close();\n logger.info(\"total number of sheets created {}\",xssfWorkbook.getNumberOfSheets());\n camelContext.startRoute(ReCAPConstants.DAILY_RR_FS_ROUTE_ID);\n logger.info(\"started \"+ReCAPConstants.DAILY_RR_FS_ROUTE_ID);\n }\n }\n catch (Exception e){\n logger.error(ReCAPConstants.LOG_ERROR + e);\n }\n logger.info(\"fileProcessed:{}\",fileName);\n }", "public static void main(String[] args) throws NullPointerException, Exception {\nFile f = new File(\"C:\\\\Users\\\\Mohit_Shobhit\\\\Music\\\\Book2xlsx.xlsx\");\r\n\tFileInputStream fi= new FileInputStream(f);\r\nXSSFWorkbook xs= new XSSFWorkbook(fi);\r\nXSSFSheet xt=xs.getSheet(\"Sheet1\");\r\n\tint r=xt.getPhysicalNumberOfRows();\r\n\tfor(int i=0;i<=r;i++)\r\n\t{\r\n\t\tXSSFRow xr=xt.getRow(i);\r\n\t\tfor(int j=0;j<xr.getPhysicalNumberOfCells();j++) \r\n\t\t{\r\n\t\t\tXSSFCell x=xr.getCell(j);\r\n\t\t\tSystem.out.println(x.getStringCellValue());\r\n\t\t}\r\n\t}\r\n\t}", "@Override\n\t\t\t\tpublic void onClick(View arg0) {\n\t\t\t\t\t\tif(filename==null){\n\t\t\t\t\t\t\tcommond.setToast( getApplication().getString(R.string.dilog_digtool_empty));\n\t\t\t\t\t\t}\n\t\t\t\t\t Xlsmake xls=new Xlsmake(xyz);\n\t\t\t\t try {\n xls.toxls(fname);\n commond.setToast( getApplication().getString(R.string.dilog_export_success));\n //Toast.makeText(getApplicationContext(), \"导出成功\", Toast.LENGTH_SHORT).show();\n } catch (RowsExceededException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n commond.setToast( getApplication().getString(R.string.dilog_export_fail));\n //Toast.makeText(getApplicationContext(), \"导出失败\", Toast.LENGTH_LONG).show();\n return ;\n } catch (WriteException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n commond.setToast( getApplication().getString(R.string.dilog_export_fail));\n //Toast.makeText(getApplicationContext(), \"导出失败\", Toast.LENGTH_LONG).show();\n return ;\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n commond.setToast( getApplication().getString(R.string.dilog_export_fail));\n //Toast.makeText(getApplicationContext(), \"导出失败\", Toast.LENGTH_LONG).show();\n return ;\n }\n\t\t\t\t}", "public static void main(String[] args) throws IOException {\n\t\tFile file = new File(\"C:\\\\Users\\\\Leonardo\\\\git\\\\repository5\\\\HandleExcelWithApachePoi\\\\src\\\\arquivo_excel.xls\");\r\n\t\t\r\n\t\tif (!file.exists()) {\r\n\t\t\tfile.createNewFile();\r\n\t\t}\r\n\t\t\r\n\t\tPessoa p1 = new Pessoa();\r\n\t\tp1.setEmail(\"[email protected]\");\r\n\t\tp1.setIdade(50);\r\n\t\tp1.setNome(\"Ricardo Edigio\");\r\n\t\t\r\n\t\tPessoa p2 = new Pessoa();\r\n\t\tp2.setEmail(\"[email protected]\");\r\n\t\tp2.setIdade(40);\r\n\t\tp2.setNome(\"Marcos Tadeu\");\r\n\t\t\r\n\t\tPessoa p3 = new Pessoa();\r\n\t\tp3.setEmail(\"[email protected]\");\r\n\t\tp3.setIdade(30);\r\n\t\tp3.setNome(\"Maria Julia\");\r\n\t\t\r\n\t\tList<Pessoa> pessoas = new ArrayList<Pessoa>();\r\n\t\tpessoas.add(p1);\r\n\t\tpessoas.add(p2);\r\n\t\tpessoas.add(p3);\r\n\t\t\r\n\t\t\r\n\t\tHSSFWorkbook hssfWorkbook = new HSSFWorkbook(); /*escrever na planilha*/\r\n\t\tHSSFSheet linhasPessoa = hssfWorkbook.createSheet(\"Planilha de pessoas\"); /*criar planilha*/\r\n\t\t\r\n\t\tint nlinha = 0;\r\n\t\tfor (Pessoa p : pessoas) {\r\n\t\t\tRow linha = linhasPessoa.createRow(nlinha ++); /*criando a linha na planilha*/\r\n\t\t\t\r\n\t\t\tint celula = 0;\r\n\t\t\t\r\n\t\t\tCell celNome = linha.createCell(celula ++); /*celula 1*/\r\n\t\t\tcelNome.setCellValue(p.getNome());\r\n\t\t\t\r\n\t\t\tCell celEmail = linha.createCell(celula ++); /*celula 2*/\r\n\t\t\tcelEmail.setCellValue(p.getEmail());\r\n\t\t\t\r\n\t\t\tCell celIdade = linha.createCell(celula ++); /*celula 3*/\r\n\t\t\tcelIdade.setCellValue(p.getIdade());\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\tFileOutputStream saida = new FileOutputStream(file);\r\n\t\thssfWorkbook.write(saida);\r\n\t\t\r\n\t\tsaida.flush();\r\n\t\tsaida.close();\r\n\t\t\r\n\t\tSystem.out.println(\"Planilha Criada com Sucesso!\");\r\n\t\t\r\n\t}", "public String excelScrFold() throws Exception \r\n\t\r\n\t{\n\t\t\t try{\t\t\t\t \r\n\t\t\t\t InputStream ExcelFileToRead = new FileInputStream(excelFilePath);\r\n\t\t\t\t\tXSSFWorkbook wb = new XSSFWorkbook(ExcelFileToRead);\r\n\t\t\t\t\t//XSSFWorkbook test = new XSSFWorkbook(); \r\n\t\t\t\t XSSFSheet sheet = wb.getSheetAt(0);\r\n\t\t\t\t XSSFRow row,rowvalue;\r\n\t\t\t\t Iterator<Row> rows = sheet.rowIterator();\r\n\t\t\t\t row = sheet.getRow(0);\r\n\t\t\t\t int i=0;\r\n\t\t\t\t int j=0;\r\n\t\t\t\t try {\r\n\t\t\t\t \t\r\n\t\t\t\t\t\t\tif(row.getCell(0).toString().equalsIgnoreCase(\"Release Number=\")){\r\n\t\t\t\t\t\t\tReleaseNum = row.getCell(1).toString().trim();\r\n\t\t\t\t\t\t\t//System.out.println(ReleaseNum);\r\n\t\t\t\t\t\t\t}else {\r\n\t\t\t\t\t\t\tSystem.out.println(\"Incorrect format\");\r\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\r\n\t\t\t\t\t } \r\n\t\t\t\t\t catch (NullPointerException e) \r\n\t\t\t\t\t {\r\n\t\t\t\t\t \tlogger.info(\"System Error: \"+e.toString());\r\n\t\t\t\t\t } \r\n\t\t\t\t }\r\n\t\t\t \r\n\t\t\t \r\n\t\t\t catch(Exception ioe) \r\n\t\t\t {\r\n\t\t\t\t logger.info(\"System Error: \"+ioe.toString());\r\n\t\t\t\t ioe.printStackTrace();\r\n\t\t\t }\t\t\t \r\n\t\t\t return ReleaseNum;\t \r\n\t}", "public static void main(String[] args) throws IOException {\n\r\n\t\tFile src = new File(\"C:\\\\Users\\\\new\\\\workspace\\\\FirstTestNGProject\\\\TestData\\\\InputData.xlsx\");\r\n\t\tFileInputStream fis = new FileInputStream(src);\r\n\t\tXSSFWorkbook wb = new XSSFWorkbook(fis);\r\n\t\tXSSFSheet sheet1 = wb.getSheetAt(0);\r\n\t\tint rowcount = sheet1.getLastRowNum();\r\n\t\tfor(int i=0;i<rowcount;i++){\r\n\t\t\tString data0 = sheet1.getRow(i).getCell(0).getStringCellValue();\r\n\t\t\tSystem.out.print(data0+\" \");\r\n\t\twb.close();\r\n\t}\r\n}", "@SuppressWarnings(\"deprecation\")\n@Test\n public void f() throws Exception{\nFile fi=new File(\"e://Loginwebtourdata.xls\");\n\t\t Workbook w=Workbook.getWorkbook(fi);\n\t\t Sheet s=w.getSheet(0);\n// Creating Result file in Results columns\n\t WritableWorkbook wwb=Workbook.createWorkbook(fi,w);\n\t\tWritableSheet sh=wwb.getSheet(0);\nfor (int i = 1; i < s.getRows(); i++) {\n//Enter username, Password and click on signin by taking data from testdata file\t\ndriver.findElement(By.name(\"userName\")).sendKeys(s.getCell(0, i).getContents());\ndriver.findElement(By.name(\"password\")).sendKeys(s.getCell(1, i).getContents());\ndriver.findElement(By.name(\"login\")).click();\n\tThread.sleep(1000);\n//Validate signout, if available assign Pass to str, else assign Fail to str\t\n\tif(selenium.isElementPresent(\"link=SIGN-OFF\"))\n\t{\n\tdriver.findElement(By.linkText(\"SIGN-OFF\")).click();\n\tThread.sleep(1000);\n\tdriver.get(\"http://newtours.demoaut.com\");\n\tdriver.manage().window().maximize();\n\tReporter.log(\"both user and password are valid\",true);\n\tstr=\"Pass\";\n\t}else{\n\t\tstr=\"Fail\";\n\t\tReporter.log(\"both user and password are invalid\",true);\n\t\t\t}\n// Add the str value to Result file under result column\t\n\tLabel result=new Label(2, i, str);\n\tsh.addCell(result);\n}//Add 3 labels in Result file\n\t\t Label rs=new Label(2,0,\"Result\");\n\t\t sh.addCell(rs);\n\t// Write and close result file\t \n\t\t wwb.write();\n\t\t wwb.close();\n\t\t }", "public static void main(String[] args) {\n\t\tString filepath = \"D:/JavaWorkSpaces/fhy/WebRoot/template/防护员信息表-Template.xls\";\n\t\tfilepath = \"C:/Users/Administrator/Downloads/防护员信息表数据导入模板 (2).xls\";\n\t\tfilepath = \"H:/个人资料/研发产品/04.工务段防护员管理系统/云梦线路车间_2018-12-12_日计划.xls\";\n\t\tfilepath = \"H:/个人资料/研发产品/04.工务段防护员管理系统/襄北线路车间2019-02-13日计划.xls\";\n\t\t//filepath = \"H:/个人资料/研发产品/04.工务段防护员管理系统/襄北线路车间2019-02-18至2019-02-18日计划.xls\";\n\t\t// filepath =\n\t\t// \"D:/JavaWorkSpaces/fhy/WebRoot/template/评价指标数据表-Template.xls\";\n\t\ttry {\n\t\t\t// filepath =\n\t\t\t// \"D:/JavaWorkSpaces/fhy/WebRoot/template/防护员信息表-Template.xls\";\n\t\t\t// filepath = \"H:/个人资料/研发产品/04.工务段防护员管理系统/客户提供数据/防护员信息表数据导入模板.xls\";\n\t\t\t// importData(filepath);\n\t\t\t// impl.importPjzbData(filepath,\"2\");\n\t\t\tFhyScoreImpl.importQgcjkData(filepath, \"admin\");\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public static void main(String[] args) throws Exception {\n\t\tFileInputStream f1 =new FileInputStream(\"C:\\\\Users\\\\Praveen\\\\eclipse-workspace\\\\SRYA\\\\EXEMAVEN\\\\target\\\\read.xlsx\");\n\t\tWorkbook w1 = new XSSFWorkbook(f1);\n\t\tSheet s1 = w1.getSheet(\"sheet1\");\n\t\tint r1 = s1.getLastRowNum();\n\t\tfor (int i = 1; i <=r1 ; i++) {\n\t\t\tString s2 = s1.getRow(i).getCell(0).getStringCellValue();\n\t\t\tString s3 = s1.getRow(i).getCell(1).getStringCellValue();\n\t\t\tString s4 = s1.getRow(i).getCell(2).getStringCellValue();\n\t\t\tSystem.out.println(s2);\n\t\t\tSystem.out.println(s3);\n\t\t\tSystem.out.println(s4);\n\t\t}\n\t}", "public void WriteResultsInExcel(String strExcelPath,String sheetName,LinkedHashMap<String, String>Results) throws IOException {\n FileInputStream inputStream = new FileInputStream(strExcelPath);\n\n Workbook guru99Workbook = null;\n\n //Find the file extension by splitting file name in substring and getting only extension name\n\n String fileExtensionName = strExcelPath.substring(strExcelPath.indexOf(\".\"));\n\n //Check condition if the file is xlsx file\n\n if(fileExtensionName.equals(\".xlsx\")){\n\n //If it is xlsx file then create object of XSSFWorkbook class\n\n guru99Workbook = new XSSFWorkbook(inputStream);\n\n }\n\n //Check condition if the file is xls file\n\n else if(fileExtensionName.equals(\".xls\")){\n\n //If it is xls file then create object of XSSFWorkbook class\n\n guru99Workbook = new HSSFWorkbook(inputStream);\n\n } \n\n //Read excel sheet by sheet name \n\n Sheet sheet = guru99Workbook.getSheet(sheetName);\n\n //Get the current count of rows in excel file\n\n int rowCount = sheet.getLastRowNum()-sheet.getFirstRowNum();\n\n //Get the first row from the sheet\n\n Row row = sheet.getRow(0);\n int column=row.getLastCellNum();\n for(int i=0;i<column;i++) {\n\t if(row.getCell(column).getStringCellValue().equalsIgnoreCase(\"TestResult\")) {\n\t\t column=i;\n\t\t break;\n\t }\n\n //Create a new row and append it at last of sheet\n\n // Row newRow = sheet.createRow(rowCount+1);\n\n //Create a loop over the cell of newly created Row\n\n for(int j = 1; j < sheet.getLastRowNum(); j++){\n\t for(Map.Entry<String, String>entry:Results.entrySet()) {\n\t\t if(entry.getKey().equalsIgnoreCase(sheet.getRow(j).getCell(0).getStringCellValue())) {\n\t\t\t sheet.getRow(j).getCell(column).setCellValue(entry.getValue().toString());\n\t\t\t break;\n\t\t }\n\t }\n\n //Fill data in row\n\n \n\n }\n\n //Close input stream\n\n inputStream.close();\n\n //Create an object of FileOutputStream class to create write data in excel file\n\n FileOutputStream outputStream = new FileOutputStream(strExcelPath);\n\n //write data in the excel file\n\n guru99Workbook.write(outputStream);\n\n //close output stream\n\n outputStream.close();\n\t\n }\n\n }", "@Test\n\t@Description(\"Principal test to run the workflow\")\n\tpublic void Principal_testcase() throws Exception {\n\t\tKeywordsOperations perform = new KeywordsOperations();\n\t\tReadFromFile readFile = new ReadFromFile();\n\t\t\n\t\t//Getting the data from the file\n\t\tXSSFSheet sheetData = readFile.ReadData(\"TestData.xlsx\", \"Sheet1\");\n\t\t\n\t\t//Getting the data times for waits\n\t\tXSSFSheet sheetDataTimes = readFile.ReadData(\"TestData.xlsx\", \"Sheet2\");\n\t\t\n\t\tArrayList<ArrayList<String>> OUT = new ArrayList<ArrayList<String>>();\n\t\t// Get iterator to all the rows in current sheet \n Iterator<Row> rowIterator = sheetDataTimes.iterator(); \n\n while (rowIterator.hasNext()) { \n Row row = rowIterator.next();\n ArrayList<String> InnerArray = new ArrayList<String>() ;\n // For each row, iterate through each columns \n Iterator<Cell> cellIterator = row.cellIterator(); \n\n while (cellIterator.hasNext()) {\n\n Cell cell = cellIterator.next(); \n\n switch (cell.getCellType().toString()) { \n \tcase \"STRING\": \n \t\tString c = cell.getStringCellValue();\n \t\tInnerArray.add(c);\n \t\tbreak; \n \tcase \"NUMERIC\": \n \t\tint n = (int) cell.getNumericCellValue();\n \t\tInnerArray.add(String.valueOf(n));\n \t\tbreak; \n \tdefault :\n \t\tbreak;\n } \n }\n \tOUT.add(InnerArray); \n }\n\t\t\n\t\t\n\t\t//Counting the rows with the important data for the test\n\t\tint rowCountData = sheetData.getLastRowNum() - sheetData.getFirstRowNum();\n\n\t\t\n\t\tfor(int i = 1; i < rowCountData + 1; i++) {\n\t\t\tRow row = sheetData.getRow(i);\n\t\t\t\n\t\t\tif(row != null) {\n\t\t\t\tif(row.getCell(0) == null || row.getCell(0).toString().length() == 0) {\n\t\t\t\t\tSystem.out.println(\"Step: \" + row.getRowNum());\n\t\t\t\t\tSystem.out.println(row.getCell(1) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(2) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(3) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(4) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(5) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(6) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(7) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(8) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(9) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(10) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(11) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(12) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(13) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(14) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(15));\n\t\t\t\t\t\n\t\t\t\t\t//Sending the cells with the data that the program will need\n\t\t\t\t\tperform.Perform(row.getCell(3), row.getCell(4), row.getCell(5), \n\t\t\t\t\t\t\trow.getCell(6), row.getCell(7), row.getCell(8), row.getCell(9), \n\t\t\t\t\t\t\trow.getCell(10), row.getCell(11), row.getCell(12), row.getCell(13), \n\t\t\t\t\t\t\trow.getCell(14), row.getCell(15), OUT);\n\t\t\t\t} else {\n\t\t\t\t\ttest = extentReport.createTest(row.getCell(0).toString());\n\t\t\t\t\t\n\t\t\t\t\tSystem.out.println(\"Step: \" + row.getRowNum());\n\t\t\t\t\tSystem.out.println(\"New test case: \" + row.getCell(0) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(1) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(2) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(3) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(4) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(5) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(6) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(7) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(8) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(9) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(10) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(11) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(12) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(13) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(14) + \" ------ \" +\n\t\t\t\t\t\t\trow.getCell(15));\n\t\t\t\t\t\n\t\t\t\t\t//Sending the cells with the data that the program will need\n\t\t\t\t\tperform.Perform(row.getCell(3), row.getCell(4), row.getCell(5), \n\t\t\t\t\t\t\trow.getCell(6), row.getCell(7), row.getCell(8), row.getCell(9), \n\t\t\t\t\t\t\trow.getCell(10), row.getCell(11), row.getCell(12), row.getCell(13), \n\t\t\t\t\t\t\trow.getCell(14), row.getCell(15), OUT);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "@Test(dataProvider=\"getExcelData\", priority=1)\n\t \n\t public void clientQuickLinks(String OrigionLocation, String Dest, String Item, String Count, String Weight, String Volume, String Client_Order, String Busunit, String GeneralLedger) throws InterruptedException, IOException {\n\t\tTC001_LoginOTM.getDriver().manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);\n\t\t \n\t\t TC001_LoginOTM.getDriver().switchTo().defaultContent();\n\t\t System.out.println(\"before sidebar\");\n\t\t TC001_LoginOTM.getDriver().switchTo().frame(\"sidebar\");\n\t\t System.out.println(\"After sidebar\");\n\t\t //click on client quick links \n\t\t TC001_LoginOTM.getDriver().findElement(By.xpath(\"//a[contains(text(),'Client Quick Links')]\")).click(); \t \n\t\t \n\t\t //click on FOE screen\n\t\t TC001_LoginOTM.getDriver().findElement(By.xpath(\"//a[text()='Fast Order Entry']\")).click();\n\t\t \t\t \n\t\t //Internal Login screen\n\t\t TC001_LoginOTM.getDriver().switchTo().defaultContent();\n\t\t TC001_LoginOTM.getDriver().switchTo().frame(\"mainBody\");\n\t\t\t\t \n\t\t //Internal username\n\t\t TC001_LoginOTM.getDriver().findElement(By.xpath(\"//*[@id='orderentryui-1928791928']/div/div[2]/div/div[1]/div/div/div/div[2]/div/div/div/div[2]/div/div/table/tbody/tr[1]/td[3]/input\")).clear();\n\t\t TC001_LoginOTM.getDriver().findElement(By.xpath(\"//*[@id='orderentryui-1928791928']/div/div[2]/div/div[1]/div/div/div/div[2]/div/div/div/div[2]/div/div/table/tbody/tr[1]/td[3]/input\")).sendKeys(\"MENLO.CLIENTA370\");\n\t\t \n\t\t //Internal password\n\t\t TC001_LoginOTM.getDriver().findElement(By.xpath(\"//*[@id=\\\"orderentryui-1928791928\\\"]/div/div[2]/div/div[1]/div/div/div/div[2]/div/div/div/div[2]/div/div/table/tbody/tr[2]/td[3]/input\")).clear();\n\t\t TC001_LoginOTM.getDriver().findElement(By.xpath(\"//*[@id=\\\"orderentryui-1928791928\\\"]/div/div[2]/div/div[1]/div/div/div/div[2]/div/div/div/div[2]/div/div/table/tbody/tr[2]/td[3]/input\")).sendKeys(\"Year2012??\");\n\t\t \n\t\t TC001_LoginOTM.getDriver().findElement(By.xpath(\"//html/body/div/div/div[2]/div/div[1]/div/div/div/div[2]/div/div/div/div[3]/div/div/span/span\")).click();\n \n\t\t \n\t\t //fast order entry screen\n\t\t TC001_LoginOTM.getDriver().switchTo().defaultContent();\n\t\t TC001_LoginOTM.getDriver().switchTo().frame(\"mainBody\");\n\t\t WebElement Origion = TC001_LoginOTM.getDriver().findElement(By.xpath(\"//html/body/div/div/div[2]/div/div[2]/div/div/div[2]/div/div[1]/div/div[2]/div/div/div[2]/div/div/div/div[2]/div/input\"));\n\t\t Origion.sendKeys(OrigionLocation);\n\t\t Thread.sleep(5000);\n\t\t //Origion.sendKeys(Keys.TAB);\n\t\t TC001_LoginOTM.getDriver().findElement(By.xpath(\"//html/body/div/div/div[2]/div/div[2]/div/div/div[2]/div/div[1]/div/div[2]/div/div/div[3]/div/div/div/div[2]/div/input\")).sendKeys(Dest);\n\t\t Thread.sleep(5000);\n\t\t \n\t\t TC001_LoginOTM.getDriver().findElement(By.xpath(\"//html/body/div/div/div[2]/div/div[2]/div/div/div[2]/div/div[1]/div/div[2]/div/div/div[7]/div/div/div/div[2]/div/div/div/div[1]/div/div/div/div[1]/div/div/div/div[1]/div/input\")).sendKeys(Item);\n\t\t Thread.sleep(5000);\n\t\t TC001_LoginOTM.getDriver().findElement(By.xpath(\"//html/body/div[3]/div/div/div/div[3]/div/div/div[2]/div/div/div[1]/div/div/div[2]/div[1]/table/tbody/tr[1]/td[1]/div\")).click();\n\t\t Thread.sleep(8000);\n\t\t \t\t \n\t\t //to enter count\n\t\t \n\t\t TC001_LoginOTM.getDriver().findElement(By.xpath(\"//html/body/div/div/div[2]/div/div[2]/div/div/div[2]/div/div[1]/div/div[2]/div/div/div[7]/div/div/div/div[2]/div/div/div/div[1]/div/div/div/div[1]/div/div/div/div[4]/div/input\")).sendKeys(Count);\n\t\t Thread.sleep(2000);\n\t\t TC001_LoginOTM.getDriver().findElement(By.xpath(\"//html/body/div/div/div[2]/div/div[2]/div/div/div[2]/div/div[1]/div/div[2]/div/div/div[7]/div/div/div/div[2]/div/div/div/div[1]/div/div/div/div[1]/div/div/div/div[5]/div/input\")).sendKeys(Weight);\n\t\t TC001_LoginOTM.getDriver().findElement(By.xpath(\"//html/body/div/div/div[2]/div/div[2]/div/div/div[2]/div/div[1]/div/div[2]/div/div/div[7]/div/div/div/div[2]/div/div/div/div[1]/div/div/div/div[1]/div/div/div/div[7]/div/input\")).sendKeys(Volume);\n\t\t Thread.sleep(9000);\n\t\t //changing date format\n\t\t //Create object of SimpleDateFormat class and decide the format\n\t\t DateFormat dateFormat = new SimpleDateFormat(\"M/d/yy\");\n\t\t //get current date time with Date()\n\t\t Date date = new Date();\n\t\t // Now format the date\n\t\t String date1= dateFormat.format(date);\n\t\t // to add 4 days to codays date\n\t\t Calendar cal = Calendar.getInstance();\n\t\t cal.setTime(date);\n\t\t cal.add(Calendar.DATE, 4); //minus number would decrement the days\n\t\t Date date2 = cal.getTime();\n\t\t String date3 = dateFormat.format(date2);\t\t \n\t\t \t\t \t\t \n\t\t //entering todays date fields\n\t\t TC001_LoginOTM.getDriver().findElement(By.xpath(\"//html/body/div/div/div[2]/div/div[2]/div/div/div[2]/div/div[1]/div/div[2]/div/div/div[9]/div/div/div/div[2]/div/div/div/div[2]/div/div/input\")).sendKeys(date1);\n\t\t // entering todays date +4 days\n\t\t Thread.sleep(2000);\n\t\t TC001_LoginOTM.getDriver().findElement(By.xpath(\"//html/body/div/div/div[2]/div/div[2]/div/div/div[2]/div/div[1]/div/div[2]/div/div/div[10]/div/div/div/div[3]/div/div/div/div[2]/div/div/input\")).sendKeys(date3);\n\t\t Thread.sleep(2000);\n\t\t TC001_LoginOTM.getDriver().findElement(By.xpath(\"//html/body/div/div/div[2]/div/div[2]/div/div/div[2]/div/div[1]/div/div[2]/div/div/div[12]/div/div/div/div/div[2]/div/input\")).sendKeys(Client_Order);\n\t\t Thread.sleep(2000);\n\t\t //selecting from combo box\n\t\t System.out.println(\"before selection element\");\n\t\t WebElement BusUnitElement = TC001_LoginOTM.getDriver().findElement(By.xpath(\"//html/body/div/div/div[2]/div/div[2]/div/div/div[2]/div/div[1]/div/div[2]/div/div/div[12]/div/div/div/div/div[6]/div/div/input\"));\n\t\t BusUnitElement.sendKeys(Busunit);\n\t \n\t\t //Select BusUnit = new Select(BusUnitElement);\n\t\t //BusUnit.selectByVisibleText(\"TRS\");\n\t\t System.out.println(\"After selection element\");\n\t\t Thread.sleep(5000);\n\t\t System.out.println(\"before premium check box element\");\n\t\t TC001_LoginOTM.getDriver().findElement(By.xpath(\"//*[@id=\\\"gwt-uid-3\\\"]\")).click();\n\t\t \n\t\t //select premium reason from combo box\n\t\t Thread.sleep(2000);\n\t\t WebElement PreReasonElement = TC001_LoginOTM.getDriver().findElement(By.xpath(\"//html/body/div/div/div[2]/div/div[2]/div/div/div[2]/div/div[1]/div/div[2]/div/div/div[12]/div/div/div/div/div[22]/div/div/select\"));\n\t\t Select PreReason = new Select(PreReasonElement);\n\t\t PreReason.selectByIndex(2);\n\t\t \n\t\t Thread.sleep(9000);\n\t\t \n\t\t //General Ledger from combo box\n\t\t WebElement GenLedElement = TC001_LoginOTM.getDriver().findElement(By.xpath(\"//html/body/div/div/div[2]/div/div[2]/div/div/div[2]/div/div[1]/div/div[2]/div/div/div[15]/div/div/div/div[2]/div/div/input\"));\n\t\t //Select GenLed = new Select(GenLedElement);\n\t\t //GenLed.selectByVisibleText(\"143-16400-000\");\n\t\t GenLedElement.sendKeys(GeneralLedger);\n\t\t Thread.sleep(5000);\n\t\t GenLedElement.sendKeys(Keys.ARROW_DOWN.ENTER);\n\t\t \n\t\t Thread.sleep(9000);\n\t\t \n\t\t //click on create button\n\t\t TC001_LoginOTM.getDriver().findElement(By.xpath(\"//html/body/div/div/div[2]/div/div[2]/div/div/div[2]/div/div[1]/div/div[2]/div/div/div[25]/div/div/div/div[1]/div/div/div/div[1]/div/div/div/div[1]/div/div/span/span\")).click();\n\t\t Thread.sleep(9000);\n\t\t \n\t\t \n\t\t \n\t\t //String message = \"//html/body/div/div/div[2]/div/div[2]/div/div/div[2]/div/div[1]/div/div[2]/div/div/div[25]/div/div/div/div[1]/div/div/div/div[2]/div/div/div/div[1]/div/div\";\n\t\t System.out.println(\"Before popup window\");\n\t\t new WebDriverWait(TC001_LoginOTM.getDriver(),30).until(ExpectedConditions.elementToBeClickable(By.xpath(\"//html/body/div/div/div[2]/div/div[2]/div/div/div[2]/div/div[1]/div/div[2]/div/div/div[25]/div/div/div/div[1]/div/div/div/div[2]/div/div\")));\n\t\t \n\t\t System.out.println(\"After popup window\");\n\t\t Thread.sleep(9000);\n\t\t \t\t \n\t\t \n\t\t String element_text = TC001_LoginOTM.getDriver().findElement(By.xpath(\"//html/body/div/div/div[2]/div/div[2]/div/div/div[2]/div/div[1]/div/div[2]/div/div/div[25]/div/div/div/div[1]/div/div/div/div[2]/div/div\")).getText();\n\t\t //splitting on the basis of space and taking index 1 to take order no \n\t\t String element_text_actual = element_text.split(\" \")[1];\n\t\t System.out.println(element_text_actual);\t\n\t\t \n\t\t\n\t\t try {\n\t\t\t //writing order no to Excel file\n\t\t\t // HSSFWorkbook wb = new HSSFWorkbook(); \n\t\t\t //CreationHelper createHelper = wb.getCreationHelper();\n\t\t\t //Sheet sheet = wb.createSheet(\"Sheet1\");\n\t\t\t \n\t\t\t //HSSFRow row = (HSSFRow) sheet.createRow(1);\n\t\t //HSSFCell cell;\n\t\t //Creating rows and filling them with data \n\t\t // cell = row.createCell(1);\n\t\t // cell.setCellValue(createHelper.createRichTextString(element_text_actual));\n\t\t\t // FileOutputStream fileOut;\n // fileOut = new FileOutputStream(\"Testdata/FOE_output.xls\");\n\t\t\t // wb.write(fileOut);\n\t\t\t // fileOut.close(); \n\t\t\t//create an object of Workbook and pass the FileInputStream object into it to create a pipeline between the sheet and eclipse.\n\t\t\t\tFileInputStream fis = new FileInputStream(\"Testdata/FOE_output.xlsx\");\n\t\t\t\tXSSFWorkbook workbook = new XSSFWorkbook(fis);\n\t\t\t\t//call the getSheet() method of Workbook and pass the Sheet Name here. \n\t\t\t\t//In this case I have given the sheet name as “TestData” \n\t\t //or if you use the method getSheetAt(), you can pass sheet number starting from 0. Index starts with 0.\n\t\t\t\tXSSFSheet sheet = workbook.getSheet(\"sheet1\");\n\t\t\t\t//XSSFSheet sheet = workbook.getSheetAt(0);\n\t\t\t\t//Now create a row number and a cell where we want to enter a value. \n\t\t\t\t//Here im about to write my test data in the cell B2. It reads Column B as 1 and Row 2 as 1. Column and Row values start from 0.\n\t\t\t\t//The below line of code will search for row number 2 and column number 2 (i.e., B) and will create a space. \n\t\t //The createCell() method is present inside Row class.\n\t\t XSSFRow row = sheet.createRow(1);\n\t\t\t\tCell cell = row.createCell(1);\n\t\t\t\t//Now we need to find out the type of the value we want to enter. \n\t\t //If it is a string, we need to set the cell type as string \n\t\t //if it is numeric, we need to set the cell type as number\n\t\t\t\tcell.setCellType(cell.CELL_TYPE_STRING);\n\t\t\t\tcell.setCellValue(element_text_actual);\n\t\t\t\tFileOutputStream fos = new FileOutputStream(\"Testdata/FOE_output.xlsx\");\n\t\t\t\tworkbook.write(fos);\n\t\t\t\tfos.close();\n\t\t\t\tSystem.out.println(\"END OF WRITING DATA IN EXCEL\");\n\t\t} catch (FileNotFoundException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t\t\n\t\t} \n\t\t\n\t\t Assert.assertTrue(element_text.contains(\"Order\"));\t\t \n\t\t \n\t }", "static Multimap<String, String> readELSXFile(String excelFileLoc, String sheetName) throws Exception {\n logger.info(\"Start executing readELSXFile method !!!\");\n\n Multimap<String, String> returnMap = ArrayListMultimap.create();\n Multimap<String, String> tags_to_select = ArrayListMultimap.create();\n Multimap<String, String> manaraFileFixSchemaMultiMap = LinkedListMultimap.create();\n Multimap<String, String> tags_wd_alias_lst = ArrayListMultimap.create();\n InputStream is = new FileInputStream(new File(excelFileLoc));\n\n Workbook workbook = StreamingReader.builder()\n .rowCacheSize(100) // number of rows to keep in memory (defaults to 10)\n .bufferSize(4096) // buffer size to use when reading InputStream to file (defaults to 1024)\n .open(is); // InputStream or File for XLSX file (required)\n\n // TODO: 12/11/2017 handle exception if sheet not present java.lang.NullPointerException\n Sheet sheet = workbook.getSheet(sheetName);\n// Printing process sheet name\n String sheetNm = sheet.getSheetName();\n logger.info(\"WorkBook/Sheet Name : \" + sheetNm);\n if (sheetNm.equals(\"TagNameAliases\")) {\n logger.info(\"Reading TagNameAliases sheet !!!!!!!\");\n for (Row r : sheet) {\n List<String> row = new ArrayList();\n for (Cell c : r) {\n String colVal = c.getStringCellValue();\n// TODO: do we have to take care for the empty/null values coming from columns or we can use directly add command\n if (colVal != null || colVal.length() > 0)\n row.add(colVal);\n else\n row.add(\"\");\n }\n// Removing the header from the excel read\n if (!row.get(0).equals(\"TagNameId\") && !row.get(1).equals(\"TagNameAlias\"))\n tags_wd_alias_lst.put(row.get(0), row.get(1));\n }\n returnMap = tags_wd_alias_lst;\n }\n\n if (sheetNm.equals(\"WWApp_Tags_to_select\")) {\n logger.info(\"Reading WWApp_Tags_to_select sheet !!!!!!!\");\n for (Row r : sheet) {\n List<String> row = new ArrayList();\n for (Cell c : r) {\n String colVal = c.getStringCellValue();\n if (colVal != null || colVal.length() > 0)\n row.add(colVal);\n else\n row.add(\"\");\n }\n if (row.size() == 31) {\n if (row.get(0).equals(\"Manara\") && row.get(28).equals(\"Diagnostic\")) {\n tags_to_select.put(row.get(30), row.get(4));\n }\n }\n }\n returnMap = tags_to_select;\n }\n if (sheetNm.equals(\"TagNames\")) {\n logger.info(\"Reading TagNames sheet !!!!!!!\");\n for (Row r : sheet) {\n List<String> row = new ArrayList();\n for (Cell c : r) {\n String colVal = c.getStringCellValue().replaceAll(\"\\\"\", \"\");\n if (colVal != null || colVal.length() > 0)\n row.add(colVal);\n else\n row.add(\"\");\n }\n if (!row.get(0).equals(\"TagNameId\") && !row.get(1).equals(\"Name\"))\n manaraFileFixSchemaMultiMap.put(row.get(0), row.get(1));\n else {\n// THIS HAS TO BE CHECKED\n manaraFileFixSchemaMultiMap.put(\"0\", \"Timestamp(+11:00)\");\n }\n }\n returnMap = manaraFileFixSchemaMultiMap;\n }\n return returnMap;\n }", "public static void main(String[] args) throws IOException {\n\t\t\nFile f = new File(\"C:\\\\Users\\\\Vinoth kumar\\\\eclipse-workspace\\\\ExcelProject\\\\Excel\\\\sample_Excel.xlsx\");\n\t// to get into the file\nFileInputStream fin = new FileInputStream(f);\n\t//to get into the workbook\nWorkbook w = new XSSFWorkbook(fin);\n//to get into the sheet\n Sheet sheet = w.getSheet(\"Sheet1\");\n//to get into the row\nRow row = sheet.getRow(1);\n//to get into the cell\nCell cell = row.getCell(1);\nSystem.out.println(cell);\n // int physicalNumberOfRows=sheet.getPhysicalNumberOfRows();\n // System.out.println(\"number of rows:\" +physicalNumberOfRows);\n\n // int physicalNumberOfCells = row.getPhysicalNumberOfCells();\n // System.out.println(\"number of cells:\"+physicalNumberOfCells);\n\n // to print all the value of a particular cell in all the rows\n\nfor (int i = 0; i < sheet.getPhysicalNumberOfRows(); i++) {\n\tRow row2 = sheet.getRow(i);\n\tCell cell2 =row2.getCell(2);\n\tSystem.out.println(cell2);\n}\n// to print all the values in a row\nfor (int i = 0; i < sheet.getPhysicalNumberOfRows(); i++) {\n\tCell cell2 = row.getCell(i);\n\tSystem.out.println(cell2);\n\t\n}\n// to print all the values in a sheet\nfor (int i = 0; i < sheet.getPhysicalNumberOfRows(); i++) {\n\tRow row2 = sheet.getRow(i);\nfor (int j = 0; j < row2.getPhysicalNumberOfCells(); j++) {\n\tCell cell2 = row2.getCell(j);\n\tSystem.out.println(cell2);\n\t}\n\t\n}\n\n\n\t}", "public static List<InputDto> readXLSXFile(File file) throws Exception {\n List<InputDto> inputDtos = new ArrayList<>();\n\n Integer i = 0;\n InputStream ExcelFileToRead = new FileInputStream(file);\n XSSFWorkbook wb = new XSSFWorkbook(ExcelFileToRead);\n\n XSSFWorkbook test = new XSSFWorkbook();\n\n XSSFSheet sheet = wb.getSheetAt(0);\n XSSFRow row;\n XSSFCell cell;\n\n Iterator rows = sheet.rowIterator();\n// ss = new String[sheet.getLastRowNum()];\n sheet.getLastRowNum();\n while (rows.hasNext()) {\n InputDto input = new InputDto();\n row = (XSSFRow) rows.next();\n Iterator cells = row.cellIterator();\n if (row.getRowNum() == 0) {\n continue; //just skip the rows if row number is 0 or 1\n }\n String s = \"\";\n while (cells.hasNext()) {\n cell = (XSSFCell) cells.next();\n\n if (cell.getCellType() == HSSFCell.CELL_TYPE_STRING) {\n// System.out.print(cell.getStringCellValue() + \" \");\n s += cell.getStringCellValue().trim() + \"|\";\n } else if (cell.getCellType() == HSSFCell.CELL_TYPE_NUMERIC) {\n// System.out.print(cell.getNumericCellValue() + \" \");\n s += cell.getRawValue().trim() + \"|\";\n } else if (cell.getCellType() == HSSFCell.CELL_TYPE_BLANK) {\n// System.out.print(cell.getNumericCellValue() + \" \");\n s += cell.getStringCellValue().trim() + \"|\";\n }\n /*else {\n //U Can Handel Boolean, Formula, Errors\n }*/\n }\n if (!s.equals(\"\") && s.split(\"\\\\|\").length == 8) {\n input.setLoadName(s.split(\"\\\\|\")[6]);\n input.setLoadSize(s.split(\"\\\\|\")[1]);\n input.setLoadDate(s.split(\"\\\\|\")[0]);\n input.setLoadPath(s.split(\"\\\\|\")[4]);\n input.setLoadType(s.split(\"\\\\|\")[2]);\n input.setCicsName(s.split(\"\\\\|\")[5]);\n input.setRowId(s.split(\"\\\\|\")[7]);\n System.out.println(input.getRowId());\n inputDtos.add(input);\n// ss[i] = s;\n\n } else {\n throw new Exception(\"EXCEL DATA IS NOT COMPELETED\");\n }\n i++;\n }\n\n return inputDtos;\n }", "public static void writeToExcelFromText() {\r\n\t\tExcelDataAccess payloadDataFile = new ExcelDataAccess(\r\n\t\t\t\t\"D:\\\\Users\\\\gawandejyostna\\\\Desktop\\\\WebServicesWorkspace\\\\GitRepo\\\\test-automation\\\\Bajaj_Automation\\\\Datatables\",\r\n\t\t\t\t\"CorrectPayloads\");\r\n\t\tpayloadDataFile.setDatasheetName(\"payloads\");\r\n\t\tint lastRowNum = payloadDataFile.getLastRowNum();\r\n\t\tfinal String TEXT_FILE_EXTENSION = \".txt\";\r\n\t\tFile[] packageDirectories = {\r\n\t\t\t\tnew File(\r\n\t\t\t\t\t\t\"D:\\\\Users\\\\gawandejyostna\\\\Desktop\\\\WebServicesWorkspace\\\\GitRepo\\\\test-automation\\\\Bajaj_Automation\\\\Datatables\\\\api\\\\inputrequests\"),\r\n\t\t\t\tnew File(\r\n\t\t\t\t\t\t\"D:\\\\Users\\\\gawandejyostna\\\\Desktop\\\\WebServicesWorkspace\\\\GitRepo\\\\test-automation\\\\Bajaj_Automation\\\\Datatables\\\\api\\\\exptresponse\\\\uat\") };\r\n\t\tfor (File packageDirectory : packageDirectories) {\r\n\t\t\tFile[] packageFiles = packageDirectory.listFiles();\r\n\t\t\tString packageName = packageDirectory.getName();\r\n\t\t\tString payloadColumn = \"Request Payload\";\r\n\t\t\tif (\"uat\".equals(packageName)) {\r\n\t\t\t\tpayloadColumn = \"Response Payload\";\r\n\t\t\t}\r\n\t\t\tfor (int i = 0; i < packageFiles.length; i++) {\r\n\t\t\t\tFile packageFile = packageFiles[i];\r\n\t\t\t\tString fileName = packageFile.getName();\r\n\t\t\t\tString fileNameWithoutExt = fileName.substring(0, fileName.indexOf(TEXT_FILE_EXTENSION));\r\n\t\t\t\t// We only want the .class files\r\n\t\t\t\tif (fileName.endsWith(TEXT_FILE_EXTENSION)) {\r\n\t\t\t\t\tString payload = readFromTextFile(packageFile);\r\n\t\t\t\t\tint rowNum = payloadDataFile.getRowNum(fileNameWithoutExt, 0);\r\n\t\t\t\t\tif (rowNum == -1) {\r\n\t\t\t\t\t\tlastRowNum = payloadDataFile.getLastRowNum();\r\n\t\t\t\t\t\trowNum = payloadDataFile.addRow();\r\n\t\t\t\t\t\tpayloadDataFile.setValue(rowNum, \"Test Case\", fileNameWithoutExt);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tpayloadDataFile.setValue(rowNum, payloadColumn,\r\n\t\t\t\t\t\t\tpayload.length() > 32000 ? payload.substring(0, 32000) : payload);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void compareTwoRows(XSSFRow row1, XSSFRow row2, XSSFRow row3,XSSFWorkbook xssfWorkbook,CellStyle cellStyle) {\n Cell sheet1RequestId = null;\n Cell sheet1Barcode = null;\n Cell sheet1Status = null;\n Cell sheet2RequestId = null;\n Cell sheet2Barcode = null;\n Cell sheet2Status = null;\n String sheet1LasStatus = null;\n String[] sheet1 = new String[3];\n String[] sheet2 = new String[3];\n if (row1 != null){\n sheet1RequestId = getRowValuesForCompare(row1,0);\n sheet1Barcode = getRowValuesForCompare(row1,1);\n sheet1Status = getRowValuesForCompare(row1,10);\n }\n if(row2 != null){\n sheet2RequestId = getRowValuesForCompare(row2,0);\n sheet2Barcode = getRowValuesForCompare(row2,1);\n sheet2Status = getRowValuesForCompare(row2,10);\n }\n if (checkCellIsNotEmpty(sheet1RequestId)){\n sheet1[0] = sheet1RequestId.getStringCellValue();\n }\n if (checkCellIsNotEmpty(sheet1Barcode)){\n sheet1[1] = sheet1Barcode.getStringCellValue().toUpperCase();\n }\n if (checkCellIsNotEmpty(sheet2RequestId)){\n sheet2[0] = sheet2RequestId.getStringCellValue();\n }\n if (checkCellIsNotEmpty(sheet2Barcode)){\n sheet2[1]=sheet2Barcode.getStringCellValue();\n }\n if (checkCellIsNotEmpty(sheet1Status)){\n sheet1LasStatus = getLasStatusForCompare(sheet1Status, sheet1);\n }\n if(checkCellIsNotEmpty(sheet2Status)){\n sheet2[2] = sheet2Status.getStringCellValue();\n }\n boolean equalRow = Arrays.equals(sheet1, sheet2);\n buidComparisionSheet(row3, xssfWorkbook, sheet1LasStatus, sheet1, sheet2, equalRow,cellStyle);\n }", "public static void main(String[] args) throws Exception {\n File source= new File(\"C:/Development/DataFiles/LoginData.xlsx\");\r\n FileInputStream fis = new FileInputStream(source);\r\n XSSFWorkbook wb = new XSSFWorkbook(fis);\r\n\tXSSFSheet sh = wb.getSheetAt(0);\r\n//\tString data0= sh.getRow(1).getCell(1).getStringCellValue();\r\n//\tSystem.out.println( data0);\r\n\tint rowcount=sh.getLastRowNum();\r\n\t//string colcount=sh.col\r\n\t//System.out.println( colcount);\r\n/*\tfor (int i=0;i<=rowcount;i++)\r\n\t{\r\n\t\tString data1= sh.getRow(i).getCell(0).getStringCellValue();\r\n\t\tif (data1==\"end\")\r\n\t\t\t{\r\n\t\t\t\t\tsh.getRow(i+1);\r\n\t\t\t}\r\n\t\t\r\n\t\tSystem.out.println(data1);\r\n\t\tSystem.out.println();\r\n\t}*/\r\n\t\r\n\tfor (@SuppressWarnings(\"rawtypes\") org.apache.poi.ss.usermodel.Sheet sh1 : wb ) {\r\n for (Row row : sh) {\r\n for (Cell cell : row) {\r\n // Do something here\r\n }\r\n }\r\n }\r\n\twb.close();\r\n\t}", "@Test\n public void readExcelFile(){\n\n ExcelUtil qa3short =new ExcelUtil(\"src/test/resources/Vytracktestdata.xlsx\", \"QA3-short\");\n\n //how many row in the sheet\n System.out.println(\"qa3short.rowCount() = \" + qa3short.rowCount());\n //qa3short.rowCount() = 14\n\n //how many columns in the sheet\n System.out.println(\"qa3short.columnCount() = \" + qa3short.columnCount());\n //qa3short.columnCount() = 4\n\n //get all column names\n System.out.println(\"qa3short.getColumnsNames() = \" + qa3short.getColumnsNames());\n //qa3short.getColumnsNames() = [username, password, firstname, lastname]\n\n //get all data in List of maps\n\n //qa3short.getDataList(); right click create variable\n List<Map<String, String>> dataList = qa3short.getDataList();\n\n //iter --- onerow\n\n for (Map<String, String> onerow : dataList) {\n System.out.println( onerow);\n //{password=UserUser123, firstname=John, username=user1, lastname=Doe}\n //{password=UserUser123, firstname=Kyleigh, username=user4, lastname=Reichert}\n //{password=UserUser123, firstname=Nona, username=user5, lastname=Carroll}\n //{password=UserUser123, firstname=Geovany, username=storemanager51, lastname=Jenkins}\n //{password=UserUser123, firstname=Roma, username=storemanager52, lastname=Medhurst}\n //{password=UserUser123, firstname=Aditya, username=storemanager53, lastname=Rempel}\n //{password=UserUser123, firstname=Turner, username=storemanager54, lastname=Considine}\n //{password=UserUser123, firstname=Rachel, username=storemanager55, lastname=Oberbrunner}\n //{password=UserUser123, firstname=Peyton, username=salesmanager101, lastname=Harber}\n //{password=UserUser123, firstname=Patricia, username=salesmanager102, lastname=Doyle}\n //{password=UserUser123, firstname=Nellie, username=salesmanager103, lastname=Corwin}\n //{password=UserUser123, firstname=Nikita, username=salesmanager104, lastname=Wintheiser}\n //{password=UserUser123, firstname=Geraldine, username=salesmanager105, lastname=Parisian}\n\n }\n\n //get Nona as a value\n System.out.println(\"dataList.get(2) = \" + dataList.get(2));\n //dataList.get(2) = {password=UserUser123, firstname=Nona, username=user5, lastname=Carroll}\n System.out.println(\"dataList.get(2) = \" + dataList.get(2).get(\"firstname\"));\n //dataList.get(2) = Nona\n\n\n //get all data in 2d array\n\n String [][] dataArray =qa3short.getDataArray();\n\n System.out.println(Arrays.deepToString(dataArray));\n //[[username, password, firstname, lastname], [user1, UserUser123, John, Doe], [user4, UserUser123, Kyleigh, Reichert], [user5, UserUser123, Nona, Carroll], [storemanager51, UserUser123, Geovany, Jenkins], [storemanager52, UserUser123, Roma, Medhurst], [storemanager53, UserUser123, Aditya, Rempel], [storemanager54, UserUser123, Turner, Considine], [storemanager55, UserUser123, Rachel, Oberbrunner], [salesmanager101, UserUser123, Peyton, Harber], [salesmanager102, UserUser123, Patricia, Doyle], [salesmanager103, UserUser123, Nellie, Corwin], [salesmanager104, UserUser123, Nikita, Wintheiser], [salesmanager105, UserUser123, Geraldine, Parisian]]\n\n\n\n }", "public static void main(String[] args) throws IOException {\n FileInputStream fi=new FileInputStream(\"C:\\\\Users\\\\SURENDRA\\\\Documents\\\\msexel1.xlsx\");\r\n Workbook wb= new XSSFWorkbook(fi);\r\n // wb.createSheet(\"MIN5\");\r\n \r\n \r\n FileOutputStream fo=new FileOutputStream(\"C:\\\\Users\\\\SURENDRA\\\\Documents\\\\msexel2.xlsx\");\r\n wb.write(fo);\r\n wb.close();\r\n fi.close();\r\n fo.close();\r\n \r\n \r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t}", "public static void main(String[] args) throws IOException {\n\t\tFileInputStream fis=new FileInputStream(System.getProperty(\"user.dir\")+ \"\\\\src\\\\test\\\\java\\\\resources\\\\Excel.xlsx\");\n\t\tXSSFWorkbook workbook=new XSSFWorkbook(fis);\n\t\t int sheets=workbook.getNumberOfSheets();\n\t\t System.out.println(sheets);\n\t\t for(int i=0;i<sheets;i++)\n\t\t {\n\t\t \t if(workbook.getSheetName(i).equalsIgnoreCase(\"testdata\"))\n\t\t \t {\n\t\t \t\tXSSFSheet sheet=workbook.getSheetAt(i);\n\t\t \t\t//access to all the rows\n\t\t \t\t Iterator<Row> rows= sheet.iterator();\n\t\t \t\t //to print allthe values from the excel sheet\n\t\t \t\t while(rows.hasNext())\n\t\t \t\t {\n\t\t \t\t Row r\t=rows.next();\n\t\t \t\t \n\t\t \t\t Iterator<Cell> ce=r.cellIterator();\n\t\t \t\t while(ce.hasNext())\n\t \t\t {\n\t \t\t \tSystem.out.println(ce.next().getStringCellValue());\n\t \t\t }\n\t\t \t\t \n\t\t \t\t \n\t\t \t\t }\n\t\t \t\t \n\n\t\t \t\t \n\t\t \t\t \n\t\t \t\t \t\t \n\t\t \t\t \t}\n\t\t \t\t }\n\t\t \t\t \n\t\t \t\t \n\t\t \t }", "public static void main(String[] args) {\n\t\t String astanaFile = \"C:/Users/S.M.Didar/Dropbox/Didar DBPC/PhD Research/Winter 2015/ICSE 2016/Experiment/ExpV4/mbostock,d3/\"; \r\n\t\t String hpFile = \"C:/Users/S.M.Didar/Dropbox/Didar DBPC/PhD Research/Winter 2015/ICSE 2016/Experiment/ExpV4/mbostock,d3/HP/\"; \r\n\t\t String fileName = \"weeklyRate.xls\"; \r\n\t\t String sheetName = \"RRVal\"; \r\n\t\t \r\n\t\t \r\n\t\t readExcelFile (astanaFile, fileName, sheetName, astanaData,80); \r\n\t\t readExcelFile (hpFile , fileName, sheetName, hpData,80); \r\n\t\t\r\n//\t\t System.out.println(astanaData.size()+\"ggggggggggggggggggggg\");\r\n//\t\t for (int i=0;i<astanaData.size();i++){\r\n//\t\t\tSystem.out.println(astanaData.get(i).RRVal); \r\n//\t\t\tSystem.out.println(astanaData.get(i).RRLevel); \r\n//\t\t }\r\n\t\t \r\n\t\t \r\n//\t\t for (int i=0;i<hpData.size();i++){\r\n//\t\t\t\tSystem.out.println(hpData.get(i).RRVal); \r\n//\t\t\t\tSystem.out.println(hpData.get(i).RRLevel); \r\n//\t\t\t }\r\n\t\t \r\n\t\t \r\n\t\t precisioncalc (); \r\n\t\t \r\n\t\t \r\n\t\t resultsCalc (astanaFile, hpPrecision, \"HPAccuracy\"); \r\n\t\t resultsCalc (astanaFile, astanaPrecision, \"AstanaAccuracy\" ); \r\n\r\n\t}", "public static void main(String[] args) throws Exception {\n\t\tFileInputStream file= new FileInputStream(\"C:\\\\Users\\\\Sonali\\\\Desktop\\\\Automation\\\\POI.xlsx\");\n\t\t\n\t\t// Step2: Import XSSFWorkbook\n\t\tXSSFWorkbook w=new XSSFWorkbook(file);\n\t\t\n\t\t//Step3: Import XSSFWorsksheet\n\t\tXSSFSheet s=w.getSheet(\"ReadData\");\n\t\t\n\t\t//Step4: Read Data\n\t\tString a=s.getRow(0).getCell(0).getStringCellValue();\n\t\tString b=s.getRow(0).getCell(1).getStringCellValue();\n\t\tint c=(int) s.getRow(0).getCell(2).getNumericCellValue();\n\t\t\n\t\t//Step 5: Display data\n\t\tSystem.out.println(a+\"\\t\\t\" +b+\"\\t\\t\"+c);\t\n\t}", "@Test(priority = 1, groups = \"test\")\r\n\tpublic void AddSchemeProcess() throws IOException, InterruptedException\r\n\t{\r\n\t\tFile src = new File(\"C:\\\\Users\\\\Admin\\\\Desktop\\\\DD_FrmWrk\\\\Videocon\\\\TC_04_Add_Scheme.xls\");\r\n\t\tFileInputStream fin = new FileInputStream(src);\r\n\t\twb = new HSSFWorkbook(fin);\r\n\t\tsheet = wb.getSheetAt(0);\r\n\t\t\r\n\t\tfor(int i = 1; i<=sheet.getLastRowNum(); i++)\r\n\t\t{\r\n\t\t\ttry \r\n\t\t\t{\r\n\t\t\t\twait.until(ExpectedConditions.elementToBeClickable(addButton));\r\n\t\t\t\tdriver.findElement(addButton).click();\r\n\t\t\t\twait.until(ExpectedConditions.visibilityOfElementLocated(categoryDD));\r\n\t\t\t\textent.log(LogStatus.INFO, \"Scheme master page opened.\");\r\n\t\t\t\t\r\n\t\t\t\t//Step-1] Import data for Category.\r\n\t\t\t\tcell = sheet.getRow(i).getCell(1);\r\n\t\t\t\tcell.setCellType(Cell.CELL_TYPE_STRING);\r\n\t\t\t\tSelect category = new Select(driver.findElement(categoryDD));\r\n\t\t\t\tcategory.selectByVisibleText(cell.getStringCellValue());\r\n\t\t\t\t\r\n\t\t\t\t//Step-2] Import data for Sub Category.\r\n\t\t\t\tcell = sheet.getRow(i).getCell(2);\r\n\t\t\t\tcell.setCellType(Cell.CELL_TYPE_STRING);\r\n\t\t\t\tSelect subCategory = new Select(driver.findElement(subCategoryDD));\r\n\t\t\t\tsubCategory.selectByVisibleText(cell.getStringCellValue());\r\n\t\t\t\t\r\n\t\t\t\t//Step-3] Import data for Name.\r\n\t\t\t\tcell = sheet.getRow(i).getCell(3);\r\n\t\t\t\tcell.setCellType(Cell.CELL_TYPE_STRING);\r\n\t\t\t\tdriver.findElement(name).sendKeys(cell.getStringCellValue());\r\n\t\t\t\tdriver.findElement(name).sendKeys(Keys.ENTER);\r\n\t\t\t\tThread.sleep(3500);\r\n\t\t\t\t//Step-3] Import data for Code.\r\n\t\t\t\tcell = sheet.getRow(i).getCell(4);\r\n\t\t\t\tcell.setCellType(Cell.CELL_TYPE_STRING);\r\n\t\t\t\tdriver.findElement(code).sendKeys(cell.getStringCellValue());\r\n\t\t\t\t\r\n\t\t\t\t//Step-4] Input for Start date.\r\n\t\t\t\tdriver.findElement(startDate).click();\r\n\t\t\t\tdriver.findElement(By.xpath(\".//*[@id='ContentPlaceHolder1_schememaster_startdate_today']\")).click();\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t// Step-5] Input data for End date.\r\n\t\t\t\tdriver.findElement(endDate).sendKeys(\"2016-12-22\");\r\n\t\t\t\tdriver.findElement(endDate).sendKeys(Keys.ENTER);\r\n\t\t\t\t\r\n\t\t\t\t// Step-6] Import data for Product group and Iterate.\r\n\t\t\t\tcell = sheet.getRow(i).getCell(5);\r\n\t\t\t\tcell.setCellType(Cell.CELL_TYPE_STRING);\r\n\t\t\t\tString productGroupString = cell.getStringCellValue();\r\n\t\t\t\tList<String> productGrpArray = Arrays.asList(productGroupString.split(\",\"));\r\n\t\t\t\t\r\n\t\t\t\t// Step-7] Import data for CP.\r\n\t\t\t\tcell = sheet.getRow(i).getCell(6);\r\n\t\t\t\tcell.setCellType(Cell.CELL_TYPE_STRING);\r\n\t\t\t\tString cpString = cell.getStringCellValue();\r\n\t\t\t\tList<String> cpArray = Arrays.asList(cpString.split(\",\"));\r\n\t\t\t\t\r\n\t\t\t\t// Step-8] Import data for Del charge %.\r\n\t\t\t\tcell = sheet.getRow(i).getCell(7);\r\n\t\t\t\tcell.setCellType(Cell.CELL_TYPE_STRING);\r\n\t\t\t\tString delChargeString = cell.getStringCellValue();\r\n\t\t\t\tList<String> delChargeArray = Arrays.asList(delChargeString.split(\",\"));\r\n\t\t\t\t\r\n\t\t\t\t// Step-9] Import data for Discount %.\r\n\t\t\t\tcell = sheet.getRow(i).getCell(8);\r\n\t\t\t\tcell.setCellType(Cell.CELL_TYPE_STRING);\r\n\t\t\t\tString discountString = cell.getStringCellValue();\r\n\t\t\t\tList<String> discountArray = Arrays.asList(discountString.split(\",\"));\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t// Step-10] Iterate the process for the data retrieved in steps 7 to 9.\r\n\t\t\t\tfor(int j = 0; j<productGrpArray.size(); j++)\r\n\t\t\t\t{\r\n\t\t\t\t\t// Create ID for product group drop down.\r\n\t\t\t\t\tString firstPartIDprdctGrp = \"ContentPlaceHolder1_schememaster_Grdscheme_ddlScheme_\";\r\n\t\t\t\t\tString finalPartIDprdctGrp = firstPartIDprdctGrp+j;\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Create ID for CP.\r\n\t\t\t\t\tString firstPartIdCP = \"ContentPlaceHolder1_schememaster_Grdscheme_txttempcp_price_\";\r\n\t\t\t\t\tString finalpartIdCP = firstPartIdCP+j;\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Create ID for DelCharge %.\r\n\t\t\t\t\tString firstPartIdDelCharge = \"ContentPlaceHolder1_schememaster_Grdscheme_txttemp_delcharge_\";\r\n\t\t\t\t\tString finalpartIdDelCharge = firstPartIdDelCharge+j;\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Create ID for Discount %.\r\n\t\t\t\t\tString firstPartIdDiscount = \"ContentPlaceHolder1_schememaster_Grdscheme_txttemp_discount_\";\r\n\t\t\t\t\tString finalpartIdDiscount = firstPartIdDiscount+j;\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Select product group drop down.\r\n\t\t\t\t\tSelect productGroup = new Select(driver.findElement(By.id(finalPartIDprdctGrp)));\r\n\t\t\t\t\tproductGroup.selectByVisibleText(productGrpArray.get(j));\r\n\t\t\t\t\tThread.sleep(3500);\r\n\t\t\t\t\t// Write data for CP.\r\n\t\t\t\t\tdriver.findElement(By.id(finalpartIdCP)).sendKeys(cpArray.get(j));\r\n\t\t\t\t\tdriver.findElement(By.id(finalpartIdCP)).sendKeys(Keys.ENTER);\r\n\t\t\t\t\tThread.sleep(3500);\r\n\t\t\t\t\t// Write data for Del charge %.\r\n\t\t\t\t\tdriver.findElement(By.id(finalpartIdDelCharge)).sendKeys(delChargeArray.get(j));\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Write data for Discount %.\r\n\t\t\t\t\tdriver.findElement(By.id(finalpartIdDiscount)).sendKeys(discountArray.get(j));\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Click on \"Add Product Group\" if more than 1 Product group exists.\r\n\t\t\t\t\tint rowCount = driver.findElements(By.xpath(\".//*[@id='ContentPlaceHolder1_schememaster_Grdscheme']/tbody/tr\")).size();\r\n\t\t\t\t \r\n\t\t\t\t\tif(productGrpArray.size() > 1 && rowCount <= productGrpArray.size())\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdriver.findElement(addProductGroup).click();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// Step-11] Import data for length.\r\n\t\t\t\tcell = sheet.getRow(i).getCell(9);\r\n\t\t\t\tcell.setCellType(Cell.CELL_TYPE_STRING);\r\n\t\t\t\tdriver.findElement(dimensionLength).sendKeys(cell.getStringCellValue());\r\n\t\t\t\tdriver.findElement(dimensionLength).sendKeys(Keys.ENTER);\r\n\t\t\t\tThread.sleep(3500);\r\n\t\t\t\t\r\n\t\t\t\t// Step-12] Import data for breadth.\r\n\t\t\t\tcell = sheet.getRow(i).getCell(10);\r\n\t\t\t\tcell.setCellType(Cell.CELL_TYPE_STRING);\r\n\t\t\t\tdriver.findElement(dimensionBreadth).sendKeys(cell.getStringCellValue());\r\n\t\t\t\tdriver.findElement(dimensionBreadth).sendKeys(Keys.ENTER);\r\n\t\t\t\tThread.sleep(3500);\r\n\t\t\t\t\r\n\t\t\t\t// Step-13] Import data for height.\r\n\t\t\t\tcell = sheet.getRow(i).getCell(11);\r\n\t\t\t\tcell.setCellType(Cell.CELL_TYPE_STRING);\r\n\t\t\t\tdriver.findElement(dimensionHeight).sendKeys(cell.getStringCellValue());\r\n\t\t\t\tdriver.findElement(dimensionHeight).sendKeys(Keys.ENTER);\r\n\t\t\t\tThread.sleep(3500);\r\n\t\t\t\t\r\n\t\t\t\t// Step-14] Import data for Multiplying factor.\r\n\t\t\t\tcell = sheet.getRow(i).getCell(12);\r\n\t\t\t\tcell.setCellType(Cell.CELL_TYPE_STRING);\r\n\t\t\t\tdriver.findElement(multiplyingFactor).clear();\r\n\t\t\t\tdriver.findElement(multiplyingFactor).sendKeys(cell.getStringCellValue());\r\n\t\t\t\tdriver.findElement(multiplyingFactor).sendKeys(Keys.ENTER);\r\n\t\t\t\tThread.sleep(3500);\r\n\t\t\t\t\r\n\t\t\t\t// Step-14] Import data for Dividing factor.\r\n\t\t\t\tcell = sheet.getRow(i).getCell(13);\r\n\t\t\t\tcell.setCellType(Cell.CELL_TYPE_STRING);\r\n\t\t\t\tdriver.findElement(dividingFactor).clear();\r\n\t\t\t\tdriver.findElement(dividingFactor).sendKeys(cell.getStringCellValue());\r\n\t\t\t\tdriver.findElement(dividingFactor).sendKeys(Keys.ENTER);\r\n\t\t\t\tThread.sleep(3500);\r\n\t\t\t\t\r\n\t\t\t\t// Step-16] Import data for Weight.\r\n\t\t\t\tcell = sheet.getRow(i).getCell(14);\r\n\t\t\t\tcell.setCellType(Cell.CELL_TYPE_STRING);\r\n\t\t\t\tdriver.findElement(weightTxtBox).sendKeys(cell.getStringCellValue());\r\n\t\t\t\t\r\n\t\t\t\t // Step-17] Import data for Weight unit.\r\n\t\t\t\tcell = sheet.getRow(i).getCell(15);\r\n\t\t\t\tcell.setCellType(Cell.CELL_TYPE_STRING);\r\n\t\t\t\tSelect weightUnit = new Select(driver.findElement(weightUnitDD));\r\n\t\t\t\tweightUnit.selectByVisibleText(cell.getStringCellValue());\r\n\t\t\t\t\r\n\t\t\t\t // Step-18] Import data for Delivery charges.\r\n\t\t\t\tcell = sheet.getRow(i).getCell(16);\r\n\t\t\t\tcell.setCellType(Cell.CELL_TYPE_STRING);\r\n\t\t\t\tSelect deliveryCharges = new Select(driver.findElement(delChargesDD));\r\n\t\t\t\tdeliveryCharges.selectByVisibleText(cell.getStringCellValue());\r\n\t\t\t\t\r\n\t\t\t\t// Step-19] Import data for Loyalty points.\r\n\t\t\t\tcell = sheet.getRow(i).getCell(17);\r\n\t\t\t\tcell.setCellType(Cell.CELL_TYPE_STRING);\r\n\t\t\t\tdriver.findElement(loyaltyPoints).sendKeys(cell.getStringCellValue());\r\n\t\t\t\t\r\n\t\t\t\t// Step-20] Import data for mode.\r\n\t\t\t\tcell = sheet.getRow(i).getCell(18);\r\n\t\t\t\tcell.setCellType(Cell.CELL_TYPE_STRING);\r\n\t\t\t\tString mode = cell.getStringCellValue();\r\n\t\t\t\t\r\n\t\t\t\t// Check for the retreived data and click accordingly.\r\n\t\t\t\tif(mode.equalsIgnoreCase(\"AIR\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tdriver.findElement(By.id(\"ContentPlaceHolder1_schememaster_rdmode_0\")).click();\r\n\t\t\t\t\tThread.sleep(3500);\r\n\t\t\t\t}\r\n\t\t\t\tif(mode.equalsIgnoreCase(\"SURFACE\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tdriver.findElement(By.id(\"ContentPlaceHolder1_schememaster_rdmode_1\")).click();\r\n\t\t\t\t\tThread.sleep(3500);\r\n\t\t\t\t}\r\n\t\t\t\tif(mode.equalsIgnoreCase(\"BOTH\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tdriver.findElement(By.id(\"ContentPlaceHolder1_schememaster_rdmode_2\")).click();\r\n\t\t\t\t\tThread.sleep(3500);\r\n\t\t\t\t\t// Step-20] Import data for priority.\r\n\t\t\t\t\tcell = sheet.getRow(i).getCell(19);\r\n\t\t\t\t\tcell.setCellType(Cell.CELL_TYPE_STRING);\r\n\t\t\t\t\twait.until(ExpectedConditions.visibilityOfElementLocated(By.id(\"ContentPlaceHolder1_schememaster_ddlmodepri\")));\r\n\t\t\t\t\tSelect priority = new Select(driver.findElement(By.id(\"ContentPlaceHolder1_schememaster_ddlmodepri\")));\r\n\t\t\t\t\tpriority.selectByVisibleText(cell.getStringCellValue());\r\n\t\t\t\t}\r\n\t\t\t\t// Click on the packing box.\r\n\t\t\t\tdriver.findElement(By.xpath(\".//*[@id='ContentPlaceHolder1_schememaster_lstpacking']/option[3]\")).click();\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t// Step-22] Click on submit button.\r\n\t\t\t\tdriver.findElement(submitButton).click();\r\n\t\t\t\t\r\n\t\t\t\ttry \r\n\t\t\t\t{\r\n\t\t\t\t\tAlert alert = driver.switchTo().alert();\r\n\t\t\t\t\tString alertMsg = alert.getText();\r\n\t\t\t\t\tif(alertMsg.equalsIgnoreCase(\"Are you sure to Submit this record?\"))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\talert.accept();\r\n\t\t\t\t\t\twait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(\".//*[@id='ContentPlaceHolder1_schememaster_pnlwarehouse']/div/table/tbody/tr[1]/td[1]\")));\r\n\t\t\t\t\t\tdriver.findElement(By.xpath(\".//*[@id='ContentPlaceHolder1_schememaster_pnlwarehouse']/div/table/tbody/tr[1]/td[1]\")).sendKeys(Keys.ESCAPE);\r\n\t\t\t\t\t wait.until(ExpectedConditions.visibilityOfElementLocated(By.id(\"ContentPlaceHolder1_schememaster_lblmsg\")));\r\n\t\t\t\t\t String successMsg = driver.findElement(By.id(\"ContentPlaceHolder1_schememaster_lblmsg\")).getText();\r\n\t\t\t\t\t System.out.println(successMsg);\r\n\t\t\t\t\t extent.log(LogStatus.PASS, successMsg);\r\n\t\t\t\t\t sheet.getRow(i).createCell(21).setCellValue(alertMsg);\r\n\t\t\t\t\t\tFileOutputStream fout = new FileOutputStream(src);\r\n\t\t\t\t\t\twb.write(fout);\r\n\t\t\t\t\t\tfout.close();\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\textent.log(LogStatus.ERROR, \"Error message\" +alertMsg);\r\n\t\t\t\t\t\tsheet.getRow(i).createCell(20).setCellValue(alertMsg);\r\n\t\t\t\t\t\tFileOutputStream fout = new FileOutputStream(src);\r\n\t\t\t\t\t\twb.write(fout);\r\n\t\t\t\t\t\tfout.close();\r\n\t\t\t\t\t\ttry \r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\talert.accept();\r\n\t\t\t\t\t\t\tAlert alert1 = driver.switchTo().alert();\r\n\t\t\t\t\t\t\talert1.accept();\r\n\t\t\t\t\t\t} \r\n\t\t\t\t\t\tcatch (Exception e) \r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\t\tSystem.out.println(\"Second alert is not present\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} \r\n\t\t\t\tcatch (Exception e)\r\n\t\t\t\t{\r\n\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t}\r\n\t\t\t\tdriver.get(driver.getCurrentUrl());\r\n\t\t\t} \r\n\t\t\tcatch (Exception e)\r\n\t\t\t{\r\n\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\r\n\t\t}\r\n\t\treports.endTest(extent);\r\n\t\treports.flush();\r\n\t}", "public void actionSearch_actionPerformed(ActionEvent e)\r\n\t\tthrows Exception {\n querys();\r\n /* for (int i=0;i<100;i++){\r\n\t\t Thread t = new Thread(new ExecuteThread(3L));\r\n\t\t t.start();\r\n\t\t latch.countDown();\r\n\t }\r\n\tThread.currentThread().sleep(3000);*/\r\n//\t System.out.println(totalCount+\"人抢到这条记录\");\r\n\t /** \r\n\t * yg 2016年10月19日 15:42:20 读取excel中的信息执行批量插入 数据 \r\n\t * \r\n\t InputStream is = new FileInputStream(\"D:/开票数据整理(161018) .xls\");\r\n\t String[][] result = ExcelOperate.getData(is, 1);\r\n\t \r\n\r\n\t int rowLength = result.length;\r\n\t String Customerid =\"\";\r\n\t BigDecimal amount=BigDecimal.ZERO;\r\n\t for(int i=0;i<rowLength;i++) {\r\n\r\n\t\t for(int j=0;j<result[i].length;j++) {\r\n\r\n\t\t System.out.print(result[i][j]+\"\\t\\t\");\r\n\t\t Customerid=result[i][0];\r\n\t\t amount=new BigDecimal(result[i][2]);\r\n\t\t }\r\n\t\t InvoiceInfo objectValue = new InvoiceInfo();\r\n\t\t objectValue.setCreator(UserFactory.getRemoteInstance().getUserInfo(new ObjectUuidPK(BOSUuid.read(\"00000000-0000-0000-0000-00000000000013B7DE7F\"))));\r\n\t\t objectValue.setBizDate(new Date());\r\n\t\t objectValue.setType(InvoiceTypeEnum.box);\t\r\n\t\t objectValue.setInvoiceKind(InvoiceKindEnum.special);\r\n\t\t objectValue.setOutputUnit(OutputUnitEnum.dlzb);\r\n\t\t objectValue.setInvoiceUnit(InvoiceUnitFactory.getRemoteInstance().getInvoiceUnitInfo(new ObjectUuidPK(BOSUuid.read(\"dKkAAAIaG6WpHse9\"))));\r\n\t\t CustomerInfo customerInfo = CustomerFactory.getRemoteInstance().getCustomerInfo(new ObjectUuidPK(BOSUuid.read(Customerid)));\r\n\t\t PersonInfo personInfo=null;\r\n\t\t try {\r\n\t\t ISaleOrder iSaleOrder = SaleOrderFactory.getRemoteInstance();\r\n\t\t personInfo= iSaleOrder.getSaler(customerInfo.getId().toString());\r\n\t\t } catch (Exception e1) {\r\n\t\t\te1.printStackTrace();\r\n\t\t}\r\n\t\t objectValue.setInvoiceMan(personInfo);\r\n\t\t objectValue.setCustomer(customerInfo);\r\n\t\t //ivoiceNum\r\n\t\t objectValue.setIvoiceNum(\"0\");\r\n\t\t //invoiceAmt\r\n\t\t objectValue.setInvoiceAmt(amount);\r\n\t\t objectValue.setProduct(ProductNameEnum.box);\r\n\t\t //productUnit\r\n\t\t objectValue.setProductUnit(ProductUnitEnum.merely);\r\n\t\t //arBillNumber\r\n\t\t objectValue.setArBillNumber(\"2014年及以前数据调整\");\r\n\t\t IObjectPK pk = InvoiceFactory.getRemoteInstance().submit(objectValue);\r\n\r\n\t\t System.out.println();\r\n\r\n\t }\r\n\t **/\r\n\t}", "public static void readfile() throws IOException {\n\t\t\n String excelFilePath = \"D:\\\\Docs\\\\Study Docs\\\\11th Semester\\\\CSE400\\\\Works\\\\Database\\\\StudentInfo.xlsx\";\n FileInputStream inputStream = new FileInputStream(new File(excelFilePath));\n \n Workbook workbook = new XSSFWorkbook(inputStream);\n Sheet firstSheet = workbook.getSheetAt(0);\n Iterator<Row> iterator = firstSheet.iterator();\n int flag=0;\n \n while (iterator.hasNext()) {\n Row nextRow = iterator.next();\n Iterator<Cell> cellIterator = nextRow.cellIterator();\n int c=0;\n String cid=\"\",sid=\"\";\n \n while (cellIterator.hasNext()) {\n Cell cell = cellIterator.next();\n if(c==0){//If it is first value\n \tsid=cell.getStringCellValue();\n \tc=1;\n }\n else{//If it is second value\n \tcid=cell.getStringCellValue();\n }\n }\n if(insert_data(sid,cid)==false) flag=1;//Insert to MSaccess\n //System.out.println(sid+\" \"+cid);\n }\n \n workbook.close();\n inputStream.close();\n if(flag==0)JOptionPane.showMessageDialog(null, \"All value imported successfully.\");\n else JOptionPane.showMessageDialog(null, \"Value importing was interrupted.\");\n }", "public static void main(String[] args) throws Exception {\n\t\t\n\t\tFile src = new File(\"/home/likewise-open/HTCINDIA/mkarthik/workspace/testproject/testdata/testdata.xls\");\n\t\t\n\t\tFileInputStream fis = new FileInputStream(src);\n\t\t\n\t\tHSSFWorkbook wb=new HSSFWorkbook(fis);\n\t\tHSSFSheet sheet1 = wb.getSheetAt(0);\n\t\t\n\t//String\tdata = sheet1.getRow(0).getCell(0).getStringCellValue();\n\t\t//System.out.println(data);\n\t\t\n\t\tint getrow =sheet1.getLastRowNum();\n\t\t\n\t\tSystem.out.println(getrow);\n\t\t\n\t\tfor(int i=0; i < getrow; i=i+1)\n\t\t{\n\t\t\tString data1 = sheet1.getRow(i).getCell(0).getStringCellValue();\n\t\t\tString data2 = sheet1.getRow(i).getCell(1).getStringCellValue();\n\t\t\tSystem.out.println(data1);\n\t\t\tSystem.out.println(data2);\n\t\t}\n\t\t\n\t\twb.close();\n\n\t}", "public void Ejecutar() throws IOException {\n\t\t// An excel file name. You can create a file name with a full\n\t\t// path information.\n\t\t//\n\t\tString filename = \"excel/bd.xls\";\n\t\t//\n\t\t// Create an ArrayList to store the data read from excel sheet.\n\t\t//\n\t\tList sheetData = new ArrayList();\n\t\tFileInputStream fis = null;\n\t\ttry {\n\t\t\t//\n\t\t\t// Create a FileInputStream that will be use to read the\n\t\t\t// excel file.\n\t\t\t//\n\t\t\tfis = new FileInputStream(filename);\n\t\t\t//\n\t\t\t// Create an excel workbook from the file system.\n\t\t\t//\n\t\t\tHSSFWorkbook workbook = new HSSFWorkbook(fis);\n\t\t\t//\n\t\t\t// Get the first sheet on the workbook.\n\t\t\t//\n\t\t\tHSSFSheet sheet = workbook.getSheetAt(0);\n\t\t\t//\n\t\t\t// When we have a sheet object in hand we can iterator on\n\t\t\t// each sheet's rows and on each row's cells. We store the\n\t\t\t// data read on an ArrayList so that we can printed the\n\t\t\t// content of the excel to the console.\n\t\t\t//\n\t\t\tIterator rows = sheet.rowIterator();\n\t\t\twhile (rows.hasNext()) {\n\t\t\t\tHSSFRow row = (HSSFRow) rows.next();\n\n\t\t\t\tIterator cells = row.cellIterator();\n\t\t\t\tList data = new ArrayList();\n\t\t\t\twhile (cells.hasNext()) {\n\t\t\t\t\tHSSFCell cell = (HSSFCell) cells.next();\n\t\t\t\t\t// System.out.println(\"Añadiendo Celda: \" + cell.toString());\n\t\t\t\t\tdata.add(cell);\n\t\t\t\t}\n\t\t\t\tsheetData.add(data);\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\tif (fis != null) {\n\t\t\t\tfis.close();\n\t\t\t}\n\t\t}\n\t\tshowExelData(sheetData);\n\n\t\t// impresion de matriz\n\t\t/*\n\t\t * for (int filas = 0; filas <fila; filas++) { for (int columna = 0; columna <\n\t\t * 4; columna++) { if(columna<3) {\n\t\t * \n\t\t * \n\t\t * }else { System.out.println(\"\"); }\n\t\t * \n\t\t * } }\n\t\t */\n\n\t\tint matriz2[][] = new int[fila][3];\n\n\t\tint numeroDeDatosMatriz = 0;\n\n\t\tfor (int filas = 0; filas < fila; filas++) {\n\t\t\tint validar = 0;\n\n\t\t\tfor (int recorrido = 0; recorrido < numeroDeDatosMatriz; recorrido++) {\n\t\t\t\tif (validar == 1) {\n\t\t\t\t\t// System.out.println(\"si encontro\");\n\t\t\t\t\t// break;\n\t\t\t\t}\n\n\t\t\t\t// System.out.print(matriz[filas][0]+\"|\");\n\t\t\t\t// System.out.println(matriz2[recorrido][0]+\"|\");\n\n\t\t\t\tif (matriz[filas][0] == matriz2[recorrido][0]) {\n\t\t\t\t\tmatriz2[recorrido][1] = matriz2[recorrido][1] + matriz[filas][1];\n\t\t\t\t\tmatriz2[recorrido][2] = matriz2[recorrido][2] + matriz[filas][2];\n\t\t\t\t\tvalidar = 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (validar == 0) {\n\t\t\t\tmatriz2[numeroDeDatosMatriz][0] = matriz[filas][0];\n\t\t\t\tmatriz2[numeroDeDatosMatriz][1] = matriz[filas][1];\n\t\t\t\tmatriz2[numeroDeDatosMatriz][2] = matriz[filas][2];\n\t\t\t\tnumeroDeDatosMatriz++;\n\n\t\t\t}\n\n\t\t\tif (validar == 1) {\n\t\t\t\tvalidar = 0;\n\t\t\t}\n\n\t\t}\n\t\t// impresion del contro general\n\t\t/*\n\t\t * \n\t\t * for (int filas = 0; filas <fila; filas++) { for (int columna = 0; columna <\n\t\t * 4; columna++) { if(columna<3) {\n\t\t * \n\t\t * System.out.print(matriz2[filas][columna]+\"|\"); }else {\n\t\t * System.out.println(\"\"); }\n\t\t * \n\t\t * } }\n\t\t */\n\t\t//////////// Pedir numero\n\t\t\n\t\tint numero = Integer.parseInt( JOptionPane.showInputDialog(\n\t\t\t null,\"¿Qué numeros con importe arriba de ?\",\n\t\t\t \"Petición \",\n\t\t\t JOptionPane.QUESTION_MESSAGE) );\n\t\t\n\t\t\n\t\t////////\n\t\tint matrizresultados[][] = new int[fila][2];\n\n\t\t// filtro primer lugar\n\n\t\tint numeroDeresultadosPrimerLugar = 0;\n\n\t\tfor (int filas = 0; filas < fila; filas++) {\n\t\t\tif (matriz2[filas][1] > numero) {\n\t\t\t\tmatrizresultados[numeroDeresultadosPrimerLugar][0] = matriz2[filas][0];\n\t\t\t\tmatrizresultados[numeroDeresultadosPrimerLugar][1] = matriz2[filas][1];\n\t\t\t\tnumeroDeresultadosPrimerLugar++;\n\t\t\t}\n\t\t}\n\n\t\tfor (int filas = 0; filas < numeroDeresultadosPrimerLugar; filas++) {\n\t\t\t// System.out.print(matrizresultados[filas][0]+\"|\");\n\t\t\t// System.out.println(matrizresultados[filas][1]);\n\t\t}\n\n\t\t//\n\n\t\t////////\n\n\t\t// System.out.println(\"///////////////////////////////////////////////\");\n\t\tint matrizresultadosSegundo[][] = new int[fila][2];\n\n\t\t// filtro primer lugar\n\n\t\tint numeroDeresultadosSegundoLugar = 0;\n\n\t\tfor (int filas = 0; filas < fila; filas++) {\n\t\t\tif (matriz2[filas][2] > numero) {\n\t\t\t\tmatrizresultadosSegundo[numeroDeresultadosSegundoLugar][0] = matriz2[filas][0];\n\t\t\t\tmatrizresultadosSegundo[numeroDeresultadosSegundoLugar][1] = matriz2[filas][2];\n\t\t\t\tnumeroDeresultadosSegundoLugar++;\n\t\t\t}\n\t\t}\n\n\t\tfor (int filas = 0; filas < numeroDeresultadosSegundoLugar; filas++) {\n\t\t\t// System.out.print(matrizresultadosSegundo[filas][0]+\"|\");\n\t\t\t// System.out.println(matrizresultadosSegundo[filas][1]);\n\t\t}\n\n\t\t//\n\n\t\tString textoArchivo = \"\";\n\n\t\tint numeroDeFilasCrearExcel = 0;\n\n\t\tfor (int lugar = 0; lugar < 2; lugar++) {\n\t\t\tif (lugar == 0) {\n\t\t\t\ttextoArchivo = \"Primeros lugares\";\n\t\t\t\tnumeroDeFilasCrearExcel = numeroDeresultadosPrimerLugar;\n\t\t\t} else {\n\t\t\t\ttextoArchivo = \"Segundos lugares\";\n\t\t\t\tnumeroDeFilasCrearExcel = numeroDeresultadosSegundoLugar;\n\t\t\t}\n\n\t\t\t/* La ruta donde se creará el archivo */\n\t\t\tString rutaArchivo = System.getProperty(\"user.home\") + \"/\" + textoArchivo + \".xls\";\n\t\t\t/* Se crea el objeto de tipo File con la ruta del archivo */\n\t\t\tFile archivoXLS = new File(rutaArchivo);\n\t\t\t/* Si el archivo existe se elimina */\n\t\t\tif (archivoXLS.exists())\n\t\t\t\tarchivoXLS.delete();\n\t\t\t/* Se crea el archivo */\n\t\t\tarchivoXLS.createNewFile();\n\n\t\t\t/* Se crea el libro de excel usando el objeto de tipo Workbook */\n\t\t\tWorkbook libro = new HSSFWorkbook();\n\t\t\t/* Se inicializa el flujo de datos con el archivo xls */\n\t\t\tFileOutputStream archivo = new FileOutputStream(archivoXLS);\n\n\t\t\t/*\n\t\t\t * Utilizamos la clase Sheet para crear una nueva hoja de trabajo dentro del\n\t\t\t * libro que creamos anteriormente\n\t\t\t */\n\t\t\tSheet hoja = libro.createSheet(textoArchivo+\" arriba de \" + numero);\n\n\t\t\t/* Hacemos un ciclo para inicializar los valores de 10 filas de celdas */\n\t\t\tfor (int f = 0; f < numeroDeFilasCrearExcel + 1; f++) {\n\t\t\t\t/* La clase Row nos permitirá crear las filas */\n\t\t\t\tRow fila = hoja.createRow(f);\n\n\t\t\t\t/* Cada fila tendrá 5 celdas de datos */\n\t\t\t\tfor (int c = 0; c < 2; c++) {\n\t\t\t\t\t/* Creamos la celda a partir de la fila actual */\n\t\t\t\t\tCell celda = fila.createCell(c);\n\n\t\t\t\t\t/* Si la fila es la número 0, estableceremos los encabezados */\n\t\t\t\t\tif (f == 0) {\n\t\t\t\t\t\tif (c == 0) {\n\t\t\t\t\t\t\tcelda.setCellValue(\"Numero Ganador\");\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcelda.setCellValue(textoArchivo+\" arriba de \" + numero);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif (lugar == 0) {\n\t\t\t\t\t\t\t/* Si no es la primera fila establecemos un valor */\n\t\t\t\t\t\t\tif(c==0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(matrizresultados[f - 1][c]<100) \n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tcelda.setCellValue(\"0\" + matrizresultados[f - 1][c]);\n\t\t\t\t\t\t\t\t}else \n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tcelda.setCellValue(\"\" + matrizresultados[f - 1][c]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}else \n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcelda.setCellValue(\"\" + matrizresultados[f - 1][c]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif(c==0) \n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(matrizresultadosSegundo[f - 1][c]<100) \n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tcelda.setCellValue(\"0\" + matrizresultadosSegundo[f - 1][c]);\n\t\t\t\t\t\t\t\t}else \n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tcelda.setCellValue(\"\" + matrizresultadosSegundo[f - 1][c]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}else \n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcelda.setCellValue(\"\" + matrizresultadosSegundo[f - 1][c]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/* Escribimos en el libro */\n\t\t\tlibro.write(archivo);\n\t\t\t/* Cerramos el flujo de datos */\n\t\t\tarchivo.close();\n\t\t\t/* Y abrimos el archivo con la clase Desktop */\n\t\t\tDesktop.getDesktop().open(archivoXLS);\n\n\t\t}\n\n\t}", "protected int DoLoadMissingFile(java.sql.Connection pConnection, ChannelSftp channelSftp, int pFtpID, String pReceiveFrom, String pDirReceive, int pRemoteFileSplitByDay, int pZipAfterDownload, int pRenameAfterDownload, int pSeqFrom, int pSeqTo, int pRenameType, String pNewPreFix, String pNewExt, String pCurrMissedDir) throws Exception\n {\n \tSimpleDateFormat sdf = new SimpleDateFormat(\"EEE MMM dd HH:mm:ss zzz yyyy\");\n \tSimpleDateFormat sdfComparator = new SimpleDateFormat(\"yyyyMMddHHmmss\");\n SimpleDateFormat sdf2 = new SimpleDateFormat(\"yyyyMMdd\");\n File file = null;\n File fileRename = null;\n String mSourceName = null;\n String mDestinationName = null;\n int mRetValue;\n String mReceiveFrom = null;\n String mNewFileName = null;\n IOUtils IOUtil = new IOUtils();\n ResultSet rs = null;\n Statement stmt1 = mConnection.createStatement();\n SmartZip zip = new SmartZip();\n Statement stmt = null;\n String mSQL = \"select distinct a.current_dir_missed,\" + \"to_char(sysdate-b.time_check,'yyyymmddhh24miss') min_date_check \" + \"from missed_file a,data_param b \" + \"where a.status=0 and a.switch_id=b.id and b.id=\" + pFtpID;\n ResultSet rs1 = stmt1.executeQuery(mSQL);\n try\n {\n mReceiveFrom = pReceiveFrom;\n \n channelSftp.cd(pReceiveFrom);\n\n //FTPFile[] listings = pFtp.dirDetails(\"\"); //Duyet cac thu muc tren ftp\n Vector<LsEntry> fileList = channelSftp.ls(pReceiveFrom);\n for (LsEntry contain : fileList)\n {\n if (contain.getAttrs().isDir())\n {\n if (!contain.getFilename().startsWith(\".\") )\n {\n if (pRemoteFileSplitByDay == 1)\n {\n\n if (Global.isNumeric(contain.getFilename()))\n {\n while (rs1.next() && miThreadCommand != THREAD_STOP)\n {\n if ((rs1.getString(\"current_dir_missed\") != null) && ((Integer.parseInt(rs1.getString(\"current_dir_missed\"))) == (Integer.parseInt(contain.getFilename()))))\n {\n if (\"/\".compareTo(pReceiveFrom.substring(pReceiveFrom.length() - 1)) != 0)\n {\n mReceiveFrom = pReceiveFrom + \"/\" + contain.getFilename();\n }\n else\n {\n mReceiveFrom = pReceiveFrom + contain.getFilename();\n }\n \n if (Long.parseLong(sdfComparator.format(sdf.parse(contain.getAttrs().getMtimeString()))) > Long.parseLong(rs1.getString(\"min_date_check\")))\n {\n writeLogFile(\" - Subdirectory listing: \" + contain.getFilename());\n if (DoLoadMissingFile(pConnection, channelSftp, pFtpID, mReceiveFrom, pDirReceive, pRemoteFileSplitByDay, pZipAfterDownload, pRenameAfterDownload, pSeqFrom, pSeqTo, pRenameType, pNewPreFix, pNewExt, contain.getFilename()) != 0)\n {\n return ( -1);\n }\n }\n }\n\n }\n\n }\n }\n }\n\n }\n else\n {\n if (pCurrMissedDir != null && !pCurrMissedDir.equals(\"\"))\n {\n mSQL = \"select a.id,a.file_name,a.current_dir_missed,\" + \"b.id,b.header_file_send,b.remote_getfile_dir,\" + \"b.local_getfile_dir,b.remote_split_file_by_day,\" + \"b.local_split_file_by_day,\" + \"to_char(sysdate-b.time_check,'yyyymmddhh24miss') min_date_check \" + \"from missed_file a,data_param b \" + \"where a.status=0 and a.switch_id=b.id and b.id=\" + pFtpID + \"and a.current_dir_missed='\" + pCurrMissedDir + \"'\";\n }\n else\n {\n mSQL = \"select a.id,a.file_name,a.current_dir_missed,\" + \"b.id,b.header_file_send,b.remote_getfile_dir,\" + \"b.local_getfile_dir,b.remote_split_file_by_day,\" + \"b.local_split_file_by_day,\" + \"to_char(sysdate-b.time_check,'yyyymmddhh24miss') min_date_check \" + \"from missed_file a,data_param b \" + \"where a.status=0 and a.switch_id=b.id and b.id=\" + pFtpID;\n }\n\n stmt = mConnection.createStatement();\n rs = stmt.executeQuery(mSQL);\n\n // Duyet cac file bao thieu\n while (rs.next() && miThreadCommand != THREAD_STOP)\n {\n\n // Kiem tra gia tri Seq cua file trong bang missed_file co trung voi gia tri Seq cua\n // mot file tren FTP server khong\n String seqFileStr = \"\";\n String seqMissedFileStr = \"\";\n if (pRenameAfterDownload == 1)\n {\n if (pRenameType == 1)\n {\n seqFileStr = contain.getFilename().substring(pSeqFrom - 1, pSeqTo - 1);\n seqMissedFileStr = rs.getString(\"file_name\").substring(pSeqFrom - 1, pSeqTo - 1);\n }\n else\n {\n seqFileStr = contain.getFilename().substring(pSeqFrom, pSeqTo);\n seqMissedFileStr = rs.getString(\"file_name\").substring(pSeqFrom, pSeqTo);\n }\n\n }\n else\n {\n if (pSeqFrom >= 0 && pSeqTo > 0)\n {\n try\n {\n seqFileStr = contain.getFilename().substring(pSeqFrom - 1, pSeqTo - 1);\n seqMissedFileStr = rs.getString(\"file_name\").substring(pSeqFrom - 1, pSeqTo - 1);\n }\n catch (Exception ex)\n {\n seqFileStr = \"\";\n seqMissedFileStr = \"\";\n }\n }\n }\n boolean isMissedFile = false;\n if (!seqFileStr.equals(\"\") && !seqMissedFileStr.equals(\"\") && seqFileStr.equalsIgnoreCase(seqMissedFileStr))\n {\n String currMissedDir = (rs.getString(\"current_dir_missed\") == null ? \"\" : rs.getString(\"current_dir_missed\"));\n if (currMissedDir.length() > 0 && Global.isNumeric(currMissedDir))\n {\n if (sdf2.format(sdf.parse(contain.getAttrs().getMtimeString())).equals(currMissedDir))\n {\n isMissedFile = true;\n }\n }\n }\n // Kiem tra hoac ten file, hoac gia tri Seq cua ten file tren FTP Server\n // co trung voi ten hoac gia tri Seq cua file trong bang missed_file.\n if ((rs.getString(\"file_name\").toLowerCase().compareTo(contain.getFilename().toLowerCase()) == 0) || isMissedFile)\n {\n if (sdf.parse(contain.getAttrs().getMtimeString()).compareTo(rs1.getDate(\"min_date_check\")) > 0)\n {\n mSourceName = IOUtil.FillPath(pReceiveFrom, Global.mSeparate) + contain.getFilename(); //+ rs.getString(\"file_name\");\n if (Global.mSeparate.compareTo(pDirReceive.substring(pDirReceive.length() - 1)) == 0)\n {\n if (rs.getInt(\"local_split_file_by_day\") == 0)\n {\n mDestinationName = pDirReceive;\n }\n else\n {\n mDestinationName = pDirReceive + rs.getString(\"current_dir_missed\") + Global.mSeparate;\n }\n }\n else if (rs.getInt(\"local_split_file_by_day\") == 0)\n {\n mDestinationName = pDirReceive + Global.mSeparate;\n }\n else\n {\n mDestinationName = pDirReceive + Global.mSeparate + rs.getString(\"current_dir_missed\") + Global.mSeparate;\n }\n\n IOUtil.forceFolderExist(mDestinationName);\n IOUtil.chmod(new File(mDestinationName), \"750\");\n file = new File(mDestinationName);\n if (file.exists() != true)\n {\n writeLogFile(\"The system cannot find the path specified : '\" + mDestinationName + \"'\");\n return ( -1);\n }\n writeLogFile(\" .Loading file \" + mSourceName + \" - Size : \" + contain.getAttrs().getSize() + \" bytes.\");\n channelSftp.get(mSourceName, mDestinationName + \"cdr.tmp\");\n file = new File(mDestinationName + \"cdr.tmp\");\n if (pRenameAfterDownload == 1)\n {\n if (pRenameType == 1) // HexToDec\n {\n mNewFileName = pNewPreFix + Global.Format(Global.Hex2Dec(contain.getFilename().substring(pSeqFrom - 1, pSeqTo - 1)), Global.rpad(\"\", pSeqTo - pSeqFrom + 1, \"0\")) + \".\" + pNewExt;\n }\n else\n {\n mNewFileName = pNewPreFix + Global.Format(Integer.parseInt(contain.getFilename().substring(pSeqFrom, pSeqTo)), Global.rpad(\"\", pSeqTo - pSeqFrom, \"0\")) + \".\" + pNewExt;\n }\n }\n else\n {\n mNewFileName = contain.getFilename();\n }\n\n fileRename = new File(mDestinationName + mNewFileName);\n file.renameTo(fileRename);\n fileRename.setLastModified(sdf.parse(contain.getAttrs().getMtimeString()).getTime());\n //.getFileDateLongTime());\n\n if (fileRename.length() != contain.getAttrs().getSize())\n {\n writeLogFile(\" .File downloaded error.Size of file downloaded (\" + fileRename.length() + \") not equal file origination.\");\n return (0);\n }\n IOUtil.chmod(fileRename, \"750\");\n if (pZipAfterDownload == 1)\n {\n\n zip.ZipFile(fileRename.getAbsolutePath(), fileRename.getAbsolutePath() + \".zip\");\n fileRename = new File(fileRename.getAbsolutePath() + \".zip\");\n //fileRename.setLastModified(listLoad\n //.getFileDateLongTime());\n fileRename.setLastModified(sdf.parse(contain.getAttrs().getMtimeString()).getTime());\n IOUtil.chmod(fileRename, \"750\");\n IOUtil.deleteFile(mDestinationName + mNewFileName);\n }\n\n mSQL = \"update import_header set current_dir = '\" + rs.getString(\"current_dir_missed\") + \"',status=\" + Global.StateFileFtpOK + \" where status in (\" + Global.StateFileFtpOK + \",\" + Global.StateConvertedError + \")\" + \" and file_name='\" + contain.getFilename() + \"' and ftp_id=\" + pFtpID; //+ rs.getString(\"file_name\")\n mRetValue = Global.ExecuteSQL(pConnection, mSQL);\n if (mRetValue == 0)\n {\n \t\n \tDate createDate = sdf.parse(contain.getAttrs().getMtimeString());\n \tString createDateStr = sdfComparator.format(createDate);\n mSQL = \"insert into import_header(status,ftp_id,\" + \"file_name,file_size,date_getfile,current_dir,\" + \"date_createfile) values(\" + Global.StateFileFtpOK + \",\" + pFtpID + \",'\" + contain.getFilename() + \"',\" + contain.getAttrs().getSize() + \",sysdate,'\" + (rs.getString(\"current_dir_missed\") == null ? \"\" : rs.getString(\"current_dir_missed\")) + \"','\" + createDateStr + \"')\"; //+ rs.getString(\"file_name\")\n Global.ExecuteSQL(pConnection, mSQL);\n }\n mSQL = \"update missed_file set status=1,date_getfile=sysdate \" + \"where id=\" + rs.getString(\"id\");\n Global.ExecuteSQL(pConnection, mSQL);\n pConnection.commit();\n writeLogFile(\" .File \" + contain.getFilename() + \" had been loaded again successful.\");\n \n \n }\n }\n\n }\n rs.close();\n stmt.close();\n }\n }\n fileList = null;\n }\n catch (Exception ex)\n {\n ex.printStackTrace();\n throw ex;\n }\n finally\n {\n try\n {\n IOUtil = null;\n rs1.close();\n rs1 = null;\n if (rs != null)\n {\n rs.close();\n }\n rs = null;\n stmt.close();\n stmt = null;\n stmt1.close();\n stmt1 = null;\n \n }\n catch (Exception e)\n {\n }\n }\n return (0);\n }", "public Integer call() throws IOException {\n \t\t\tint ret=90;\n \t\t\ttestCases = new ArrayList<String>();\n \t\t\trealIds = new ArrayList<String>();\n \t \tString path = \"./workspace/\"+jobname;\n\t\t\t\tlistener.getLogger().println(\"IL PATH DEL TESTRUN E' \"+path);\n \t\t\t/* folders = listFilesForFolder(new File(path),listener);\n \t\t\t// cerco il TestRun nell'svn di Polarion\n \tcheck:\tfor(String folder : folders){\n \t \tlistener.getLogger().println(\"confronto: \"+testrunid+\" - \"+folder);\n \t\t\t\tif(testrunid.equals(folder)){ \t\t\t\t\t\n \t\t\t\t\t// prelevo i TestCase relativi al TestRun\n \t\t\t\t\t */\n \t\t\t\t\ttestCases = getTestCases(path,listener);\n \t\t\t\t\tString nometestrun = \"Executed - \"+testrunid+\".xml\";\n \t\t\t\t\tif(!testCases.isEmpty()){\n \t\t\t\t\t\t// prelevo l'ID vero dei Test Case\n\t\t\t\t\t\t\trealIds = getRealTestCaseIdFromPolarion(listener,testCases);\n\t\t\t\t\t\t\tif(type.equals(\"TestMTP\")){ // ESECUZIONE SU MTP\n\t\t\t\t\t\t\t\tlistener.getLogger().println(\"eseguo MTP\");\n\t\t\t\t\t\t\t\tfor(String realId : realIds){\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/* Per l'esecuzione con lo stub (va messa fuori il for per funzionare)\n\t\t \t\t\t\t\tCreaXMLStub stub = new CreaXMLStub(testCases);\n\t\t\t\t\t\t\t\tstub.doTest(\"C:/JenkinsSlave/workspace/\"+jobname+\"/Temp/\"+nometestrun,listener);*/\n\t\t\t\t\t\t\t}else if(type.equals(\"TestMX\")){ // ESECUZIONE SU MICROMAX\n\t\t\t\t\t\t\t\tif(!scenario){\n\t\t\t\t\t\t\t\t\tArrayList<Integer> returnCodes = new ArrayList<Integer>();\n\t\t\t\t\t\t\t\t\tfor(String realId : realIds){\n\t\t\t\t\t\t\t\t\t\t// stampo il realId del test case\n\t\t\t\t\t\t\t \tlistener.getLogger().println(\"TC: \"+realId);\n\t\t\t\t\t\t\t\t\t\tlistener.getLogger().println(\"eseguo MX\");\n\t\t\t\t\t\t\t\t\t\tString[] parameters = realId.split(\",\");\n\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\tProcessBuilder builder = new ProcessBuilder(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"MxVGUI\", \"/n\", \"/r\", mxpath+File.separator+parameters[0]+File.separator+parameters[1]+\".mxp\", mxpath+File.separator+parameters[0]+\"/ScenariosAndTestCases/\"+parameters[2]); \n\t\t\t\t\t\t\t\t\t\t\tbuilder.redirectErrorStream(true); \n\t\t\t\t\t\t\t\t\t\t\tProcess p = builder.start();\n\t\t\t\t\t\t\t\t\t\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));\n\t\t\t\t\t\t\t\t\t\t\tString line;\n\t\t\t\t\t\t\t\t\t\t\twhile ((line = reader.readLine()) != null)\n\t\t\t\t\t\t\t\t\t\t\t\tlistener.getLogger().println(\"tasklist: \" + line);\n\t\t\t\t\t\t\t\t\t\t\tret=p.waitFor();\n\t\t\t\t\t\t\t\t\t\t\treturnCodes.add(ret);\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\tlistener.getLogger().println(\"eseguito MX \"+ret);\n\t\t\t\t\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\t\t\t\t\t\t\tContactPolarion(listener);\n\t\t\t\t\t\t\t\t\t\t\tlistener.getLogger().println(e.getMessage());\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t//Scrive i risultati in base al valore di ritorno di MxVDEV\n\t\t\t\t\t\t\t\t\twriteTestResults(\"C:/JenkinsSlave/Results/\"+nometestrun, testCases, returnCodes);\t\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t//Converto tutti i risultati nel formato desiderato leggendo i log\n\t\t\t\t\t\t\t\t//convertTestCaseResults(realIds, \"C:/JenkinsSlave/workspace/\"+jobname+\"/Temp/\"+nometestrun, testCases);\n\t\t\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t\t\t//convertScenarioResults(testCases, new ArrayList<String>(), mxpath+File.separator+parameters[0]+\"/ScenariosAndTestCases/\"+testrunid ,testrunid);\n\t\t\t\t\t\t\t\t\tString[] parameters = realIds.get(0).split(\",\");\n\t\t\t\t\t\t\t\t\tScenario scenario = new Scenario(testrunid,realIds,mxpath+File.separator+parameters[0]+\"/ScenariosAndTestCases/\");\n\t\t\t\t\t\t\t\t\tif(scenario.createScenario()){\n\t\t\t\t\t\t\t\t\t\tlistener.getLogger().println(\"Scenario creato\");\n\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\tProcessBuilder builder = new ProcessBuilder(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"MxVGUI\", \"/n\", \"/r\", mxpath+File.separator+parameters[0]+File.separator+parameters[1]+\".mxp\", mxpath+File.separator+parameters[0]+\"/ScenariosAndTestCases/\"+testrunid+\".mxs\"); \n\t\t\t\t\t\t\t\t\t\t\tbuilder.redirectErrorStream(true); \n\t\t\t\t\t\t\t\t\t\t\tProcess p = builder.start();\n\t\t\t\t\t\t\t\t\t\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));\n\t\t\t\t\t\t\t\t\t\t\tString line;\n\t\t\t\t\t\t\t\t\t\t\twhile ((line = reader.readLine()) != null)\n\t\t\t\t\t\t\t\t\t\t\t\tlistener.getLogger().println(\"tasklist: \" + line);\n\t\t\t\t\t\t\t\t\t\t\tret=p.waitFor();\n\t\t\t\t\t\t\t\t\t\t\tlistener.getLogger().println(\"eseguito MX \"+ret);\n\t\t\t\t\t\t\t\t\t\t\tconvertScenarioResults(testCases, new ArrayList<String>(), mxpath+File.separator+parameters[0]+\"/ScenariosAndTestCases/\"+testrunid ,testrunid);\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t\t\t\t\tContactPolarion(listener);\n\t\t\t\t\t\t\t\t\t\t\tlistener.getLogger().println(e.getMessage());\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\tlistener.getLogger().println(\"creazione dello scenario non riuscita\");\n\t\t\t\t\t\t\t\t\t}\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}else{ // CONDIZIONE EVENTUALI ERRORI\n\t\t\t\t\t\t\t\tContactPolarion(listener);\n\t\t\t\t\t\t\t\tlistener.getLogger().println(\"condizione inaspettata\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tpublishTest(\"C:/JenkinsSlave/Results/\",sharedpasswd,shareduser,nometestrun, listener, projectname);\n\t\t\t\t\t \t}else{\n\t\t\t\t\t \t\tContactPolarion(listener);\n\t\t\t\t\t \t\tlistener.getLogger().println(\"Nessun tc impostato. Setto tr a open\");\n\t\t\t\t\t \t//}\n\t\t\t\t\t \t//break check;\n \t\t\t\t//}\n \t\t\t}\n \t\t\treturn ret; \t\n \t\t}", "public void updateMultiRunInventory() {\n\n\t\tExcelFileUtils excelFileUtils = new ExcelFileUtils();\n\t\texcelFileUtils.setSpreadsheetFilePath(spreadsheetFilePath);\n\t\texcelFileUtils.setSheetFormat(sheetFormat);\n\t\texcelFileUtils.setSheetName(sheetName);\n\t\texcelFileUtils.setDebug(true /* this.debug */ );\n\t\texcelFileUtils.setTableData(tableData);\n\t\tif (!appendData) {\n\t\t\tcolumnHeaders = excelFileUtils.readColumnHeaders();\n\t\t\tnewColumnHeader = String.format(\"Run %d\", columnHeaders.size());\n\t\t\texcelFileUtils.appendColumnHeader(newColumnHeader);\n\n\t\t\tcolumnHeaders = excelFileUtils.readColumnHeaders();\n\t\t\tif (debug) {\n\t\t\t\tSystem.err.println(\"Appended column: \" + columnHeaders.toString());\n\t\t\t}\n\t\t\trowData = new HashMap<>();\n\t\t\t// Note: row 0 is reserved for headers\n\t\t\t// for FILLO SQL query based data access\n\t\t\tfor (int column = 0; column != columnHeaders.size(); column++) {\n\t\t\t\trowData.put(column, columnHeaders.get(column));\n\t\t\t}\n\t\t\ttableData.add(rowData);\n\t\t\t// columnHeaders\n\t\t\tfor (String testMethodName : testInventoryData.keySet()) {\n\t\t\t\trowData = new HashMap<>();\n\t\t\t\trowData.put(0, testMethodName);\n\t\t\t\trowData.put(1, testInventoryData.get(testMethodName).toString());\n\t\t\t\ttableData.add(rowData);\n\t\t\t}\n\t\t\texcelFileUtils.setTableData(tableData);\n\t\t} else {\n\t\t\tList<Map<Integer, String>> existingData = new ArrayList<>();\n\t\t\t// NOTE: no need to wrap into an Optional\n\t\t\texcelFileUtils.readSpreadsheet(Optional.of(existingData));\n\t\t\tif (verbose) {\n\t\t\t\tSystem.err.println(\"Adding extra column\");\n\t\t\t}\n\n\t\t\ttableData = new ArrayList<>(); // reset tableData\n\t\t\tfor (Map<Integer, String> rowData : existingData) {\n\t\t\t\tString testMethodName = rowData.get(0); // \"Test Method\"\n\t\t\t\tInteger newColumn = rowData.size();\n\t\t\t\tif (testMethodName.matches(\"Test Method\")) {\n\t\t\t\t\t// continue;\n\t\t\t\t\trowData.put(rowData.size(), String.format(\"Run %d\", newColumn));\n\t\t\t\t} else {\n\t\t\t\t\tif (verbose) {\n\t\t\t\t\t\tSystem.err\n\t\t\t\t\t\t\t\t.println(\"Adding extra column for test \" + testMethodName);\n\t\t\t\t\t}\n\t\t\t\t\tBoolean testStatus = Boolean\n\t\t\t\t\t\t\t.parseBoolean(testInventoryData.get(testMethodName).toString());\n\t\t\t\t\trowData.put(newColumn, testStatus.toString());\n\t\t\t\t}\n\t\t\t\ttableData.add(rowData);\n\t\t\t\tif (verbose) {\n\t\t\t\t\tfor (Map.Entry<Integer, String> columnData : rowData.entrySet()) {\n\t\t\t\t\t\tSystem.err.println(columnData.getKey().toString() + \" => \"\n\t\t\t\t\t\t\t\t+ columnData.getValue());\n\t\t\t\t\t}\n\t\t\t\t\tSystem.err.println(\"---\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\texcelFileUtils.setTableData(tableData);\n\t\t\texcelFileUtils.writeSpreadsheet();\n\t\t}\n\t}", "public List<String> executableTestCase(XSSFWorkbook workbook){\r\n\t\tXSSFSheet worksheet = workbook.getSheetAt(0);\r\n\t\tint testcasecount = worksheet.getLastRowNum();\t\t\t// Test case count from scenario sheet\r\n System.out.println(\"Total number of testcase: \"+testcasecount);\r\n\t\t//\t\tint testCaseYCnt = 0;\r\n//\t\tList<String> testcasename = new ArrayList<String>() ;\t// List of all the executable test cases (Flag 'Y') from scenario sheet\r\n//\t\tList<String> featurefilelist ;\r\n//\t\tList<List<String>> featurefilelistOFlist = new ArrayList<List<String>>() ; //Contains all feature files and each entry contains feature file list for a TC \r\n\t\tRow row;\r\n\t\tCell cell;\r\n\t\tfor(int i=1;i<=testcasecount;++i){\r\n\t\t\trow = worksheet.getRow(i);\r\n\t\t\tfeaturefilelist = new ArrayList<String>() ;\r\n\t\t\tcell = row.getCell(0);\r\n\t\t\tif(cell==null)break;\r\n\t\t\tif((cell.toString()).equalsIgnoreCase(\"Y\")){\r\n\t\t\t\tint featurefilecount;\r\n\t\t\t\ttestcasename.add(row.getCell(1).toString()); \t\t\t\t\t\t\r\n\t\t\t\tfeaturefilecount = worksheet.getRow(testCaseYCnt+1).getLastCellNum(); // Feature file count in each row of scenario sheet\r\n\t\t\t\t\r\n\t\t\t\tSystem.out.println(\"the number of feature file : \"+featurefilecount);\r\n\t\t\t\t\r\n\t\t\t\tfor( int k=1 ; k<=featurefilecount-2;++k){\r\n\t\t\t\t\tfeaturefilename = worksheet.getRow(i).getCell(k+1).toString();\r\n\t\t\t\t\tif(featurefilename.equals(\"\")){\r\n\t\t\t\t\t\tbreak; \t\t\t\t\t\t// If cells have been written over once they will add to the count of feature files\r\n\t\t\t\t\t}\r\n\t\t\t\t\tfeaturefilelist.add(featurefilename);\r\n\t\t\t\t}\r\n\t\t\t\tfeaturefilelistOFlist.add(featurefilelist); // List of list of feature file with all TC having flag as Y\r\n\t\t\t\t++testCaseYCnt; \r\n\t\t\t}\r\n\t\t}\r\n\t\tSystem.out.println(\"Total Executable Cases : \" + testCaseYCnt);\r\n\t\treturn testcasename;\r\n\t}", "Excel getExcelInst();", "public static void writeExcelFileForSingleFields(String ruleDataExcelSheetFilePath, List rowDataArr_ForIndividual,String editionYear,int fieldNumber,String state,String realPath,String fieldName,int recentRuleId) throws InvalidFormatException {\n int rowCount = 1;\r\n boolean sheetDupCheck=false;\r\n String fieldNames[]=fieldName.split(\"-\");\r\n String fieldNameValue=fieldNames[0];\r\n try {\r\n \t XSSFWorkbook workbook ;\r\n // \tFile file = new File(\"D:\\\\latest\\\\SOUTH DAKOTA_BUFFALO_5_5.xlsx\");\r\n \t File file = new File(realPath+MappingConstants.EXCELFULEFORRULESCREATION+\".xlsx\"); \r\n \tif (file.exists() == false) {\r\n \t\tworkbook = new XSSFWorkbook();\r\n \t\t XSSFSheet sheet = workbook.createSheet(state+\"_\"+editionYear+\"_\"+fieldNumber);\r\n\t\t//\t Row row1 = sheet.createRow(0);\r\n\t\t//\t Cell cell1 = row1.createCell(0);\r\n\t\t//\t cell1.setCellValue(\"Rule Id:\"+recentRuleId);\r\n \t\t\tfor (int i=0; i<rowDataArr_ForIndividual.size(); i++) {\r\n \t\t\t\tList rowDataList = (ArrayList)rowDataArr_ForIndividual.get(i);\r\n \t\t\t Row row = sheet.createRow(rowCount);\r\n \t\t\t int columnCount = 0;\r\n \t\t\t for (int j = 0; j < rowDataList.size(); j++) {\r\n \t\t\t \tObject colObj = rowDataList.get(j);\r\n \t\t\t Cell cell = row.createCell(columnCount);\r\n \t\t\t CellUtil.setAlignment(cell, workbook, CellStyle.ALIGN_CENTER);\r\n \t\t\t if (colObj instanceof String) {\r\n \t\t\t cell.setCellValue((String) colObj);\r\n \t\t\t } else if (colObj instanceof Integer) {\r\n \t\t\t cell.setCellValue((Integer) colObj);\r\n \t\t\t }\r\n \t\t\t columnCount++;\r\n \t\t\t }\r\n \t\t\t rowCount++;\r\n \t\t\t}\r\n \t\t\tFileOutputStream outputStream = new FileOutputStream(file);\r\n \t\t\tworkbook.write(outputStream);\r\n \t}\r\n \telse{\r\n \t\tint sheetOfDup=0;\r\n \t\tint lastRowInSheet=0;\r\n \t\tfinal InputStream is = new FileInputStream(file);\r\n \t\tworkbook = new XSSFWorkbook(is);\r\n \t\tint noOfSheets=workbook.getNumberOfSheets();\r\n \t\tfor(int sheetCount=0;noOfSheets>sheetCount;sheetCount++){\r\n \t\t\tString sheetOfType = workbook.getSheetAt(sheetCount).getSheetName();\r\n \t\t\tlastRowInSheet = workbook.getSheetAt(sheetCount).getLastRowNum();\r\n \t\t\tif(sheetOfType.equals(state+\"_\"+editionYear+\"_\"+fieldNumber)){\r\n \t\t\t\t sheetDupCheck=true;\r\n \t\t\t\tsheetOfDup=sheetCount;\r\n \t\t\t\tlastRowInSheet=lastRowInSheet+1;\r\n \t\t\t\t break;\r\n \t\t\t}\r\n \t\t\telse{\r\n \t\t\t\tsheetDupCheck=false;\r\n \t\t\t}\r\n \t\t}\r\n \t\t if(sheetDupCheck){\r\n \t\t\tXSSFSheet sheetToAddData= workbook.getSheetAt(sheetOfDup);\r\n\t \t\t\t Row row1 = sheetToAddData.createRow(lastRowInSheet);\r\n\t \t\t\t Cell cell1 = row1.createCell(0);\r\n\t \t\t\t cell1.setCellValue(MappingConstants.ruleIdInExcel+recentRuleId);\r\n\t \t\t\t lastRowInSheet++;\r\n\t\t\t\tfor (int i=0; i<rowDataArr_ForIndividual.size(); i++) {\r\n\t\t\t\t\t\tList rowDataList = (ArrayList)rowDataArr_ForIndividual.get(i);\r\n\t\t\t\t\t\t/*int colOfLastInserted= workbook.getSheetAt(sheetOfDup).;*/\r\n\t\t\t\t\t Row row = sheetToAddData.createRow(lastRowInSheet);\r\n\t\t\t\t\t int columnCount = 0;\r\n\t\t\t\t\t\t for (int j = 0; j < rowDataList.size(); j++) {\r\n\t\t\t\t\t\t \tObject colObj = rowDataList.get(j);\r\n\t\t\t\t\t\t Cell cell = row.createCell(columnCount);\r\n\t\t\t\t\t\t CellUtil.setAlignment(cell, workbook, CellStyle.ALIGN_CENTER);\r\n\t\t\t\t\t\t if (colObj instanceof String) {\r\n\t\t\t\t\t\t cell.setCellValue((String) colObj);\r\n\t\t\t\t\t\t } else if (colObj instanceof Integer) {\r\n\t\t\t\t\t\t cell.setCellValue((Integer) colObj);\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t columnCount++;\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t lastRowInSheet++;\r\n\t\t\t\t}\r\n\t\t\t\tFileOutputStream outputStream = new FileOutputStream(file);\r\n\t\t\t\tworkbook.write(outputStream);\r\n \t\t}\r\n \t\telse{\r\n \t\t\tXSSFSheet sheet = workbook.createSheet(state+\"_\"+editionYear+\"_\"+fieldNumber);\r\n \t\t Row row1 = sheet.createRow(0);\r\n\t \t\t\t Cell cell1 = row1.createCell(0);\r\n\t \t\t\t cell1.setCellValue(\"Rule Id:\"+recentRuleId);\r\n\t\t\t\tfor (int i=0; i<rowDataArr_ForIndividual.size(); i++) {\r\n\t\t\t\t\t\tList rowDataList = (ArrayList)rowDataArr_ForIndividual.get(i);\r\n\t\t\t\t\t Row row = sheet.createRow(rowCount);\r\n\t\t\t\t\t int columnCount = 0;\r\n\t\t\t\t\t\t for (int j = 0; j < rowDataList.size(); j++) {\r\n\t\t\t\t\t\t \tObject colObj = rowDataList.get(j);\r\n\t\t\t\t\t\t Cell cell = row.createCell(columnCount);\r\n\t\t\t\t\t\t CellUtil.setAlignment(cell, workbook, CellStyle.ALIGN_CENTER);\r\n\t\t\t\t\t\t if (colObj instanceof String) {\r\n\t\t\t\t\t\t cell.setCellValue((String) colObj);\r\n\t\t\t\t\t\t } else if (colObj instanceof Integer) {\r\n\t\t\t\t\t\t cell.setCellValue((Integer) colObj);\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t columnCount++;\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t rowCount++;\r\n\t\t\t\t}\r\n\t\t\t\tFileOutputStream outputStream = new FileOutputStream(file);\r\n\t\t\t\tworkbook.write(outputStream);\r\n \t\t}\r\n \t}\r\n \t\r\n\t\t} catch (FileNotFoundException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t} catch (IOException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n \r\n\t}", "public static void main(String[] args) throws Exception\r\n\t{\n\t\tFile f=new File(\"javafile.xlsx\");\r\n\t\tFileInputStream fi=new FileInputStream(f);\r\n\t\tWorkbook wb=WorkbookFactory.create(fi);\r\n\t\tSheet sh=wb.getSheet(\"java1\");\r\n\t\tint x=sh.getPhysicalNumberOfRows();\r\n\t\tint y=sh.getRow(0).getLastCellNum();\r\n\t\t\r\n\t\tSystem.out.println(\"no.of used rows \"+x+\": no of used colums \"+y);\r\n\t\t\r\n\t\t\r\n\t\tfor(int i=1;i<x;i++)\r\n\t\t{\r\n\t\t\tfor(int j=0;j<y;j++)\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\tString x1= sh.getRow(i).getCell(j).getStringCellValue();\r\n\t\t\t\tSystem.out.print(\" \"+x1);\r\n\t\t\t}\r\n\t\t\tSystem.out.println();\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\r\n\t}", "public static void main(String[] args) throws Exception {\n \n ExcelUtils.setExcelFile(Constants.Path_TestData + Constants.File_TestData,\"Sheet1\");\n \t System.out.println(\"Total Number of Rows in the excel is : \"+ExcelUtils.rowCount());\n \t System.out.println(\"Total Number of Columns in the excel is : \"+ExcelUtils.columnCount());\n\n System.setProperty(\"webdriver.gecko.driver\",driverPath);\n driver = new FirefoxDriver();\n \n driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);\n \n driver.get(Constants.URL);\n \n SignIn_Action.Execute(driver);\n \n System.out.println(\"Login Successfully, now it is the time to Log Off buddy.\");\n \n Home_Page.lnk_LogOut(driver).click(); \n \n driver.quit();\n \n //This is to send the PASS value to the Excel sheet in the result column.\n \n ExcelUtils.setCellData(\"Pass\", 1, 3);\n \n }", "public static void main(String args,String flag, InputStream object) \r\n {\r\n \t//flag=\"senderIdandPassword\";\r\n try\r\n {\r\n \t//File f=new File(args);\r\n \t \r\n // FileInputStream file = new FileInputStream(f);\r\n //Create Workbook instance holding reference to .xlsx file\r\n XSSFWorkbook workbook = new XSSFWorkbook(object);\r\n \r\n //Get first/desired sheet from the workbook\r\n XSSFSheet sheet = workbook.getSheetAt(0);\r\n \r\n //Iterate through each rows one by one\r\n Iterator<Row> rowIterator = sheet.iterator();\r\n if(flag.equals(\"receiverfile\"))\r\n getEmailidsforsend(rowIterator);\r\n if(flag.equals(\"senderIdandPassword\"))\r\n getEmailidsandpaswordforsend(rowIterator);\r\n \r\n //file.close();\r\n } \r\n catch (Exception e) \r\n {\r\n e.printStackTrace();\r\n }\r\n }", "private void exportInvToXLS1() {\n\n progress = new ProgressDialog(NewScannerActivity.this);\n /* progress.setTitle(\"Loading\");\n progress.setMessage(\"Wait while loading...\");\n progress.show();*/\n// To dismiss the dialog\n\n\n //setProgressBarIndeterminateVisibility(true);\n closeDriver();\n\n if (date == null) date = \"_\";\n if (subdiv == null) subdiv = \"market\";\n\n date = date.replaceAll(\":\", \"_\");\n date = date.replaceAll(\"/\", \"-\");\n int offl = subdiv.indexOf(\" - offline\");\n if (offl > 0) subdiv = subdiv.substring(0, offl);\n //date=date.replaceAll(\"offline document\",\"\");\n filename = \"inv\" + \"_\" + date + \"_\" + subdiv;\n Log.d(\"my\", \"filename = \" + filename);\n\n\n AlertDialog.Builder builder = new AlertDialog.Builder(this);\n builder.setTitle(\"Export to file\");\n\n// Set up the input\n final EditText input = new EditText(this);\n input.setText(filename);\n input.setSelected(true);\n input.setSelectAllOnFocus(true);\n\n// Specify the type of input expected; this, for example, sets the input as a password, and will mask the text\n input.setInputType(InputType.TYPE_CLASS_TEXT);\n builder.setView(input);\n\n// Set up the buttons\n builder.setPositiveButton(\"CSV\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n filename = input.getText().toString();\n\n ExportExcelThread exportExcelThread = new ExportExcelThread(\"csv\");\n exportExcelThread.start();\n }\n });\n\n\n builder.setNeutralButton(\"XLS\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n filename = input.getText().toString();\n\n ExportExcelThread exportExcelThread = new ExportExcelThread(\"xls\");\n exportExcelThread.start();\n }\n });\n\n builder.setNegativeButton(\"Cancel\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n dialog.cancel();\n }\n });\n\n builder.show();\n\n\n }", "public static void main(String[] args) throws IOException {\n \r\n File src = new File(\"C:\\\\Temp\\\\Sel_data.xlsx\");\r\n FileInputStream fis=new FileInputStream(src);\r\n XSSFWorkbook wb = new XSSFWorkbook(fis);\r\n XSSFSheet sheet1=wb.getSheetAt(0);\r\n \r\n String data0 = sheet1.getRow(1).getCell(0).getStringCellValue();\r\n System.out.println(\"First user name is:\" +data0);\r\n \r\n String data1 = sheet1.getRow(2).getCell(1).getStringCellValue();\r\n System.out.println(\"First password is:\" +data1);\r\n \r\n wb.close();\r\n int i;\r\n int j;\r\n \r\n \r\n \r\n \r\n\t}", "public static void main(String[] args) {\n String path = System.getProperty(\"user.dir\")+\"\\\\src\\\\test\\\\java\\\\FileHandling\\\\Data.xlsx\";\n //Xls_Reader xls = new Xls_Reader(path);\n\n // counting rows\n\n //counting cols\n\n //reading\n\n //writing\n\n }", "@Test (priority=1)\n\t\tpublic static void QuestionType1 () throws InterruptedException, IOException {\t\n\t\t SoftAssert assertion1 = new SoftAssert();\n\t\t FileInputStream finput = new FileInputStream(src);\n\t workbook = new HSSFWorkbook(finput);\n\t sheet= workbook.getSheetAt(0); //preview sheet\n\t for(int i=2; i<=sheet.getLastRowNum(); i++)\n\t {\t\n\t \tLogin();\t \t\n\t\t\t \tdriver.findElement(By.xpath(\"//*[@id=\\\"batch\\\"]\")).click(); //click new batch icon\n\t\t\t\tdriver.findElement(By.xpath(\"//*[contains(text(),'New Master')]\")).click(); //Click master batch icon\n\t\t\t//Fill basic details\n\t\t\t\tcell = sheet.getRow(i).getCell(1);\n\t\t cell.setCellType(Cell.CELL_TYPE_STRING);\n\t\t\t\tdriver.findElement(By.xpath(\"//*[@id=\\\"type_name\\\"]\")).sendKeys(cell.getStringCellValue());\n\t\t\t\tcell = sheet.getRow(i).getCell(2);\n\t\t cell.setCellType(Cell.CELL_TYPE_STRING);\n\t\t\t\tSelect templateCategory =new Select(driver.findElement(By.xpath(\"//*[@id=\\\"type_category\\\"]\")));\n\t\t\t\ttemplateCategory.selectByVisibleText(cell.getStringCellValue());\n\t\t\t\tcell = sheet.getRow(i).getCell(3);\n\t\t cell.setCellType(Cell.CELL_TYPE_STRING);\n\t\t\t\tSelect templateType =new Select(driver.findElement(By.xpath(\"//*[@id=\\\"template_type\\\"]\")));\n\t\t\t\ttemplateType.selectByVisibleText(cell.getStringCellValue());\n\t\t\t\tcell = sheet.getRow(i).getCell(4);\n\t\t cell.setCellType(Cell.CELL_TYPE_STRING);\n\t\t\t\tdriver.findElement(By.xpath(\"//*[@id=\\\"type_purpose\\\"]\")).clear();\n\t\t\t\tdriver.findElement(By.xpath(\"//*[@id=\\\"type_purpose\\\"]\")).sendKeys(cell.getStringCellValue());\n\t\t\t\tcell = sheet.getRow(i).getCell(5);\n\t\t cell.setCellType(Cell.CELL_TYPE_STRING);\n\t\t\t\tdriver.findElement(By.xpath(\"//*[@id=\\\"type_document\\\"]\")).clear();\n\t\t\t\tdriver.findElement(By.xpath(\"//*[@id=\\\"type_document\\\"]\")).sendKeys(cell.getStringCellValue());\n\t\t\t\t//save\n\t\t\t\tdriver.findElement(By.xpath(\"//*[@id=\\\"masterSave\\\"]\")).click();\n\t\t\t\t//upload assert\n\t\t\t\tcell = sheet.getRow(i).getCell(6);\n\t\t cell.setCellType(Cell.CELL_TYPE_STRING);\n\t\t\t\tdriver.findElement(By.xpath(\"//*[@id=\\\"type_name1\\\"]\")).sendKeys(cell.getStringCellValue()); //enter assert master record name\n\t\t\t\tThread.sleep(5000);\n\t\t\t\t\n\t\t\t\tString file = \"//home//s4cchinpc105//Desktop//ZImage//download1.jpeg\";\n\t\t\t\tdriver.findElement(By.xpath(\"//*[@id=\\\"asset_files\\\"]\")).sendKeys(file); //upload file\n\t\t\t\tThread.sleep(3000);\n\t\t\t\tWebElement uploadedfile1 = driver.findElement(By.xpath(\"//*[@id=\\\"assetTable\\\"]/tr[1]/td/label\"));\n\t\t\t\tString uploadedfile1text = uploadedfile1.getText();\n\t\t\t\tString expectuploadedfile1text = \"download1.jpeg\";\n\t\t\t\t//assertion1.assertEquals(expectuploadedfile1text, uploadedfile1text); \n\t\t\t\tThread.sleep(3000);\n\t\t \t\tdriver.findElement(By.xpath(\"//*[@id=\\\"fileSave\\\"]\")).click(); // click continue\n\t\t \t\tThread.sleep(3000);\n\t\t\t \t\t\n\t\t\t\t//Form Builder - single input\n\t\t\t driver.findElement(By.xpath(\"//img[contains(@src,'/Survey-portlet/images/Add question icon.svg')]\")).click();\n\t\t\t Thread.sleep(5000);\n\t\t\t driver.findElement(By.xpath(\"//*[@class=\\\"svd_toolbox_item svd-light-border-color svdToolboxItem svd_toolbox_item_icon-text\\\"]\")).click(); //single input\n\t\t\t Thread.sleep(5000);\n\t\t\t driver.findElement(By.xpath(\"//*[@class=\\\"sv_qstn question_actions svd_question svd-dark-bg-color svd_q_design_border svd_q_selected svd-main-border-color\\\"]/div[3]/question-actions/div/span\")).click(); //click properties icon \n\t\t\t Thread.sleep(6000);\n\t ((JavascriptExecutor)driver).executeScript(\"arguments[0].scrollIntoView();\", driver.findElement(By.xpath(\"//span[contains(text(), 'Title')]/parent::td/parent::tr/td[2]/div/div[2]/input\")));\n\t cell = sheet.getRow(i).getCell(7);\n\t\t cell.setCellType(Cell.CELL_TYPE_STRING);\n\t\t\t driver.findElement(By.xpath(\"//span[contains(text(), 'Title')]/parent::td/parent::tr/td[2]/div/div[2]/input\")).sendKeys(cell.getStringCellValue());\n\t\t\t \n\t\t\t //Form Builder - dropdown\n\t\t\t driver.findElement(By.xpath(\"//img[contains(@src,'/Survey-portlet/images/Add question icon.svg')]\")).click();\n\t\t\t Thread.sleep(5000);\n\t\t\t driver.findElement(By.xpath(\"//span[contains(text(),'Dropdown')]\")).click(); //Dropdown\n\t\t\t Thread.sleep(5000);\n\t\t\t driver.findElement(By.xpath(\"//*[@class=\\\"sv_qstn question_actions svd_question svd-dark-bg-color svd_q_design_border svd_q_selected svd-main-border-color\\\"]/div[3]/question-actions/div/span\")).click(); //click properties icon \n\t\t\t Thread.sleep(6000);\n\t ((JavascriptExecutor)driver).executeScript(\"arguments[0].scrollIntoView();\", driver.findElement(By.xpath(\"//span[contains(text(), 'Title')]/parent::td/parent::tr/td[2]/div/div[2]/input\")));\n\t cell = sheet.getRow(i).getCell(8);\n\t\t cell.setCellType(Cell.CELL_TYPE_STRING);\n\t\t\t driver.findElement(By.xpath(\"//span[contains(text(), 'Title')]/parent::td/parent::tr/td[2]/div/div[2]/input\")).sendKeys(cell.getStringCellValue());\n\t\t\t Thread.sleep(5000);\n\n\t\t\t //Form Builder - dynamic matrix\n\t \t\tdriver.findElement(By.xpath(\"//img[contains(@src,'/Survey-portlet/images/Add question icon.svg')]\")).click();\n\t \t\tThread.sleep(5000);\n\t \t\tdriver.findElement(By.xpath(\"//span[contains(text(),'Matrix (dynamic rows)')]\")).click(); //Matrix (dynamic rows)\n\t\t\t Thread.sleep(5000);\n\t \t\tdriver.findElement(By.xpath(\"//*[@class=\\\"sv_qstn question_actions svd_question svd-dark-bg-color svd_q_design_border svd_q_selected svd-main-border-color\\\"]/div[3]/question-actions/div/span[1]/img\")).click(); //click properties icon\n\t \t\t((JavascriptExecutor)driver).executeScript(\"arguments[0].scrollIntoView();\", driver.findElement(By.xpath(\"//span[contains(text(), 'Title')]/parent::td/parent::tr/td[2]/div/div[2]/input\")));\n\t cell = sheet.getRow(i).getCell(9);\n\t\t cell.setCellType(Cell.CELL_TYPE_STRING);\n\t\t\t driver.findElement(By.xpath(\"//span[contains(text(), 'Title')]/parent::td/parent::tr/td[2]/div/div[2]/input\")).sendKeys(cell.getStringCellValue());\n\t\t\t Thread.sleep(5000);\n\n\t\t\t //Add second page\n\t\t\t driver.findElement(By.xpath(\"//*[@title=\\\"Add New Page\\\"]\")).click(); \n\t\t\t\t\n\t\t\t//Form Builder - rating\n\t\t \tdriver.findElement(By.xpath(\"//img[contains(@src,'/Survey-portlet/images/Add question icon.svg')]\")).click();\n\t\t \tThread.sleep(5000);\n\t\t \tdriver.findElement(By.xpath(\"//span[contains(text(),'Rating')]\")).click(); //Rating\t\t\n\t\t \tThread.sleep(5000);\n\t\t \tdriver.findElement(By.xpath(\"//*[@class=\\\"sv_qstn question_actions svd_question svd-dark-bg-color svd_q_design_border svd_q_selected svd-main-border-color\\\"]/div[3]/question-actions/div/span\")).click(); //click properties icon\n\t\t \t((JavascriptExecutor)driver).executeScript(\"arguments[0].scrollIntoView();\", driver.findElement(By.xpath(\"//span[contains(text(), 'Title')]/parent::td/parent::tr/td[2]/div/div[2]/input\")));\n\t cell = sheet.getRow(i).getCell(10);\n\t\t cell.setCellType(Cell.CELL_TYPE_STRING);\n\t\t\t driver.findElement(By.xpath(\"//span[contains(text(), 'Title')]/parent::td/parent::tr/td[2]/div/div[2]/input\")).sendKeys(cell.getStringCellValue());\n\t\t\t Thread.sleep(5000);\n\n\t\t\t//Form Builder - matrix single choice\n\t\t \tdriver.findElement(By.xpath(\"//img[contains(@src,'/Survey-portlet/images/Add question icon.svg')]\")).click();\n\t\t \tThread.sleep(5000);\n\t\t \tdriver.findElement(By.xpath(\"//*[@class=\\\"svd_toolbox_item svd-light-border-color svdToolboxItem svd_toolbox_item_icon-matrix\\\"]/span[2]\")).click(); //single choice\n\t\t\t Thread.sleep(5000);\n\t\t \tdriver.findElement(By.xpath(\"//*[@class=\\\"sv_qstn question_actions svd_question svd-dark-bg-color svd_q_design_border svd_q_selected svd-main-border-color\\\"]/div[3]/question-actions/div/span\")).click(); //click properties icon\n\t\t \t((JavascriptExecutor)driver).executeScript(\"arguments[0].scrollIntoView();\", driver.findElement(By.xpath(\"//span[contains(text(), 'Title')]/parent::td/parent::tr/td[2]/div/div[2]/input\")));\n\t cell = sheet.getRow(i).getCell(11);\n\t\t cell.setCellType(Cell.CELL_TYPE_STRING);\n\t\t\t driver.findElement(By.xpath(\"//span[contains(text(), 'Title')]/parent::td/parent::tr/td[2]/div/div[2]/input\")).sendKeys(cell.getStringCellValue());\n\t\t\t Thread.sleep(5000);\n\n\t\t\t driver.findElement(By.xpath(\"//*[@id=\\\"saveSurvey\\\"]\")).click(); //save\n\t \tThread.sleep(5000); \n\t \t\n\t\t ((JavascriptExecutor)driver).executeScript(\"arguments[0].scrollIntoView();\", driver.findElement(By.xpath(\"//*[contains(text(), 'Complete')]\"))); \n\t\t\t driver.findElement(By.xpath(\"//*[contains(text(), 'Complete')]\")).click(); //complete\n\t\t\t Thread.sleep(5000);\n\t\t\n\t\t\t String thirdques = driver.findElement(By.xpath(\"//*[@class=\\\"sv_p_root\\\"]/div[4]/div/div/h5/span[3]\")).getText();\n\t\t String expectthirdques = \"Dynamic Matrix Question\";\n\t\t AssertJUnit.assertEquals(expectthirdques, thirdques); \n\t\t\n\t\t Thread.sleep(6000);\n\t\t ((JavascriptExecutor)driver).executeScript(\"arguments[0].scrollIntoView();\", driver.findElement(By.xpath(\"//*[@id=\\\"surveyElement\\\"]/div/form/div[2]/div/div[4]/input[2]\")));\n\t \n\t\t driver.findElement(By.xpath(\"//*[@id=\\\"surveyElement\\\"]/div/form/div[2]/div/div[4]/input[2]\")).click(); //click next\n\t\t Thread.sleep(5000);\n\t\t String fifthques = driver.findElement(By.xpath(\"//*[@class=\\\"sv_p_root\\\"]/div[3]/div/div/h5/span[3]\")).getText();\n\t\t String expectfifthques = \"Single Matrix Question\";\n\t\t AssertJUnit.assertEquals(expectfifthques, fifthques); \n\t\t assertion1.assertAll();\n\t\t \t\t\n\t\t driver.findElement(By.xpath(\"//*[@id=\\\"surveyElement\\\"]/div/form/div[2]/div/div[4]/input\")).click(); //click previous\n\t\t \tThread.sleep(2000);\n\t\t \tClose();\n\t }\n\t }", "@Override\n\t\t\tpublic void run() {\n\t\t\t\tString filePath = env.getProperty(\"export.file.path\");\n\t\t\t\tFileSystem fileSystem = FileSystems.getDefault();\n\t\t\t\t// log.debug(\"FILE SYSTEM -----\" + fileSystem);\n\n\t\t\t\t// if(StringUtils.isNotEmpty(empId)) {\n\t\t\t\t// filePath += \"/\" + empId;\n\t\t\t\t// }\n\t\t\t\tPath path = fileSystem.getPath(filePath);\n\t\t\t\t// log.debug(\"PATH----------\" + path);\n\t\t\t\t// path = path.resolve(String.valueOf(empId));\n\t\t\t\tif (!Files.exists(path)) {\n\t\t\t\t\tPath newEmpPath = Paths.get(filePath);\n\t\t\t\t\ttry {\n\t\t\t\t\t\tFiles.createDirectory(newEmpPath);\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\tlog.error(\"Error while creating path \" + newEmpPath);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfilePath += \"/\" + exportFileName;\n\t\t\t\t// log.debug(\"NEW EXCEL_FILE PATH TO EXPORT----------\" + filePath);\n\n\t\t\t\t// create workbook\n\t\t\t\tXSSFWorkbook xssfWorkbook = new XSSFWorkbook();\n\t\t\t\t// create worksheet with title\n\t\t\t\tXSSFSheet xssfSheet = xssfWorkbook.createSheet(\"EMPLOYEE_REPORT\");\n\n\t\t\t\tRow headerRow = xssfSheet.createRow(0);\n\n\t\t\t\tfor (int i = 0; i < EMP_HEADER.length; i++) {\n\t\t\t\t\tCell cell = headerRow.createCell(i);\n\t\t\t\t\tcell.setCellValue(EMP_HEADER[i]);\n\t\t\t\t}\n\n\t\t\t\tint rowNum = 1;\n\n\t\t\t\tfor (EmployeeDTO transaction : content) {\n\n\t\t\t\t\tlog.info(\"Entered into EMP-FOR Loop--------->\");\n\n\t\t\t\t\tRow dataRow = xssfSheet.createRow(rowNum++);\n\n\t\t\t\t\tdataRow.createCell(0).setCellValue(transaction.getEmpId());\n\t\t\t\t\tdataRow.createCell(1).setCellValue(transaction.getName());\n\t\t\t\t\tdataRow.createCell(2).setCellValue(transaction.getDesignation());\n\t\t\t\t\tdataRow.createCell(3).setCellValue(transaction.getManagerName());\n\t\t\t\t\tdataRow.createCell(4).setCellValue(transaction.getProjectName());\n\t\t\t\t\tdataRow.createCell(5).setCellValue(transaction.getSiteName());\n\t\t\t\t\tdataRow.createCell(6).setCellValue(transaction.getActive());\n\t\t\t\t}\n\n\t\t\t\tfor (int i = 0; i < EMP_HEADER.length; i++) {\n\t\t\t\t\txssfSheet.autoSizeColumn(i);\n\t\t\t\t}\n\t\t\t\t// log.info(exportFileName + \" Excel file was created successfully !!!\");\n\t\t\t\tstatusMap.put(exportFileName, \"COMPLETED\");\n\n\t\t\t\t// String fName = \"F:\\\\Export\\\\Employee.xlsx\";\n\t\t\t\tFileOutputStream fileOutputStream = null;\n\t\t\t\ttry {\n\t\t\t\t\tfileOutputStream = new FileOutputStream(filePath);\n\t\t\t\t\txssfWorkbook.write(fileOutputStream);\n\t\t\t\t\tfileOutputStream.close();\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tlog.error(\"Error while flushing/closing !!!\");\n\t\t\t\t\tstatusMap.put(exportFileName, \"FAILED\");\n\t\t\t\t}\n\t\t\t\tlock.unlock();\n\t\t\t}", "@Test\n public String[][] readExcelFile() throws BiffException, IOException, RowsExceededException, WriteException {\n\t Workbook book = Workbook.getWorkbook(new File(\"./src/test/BlogData.xls\"));\n\t Sheet sheet = book.getSheet(\"Blogs\");\n\t \n\t /*\n\t blogs[1][0] = sheet.getCell(0,1).getContents();\n\t System.out.println(\"Blog title\" + blogs[1][0].toString());\n\t \n\t blogs[1][1] = sheet.getCell(1,1).getContents();\n\t System.out.println(\"Blog body\" + blogs[1][1].toString());\n\t */\n\t \n\t for (int row=0; row<=4; row++) {\n\t\t \n\t\t for(int col=0; col<=1; col++) {\n\t\t\t \n\t\t\t blogs[row][col] = sheet.getCell(col, row).getContents();\n\t\t\t \n\t\t }\n\t }\n\t \n\t \n\t \n\t for (int row=0; row<=4; row++) {\n\t\t\t\n\t\t System.out.println(blogs[row][0].toString() +\":\" +blogs[row][1].toString());\n\t }\n\t \n\t book.close();\n\t \n\t return blogs;\n\t \n\t \n\t /*\n\t * Write to excel sheet\n\t WritableWorkbook newbook = Workbook.createWorkbook(new File(\"./src/test/NewExcel.xls\"));\n\t WritableSheet sheet = newbook.createSheet(\"Master\", 0);\n\t \n\t Label l1 = new Label(0,0,\"One\");\n\t \n\t sheet.addCell(l1);\n\t \n\t newbook.write();\n\t newbook.close();\n\t */\n\t \n\t /*\n\t * Modify excel sheet\n\t \n\t Workbook oldCopy = Workbook.getWorkbook(new File(\"./src/test/Sample_DD.xls\"));\n\t \n\t WritableWorkbook newCopy = Workbook.createWorkbook(new File(\"./src/test/New_Sample_DD.xls\"), oldCopy);\n\t \n\t WritableSheet sheet1 = newCopy.getSheet(0);\n\t \n\t Label l2 = new Label(2,2,\"Friends\");\n\t \n\t sheet1.addCell(l2);\n\t \n\t newCopy.write();\n\t \n\t oldCopy.close();\n\t newCopy.close();\n\t */\n\t \n }", "@Test\r\n public void excel() throws EncryptedDocumentException, InvalidFormatException, FileNotFoundException, IOException {\n\t\tSystem.setProperty(\"webdriver.chrome.driver\", \"E:\\\\Selenium\\\\Newfolder\\\\chromedriver.exe\");\r\n\t\tdriver = new ChromeDriver();\r\n\t\t\r\n //get the excel sheet file location \r\n String filepath=\"E:\\\\Selenium\\\\SampleApplications\\\\ClearTripAppln\\\\DataSheet.xlsx\";\r\n\t \t\t\t\tWorkbook wb= WorkbookFactory.create(new FileInputStream(new File(filepath)));\r\n //get the sheet which needs read operation\r\n\t\t Sheet sh = wb.getSheet(\"sheet1\");\r\n\t\t \r\n\t String url =sh.getRow(0).getCell(1).getStringCellValue();\r\n\t System.out.println(url);\r\n\t driver.get(url);\r\n\t \r\n\t \t\t// Maximizing the window\r\n\t \t\tdriver.manage().window().maximize();\r\n\t \t\t\r\n\r\n\r\n\t\t }", "private void getExcelData21ZV() throws Exception {\n\t\tlistHeader = new ArrayList<ExcelPromotionHeader>();\n\t\tlistDetail = new ArrayList<ExcelPromotionDetail>();\n\t\tlistUnit = new ArrayList<ExcelPromotionUnit>();\n\t\tmapHeader = new HashMap<String, ExcelPromotionHeader>();\n\t\tmapUnit = new HashMap<String, ExcelPromotionUnit>();\n\t\tmapErrorPromotion = new HashMap<String, String>();\n\t\tmapType = new HashMap<String, String>();\n\t\tmapPromotionMua = new HashMap<String, ListGroupMua>();\n\t\tmapPromotionKM = new HashMap<String, ListGroupKM>();\n\t\tmapMuaKM = new MapMuaKM();\n\t\tmapPromotionTypeCheck = new HashMap<String, String>();\n\t\tlstHeaderError = new ArrayList<CellBean>();\n\t\tlstDetailError = new ArrayList<CellBean>();\n\t\tlistUnitError = new ArrayList<CellBean>();\n\t\tMap<String, Integer> mapCheckHeaderDuplicate = new HashMap<String, Integer>();\n\t\tMap<String, String> mapCheckType = apParamMgr.getMapPromotionType();\n\t\tWorkbook myWorkBook = null;\n\t\tInputStream is = new FileInputStream(excelFile);\n\t\tint MAX_ARRAY = 10000;\n\t\tfinal int NUM_SHEETS = 2;\n\n\t\tif (!is.markSupported()) {\n\t\t\tis = new PushbackInputStream(is, 8);\n\t\t}\n\t\tif (POIFSFileSystem.hasPOIFSHeader(is)) {\n\t\t\tmyWorkBook = new HSSFWorkbook(is);\n\t\t} else if (POIXMLDocument.hasOOXMLHeader(is)) {\n\t\t\tmyWorkBook = new XSSFWorkbook(OPCPackage.open(is));\n\t\t}\n\t\tif (myWorkBook != null) {\n\t\t\tif (myWorkBook.getNumberOfSheets() < NUM_SHEETS) {\n\t\t\t\tthrow new Exception(ERR_NUM_SHEET);\n\t\t\t}\n\t\t\tSheet headerSheet = myWorkBook.getSheetAt(0);\n\t\t\tSheet detailSheet = myWorkBook.getSheetAt(1);\n\t\t\tSheet unitSheet = myWorkBook.getSheetAt(2);\n\t\t\tint iRun = 0;\n\t\t\ttotalItem = 0;\n\t\t\tint maxSizeSheet1 = 12;\n\t\t\tif (headerSheet != null) {\n\t\t\t\tIterator<?> rowIter = headerSheet.rowIterator();\n\t\t\t\twhile (rowIter.hasNext()) {\n\t\t\t\t\tRow myRow = (Row) rowIter.next();\n\t\t\t\t\tif (iRun == 0) {\n\t\t\t\t\t\tiRun++;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tboolean isContinue = true;\n\t\t\t\t\t//Kiem tra su hop le cua Row Import\n\t\t\t\t\tfor (int i = 0; i < maxSizeSheet1; i++) {\n\t\t\t\t\t\tif (myRow.getCell(i) != null && !StringUtil.isNullOrEmpty(getCellValueToString(myRow.getCell(i)))) {\n\t\t\t\t\t\t\tisContinue = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (isContinue) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tExcelPromotionHeader header = new ExcelPromotionHeader();\n\t\t\t\t\tCellBean errRow = new CellBean();\n\t\t\t\t\tString messageError = \"\";\n\t\t\t\t\ttotalItem++;\n\t\t\t\t\t//0\tget promotionCode\n\t\t\t\t\tString promotionCode = \"\";\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellPromotionCode = myRow.getCell(0);\n\t\t\t\t\t\tif (cellPromotionCode != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\t//\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t//\t\t\t\t\t\t\tpromotionCode = cellPromotionCode.getStringCellValue();\n\t\t\t\t\t\t\t//\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t//\t\t\t\t\t\t\tpromotionCode = String.valueOf(cellPromotionCode.getNumericCellValue());\n\t\t\t\t\t\t\t//\t\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t\t\t//\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpromotionCode = getCellValueToString(cellPromotionCode);\n\t\t\t\t\t\t\tpromotionCode = promotionCode != null ? promotionCode.toUpperCase().trim() : \"\";\n\t\t\t\t\t\t\theader.promotionCode = promotionCode;\n\t\t\t\t\t\t\terrRow.setContent1(promotionCode);\n\t\t\t\t\t\t\tif (StringUtil.isNullOrEmpty(promotionCode)) {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.null\", \"Mã CTKM\");\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessageError += ValidateUtil.validateField(promotionCode, \"catalog.promotion.import.column.progcode\", 50, ConstantManager.ERR_REQUIRE, ConstantManager.ERR_MAX_LENGTH, ConstantManager.ERR_EXIST_SPECIAL_CHAR_IN_CODE);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (mapCheckHeaderDuplicate.get(promotionCode) != null) {\n\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"promotion.product.import.duplicate\", mapCheckHeaderDuplicate.get(promotionCode));\n\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmapCheckHeaderDuplicate.put(promotionCode, myRow.getRowNum());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tPromotionProgram existPromotion = promotionProgramMgr.getPromotionProgramByCode(promotionCode);\n\t\t\t\t\t\t\tif (existPromotion != null && !ActiveType.WAITING.equals(existPromotion.getStatus())) {\n\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.program.exists\");\n\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.get.promotion.error\", promotionCode);\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t\t//\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"ProgCode\");\n\t\t\t\t\t}\n\t\t\t\t\t//1\tget description\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellDescription = myRow.getCell(1);\n\t\t\t\t\t\tif (cellDescription != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tString description = getCellValueToString(cellDescription);\n\t\t\t\t\t\t\theader.description = description;\n\t\t\t\t\t\t\terrRow.setContent2(description);\n\t\t\t\t\t\t\tmessageError += ValidateUtil.validateField(description, \"catalog.promotion.import.column.progpescr\", 100, ConstantManager.ERR_REQUIRE, ConstantManager.ERR_MAX_LENGTH, ConstantManager.ERR_EXIST_SPECIAL_CHAR_IN_NAME);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"ProgDescr\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//2\tget release\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (myRow.getCell(2) != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\terrRow.setContent3(getCellValueToString(myRow.getCell(2)));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.number\", iRun, \"Release\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//3\tget promotion type\n\t\t\t\t\tString type = null;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellPromotionType = myRow.getCell(3);\n\t\t\t\t\t\tif (cellPromotionType != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\ttype = getCellValueToString(cellPromotionType);\n\t\t\t\t\t\t\ttype = type != null ? type.toUpperCase().trim() : \"\";\n\t\t\t\t\t\t\theader.type = type;\n\t\t\t\t\t\t\terrRow.setContent4(type);\n\t\t\t\t\t\t\tif (StringUtil.isNullOrEmpty(type)) {\n\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.required\", Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.type\"));\n\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (mapCheckType.get(type) == null) {\n\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.exists.before\", Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.type\"));\n\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmapType.put(header.promotionCode, type);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"ConditionTypeCode\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//4 get format\n\t\t\t\t\t//try {\n\t\t\t\t\t//\tCell cellFormat = myRow.getCell(4);\n\t\t\t\t\t//\tif (cellFormat != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t//\t\tString format = cellFormat.getStringCellValue();\n\t\t\t\t\t//\t\theader.format = format;\n\t\t\t\t\t//\t\terrRow.setContent5(format);\n\t\t\t\t\t//\t}\n\t\t\t\t\t//} catch (Exception e) {\n\t\t\t\t\t//\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"User1\");\n\t\t\t\t\t//}\n\t\t\t\t\t//4 get fromDate\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellFromDate = myRow.getCell(4);\n\t\t\t\t\t\tif (cellFromDate != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tif (cellFromDate.getCellType() == Cell.CELL_TYPE_NUMERIC && cellFromDate.getCellStyle() != null && DateUtil.HSSF_DATE_FORMAT_M_D_YY.equals(cellFromDate.getCellStyle().getDataFormatString())) {\n\t\t\t\t\t\t\t\tif (cellFromDate.getDateCellValue() != null || !StringUtil.isNullOrEmpty(cellFromDate.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\tString __fromDate = DateUtil.toDateString(cellFromDate.getDateCellValue(), DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\tDate fromDate = DateUtil.toDate(__fromDate, DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\theader.fromDate = fromDate;\n\t\t\t\t\t\t\t\t\terrRow.setContent5(__fromDate);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.required\", Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"imp.epx.tuyen.clmn.tuNgay\"));\n\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (cellFromDate.getCellType() == Cell.CELL_TYPE_NUMERIC && cellFromDate.getCellStyle() != null && DateUtil.DATE_FORMAT_VISIT.equals(cellFromDate.getCellStyle().getDataFormatString())) {\n\t\t\t\t\t\t\t\tif (cellFromDate.getDateCellValue() != null || !StringUtil.isNullOrEmpty(cellFromDate.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\tString __fromDate = DateUtil.toDateString(cellFromDate.getDateCellValue(), DateUtil.DATE_FORMAT_VISIT);\n\t\t\t\t\t\t\t\t\tDate fromDate = DateUtil.toDate(__fromDate, DateUtil.DATE_FORMAT_VISIT);\n\t\t\t\t\t\t\t\t\theader.fromDate = fromDate;\n\t\t\t\t\t\t\t\t\terrRow.setContent5(__fromDate);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.required\", Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"imp.epx.tuyen.clmn.tuNgay\"));\n\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif (!StringUtil.isNullOrEmpty(cellFromDate.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\tString __fromDate = cellFromDate.getStringCellValue();\n\t\t\t\t\t\t\t\t\t\tif (DateUtil.checkInvalidFormatDate(__fromDate)) {\n\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.invalid.format.date\", R.getResource(\"imp.epx.tuyen.clmn.tuNgay\"));\n\t\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t\t\terrRow.setContent5(__fromDate);\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tDate fromDate = DateUtil.toDate(__fromDate, DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\t\theader.fromDate = fromDate;\n\t\t\t\t\t\t\t\t\t\t\terrRow.setContent5(__fromDate);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} catch (Exception e1) {\n\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.invalid.format.date\", R.getResource(\"imp.epx.tuyen.clmn.tuNgay\"));\n\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t\terrRow.setContent5(cellFromDate.getStringCellValue());\n\t\t\t\t\t\t\t\t\t\tLogUtility.logError(e1, e1.getMessage());\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.required\", R.getResource(\"imp.epx.tuyen.clmn.tuNgay\"));\n\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.cant.read.cell.date\", iRun, \"FromDate\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//5 get toDate\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellToDate = myRow.getCell(5);\n\t\t\t\t\t\tif (cellToDate != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tif (cellToDate.getCellType() == Cell.CELL_TYPE_NUMERIC && cellToDate.getCellStyle() != null && DateUtil.HSSF_DATE_FORMAT_M_D_YY.equals(cellToDate.getCellStyle().getDataFormatString())) {\n\t\t\t\t\t\t\t\tif (cellToDate.getDateCellValue() != null || !StringUtil.isNullOrEmpty(cellToDate.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\tString __toDate = DateUtil.toDateString(cellToDate.getDateCellValue(), DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\tDate toDate = DateUtil.toDate(__toDate, DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\theader.toDate = toDate;\n\t\t\t\t\t\t\t\t\terrRow.setContent6(__toDate);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (cellToDate.getCellType() == Cell.CELL_TYPE_NUMERIC && cellToDate.getCellStyle() != null && DateUtil.DATE_FORMAT_VISIT.equals(cellToDate.getCellStyle().getDataFormatString())) {\n\t\t\t\t\t\t\t\tif (cellToDate.getDateCellValue() != null || !StringUtil.isNullOrEmpty(cellToDate.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\tString __toDate = DateUtil.toDateString(cellToDate.getDateCellValue(), DateUtil.DATE_FORMAT_VISIT);\n\t\t\t\t\t\t\t\t\tDate toDate = DateUtil.toDate(__toDate, DateUtil.DATE_FORMAT_VISIT);\n\t\t\t\t\t\t\t\t\theader.toDate = toDate;\n\t\t\t\t\t\t\t\t\terrRow.setContent6(__toDate);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (!StringUtil.isNullOrEmpty(cellToDate.getStringCellValue())) {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tString __toDate = cellToDate.getStringCellValue();\n\t\t\t\t\t\t\t\t\tif (DateUtil.checkInvalidFormatDate(__toDate)) {\n\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.invalid.format.date\", R.getResource(\"imp.epx.tuyen.clmn.denNgay\"));\n\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t\terrRow.setContent6(__toDate);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tDate toDate = DateUtil.toDate(__toDate, DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\theader.toDate = toDate;\n\t\t\t\t\t\t\t\t\t\terrRow.setContent6(__toDate);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} catch (Exception e1) {\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.invalid.format.date\", R.getResource(\"imp.epx.tuyen.clmn.denNgay\"));\n\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\terrRow.setContent6(cellToDate.getStringCellValue());\n\t\t\t\t\t\t\t\t\tLogUtility.logError(e1, e1.getMessage());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (header.fromDate != null && header.toDate != null) {\n\t\t\t\t\t\t\tif (DateUtil.compareDateWithoutTime(header.fromDate, header.toDate) > 0) {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.fromdate.greater.todate\") + \"\\n\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.cant.read.cell.date\", iRun, \"ToDate\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\n\t\t\t\t\t//6 Số thông báo CTKM\n\t\t\t\t\t/*\n\t\t\t\t\t * String description =\n\t\t\t\t\t * getCellValueToString(cellDescription); header.description\n\t\t\t\t\t * = description; errRow.setContent2(description);\n\t\t\t\t\t * messageError += ValidateUtil.validateField(description,\n\t\t\t\t\t * \"catalog.promotion.import.column.progpescr\", 100,\n\t\t\t\t\t * ConstantManager.ERR_REQUIRE,\n\t\t\t\t\t * ConstantManager.ERR_MAX_LENGTH,\n\t\t\t\t\t * ConstantManager.ERR_EXIST_SPECIAL_CHAR_IN_NAME);\n\t\t\t\t\t */\n\t\t\t\t\t\n\t\t\t\t\t/*errMsg = ValidateUtil.validateField(promotionName, \"catalog.promotion.name\", 500, ConstantManager.ERR_REQUIRE, ConstantManager.ERR_EXIST_SPECIAL_CHAR_IN_SPECIAL, ConstantManager.ERR_MAX_LENGTH);\n\t\t\t\t\tif (StringUtil.isNullOrEmpty(errMsg)) {\n\t\t\t\t\t\terrMsg = ValidateUtil.validateField(description, \"common.description\", null, ConstantManager.ERR_EXIST_SPECIAL_CHAR_IN_SPECIAL);\n\t\t\t\t\t}*/\n\t\t\t\t\t\n\t\t\t\t\t// 6 Số thông báo\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellNoticeCode = myRow.getCell(6);\n\t\t\t\t\t\tif (cellNoticeCode != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tString noticeCode = getCellValueToString(cellNoticeCode);\n\t\t\t\t\t\t\tif(noticeCode != null){\n\t\t\t\t\t\t\t\tnoticeCode = noticeCode.trim();\n\t\t\t\t\t\t\t\tnoticeCode = noticeCode.toUpperCase();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmessageError = ValidateUtil.validateField(noticeCode, \"catalog.promotion.noticecode\", 100, ConstantManager.ERR_EXIST_SPECIAL_CHAR_IN_SPECIAL);\n\t\t\t\t\t\t\t/*if(noticeCode.length() > 100){\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.notice.code.over.length\")+\"\\n\";\n\t\t\t\t\t\t\t}else*/ \n\t\t\t\t\t\t\tif(StringUtil.isNullOrEmpty(noticeCode)) {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.notice.code.obligate\") + \"\\n\";\n\t\t\t\t\t\t\t}else if(noticeCode != null && noticeCode.trim().length() > 100){\n\t\t\t\t\t\t\t\t//messageError += R.getResource(\"catalog.promotion.import.notice.code.incorrect.format\");\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.over.max.length\") + \"\\n\";\n\t\t\t\t\t\t\t\tmessageError = messageError.replaceAll(\"%max%\", \"100\");\n\t\t\t\t\t\t\t\tmessageError = messageError.replaceAll(\"%colName%\", \"Số thông báo\");\n\t\t\t\t\t\t\t}else if(StringUtil.isNullOrEmpty(messageError)){\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\theader.noticeCode = noticeCode;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\terrRow.setContent7(noticeCode);\n\t\t\t\t\t\t}else if (cellNoticeCode == null) {\n\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.notice.code.obligate\") + \"\\n\";\n\t\t\t\t\t\t} \n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.cant.read.cell.string\", iRun, \"NoticeCode\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t// 7 Nhóm/Tên SP hàng bán\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellDesProduct = myRow.getCell(7);\n\t\t\t\t\t\tif (cellDesProduct != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tString descProduct = getCellValueToString(cellDesProduct);\n\t\t\t\t\t\t\tif(descProduct != null){\n\t\t\t\t\t\t\t\tdescProduct = descProduct.trim();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t//descProduct = descProduct.trim();\n\t\t\t\t\t\t\tmessageError = ValidateUtil.validateField(descProduct, \"catalog.promotion.descriptionproduct\", 1000, ConstantManager.ERR_EXIST_SPECIAL_CHAR_IN_SPECIAL);\n\t\t\t\t\t\t\t/*if(descProduct.length() > 1000){\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.desc.product.over.length\")+\"\\n\";\n\t\t\t\t\t\t\t}else*/ \n\t\t\t\t\t\t\tif(StringUtil.isNullOrEmpty(descProduct)) {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.description.product.obligate\") + \"\\n\";\n\t\t\t\t\t\t\t}else if(descProduct.trim().length() > 1000){\n\t\t\t\t\t\t\t\t//messageError += R.getResource(\"catalog.promotion.import.description.product.incorrect.format\") + \"\\n\";\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.over.max.length\") + \"\\n\";\n\t\t\t\t\t\t\t\tmessageError = messageError.replaceAll(\"%max%\", \"1000\");\n\t\t\t\t\t\t\t\tmessageError = messageError.replaceAll(\"%colName%\", \"Nhóm/Tên SP hàng bán\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if(StringUtil.isNullOrEmpty(messageError)){\n\t\t\t\t\t\t\t\tdescProduct = descProduct.trim();\n\t\t\t\t\t\t\t\theader.decriptionProduct = descProduct;\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\n\t\t\t\t\t\t\terrRow.setContent8(descProduct);\n\t\t\t\t\t\t}else if(cellDesProduct == null) {\n\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.description.product.obligate\") + \"\\n\";\n\t\t\t\t\t\t} \n\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.cant.read.cell.string\", iRun, \"DescProduct\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\n\t\t\t\t\t// 8 Mô tả chương trình\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellDescription = myRow.getCell(8);\n\t\t\t\t\t\tif (cellDescription != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tString description = getCellValueToString(cellDescription);\n\t\t\t\t\t\t\tif(description != null){\n\t\t\t\t\t\t\t\tdescription = description.trim();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(description != null && description.trim().length() > 1000){\n\t\t\t\t\t\t\t\t//messageError += R.getResource(\"catalog.promotion.import.description.program.incorrect.format\") + \"\\n\";\n\t\t\t\t\t\t\t\t//messageError += R.getResource(\"\", iRun, \"Description\");\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.over.max.length\") + \"\\n\";\n\t\t\t\t\t\t\t\tmessageError = messageError.replaceAll(\"%max%\", \"1000\");\n\t\t\t\t\t\t\t\tmessageError = messageError.replaceAll(\"%colName%\", \"Mô tả chương trình\");\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\tdescription = description.trim();\n\t\t\t\t\t\t\t\theader.descriptionProgram = description;\n\t\t\t\t\t\t\t\terrRow.setContent9(description);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t/*else if(cellDescription != null){\n\t\t\t\t\t\t\tString description = getCellValueToString(cellDescription);\n\t\t\t\t\t\t\terrRow.setContent9(description);\n\t\t\t\t\t\t}*/\n\t\t\t\t\t\t\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.cant.read.cell.string\", iRun, \"Description\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//9 Bội số\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellMultiple = myRow.getCell(9);\n\t\t\t\t\t\theader.multiple = 0; \n\t\t\t\t\t\tif (cellMultiple != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tString multiple = getCellValueToString(cellMultiple);\n\t\t\t\t\t\t\tApParam apParam = apParamMgr.getApParamByCode(\"LIST_PROMO_ALLOW_MULTIPLE\", ApParamType.LIST_PROMO_ALLOW_MULTIPLE);\n\t\t\t\t\t\t\tString strListPromo = apParam != null?apParam.getValue() : \"ZV02,ZV03,ZV05,ZV06,ZV08,ZV09,ZV11,ZV12,ZV13,ZV14,ZV15,ZV16,ZV17,ZV18,ZV20,ZV21,ZV23,ZV24\";\n\t\t\t\t\t\t\tif ((Constant.IS_MULTIPLE.equals(multiple) || Constant.NON_MULTIPLE.equals(multiple)) \n\t\t\t\t\t\t\t\t\t&& strListPromo != null) {\n\t\t\t\t\t\t\t\tstrListPromo = strListPromo.replace(\" \", \"\");\n\t\t\t\t\t\t\t\tstrListPromo = strListPromo.toUpperCase();\n\t\t\t\t\t\t\t\tString[] ListPromoAllow = strListPromo.split(\",\");\n\t\t\t\t\t\t\t\tif (Constant.IS_MULTIPLE.equals(multiple) \n\t\t\t\t\t\t\t\t\t &&\t!Arrays.asList(ListPromoAllow).contains(header.type.toUpperCase())) {\n\t\t\t\t\t\t\t\t\tSystem.out.println(header.type.toUpperCase());\n\t\t\t\t\t\t\t\t\tSystem.out.println(strListPromo);\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.multiple.not.use\") + \"\\n\";\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\theader.multiple = Integer.parseInt(multiple.trim());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.multiple.incorrect.format\") + \"\\n\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\terrRow.setContent10(multiple);\n\t\t\t\t\t\t}/*else if(cellMultiple != null){\n\t\t\t\t\t\t\tString multiple = getCellValueToString(cellMultiple);\n\t\t\t\t\t\t\terrRow.setContent10(multiple);\n\t\t\t\t\t\t}*/\n\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.number\", iRun, \"Multiple\", \"['','X']\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t// 10 Tối ưu\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellRecursive = myRow.getCell(10);\n\t\t\t\t\t\theader.recursive = 0;\n\t\t\t\t\t\tif (cellRecursive != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tString recursive = getCellValueToString(cellRecursive);\n\t\t\t\t\t\t\tApParam apParam = apParamMgr.getApParamByCode(\"LIST_PROMO_ALLOW_RECURSIVE\", ApParamType.LIST_PROMO_ALLOW_RECURSIVE);\n\t\t\t\t\t\t\tString strListPromo = apParam == null? \"ZV02,ZV03,ZV05,ZV06,ZV08,ZV09,ZV11,ZV12,ZV13,ZV14,ZV15,ZV16,ZV17,ZV18,ZV20,ZV21,ZV23,ZV24\":apParam.getValue();\n\t\t\t\t\t\t\tif ((Constant.IS_RECURSIVE.equals(recursive) || Constant.NON_RECURSIVE.equals(recursive)) \n\t\t\t\t\t\t\t\t\t&& strListPromo != null) {\n\t\t\t\t\t\t\t\tstrListPromo = strListPromo.replace(\" \", \"\");\n\t\t\t\t\t\t\t\tString[] listPromoAllow = strListPromo.split(\",\");\n\t\t\t\t\t\t\t\tif (Constant.IS_RECURSIVE.equals(recursive)\t\t\t\n\t\t\t\t\t\t\t\t\t &&\t!Arrays.asList(listPromoAllow).contains(header.type.toUpperCase())) {\n\t\t\t\t\t\t\t\t/*\tSystem.out.println(header.type.toUpperCase());\n\t\t\t\t\t\t\t\t\tSystem.out.println(strListPromo);*/\n\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.recursive.not.use\") + \"\\n\";\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\theader.recursive = Integer.parseInt(recursive.trim());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.recursive.incorrect.format\") + \"\\n\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\terrRow.setContent11(recursive);\n\t\t\t\t\t\t}/*else if(cellRecursive != null){\n\t\t\t\t\t\t\tString recursive = getCellValueToString(cellRecursive);\n\t\t\t\t\t\t\terrRow.setContent11(recursive);\n\t\t\t\t\t\t}*/\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.number\", iRun, \"Recursive\", \"['','X']\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t// 9 Loại trả thưởng\n\t\t\t\t/*\ttry {\n\t\t\t\t\t\tCell cellRewardType = myRow.getCell(9);\n\t\t\t\t\t\tApParam apParam = apParamMgr.getApParamByCode(\"LIST_ALLOW_REWARD_TYPE\", ApParamType.LIST_ALLOW_REWARD_TYPE);\n\t\t\t\t\t\tString strListAllowReward = apParam.getApParamName();\n\t\t\t\t\t\tstrListAllowReward = strListAllowReward.replace(\" \", \"\");\n\t\t\t\t\t\tString[] listAllowReward = strListAllowReward.split(\",\");\n\t\t\t\t\t\tif (cellRewardType != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tString strRewardType = getCellValueToString(cellRewardType);\n\t\t\t\t\t\t\tif (strRewardType != null \n\t\t\t\t\t\t\t\t\t&& (Constant.DISCOUNT_MONEY.equals(strRewardType) || Constant.VOUCHER.equals(strRewardType)) \n\t\t\t\t\t\t\t\t\t&& Arrays.asList(listAllowReward).contains(header.type)) {\n\t\t\t\t\t\t\t\theader.rewardType = Integer.parseInt(strRewardType.trim());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\terrRow.setContent10(strRewardType);\n\t\t\t\t\t\t}else if(cellRewardType != null){\n\t\t\t\t\t\t\tString strRewardType = getCellValueToString(cellRewardType);\n\t\t\t\t\t\t\terrRow.setContent10(strRewardType);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.cant.read.cell.number\", iRun, \"RewardType\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t// 10 Từ ngày trả thưởng\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellFromDateReward = myRow.getCell(10);\n\t\t\t\t\t\tif (Constant.VOUCHER.equals(header.rewardType+\"\")) {\n\t\t\t\t\t\t\tif (cellFromDateReward != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\t\tif (cellFromDateReward.getCellType() == Cell.CELL_TYPE_NUMERIC && cellFromDateReward.getCellStyle() != null && DateUtil.HSSF_DATE_FORMAT_M_D_YY.equals(cellFromDateReward.getCellStyle().getDataFormatString())) {\n\t\t\t\t\t\t\t\t\tif (cellFromDateReward.getDateCellValue() != null || !StringUtil.isNullOrEmpty(cellFromDateReward.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\t\tString _fromDateReward = DateUtil.toDateString(cellFromDateReward.getDateCellValue(), DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\tDate fromDateReward = DateUtil.toDate(_fromDateReward, DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\theader.fromApplyDate = fromDateReward;\n\t\t\t\t\t\t\t\t\t\terrRow.setContent11(_fromDateReward);\n\t\t\t\t\t\t\t\t\t} else if (cellFromDateReward.getCellType() == Cell.CELL_TYPE_NUMERIC && cellFromDateReward.getCellStyle() != null && DateUtil.DATE_FORMAT_VISIT.equals(cellFromDateReward.getCellStyle().getDataFormatString())) {\n\t\t\t\t\t\t\t\t\t\tif (cellFromDateReward.getDateCellValue() != null || StringUtil.isNullOrEmpty(cellFromDateReward.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\t\t\tString _fromDateReward = DateUtil.toDateString(cellFromDateReward.getDateCellValue(), DateUtil.DATE_FORMAT_VISIT);\n\t\t\t\t\t\t\t\t\t\t\tDate fromDateReward = DateUtil.toDate(_fromDateReward, DateUtil.DATE_FORMAT_VISIT);\n\t\t\t\t\t\t\t\t\t\t\theader.fromApplyDate = fromDateReward;\n\t\t\t\t\t\t\t\t\t\t\terrRow.setContent11(_fromDateReward);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else if (!StringUtil.isNullOrEmpty(cellFromDateReward.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\tString _fromDateReward = cellFromDateReward.getStringCellValue();\n\t\t\t\t\t\t\t\t\t\t\tif (DateUtil.checkInvalidFormatDate(_fromDateReward)) {\n\t\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.invalid.format.date\", R.getResource(\"imp.epx.tuyen.clmn.tuNgay.traThuong\"));\n\t\t\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t\t\t\terrRow.setContent11(_fromDateReward);\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\tDate fromDateReward = DateUtil.toDate(_fromDateReward, DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\t\t\theader.fromApplyDate = fromDateReward;\n\t\t\t\t\t\t\t\t\t\t\t\terrRow.setContent11(_fromDateReward);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} catch (Exception e1) {\n\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.invalid.format.date\", R.getResource(\"imp.epx.tuyen.clmn.tuNgay.traThuong\"));\n\t\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t\t\terrRow.setContent11(cellFromDateReward.getStringCellValue());\n\t\t\t\t\t\t\t\t\t\t\tLogUtility.logError(e1, e1.getMessage());\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif(header.fromApplyDate != null && header.fromDate != null){\n\t\t\t\t\t\t\t\t\t\tint sub = DateUtil.compareDateWithoutTime(header.fromDate,header.fromApplyDate);\n\t\t\t\t\t\t\t\t\t\tif(DateUtil.compareDateWithoutTime(header.fromDate,header.fromApplyDate) > 0){\n\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.fromdate.reward.greater.fromdate\")+\"\\n\";\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}else if(cellFromDateReward != null){\n\t\t\t\t\t\t\tString _fromDateReward = getCellValueToString(cellFromDateReward); \n\t\t\t\t\t\t\terrRow.setContent11(_fromDateReward);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.cant.read.cell.date\", iRun, \"FromDateReward\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\n\t\t\t\t\t// 11 Đến ngày trả thưởng\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellToDateReward = myRow.getCell(11);\n\t\t\t\t\t\tif (Constant.VOUCHER.equals(header.rewardType+\"\")) {\n\t\t\t\t\t\t\tif (cellToDateReward != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\t\tif (cellToDateReward.getCellType() == Cell.CELL_TYPE_NUMERIC && cellToDateReward.getCellStyle() != null && DateUtil.HSSF_DATE_FORMAT_M_D_YY.equals(cellToDateReward.getCellStyle().getDataFormatString())) {\n\t\t\t\t\t\t\t\t\tif (cellToDateReward.getDateCellValue() != null || !StringUtil.isNullOrEmpty(cellToDateReward.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\t\tString _toDateReward = DateUtil.toDateString(cellToDateReward.getDateCellValue(), DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\tDate toDateReward = DateUtil.toDate(_toDateReward, DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\theader.toApplyDate = toDateReward;\n\t\t\t\t\t\t\t\t\t\terrRow.setContent12(_toDateReward);\n\t\t\t\t\t\t\t\t\t} else if (cellToDateReward.getCellType() == Cell.CELL_TYPE_NUMERIC && cellToDateReward.getCellStyle() != null && DateUtil.DATE_FORMAT_VISIT.equals(cellToDateReward.getCellStyle().getDataFormatString())) {\n\t\t\t\t\t\t\t\t\t\tif (cellToDateReward.getDateCellValue() != null || StringUtil.isNullOrEmpty(cellToDateReward.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\t\t\tString _toDateReward = DateUtil.toDateString(cellToDateReward.getDateCellValue(), DateUtil.DATE_FORMAT_VISIT);\n\t\t\t\t\t\t\t\t\t\t\tDate toDateReward = DateUtil.toDate(_toDateReward, DateUtil.DATE_FORMAT_VISIT);\n\t\t\t\t\t\t\t\t\t\t\theader.toApplyDate = toDateReward;\n\t\t\t\t\t\t\t\t\t\t\terrRow.setContent12(_toDateReward);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else if (!StringUtil.isNullOrEmpty(cellToDateReward.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\tString _todateReward = cellToDateReward.getStringCellValue();\n\t\t\t\t\t\t\t\t\t\t\tif (DateUtil.checkInvalidFormatDate(_todateReward)) {\n\t\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.invalid.format.date\", R.getResource(\"imp.epx.tuyen.clmn.denNgay.traThuong \"));\n\t\t\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t\t\t\terrRow.setContent12(_todateReward);\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\tDate toDate = DateUtil.toDate(_todateReward, DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\t\t\theader.toApplyDate = toDate;\n\t\t\t\t\t\t\t\t\t\t\t\terrRow.setContent12(_todateReward);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} catch (Exception e1) {\n\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.invalid.format.date\", R.getResource(\"imp.epx.tuyen.clmn.denNgay.traThuong\"));\n\t\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t\t\terrRow.setContent12(cellToDateReward.getStringCellValue());\n\t\t\t\t\t\t\t\t\t\t\tLogUtility.logError(e1, e1.getMessage());\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (header.fromApplyDate != null && header.toApplyDate != null) {\n\t\t\t\t\t\t\t\t\t\tif (DateUtil.compareDateWithoutTime(header.fromApplyDate, header.toApplyDate) > 0) {\n\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.fromdate.greater.todate.reward\") + \"\\n\";\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}else if(cellToDateReward != null){\n\t\t\t\t\t\t\tString _todateReward = getCellValueToString(cellToDateReward); \n\t\t\t\t\t\t\terrRow.setContent12(_todateReward);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.cant.read.cell.date\", iRun, \"ToDateReward\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}*/\n\t\t\t\t\t// 11 Loại trả thưởng\n\t\t\t\t\ttry {\n\t\t\t\t\t\t\tCell cellRewardType = myRow.getCell(11);\n\t\t\t\t\t\t\tApParam apParam = apParamMgr.getApParamByCode(\"LIST_ALLOW_REWARD_TYPE\", ApParamType.LIST_ALLOW_REWARD_TYPE);\n\t\t\t\t\t\t\tString strListAllowReward = apParam.getApParamName();\n\t\t\t\t\t\t\tstrListAllowReward = strListAllowReward.replace(\" \", \"\");\n\t\t\t\t\t\t\tString[] listAllowReward = strListAllowReward.split(\",\");\n\t\t\t\t\t\t\tif (cellRewardType != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\t\tString strRewardType = getCellValueToString(cellRewardType);\n\t\t\t\t\t\t\t\tif (strRewardType != null \n\t\t\t\t\t\t\t\t\t&& (Constant.DISCOUNT_MONEY.equals(strRewardType) || Constant.VOUCHER.equals(strRewardType)) \n\t\t\t\t\t\t\t\t\t&& Arrays.asList(listAllowReward).contains(header.type)) \n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif(Constant.DISCOUNT_MONEY.equals(strRewardType) || Constant.VOUCHER.equals(strRewardType)) \n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\theader.rewardType = Integer.parseInt(strRewardType.trim());\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\terrRow.setContent12(strRewardType);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tString strRewardType = getCellValueToString(cellRewardType);\n\t\t\t\t\t\t\t\terrRow.setContent12(strRewardType);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.cant.read.cell.number\", iRun, \"RewardType\");\n\t\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// 12 Từ ngày trả thưởng\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellFromDateReward = myRow.getCell(12);\n\t\t\t\t\t\tif (Constant.VOUCHER.equals(header.rewardType+\"\")) {\n\t\t\t\t\t\t\tif (cellFromDateReward != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\t\tif (StringUtil.isNullOrEmpty(cellFromDateReward.getStringCellValue()))\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.null\", R.getResource(\"imp.epx.tuyen.clmn.tuNgay.traThuong\"));\n\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tif (cellFromDateReward.getCellType() == Cell.CELL_TYPE_NUMERIC && cellFromDateReward.getCellStyle() != null && DateUtil.HSSF_DATE_FORMAT_M_D_YY.equals(cellFromDateReward.getCellStyle().getDataFormatString())) {\n\t\t\t\t\t\t\t\t\tif (cellFromDateReward.getDateCellValue() != null || !StringUtil.isNullOrEmpty(cellFromDateReward.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\t\tString _fromDateReward = DateUtil.toDateString(cellFromDateReward.getDateCellValue(), DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\tDate fromDateReward = DateUtil.toDate(_fromDateReward, DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\theader.fromApplyDate = fromDateReward;\n\t\t\t\t\t\t\t\t\t\terrRow.setContent13(_fromDateReward);\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t} \n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse if (cellFromDateReward.getCellType() == Cell.CELL_TYPE_NUMERIC && cellFromDateReward.getCellStyle() != null && DateUtil.DATE_FORMAT_VISIT.equals(cellFromDateReward.getCellStyle().getDataFormatString())) {\n\t\t\t\t\t\t\t\t\t\tif (cellFromDateReward.getDateCellValue() != null || StringUtil.isNullOrEmpty(cellFromDateReward.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\t\t\tString _fromDateReward = DateUtil.toDateString(cellFromDateReward.getDateCellValue(), DateUtil.DATE_FORMAT_VISIT);\n\t\t\t\t\t\t\t\t\t\t\tDate fromDateReward = DateUtil.toDate(_fromDateReward, DateUtil.DATE_FORMAT_VISIT);\n\t\t\t\t\t\t\t\t\t\t\theader.fromApplyDate = fromDateReward;\n\t\t\t\t\t\t\t\t\t\t\terrRow.setContent13(_fromDateReward);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else if (!StringUtil.isNullOrEmpty(cellFromDateReward.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\tString _fromDateReward = cellFromDateReward.getStringCellValue();\n\t\t\t\t\t\t\t\t\t\t\tif (DateUtil.checkInvalidFormatDate(_fromDateReward)) {\n\t\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.invalid.format.date\", R.getResource(\"imp.epx.tuyen.clmn.tuNgay.traThuong\"));\n\t\t\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t\t\t\terrRow.setContent13(_fromDateReward);\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\tDate fromDateReward = DateUtil.toDate(_fromDateReward, DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\t\t\theader.fromApplyDate = fromDateReward;\n\t\t\t\t\t\t\t\t\t\t\t\terrRow.setContent13(_fromDateReward);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} catch (Exception e1) {\n\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.invalid.format.date\", R.getResource(\"imp.epx.tuyen.clmn.tuNgay.traThuong\"));\n\t\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t\t\terrRow.setContent13(cellFromDateReward.getStringCellValue());\n\t\t\t\t\t\t\t\t\t\t\tLogUtility.logError(e1, e1.getMessage());\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif(header.fromApplyDate != null && header.fromDate != null){\n//\t\t\t\t\t\t\t\t\t\tint sub = DateUtil.compareDateWithoutTime(header.fromDate,header.fromApplyDate);\n\t\t\t\t\t\t\t\t\t\tif(DateUtil.compareDateWithoutTime(header.fromDate,header.fromApplyDate) > 0){\n\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.fromdate.reward.greater.fromdate\")+\"\\n\";\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}else if(cellFromDateReward != null){\n\t\t\t\t\t\t\tString _fromDateReward = getCellValueToString(cellFromDateReward); \n\t\t\t\t\t\t\terrRow.setContent13(_fromDateReward);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.cant.read.cell.date\", iRun, \"FromDateReward\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// 11 Đến ngày trả thưởng\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellToDateReward = myRow.getCell(13);\n\t\t\t\t\t\tif (Constant.VOUCHER.equals(header.rewardType+\"\")) {\n\t\t\t\t\t\t\tif (cellToDateReward != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\t\tif (cellToDateReward.getCellType() == Cell.CELL_TYPE_NUMERIC && cellToDateReward.getCellStyle() != null && DateUtil.HSSF_DATE_FORMAT_M_D_YY.equals(cellToDateReward.getCellStyle().getDataFormatString())) {\n\t\t\t\t\t\t\t\t\tif (cellToDateReward.getDateCellValue() != null || !StringUtil.isNullOrEmpty(cellToDateReward.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\t\tString _toDateReward = DateUtil.toDateString(cellToDateReward.getDateCellValue(), DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\tDate toDateReward = DateUtil.toDate(_toDateReward, DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\theader.toApplyDate = toDateReward;\n\t\t\t\t\t\t\t\t\t\terrRow.setContent14(_toDateReward);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else if (cellToDateReward.getCellType() == Cell.CELL_TYPE_NUMERIC && cellToDateReward.getCellStyle() != null && DateUtil.DATE_FORMAT_VISIT.equals(cellToDateReward.getCellStyle().getDataFormatString())) {\n\t\t\t\t\t\t\t\t\t\tif (cellToDateReward.getDateCellValue() != null || StringUtil.isNullOrEmpty(cellToDateReward.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\t\t\tString _toDateReward = DateUtil.toDateString(cellToDateReward.getDateCellValue(), DateUtil.DATE_FORMAT_VISIT);\n\t\t\t\t\t\t\t\t\t\t\tDate toDateReward = DateUtil.toDate(_toDateReward, DateUtil.DATE_FORMAT_VISIT);\n\t\t\t\t\t\t\t\t\t\t\theader.toApplyDate = toDateReward;\n\t\t\t\t\t\t\t\t\t\t\terrRow.setContent14(_toDateReward);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else if (!StringUtil.isNullOrEmpty(cellToDateReward.getStringCellValue())) {\n\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\tString _todateReward = cellToDateReward.getStringCellValue();\n\t\t\t\t\t\t\t\t\t\t\tif (DateUtil.checkInvalidFormatDate(_todateReward)) {\n\t\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.invalid.format.date\", R.getResource(\"imp.epx.tuyen.clmn.denNgay.traThuong \"));\n\t\t\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t\t\t\terrRow.setContent14(_todateReward);\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\tDate toDate = DateUtil.toDate(_todateReward, DateUtil.DATE_FORMAT_DDMMYYYY);\n\t\t\t\t\t\t\t\t\t\t\t\theader.toApplyDate = toDate;\n\t\t\t\t\t\t\t\t\t\t\t\terrRow.setContent14(_todateReward);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} catch (Exception e1) {\n\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.invalid.format.date\", R.getResource(\"imp.epx.tuyen.clmn.denNgay.traThuong\"));\n\t\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t\t\terrRow.setContent14(cellToDateReward.getStringCellValue());\n\t\t\t\t\t\t\t\t\t\t\tLogUtility.logError(e1, e1.getMessage());\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (header.fromApplyDate != null && header.toApplyDate != null) {\n\t\t\t\t\t\t\t\t\t\tif (DateUtil.compareDateWithoutTime(header.fromApplyDate, header.toApplyDate) > 0) {\n\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"common.fromdate.greater.todate.reward\") + \"\\n\";\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}else if(cellToDateReward != null){\n\t\t\t\t\t\t\tString _todateReward = getCellValueToString(cellToDateReward); \n\t\t\t\t\t\t\terrRow.setContent14(_todateReward);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.cant.read.cell.date\", iRun, \"ToDateReward\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\tlistHeader.add(header);\n\t\t\t\t\t\tmapHeader.put(header.promotionCode, header);\n\t\t\t\t\t} else {\n\t\t\t\t\t\terrRow.setErrMsg(messageError);\n\t\t\t\t\t\tlstHeaderError.add(errRow);\n\t\t\t\t\t\tif (mapErrorPromotion.get(header.promotionCode) == null) {\n\t\t\t\t\t\t\tmapErrorPromotion.put(header.promotionCode, messageError);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tiRun++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t//Sheet Don vi tham gia\n\t\t\tif (unitSheet != null) {\n\t\t\t\tIterator<?> rowIter = unitSheet.rowIterator();\n\t\t\t\tiRun = 0;\n\t\t\t\tint maxSizeSheet3 = 5;\n\t\t\t\tList<Shop> listShopChild;\n\t\t\t\twhile (rowIter.hasNext()) {\n\t\t\t\t\tRow myRow = (Row) rowIter.next();\n\t\t\t\t\tif (iRun == 0) {\n\t\t\t\t\t\tiRun++;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tboolean isContinue = true;\n\t\t\t\t\tfor (int i = 0; i < maxSizeSheet3; i++) {\n\t\t\t\t\t\tif (myRow.getCell(i) != null) {\n\t\t\t\t\t\t\tisContinue = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (isContinue) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tExcelPromotionUnit unitPromo = new ExcelPromotionUnit();\n\t\t\t\t\tCellBean errRow = new CellBean();\n\t\t\t\t\tString messageError = \"\";\n\t\t\t\t\tBoolean isHasData = false;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tString promotionCode = getCellValueToString(myRow.getCell(0));\n\t\t\t\t\t\tString shopCode = getCellValueToString(myRow.getCell(1));\n\t\t\t\t\t\tString quality = getCellValueToString(myRow.getCell(2));\n\t\t\t\t\t\tString totalAmount = getCellValueToString(myRow.getCell(3));\n\t\t\t\t\t\tString amount = getCellValueToString(myRow.getCell(4));\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (!StringUtil.isNullOrEmpty(promotionCode) || !StringUtil.isNullOrEmpty(shopCode) || !StringUtil.isNullOrEmpty(quality)\n\t\t\t\t\t\t\t\t|| !StringUtil.isNullOrEmpty(totalAmount) || !StringUtil.isNullOrEmpty(amount)) {\n\t\t\t\t\t\t\tisHasData = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t// 1 Mã CTKM\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellPromotionCode = myRow.getCell(0);\n\t\t\t\t\t\tif (cellPromotionCode != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tif(isHasData){\n\t\t\t\t\t\t\t\tString promoCode = getCellValueToString(cellPromotionCode);\n\t\t\t\t\t\t\t\tPromotionProgram newPromotionProgram;\n\t\t\t\t\t\t\t\tif (StringUtil.isNullOrEmpty(promoCode)) {\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.promotion.code.obligate\") + \"\\n\";\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tnewPromotionProgram = promotionProgramMgr.getPromotionProgramByCode(promoCode);\n\t\t\t\t\t\t\t\t\tif(newPromotionProgram == null \n\t\t\t\t\t\t\t\t\t\t\t&& mapHeader.get(promoCode) == null){\n\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.not.init\") + \"\\n\";\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tunitPromo.promotionCode = promoCode;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\terrRow.setContent1(promoCode);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"Mã CTKM\"));\n\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t// 2 Mã đơn vị\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellUnitCode = myRow.getCell(1);\n\t\t\t\t\t\tif (cellUnitCode != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tif(isHasData){\n\t\t\t\t\t\t\t\tString unitCode = getCellValueToString(cellUnitCode);\n\t\t\t\t\t\t\t\t// Kiem tra ma don vi empty\n\t\t\t\t\t\t\t\tif(StringUtil.isNullOrEmpty(unitCode)){\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.unit.code.obligate\") + \"\\n\";\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// Kiem tra don vi ton tai trong he thong\n\t\t\t\t\t\t\t\t\tif(shopMgr.getShopByCode(unitCode) == null){\n\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.unit.code.not.permission\") + \"\\n\";\n\t\t\t\t\t\t\t\t\t} else if (currentUser != null && currentUser.getShopRoot() != null){ // kiem tra don vi co thuoc quyen quan ly cua user\n\t\t\t\t\t\t\t\t\t\tlistShopChild = promotionProgramMgr.getListChildByShopId(currentUser.getShopRoot().getShopId());\n\t\t\t\t\t\t\t\t\t\t// Kiem tra shop co thuoc quen quan ly cua user dang nhap\n\t\t\t\t\t\t\t\t\t\tboolean isShopMapWithUser = false;\n\t\t\t\t\t\t\t\t\t\tfor(Shop shop: listShopChild){\n\t\t\t\t\t\t\t\t\t\t\t if(unitCode.toLowerCase().equals(shop.getShopCode().toLowerCase())){\n\t\t\t\t\t\t\t\t\t\t\t\t isShopMapWithUser = true;\n\t\t\t\t\t\t\t\t\t\t\t\t break;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif(!isShopMapWithUser){\n\t\t\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.unit.code.not.permission.by.current.user\") + \"\\n\";\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tunitPromo.unitCode = unitCode;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\terrRow.setContent2(unitCode);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"Mã CTKM\"));\n\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t// 3 Số suất \n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellQuantityMax = myRow.getCell(2);\n\t\t\t\t\t\tif (cellQuantityMax != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tString quantityMax = getCellValueToString(cellQuantityMax);\n\t\t\t\t\t\t\tif(quantityMax != null){\n\t\t\t\t\t\t\t\tquantityMax = quantityMax.trim().replace(\",\", \"\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (quantityMax != null && quantityMax.trim().length() <= 9 \n\t\t\t\t\t\t\t\t\t&& StringUtil.isFloat(quantityMax) && Double.parseDouble(quantityMax.trim()) > 0\n\t\t\t\t\t\t\t\t\t&& quantityMax.contains(\".\") == false) {\n\t\t\t\t\t\t\t\tunitPromo.quantityMax = Integer.parseInt(quantityMax.trim().replace(\",\", \"\"));\n\t\t\t\t\t\t\t} else if(quantityMax != null && quantityMax.length() > 9 ){\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.over.max.length\") + \"\\n\";\n\t\t\t\t\t\t\t\tmessageError = messageError.replaceAll(\"%max%\", \"9\");\n\t\t\t\t\t\t\t\tmessageError = messageError.replaceAll(\"%colName%\", \"Số suất\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (StringUtil.isNullOrEmpty(quantityMax) == false) {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.quantity.max.incorrect.format\") + \"\\n\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\terrRow.setContent3(quantityMax);\n\t\t\t\t\t\t}else if(cellQuantityMax != null){\n\t\t\t\t\t\t\t// String quantityMax = getCellValueToString(cellQuantityMax);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.number\", Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"Số suất\"));\n\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t// 4 Số tiền amountMax\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellAmountMax = myRow.getCell(3);\n\t\t\t\t\t\tif (cellAmountMax != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tString amountMax = getCellValueToString(cellAmountMax);\n\t\t\t\t\t\t\tif(amountMax != null){\n\t\t\t\t\t\t\t\tamountMax = amountMax.trim().replace(\",\", \"\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (amountMax != null && amountMax.length() <= 9 && StringUtil.isFloat(amountMax) \n\t\t\t\t\t\t\t\t\t&& Double.parseDouble(amountMax.trim()) > 0 && amountMax.contains(\".\") == false) {\n\t\t\t\t\t\t\t\tunitPromo.amountMax = new BigDecimal(amountMax.trim().replace(\",\", \"\"));\n\t\t\t\t\t\t\t} else if(amountMax != null && amountMax.length() > 9){\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.over.max.length\") + \"\\n\";\n\t\t\t\t\t\t\t\tmessageError = messageError.replaceAll(\"%max%\", \"9\");\n\t\t\t\t\t\t\t\tmessageError = messageError.replaceAll(\"%colName%\", \"Số tiền\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (StringUtil.isNullOrEmpty(amountMax) == false) {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.amount.max.incorrect.format\") + \"\\n\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\terrRow.setContent4(amountMax);\n\t\t\t\t\t\t}else if(cellAmountMax != null){\n\t\t\t\t\t\t\tString amountMax = getCellValueToString(cellAmountMax);\n\t\t\t\t\t\t\terrRow.setContent4(amountMax);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.number\", Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"Số tiền\"));\n\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t// 5 Số lượng numMax\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellNumMax = myRow.getCell(4);\n\t\t\t\t\t\tif (cellNumMax != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tString numMax = getCellValueToString(cellNumMax);\n\t\t\t\t\t\t\tnumMax = numMax.trim().replace(\",\", \"\");\n\t\t\t\t\t\t\tif (numMax != null && numMax.length() <= 9 \n\t\t\t\t\t\t\t\t\t&& StringUtil.isFloat(numMax) \n\t\t\t\t\t\t\t\t\t&& Double.parseDouble(numMax.trim()) > 0\n\t\t\t\t\t\t\t\t\t&& numMax.contains(\".\") == false) {\n\t\t\t\t\t\t\t\tunitPromo.numMax = new BigDecimal(numMax.trim().replace(\",\", \"\"));\n\t\t\t\t\t\t\t} else if(numMax != null && numMax.length() > 9){\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.over.max.length\") + \"\\n\";\n\t\t\t\t\t\t\t\tmessageError = messageError.replaceAll(\"%max%\", \"9\");\n\t\t\t\t\t\t\t\tmessageError = messageError.replaceAll(\"%colName%\", \"Số lượng\");\n\t\t\t\t\t\t\t}else if (StringUtil.isNullOrEmpty(numMax) == false) {\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.num.max.incorrect.format\") + \"\\n\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\terrRow.setContent5(numMax);\n\t\t\t\t\t\t}else if(cellNumMax != null){\n\t\t\t\t\t\t\tString numMax = getCellValueToString(cellNumMax);\n\t\t\t\t\t\t\terrRow.setContent5(numMax);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.number\",\n\t\t\t\t\t\t\t\tConfiguration.getResourceString(ConstantManager.VI_LANGUAGE, \"Số lượng\"));\n\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\tif (StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\tlistUnit.add(unitPromo);\n\t\t\t\t\t\tmapUnit.put(unitPromo.promotionCode, unitPromo);\n\t\t\t\t\t}else{\n\t\t\t\t\t\terrRow.setContent6(messageError);\n\t\t\t\t\t\tlistUnitError.add(errRow);\n//\t\t\t\t\t\tif(mapErrorUnit.get(unitPromo.promotionCode) == null){\n//\t\t\t\t\t\t\tmapErrorUnit.put(unitPromo.promotionCode, messageError);\n//\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t/*if (StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\tlistHeader.add(header);\n\t\t\t\t\t\tmapHeader.put(header.promotionCode, header);\n\t\t\t\t\t} else {\n\t\t\t\t\t\terrRow.setContent13(messageError);\n\t\t\t\t\t\tlstHeaderError.add(errRow);\n\t\t\t\t\t\tif (mapErrorPromotion.get(header.promotionCode) == null) {\n\t\t\t\t\t\t\tmapErrorPromotion.put(header.promotionCode, messageError);\n\t\t\t\t\t\t}\n\t\t\t\t\t}*/\n\n\t\t\t\t\tiRun++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//Sheet Co cau KM\n\t\t\t/////\n\t\t\tif (detailSheet != null) {\t\n\t\t\t\tIterator<?> rowIter = detailSheet.rowIterator();\n\t\t\t\tString previousPromotionCode = null;\n\t\t\t\tint typeKM;\n\t\t\t\tMap<String, Integer> mapPromotionType = new HashMap<String, Integer>();\n\t\t\t\tiRun = 0;\n\t\t\t\tMap<String, String[]> mapArrayProduct = new HashMap<String, String[]>();\n\t\t\t\tMap<String, BigDecimal[]> mapArraySaleQuantity = new HashMap<String, BigDecimal[]>();\n\t\t\t\tMap<String, BigDecimal[]> mapArraySaleAmount = new HashMap<String, BigDecimal[]>();\n\t\t\t\tMap<String, BigDecimal[]> mapArrayDiscountAmount = new HashMap<String, BigDecimal[]>();\n\t\t\t\tMap<String, Float[]> mapArrayDiscountPercent = new HashMap<String, Float[]>();\n\t\t\t\tMap<String, Integer[]> mapArrayQuantityUnit = new HashMap<String, Integer[]>();\n\t\t\t\tMap<String, String[]> mapArrayFreeProduct = new HashMap<String, String[]>();\n\t\t\t\tMap<String, BigDecimal[]> mapArrayFreeQuantity = new HashMap<String, BigDecimal[]>();\n\t\t\t\tMap<String, Integer[]> mapArrayFreeQuantityUnit = new HashMap<String, Integer[]>();\n\t\t\t\tMap<String, Boolean[]> mapArrayAndOr = new HashMap<String, Boolean[]>();\n\t\t\t\tMap<String, String[]> mapPromoGroupCode = new HashMap<String, String[]>();\n\t\t\t\tMap<String, String[]> mapPromoGroupName = new HashMap<String, String[]>();\n\t\t\t\tMap<String, String[]> mapPromoLevelCode = new HashMap<String, String[]>();\n//\t\t\t\tMap<String, Integer[]> mapMultiple = new HashMap<String, Integer[]>();\n//\t\t\t\tMap<String, Integer[]> mapRecursive = new HashMap<String, Integer[]>();\n//\t\t\t\tMap<String, Integer[]> mapDkgh = new HashMap<String,Integer[]>();\n\t\t\t\t\n\t\t\t\tLinkedHashMap<String, Integer> lstProductPromo = new LinkedHashMap<String, Integer>();\n\t\t\t\tMap<String, List<Row>> lstRow = new HashMap<String, List<Row>>();\n\t\t\t\tint indexProductPromo = 0;\n\t\t\t\tint maxSizeSheet2 = 12;\n\t\t\t\tPromotionProgram existPromotion = null;\n\t\t\t\twhile (rowIter.hasNext()) {\n\t\t\t\t\tRow myRow = (Row) rowIter.next();\n\t\t\t\t\tif (iRun == 0) {\n\t\t\t\t\t\tiRun++;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tboolean isContinue = true;\n\t\t\t\t\t//Kiem tra su hop le cua Row Import\n\t\t\t\t\tfor (int i = 0; i < maxSizeSheet2; i++) {\n\t\t\t\t\t\tif (myRow.getCell(i) != null) {\n\t\t\t\t\t\t\tisContinue = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (isContinue) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tExcelPromotionDetail detail = new ExcelPromotionDetail();\n\t\t\t\t\tCellBean errRow = new CellBean();\n\t\t\t\t\tString messageError = \"\";\n\t\t\t\t\t//0 get promotionCode\n\t\t\t\t\tString promotionCode = null;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellPromotionCode = myRow.getCell(0);\n\t\t\t\t\t\tif (cellPromotionCode != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\t//\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t//\t\t\t\t\t\t\tpromotionCode = cellPromotionCode.getStringCellValue();\n\t\t\t\t\t\t\t//\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t//\t\t\t\t\t\t\tpromotionCode = String.valueOf(cellPromotionCode.getNumericCellValue());\n\t\t\t\t\t\t\t//\t\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t\t\t//\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpromotionCode = getCellValueToString(cellPromotionCode);\n\t\t\t\t\t\t\tpromotionCode = promotionCode != null ? promotionCode.trim().toUpperCase().trim() : \"\";\n\t\t\t\t\t\t\tif (StringUtil.isNullOrEmpty(promotionCode)) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessageError += ValidateUtil.validateField(promotionCode, \"catalog.promotion.import.column.progcode\", 50, ConstantManager.ERR_REQUIRE, ConstantManager.ERR_MAX_LENGTH, ConstantManager.ERR_EXIST_SPECIAL_CHAR_IN_CODE);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\texistPromotion = promotionProgramMgr.getPromotionProgramByCode(promotionCode);\n\t\t\t\t\t\t\tif (existPromotion == null && mapHeader.get(promotionCode) == null) {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.not.init\") + \"\\n\";\n\t\t\t\t\t\t\t\t//messageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.program.not.exists\");\n\t\t\t\t\t\t\t\t//messageError += \"\\n\";\n\t\t\t\t\t\t\t\t//else if(existPromotion != null && mapHeader.get(promotionCode) == null){\n\t\t\t\t\t\t\t} else if(existPromotion != null && ActiveType.RUNNING.equals(existPromotion.getStatus())){\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.program.exists\") + \"\\n\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdetail.promotionCode = promotionCode;\n\t\t\t\t\t\t\terrRow.setContent1(promotionCode);\n\t\t\t\t\t\t\tif (StringUtil.isNullOrEmpty(promotionCode)) {\n\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.required\", Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.code\"));\n\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"Mã CTKM\") + \"\\n\";\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//1 get type\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (myRow.getCell(1) != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\t//\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t//\t\t\t\t\t\t\tdetail.type = myRow.getCell(1).getStringCellValue();\n\t\t\t\t\t\t\t//\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t//\t\t\t\t\t\t\tdetail.type = String.valueOf(myRow.getCell(1).getNumericCellValue());\n\t\t\t\t\t\t\t//\t\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t\t\t//\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdetail.type = getCellValueToString(myRow.getCell(1));\n\t\t\t\t\t\t\tdetail.type = detail.type != null ? detail.type.trim().toUpperCase().trim() : \"\";\n\t\t\t\t\t\t\tif (StringUtil.isNullOrEmpty(detail.type)) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif (mapCheckType.get(detail.type) == null) {\n\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.exists.before\", Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.type\"));\n\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t} else if (mapType.get(promotionCode) == null) {\n\t\t\t\t\t\t\t\t\tif (null != existPromotion && existPromotion.getType().equalsIgnoreCase(detail.type)) {\n\t\t\t\t\t\t\t\t\t\tmapType.put(detail.promotionCode, detail.type);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.type.is.not.same2\") + \"\\n\";\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else if (!mapType.get(promotionCode).equals(detail.type)) {\n\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.type.is.not.same2\") + \"\\n\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\terrRow.setContent2(getCellValueToString(myRow.getCell(1)));\n\t\t\t\t\t\t}else if(myRow.getCell(1) != null){\n\t\t\t\t\t\t\terrRow.setContent2(getCellValueToString(myRow.getCell(1)));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"Loại CTKM\") + \"\\n\";\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//2 Mã nhóm\n\t\t\t\t\t/*try {\n\t\t\t\t\t\tCell cellGroupCode = myRow.getCell(2);\n\t\t\t\t\t\tString groupCode = null;\n\t\t\t\t\t\tif (cellGroupCode != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tgroupCode = getCellValueToString(cellGroupCode);\n\t\t\t\t\t\t\tmessageError = ValidateUtil.validateField(noticeCode, \"catalog.promotion.noticecode\", 100, ConstantManager.ERR_EXIST_SPECIAL_CHAR_IN_SPECIAL);\n\t\t\t\t\t\t\tif (StringUtil.isNullOrEmpty(groupCode)) {\n\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.promotion.group.code.obligate\") + \"\\n\";\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdetail.promoGroupCode = groupCode;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\terrRow.setContent3(groupCode);\n\t\t\t\t\t\t}else if (cellGroupCode != null) {\n\t\t\t\t\t\t\tgroupCode = getCellValueToString(cellGroupCode);\n\t\t\t\t\t\t\terrRow.setContent3(groupCode);\n\t\t\t\t\t\t}else if (cellGroupCode == null) {\n\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.promotion.group.code.obligate\") + \"\\n\";\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"Mã nhóm\") + \"\\n\";\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t// 3 Tên nhóm\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellGroupName = myRow.getCell(3);\n\t\t\t\t\t\tString groupName = null;\n\t\t\t\t\t\tif (cellGroupName != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tgroupName = getCellValueToString(cellGroupName);\n\t\t\t\t\t\t\tif (StringUtil.isNullOrEmpty(groupName)) {\n\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.promotion.group.name.obligate\") + \"\\n\";\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdetail.promoGroupName = groupName;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\terrRow.setContent4(groupName);\n\t\t\t\t\t\t}else if (cellGroupName != null) {\n\t\t\t\t\t\t\tgroupName = getCellValueToString(cellGroupName);\n\t\t\t\t\t\t\terrRow.setContent4(groupName);\n\t\t\t\t\t\t}else if (cellGroupName == null) {\n\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.promotion.group.name.obligate\") + \"\\n\";\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"Tên nhóm\") + \"\\n\";\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t// 4 Mã mức\n\t\t\t\t\ttry {\n\t\t\t\t\t\tCell cellLevelCode = myRow.getCell(4);\n\t\t\t\t\t\tString levelCode = null;\n\t\t\t\t\t\tif (cellLevelCode != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tlevelCode = getCellValueToString(cellLevelCode);\n\t\t\t\t\t\t\tif (StringUtil.isNullOrEmpty(levelCode)) {\n\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.promotion.level.code.obligate\") + \"\\n\";\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdetail.promoLevelCode = levelCode;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\terrRow.setContent5(levelCode);\n\t\t\t\t\t\t} else if (cellLevelCode != null) {\n\t\t\t\t\t\t\tlevelCode = getCellValueToString(cellLevelCode);\n\t\t\t\t\t\t\terrRow.setContent5(levelCode);\n\t\t\t\t\t\t}else if (cellLevelCode == null) {\n\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.promotion.level.code.obligate\") + \"\\n\";\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"Tên nhóm\") + \"\\n\";\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}*/\n\t\t\t\t\t//5 Tên mức\n\t\t\t\t\t/*try {\n\t\t\t\t\t\tCell cellLevelName = myRow.getCell(5);\n\t\t\t\t\t\tString levelName = null;\n\t\t\t\t\t\tif (cellLevelName != null && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tlevelName = getCellValueToString(cellLevelName);\n\t\t\t\t\t\t\tif (StringUtil.isNullOrEmpty(levelName)) {\n\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.promotion.level.name.obligate \") + \"\\n\";\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdetail.promoLevelName = levelName;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\terrRow.setContent6(levelName);\n\t\t\t\t\t\t} else if (cellLevelName == null) {\n\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.promotion.level.name.obligate \") + \"\\n\";\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"Tên nhóm\") + \"\\n\";\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}*/\n\t\t\t\t\t//2 get productCode\n\t\t\t\t\tString productCode = \"\";\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (checkColumnNecessary(detail.type, 2) && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tCell cellProductCode = myRow.getCell(2);\n\t\t\t\t\t\t\tif (cellProductCode != null) {\n\t\t\t\t\t\t\t\t//\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t//\t\t\t\t\t\t\t\tproductCode = cellProductCode.getStringCellValue();\n\t\t\t\t\t\t\t\t//\t\t\t\t\t\t\t} catch (Exception ex) {\n\t\t\t\t\t\t\t\t//\t\t\t\t\t\t\t\tproductCode = String.valueOf(cellProductCode.getNumericCellValue());\n\t\t\t\t\t\t\t\t//\t\t\t\t\t\t\t\tLogUtility.logError(ex, ex.getMessage());\n\t\t\t\t\t\t\t\t//\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tproductCode = getCellValueToString(cellProductCode);\n\t\t\t\t\t\t\t\tif (!StringUtil.isNullOrEmpty(productCode)) {\n\t\t\t\t\t\t\t\t\tProduct product = productMgr.getProductByCode(productCode.trim());\n\t\t\t\t\t\t\t\t\tif (product == null) {\n\t\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.not.exist.in.db\", Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.buyproduct.code\"));\n\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdetail.productCode = productCode.toUpperCase().trim();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.null\", \"Mã Sản Phẩm Mua\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.null\", \"Mã Sản Phẩm Mua\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (myRow.getCell(2) != null) {\n\t\t\t\t\t\t\terrRow.setContent3(getCellValueToString(myRow.getCell(2)));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.get.product.error\", productCode);\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//3 getQuantity\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (checkColumnNecessary(detail.type, 3) && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tCell cellQuantity = myRow.getCell(3);\n\t\t\t\t\t\t\tif (cellQuantity != null && cellQuantity.getCellType() != Cell.CELL_TYPE_BLANK) {\n\t\t\t\t\t\t\t\tif (cellQuantity.getCellType() == Cell.CELL_TYPE_NUMERIC) {\n\t\t\t\t\t\t\t\t\tBigDecimal quantity = new BigDecimal(cellQuantity.getNumericCellValue());\n\t\t\t\t\t\t\t\t\tif (quantity == null || quantity.compareTo(BigDecimal.ZERO) <= 0) {\n\t\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.not.date\", \"SL Sản Phẩm Mua\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdetail.saleQuantity = quantity;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.invalid.format.number\", \"SL Sản Phẩm Mua\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.null\", \"SL Sản Phẩm Mua\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (myRow.getCell(3) != null) {\n\t\t\t\t\t\t\terrRow.setContent4(getCellValueToString(myRow.getCell(3)));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.number\", iRun, \"SL Sản Phẩm Mua\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//4 get UOM\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (checkColumnNecessary(detail.type, 4) && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tCell cellProductUnit = myRow.getCell(4);\n\t\t\t\t\t\t\tif (cellProductUnit != null && cellProductUnit.getCellType() != Cell.CELL_TYPE_BLANK) {\n\t\t\t\t\t\t\t\tif (cellProductUnit.getCellType() == Cell.CELL_TYPE_STRING) {\n\t\t\t\t\t\t\t\t\tString unit = cellProductUnit.getStringCellValue();\n\t\t\t\t\t\t\t\t\tif (unit == null || StringUtil.isNullOrEmpty(unit)) {\n\t\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.not.date\", \"Đơn Vị Tính Cho SP Mua\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (unit.trim().toLowerCase().equals(\"LẺ\".toLowerCase())) {\n\t\t\t\t\t\t\t\t\t\tdetail.productUnit = 1;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tdetail.productUnit = 2;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.invalid.format.number\", \"Đơn Vị Tính Cho SP Mua\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.null\", \"Đơn Vị Tính Cho SP Mua\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (myRow.getCell(4) != null) {\n\t\t\t\t\t\t\terrRow.setContent5(getCellValueToString(myRow.getCell(4)));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"Đơn Vị Tính Cho SP Mua\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//5 getAmount\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (checkColumnNecessary(detail.type, 5) && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tCell cellAmount = myRow.getCell(5);\n\t\t\t\t\t\t\tif (cellAmount != null && cellAmount.getCellType() != Cell.CELL_TYPE_BLANK) {\n\t\t\t\t\t\t\t\tif (cellAmount.getCellType() == Cell.CELL_TYPE_NUMERIC) {\n\t\t\t\t\t\t\t\t\tBigDecimal amount = BigDecimal.valueOf(cellAmount.getNumericCellValue());\n\t\t\t\t\t\t\t\t\tif (amount == null || amount.compareTo(BigDecimal.ZERO) < 0) {\n\t\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.not.date\", \"Số Tiền SP Mua\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdetail.saleAmount = amount;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.invalid.format.number\", \"Số Tiền SP Mua\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.null\", \"Số Tiền SP Mua\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (myRow.getCell(5) != null) {\n\t\t\t\t\t\t\terrRow.setContent6(getCellValueToString(myRow.getCell(5)));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.number\", iRun, \"Số Tiền SP Mua\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//6 getDiscount Amount\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (checkColumnNecessary(detail.type, 6) && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tCell cellDiscountAmount = myRow.getCell(6);\n\t\t\t\t\t\t\tif (cellDiscountAmount != null && cellDiscountAmount.getCellType() != Cell.CELL_TYPE_BLANK) {\n\t\t\t\t\t\t\t\tif (cellDiscountAmount.getCellType() == Cell.CELL_TYPE_NUMERIC) {\n\t\t\t\t\t\t\t\t\tBigDecimal discountAmount = BigDecimal.valueOf(cellDiscountAmount.getNumericCellValue());\n\t\t\t\t\t\t\t\t\tif (discountAmount == null || discountAmount.compareTo(BigDecimal.ZERO) < 0) {\n\t\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.not.date\", \"Số Tiền SP KM\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdetail.discountAmount = discountAmount;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.invalid.format.number\", \"Số Tiền SP KM\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.null\", \"Số Tiền SP KM\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (myRow.getCell(6) != null) {\n\t\t\t\t\t\t\terrRow.setContent7(getCellValueToString(myRow.getCell(6)));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.number\", iRun, \"Số Tiền SP KM\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//7 get discount percent\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (checkColumnNecessary(detail.type, 7) && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tCell cellDiscountPercent = myRow.getCell(7);\n\t\t\t\t\t\t\tif (cellDiscountPercent != null && cellDiscountPercent.getCellType() != Cell.CELL_TYPE_BLANK) {\n\t\t\t\t\t\t\t\tif (cellDiscountPercent.getCellType() == Cell.CELL_TYPE_NUMERIC) {\n\t\t\t\t\t\t\t\t\tFloat discountPercent = (float) cellDiscountPercent.getNumericCellValue();\n\t\t\t\t\t\t\t\t\tif (discountPercent == null || discountPercent < 0 || discountPercent > 100) {\n\t\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.not.date\", \"% KM\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdetail.discountPercent = discountPercent;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.column.invalid.format.float\", \"% KM\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.null\", \"% KM\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (myRow.getCell(7) != null) {\n\t\t\t\t\t\t\terrRow.setContent8(getCellValueToString(myRow.getCell(7)));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.number\", iRun, \"DiscPer\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//8 get Free product code\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (checkColumnNecessary(detail.type, 8) && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tCell cellFreeProductCode = myRow.getCell(8);\n\t\t\t\t\t\t\tif (cellFreeProductCode != null) {\n\t\t\t\t\t\t\t\tString freeProductCode = getCellValueToString(cellFreeProductCode);\n\t\t\t\t\t\t\t\tif (!StringUtil.isNullOrEmpty(freeProductCode)) {\n\t\t\t\t\t\t\t\t\tProduct freeProduct = productMgr.getProductByCode(freeProductCode.trim());\n\t\t\t\t\t\t\t\t\tif (freeProduct == null) {\n\t\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.not.exist.in.db\", Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.disproduct.code\"));\n\t\t\t\t\t\t\t\t\t\tmessageError += \"\\n\";\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdetail.freeProductCode = freeProductCode.toUpperCase().trim();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.null\", \"Mã SP KM\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (myRow.getCell(8) != null) {\n\t\t\t\t\t\t\terrRow.setContent9(getCellValueToString(myRow.getCell(8)));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"Mã SP KM\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//9 get free Quantity\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (checkColumnNecessary(detail.type, 9) && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tCell cellFreeQuantity = myRow.getCell(9);\n\t\t\t\t\t\t\tif (cellFreeQuantity != null && cellFreeQuantity.getCellType() != Cell.CELL_TYPE_BLANK) {\n\t\t\t\t\t\t\t\tif (cellFreeQuantity.getCellType() == Cell.CELL_TYPE_NUMERIC) {\n\t\t\t\t\t\t\t\t\tBigDecimal freeQuantity = new BigDecimal(cellFreeQuantity.getNumericCellValue());\n\t\t\t\t\t\t\t\t\tif (freeQuantity == null || freeQuantity.compareTo(BigDecimal.ZERO) < 0) {\n\t\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.not.date\", \"Số Lượng KM\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdetail.freeQuantity = freeQuantity;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.invalid.format.number\", \"Số Lượng KM\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.null\", \"Số Lượng KM\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (myRow.getCell(9) != null) {\n\t\t\t\t\t\t\terrRow.setContent10(getCellValueToString(myRow.getCell(9)));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.number\", iRun, \"Số Lượng KM\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//10 get Free UOM\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (checkColumnNecessary(detail.type, 10) && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tCell cellProductUnit = myRow.getCell(10);\n\t\t\t\t\t\t\tif (cellProductUnit != null && cellProductUnit.getCellType() != Cell.CELL_TYPE_BLANK) {\n\t\t\t\t\t\t\t\tif (cellProductUnit.getCellType() == Cell.CELL_TYPE_STRING) {\n\t\t\t\t\t\t\t\t\tString unit = cellProductUnit.getStringCellValue();\n\t\t\t\t\t\t\t\t\tif (unit == null || StringUtil.isNullOrEmpty(unit)) {\n\t\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"common.not.date\", \"Đơn Vị Tính cho SP KM\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (unit.trim().toLowerCase().equals(\"LẺ\".toLowerCase())) {\n\t\t\t\t\t\t\t\t\t\tdetail.freeProductUnit = 1;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tdetail.freeProductUnit = 2;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.column.invalid.format.number\", \"Đơn Vị Tính cho SP KM\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (myRow.getCell(10) != null) {\n\t\t\t\t\t\t\terrRow.setContent11(getCellValueToString(myRow.getCell(10)));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.string\", iRun, \"Đơn Vị Tính cho SP KM\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t//11 get And Or\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (checkColumnNecessary(detail.type, 11) && StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\t\tCell cellAndOrCell = myRow.getCell(11);\n\t\t\t\t\t\t\tif (cellAndOrCell != null) {\n\t\t\t\t\t\t\t\tString value;\n\t\t\t\t\t\t\t\tif (cellAndOrCell.getCellType() != Cell.CELL_TYPE_NUMERIC) {\n\t\t\t\t\t\t\t\t\tvalue = cellAndOrCell.getStringCellValue();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tvalue = String.valueOf((float) cellAndOrCell.getNumericCellValue());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (\"X\".equals(value.trim().toUpperCase())) {\n\t\t\t\t\t\t\t\t\tdetail.andOr = true;\n\t\t\t\t\t\t\t\t\terrRow.setContent12(value);\n\t\t\t\t\t\t\t\t} else if (\"\".equals(value.trim().toUpperCase())) {\n\t\t\t\t\t\t\t\t\tdetail.andOr = false;\n\t\t\t\t\t\t\t\t\terrRow.setContent12(value);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\terrRow.setContent13(value);\n\t\t\t\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.read.cell.format.invalid\", iRun, \"AllFreeItemcode\", \"['','X']\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdetail.andOr = false;\n\t\t\t\t\t\t\t\terrRow.setContent12(\"\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.read.cell.format.invalid\", iRun, \"AllFreeItemcode\", \"['','X']\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// 12 ĐKGH\n\t\t\t\t\t/*try{\n\t\t\t\t\t\tApParam apParam = apParamMgr.getApParamByCode(\"LIST_ALLOW_DKGH\", ApParamType.LIST_ALLOW_DKGH);\n\t\t\t\t\t\tString strListPromo = apParam.getApParamName();\n\t\t\t\t\t\tCell cellDKGH = myRow.getCell(17);\n\t\t\t\t\t\tString[] ListAllow = strListPromo.split(\",\");\n\t\t\t\t\t\tif(Arrays.asList(ListAllow).contains(detail.type)){\n\t\t\t\t\t\t\tif(cellDKGH != null && StringUtil.isNullOrEmpty(messageError)){\n\t\t\t\t\t\t\t\tString dkgh = getCellValueToString(cellDKGH);\n\t\t\t\t\t\t\t\tif(dkgh != null \n\t\t\t\t\t\t\t\t\t\t&& (Constant.HAVE_CONDITION.equals(dkgh) || (Constant.NON_CONDITION.equals(dkgh)))){\n\t\t\t\t\t\t\t\t\tdetail.dkgh = Integer.parseInt(dkgh.trim());\n\t\t\t\t\t\t\t\t}else if(dkgh != null){\n\t\t\t\t\t\t\t\t\tmessageError += R.getResource(\"catalog.promotion.import.dkgh.incorrect.format\")+\"\\n\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\terrRow.setContent18(dkgh);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}else if(cellDKGH != null){\n\t\t\t\t\t\t\tString dkgh = getCellValueToString(cellDKGH);\n\t\t\t\t\t\t\terrRow.setContent18(dkgh);\n\t\t\t\t\t\t}\n\t\t\t\t\t}catch (Exception e) {\n\t\t\t\t\t\tmessageError += Configuration.getResourceString(ConstantManager.VI_LANGUAGE, \"catalog.promotion.import.cant.read.cell.number\", iRun, \"DKGH\", \"['','X']\");\n\t\t\t\t\t\tLogUtility.logError(e, e.getMessage());\n\t\t\t\t\t}*/\n\t\t\t\t\tif (mapPromotionTypeCheck.get(detail.promotionCode) == null) {\n\t\t\t\t\t\tmapPromotionTypeCheck.put(detail.promotionCode, detail.type);\n\t\t\t\t\t}\n\t\t\t\t\tif (!promotionCode.equals(previousPromotionCode)) {\n\t\t\t\t\t\tif (mapPromotionType.get(detail.promotionCode) != null) {//da ton tai ctkm nay truoc do roi\n\t\t\t\t\t\t\t//typeKM = mapPromotionType.get(detail.promotionCode);//=> lay ra loai cua no thoi\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (!StringUtil.isNullOrEmpty(detail.productCode) && detail.saleQuantity != null && detail.saleQuantity.compareTo(BigDecimal.ZERO) > 0 && !StringUtil.isNullOrEmpty(detail.freeProductCode) && detail.freeQuantity != null\n\t\t\t\t\t\t\t\t\t&& detail.freeQuantity.compareTo(BigDecimal.ZERO) > 0) {\n\t\t\t\t\t\t\t\ttypeKM = 1;//ZV03\n\t\t\t\t\t\t\t} else if (!StringUtil.isNullOrEmpty(detail.productCode) && detail.saleQuantity != null && detail.saleQuantity.compareTo(BigDecimal.ZERO) > 0 && detail.discountAmount != null && detail.discountAmount.compareTo(\n\t\t\t\t\t\t\t\t\tBigDecimal.ZERO) > 0) {\n\t\t\t\t\t\t\t\ttypeKM = 2;//ZV02\n\t\t\t\t\t\t\t} else if (!StringUtil.isNullOrEmpty(detail.productCode) && detail.saleQuantity != null && detail.saleQuantity.compareTo(BigDecimal.ZERO) > 0 && detail.discountPercent != null && detail.discountPercent > 0) {\n\t\t\t\t\t\t\t\ttypeKM = 3;//ZV01\n\t\t\t\t\t\t\t} else if (!StringUtil.isNullOrEmpty(detail.productCode) && detail.saleAmount != null && detail.saleAmount.compareTo(BigDecimal.ZERO) > 0 && !StringUtil.isNullOrEmpty(detail.freeProductCode) && detail.freeQuantity != null\n\t\t\t\t\t\t\t\t\t&& detail.freeQuantity.compareTo(BigDecimal.ZERO) > 0) {\n\t\t\t\t\t\t\t\ttypeKM = 4;\n\t\t\t\t\t\t\t} else if (!StringUtil.isNullOrEmpty(detail.productCode) && detail.saleAmount != null && detail.saleAmount.compareTo(BigDecimal.ZERO) > 0 && detail.discountAmount != null && detail.discountAmount.compareTo(\n\t\t\t\t\t\t\t\t\tBigDecimal.ZERO) > 0) {\n\t\t\t\t\t\t\t\ttypeKM = 5;\n\t\t\t\t\t\t\t} else if (!StringUtil.isNullOrEmpty(detail.productCode) && detail.saleAmount != null && detail.saleAmount.compareTo(BigDecimal.ZERO) > 0 && detail.discountPercent != null && detail.discountPercent > 0) {\n\t\t\t\t\t\t\t\ttypeKM = 6;\n\t\t\t\t\t\t\t} else if (detail.saleAmount != null && detail.saleAmount.compareTo(BigDecimal.ZERO) > 0 && !StringUtil.isNullOrEmpty(detail.freeProductCode) && detail.freeQuantity != null && detail.freeQuantity.compareTo(\n\t\t\t\t\t\t\t\t\tBigDecimal.ZERO) > 0) {\n\t\t\t\t\t\t\t\ttypeKM = 7;\n\t\t\t\t\t\t\t} else if (detail.saleAmount != null && detail.saleAmount.compareTo(BigDecimal.ZERO) > 0 && detail.discountAmount != null && detail.discountAmount.compareTo(BigDecimal.ZERO) > 0) {\n\t\t\t\t\t\t\t\ttypeKM = 8;\n\t\t\t\t\t\t\t} else if (detail.saleAmount != null && detail.saleAmount.compareTo(BigDecimal.ZERO) > 0 && detail.discountPercent != null && detail.discountPercent > 0) {\n\t\t\t\t\t\t\t\ttypeKM = 9;\n\t\t\t\t\t\t\t} else if (detail.saleQuantity != null && detail.saleQuantity.compareTo(BigDecimal.ZERO) > 0 && !StringUtil.isNullOrEmpty(detail.freeProductCode) && detail.freeQuantity != null && detail.freeQuantity.compareTo(\n\t\t\t\t\t\t\t\t\tBigDecimal.ZERO) > 0) {\n\t\t\t\t\t\t\t\ttypeKM = 10;//ZV24\n\t\t\t\t\t\t\t} else if (detail.saleQuantity != null && detail.saleQuantity.compareTo(BigDecimal.ZERO) > 0 && detail.discountAmount != null && detail.discountAmount.compareTo(BigDecimal.ZERO) > 0) {\n\t\t\t\t\t\t\t\ttypeKM = 11;//ZV23\n\t\t\t\t\t\t\t} else if (detail.saleQuantity != null && detail.saleQuantity.compareTo(BigDecimal.ZERO) > 0 && detail.discountPercent != null && detail.discountPercent > 0) {\n\t\t\t\t\t\t\t\ttypeKM = 12;//ZV22\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ttypeKM = -1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmapPromotionType.put(detail.promotionCode, typeKM);\n\t\t\t\t\t\t\tpreviousPromotionCode = detail.promotionCode;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//typeKM = mapPromotionType.get(detail.promotionCode);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\tList<Row> lstR = lstRow.get(detail.promotionCode);\n\t\t\t\t\t\tif (lstR == null) {\n\t\t\t\t\t\t\tlstR = new ArrayList<Row>();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmessageError = checkDuplicate(mapType.get(detail.promotionCode), lstR, myRow);\n\t\t\t\t\t\tif(StringUtil.isNullOrEmpty(messageError)){\n\t\t\t\t\t\t\tlistDetail.add(detail);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlstR.add(myRow);\n\t\t\t\t\t\tlstRow.put(detail.promotionCode, lstR);\n\t\t\t\t\t}\n\t\t\t\t\tif (StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\t\tif (mapArrayProduct.get(detail.promotionCode) == null) {\n\t\t\t\t\t\t\tString[] arrProduct = new String[MAX_ARRAY];\n\t\t\t\t\t\t\tarrProduct[iRun] = detail.productCode;\n\t\t\t\t\t\t\tmapArrayProduct.put(detail.promotionCode, arrProduct);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tString[] arrProduct = mapArrayProduct.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrProduct[iRun] = detail.productCode;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (mapArraySaleQuantity.get(detail.promotionCode) == null) {\n\t\t\t\t\t\t\tBigDecimal[] arrSaleQuantity = new BigDecimal[MAX_ARRAY];\n\t\t\t\t\t\t\tarrSaleQuantity[iRun] = detail.saleQuantity;\n\t\t\t\t\t\t\tmapArraySaleQuantity.put(detail.promotionCode, arrSaleQuantity);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tBigDecimal[] arrSaleQuantity = mapArraySaleQuantity.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrSaleQuantity[iRun] = detail.saleQuantity;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (mapArrayQuantityUnit.get(detail.promotionCode) == null) {\n\t\t\t\t\t\t\tInteger[] arrUnit = new Integer[MAX_ARRAY];\n\t\t\t\t\t\t\tarrUnit[iRun] = detail.productUnit;\n\t\t\t\t\t\t\tmapArrayQuantityUnit.put(detail.promotionCode, arrUnit);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tInteger[] arrUnit = mapArrayQuantityUnit.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrUnit[iRun] = detail.productUnit;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (mapArraySaleAmount.get(detail.promotionCode) == null) {\n\t\t\t\t\t\t\tBigDecimal[] arrSaleAmount = new BigDecimal[MAX_ARRAY];\n\t\t\t\t\t\t\tarrSaleAmount[iRun] = detail.saleAmount;\n\t\t\t\t\t\t\tmapArraySaleAmount.put(detail.promotionCode, arrSaleAmount);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tBigDecimal[] arrSaleAmount = mapArraySaleAmount.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrSaleAmount[iRun] = detail.saleAmount;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (mapArrayFreeProduct.get(detail.promotionCode) == null) {\n\t\t\t\t\t\t\tString[] arrFreeProduct = new String[MAX_ARRAY];\n\t\t\t\t\t\t\tarrFreeProduct[iRun] = detail.freeProductCode;\n\t\t\t\t\t\t\tmapArrayFreeProduct.put(detail.promotionCode, arrFreeProduct);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tString[] arrFreeProduct = mapArrayFreeProduct.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrFreeProduct[iRun] = detail.freeProductCode;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (mapArrayFreeQuantityUnit.get(detail.promotionCode) == null) {\n\t\t\t\t\t\t\tInteger[] arrUnit = new Integer[MAX_ARRAY];\n\t\t\t\t\t\t\tarrUnit[iRun] = detail.freeProductUnit;\n\t\t\t\t\t\t\tmapArrayFreeQuantityUnit.put(detail.promotionCode, arrUnit);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tInteger[] arrUnit = mapArrayFreeQuantityUnit.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrUnit[iRun] = detail.freeProductUnit;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (mapArrayFreeQuantity.get(detail.promotionCode) == null) {\n\t\t\t\t\t\t\tBigDecimal[] arrFreeQuantity = new BigDecimal[MAX_ARRAY];\n\t\t\t\t\t\t\tarrFreeQuantity[iRun] = detail.freeQuantity;\n\t\t\t\t\t\t\tmapArrayFreeQuantity.put(detail.promotionCode, arrFreeQuantity);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tBigDecimal[] arrFreeProduct = mapArrayFreeQuantity.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrFreeProduct[iRun] = detail.freeQuantity;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (mapArrayDiscountAmount.get(detail.promotionCode) == null) {\n\t\t\t\t\t\t\tBigDecimal[] arrDiscountAmount = new BigDecimal[MAX_ARRAY];\n\t\t\t\t\t\t\tarrDiscountAmount[iRun] = detail.discountAmount;\n\t\t\t\t\t\t\tmapArrayDiscountAmount.put(detail.promotionCode, arrDiscountAmount);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tBigDecimal[] arrDiscountAmount = mapArrayDiscountAmount.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrDiscountAmount[iRun] = detail.discountAmount;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (mapArrayDiscountPercent.get(detail.promotionCode) == null) {\n\t\t\t\t\t\t\tFloat[] arrDiscountPercent = new Float[MAX_ARRAY];\n\t\t\t\t\t\t\tarrDiscountPercent[iRun] = detail.discountPercent;\n\t\t\t\t\t\t\tmapArrayDiscountPercent.put(detail.promotionCode, arrDiscountPercent);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tFloat[] arrDiscountPercent = mapArrayDiscountPercent.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrDiscountPercent[iRun] = detail.discountPercent;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (mapArrayAndOr.get(detail.promotionCode) == null) {\n\t\t\t\t\t\t\tBoolean[] arrAndOr = new Boolean[MAX_ARRAY];\n\t\t\t\t\t\t\tarrAndOr[iRun] = detail.andOr;\n\t\t\t\t\t\t\tmapArrayAndOr.put(detail.promotionCode, arrAndOr);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tBoolean[] arrAndOr = mapArrayAndOr.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrAndOr[iRun] = detail.andOr;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// map Ma nhom\n\t\t\t\t\t\tif(mapPromoGroupCode.get(detail.promotionCode) == null){\n\t\t\t\t\t\t\tString[] arrPromoGroupCode = new String[MAX_ARRAY];\n\t\t\t\t\t\t\tarrPromoGroupCode[iRun] = detail.promoGroupCode;\n\t\t\t\t\t\t\tmapPromoGroupCode.put(detail.promotionCode, arrPromoGroupCode);\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tString[] arrPromoGroupCode = mapPromoGroupCode.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrPromoGroupCode[iRun] = detail.promoGroupCode;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// map Ten nhom\n\t\t\t\t\t\tif(mapPromoGroupName.get(detail.promotionCode) == null){\n\t\t\t\t\t\t\tString[] arrPromoGroupName = new String[MAX_ARRAY];\n\t\t\t\t\t\t\tarrPromoGroupName[iRun] = detail.promoGroupName;\n\t\t\t\t\t\t\tmapPromoGroupName.put(detail.promotionCode, arrPromoGroupName);\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tString[] arrPromoGroupName = mapPromoGroupName.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrPromoGroupName[iRun] = detail.promoGroupName;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// map Ma muc\n\t\t\t\t\t\tif(mapPromoLevelCode.get(detail.promotionCode) == null){\n\t\t\t\t\t\t\tString[] arrayPromoLevelCode = new String[MAX_ARRAY];\n\t\t\t\t\t\t\tarrayPromoLevelCode[iRun] = detail.promoLevelCode;\n\t\t\t\t\t\t\tmapPromoLevelCode.put(detail.promotionCode, arrayPromoLevelCode);\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tString[] arrayPromoLevelCode = mapPromoLevelCode.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrayPromoLevelCode[iRun] = detail.promoLevelCode;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// map Bội số\n\t\t\t\t\t\t/*if(mapMultiple.get(detail.promotionCode) == null){\n\t\t\t\t\t\t\tInteger[] arrMultiple = new Integer[MAX_ARRAY];\n\t\t\t\t\t\t\tarrMultiple[iRun] = detail.multiple;\n\t\t\t\t\t\t\tmapMultiple.put(detail.promotionCode, arrMultiple);\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tInteger[] arrMultiple = mapMultiple.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrMultiple[iRun] = detail.multiple;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// map Tối ưu\n\t\t\t\t\t\tif(mapRecursive.get(detail.promotionCode) == null){\n\t\t\t\t\t\t\tInteger[] arrRecursive = new Integer[MAX_ARRAY];\n\t\t\t\t\t\t\tarrRecursive[iRun] = detail.recursive;\n\t\t\t\t\t\t\tmapRecursive.put(detail.promotionCode, arrRecursive);\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tInteger[] arrRecursive = mapRecursive.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrRecursive[iRun] = detail.recursive;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// map ĐKGH\n\t\t\t\t\t\tif(mapDkgh.get(detail.promotionCode) == null){\n\t\t\t\t\t\t\tInteger[] arrDkgh = new Integer[MAX_ARRAY];\n\t\t\t\t\t\t\tarrDkgh[iRun] = detail.dkgh;\n\t\t\t\t\t\t\tmapDkgh.put(detail.promotionCode, arrDkgh);\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tInteger[] arrDkgh = mapDkgh.get(detail.promotionCode);\n\t\t\t\t\t\t\tarrDkgh[iRun] = detail.dkgh;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t*/\n\t\t\t\t\t\tif (!StringUtil.isNullOrEmpty(detail.productCode) && lstProductPromo.get(detail.promotionCode + \"-\" + detail.productCode) == null) {\n\t\t\t\t\t\t\tlstProductPromo.put(detail.promotionCode + \"-\" + detail.productCode, indexProductPromo++);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//error\n\t\t\t\t\t\terrRow.setContent13(messageError);\n\t\t\t\t\t\tlstDetailError.add(errRow);\n\t\t\t\t\t\tif (mapErrorPromotion.get(detail.promotionCode) == null) {\n\t\t\t\t\t\t\tmapErrorPromotion.put(detail.promotionCode, messageError);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// totalItem++;\n\t\t\t\t\tiRun++;\n\t\t\t\t}\n\t\t\t\t/**\n\t\t\t\t * put vao group level\n\t\t\t\t */\n\t\t\t\tString messageError = \"\";\n\t\t\t\tCellBean errRow = new CellBean();\n\t\t\t\t\n\t\t\t\tfor (String promotionProgramCode : mapPromotionType.keySet()) {\n\t\t\t\t\tInteger unit = -1;\n\t\t\t\t\tString[] arrPromoGroupCode = mapPromoGroupCode.get(promotionProgramCode);\n\t\t\t\t\tString[] arrPromoGroupName = mapPromoGroupName.get(promotionProgramCode);\n\t\t\t\t/*\tString[] arrPromoLevelCode = mapPromoLevelCode.get(promotionProgramCode);\n\t\t\t\t\tInteger[] arrMultiple = mapMultiple.get(promotionProgramCode);\n\t\t\t\t\tInteger[] arrRecursive = mapRecursive.get(promotionProgramCode);\t\t*/\t\t\t\n//\t\t\t\t\tInteger[] arrDkgh = mapDkgh.get(promotionProgramCode);\n\t\t\t\t\t\n\t\t\t\t\tif (mapPromotionType.get(promotionProgramCode) == 1) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * mua A(1), B(1) dc km ... C(1), D(1)\n\t\t\t\t\t\t */\n\t\t\t\t\t\tString[] arrProduct = mapArrayProduct.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrProductUnit = mapArrayQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrSaleQuantity = mapArraySaleQuantity.get(promotionProgramCode);\n\t\t\t\t\t\tBoolean[] arrAndOr = mapArrayAndOr.get(promotionProgramCode);\n\t\t\t\t\t\tString[] arrFreeProduct = mapArrayFreeProduct.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrFreeProductUnit = mapArrayFreeQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrFreeQuantity = mapArrayFreeQuantity.get(promotionProgramCode);\n\t\t\t\t\t\t//Sort theo saleQuantity\n\t\t\t\t\t\tsortQuantityProduct(arrProduct, arrProductUnit, arrSaleQuantity, arrAndOr, arrFreeProduct, arrFreeProductUnit, arrFreeQuantity, null, null);\n\t\t\t\t\t\tfor (int i = 0; arrProduct != null && i < arrProduct.length; i++) {\n\t\t\t\t\t\t\tif (!StringUtil.isNullOrEmpty(arrProduct[i]) && arrSaleQuantity[i] != null && !StringUtil.isNullOrEmpty(arrFreeProduct[i]) && arrFreeQuantity[i] != null) {\n\t\t\t\t\t\t\t\tGroupMua groupMua;\n\t\t\t\t\t\t\t\tGroupKM groupKM;\n\t\t\t\t\t\t\t\tunit = arrProductUnit[i];\n\t\t\t\t\t\t\t\tif (mapPromotionMua.get(promotionProgramCode) != null && mapPromotionKM.get(promotionProgramCode) != null) {\n\t\t\t\t\t\t\t\t\tgroupMua = mapPromotionMua.get(promotionProgramCode).get(mapPromotionMua.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t\tgroupKM = mapPromotionKM.get(promotionProgramCode).get(mapPromotionKM.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tListGroupMua lstGroupMua = new ListGroupMua();\n\t\t\t\t\t\t\t\t\tListGroupKM lstGroupKM = new ListGroupKM();\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tgroupMua.groupCode = \"N\" + (lstGroupMua.size() + 1);\n\t\t\t\t\t\t\t\t\tgroupMua.qttUnit = unit;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t//groupMua.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupMua.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tgroupKM.groupCode = \"N\" + (lstGroupKM.size() + 1);\n\t\t\t\t\t\t\t\t\tgroupKM.qttUnit = arrFreeProductUnit[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t//groupKM.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupKM.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.order = lstGroupMua.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupKM.order = lstGroupKM.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tmapPromotionMua.put(promotionProgramCode, lstGroupMua);\n\t\t\t\t\t\t\t\t\tmapPromotionKM.put(promotionProgramCode, lstGroupKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGroupSP groupSPMua = groupMua.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrProduct[i], unit, arrSaleQuantity[i], indexMua++, i, arrProduct, arrSaleQuantity, arrFreeProduct, arrFreeQuantity);\n\t\t\t\t\t\t\t\tif (groupSPMua == null) {\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tList<GroupMua> lstGroupMua = mapPromotionMua.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupSPMua = groupMua.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrProduct[i], unit, arrSaleQuantity[i], indexMua++, i, arrProduct, arrSaleQuantity, arrFreeProduct, arrFreeQuantity);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tList<Long> lstIndex = mapMuaKM.get(groupSPMua.index);//lay danh sach cac index muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tList<GroupSP> lstLevelKM = groupKM.searchIndex(lstIndex);//lay danh sach cac muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tGroupSP groupSPKM = groupKM.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrFreeProduct[i], unit, arrFreeQuantity[i], arrAndOr[i], indexKM++, i, arrFreeProduct, arrFreeQuantity, lstLevelKM);\n\t\t\t\t\t\t\t\tif (groupSPKM == null) {\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tList<GroupKM> lstGroupKM = mapPromotionKM.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tgroupSPKM = groupKM.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrFreeProduct[i], unit, arrFreeQuantity[i], arrAndOr[i], indexKM++, i, arrFreeProduct, arrFreeQuantity, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmapMuaKM.put(groupSPMua.index, groupSPKM.index);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (mapPromotionType.get(promotionProgramCode) == 2) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * mua A(1), B(1) dc km ... 10.000\n\t\t\t\t\t\t */\n\t\t\t\t\t\tString[] arrProduct = mapArrayProduct.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrProductUnit = mapArrayQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrSaleQuantity = mapArraySaleQuantity.get(promotionProgramCode);\n\t\t\t\t\t\tBoolean[] arrAndOr = mapArrayAndOr.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrFreeAmount = mapArrayDiscountAmount.get(promotionProgramCode);\n\t\t\t\t\t\t//Sort theo saleQuantity\n\t\t\t\t\t\tsortQuantityProduct(arrProduct, arrProductUnit, arrSaleQuantity, arrAndOr, null, null, null, arrFreeAmount, null);\n\t\t\t\t\t\tfor (int i = 0; arrProduct != null && i < arrProduct.length; i++) {\n\t\t\t\t\t\t\tif (!StringUtil.isNullOrEmpty(arrProduct[i]) && arrSaleQuantity[i] != null && arrFreeAmount[i] != null) {\n\t\t\t\t\t\t\t\tGroupMua groupMua;\n\t\t\t\t\t\t\t\tGroupKM groupKM;\n\t\t\t\t\t\t\t\tunit = arrProductUnit[i];\n\t\t\t\t\t\t\t\tif (mapPromotionMua.get(promotionProgramCode) != null && mapPromotionKM.get(promotionProgramCode) != null) {\n\t\t\t\t\t\t\t\t\tgroupMua = mapPromotionMua.get(promotionProgramCode).get(mapPromotionMua.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t\tgroupKM = mapPromotionKM.get(promotionProgramCode).get(mapPromotionKM.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tListGroupMua lstGroupMua = new ListGroupMua();\n\t\t\t\t\t\t\t\t\tListGroupKM lstGroupKM = new ListGroupKM();\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tgroupMua.groupCode = \"N\" + (lstGroupMua.size() + 1);\n\t\t\t\t\t\t\t\t\tgroupMua.qttUnit = unit;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t//groupMua.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupMua.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tgroupKM.groupCode = \"N\" + (lstGroupKM.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupKM.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupKM.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.order = lstGroupMua.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupKM.order = lstGroupKM.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tmapPromotionMua.put(promotionProgramCode, lstGroupMua);\n\t\t\t\t\t\t\t\t\tmapPromotionKM.put(promotionProgramCode, lstGroupKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGroupSP groupSPMua = groupMua.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrProduct[i], unit, arrSaleQuantity[i], indexMua++, i, arrProduct, arrSaleQuantity, null, null);\n\t\t\t\t\t\t\t\tif (groupSPMua == null) {\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tList<GroupMua> lstGroupMua = mapPromotionMua.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupSPMua = groupMua.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrProduct[i], unit, arrSaleQuantity[i], indexMua++, i, arrProduct, arrSaleQuantity, null, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tList<Long> lstIndex = mapMuaKM.get(groupSPMua.index);//lay danh sach cac index muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tList<GroupSP> lstLevelKM = groupKM.searchIndex(lstIndex);//lay danh sach cac muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tGroupSP groupSPKM = groupKM.add2Level(arrFreeAmount[i], indexKM++, i, arrFreeAmount, lstLevelKM);\n\t\t\t\t\t\t\t\tif (groupSPKM == null) {\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tList<GroupKM> lstGroupKM = mapPromotionKM.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tgroupSPKM = groupKM.add2Level(arrFreeAmount[i], indexKM++, i, arrFreeAmount, lstLevelKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmapMuaKM.put(groupSPMua.index, groupSPKM.index);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (mapPromotionType.get(promotionProgramCode) == 3) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * mua A(1), B(1) dc km ... 10%\n\t\t\t\t\t\t */\n\t\t\t\t\t\tString[] arrProduct = mapArrayProduct.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrProductUnit = mapArrayQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrSaleQuantity = mapArraySaleQuantity.get(promotionProgramCode);\n\t\t\t\t\t\tBoolean[] arrAndOr = mapArrayAndOr.get(promotionProgramCode);\n\t\t\t\t\t\tFloat[] arrPercent = mapArrayDiscountPercent.get(promotionProgramCode);\n\t\t\t\t\t\t//Sort theo saleQuantity\n\t\t\t\t\t\tsortQuantityProduct(arrProduct, arrProductUnit, arrSaleQuantity, arrAndOr, null, null, null, null, arrPercent);\n\t\t\t\t\t\tfor (int i = 0; arrProduct != null && i < arrProduct.length; i++) {\n\t\t\t\t\t\t\tif (!StringUtil.isNullOrEmpty(arrProduct[i]) && arrSaleQuantity[i] != null && arrPercent[i] != null) {\n\t\t\t\t\t\t\t\tGroupMua groupMua;\n\t\t\t\t\t\t\t\tGroupKM groupKM;\n\t\t\t\t\t\t\t\tunit = arrProductUnit[i];\n\t\t\t\t\t\t\t\tif (mapPromotionMua.get(promotionProgramCode) != null && mapPromotionKM.get(promotionProgramCode) != null) {\n\t\t\t\t\t\t\t\t\tgroupMua = mapPromotionMua.get(promotionProgramCode).get(mapPromotionMua.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t\tgroupKM = mapPromotionKM.get(promotionProgramCode).get(mapPromotionKM.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tListGroupMua lstGroupMua = new ListGroupMua();\n\t\t\t\t\t\t\t\t\tListGroupKM lstGroupKM = new ListGroupKM();\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tgroupMua.groupCode = \"N\" + (lstGroupMua.size() + 1);\n\t\t\t\t\t\t\t\t\tgroupMua.qttUnit = unit;\n\t\t\t\t\t\t\t\t\t//groupMua.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupMua.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tgroupKM.groupCode = \"N\" + (lstGroupKM.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupKM.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupKM.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.dkgh = arrDkgh[i];\n//\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.order = lstGroupMua.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupKM.order = lstGroupKM.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tmapPromotionMua.put(promotionProgramCode, lstGroupMua);\n\t\t\t\t\t\t\t\t\tmapPromotionKM.put(promotionProgramCode, lstGroupKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGroupSP groupSPMua = groupMua.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrProduct[i], unit, arrSaleQuantity[i], indexMua++, i, arrProduct, arrSaleQuantity, null, null);\n\t\t\t\t\t\t\t\tif (groupSPMua == null) {\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tList<GroupMua> lstGroupMua = mapPromotionMua.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupSPMua = groupMua.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrProduct[i], unit, arrSaleQuantity[i], indexMua++, i, arrProduct, arrSaleQuantity, null, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tList<Long> lstIndex = mapMuaKM.get(groupSPMua.index);//lay danh sach cac index muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tList<GroupSP> lstLevelKM = groupKM.searchIndex(lstIndex);//lay danh sach cac muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tGroupSP groupSPKM = groupKM.add2Level(arrPercent[i], indexKM++, i, arrPercent, lstLevelKM);\n\t\t\t\t\t\t\t\tif (groupSPKM == null) {\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tList<GroupKM> lstGroupKM = mapPromotionKM.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tgroupSPKM = groupKM.add2Level(arrPercent[i], indexKM++, i, arrPercent, lstLevelKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmapMuaKM.put(groupSPMua.index, groupSPKM.index);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (mapPromotionType.get(promotionProgramCode) == 4) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * mua A(10.000), B(10.000) dc km ... C(1), D(1)\n\t\t\t\t\t\t */\n\t\t\t\t\t\tString[] arrProduct = mapArrayProduct.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrProductUnit = mapArrayQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrSaleAmount = mapArraySaleAmount.get(promotionProgramCode);\n\t\t\t\t\t\tBoolean[] arrAndOr = mapArrayAndOr.get(promotionProgramCode);\n\t\t\t\t\t\tString[] arrFreeProduct = mapArrayFreeProduct.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrFreeProductUnit = mapArrayFreeQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrFreeQuantity = mapArrayFreeQuantity.get(promotionProgramCode);\n\t\t\t\t\t\t//Sort theo saleQuantity\n\t\t\t\t\t\tsortAmountProduct(arrProduct, arrProductUnit, arrSaleAmount, arrAndOr, arrFreeProduct, arrFreeProductUnit, arrFreeQuantity, null, null);\n\t\t\t\t\t\tfor (int i = 0; arrProduct != null && i < arrProduct.length; i++) {\n\t\t\t\t\t\t\tif (!StringUtil.isNullOrEmpty(arrProduct[i]) && arrSaleAmount[i] != null && !StringUtil.isNullOrEmpty(arrFreeProduct[i]) && arrFreeQuantity[i] != null) {\n\t\t\t\t\t\t\t\tGroupMua groupMua;\n\t\t\t\t\t\t\t\tGroupKM groupKM;\n\t\t\t\t\t\t\t\tunit = arrProductUnit[i];\n\t\t\t\t\t\t\t\tif (mapPromotionMua.get(promotionProgramCode) != null && mapPromotionKM.get(promotionProgramCode) != null) {\n\t\t\t\t\t\t\t\t\tgroupMua = mapPromotionMua.get(promotionProgramCode).get(mapPromotionMua.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t\tgroupKM = mapPromotionKM.get(promotionProgramCode).get(mapPromotionKM.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tListGroupMua lstGroupMua = new ListGroupMua();\n\t\t\t\t\t\t\t\t\tListGroupKM lstGroupKM = new ListGroupKM();\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tgroupMua.groupCode = \"N\" + (lstGroupMua.size() + 1);\n\t\t\t\t\t\t\t\t\tgroupMua.qttUnit = unit;\n\t\t\t\t\t\t\t\t\t//groupMua.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupMua.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tgroupKM.groupCode = \"N\" + (lstGroupKM.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupKM.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupKM.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.qttUnit = arrFreeProductUnit[i];\n\t\t\t\t\t\t\t\t\tgroupMua.order = lstGroupMua.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupKM.order = lstGroupKM.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tmapPromotionMua.put(promotionProgramCode, lstGroupMua);\n\t\t\t\t\t\t\t\t\tmapPromotionKM.put(promotionProgramCode, lstGroupKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGroupSP groupSPMua = groupMua.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrProduct[i], arrSaleAmount[i], indexMua++, i, arrProduct, arrSaleAmount, arrFreeProduct, arrFreeQuantity);\n\t\t\t\t\t\t\t\tif (groupSPMua == null) {\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tList<GroupMua> lstGroupMua = mapPromotionMua.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupSPMua = groupMua.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrProduct[i], arrSaleAmount[i], indexMua++, i, arrProduct, arrSaleAmount, arrFreeProduct, arrFreeQuantity);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tList<Long> lstIndex = mapMuaKM.get(groupSPMua.index);//lay danh sach cac index muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tList<GroupSP> lstLevelKM = groupKM.searchIndex(lstIndex);//lay danh sach cac muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tGroupSP groupSPKM = groupKM.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrFreeProduct[i], unit, arrFreeQuantity[i], arrAndOr[i], indexKM++, i, arrFreeProduct, arrFreeQuantity, lstLevelKM);\n\t\t\t\t\t\t\t\tif (groupSPKM == null) {\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tList<GroupKM> lstGroupKM = mapPromotionKM.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tgroupSPKM = groupKM.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrFreeProduct[i], unit, arrFreeQuantity[i], arrAndOr[i], indexKM++, i, arrFreeProduct, arrFreeQuantity, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmapMuaKM.put(groupSPMua.index, groupSPKM.index);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (mapPromotionType.get(promotionProgramCode) == 5) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * mua A(10.000), B(10.000) dc km ... 10.000\n\t\t\t\t\t\t */\n\t\t\t\t\t\tString[] arrProduct = mapArrayProduct.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrProductUnit = mapArrayQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrSaleAmount = mapArraySaleAmount.get(promotionProgramCode);\n\t\t\t\t\t\tBoolean[] arrAndOr = mapArrayAndOr.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrFreeAmount = mapArrayDiscountAmount.get(promotionProgramCode);\n\t\t\t\t\t\t//Sort theo saleQuantity\n\t\t\t\t\t\tsortAmountProduct(arrProduct, arrProductUnit, arrSaleAmount, arrAndOr, null, null, null, arrFreeAmount, null);\n\t\t\t\t\t\tfor (int i = 0; arrProduct != null && i < arrProduct.length; i++) {\n\t\t\t\t\t\t\tif (!StringUtil.isNullOrEmpty(arrProduct[i]) && arrSaleAmount[i] != null && arrFreeAmount[i] != null) {\n\t\t\t\t\t\t\t\tGroupMua groupMua;\n\t\t\t\t\t\t\t\tGroupKM groupKM;\n\t\t\t\t\t\t\t\tunit = arrProductUnit[i];\n\t\t\t\t\t\t\t\tif (mapPromotionMua.get(promotionProgramCode) != null && mapPromotionKM.get(promotionProgramCode) != null) {\n\t\t\t\t\t\t\t\t\tgroupMua = mapPromotionMua.get(promotionProgramCode).get(mapPromotionMua.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t\tgroupKM = mapPromotionKM.get(promotionProgramCode).get(mapPromotionKM.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tListGroupMua lstGroupMua = new ListGroupMua();\n\t\t\t\t\t\t\t\t\tListGroupKM lstGroupKM = new ListGroupKM();\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tgroupMua.groupCode = \"N\" + (lstGroupMua.size() + 1);\n\t\t\t\t\t\t\t\t\tgroupMua.qttUnit = unit;\n\t\t\t\t\t\t\t\t\t//groupMua.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupMua.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tgroupKM.groupCode = \"N\" + (lstGroupKM.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupKM.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupKM.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.order = lstGroupMua.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupKM.order = lstGroupKM.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tmapPromotionMua.put(promotionProgramCode, lstGroupMua);\n\t\t\t\t\t\t\t\t\tmapPromotionKM.put(promotionProgramCode, lstGroupKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGroupSP groupSPMua = groupMua.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrProduct[i], arrSaleAmount[i], indexMua++, i, arrProduct, arrSaleAmount, null, null);\n\t\t\t\t\t\t\t\tif (groupSPMua == null) {\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tList<GroupMua> lstGroupMua = mapPromotionMua.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupSPMua = groupMua.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrProduct[i], arrSaleAmount[i], indexMua++, i, arrProduct, arrSaleAmount, null, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tList<Long> lstIndex = mapMuaKM.get(groupSPMua.index);//lay danh sach cac index muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tList<GroupSP> lstLevelKM = groupKM.searchIndex(lstIndex);//lay danh sach cac muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tGroupSP groupSPKM = groupKM.add2Level(arrFreeAmount[i], indexKM++, i, arrFreeAmount, lstLevelKM);\n\t\t\t\t\t\t\t\tif (groupSPKM == null) {\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tList<GroupKM> lstGroupKM = mapPromotionKM.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tgroupSPKM = groupKM.add2Level(arrFreeAmount[i], indexKM++, i, arrFreeAmount, lstLevelKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmapMuaKM.put(groupSPMua.index, groupSPKM.index);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (mapPromotionType.get(promotionProgramCode) == 6) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * mua A(10.000), B(10.000) dc km ... 10%\n\t\t\t\t\t\t */\n\t\t\t\t\t\tString[] arrProduct = mapArrayProduct.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrProductUnit = mapArrayQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrSaleAmount = mapArraySaleAmount.get(promotionProgramCode);\n\t\t\t\t\t\tBoolean[] arrAndOr = mapArrayAndOr.get(promotionProgramCode);\n\t\t\t\t\t\tFloat[] arrPercent = mapArrayDiscountPercent.get(promotionProgramCode);\n\t\t\t\t\t\t//Sort theo saleQuantity\n\t\t\t\t\t\tsortAmountProduct(arrProduct, arrProductUnit, arrSaleAmount, arrAndOr, null, null, null, null, arrPercent);\n\t\t\t\t\t\tfor (int i = 0; arrProduct != null && i < arrProduct.length; i++) {\n\t\t\t\t\t\t\tif (!StringUtil.isNullOrEmpty(arrProduct[i]) && arrSaleAmount[i] != null && arrPercent[i] != null) {\n\t\t\t\t\t\t\t\tGroupMua groupMua;\n\t\t\t\t\t\t\t\tGroupKM groupKM;\n\t\t\t\t\t\t\t\tunit = arrProductUnit[i];\n\t\t\t\t\t\t\t\tif (mapPromotionMua.get(promotionProgramCode) != null && mapPromotionKM.get(promotionProgramCode) != null) {\n\t\t\t\t\t\t\t\t\tgroupMua = mapPromotionMua.get(promotionProgramCode).get(mapPromotionMua.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t\tgroupKM = mapPromotionKM.get(promotionProgramCode).get(mapPromotionKM.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tListGroupMua lstGroupMua = new ListGroupMua();\n\t\t\t\t\t\t\t\t\tListGroupKM lstGroupKM = new ListGroupKM();\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tgroupMua.groupCode = \"N\" + (lstGroupMua.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupMua.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupMua.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.qttUnit = unit;\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tgroupKM.groupCode = \"N\" + (lstGroupKM.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupKM.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupKM.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.order = lstGroupMua.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupKM.order = lstGroupKM.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tmapPromotionMua.put(promotionProgramCode, lstGroupMua);\n\t\t\t\t\t\t\t\t\tmapPromotionKM.put(promotionProgramCode, lstGroupKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGroupSP groupSPMua = groupMua.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrProduct[i], arrSaleAmount[i], indexMua++, i, arrProduct, arrSaleAmount, null, null);\n\t\t\t\t\t\t\t\tif (groupSPMua == null) {\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tList<GroupMua> lstGroupMua = mapPromotionMua.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupSPMua = groupMua.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrProduct[i], arrSaleAmount[i], indexMua++, i, arrProduct, arrSaleAmount, null, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tList<Long> lstIndex = mapMuaKM.get(groupSPMua.index);//lay danh sach cac index muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tList<GroupSP> lstLevelKM = groupKM.searchIndex(lstIndex);//lay danh sach cac muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tGroupSP groupSPKM = groupKM.add2Level(arrPercent[i], indexKM++, i, arrPercent, lstLevelKM);\n\t\t\t\t\t\t\t\tif (groupSPKM == null) {\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tList<GroupKM> lstGroupKM = mapPromotionKM.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tgroupSPKM = groupKM.add2Level(arrPercent[i], indexKM++, i, arrPercent, lstLevelKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmapMuaKM.put(groupSPMua.index, groupSPKM.index);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (mapPromotionType.get(promotionProgramCode) == 7) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * mua 10000 dc km ... C(1), D(1)\n\t\t\t\t\t\t */\n\t\t\t\t\t\tBigDecimal[] arrSaleAmount = mapArraySaleAmount.get(promotionProgramCode);\n\t\t\t\t\t\tString[] arrFreeProduct = mapArrayFreeProduct.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrFreeProductUnit = mapArrayFreeQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrFreeQuantity = mapArrayFreeQuantity.get(promotionProgramCode);\n\t\t\t\t\t\tBoolean[] arrAndOr = mapArrayAndOr.get(promotionProgramCode);\n\t\t\t\t\t\tsortAmount(arrSaleAmount, arrAndOr, arrFreeProduct, arrFreeProductUnit, arrFreeQuantity, null, null);\n\t\t\t\t\t\tfor (int i = 0; arrSaleAmount != null && i < arrSaleAmount.length; i++) {\n\t\t\t\t\t\t\tif (arrSaleAmount[i] != null && !StringUtil.isNullOrEmpty(arrFreeProduct[i]) && arrFreeQuantity[i] != null) {\n\t\t\t\t\t\t\t\tGroupMua groupMua;\n\t\t\t\t\t\t\t\tGroupKM groupKM;\n\t\t\t\t\t\t\t\tif (mapPromotionMua.get(promotionProgramCode) != null && mapPromotionKM.get(promotionProgramCode) != null) {\n\t\t\t\t\t\t\t\t\tgroupMua = mapPromotionMua.get(promotionProgramCode).get(mapPromotionMua.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t\tgroupKM = mapPromotionKM.get(promotionProgramCode).get(mapPromotionKM.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tListGroupMua lstGroupMua = new ListGroupMua();\n\t\t\t\t\t\t\t\t\tListGroupKM lstGroupKM = new ListGroupKM();\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tgroupMua.groupCode = \"N\" + (lstGroupMua.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupMua.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupMua.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tgroupKM.groupCode = \"N\" + (lstGroupKM.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupKM.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupKM.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupKM.qttUnit = arrFreeProductUnit[i];\n\t\t\t\t\t\t\t\t\tgroupMua.order = lstGroupMua.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupKM.order = lstGroupKM.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tmapPromotionMua.put(promotionProgramCode, lstGroupMua);\n\t\t\t\t\t\t\t\t\tmapPromotionKM.put(promotionProgramCode, lstGroupKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGroupSP groupSPMua = groupMua.add2Level(2, arrSaleAmount[i], null, indexMua++, i, arrSaleAmount, arrFreeProduct, arrFreeQuantity);\n\t\t\t\t\t\t\t\tif (groupSPMua == null) {\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tList<GroupMua> lstGroupMua = mapPromotionMua.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupSPMua = groupMua.add2Level(2, arrSaleAmount[i], null, indexMua++, i, arrSaleAmount, arrFreeProduct, arrFreeQuantity);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tList<Long> lstIndex = mapMuaKM.get(groupSPMua.index);//lay danh sach cac index muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tList<GroupSP> lstLevelKM = groupKM.searchIndex(lstIndex);//lay danh sach cac muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tGroupSP groupSPKM = groupKM.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrFreeProduct[i], unit, arrFreeQuantity[i], arrAndOr[i], indexKM++, i, arrFreeProduct, arrFreeQuantity, lstLevelKM);\n\t\t\t\t\t\t\t\tif (groupSPKM == null) {\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tList<GroupKM> lstGroupKM = mapPromotionKM.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tgroupSPKM = groupKM.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrFreeProduct[i], unit, arrFreeQuantity[i], arrAndOr[i], indexKM++, i, arrFreeProduct, arrFreeQuantity, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmapMuaKM.put(groupSPMua.index, groupSPKM.index);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (mapPromotionType.get(promotionProgramCode) == 8) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * mua 10000 dc km ... 10.000\n\t\t\t\t\t\t */\n\t\t\t\t\t\tBigDecimal[] arrSaleAmount = mapArraySaleAmount.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrFreeAmount = mapArrayDiscountAmount.get(promotionProgramCode);\n\t\t\t\t\t\tsortAmount(arrSaleAmount, null, null, null, null, arrFreeAmount, null);\n\t\t\t\t\t\tfor (int i = 0; arrSaleAmount != null && i < arrSaleAmount.length; i++) {\n\t\t\t\t\t\t\tif (arrSaleAmount[i] != null && arrFreeAmount[i] != null) {\n\t\t\t\t\t\t\t\tGroupMua groupMua;\n\t\t\t\t\t\t\t\tGroupKM groupKM;\n\t\t\t\t\t\t\t\tif (mapPromotionMua.get(promotionProgramCode) != null && mapPromotionKM.get(promotionProgramCode) != null) {\n\t\t\t\t\t\t\t\t\tgroupMua = mapPromotionMua.get(promotionProgramCode).get(mapPromotionMua.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t\tgroupKM = mapPromotionKM.get(promotionProgramCode).get(mapPromotionKM.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tListGroupMua lstGroupMua = new ListGroupMua();\n\t\t\t\t\t\t\t\t\tListGroupKM lstGroupKM = new ListGroupKM();\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tgroupMua.groupCode = \"N\" + (lstGroupMua.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupMua.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupMua.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupMua.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tgroupKM.groupCode = \"N\" + (lstGroupKM.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupKM.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupKM.groupName = arrPromoGroupName[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.multiple = arrMultiple[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.recursive = arrRecursive[i];\n//\t\t\t\t\t\t\t\t\tgroupKM.dkgh = arrDkgh[i];\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.order = lstGroupMua.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupKM.order = lstGroupKM.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tmapPromotionMua.put(promotionProgramCode, lstGroupMua);\n\t\t\t\t\t\t\t\t\tmapPromotionKM.put(promotionProgramCode, lstGroupKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGroupSP groupSPMua = groupMua.add2Level(2, arrSaleAmount[i], null, indexMua++, i, arrSaleAmount, null, null);\n\t\t\t\t\t\t\t\tif (groupSPMua == null) {\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tList<GroupMua> lstGroupMua = mapPromotionMua.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupSPMua = groupMua.add2Level(2, arrSaleAmount[i], null, indexMua++, i, arrSaleAmount, null, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tList<Long> lstIndex = mapMuaKM.get(groupSPMua.index);//lay danh sach cac index muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tList<GroupSP> lstLevelKM = groupKM.searchIndex(lstIndex);//lay danh sach cac muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tGroupSP groupSPKM = groupKM.add2Level(arrFreeAmount[i], indexKM++, i, arrFreeAmount, lstLevelKM);\n\t\t\t\t\t\t\t\tif (groupSPKM == null) {\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tList<GroupKM> lstGroupKM = mapPromotionKM.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tgroupSPKM = groupKM.add2Level(arrFreeAmount[i], indexKM++, i, arrFreeAmount, lstLevelKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmapMuaKM.put(groupSPMua.index, groupSPKM.index);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (mapPromotionType.get(promotionProgramCode) == 9) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * mua 10000 dc km ... 10%\n\t\t\t\t\t\t */\n\t\t\t\t\t\tBigDecimal[] arrSaleAmount = mapArraySaleAmount.get(promotionProgramCode);\n\t\t\t\t\t\tFloat[] arrPercent = mapArrayDiscountPercent.get(promotionProgramCode);\n\t\t\t\t\t\tsortAmount(arrSaleAmount, null, null, null, null, null, arrPercent);\n\t\t\t\t\t\tfor (int i = 0; arrSaleAmount != null && i < arrSaleAmount.length; i++) {\n\t\t\t\t\t\t\tif (arrSaleAmount[i] != null && arrPercent[i] != null) {\n\t\t\t\t\t\t\t\tGroupMua groupMua;\n\t\t\t\t\t\t\t\tGroupKM groupKM;\n\t\t\t\t\t\t\t\tif (mapPromotionMua.get(promotionProgramCode) != null && mapPromotionKM.get(promotionProgramCode) != null) {\n\t\t\t\t\t\t\t\t\tgroupMua = mapPromotionMua.get(promotionProgramCode).get(mapPromotionMua.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t\tgroupKM = mapPromotionKM.get(promotionProgramCode).get(mapPromotionKM.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tListGroupMua lstGroupMua = new ListGroupMua();\n\t\t\t\t\t\t\t\t\tListGroupKM lstGroupKM = new ListGroupKM();\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tgroupMua.groupCode = \"N\" + (lstGroupMua.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupMua.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupMua.groupName = arrPromoGroupName[i];\n\t\t\t\t\t\t\t\t\t/*groupMua.multiple = arrMultiple[i];\n\t\t\t\t\t\t\t\t\tgroupMua.recursive = arrRecursive[i];\n\t\t\t\t\t\t\t\t\tgroupMua.dkgh = arrDkgh[i];*/\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tgroupKM.groupCode = \"N\" + (lstGroupKM.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupKM.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupKM.groupName = arrPromoGroupName[i];\n\t\t\t\t\t\t\t\t/*\tgroupKM.multiple = arrMultiple[i];\n\t\t\t\t\t\t\t\t\tgroupKM.recursive = arrRecursive[i];\n\t\t\t\t\t\t\t\t\tgroupKM.dkgh = arrDkgh[i];*/\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.order = lstGroupMua.size() + 1;\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupKM.order = lstGroupKM.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tmapPromotionMua.put(promotionProgramCode, lstGroupMua);\n\t\t\t\t\t\t\t\t\tmapPromotionKM.put(promotionProgramCode, lstGroupKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGroupSP groupSPMua = groupMua.add2Level(2, arrSaleAmount[i], null, indexMua++, i, arrSaleAmount, null, null);\n\t\t\t\t\t\t\t\tif (groupSPMua == null) {\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tList<GroupMua> lstGroupMua = mapPromotionMua.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupSPMua = groupMua.add2Level(2, arrSaleAmount[i], null, indexMua++, i, arrSaleAmount, null, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tList<Long> lstIndex = mapMuaKM.get(groupSPMua.index);//lay danh sach cac index muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tList<GroupSP> lstLevelKM = groupKM.searchIndex(lstIndex);//lay danh sach cac muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tGroupSP groupSPKM = groupKM.add2Level(arrPercent[i], indexKM++, i, arrPercent, lstLevelKM);\n\t\t\t\t\t\t\t\tif (groupSPKM == null) {\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tList<GroupKM> lstGroupKM = mapPromotionKM.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tgroupSPKM = groupKM.add2Level(arrPercent[i], indexKM++, i, arrPercent, lstLevelKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmapMuaKM.put(groupSPMua.index, groupSPKM.index);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (mapPromotionType.get(promotionProgramCode) == 10) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * ZV24\n\t\t\t\t\t\t */\n\t\t\t\t\t\tBigDecimal[] arrSaleQuantity = mapArraySaleQuantity.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrProductUnit = mapArrayQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tString[] arrFreeProduct = mapArrayFreeProduct.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrFreeQuantity = mapArrayFreeQuantity.get(promotionProgramCode);\n\t\t\t\t\t\tBoolean[] arrAndOr = mapArrayAndOr.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrFreeProductUnit = mapArrayFreeQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tsortQuantity(arrSaleQuantity, arrAndOr, arrFreeProduct, arrFreeProductUnit, arrFreeQuantity, null, null);\n\n\t\t\t\t\t\tfor (int i = 0; arrSaleQuantity != null && i < arrSaleQuantity.length; i++) {\n\t\t\t\t\t\t\tif (arrSaleQuantity[i] != null && !StringUtil.isNullOrEmpty(arrFreeProduct[i]) && arrFreeQuantity[i] != null) {\n\t\t\t\t\t\t\t\tGroupMua groupMua;\n\t\t\t\t\t\t\t\tGroupKM groupKM;\n\t\t\t\t\t\t\t\tunit = arrProductUnit[i];\n\t\t\t\t\t\t\t\tif (mapPromotionMua.get(promotionProgramCode) != null && mapPromotionKM.get(promotionProgramCode) != null) {\n\t\t\t\t\t\t\t\t\tgroupMua = mapPromotionMua.get(promotionProgramCode).get(mapPromotionMua.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t\tgroupKM = mapPromotionKM.get(promotionProgramCode).get(mapPromotionKM.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tListGroupMua lstGroupMua = new ListGroupMua();\n\t\t\t\t\t\t\t\t\tListGroupKM lstGroupKM = new ListGroupKM();\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tgroupMua.groupCode = \"N\" + (lstGroupMua.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupMua.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupMua.groupName = arrPromoGroupName[i];\n\t\t\t\t\t\t\t\t\t/*groupMua.multiple = arrMultiple[i];\n\t\t\t\t\t\t\t\t\tgroupMua.recursive = arrRecursive[i];\n\t\t\t\t\t\t\t\t\tgroupMua.dkgh = arrDkgh[i];*/\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.qttUnit = unit;\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tgroupKM.groupCode = \"N\" + (lstGroupKM.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupKM.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupKM.groupName = arrPromoGroupName[i];\n\t\t\t\t\t\t/*\t\t\tgroupKM.multiple = arrMultiple[i];\n\t\t\t\t\t\t\t\t\tgroupKM.recursive = arrRecursive[i];\n\t\t\t\t\t\t\t\t\tgroupKM.dkgh = arrDkgh[i];*/\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupKM.qttUnit = arrFreeProductUnit[i];\n\t\t\t\t\t\t\t\t\tgroupMua.order = lstGroupMua.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupKM.order = lstGroupKM.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tmapPromotionMua.put(promotionProgramCode, lstGroupMua);\n\t\t\t\t\t\t\t\t\tmapPromotionKM.put(promotionProgramCode, lstGroupKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGroupSP groupSPMua = groupMua.add2Level(1, arrSaleQuantity[i], arrProductUnit[i], indexMua++, i, arrSaleQuantity, arrFreeProduct, arrFreeQuantity);\n\t\t\t\t\t\t\t\tif (groupSPMua == null) {\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tList<GroupMua> lstGroupMua = mapPromotionMua.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupSPMua = groupMua.add2Level(1, arrSaleQuantity[i], null, indexMua++, i, arrSaleQuantity, arrFreeProduct, arrFreeQuantity);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tList<Long> lstIndex = mapMuaKM.get(groupSPMua.index);//lay danh sach cac index muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tList<GroupSP> lstLevelKM = groupKM.searchIndex(lstIndex);//lay danh sach cac muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tGroupSP groupSPKM = groupKM.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrFreeProduct[i], unit, arrFreeQuantity[i], arrAndOr[i], indexKM++, i, arrFreeProduct, arrFreeQuantity, lstLevelKM);\n\t\t\t\t\t\t\t\tif (groupSPKM == null) {\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tList<GroupKM> lstGroupKM = mapPromotionKM.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tgroupSPKM = groupKM.add2Level(mapPromotionTypeCheck.get(promotionProgramCode), arrFreeProduct[i], unit, arrFreeQuantity[i], arrAndOr[i], indexKM++, i, arrFreeProduct, arrFreeQuantity, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmapMuaKM.put(groupSPMua.index, groupSPKM.index);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (mapPromotionType.get(promotionProgramCode) == 11) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * ZV23\n\t\t\t\t\t\t */\n\t\t\t\t\t\tBigDecimal[] arrSaleQuantity = mapArraySaleQuantity.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrProductUnit = mapArrayQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tBigDecimal[] arrFreeAmount = mapArrayDiscountAmount.get(promotionProgramCode);\n\t\t\t\t\t\tsortQuantity(arrSaleQuantity, null, null, null, null, arrFreeAmount, null);\n\t\t\t\t\t\tfor (int i = 0; arrSaleQuantity != null && i < arrSaleQuantity.length; i++) {\n\t\t\t\t\t\t\tif (arrSaleQuantity[i] != null && arrFreeAmount[i] != null) {\n\t\t\t\t\t\t\t\tGroupMua groupMua;\n\t\t\t\t\t\t\t\tGroupKM groupKM;\n\t\t\t\t\t\t\t\tunit = arrProductUnit[i];\n\t\t\t\t\t\t\t\tif (mapPromotionMua.get(promotionProgramCode) != null && mapPromotionKM.get(promotionProgramCode) != null) {\n\t\t\t\t\t\t\t\t\tgroupMua = mapPromotionMua.get(promotionProgramCode).get(mapPromotionMua.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t\tgroupKM = mapPromotionKM.get(promotionProgramCode).get(mapPromotionKM.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tListGroupMua lstGroupMua = new ListGroupMua();\n\t\t\t\t\t\t\t\t\tListGroupKM lstGroupKM = new ListGroupKM();\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tgroupMua.groupCode = \"N\" + (lstGroupMua.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupMua.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupMua.groupName = arrPromoGroupName[i];\n\t\t\t\t\t\t\t\t/*\tgroupMua.multiple = arrMultiple[i];\n\t\t\t\t\t\t\t\t\tgroupMua.recursive = arrRecursive[i];\n\t\t\t\t\t\t\t\t\tgroupMua.dkgh = arrDkgh[i];*/\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.qttUnit = unit;\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tgroupKM.groupCode = \"N\" + (lstGroupKM.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupKM.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupKM.groupName = arrPromoGroupName[i];\n\t\t\t\t\t\t\t/*\t\tgroupKM.multiple = arrMultiple[i];\n\t\t\t\t\t\t\t\t\tgroupKM.recursive = arrRecursive[i];\n\t\t\t\t\t\t\t\t\tgroupKM.dkgh = arrDkgh[i];*/\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.order = lstGroupMua.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupKM.order = lstGroupKM.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tmapPromotionMua.put(promotionProgramCode, lstGroupMua);\n\t\t\t\t\t\t\t\t\tmapPromotionKM.put(promotionProgramCode, lstGroupKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGroupSP groupSPMua = groupMua.add2Level(1, arrSaleQuantity[i], arrProductUnit[i], indexMua++, i, arrSaleQuantity, null, null);\n\t\t\t\t\t\t\t\tif (groupSPMua == null) {\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tList<GroupMua> lstGroupMua = mapPromotionMua.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupSPMua = groupMua.add2Level(1, arrSaleQuantity[i], arrProductUnit[i], indexMua++, i, arrSaleQuantity, null, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tList<Long> lstIndex = mapMuaKM.get(groupSPMua.index);//lay danh sach cac index muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tList<GroupSP> lstLevelKM = groupKM.searchIndex(lstIndex);//lay danh sach cac muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tGroupSP groupSPKM = groupKM.add2Level(arrFreeAmount[i], indexKM++, i, arrFreeAmount, lstLevelKM);\n\t\t\t\t\t\t\t\tif (groupSPKM == null) {\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tList<GroupKM> lstGroupKM = mapPromotionKM.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tgroupSPKM = groupKM.add2Level(arrFreeAmount[i], indexKM++, i, arrFreeAmount, lstLevelKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmapMuaKM.put(groupSPMua.index, groupSPKM.index);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (mapPromotionType.get(promotionProgramCode) == 12) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * \n\t\t\t\t\t\t */\n\t\t\t\t\t\tBigDecimal[] arrSaleQuantity = mapArraySaleQuantity.get(promotionProgramCode);\n\t\t\t\t\t\tInteger[] arrProductUnit = mapArrayQuantityUnit.get(promotionProgramCode);\n\t\t\t\t\t\tFloat[] arrPercent = mapArrayDiscountPercent.get(promotionProgramCode);\n\t\t\t\t\t\t//Sort theo saleQuantity\n\t\t\t\t\t\tsortQuantity(arrSaleQuantity, null, null, null, null, null, arrPercent);\n\t\t\t\t\t\tfor (int i = 0; arrSaleQuantity != null && i < arrSaleQuantity.length; i++) {\n\t\t\t\t\t\t\tif (arrSaleQuantity[i] != null && arrPercent[i] != null) {\n\t\t\t\t\t\t\t\tGroupMua groupMua;\n\t\t\t\t\t\t\t\tGroupKM groupKM;\n\t\t\t\t\t\t\t\tunit = arrProductUnit[i];\n\t\t\t\t\t\t\t\tif (mapPromotionMua.get(promotionProgramCode) != null && mapPromotionKM.get(promotionProgramCode) != null) {\n\t\t\t\t\t\t\t\t\tgroupMua = mapPromotionMua.get(promotionProgramCode).get(mapPromotionMua.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t\tgroupKM = mapPromotionKM.get(promotionProgramCode).get(mapPromotionKM.get(promotionProgramCode).size() - 1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tListGroupMua lstGroupMua = new ListGroupMua();\n\t\t\t\t\t\t\t\t\tListGroupKM lstGroupKM = new ListGroupKM();\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tgroupMua.groupCode = \"N\" + (lstGroupMua.size() + 1);\n\t\t\t\t\t\t\t\t\t//groupMua.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupMua.groupName = arrPromoGroupName[i];\n\t\t\t\t\t\t\t\t\t/*groupMua.multiple = arrMultiple[i];\n\t\t\t\t\t\t\t\t\tgroupMua.recursive = arrRecursive[i];\n\t\t\t\t\t\t\t\t\tgroupMua.dkgh = arrDkgh[i];*/\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.qttUnit = unit;\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\t//groupKM.groupCode = \"N\" + (lstGroupKM.size() + 1);\n\t\t\t\t\t\t\t\t\tgroupKM.groupCode = arrPromoGroupCode[i];\n\t\t\t\t\t\t\t\t\tgroupKM.groupName = arrPromoGroupName[i];\n\t\t\t\t\t\t\t\t\t/*groupKM.multiple = arrMultiple[i];\n\t\t\t\t\t\t\t\t\tgroupKM.recursive = arrRecursive[i];\n\t\t\t\t\t\t\t\t\tgroupKM.dkgh = arrDkgh[i];*/\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tgroupMua.order = lstGroupMua.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupKM.order = lstGroupKM.size() + 1;\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tmapPromotionMua.put(promotionProgramCode, lstGroupMua);\n\t\t\t\t\t\t\t\t\tmapPromotionKM.put(promotionProgramCode, lstGroupKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tGroupSP groupSPMua = groupMua.add2Level(1, arrSaleQuantity[i], arrProductUnit[i], indexMua++, i, arrSaleQuantity, null, null);\n\t\t\t\t\t\t\t\tif (groupSPMua == null) {\n\t\t\t\t\t\t\t\t\tgroupMua = new GroupMua();\n\t\t\t\t\t\t\t\t\tList<GroupMua> lstGroupMua = mapPromotionMua.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupMua.add(groupMua);\n\t\t\t\t\t\t\t\t\tgroupSPMua = groupMua.add2Level(1, arrSaleQuantity[i], arrProductUnit[i], indexMua++, i, arrSaleQuantity, null, null);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tList<Long> lstIndex = mapMuaKM.get(groupSPMua.index);//lay danh sach cac index muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tList<GroupSP> lstLevelKM = groupKM.searchIndex(lstIndex);//lay danh sach cac muc duoc map voi muc sp mua\n\t\t\t\t\t\t\t\tGroupSP groupSPKM = groupKM.add2Level(arrPercent[i], indexKM++, i, arrPercent, lstLevelKM);\n\t\t\t\t\t\t\t\tif (groupSPKM == null) {\n\t\t\t\t\t\t\t\t\tgroupKM = new GroupKM();\n\t\t\t\t\t\t\t\t\tList<GroupKM> lstGroupKM = mapPromotionKM.get(promotionProgramCode);\n\t\t\t\t\t\t\t\t\tlstGroupKM.add(groupKM);\n\t\t\t\t\t\t\t\t\tgroupSPKM = groupKM.add2Level(arrPercent[i], indexKM++, i, arrPercent, lstLevelKM);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmapMuaKM.put(groupSPMua.index, groupSPKM.index);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!StringUtil.isNullOrEmpty(messageError)) {\n\t\t\t\t\terrRow.setContent14(messageError);\n\t\t\t\t\tlstDetailError.add(errRow);\n\t\t\t\t}\n\t\t\t\tfor (String promotionProgramCode : mapPromotionType.keySet()) {\n\t\t\t\t\tsplitGroup(mapPromotionMua.get(promotionProgramCode), mapPromotionKM.get(promotionProgramCode), mapMuaKM, promotionProgramCode, lstProductPromo);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public static void main(String[] args) throws IOException {\n\t\tFile file=new File(\"E:\\\\AutomationSelenium\\\\ApachePOI\\\\testdata.xlsx\");\n\t\tFileInputStream fis=new FileInputStream(file);\n\t\t\n\t\tXSSFWorkbook wb=new XSSFWorkbook(fis);\n\t\tXSSFSheet sheet=wb.getSheetAt(0);\n\t\tString data0=sheet.getRow(1).getCell(0).getStringCellValue();\n\t\tString data1=sheet.getRow(1).getCell(1).getStringCellValue();\n\t\tSystem.out.println(data0+\"\"+data1);\n\t\twb.close();\n\t}", "private int create(int row) throws FileNotFoundException {\n\t\tXSSFRow row0 = in.createRow(row);\r\n\t\tXSSFCell cell0row0 = row0.createCell(0);\r\n\t\t\r\n\t\tcell0row0.setCellValue(\"col_lookupName\");\r\n\r\n\t\tXSSFCell cell1row0 = row0.createCell(1);\r\n\t\t\r\n\t\tcell1row0.setCellValue(\"col_lookupType\");\r\n\r\nXSSFCell cell2row0 = row0.createCell(2);\r\n\t\t\r\n\t\tcell2row0.setCellValue(\"col_lookupTable\");\r\n\t\t\r\n\t\t\r\nXSSFCell cell3row0 = row0.createCell(3);\r\n\t\t\r\n\t\tcell3row0.setCellValue(\"col_lookupColumn\");\r\n\t\t\r\n\t\t\r\nXSSFCell cell4row0 = row0.createCell(4);\r\n\t\t\r\n\t\tcell4row0.setCellValue(\"\");\t\r\n\t\t\r\nXSSFCell cell5row0 = row0.createCell(5);\r\n\t\t\r\n\t\tcell5row0.setCellValue(\"\");\t\r\n\t\t\r\nXSSFCell cell6row0 = row0.createCell(6);\r\n\t\t\r\ncell6row0.setCellValue(\"Col_Constraints\");\r\n\r\n\r\nXSSFCell cell7row0 = row0.createCell(7);\r\n\r\ncell7row0.setCellValue(\"\");\r\n\r\n\r\n\r\nXSSFCell cell8row0 = row0.createCell(8);\r\n\r\ncell8row0.setCellValue(\"\");\r\n\r\n\t\t\r\n\t\r\nXSSFCell cell9row0 = row0.createCell(9);\r\n\r\ncell9row0.setCellValue(\"\");\r\n\r\n\r\nXSSFCell cell10row0 = row0.createCell(10);\r\n\r\ncell10row0.setCellValue(\"Col_Pagination\");\r\n\r\n\r\n\r\n\r\n\r\n\r\n\t\t// Placing column headings below the row.\r\n\t\tXSSFRow row1 = in.createRow(1);\r\n\t\tXSSFCell cell3row1 = row1.createCell(3);\r\n\t\t\r\n\t\tcell3row1.setCellValue(\"Col_desplayName\");\r\n\r\n\t\tXSSFCell cell4row1 = row1.createCell(4);\r\n\t\t\r\n\t\tcell4row1.setCellValue(\"Col_columnName\");\r\n\r\n\t\tXSSFCell cell5row1 = row1.createCell(5);\r\n\t\r\n\t\tcell5row1.setCellValue(\"Col_searchable\");\r\n\r\n\t\tXSSFCell cell6row1 = row1.createCell(6);\r\n\t\r\n\t\tcell6row1.setCellValue(\"Col_constraintColumn\");\r\n\r\n\t\tXSSFCell cell7row1 = row1.createCell(7);\r\n\t\t\r\n\t\tcell7row1.setCellValue(\"Col_constraintOperator\");\r\n\r\n\t\tXSSFCell cell8row1 = row1.createCell(8);\r\n\t\t\r\n\t\tcell8row1.setCellValue(\"Col_constraintValue\");\r\n\r\n\t\tXSSFCell cell9row1 = row1.createCell(9);\r\n\t\t\r\n\t\tcell9row1.setCellValue(\"Col_parameterName\");\r\n\r\n\t\tXSSFCell cell10row1 = row1.createCell(10);\r\n\t\t\r\n\t\tcell10row1.setCellValue(\"Col_allowed\");\r\n\t\t\r\n\t\t\r\nXSSFCell cell11row1 = row1.createCell(11);\r\n\t\t\r\n\t\tcell11row1.setCellValue(\"Col_recordsPerPage\");\r\n\t\t\r\n\t\t\r\n\t\tin.addMergedRegion(new CellRangeAddress(0,0,3,5));\r\n\t\tin.addMergedRegion(new CellRangeAddress(0,0,6,9));\r\n\t\tin.addMergedRegion(new CellRangeAddress(0,0,10,11));\r\n\t\t\r\n\t\t\r\n\t\tin.autoSizeColumn(0);\r\n\t\tin.autoSizeColumn(1);\r\n\t\tin.autoSizeColumn(2);\r\n\t\tin.autoSizeColumn(3);\r\n\t\tin.autoSizeColumn(4);\r\n\t\tin.autoSizeColumn(5);\r\n\t\tin.autoSizeColumn(6);\r\n\t\tin.autoSizeColumn(7);\r\n\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t FileOutputStream outputStream = new FileOutputStream(\"D://jsonFormatRAHULKADYANbyRAHULKADYAN.xlsx\");\r\n try {\r\n\t\t\tworkbook.write(outputStream);\r\n\t\t} catch (IOException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n /* try {\r\n\t//\t\tworkbook.close();\r\n\t\t} catch (IOException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}*/\r\n\t\t\r\n\t\t\r\n\t\t\r\n\r\n\t\treturn row;\r\n\t}", "@Test \n\t public static void Execute_Sessions() throws Exception\n\t {\n\t\t int MYTHREADS = 30; \n\t\t // ExecutorService pool = Executors.newFixedThreadPool(MYTHREADS); \n\t\t //CountDownLatch latch = new CountDownLatch(totalNumberOfTasks);\n\t\t ExecutorService executor = Executors.newFixedThreadPool(MYTHREADS);\n\t\t \n\t\t// CountDownLatch latch = new CountDownLatch(15);\n\t\t //ExecutorService executor = Executors.newFixedThreadPool(13);\n\t\t// ExecutorService pool = Executors.newFixedThreadPool(MYTHREADS); \n\t\t \n\t\t int NumberofTestScripts = 0;\n\t\t\tExcelApiTest3 eat = new ExcelApiTest3();\n\t\t\tNumberofTestScripts=eat.getRowCount(\"E://Batch2Source//Regression1.xls\",\"Sheet1\");\n\t\t\tSystem.out.println(\"Numberof TestScripts Count Regression1.xls :\"+NumberofTestScripts);\n\t\t\t\n\t\t\t\t\t\n\t\t\tfor (int iRow1=1;iRow1<NumberofTestScripts;iRow1++) // Number of Test Cases in Regression Sheet\n\t\t\t{\n\t\t\t\tRunnable worker = new DriverTest124(iRow1);\n\t\t\t\tThread.sleep(3000);\n\t\t\t\t\n\t \t\texecutor.execute(worker);\n\t \t\t\n\n\t\t\t\t//executor.awaitTermination(5, TimeUnit.HOURS);\n\t \t\t//Runnable worker = new WorkerThread(\"\" + iRow1);\n\t // executor.execute(worker);\n\t\t\t\t//Future f = executor.submit(new DriverTest124(iRow1));\n\t\t\t\t//f.get(60,TimeUnit.SECONDS);\n\t\t\t\t//Thread.sleep(9000);\n\t \t\n\t\n\t\t\t\t/*\n\t \t\tSystem.out.println(\"First Thread ID:\"+Thread.currentThread().getId());\n\t\t\t\tSystem.out.println(\"First Thread status:\"+Thread.currentThread().getState());\n\t\t\t\tSystem.out.println(\"First Thread Name:\"+Thread.currentThread().getName());\n\t\t\t\t\n\t\t\n\t\t\t\t String str=\"Row Iteration in for loop- \" + String.valueOf(iRow1);\n\t\t\t\t System.out.println(\"Row Iteration in for loop- \"+str);\n\t\t\t\t\n\t\t\t\tSystem.out.println(\"Thread ID:\"+Thread.currentThread().getId());\n\t\t\t\tSystem.out.println(\"Thread status:\"+Thread.currentThread().getState());\n\t\t\t\tSystem.out.println(\"Thread Name:\"+Thread.currentThread().getName());*/\n\t\t\t\t\n\t\t\t\t/*if(Thread.currentThread().isInterrupted())\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(\"Thread status:\"+Thread.currentThread().getId());\n\t\t\t\t\tSystem.out.println(\"Thread status:\"+Thread.currentThread().getState());\n\t\t\t\t}*/\n\t\t\t\t\n\t \t\n\t\t\t\t//f.wait();\n\t\t\t\t//System.out.println(\"Task Status - :\"+f.isCancelled());\n\t\t\t\t\n\t\t\t\t\t//f.isDone();\n\t \t\t\n\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\n\t\t\t/*try {\n\t\t\t latch.await();\n\t\t\t} catch (InterruptedException E) {\n\t\t\t\t\n\t\t\t}\n\t\t\t*/\n\t\t\t\n\t\t\tSystem.out.println(\"Finish tasks\");\n\t\t\t\n\t\t\t//awaitTerminationAfterShutdown\n\t\t\t\t\t\n\t\t\n\t\t\texecutor.shutdown();\n\t\t\texecutor.awaitTermination(5, TimeUnit.HOURS);\n\t\t\t\n\t\t\t// Wait until all threads are finish\n\t\t//\twhile (!executor.isTerminated()) {\n\t \n\t\t//\t}\n\t\t\tSystem.out.println(\"\\nFinished all threads\");\n\t\t\t\n\t\t\t\n\t\t}", "public static void main(String[] args) throws FileNotFoundException,IOException, JXLException {\nFileOutputStream fo=new FileOutputStream(\"./testdata/testoutput.xls\");\r\nWritableWorkbook ww=Workbook.createWorkbook(fo);\r\nWritableSheet ws=ww.createSheet(\"testing\",0);\r\n//to move data into specific loationa using labels\r\nLabel a = new Label(0,0,\"Username\");//now the label store in ram loaction\r\n// to move data into specific location\r\nLabel b = new Label(1,0,\"password\");\r\nws.addCell(b);\r\n\r\nws.addCell(a);\r\nww.write();\r\nww.close();\r\n\t}", "@Override\r\n\t\t\tpublic boolean run() throws SQLException {\n\t\t\t\ttry {\r\n\t\t\t\t\tDecimalFormat df = new DecimalFormat(\"######0.00\");\r\n\t\t\t\t\t// 上传文件\r\n\t\t\t\t\tUploadFile file = getFile();\r\n\t\t\t\t\tFile delfile = new File(file.getUploadPath() + \"/\" + file.getFileName());\r\n\t\t\t\t\tString createBy = getPara(\"createBy\");\r\n\t\t\t\t\tString path = delfile.getPath();// 文件的路径\r\n\t\t\t\t\t// 读取文件内容\r\n\t\t\t\t\tReadExcelUtils readExcel = new ReadExcelUtils(path);\r\n\t\t\t\t\t// 读取文件标题(确定几月份的考勤)\r\n\t\t\t\t\tCell title = readExcel.readExcelTitle();\r\n\t\t\t\t\tString str = title.getStringCellValue();\r\n\t\t\t\t\tString[] split = str.split(\":\");\r\n\t\t\t\t\tString attendanceDate = split[1];\r\n\t\t\t\t\tString year = attendanceDate.split(\"-\")[0];\r\n\t\t\t\t\tString month = attendanceDate.split(\"-\")[1];\r\n\t\t\t\t\t// 查询 导入的文件是否已经导入过了\r\n\t\t\t\t\tPage<HrStaffAttendance> list = service.getStaffAttendanceInfo(1, 10, attendanceDate, null);\r\n\t\t\t\t\tif (list.getList().size() != 0) {\r\n\t\t\t\t\t\trenderError(\"不可重复导入同一数据\");\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tList<HrStaffAttendance> content = readExcel.readExcelContent(Integer.parseInt(year),\r\n\t\t\t\t\t\t\tInteger.parseInt(month));\r\n\r\n\t\t\t\t\tlogger.info(\"StaffAttendanceController staffAttendance 从excel员工表导入的数据: \" + content);\r\n\t\t\t\t\tint export = 0;\r\n\t\t\t\t\tfor (HrStaffAttendance hrStaffAttendance : content) {\r\n\t\t\t\t\t\t// 处理考勤时间\r\n\t\t\t\t\t\tDouble actCheckDay = 0.0;\r\n\t\t\t\t\t\t// 实际考勤天数(工作量)\r\n\t\t\t\t\t\tDouble actCheckDay1 = 0.0;\r\n\t\t\t\t\t\tint checkDays = 0;// 打卡日期,即每天打卡2次以上\r\n\t\t\t\t\t\tint laterDay = 0;// 迟到天数\r\n\t\t\t\t\t\tint earlyRetreat = 0;// 早退天数\r\n\t\t\t\t\t\tint singleCheck = 0;// 单边打卡天数\r\n\t\t\t\t\t\tint workDay = hrStaffAttendance.getWorkDay();// 每月需工作天数\r\n\t\t\t\t\t\tJSONObject parse = (JSONObject) JSON.parse(hrStaffAttendance.getCheckRecord());\r\n\t\t\t\t\t\tJSONObject jsonA = (JSONObject) JSON.parse(parse.getString(\"A\"));\r\n\t\t\t\t\t\tString strB = parse.getString(\"B\");\r\n\t\t\t\t\t\tString checkIn = null;\r\n\t\t\t\t\t\tString checkOut = null;\r\n\t\t\t\t\t\tJSONObject workHour = null;\r\n\t\t\t\t\t\tJSONObject workHours = new JSONObject();\r\n\t\t\t\t\t\tJSONObject checkRecord = null;\r\n\t\t\t\t\t\tJSONObject checkRecords = new JSONObject();\r\n\t\t\t\t\t\tSimpleDateFormat simpleFormat = new SimpleDateFormat(\"HH:mm\");\r\n\t\t\t\t\t\t// 本月不存在打卡3次以上的情况\r\n\t\t\t\t\t\tif (strB == null || strB == \"\") {\r\n\t\t\t\t\t\t\tworkHour = new JSONObject();\r\n\t\t\t\t\t\t\tcheckRecords = parse;\r\n\t\t\t\t\t\t\tfor (Entry<String, Object> ent : jsonA.entrySet()) {\r\n\t\t\t\t\t\t\t\tString st = ent.getValue().toString();\r\n\t\t\t\t\t\t\t\tint hours = 0;\r\n\t\t\t\t\t\t\t\t// length > 1 说明今天至少打卡1次,保证checkIn不为空\r\n\t\t\t\t\t\t\t\tif (st.split(\",\").length > 1) {\r\n\t\t\t\t\t\t\t\t\tcheckIn = st.split(\",\")[0].trim();\r\n\t\t\t\t\t\t\t\t\t// checkIn 为空 说明今天未打卡\r\n\t\t\t\t\t\t\t\t\tcheckOut = st.split(\",\")[st.split(\",\").length - 1].trim();\r\n\t\t\t\t\t\t\t\t\t// checkOut 为空 今天只打卡一次,属于单边打卡\r\n\t\t\t\t\t\t\t\t\tif (!StrKit.notBlank(checkOut) || \"0\".equals(checkOut)) {\r\n\t\t\t\t\t\t\t\t\t\tsingleCheck++;\r\n\t\t\t\t\t\t\t\t\t\tactCheckDay = 0.0;\r\n\t\t\t\t\t\t\t\t\t} else {// checkOut不为空,说明今天打卡两次\r\n\t\t\t\t\t\t\t\t\t\tcheckDays++;\r\n\t\t\t\t\t\t\t\t\t\tlong from = simpleFormat.parse(checkIn).getTime();\r\n\t\t\t\t\t\t\t\t\t\tlong to = simpleFormat.parse(checkOut).getTime();\r\n\t\t\t\t\t\t\t\t\t\t// 每天的工作时长\r\n\t\t\t\t\t\t\t\t\t\thours = Math.abs((int) ((to - from) / (1000 * 60 * 60)));\r\n\t\t\t\t\t\t\t\t\t\t;\r\n\t\t\t\t\t\t\t\t\t\tif (from > 3600000) {\r\n\t\t\t\t\t\t\t\t\t\t\tlaterDay++;// 迟到\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t// simpleFormat.parse(\"18:00\").getTime()=36000000\r\n\t\t\t\t\t\t\t\t\t\tif (to < 36000000) {\r\n\t\t\t\t\t\t\t\t\t\t\tearlyRetreat++;// 早退\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\tif (hours >= 9) {\r\n\t\t\t\t\t\t\t\t\t\t\tactCheckDay = 1.0;\r\n\t\t\t\t\t\t\t\t\t\t} else if (hours < 9 && hours >= 4) {\r\n\t\t\t\t\t\t\t\t\t\t\tactCheckDay = 0.5;\r\n\t\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\t\tactCheckDay = 0.0;\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\thours = 0;\r\n\t\t\t\t\t\t\t\t\tactCheckDay = 0.0;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tworkHour.put(String.valueOf(ent.getKey()), hours);\r\n\t\t\t\t\t\t\t\tactCheckDay1 += actCheckDay;\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t// 本月存在打卡3次以上的情况\r\n\t\t\t\t\t\t\tJSONObject jsonB = (JSONObject) JSON.parse(strB);\r\n\t\t\t\t\t\t\tworkHour = new JSONObject();\r\n\t\t\t\t\t\t\tcheckRecord = new JSONObject();\r\n\t\t\t\t\t\t\tfor (Entry<String, Object> ent : jsonB.entrySet()) {\r\n\t\t\t\t\t\t\t\tString string = ent.getValue().toString();\r\n\t\t\t\t\t\t\t\tint hours = 0;\r\n\t\t\t\t\t\t\t\tString cr = null;\r\n\t\t\t\t\t\t\t\t// string不为0 说明今天存在打卡3次以上情况 前两次均存在打卡记录\r\n\t\t\t\t\t\t\t\tif (!\"0\".equals(string)) {\r\n\t\t\t\t\t\t\t\t\t// 今天打卡3次以上\r\n\t\t\t\t\t\t\t\t\tcheckDays++;\r\n\t\t\t\t\t\t\t\t\t// 第一次打卡\r\n\t\t\t\t\t\t\t\t\tcheckIn = jsonA.getString(ent.getKey()).split(\",\")[0].trim();\r\n\t\t\t\t\t\t\t\t\t// 今天最后一次打卡\r\n\t\t\t\t\t\t\t\t\tcheckOut = string.split(\",\")[string.split(\",\").length - 1].trim();\r\n\t\t\t\t\t\t\t\t\t// 今天打卡记录合并 如:9:00,12:00,18:00\r\n\t\t\t\t\t\t\t\t\t// checkOut 为空,说明今天只打了3次卡,没有第四次\r\n\t\t\t\t\t\t\t\t\tif (!StrKit.notBlank(checkOut)) {\r\n\t\t\t\t\t\t\t\t\t\tcheckOut = string.split(\",\")[0].trim();\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tlong from = simpleFormat.parse(checkIn).getTime();\r\n\t\t\t\t\t\t\t\t\tlong to = simpleFormat.parse(checkOut).getTime();\r\n\t\t\t\t\t\t\t\t\tif (from > 3600000) {\r\n\t\t\t\t\t\t\t\t\t\tlaterDay++;// 迟到\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t// simpleFormat.parse(\"18:00\").getTime()=36000000\r\n\t\t\t\t\t\t\t\t\tif (to < 36000000) {\r\n\t\t\t\t\t\t\t\t\t\tearlyRetreat++;// 早退\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t// 每天的工作时长\r\n\t\t\t\t\t\t\t\t\thours = Math.abs((int) ((to - from) / (1000 * 60 * 60)));\r\n\t\t\t\t\t\t\t\t\tif (hours >= 9) {\r\n\t\t\t\t\t\t\t\t\t\tactCheckDay = 1.0;\r\n\t\t\t\t\t\t\t\t\t} else if (hours < 9 && hours >= 4) {\r\n\t\t\t\t\t\t\t\t\t\tactCheckDay = 0.5;\r\n\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\tactCheckDay = 0.0;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tcr = jsonA.getString(ent.getKey()).trim() + \",\" + string.trim();\r\n\t\t\t\t\t\t\t\t} else {// 今天不存在打3次卡以上的情况\r\n\t\t\t\t\t\t\t\t\t// 第一次打卡\r\n\t\t\t\t\t\t\t\t\tcheckIn = jsonA.getString(ent.getKey()).split(\",\")[0].trim();\r\n\t\t\t\t\t\t\t\t\t// 最后一次打卡\r\n\t\t\t\t\t\t\t\t\tcheckOut = jsonA.getString(ent.getKey())\r\n\t\t\t\t\t\t\t\t\t\t\t.split(\",\")[jsonA.getString(ent.getKey()).split(\",\").length - 1].trim();\r\n\t\t\t\t\t\t\t\t\t// checkIn 为空 说明今天未打卡 跳出本次循环\r\n\t\t\t\t\t\t\t\t\tif (!StrKit.notBlank(checkIn) || \"0\".equals(checkIn)) {\r\n\t\t\t\t\t\t\t\t\t\thours = 0;\r\n\t\t\t\t\t\t\t\t\t\tactCheckDay = 0.0;\r\n\t\t\t\t\t\t\t\t\t\tworkHour.put(String.valueOf(ent.getKey()), 0);\r\n\t\t\t\t\t\t\t\t\t\tcheckRecord.put(String.valueOf(ent.getKey()), \"0\");\r\n\t\t\t\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t// checkOut 为空 或者和checkIn相等 属于单边打卡\r\n\t\t\t\t\t\t\t\t\tif (!StrKit.notBlank(checkOut) || checkIn.equals(checkOut)) {\r\n\t\t\t\t\t\t\t\t\t\tsingleCheck++;\r\n\t\t\t\t\t\t\t\t\t\tactCheckDay = 0.0;\r\n\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\t// 能走到这里,说明checkIn,checkOut均不为空,说明今天打卡2次\r\n\t\t\t\t\t\t\t\t\t\tcheckDays++;\r\n\t\t\t\t\t\t\t\t\t\tlong from = simpleFormat.parse(checkIn).getTime();\r\n\t\t\t\t\t\t\t\t\t\tlong to = simpleFormat.parse(checkOut).getTime();\r\n\t\t\t\t\t\t\t\t\t\t// 每天的工作时长\r\n\t\t\t\t\t\t\t\t\t\thours = Math.abs((int) ((to - from) / (1000 * 60 * 60)));\r\n\t\t\t\t\t\t\t\t\t\tif (from > 3600000) {\r\n\t\t\t\t\t\t\t\t\t\t\tlaterDay++;// 迟到\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t// simpleFormat.parse(\"18:00\").getTime()=36000000\r\n\t\t\t\t\t\t\t\t\t\tif (to < 36000000) {\r\n\t\t\t\t\t\t\t\t\t\t\tearlyRetreat++;// 早退\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\tif (hours >= 9) {\r\n\t\t\t\t\t\t\t\t\t\t\tactCheckDay = 1.0;\r\n\t\t\t\t\t\t\t\t\t\t} else if (hours < 9 && hours >= 4) {\r\n\t\t\t\t\t\t\t\t\t\t\tactCheckDay = 0.5;\r\n\t\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\t\tactCheckDay = 0.0;\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tcr = jsonA.getString(ent.getKey());\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tworkHour.put(String.valueOf(ent.getKey()), hours);\r\n\t\t\t\t\t\t\t\tcheckRecord.put(String.valueOf(ent.getKey()), cr);\r\n\t\t\t\t\t\t\t\tactCheckDay1 += actCheckDay;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tcheckRecords.put(\"A\", checkRecord);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tworkHours.put(\"A\", workHour);\r\n\t\t\t\t\t\tInteger checkInNum = hrStaffAttendance.getCheckInNum();\r\n\t\t\t\t\t\thrStaffAttendance.setActCheckDay(actCheckDay1.toString());\r\n\t\t\t\t\t\tDouble allDayNotSca = (1 - (double) checkDays / workDay);\r\n\t\t\t\t\t\tDouble earlyRetreatSca = ((double) earlyRetreat / workDay);\r\n\t\t\t\t\t\tDouble laterDaySca = ((double) laterDay / workDay);\r\n\t\t\t\t\t\tDouble singleCheckSca = ((double) singleCheck / workDay);\r\n\t\t\t\t\t\thrStaffAttendance.setCheckDay(checkDays);\r\n\t\t\t\t\t\thrStaffAttendance.setEarlyRetreat(earlyRetreat);\r\n\t\t\t\t\t\thrStaffAttendance.setSingleCheck(singleCheck);\r\n\t\t\t\t\t\thrStaffAttendance.setLaterDay(laterDay);\r\n\t\t\t\t\t\thrStaffAttendance.setAllDayNotSca(df.format(allDayNotSca));\r\n\t\t\t\t\t\thrStaffAttendance.setEarlyRetreatSca(df.format(earlyRetreatSca));\r\n\t\t\t\t\t\thrStaffAttendance.setLaterDaySca(df.format(laterDaySca));\r\n\t\t\t\t\t\thrStaffAttendance.setSingleCheckSca(df.format(singleCheckSca));\r\n\t\t\t\t\t\t// 通过考勤编号check_in_num去人员列表里找到相关的入场信息\r\n\t\t\t\t\t\tList<Record> personInfo = service.getPersonInfo(checkInNum);\r\n\t\t\t\t\t\t// 保证arrayList>1\r\n\t\t\t\t\t\tif (personInfo.size() == 0) {\r\n\t\t\t\t\t\t\tlogger.info(\"StaffAttendanceController staffAttendance 考勤编号:\" + checkInNum\r\n\t\t\t\t\t\t\t\t\t+ \"在人员入场表里找不到该人员的相关入场信息\");\r\n\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// 先判断一下时间 比如:3月入场,5月转场,导入4月的考勤\r\n\t\t\t\t\t\t// arrayList记录改考勤编号下的所有的入场日期及订单编号\r\n\t\t\t\t\t\tList<String> arrayList = new ArrayList<>();\r\n\t\t\t\t\t\t// array记录本月的入场时间\r\n\t\t\t\t\t\tList<String> array = new ArrayList<>();\r\n\t\t\t\t\t\t// 中间变量 用于排序入场时间\r\n\t\t\t\t\t\tString[] per = new String[personInfo.size() + 1];\r\n\t\t\t\t\t\tper[0] = attendanceDate.substring(0, 10);\r\n\t\t\t\t\t\tint i = 1;\r\n\t\t\t\t\t\tfor (Record record : personInfo) {\r\n\t\t\t\t\t\t\tper[i] = JSON.parseObject(record.get(\"in_field_json\")).getString(\"entry_date\");\r\n\t\t\t\t\t\t\ti++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// 对入场时间进行排序\r\n\t\t\t\t\t\tArrays.sort(per);\r\n\t\t\t\t\t\tfor (int j = 0; j < per.length; j++) {\r\n\t\t\t\t\t\t\tarrayList.add(per[j]);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// 本月考勤记录第一天所在所有入场日期的位置\r\n\t\t\t\t\t\tint index = arrayList.indexOf(attendanceDate.substring(0, 10));\r\n\t\t\t\t\t\t// 先判断本月有几条入离场信息的入场时间\r\n\t\t\t\t\t\tfor (int j = 0; j < per.length; j++) {\r\n\t\t\t\t\t\t\tif (per[j].substring(0, 7).equals(attendanceDate.substring(0, 7))) {\r\n\t\t\t\t\t\t\t\tarray.add(per[j]);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// 说明本月无转场\r\n\t\t\t\t\t\tif (array.size() == 1) {\r\n\t\t\t\t\t\t\t// 根据入场时间和考勤编号查询入场信息\r\n\t\t\t\t\t\t\tif (index != 0) {\r\n\t\t\t\t\t\t\t\tindex = index - 1;// 该月无转场,直接入场(离场不用管,因为离场后就不会再打卡)(若index=0,说明该人员无入场)\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tRecord record = service.getUserInInfo(checkInNum, arrayList.get(index));\r\n\t\t\t\t\t\t\tif (record == null) {\r\n\t\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tObject object = record.get(\"in_field_json\");\r\n\t\t\t\t\t\t\tJSONObject fromObject = JSON.parseObject(object.toString());\r\n\t\t\t\t\t\t\tString orderNum = fromObject.getString(\"order_num\");\r\n\t\t\t\t\t\t\tString department = fromObject.getJSONObject(\"department\").getString(\"department_name\");\r\n\t\t\t\t\t\t\tString supplierName = fromObject.getString(\"supplier_name\");\r\n\t\t\t\t\t\t\tRecord rec = service.getCBbySupplierName(supplierName);\r\n\t\t\t\t\t\t\tif (rec != null) {\r\n\t\t\t\t\t\t\t\tcreateBy = rec.getStr(\"create_by\");\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tString personName = fromObject.getString(\"person_name\");\r\n\t\t\t\t\t\t\tString personNature = fromObject.getJSONObject(\"person_nature\")\r\n\t\t\t\t\t\t\t\t\t.getString(\"person_nature_name\");\r\n\t\t\t\t\t\t\tString personLevel = fromObject.getJSONObject(\"person_level\").getString(\"person_level_key\");\r\n\t\t\t\t\t\t\tString personClass = fromObject.getJSONObject(\"person_type\").getString(\"person_type_key\");\r\n\t\t\t\t\t\t\tString changePerson = fromObject.getJSONObject(\"change_person\")\r\n\t\t\t\t\t\t\t\t\t.getString(\"change_person_key\");\r\n\t\t\t\t\t\t\tString orderName = fromObject.getJSONObject(\"order_name\").getString(\"order_name_name\");\r\n\t\t\t\t\t\t\tString entryDate = fromObject.getString(\"entry_date\");\r\n\t\t\t\t\t\t\tString leaveDate = fromObject.getString(\"leave_date\");\r\n\t\t\t\t\t\t\thrStaffAttendance.setPersonLevel(personLevel);\r\n\t\t\t\t\t\t\thrStaffAttendance.setPersonName(personName);\r\n\t\t\t\t\t\t\thrStaffAttendance.setPersonNature(personNature);\r\n\t\t\t\t\t\t\thrStaffAttendance.setSupplierName(supplierName);\r\n\t\t\t\t\t\t\thrStaffAttendance.setDepartment(department);\r\n\t\t\t\t\t\t\thrStaffAttendance.setEntryDate(entryDate);\r\n\t\t\t\t\t\t\thrStaffAttendance.setAttendanceDate(attendanceDate);\r\n\t\t\t\t\t\t\thrStaffAttendance.setPersonClassKey(personClass);\r\n\t\t\t\t\t\t\thrStaffAttendance.setChangePersonKey(changePerson);\r\n\t\t\t\t\t\t\thrStaffAttendance.setCreateBy(createBy);\r\n\t\t\t\t\t\t\thrStaffAttendance\r\n\t\t\t\t\t\t\t\t\t.setCreateTime(new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\").format(new Date()));\r\n\t\t\t\t\t\t\tint status = 0;\r\n\t\t\t\t\t\t\tif (\"2\".equals(record.get(\"status_type\"))) {\r\n\t\t\t\t\t\t\t\tstatus = 1;// 1为离场状态\r\n\t\t\t\t\t\t\t\tleaveDate = JSON.parseObject(record.get(\"out_field_json\"))\r\n\t\t\t\t\t\t\t\t\t\t.getString(\"actual_leave_date\");\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tstatus = 0;// 0为入场状态\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\thrStaffAttendance.setStatusInorout(status);\r\n\t\t\t\t\t\t\thrStaffAttendance.setOrderNum(orderNum);\r\n\t\t\t\t\t\t\thrStaffAttendance.setOrderName(orderName);\r\n\t\t\t\t\t\t\t// 默认每人每月非开会事由补打卡次数最多为:3次\r\n\t\t\t\t\t\t\thrStaffAttendance.setFillupMaxcounts(3);\r\n\t\t\t\t\t\t\thrStaffAttendance.setLeaveDate(leaveDate);\r\n\t\t\t\t\t\t\thrStaffAttendance.setWorkHours(workHours.toString());\r\n\t\t\t\t\t\t\thrStaffAttendance.setCheckRecord(checkRecords.toString());\r\n\t\t\t\t\t\t\t// 默认工作工作量确认初始值为:0(未确认)\r\n\t\t\t\t\t\t\thrStaffAttendance.setStatus(Constants.STATUS);\r\n\t\t\t\t\t\t\tlogger.info(\"StaffAttendanceController staffAttendance 将数据添加到数据库 \");\r\n\t\t\t\t\t\t\tint m = service.insertstaffAttendance(hrStaffAttendance);\r\n\t\t\t\t\t\t\tif (m < 0) {\r\n\t\t\t\t\t\t\t\trenderError(\"数据添加到数据库:失败\");\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\trenderSuccess(\"数据成功添加到数据库 \");\r\n\t\t\t\t\t\t} else if (array.size() == 2) {\r\n\t\t\t\t\t\t\tif (index == 0) {\r\n\t\t\t\t\t\t\t\tindex = index + 1;// 该月无转场 在本月入场\r\n\t\t\t\t\t\t\t\tRecord record = service.getUserInInfo(checkInNum, arrayList.get(index));\r\n\t\t\t\t\t\t\t\tif (record == null) {\r\n\t\t\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tObject object = record.get(\"in_field_json\");\r\n\t\t\t\t\t\t\t\tJSONObject fromObject = JSON.parseObject(object.toString());\r\n\t\t\t\t\t\t\t\tString orderNum = fromObject.getString(\"order_num\");\r\n\t\t\t\t\t\t\t\tString department = fromObject.getJSONObject(\"department\").getString(\"department_name\");\r\n\t\t\t\t\t\t\t\tString supplierName = fromObject.getString(\"supplier_name\");\r\n\t\t\t\t\t\t\t\tRecord rec = service.getCBbySupplierName(supplierName);\r\n\t\t\t\t\t\t\t\tif (rec != null) {\r\n\t\t\t\t\t\t\t\t\tcreateBy = rec.getStr(\"create_by\");\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tString personName = fromObject.getString(\"person_name\");\r\n\t\t\t\t\t\t\t\tString personNature = fromObject.getJSONObject(\"person_nature\")\r\n\t\t\t\t\t\t\t\t\t\t.getString(\"person_nature_name\");\r\n\t\t\t\t\t\t\t\tString personLevel = fromObject.getJSONObject(\"person_level\")\r\n\t\t\t\t\t\t\t\t\t\t.getString(\"person_level_key\");\r\n\t\t\t\t\t\t\t\tString personClass = fromObject.getJSONObject(\"person_type\")\r\n\t\t\t\t\t\t\t\t\t\t.getString(\"person_type_key\");\r\n\t\t\t\t\t\t\t\tString changePerson = fromObject.getJSONObject(\"change_person\")\r\n\t\t\t\t\t\t\t\t\t\t.getString(\"change_person_key\");\r\n\t\t\t\t\t\t\t\tString orderName = fromObject.getJSONObject(\"order_name\").getString(\"order_name_name\");\r\n\t\t\t\t\t\t\t\tString entryDate = fromObject.getString(\"entry_date\");\r\n\t\t\t\t\t\t\t\tString leaveDate = fromObject.getString(\"leave_date\");\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setPersonLevel(personLevel);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setPersonName(personName);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setPersonNature(personNature);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setSupplierName(supplierName);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setDepartment(department);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setEntryDate(entryDate);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setAttendanceDate(attendanceDate);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setPersonClassKey(personClass);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setChangePersonKey(changePerson);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setCreateBy(createBy);\r\n\t\t\t\t\t\t\t\thrStaffAttendance\r\n\t\t\t\t\t\t\t\t\t\t.setCreateTime(new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\").format(new Date()));\r\n\t\t\t\t\t\t\t\tint status = 0;\r\n\t\t\t\t\t\t\t\tif (\"2\".equals(record.get(\"status_type\"))) {\r\n\t\t\t\t\t\t\t\t\tstatus = 1;// 1为离场状态\r\n\t\t\t\t\t\t\t\t\tleaveDate = JSON.parseObject(record.get(\"out_field_json\"))\r\n\t\t\t\t\t\t\t\t\t\t\t.getString(\"actual_leave_date\");\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\tstatus = 0;// 0为入场状态\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setStatusInorout(status);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setOrderNum(orderNum);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setOrderName(orderName);\r\n\t\t\t\t\t\t\t\t// 默认每人每月非开会事由补打卡次数最多为:3次\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setFillupMaxcounts(3);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setLeaveDate(leaveDate);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setWorkHours(workHours.toString());\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setCheckRecord(checkRecords.toString());\r\n\t\t\t\t\t\t\t\t// 默认工作工作量确认初始值为:0(未确认)\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setStatus(Constants.STATUS);\r\n\t\t\t\t\t\t\t\tlogger.info(\"StaffAttendanceController staffAttendance 将数据添加到数据库 \");\r\n\t\t\t\t\t\t\t\tint m = service.insertstaffAttendance(hrStaffAttendance);\r\n\t\t\t\t\t\t\t\tif (m < 0) {\r\n\t\t\t\t\t\t\t\t\trenderError(\"数据添加到数据库:失败\");\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\trenderSuccess(\"数据成功添加到数据库 \");\r\n\t\t\t\t\t\t\t} else {// 该月有转场\r\n\t\t\t\t\t\t\t\tcheckDays = 0;\r\n\t\t\t\t\t\t\t\tlaterDay = 0;\r\n\t\t\t\t\t\t\t\tearlyRetreat = 0;\r\n\t\t\t\t\t\t\t\tsingleCheck = 0;\r\n\r\n\t\t\t\t\t\t\t\tDouble actCheckDays1 = 0.0;\r\n\t\t\t\t\t\t\t\t// 转场前\r\n\t\t\t\t\t\t\t\tRecord record = service.getUserInInfo(checkInNum, arrayList.get(index - 1));\r\n\t\t\t\t\t\t\t\tif (record == null) {\r\n\t\t\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tObject object = record.get(\"in_field_json\");\r\n\t\t\t\t\t\t\t\tJSONObject fromObject = JSON.parseObject(object.toString());\r\n\t\t\t\t\t\t\t\tString orderNum = fromObject.getString(\"order_num\");\r\n\t\t\t\t\t\t\t\tString department = fromObject.getJSONObject(\"department\").getString(\"department_name\");\r\n\t\t\t\t\t\t\t\tString supplierName = fromObject.getString(\"supplier_name\");\r\n\t\t\t\t\t\t\t\tRecord rec = service.getCBbySupplierName(supplierName);\r\n\t\t\t\t\t\t\t\tif (rec != null) {\r\n\t\t\t\t\t\t\t\t\tcreateBy = rec.getStr(\"create_by\");\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tString personName = fromObject.getString(\"person_name\");\r\n\t\t\t\t\t\t\t\tString personNature = fromObject.getJSONObject(\"person_nature\")\r\n\t\t\t\t\t\t\t\t\t\t.getString(\"person_nature_name\");\r\n\t\t\t\t\t\t\t\tString personLevel = fromObject.getJSONObject(\"person_level\")\r\n\t\t\t\t\t\t\t\t\t\t.getString(\"person_level_key\");\r\n\t\t\t\t\t\t\t\tString personClass = fromObject.getJSONObject(\"person_type\")\r\n\t\t\t\t\t\t\t\t\t\t.getString(\"person_type_key\");\r\n\t\t\t\t\t\t\t\tString changePerson = fromObject.getJSONObject(\"change_person\")\r\n\t\t\t\t\t\t\t\t\t\t.getString(\"change_person_key\");\r\n\t\t\t\t\t\t\t\tString orderName = fromObject.getJSONObject(\"order_name\").getString(\"order_name_name\");\r\n\t\t\t\t\t\t\t\tString entryDate = fromObject.getString(\"entry_date\");\r\n\t\t\t\t\t\t\t\tString leaveDate = fromObject.getString(\"leave_date\");\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setPersonLevel(personLevel);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setPersonName(personName);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setPersonNature(personNature);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setSupplierName(supplierName);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setDepartment(department);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setEntryDate(entryDate);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setAttendanceDate(attendanceDate);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setPersonClassKey(personClass);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setChangePersonKey(changePerson);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setCreateBy(createBy);\r\n\t\t\t\t\t\t\t\thrStaffAttendance\r\n\t\t\t\t\t\t\t\t\t\t.setCreateTime(new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\").format(new Date()));\r\n\t\t\t\t\t\t\t\tint status = 0;\r\n\t\t\t\t\t\t\t\tif (\"2\".equals(record.get(\"status_type\"))) {\r\n\t\t\t\t\t\t\t\t\tstatus = 1;\r\n\t\t\t\t\t\t\t\t\tleaveDate = JSON.parseObject(record.get(\"out_field_json\"))\r\n\t\t\t\t\t\t\t\t\t\t\t.getString(\"actual_leave_date\");\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\tstatus = 0;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setStatusInorout(status);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setOrderNum(orderNum);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setOrderName(orderName);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setLeaveDate(leaveDate);\r\n\t\t\t\t\t\t\t\t// 默认每人每月非开会事由补打卡次数最多为:3次\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setFillupMaxcounts(3);\r\n\t\t\t\t\t\t\t\t// 默认工作工作量确认初始值为:0(未确认)\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setStatus(Constants.STATUS);\r\n\t\t\t\t\t\t\t\tlogger.info(\"StaffAttendanceController staffAttendance 将数据添加到数据库 \");\r\n\t\t\t\t\t\t\t\tJSONObject wH = new JSONObject();\r\n\t\t\t\t\t\t\t\tJSONObject cR = new JSONObject();\r\n\t\t\t\t\t\t\t\tint co = 1;\r\n\t\t\t\t\t\t\t\tfor (Entry<String, Object> ent : workHour.entrySet()) {\r\n\t\t\t\t\t\t\t\t\tif (Integer.parseInt(ent.getKey()) > Integer.parseInt(leaveDate.substring(8, 10))) {\r\n\t\t\t\t\t\t\t\t\t\twH.put(ent.getKey(), 0);\r\n\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\twH.put(ent.getKey(), ent.getValue());\r\n\r\n\t\t\t\t\t\t\t\t\t\tif (Integer.parseInt(ent.getValue().toString()) >= 9) {\r\n\t\t\t\t\t\t\t\t\t\t\tactCheckDay = 1.0;\r\n\t\t\t\t\t\t\t\t\t\t} else if (Integer.parseInt(ent.getValue().toString()) < 9\r\n\t\t\t\t\t\t\t\t\t\t\t\t&& Integer.parseInt(ent.getValue().toString()) >= 4) {\r\n\t\t\t\t\t\t\t\t\t\t\tactCheckDay = 0.5;\r\n\t\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\t\tactCheckDay = 0.0;\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\tactCheckDays1 += actCheckDay;\r\n\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\tco++;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tco = 1;\r\n\t\t\t\t\t\t\t\tfor (Entry<String, Object> ent : checkRecords.getJSONObject(\"A\").entrySet()) {\r\n\t\t\t\t\t\t\t\t\tif (Integer.parseInt(ent.getKey()) > Integer.parseInt(leaveDate.substring(8, 10))) {\r\n\t\t\t\t\t\t\t\t\t\tcR.put(ent.getKey(), \"0\");\r\n\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\tcR.put(ent.getKey(), ent.getValue());\r\n\t\t\t\t\t\t\t\t\t\t// 保证上班打卡和下班打卡时间不能同时为空\r\n\t\t\t\t\t\t\t\t\t\tif (!\"0\".equals(ent.getValue())) {\r\n\t\t\t\t\t\t\t\t\t\t\tSimpleDateFormat sim = new SimpleDateFormat(\"HH:mm\");\r\n\t\t\t\t\t\t\t\t\t\t\tString[] split1 = ent.getValue().toString().split(\"\\n\");\r\n\t\t\t\t\t\t\t\t\t\t\tString checkIn1 = split1[0].trim();\r\n\t\t\t\t\t\t\t\t\t\t\tString checkOut1 = split1[split1.length - 1].trim();\r\n\t\t\t\t\t\t\t\t\t\t\tif (!\"\".equals(checkIn) && !\"\".equals(checkOut)) {\r\n\t\t\t\t\t\t\t\t\t\t\t\tcheckDays++;// 打卡天数\r\n\t\t\t\t\t\t\t\t\t\t\t\tlong from = sim.parse(checkIn1).getTime();\r\n\t\t\t\t\t\t\t\t\t\t\t\tlong to = sim.parse(checkOut1).getTime();\r\n\t\t\t\t\t\t\t\t\t\t\t\t// simpleFormat.parse(\"9:00\").getTime()=3600000\r\n\t\t\t\t\t\t\t\t\t\t\t\tif (from > 3600000) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tlaterDay++;// 迟到\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t// simpleFormat.parse(\"18:00\").getTime()=36000000\r\n\t\t\t\t\t\t\t\t\t\t\t\tif (to < 36000000) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tearlyRetreat++;// 早退\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\t\t\tsingleCheck++;// 单边打卡天数\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tco++;\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tallDayNotSca = (1 - (double) checkDays / workDay);\r\n\t\t\t\t\t\t\t\tearlyRetreatSca = ((double) earlyRetreat / workDay);\r\n\t\t\t\t\t\t\t\tlaterDaySca = ((double) laterDay / workDay);\r\n\t\t\t\t\t\t\t\tsingleCheckSca = ((double) singleCheck / workDay);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setCheckDay(checkDays);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setEarlyRetreat(earlyRetreat);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setSingleCheck(singleCheck);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setLaterDay(laterDay);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setAllDayNotSca(df.format(allDayNotSca));\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setEarlyRetreatSca(df.format(earlyRetreatSca));\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setLaterDaySca(df.format(laterDaySca));\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setSingleCheckSca(df.format(singleCheckSca));\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setCheckDay(checkDays);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setEarlyRetreat(earlyRetreat);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setLaterDay(laterDay);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setSingleCheck(singleCheck);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setActCheckDay(actCheckDays1.toString());\r\n\t\t\t\t\t\t\t\tJSONObject jswH = new JSONObject();\r\n\t\t\t\t\t\t\t\tJSONObject jscR = new JSONObject();\r\n\t\t\t\t\t\t\t\tjswH.put(\"A\", wH);\r\n\t\t\t\t\t\t\t\tjscR.put(\"A\", cR);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setWorkHours(jswH.toString());\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setCheckRecord(jscR.toString());\r\n\t\t\t\t\t\t\t\tlogger.info(\"StaffAttendanceController staffAttendance 将【转场前】数据添加到数据库 \");\r\n\t\t\t\t\t\t\t\tint m = service.insertstaffAttendance(hrStaffAttendance);\r\n\t\t\t\t\t\t\t\tif (m < 0) {\r\n\t\t\t\t\t\t\t\t\trenderError(\"数据添加到数据库:失败\");\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\trenderSuccess(\"数据成功添加到数据库 \");\r\n\t\t\t\t\t\t\t\t// 转场后\r\n\t\t\t\t\t\t\t\tDouble actCheckDaylatter = 0.0;\r\n\t\t\t\t\t\t\t\tDouble actCheckDaylatter1 = 0.0;\r\n\t\t\t\t\t\t\t\tint checkDayslatter = 0;\r\n\t\t\t\t\t\t\t\tint laterDaylatter = 0;\r\n\t\t\t\t\t\t\t\tint earlyRetreatlatter = 0;\r\n\t\t\t\t\t\t\t\tint singleChecklatter = 0;\r\n\t\t\t\t\t\t\t\tRecord recordlatter = service.getUserInInfo(checkInNum, arrayList.get(index + 1));\r\n\t\t\t\t\t\t\t\tif (recordlatter == null) {\r\n\t\t\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tObject objectlatter = recordlatter.get(\"in_field_json\");\r\n\t\t\t\t\t\t\t\tJSONObject fromObjectlatter = JSON.parseObject(objectlatter.toString());\r\n\t\t\t\t\t\t\t\tString orderNumlatter = fromObjectlatter.getString(\"order_num\");\r\n\t\t\t\t\t\t\t\tString departmentlatter = fromObjectlatter.getJSONObject(\"department\")\r\n\t\t\t\t\t\t\t\t\t\t.getString(\"department_name\");\r\n\t\t\t\t\t\t\t\tString supplierNamelatter = fromObjectlatter.getString(\"supplier_name\");\r\n\t\t\t\t\t\t\t\tRecord rec1 = service.getCBbySupplierName(supplierName);\r\n\t\t\t\t\t\t\t\tif (rec1 != null) {\r\n\t\t\t\t\t\t\t\t\tcreateBy = rec1.getStr(\"create_by\");\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tString personNamelatter = fromObjectlatter.getString(\"person_name\");\r\n\t\t\t\t\t\t\t\tString personNaturelatter = fromObjectlatter.getJSONObject(\"person_nature\")\r\n\t\t\t\t\t\t\t\t\t\t.getString(\"person_nature_name\");\r\n\t\t\t\t\t\t\t\tString personLevellatter = fromObjectlatter.getJSONObject(\"person_level\")\r\n\t\t\t\t\t\t\t\t\t\t.getString(\"person_level_key\");\r\n\t\t\t\t\t\t\t\tString personClasslatter = fromObjectlatter.getJSONObject(\"person_type\")\r\n\t\t\t\t\t\t\t\t\t\t.getString(\"person_type_key\");\r\n\t\t\t\t\t\t\t\tString changePersonlatter = fromObjectlatter.getJSONObject(\"change_person\")\r\n\t\t\t\t\t\t\t\t\t\t.getString(\"change_person_key\");\r\n\t\t\t\t\t\t\t\tString orderNamelatter = fromObjectlatter.getJSONObject(\"order_name\")\r\n\t\t\t\t\t\t\t\t\t\t.getString(\"order_name_name\");\r\n\t\t\t\t\t\t\t\tString entryDatelatter = fromObjectlatter.getString(\"entry_date\");\r\n\t\t\t\t\t\t\t\tString leaveDatelatter = fromObjectlatter.getString(\"leave_date\");\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setPersonLevel(personLevellatter);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setPersonName(personNamelatter);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setPersonNature(personNaturelatter);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setSupplierName(supplierNamelatter);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setDepartment(departmentlatter);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setEntryDate(entryDatelatter);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setAttendanceDate(attendanceDate);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setPersonClassKey(personClasslatter);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setChangePersonKey(changePersonlatter);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setCreateBy(createBy);\r\n\t\t\t\t\t\t\t\thrStaffAttendance\r\n\t\t\t\t\t\t\t\t\t\t.setCreateTime(new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\").format(new Date()));\r\n\t\t\t\t\t\t\t\tint statuslatter = 0;\r\n\t\t\t\t\t\t\t\tif (\"2\".equals(recordlatter.get(\"status_type\"))) {\r\n\t\t\t\t\t\t\t\t\tstatuslatter = 1;\r\n\t\t\t\t\t\t\t\t\tleaveDatelatter = JSON.parseObject(recordlatter.get(\"out_field_json\"))\r\n\t\t\t\t\t\t\t\t\t\t\t.getString(\"actual_leave_date\");\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\tstatuslatter = 0;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setStatusInorout(statuslatter);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setOrderNum(orderNumlatter);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setOrderName(orderNamelatter);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setLeaveDate(leaveDatelatter);\r\n\t\t\t\t\t\t\t\t// 默认每人每月非开会事由补打卡次数最多为:3次\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setFillupMaxcounts(3);\r\n\t\t\t\t\t\t\t\t// 默认工作工作量确认初始值为:0(未确认)\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setStatus(Constants.STATUS);\r\n\t\t\t\t\t\t\t\tJSONObject wHlatter = new JSONObject();\r\n\t\t\t\t\t\t\t\tJSONObject cRlatter = new JSONObject();\r\n\t\t\t\t\t\t\t\tint colatter = 1;\r\n\t\t\t\t\t\t\t\tfor (Entry<String, Object> entlatter : workHour.entrySet()) {\r\n\t\t\t\t\t\t\t\t\tif (Integer.parseInt(entlatter.getKey()) <= Integer\r\n\t\t\t\t\t\t\t\t\t\t\t.parseInt(entryDatelatter.substring(8, 10))) {\r\n\t\t\t\t\t\t\t\t\t\twHlatter.put(entlatter.getKey(), 0);\r\n\t\t\t\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t\t\t\twHlatter.put(entlatter.getKey(), entlatter.getValue());\r\n\t\t\t\t\t\t\t\t\t\tif (Integer.parseInt(entlatter.getValue().toString()) >= 9) {\r\n\t\t\t\t\t\t\t\t\t\t\tactCheckDaylatter = 1.0;\r\n\t\t\t\t\t\t\t\t\t\t} else if (Integer.parseInt(entlatter.getValue().toString()) < 9\r\n\t\t\t\t\t\t\t\t\t\t\t\t&& Integer.parseInt(entlatter.getValue().toString()) >= 4) {\r\n\t\t\t\t\t\t\t\t\t\t\tactCheckDaylatter = 0.5;\r\n\t\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\t\tactCheckDaylatter = 0.0;\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\tactCheckDaylatter1 += actCheckDaylatter;\r\n\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\tcolatter++;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tcolatter = 1;\r\n\t\t\t\t\t\t\t\tfor (Entry<String, Object> entlatter : checkRecords.getJSONObject(\"A\").entrySet()) {\r\n\t\t\t\t\t\t\t\t\tif (Integer.parseInt(entlatter.getKey()) <= Integer\r\n\t\t\t\t\t\t\t\t\t\t\t.parseInt(entryDatelatter.substring(8, 10))) {\r\n\t\t\t\t\t\t\t\t\t\tcRlatter.put(entlatter.getKey(), \"0\");\r\n\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\tcRlatter.put(entlatter.getKey(), entlatter.getValue());\r\n\r\n\t\t\t\t\t\t\t\t\t\t// 保证上班打卡和下班打卡时间不能同时为空,不能为0\r\n\t\t\t\t\t\t\t\t\t\tif (!\"0\".equals(entlatter.getValue())) {\r\n\t\t\t\t\t\t\t\t\t\t\tSimpleDateFormat si = new SimpleDateFormat(\"HH:mm\");\r\n\t\t\t\t\t\t\t\t\t\t\tString[] splitlatter = entlatter.getValue().toString().split(\"\\n\");\r\n\t\t\t\t\t\t\t\t\t\t\tString checkInlatter = splitlatter[0].trim();\r\n\t\t\t\t\t\t\t\t\t\t\tString checkOutlatter = splitlatter[splitlatter.length - 1].trim();\r\n\t\t\t\t\t\t\t\t\t\t\tif (!\"\".equals(checkInlatter) && !\"\".equals(checkOutlatter)) {\r\n\t\t\t\t\t\t\t\t\t\t\t\tcheckDayslatter++;// 打卡天数\r\n\t\t\t\t\t\t\t\t\t\t\t\tlong from = si.parse(checkInlatter).getTime();\r\n\t\t\t\t\t\t\t\t\t\t\t\tlong to = si.parse(checkOutlatter).getTime();\r\n\t\t\t\t\t\t\t\t\t\t\t\t// simpleFormat.parse(\"9:00\").getTime()=3600000\r\n\t\t\t\t\t\t\t\t\t\t\t\tif (from > 3600000) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tlaterDaylatter++;// 迟到\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t// simpleFormat.parse(\"18:00\").getTime()=36000000\r\n\t\t\t\t\t\t\t\t\t\t\t\tif (to < 36000000) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tearlyRetreatlatter++;// 早退\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\t\t\tsingleChecklatter++;// 单边打卡天数\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tcolatter++;\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tint workDaylatter = hrStaffAttendance.getWorkDay();\r\n\t\t\t\t\t\t\t\tDouble allDayNotScalatter = (1 - (double) checkDayslatter / workDaylatter);\r\n\t\t\t\t\t\t\t\tDouble earlyRetreatScalatter = ((double) earlyRetreatlatter / workDaylatter);\r\n\t\t\t\t\t\t\t\tDouble laterDayScalatter = ((double) laterDaylatter / workDaylatter);\r\n\t\t\t\t\t\t\t\tDouble singleCheckScalatter = ((double) singleChecklatter / workDaylatter);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setAllDayNotSca(df.format(allDayNotScalatter));\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setEarlyRetreatSca(df.format(earlyRetreatScalatter));\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setLaterDaySca(df.format(laterDayScalatter));\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setSingleCheckSca(df.format(singleCheckScalatter));\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setCheckDay(checkDayslatter);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setEarlyRetreat(earlyRetreatlatter);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setLaterDay(laterDaylatter);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setSingleCheck(singleChecklatter);\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setActCheckDay(actCheckDaylatter1.toString());\r\n\t\t\t\t\t\t\t\tJSONObject jswHlatter = new JSONObject();\r\n\t\t\t\t\t\t\t\tJSONObject jscRlatter = new JSONObject();\r\n\t\t\t\t\t\t\t\tjswHlatter.put(\"A\", wHlatter);\r\n\t\t\t\t\t\t\t\tjscRlatter.put(\"A\", cRlatter);\r\n\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setWorkHours(jswHlatter.toString());\r\n\t\t\t\t\t\t\t\thrStaffAttendance.setCheckRecord(jscRlatter.toString());\r\n\t\t\t\t\t\t\t\tlogger.info(\"StaffAttendanceController staffAttendance 将 【转场后】 数据添加到数据库 \");\r\n\t\t\t\t\t\t\t\tint mlatter = service.insertstaffAttendance(hrStaffAttendance);\r\n\t\t\t\t\t\t\t\tif (mlatter < 0) {\r\n\t\t\t\t\t\t\t\t\trenderError(\"数据添加到数据库:失败\");\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\trenderSuccess(\"数据成功添加到数据库 \");\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\texport++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (export == 0) {\r\n\t\t\t\t\t\trenderError(\"该表中人员均在入场表里找不到相关信息 \");\r\n\t\t\t\t\t\tlogger.info(\"StaffAttendanceController staffAttendance 该表中人员均在入场表里找不到 相关信息\");\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} catch (Exception e) {\r\n\t\t\t\t\trenderError(\"数据导入失败\");\r\n\t\t\t\t\tlogger.error(\"Exception: \", e);\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn true;\r\n\t\t\t}", "public static void main(String[] args) {\n\t\tExcelDataConfig excel=new ExcelDataConfig(\"D:\\\\Batch -2 Workspace\\\\Selenium_Batch_Two\\\\TestData\\\\readexceldemo1.xlsx\");\n\t\tSystem.out.println(excel.getData(0, 0, 0));\n\t}", "public static void main(String[] args) {\n\t\tDataToExcel etd = new DataToExcel();\n\t\ttry {\n\t\t\t\n\t\tlong startTime = System.currentTimeMillis(); // 获取开始时间\n\t\t\tetd.dataToexcel(\"e:/express2014031912.xls\");\n\t\t\tSystem.out.println(\"数据导出成功!\");\n\t\t\t\n\t\tlong endTime = System.currentTimeMillis(); \n\t\tSystem.out.println(\"导出表所需要的时间:\"+(endTime-startTime)+\"ms\");\n\t\t} catch (SQLException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t\tSystem.out.println(\"数据导出失败!\");\n\t\t}\n\t}", "public static void main(String[] args) {\n\t\tString projectLocation=System.getProperty(\"user.dir\");\n\t\tExcelDataConfig excelDataConfig=new ExcelDataConfig(projectLocation+\"/Data/Data.xlsx\");\n\t\t\n\t\texcelDataConfig.writeExcelData(projectLocation+\"/Data/Data.xlsx\");\n\t\t\n\t\texcelDataConfig.getFullExcelData(projectLocation+\"/Data/Data.xlsx\", \"raghu\");\n\t\t\n\t\t\n\t}", "public static void main(String[] args) throws IOException {\n\t\t\r\n\t\tFile fw = new File(\"C:\\\\Files\\\\work.xlsx\");//create file object\r\n\t\t//FileInputStream f = new FileInputStream(fw);//to create connection first create reader.\r\n\t\tXSSFWorkbook wb = new XSSFWorkbook(new FileInputStream(fw));//to go workbook we are using this class\r\n\t\t//XSSFSheet sht = new XSSFSheet();//to go to sheet\r\n\t\t//below line is for getting that sheet\r\n\t\tXSSFSheet sht1 = wb.getSheet(\"Test\");\r\n\t\tXSSFRow row = sht1.getRow(0);\r\nint a = row.getLastCellNum();\r\n\tSystem.out.println(a);\r\n\tfor(int i=0; i<=a ; i++) {\r\n\t\t\r\n\t\tint s = row.getFirstCellNum();\r\n\t\tSystem.out.println(s);\r\n\t\t\r\n\t\t}\r\n\t}", "public static void main(String[] args) throws IOException {\n\t\tWorkbook workbook = new XSSFWorkbook(); \n\t\t\n /* CreationHelper helps us create instances of various things like DataFormat, \n Hyperlink, RichTextString etc, in a format (HSSF, XSSF) independent way */\n\t\tCreationHelper createHelper = workbook.getCreationHelper();\n \n\t\t// Create a sheet\n\t\tSheet sheet = workbook.createSheet(\"Employee\");\n\t\t\n\t\t// create a font for styling header cells\n\t\tFont headerFont =workbook.createFont();\n\t\theaderFont.setBold(true);\n\t\theaderFont.setFontHeightInPoints((short)14);\n\t\theaderFont.setColor(IndexedColors.RED.getIndex());\n\t\t\n\t\t// Create a cellStyle with font \n\t\tCellStyle headerCellStyle=workbook.createCellStyle();\n\t\theaderCellStyle.setFont(headerFont);\n\t\t\n\t\t// Create a row \n\t\tRow headerRow = sheet.createRow(0);\n\t\t\n\t\t// create cell\n\t\tfor(int i=0; i<columns.length; i++){\n\t\t\t\tCell cell=headerRow.createCell(i);\n\t\t\t\tcell.setCellValue(columns[i]);\n\t\t\t\tcell.setCellStyle(headerCellStyle);\n\t\t}\n\t\t\n\t\tCellStyle dateCellStyle = workbook.createCellStyle();\n\t\tdateCellStyle.setDataFormat(createHelper.createDataFormat().getFormat(\"dd-MM-yyyy\"));\n\t\t\n\t\t// Create Other rows and cells with employees data\n\t\tint rowNum=(sheet.getLastRowNum()+1);\n\t\tfor(Employee employee : employees){\n\t\t\tint cellNum = 0;\n\t\t\tRow row=sheet.createRow(rowNum++);\n\t\t\trow.createCell(cellNum++).setCellValue(employee.getName());\n\t\t\trow.createCell(cellNum++).setCellValue(employee.getEmail());\n\t\t\t\n\t\t\tCell dateOfBirthCell=row.createCell(cellNum++);\n\t\t\tdateOfBirthCell.setCellValue(employee.getDateOfBirth());\n\t\t\tdateOfBirthCell.setCellStyle(dateCellStyle);\n\t\t\t\n\t\t\trow.createCell(cellNum).setCellValue(employee.getSalary());\n\t\t\t\n\t\t\t// Resize all columns to fit the content size\n\t for(int i = 0; i < columns.length; i++) {\n\t sheet.autoSizeColumn(i);\n\t }\n\t\t\t\t\n\t\t}\n\t\t\n // Write the output to the file\n\t\t\n OutputStream outputStream=new \n\t\t\t\t\tFileOutputStream(\"C:\\\\Users\\\\gauravd\\\\Downloads\\\\poi-generated-file.xlsx\");\n\t\t\tworkbook.write(outputStream);\n\t\t\t\n\t\t\toutputStream.close();\n\t\t\tworkbook.close();\n\t\t\tSystem.out.println(\"Writer Completed\");\n\t\t\t\n\t}", "public static void main(String[] args) throws IOException, NumberFormatException, InterruptedException {\n\t\tFileInputStream inputFile = new FileInputStream(new File(\"C:/Users/vv297e/Desktop/Selenium/Workspace/KeywordFramework.xlsx\"));\r\n\t\t\r\n\t\tXSSFWorkbook workbook = new XSSFWorkbook(inputFile);\r\n\t\t\r\n\t\tXSSFSheet sheet = workbook.getSheet(\"Facebook\");\r\n\t\t\r\n\t\tInteger noOfRows = sheet.getLastRowNum();\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t//create the browser instance\r\n\t\tSystem.setProperty(\"webdriver.chrome.driver\", \"C:/Users/vv297e/Desktop/Selenium/Webdrivers/chromedriver.exe\");\r\n\t\t\r\n\t\tdriver = new ChromeDriver();\r\n\t\t\r\n\t\tdriver.manage().window().maximize();\r\n\t\t\r\n\t\tdriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);\r\n\t\t\r\n\t\twdWait = new WebDriverWait(driver, 20);\r\n\t\t\r\n\t\t\r\n\t\t//iterating through all excel rows\r\n\t\tfor(int i=1; i<=noOfRows; i++) {\r\n\t\t\t\r\n\t\t\tString keyWord = null;\r\n\t\t\t\r\n\t\t\tString locatorType = null;\r\n\t\t\t\r\n\t\t\tString locatorValue = null;\r\n\t\t\t\r\n\t\t\tString data = null;\r\n\t\t\t\r\n\t\t\t\r\n\t\t\tXSSFCell keyWordCell = sheet.getRow(i).getCell(0, Row.RETURN_BLANK_AS_NULL);\r\n\t\t\t\r\n\t\t\tif(keyWordCell != null) {\r\n\t\t\t\t\r\n\t\t\t\tkeyWord = sheet.getRow(i).getCell(0).toString();\r\n\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tXSSFCell locatorTypeCell = sheet.getRow(i).getCell(1, Row.RETURN_BLANK_AS_NULL);\r\n\t\t\t\r\n\t\t\tif(locatorTypeCell != null) {\r\n\t\t\t\t\r\n\t\t\t\tlocatorType = sheet.getRow(i).getCell(1).toString();\r\n\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tXSSFCell locatorValueCell = sheet.getRow(i).getCell(2, Row.RETURN_BLANK_AS_NULL);\r\n\t\t\t\r\n\t\t\tif(locatorValueCell != null) {\r\n\t\t\t\t\r\n\t\t\t\tlocatorValue = sheet.getRow(i).getCell(2).toString();\r\n\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tXSSFCell dataCell = sheet.getRow(i).getCell(3, Row.RETURN_BLANK_AS_NULL);\r\n\t\t\t\r\n\t\t\tif(dataCell != null) {\r\n\t\t\t\t\r\n\t\t\t\tdata = sheet.getRow(i).getCell(3).toString();\r\n\t\t\r\n\t\t\t}\t\t\r\n\t\t\t\r\n\t\t\tKeywordFramework keywordFramework = new KeywordFramework();\r\n\t\t\t\r\n\t\t\tswitch(keyWord) {\r\n\t\t\t\r\n\t\t\tcase \"openURL\":\r\n\t\t\t\tkeywordFramework.openURL(data);\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase \"sendKeys\":\r\n\t\t\t\tkeywordFramework.sendKeys(locatorType, locatorValue, data);\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase \"click\":\r\n\t\t\t\tkeywordFramework.click(locatorType, locatorValue);\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase \"sleep\":\r\n\t\t\t\tkeywordFramework.sleep(data);\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase \"wdWait\":\r\n\t\t\t\tkeywordFramework.wdWait(locatorType, locatorValue);\t\t\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase \"selectByIndex\":\r\n\t\t\t\tkeywordFramework.selectByIndex(locatorType, locatorValue, data);\t\t\t\t\r\n\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\tcase \"selectByVisibleText\":\r\n\t\t\t\tkeywordFramework.selectByVisibleText(locatorType, locatorValue, data);\t\t\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\r\n\t}", "public void run() throws Exception {\n\t\t\n\t\tdatatable.importExcel(\"C:\\\\OracleATS\\\\OFT\\\\Maaden\\\\Test Data\\\\Global HR(Admn)\\\\HCM_ManageJobs_CreateJobs_CreateProfile_0037.xlsx\", true);\n\t\teffective_Start_Date=(String) datatable.getValue(\"DataSheet\", 0, \"Effective_Start_Date\");\n\t\tinfo(\"Effective_Start_Date is : \"+effective_Start_Date);\n\t\tcreateJob_Name=(String) datatable.getValue(\"DataSheet\", 0, \"CreateJob_Name\");\n\t\tinfo(\"CreateJob_Name is : \"+createJob_Name);\n\t\tcreateJob_Code=(String) datatable.getValue(\"DataSheet\", 0, \"CreateJob_Code\");\n\t\tinfo(\"CreateJob_Code is : \"+createJob_Code);\n\t\tprofile_Code=(String) datatable.getValue(\"DataSheet\", 0, \"Profile_Code\");\n\t\tinfo(\"profile_Code is : \"+profile_Code);\n\t\tprofile_Name=(String) datatable.getValue(\"DataSheet\", 0, \"Profile_Name\");\n\t\tinfo(\"profile_Name is : \"+profile_Name);\n\t\tprofile_Description=(String) datatable.getValue(\"DataSheet\", 0, \"Profile_Description\");\n\t\tinfo(\"CreateJob_Code is : \"+profile_Description);\n\t\t\n\t\thCM_LogIn_LogOut.run();\t\n\t\t\n\t\tweb.link(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.MyClientGroups}}\").click();\n\t\tweb.link(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.WorkforceStructure}}\").click();\n\t\tweb.window(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.web_window}}\").waitForPage(100,true);\n\t\tweb.element(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.web_h2_Jobs}}\").focus();\n\t\tweb.element(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.web_path_svg_outline}}\").focus();\n\t\n\t\tweb.link(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.web_a__FOpt1__FOr1_0__FOSritemN_2}}\").click();\n\t\t{\n\t\t\tthink(0.145);\n\t\t}\n\t\tweb.link(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.web_a__FOpt1__FOr1_0__FOSritemN_3}}\").dblClick();\n\t\t{\n\t\t\tthink(1.559);\n\t\t}\n\t\tweb.element(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.Create}}\").click();\n\t\t{\n\t\t\tthink(1.836);\n\t\t}\n\t\tweb.textBox(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.web_input_text__FOpt1__FOr1_0__FOSritemN_1}}\").click();\n\t\tweb.textBox(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.web_input_text__FOpt1__FOr1_0__FOSritemN_1}}\").setText(effective_Start_Date);\n\t\t//Provide basic details\n\t\tweb.element(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.web_span_Common_Set}}\").click();\n\t\tweb.textBox(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.createJob_Name}}\").click();\n\t\tweb.textBox(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.createJob_Name}}\").setText(createJob_Name);\n\t\tweb.textBox(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.createJob_Name}}\").pressTab();\n\t\tweb.textBox(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.createJob_Code}}\").setText(createJob_Code);\t\t\n\t\t\n\t\tweb.element(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.Next}}\").click();\n\t\t{\n\t\t\tthink(0.074);\n\t\t}\n\t\t//Job Description \n\t\tweb.link(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.web_a__FOpt1__FOr1_0__FOSritemN_5}}\").click();\t\t\n\t\tweb.element(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.web_li_Active}}\")\t.click();\n\t\t\n\t\t//Added Valid Grades\n\t\tweb.element(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.Add_Row}}\").click();\n\t\t{\n\t\t\tthink(2.529);\n\t\t}\n\t\tweb.textBox(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.GradeName}}\").click();\n\t\tweb.textBox(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.GradeName}}\").setText(\"SA.03\");\n\t\t{\n\t\t\tthink(5.529);\n\t\t}\n\t\tweb.textBox(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.GradeName}}\").pressTab();\n\t\t//web.element(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.SelectGrade}}\").click();\n\t\t\n\t\tweb.element(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.Next}}\").click();\n\t\t{\n\t\t\tthink(1.529);\n\t\t}\n\t\t//Evaluation Criteria \n\t\tweb.link(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.EvaluationSystem_DropDown}}\").click();\n\t\tweb.element(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.Custom}}\").click();\n\t\tweb.textBox(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.MeasurementUnit_InputBox}}\").click();\n\t\tweb.element(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.Points}}\").click();\n\t\t{\n\t\t\tthink(1.529);\n\t\t}\n\t\t//Click on Next Button\n\t\tweb.element(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.Next}}\").click();\n\t\t{\n\t\t\tthink(2.529);\n\t\t}\n\t\t\t//Create Profile\n\t\t\tweb.element(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.Create_Profile}}\").click();\n\t\t\tweb.textBox(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.Profile_Code}}\").setText(profile_Code);\t\t\n\t\t\tweb.textBox(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.Profile_Name}}\").setText(profile_Name);\n\t\t\tweb.textArea(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.Profile_Description}}\").setText(profile_Description);\n\t\t\tweb.button(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.Pop_Up_OK}}\").click();\n\t\t\t{\n\t\t\t\tthink(3.529);\n\t\t\t}\n\t\tweb.element(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.Next}}\").click();\n\t\t{\n\t\t\tthink(5.529);\n\t\t}\n\t\tweb.element(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.Submit}}\").click();\n\t\t{\n\t\t\tthink(4.124);\n\t\t}\n\t\tif(web.button(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.Yes}}\").exists(10, TimeUnit.SECONDS)){\n\t\t\tweb.button(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.Yes}}\").click();\t\n\t\t}\t\t\n\t\t{\n\t\t\tthink(4.187);\n\t\t}\n\t\tweb.button(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.web_button__FOpt1__FOr1_0__FOSritemN_1}}\").click();\n\t\t{\n\t\t\tthink(2.187);\n\t\t}\n\t\tweb.textBox(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.web_input_text__FOpt1__FOr1_0__FOSritemN_5}}\").setText(createJob_Code);\n\t\tweb.button(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.Search}}\").click();\n\t\t{\n\t\t\tthink(3.049);\n\t\t}\n\t\tweb.element(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.web_span_Sjit_Job_1}}\").dblClick();\n\t\tweb.element(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.web_span_Sjit_Job_2}}\").focus();\n\t\tweb.element(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.web_span_Sujit_Job_1}}\").focus();\n\t\tweb.element(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.web_span_Active_1}}\").focus();\n\t\t{\n\t\t\tthink(0.029);\n\t\t}\n\t\tweb.window(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.web_window}}\").capturePage();\n\t\tweb.link(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.Tab_EvaluationCriteria}}\").click();\n\t\t{\n\t\t\tthink(2.649);\n\t\t}\n\t\tweb.window(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.web_window}}\").capturePage();\n\t\tweb.link(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.Tab_Profiles}}\").click();\n\t\tweb.window(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.web_window}}\").capturePage();\n\t\tweb.element(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.web_span_Done}}\").click();\n\t\tweb.window(\"{{obj.HCM_ManageJobs_CreateJobs_CreateProfile_0037.web_window}}\").close();\n\t\t\n\t\t\n\t}", "public static void main(String[] args) throws IOException {\nWebDriver driver;\t\r\n//\t\tSystem.setProperty(\"webdriver.chrome.driver\", \"chromedriver.exe\");\r\n//\t\tdriver=new ChromeDriver();\r\n//\t\tdriver.manage().window().maximize();\r\n//\t\tdriver.manage().timeouts().implicitlyWait(30\t,TimeUnit.SECONDS);\r\n//\t\tdriver.get(\"http://newtours.demoaut.com/\");\r\n\t//String[][] data=Excel.getData(\"testData.xlsx\",\"Sheet1\");\r\n//\t\t\t\t\r\n//\t\tfor(int i=1;i<data.length;i++) {\r\n//\t\t\r\n//\t\tString username=data[i][1];\r\n//\t\tString password=data[i][2];\r\n//\t\tdriver.findElement(By.name(\"userName\")).sendKeys(username);\r\n//\t\tdriver.findElement(By.name(\"password\")).sendKeys(password);\r\n\t\t\r\n\t\tSystem.out.println(\"username\");\r\n\t\t}", "public static HashMap<String, String> readFromExcel() throws IOException, WriteException, BiffException {\n\t\t\t\tList<String> keyList = new ArrayList<String>(); \r\n\t\t\t\tList<String> list = new ArrayList<String>(); \r\n\t\t\t\tHashMap<String, String> map = new HashMap<String, String>(); \r\n\t\t\t\tString str = null;\r\n\t\t\t\r\n\t\t\t\ttry\r\n\t\t {\r\n\t\t File f1=new File(\"//ecs-9844/DoNotDelete/JenkinsData/input.xls\");\r\n\t\t //the excel sheet which contains data\r\n\t\t WorkbookSettings ws=new WorkbookSettings();\r\n\t\t ws.setLocale(new Locale(\"er\",\"ER\"));\r\n\t\t Workbook workbook=Workbook.getWorkbook(f1,ws);\r\n\t\t Sheet readsheet=workbook.getSheet(0);\r\n\t\t //Loop to read the KEYS from Excel i.e, 1st column of the Excel\r\n\t\t for(int i=0;i<readsheet.getColumns();i++) {\r\n\t\t \tstr=readsheet.getCell(i,0).getContents().toString();\r\n\t\t \tlist.add(str);\r\n\t\t }\r\n\t\t \tkeyList.addAll(list);\r\n\t\t \t// Hardcoding the first map (key, value) values \r\n\t\t \tmap.put(keyList.get(0), readsheet.getCell(0, 1).getContents().toString());\r\n\t\t \t// Loop to read TEST DATA from the Excel\r\n\t\t for(int i=1;i<readsheet.getRows();i++) {\r\n\t\t for(int j=1;j<readsheet.getColumns();j++) {\t\r\n\t\t str=readsheet.getCell(j,i).getContents().toString();\r\n\t\t list.add(str);\r\n\t\t System.out.println(str);\r\n\t\t map.put(keyList.get(j),str); \r\n\t\t \t}\r\n\t\t }\r\n\t\t //Print the map(key, value) \r\n\t\t System.out.println(\"Print map\");\r\n\t\t System.out.println(map);\r\n\t\t \r\n\t\t }\r\n\t\t catch(IOException e)\r\n\t\t {\r\n\t\t e.printStackTrace();\r\n\t\t }\r\n\r\n\t\t catch(BiffException e)\r\n\t\t {\r\n\t\t e.printStackTrace();\r\n\t\t } catch (Exception e) {\r\n\t\t e.printStackTrace(); \r\n\t\t }\r\n\t\t\t\t\treturn map;\r\n\t}", "public static void main(String[] args) throws Exception\n\t{\n\t\tString[][] sessionInfoData_table = new String[100][100]; // For input session data\n\n\t\t\n\t\tString[][] sessionDate_table = new String[100][100];\n\t\tString[][] nbackByID_table = new String[100][500];\n\t\tString[][] nbackByDate_table = new String[100][100];\n\t\tString[][] sudokuByID_table = new String[100][100];\n\t\tString[][] sudokuByDate_table = new String[100][100]; //Added these rows for the 5 organized tables, mirrors \"organized table\" A.P\n\t\t\n//\t\tString[][] organizedTable = new String[100000][50]; //Table that receives the data sorted by user ID\n//\t\tString[][] organizedTable2 = new String[100000][50]; // Table that receives the data sorted by Date for each user ID\n//\t\t//boolean knownID[] = new boolean[100000]; // It just checks whether a desired operation has been applied to an ID\n\t\t\n//\t\tint avgsReport_row_num = 0;\n//\t\tint avgsReport_col_num = 0;\n//\t\tint loginReport_row_num = 0;\n//\t\tint loginReport_col_num = 0;\n//\t\tint sudokuReport_row_num = 0;\n//\t\tint sudokuReport_col_num = 0;\n//\t\tint nbackReport_row_num = 0;\n//\t\tint nbackReport_col_num = 0; // Added for raw data A.P\n\t\tint sessionInfoData_row_num = 0;\n\t\tint sessionInfoData_col_num = 0;\n\t\t\n\t\tint sessionDate_row_num = 0; // Total of rows in the SWM excel sheet\n\t\tint sessionDate_col_num = 0; // Total of columns in the SWM excel sheet\n\t\tString[][] sessionDate = new String[10000][50]; // Store the information from the sessionDate excel file\n\t\tString[][] timeOfDay = new String[10000][3]; //Store the preDate and postDate time of day\n\t\t\n\t\t//In case need inputed data\t\t\n\t\t//String input = new String();\t\t\n\t\t//Input data by user (Sheida)\n\t\t//Input data storage\n\t\t//InputStreamReader isr = new InputStreamReader(System.in);\n\t\t//BufferedReader br = new BufferedReader(isr);\n\t\t//input = br.readLine();\n\t\t//int number = 0;\n\t\t//number = Integer.parseInt(input);\n\t\t\n\t\t\t\t\n\t\t//======================================================================================================================//\n\t\t//======================================================================================================================//\n\t\t\t\n\t\t/*First things first: get the output files and the session data file. Outputs are all in a folder \"allReports\" (to be in the system \n\t\t * library where all resources for a program are stored)\n\t\t */\n\t\tFile[] files = null;\n\t\tFile[] responses = null;\n\t\ttry {\n\t\t\t//Start with output files; store them in an array files[]\n\t\t\tFile inputFolder = new File(\"allReports\"); //this will implements the single file algorithm below\n\t \tif(inputFolder.isDirectory()) //check if said file is a directory\n\t \t{\n\t \t\t//The following MUST OCCUR:\n\t \t\tfiles = inputFolder.listFiles(); // create array to hold all files in the directory, regardless of extension; puts all files in\n\t \t\tfor (int i = 0; i < files.length; i++) \n\t \t\t{\n\t \t\t\tSystem.out.println(files[i].getName()); //get name of each file in the directory; print out\n\t \t\t\t//NEED TO REMOVE FIRST X SPACES IN EACH FILE\n\t\t\t\t}\n\t \t}\n\t \t\n\t \t//Get the text files containing data with response times\n\t \t\n\t \tFile nbkResponses = new File(\"NbkResponses\");\n\t \t\n\t \tif(nbkResponses.isDirectory()) //check if said file is a directory\n\t \t{\n\t \t\t//The following MUST OCCUR:\n\t \t\tresponses = nbkResponses.listFiles(); // create array to hold all files in the directory, regardless of extension; puts all files in\n\t \t\tfor (int i = 0; i < files.length; i++) \n\t \t\t{\n\t \t\t\tSystem.out.println(responses[i].getName()); //get name of each file in the directory; print out\n\t \t\t\t//NEED TO REMOVE FIRST X SPACES IN EACH FILE\n\t\t\t\t}\n\t \t}\n\t \t\n//\t \tFile inputFile = new File(\"Report_ID_11031301114.xml\");\n//\t DocumentBuilderFactory dbFactory \n//\t = DocumentBuilderFactory.newInstance();\n//\t DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();\n//\t Document doc = dBuilder.parse(inputFile);\n//\t doc.getDocumentElement().normalize();\n//\t NodeList rowList = doc.getElementsByTagName(\"Row\");\n//\t for (int temp = 0; temp < rowList.getLength(); temp++) {\n//\t Element nNode = (Element) rowList.item(temp);\n//\t NodeList cellList = nNode.getElementsByTagName(\"Cell\");\n//\t System.out.println(\"Row \"+temp);\n//\t StringBuffer content = new StringBuffer();\n//\t for (int j = 0; j < cellList.getLength(); j++) {\n//\t \tNode abc = cellList.item(j);\n//\t \tString text = ((Element)abc.getChildNodes()).getTextContent();\n//\t \tcontent.append(text+\",\");\n//\n//\t }\n//\t \tSystem.out.println(\"Row \"+temp + \"=\"+content);\n//\t }\n\t \t\n\t \t//Next, get the sessionDates as a .xlsx file; put everything into a 2D array \"sessionInfoData_table\"\n\t \tFile a = new File(\"NICT_Sessiondatesjan27162016.xlsx\");\n\t \tFileInputStream inputStream = new FileInputStream(a);\n\t \tWorkbook sessionDatesInput = new XSSFWorkbook(inputStream);\n\t \tSheet sessionInfoData = sessionDatesInput.getSheetAt(0);\n\t \tfor(Iterator<Row> rit = sessionInfoData.rowIterator(); rit.hasNext();)\n\t \t{\n\t \t\tRow row = rit.next();\n\t \t\tfor(Iterator<Cell> cit = row.cellIterator(); cit.hasNext();)\n\t \t\t{\n\t \t\t\tCell cell = cit.next(); //Reads the cells in the file A.P\n\t \t\t\tcell.setCellType(Cell.CELL_TYPE_STRING); //reads each column as a string, and later, if it's a number, can convert to a number\n\t \t\t\tsessionInfoData_table[cell.getRowIndex()][cell.getColumnIndex()] = cell.getStringCellValue();\n\t \t\t}\n\t \t\tsessionInfoData_col_num = row.getPhysicalNumberOfCells();\n\t \t}\n\t \tsessionInfoData_row_num = sessionInfoData.getPhysicalNumberOfRows();\n\t \tsessionDatesInput.close();\n\t \t\n\t \t//Finished reading in all inputs\n\t \t\n\t\t} catch (FileNotFoundException e){\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\t\n\t \n\t\t//Now, initialize all sheets\n\t Workbook outputFile = new XSSFWorkbook(); // Empty Excel output file is initialized\n\t\t\n\t \t//Create the sessionDates sheet and have all data stored\n\t \tsessionDate_table = sessionDateSheetInit(sessionInfoData_table,sessionInfoData_row_num, sessionInfoData_col_num, sessionDate_table, outputFile); //Adds to the sheet and creates the 2d array to use for other methods\n\t\n \t//Initialize all of the following tables with titles\n\t nbackByID_table = nbackByIDSheetInit(nbackByID_table);\n\t \tnbackByDate_table = nbackByDateSheetInit(nbackByDate_table);\n\t sudokuByID_table = sudokuByIDSheetInit(sudokuByID_table);\n\t sudokuByDate_table = sudokuByDateSheetInit(sudokuByDate_table);\n\t\t\n\t //Now, for the ID sheets, call nbackByIDSheet and sudokuByIDSheet with outputs of 2D arrays; start inserting rows into their respective tables\n\t if(files!=null)\n\t {\n\t \tfor(int i = 0; i<files.length;i++)//For each user's file\n\t \t{\n\t \t\t\n\t \t\tnbackByIDSheet(files[i],responses,sessionDate_table,nbackByID_table,i+1); //Adds a new row to nbackByID at line i+1; NEEDS ARRAY OF TEXT FILES A.P\n\t \t\tsudokuByIDSheet(files[i],sessionDate_table,sudokuByID_table,i+1); //Adds a new row to sudokuByID\n\t \t}\n\t \t\n\t }\n\t \n\t \n\t //Get the date and time \t\n\t DateFormat dateFormat = new SimpleDateFormat(\"yyyy_MM_dd\");\t\n\t Date date = new Date();\n\t String fileDate = dateFormat.format(date);\n\t System.out.println(fileDate); //Print out today's date\n\t\t\n\t //Now, take all the completed 2D arrays and put them into sheets\n\t //First, SessionDate\n\t Sheet sessionDate_sheet = outputFile.createSheet(\"SessionDate\");\n\t\tCell cell_w;\n\t\tfor(int r = 0 ; r < sessionInfoData_row_num ; r++) //make x rows where x is the total number of rows of users + title row\n\t\t{\n\t\t\tRow row = sessionDate_sheet.createRow(r);\n\t\t\tfor(int c = 0 ; c < 14 ; c++) //There are 14 columns\n\t\t\t{\n\t\t\t\t/*if(r == 0||c == 11) //If it's either the titles row or the examiner column, don't turn the cell type into a number CHECK A.P\n\t\t\t\t{\n\t\t\t\t\tcell_w = row.createCell(c);\n\t\t\t\t\tcell_w.setCellType(Cell.CELL_TYPE_STRING);\n\t\t\t\t\tcell_w.setCellValue(sessionDate_table[r][c].toString());\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tcell_w = row.createCell(c);\n\t\t\t\t\tif(sessionDate_table[r][c].equals(\"\")) //If the cell is empty\n\t\t\t\t\t{\n\t\t\t\t\t\tcell_w.setCellType(Cell.CELL_TYPE_STRING);\n\t\t\t\t\t\tcell_w.setCellValue(\"\");\n\t\t\t\t\t}\t\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tcell_w.setCellType(Cell.CELL_TYPE_NUMERIC);\n\t\t\t\t\t\tcell_w.setCellValue(Double.parseDouble(sessionDate_table[r][c].toString()));\n\t\t\t\t\t}\n\t\t\t\t}*/\n\t\t\t\tcell_w = row.createCell(c);\n\t\t\t\tcell_w.setCellType(Cell.CELL_TYPE_STRING);\n\t\t\t\tcell_w.setCellValue(sessionDate_table[r][c].toString());\n\t\t\t}\n\t\t}\n\t\t\n\t\t//Next, nbackByID\n\t\tSheet nbackByID_sheet = outputFile.createSheet(\"nbackByID\");\n\t\t\n\t\tcell_w = null;\n\t\t\n\t\tfor(int r = 0 ; r < files.length+1 ; r++)//+1 b/c one row for the titles\n\t\t{\n\t\t\tRow row = nbackByID_sheet.createRow(r);\n\t\t\tfor(int c = 0 ; c < 128 ; c++) //# of columns\n\t\t\t{\n\t\t\t\t/*if(r == 0)\n\t\t\t\t{\n\t\t\t\t\tcell_w = row.createCell(c);\n\t\t\t\t\tcell_w.setCellType(Cell.CELL_TYPE_STRING);\n\t\t\t\t\tcell_w.setCellValue(nbackByID_table[r][c].toString());\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tcell_w = row.createCell(c);\n\t\t\t\t\tif(nbackByID_table[r][c].equals(\"\"))\n\t\t\t\t\t{\n\t\t\t\t\t\tcell_w.setCellType(Cell.CELL_TYPE_STRING);\n\t\t\t\t\t\tcell_w.setCellValue(\"\");\n\t\t\t\t\t}\t\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tcell_w.setCellType(Cell.CELL_TYPE_NUMERIC);\n\t\t\t\t\t\tcell_w.setCellValue(Double.parseDouble(nbackByID_table[r][c].toString()));\n\t\t\t\t\t}\n\t\t\t\t}*/\n\t\t\t\tcell_w = row.createCell(c);\n\t\t\t\tcell_w.setCellType(Cell.CELL_TYPE_STRING);\n\t\t\t\tcell_w.setCellValue(nbackByID_table[r][c].toString());\n\t\t\t}\n\t\t}\n\t\t\n\t\t//Next, nbackByDate\n\t\tSheet nbackByDate_sheet = outputFile.createSheet(\"nbackByDate\");\n\t\t\n\t\tcell_w = null;\n\t\t\n\t\tfor(int r = 0 ; r < nbackByDate_table.length ; r++)\n\t\t{\n\t\t\tRow row = nbackByDate_sheet.createRow(r);\n\t\t\tfor(int c = 0 ; c < 52 ; c++)\n\t\t\t{\n\t\t\t\t/*if(r == 0)\n\t\t\t\t{\n\t\t\t\t\tcell_w = row.createCell(c);\n\t\t\t\t\tcell_w.setCellType(Cell.CELL_TYPE_STRING);\n\t\t\t\t\tcell_w.setCellValue(nbackByDate_table[r][c].toString());\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tcell_w = row.createCell(c);\n\t\t\t\t\tif(nbackByDate_table[r][c].equals(\"\"))\n\t\t\t\t\t{\n\t\t\t\t\t\tcell_w.setCellType(Cell.CELL_TYPE_STRING);\n\t\t\t\t\t\tcell_w.setCellValue(\"\");\n\t\t\t\t\t}\t\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tcell_w.setCellType(Cell.CELL_TYPE_NUMERIC);\n\t\t\t\t\t\tcell_w.setCellValue(Double.parseDouble(nbackByDate_table[r][c].toString()));\n\t\t\t\t\t}\n\t\t\t\t}*/\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\t//Next, SudokuByID\n\t\tSheet sudokuByID_sheet = outputFile.createSheet(\"sudokuByID\");\n\t\t\n\t\tcell_w = null;\n\t\t\n\t\tfor(int r = 0 ; r < files.length+1 ; r++)//num rows + 1 for the title row\n\t\t{\n\t\t\tRow row = sudokuByID_sheet.createRow(r);\n\t\t\tfor(int c = 0 ; c < 52 ; c++)\n\t\t\t{\n\t\t\t\t/*if(r == 0)\n\t\t\t\t{\n\t\t\t\t\tcell_w = row.createCell(c);\n\t\t\t\t\tcell_w.setCellType(Cell.CELL_TYPE_STRING);\n\t\t\t\t\tcell_w.setCellValue(sudokuByID_table[r][c].toString());\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tcell_w = row.createCell(c);\n\t\t\t\t\tif(sudokuByID_table[r][c].equals(\"\"))\n\t\t\t\t\t{\n\t\t\t\t\t\tcell_w.setCellType(Cell.CELL_TYPE_STRING);\n\t\t\t\t\t\tcell_w.setCellValue(\"\");\n\t\t\t\t\t}\t\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tcell_w.setCellType(Cell.CELL_TYPE_NUMERIC);\n\t\t\t\t\t\tcell_w.setCellValue(Double.parseDouble(sudokuByID_table[r][c].toString()));\n\t\t\t\t\t}\n\t\t\t\t}*/\n\t\t\t\tcell_w = row.createCell(c);\n\t\t\t\tcell_w.setCellType(Cell.CELL_TYPE_STRING);\n\t\t\t\tcell_w.setCellValue(sudokuByID_table[r][c].toString());\n\t\t\t}\n\t\t}\n\t\t\n\t\t//Next, SudokuByID\n\t\t\tSheet sudokuByDate_sheet = outputFile.createSheet(\"sudokuByDate\");\n\t\t\t\t\n\t\t\tcell_w = null;\n\t\t\t\t\n\t\t\t\tfor(int r = 0 ; r < sudokuByDate_table.length ; r++)\n\t\t\t\t{\n\t\t\t\t\tRow row = sudokuByDate_sheet.createRow(r);\n\t\t\t\t\tfor(int c = 0 ; c < 52 ; c++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(r == 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcell_w = row.createCell(c);\n\t\t\t\t\t\t\tcell_w.setCellType(Cell.CELL_TYPE_STRING);\n\t\t\t\t\t\t\tcell_w.setCellValue(sudokuByDate_table[r][c].toString());\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcell_w = row.createCell(c);\n\t\t\t\t\t\t\tif(sudokuByDate_table[r][c].equals(\"\"))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcell_w.setCellType(Cell.CELL_TYPE_STRING);\n\t\t\t\t\t\t\t\tcell_w.setCellValue(\"\");\n\t\t\t\t\t\t\t}\t\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcell_w.setCellType(Cell.CELL_TYPE_NUMERIC);\n\t\t\t\t\t\t\t\tcell_w.setCellValue(Double.parseDouble(sudokuByDate_table[r][c].toString()));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t \n\t //Output the completed excel file!\n\t try{\t\n\t \tFileOutputStream output = new FileOutputStream(\"C:/Users/Anita/Documents/School/uOttawa/FilteredData_\"+fileDate+\".xlsx\"); //Changed directory to fit comp A.P\n\t \toutputFile.write(output);\n\t \toutput.close();\n\t \toutputFile.close();\n\t }\n\t catch (Exception e)\n\t\t{\n\t\t\te.printStackTrace();\n\t\t}\n//\t\ttry\n//\t\t\t{\n//\t\t\t\t//Open an excel file\n//\t\t\t\tWorkbook workbook = new XSSFWorkbook(new FileInputStream(fileChooser.getSelectedFile())); //HSSF to XSSF A.P\n//\t\t\t\t\n//\t\t\t\t//The Following reads in data from the avgsReport sheet A.P\n//\t\t\t\tSheet avgsReport = workbook.getSheetAt(0);\n//\t\t\t\tfor(Iterator<Row> rit = avgsReport.rowIterator(); rit.hasNext();)\n//\t\t\t\t{\n//\t\t\t\t\tRow row = rit.next();\n//\t\t\t\t\tfor(Iterator<Cell> cit = row.cellIterator(); cit.hasNext();)\n//\t\t\t\t\t{\n//\t\t\t\t\t\tCell cell = cit.next(); //Reads the cells in the file A.P\n//\t\t\t\t\t\tcell.setCellType(Cell.CELL_TYPE_STRING); //reads each column as a string, and later, if it's a number, can convert to a number\n//\t\t\t\t\t\t//System.out.print(cell.getStringCellValue()+\"\\t\\t\");\n//\t\t\t\t\t\tavgsReport_table[cell.getRowIndex()][cell.getColumnIndex()] = cell.getStringCellValue();\n//\t\t\t\t\t}\n//\t\t\t\t\t//System.out.println();\n//\t\t\t\t\tavgsReport_col_num = row.getPhysicalNumberOfCells();\n//\t\t\t\t}\n//\t\t\t\tavgsReport_row_num = avgsReport.getPhysicalNumberOfRows();\n//\t\t\t\t\n//\t\t\t\t//The Following reads in data from the loginReport sheet A.P\n//\t\t\t\tSheet loginReport = workbook.getSheetAt(1);\n//\t\t\t\tfor(Iterator<Row> rit = loginReport.rowIterator(); rit.hasNext();)\n//\t\t\t\t{\n//\t\t\t\t\tRow row = rit.next();\n//\t\t\t\t\tfor(Iterator<Cell> cit = row.cellIterator(); cit.hasNext();)\n//\t\t\t\t\t{\n//\t\t\t\t\t\tCell cell = cit.next(); //Reads the cells in the file A.P\n//\t\t\t\t\t\tcell.setCellType(Cell.CELL_TYPE_STRING); //reads each column as a string, and later, if it's a number, can convert to a number\n//\t\t\t\t\t\tloginReport_table[cell.getRowIndex()][cell.getColumnIndex()] = cell.getStringCellValue();\n//\t\t\t\t\t}\n//\t\t\t\t\tloginReport_col_num = row.getPhysicalNumberOfCells();\n//\t\t\t\t}\n//\t\t\t\tloginReport_row_num = loginReport.getPhysicalNumberOfRows();\n//\t\t\t\t\n//\t\t\t\t//The Following reads in data from the sudokuReport sheet A.P\n//\t\t\t\tSheet sudokuReport = workbook.getSheetAt(2);\n//\t\t\t\tfor(Iterator<Row> rit = sudokuReport.rowIterator(); rit.hasNext();)\n//\t\t\t\t{\n//\t\t\t\t\tRow row = rit.next();\n//\t\t\t\t\tfor(Iterator<Cell> cit = row.cellIterator(); cit.hasNext();)\n//\t\t\t\t\t{\n//\t\t\t\t\t\tCell cell = cit.next(); //Reads the cells in the file A.P\n//\t\t\t\t\t\tcell.setCellType(Cell.CELL_TYPE_STRING); //reads each column as a string, and later, if it's a number, can convert to a number\n//\t\t\t\t\t\tsudokuReport_table[cell.getRowIndex()][cell.getColumnIndex()] = cell.getStringCellValue();\n//\t\t\t\t\t}\n//\t\t\t\t\tsudokuReport_col_num = row.getPhysicalNumberOfCells();\n//\t\t\t\t}\n//\t\t\t\tsudokuReport_row_num = sudokuReport.getPhysicalNumberOfRows();\n//\t\t\t\t\n//\t\t\t\t//The Following reads in data from the nbackReport sheet A.P\n//\t\t\t\tSheet nbackReport = workbook.getSheetAt(3);\n//\t\t\t\tfor(Iterator<Row> rit = nbackReport.rowIterator(); rit.hasNext();)\n//\t\t\t\t{\n//\t\t\t\t\tRow row = rit.next();\n//\t\t\t\t\tfor(Iterator<Cell> cit = row.cellIterator(); cit.hasNext();)\n//\t\t\t\t\t{\n//\t\t\t\t\t\tCell cell = cit.next(); //Reads the cells in the file A.P\n//\t\t\t\t\t\tcell.setCellType(Cell.CELL_TYPE_STRING); //reads each column as a string, and later, if it's a number, can convert to a number\n//\t\t\t\t\t\tnbackReport_table[cell.getRowIndex()][cell.getColumnIndex()] = cell.getStringCellValue();\n//\t\t\t\t\t}\n//\t\t\t\t\tnbackReport_col_num = row.getPhysicalNumberOfCells();\n//\t\t\t\t}\n//\t\t\t\tnbackReport_row_num = nbackReport.getPhysicalNumberOfRows();\n//\t\t\t\t\n//\t\t\t\tworkbook.close(); //end of reading from single output file A.P\n//\t\t\t\t\n//\t\t\t} catch (FileNotFoundException x){\n//\t\t\t\tx.printStackTrace();\n//\t\t\t} catch (IOException x) {\n//\t\t\t\tx.printStackTrace();\n//\t\t\t}\n//\t\telse\n//\t\t{\n//\t\t\tSystem.out.println(\"No file has been chosen.\");\n//\t\t}\t\n//\t\t\t//Finished copying data\n\t\t\n\t\t\n\t\t//======================================================================================================================//\n\t\t//======================================================================================================================//\n\t\t\n\t\t\n\t\t//======================================================================================================================//\n\t\t//======================================================================================================================//\n\t\t\n\t\t//General Operation\n\t\t//Convert sessionDate from string to numbers\n\t\tdouble [][] sessionDate_asNum = new double[10000][15];\n\t\tfor(int row = 1 ; row < sessionDate_row_num ; row++)\n\t\t{\n\t\t\tfor( int col = 1 ; col < (sessionDate_col_num-3) ; col++)\n\t\t\t{\n\t\t\t\tif(!(sessionDate[row][col].equals(\"NULL\")))\n\t\t\t\t{\t\t\t\t\t\n\t\t\t\t\tsessionDate_asNum[row][col] = (Double.parseDouble(sessionDate[row][col].toString()));\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif( col == 6)\n\t\t\t\t\t{\n\t\t\t\t\t\tSystem.out.println(\"The user \" + sessionDate[row][0].toString() + \" doesn't have a last lab session.\");\n\t\t\t\t\t\tsessionDate_asNum[row][col] = sessionDate_asNum[row][col-1] + 7; //If sessionDate is NULL then add 7 day since last lab\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tSystem.out.println(\"The user \" + sessionDate[row][0].toString() + \" doesn't have the week\" + (col-1) + \" lab session.\");\n\t\t\t\t\t\tsessionDate_asNum[row][col] = sessionDate_asNum[row][col-1] + 7; //If sessionDate is NULL then add 7 day since last lab\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\t\t\n\t\t//Finished converting\t\n\t}", "@Override\n public void escribirExcel(String pathPlan, String pathDeex, String nombResa) throws Exception {\n LOGGER.info(\"Iniciando escritura del archivo en excel\");\n\n LOGGER.debug(\"Ruta de la plantilla {}\", pathPlan);\n LOGGER.debug(\"Ruta donde se va a escribir la plantilla {} \", pathDeex);\n\n //Archivo Origen\n File archOrig = null;\n //Archivo Destino\n File archDest = null;\n //ruta completa de la plantilla\n String pathDefi = pathDeex + File.separator + nombResa;\n //Registra del archivo de excel\n Row row = null;\n //Celda en el archivo de excel\n Cell cell;\n //Hoja de excel\n Sheet sheet = null;\n //Numero de hojas en el libro de excel\n int numberOfSheets;\n //Constantes\n final String NOMBRE_HOJA = \"RESULTADOS EVALUACION\";\n // Fila y columna para \n int fila = 0;\n int columna = 0;\n //Fila inicio evidencia\n int filaEvid;\n\n try {\n archOrig = new File(pathPlan);\n\n if (!archOrig.exists()) {\n LOGGER.debug(\"Plantilla no existe en la ruta {} \", pathPlan);\n throw new IOException(\"La plantilla no existe en la ruta \" + pathPlan);\n }\n\n archDest = new File(pathDeex);\n\n if (!archDest.exists()) {\n LOGGER.debug(\"Ruta no existe donde se va a depositar el excel {} , se va a crear\", pathDeex);\n archDest.mkdirs();\n }\n\n LOGGER.info(\"Ruta del archivo a crear {}\", pathDefi);\n archDest = new File(pathDefi);\n\n if (!archDest.exists()) {\n LOGGER.info(\"No existe el archivo en la ruta {}, se procede a la creacion \", pathDefi);\n archDest.createNewFile();\n } else {\n\n LOGGER.info(\"el archivo que se requiere crear, ya existe {} se va a recrear\", pathDefi);\n archDest.delete();\n LOGGER.info(\"archivo en la ruta {}, borrado\", pathDefi);\n archDest.createNewFile();\n\n LOGGER.info(\"archivo en la ruta {}, se vuelve a crear\", pathDefi);\n\n }\n\n LOGGER.info(\"Se inicia con la copia de la plantilla de la ruta {} a la ruta {} \", pathPlan, pathDefi);\n try (FileChannel archTror = new FileInputStream(archOrig).getChannel();\n FileChannel archTrDe = new FileOutputStream(archDest).getChannel();) {\n\n archTrDe.transferFrom(archTror, 0, archTror.size());\n\n LOGGER.info(\"Termina la copia del archivo\");\n\n } catch (Exception e) {\n LOGGER.info(\"Se genera un error con la transferencia {} \", e.getMessage());\n throw new Exception(\"Error [\" + e.getMessage() + \"]\");\n }\n\n LOGGER.info(\"Se inicia con el diligenciamiento del formato \");\n\n LOGGER.info(\"Nombre Archivo {}\", archDest.getName());\n if (!archDest.getName().toLowerCase().endsWith(\"xls\")) {\n throw new Exception(\"La plantilla debe tener extension xls\");\n }\n\n try (FileInputStream fis = new FileInputStream(archDest);\n Workbook workbook = new HSSFWorkbook(fis);\n FileOutputStream fos = new FileOutputStream(archDest);) {\n\n if (workbook != null) {\n numberOfSheets = workbook.getNumberOfSheets();\n LOGGER.debug(\"Numero de hojas {}\", numberOfSheets);\n\n LOGGER.info(\"Hoja seleccionada:{}\", NOMBRE_HOJA);\n sheet = workbook.getSheetAt(0);\n\n fila = 5;\n\n LOGGER.info(\"Se inicia con la escritura de las oportunidades de mejora\");\n\n LOGGER.info(\"Creando las celdas a llenar\");\n\n for (int numeFila = fila; numeFila < this.listOpme.size() + fila; numeFila++) {\n\n LOGGER.info(\"Fila {} \", numeFila);\n if (numeFila > 8) {\n\n copyRow(workbook, sheet, numeFila - 2, numeFila - 1);\n sheet.addMergedRegion(new CellRangeAddress(numeFila - 1, numeFila - 1, 1, 4));\n sheet.addMergedRegion(new CellRangeAddress(numeFila - 1, numeFila - 1, 6, 7));\n\n }\n\n }\n\n LOGGER.info(\"Terminando de llenar celdas\");\n LOGGER.info(\"Poblar registros desde {} \", fila);\n\n for (OptuMejo optuMejo : this.listOpme) {\n\n LOGGER.debug(\"Se va actualizar la linea {} celda 1. Valor Capacitacion tecnica {}\", fila, optuMejo.getCapaTecn());\n row = null;\n cell = null;\n\n row = sheet.getRow(fila);\n cell = row.getCell(1);\n\n cell.setCellValue(optuMejo.getCapaTecn());\n\n LOGGER.debug(\"Se va actualizar la linea {} celda 6. Valor compromisos del area {}\", fila, optuMejo.getComporta());\n row = null;\n cell = null;\n\n row = sheet.getRow(fila);\n cell = row.getCell(6);\n\n cell.setCellValue(optuMejo.getComporta());\n\n fila++;\n\n }\n LOGGER.info(\"Termino de poblar el registro hasta {} \", fila);\n //Ajustando los formulario\n if (fila > 8) {\n sheet.addMergedRegion(new CellRangeAddress(fila, fila, 1, 7));\n sheet.addMergedRegion(new CellRangeAddress(fila + 1, fila + 1, 2, 6));\n } else {\n fila = 9;\n }\n\n /* sheet.addMergedRegion(new CellRangeAddress(fila, fila, 1, 7));\n sheet.addMergedRegion(new CellRangeAddress(fila + 1, fila + 1, 2, 6));*/\n LOGGER.info(\"Fin de la escritura de las oportunidades de mejora\");\n\n LOGGER.info(\"Se inicia la escritura de las evidencias \");\n\n fila += 2;\n filaEvid = fila + 5;\n\n LOGGER.info(\"Se inicia la creacion de las celdas desde el registro {} \", fila);\n\n for (Evidenci evidenci : this.listEvid) {\n\n if (filaEvid < fila) {\n copyRow(workbook, sheet, fila - 1, fila);\n\n }\n\n LOGGER.debug(\"Se va actualizar la linea {} celda 1. Valor Fecha {}\", fila, evidenci.getFecha());\n row = null;\n cell = null;\n\n row = sheet.getRow(fila);\n cell = row.getCell(1);\n\n cell.setCellValue(evidenci.getFecha());\n\n LOGGER.debug(\"Se va actualizar la linea {} celda 6. Valor compromisos del area {}\", fila, evidenci.getDescripc());\n row = null;\n cell = null;\n\n row = sheet.getRow(fila);\n cell = row.getCell(2);\n\n cell.setCellValue(evidenci.getDescripc());\n\n sheet.addMergedRegion(new CellRangeAddress(fila, fila, 2, 6));\n\n fila++;\n\n }\n\n LOGGER.info(\"Fin de la escritura de las Evidencias\");\n\n LOGGER.info(\"Inicio de escritura de calificaciones\");\n //Ajustando los formulario - resultado\n\n /*sheet.addMergedRegion(new CellRangeAddress(fila, fila, 1, 7));*/\n if (fila > filaEvid) {\n LOGGER.info(\"Fila a ejecutar {} \", fila);\n sheet.addMergedRegion(new CellRangeAddress(fila + 1, fila + 1, 2, 5));\n sheet.addMergedRegion(new CellRangeAddress(fila + 2, fila + 2, 2, 5));\n sheet.addMergedRegion(new CellRangeAddress(fila + 3, fila + 3, 2, 5));\n sheet.addMergedRegion(new CellRangeAddress(fila + 4, fila + 4, 2, 5));\n sheet.addMergedRegion(new CellRangeAddress(fila + 1, fila + 1, 6, 7));\n sheet.addMergedRegion(new CellRangeAddress(fila + 2, fila + 4, 6, 7));\n //Firma del evaluado ajuste\n sheet.addMergedRegion(new CellRangeAddress(fila + 5, fila + 5, 1, 3));\n sheet.addMergedRegion(new CellRangeAddress(fila + 5, fila + 5, 4, 6));\n\n //Ajustando recursos\n sheet.addMergedRegion(new CellRangeAddress(fila + 6, fila + 6, 1, 7));\n\n sheet.addMergedRegion(new CellRangeAddress(fila + 8, fila + 8, 1, 7));\n sheet.addMergedRegion(new CellRangeAddress(fila + 10, fila + 10, 1, 7));\n\n } else {\n fila = filaEvid + 1;\n LOGGER.info(\"Fila a ejecutar {} \", fila);\n }\n\n LOGGER.debug(\"Se va actualizar la linea {} celda 2. Valor Excelente {}\", fila + 2, this.excelent);\n row = null;\n cell = null;\n\n row = sheet.getRow(fila + 2);\n cell = row.getCell(2);\n\n cell.setCellValue((this.excelent != null ? this.excelent : \"\"));\n\n LOGGER.debug(\"Se va actualizar la linea {} celda 2. Valor satisfactorio {}\", fila + 3, this.satisfac);\n row = null;\n cell = null;\n\n row = sheet.getRow(fila + 3);\n cell = row.getCell(2);\n\n cell.setCellValue((this.satisfac != null ? this.satisfac : \"\"));\n\n LOGGER.debug(\"Se va actualizar la linea {} celda 3. Valor no satisfactorio {}\", fila + 4, this.noSatisf);\n row = null;\n cell = null;\n\n row = sheet.getRow(fila + 4);\n cell = row.getCell(2);\n\n cell.setCellValue((this.noSatisf != null ? this.noSatisf : \"\"));\n\n //Ajustando Total Calificacion en Numero\n LOGGER.debug(\"Se va actualizar la linea {} celda 2. Valor total calificacion {}\", fila + 2, this.numeToca);\n row = null;\n cell = null;\n\n row = sheet.getRow(fila + 2);\n cell = row.getCell(6);\n\n cell.setCellValue(this.numeToca);\n\n LOGGER.info(\"Fin de escritura de calificaciones\");\n\n LOGGER.info(\"Inicio de escritura de interposicion de recursos\");\n\n LOGGER.debug(\"Se va actualizar la linea {} celda 5. Valor si interpone recursos {}\", fila + 7, this.siinRecu);\n row = null;\n cell = null;\n\n row = sheet.getRow(fila + 7);\n cell = row.getCell(6);\n\n cell.setCellValue(\"SI:\" + (this.siinRecu != null ? this.siinRecu : \"\"));\n\n LOGGER.debug(\"Se va actualizar la linea {} celda 5. Valor si interpone recursos {}\", fila + 7, this.noinRecu);\n row = null;\n cell = null;\n\n row = sheet.getRow(fila + 7);\n cell = row.getCell(7);\n\n cell.setCellValue(\"NO:\" + (this.noinRecu != null ? this.noinRecu : \"\"));\n \n \n LOGGER.debug(\"Se va actualizar la linea {} celda 5. Valor si interpone recursos {}\", fila + 8, this.fech);\n \n row = null;\n cell = null;\n\n row = sheet.getRow(fila + 8);\n cell = row.getCell(1);\n\n cell.setCellValue(\"FECHA:\" + (this.fech != null ? this.fech : \"\"));\n \n \n\n LOGGER.info(\"Fin de escritura de interposicion de recursos\");\n\n //Ajustando recursos\n workbook.write(fos);\n\n } else {\n throw new Exception(\"No se cargo de manera adecuada el archivo \");\n }\n\n } catch (Exception e) {\n System.out.println(\"\" + e.getMessage());\n }\n\n } catch (Exception e) {\n LOGGER.error(e.getMessage());\n throw new Exception(e.getMessage());\n }\n }", "public static void main(String[] args) throws IOException {\n\t\t \n\t\tFileOutputStream fileOut1 = new FileOutputStream(\"D:\\\\Test9.xls\");\n\t\tWorkbook wb1 = new XSSFWorkbook();\t\t\n\t\t\n\t\tSheet s2=wb1.createSheet(\"Abi\");\n\t\tSystem.out.println(\"File created\");\n\t\tRow r1=s2.createRow(0);\n\t\tCell c1 = r1.createCell(0);\n\t\tc1.setCellValue(\"Java\");\n\t\twb1.write(fileOut1);\n\t\tSystem.out.println(\"Dhandapani Branch\");\n\t\t}", "public static void main(String[] argv) {\r\n\t\ttask_data task_info = new task_data();\r\n\t\tlocal_tube sheet_parser = new local_tube(task_info);\r\n\t\tString current_terminal = \"LSHITD0097\";\r\n\t\tHashMap<String, String> imported_data = new HashMap<String, String>();\r\n\t\timported_data.put(\"env\", \"a=b\");\r\n\t\timported_data.put(\"sort\", \"\");\r\n\t\timported_data.put(\"key\", public_data.CASE_USER_PATTERN + \"|\" + public_data.CASE_STANDARD_PATTERN);\r\n\t\tsheet_parser.generate_suite_file_local_admin_task_queues(time_info.get_date_time(), \"C:\\\\Users\\\\jwang1\\\\Desktop\\\\standard_suite2\\\\radiant_regression.xlsx\", imported_data, current_terminal);\r\n\t\t//System.out.println(task_info.get_received_task_queues_map().toString());\r\n\t\t//System.out.println(task_info.get_received_admin_queues_treemap().toString());\r\n\t\tsheet_parser.generate_suite_path_local_admin_task_queues(time_info.get_date_time(), \"C:/Users/jwang1/Desktop/qinhai_suite\", \"D:/tmp_work\", imported_data);\r\n\t\tSystem.out.println(task_info.get_received_task_queues_map().toString());\r\n\t\tSystem.out.println(task_info.get_received_admin_queues_treemap().toString());\r\n\t\t/*\t\t\r\n\t\txml_parser xml_parser2 = new xml_parser();\r\n\t\tIterator<String> dump_queue_it = task_info.get_received_admin_queues_treemap().keySet().iterator();\r\n\t\tString queue_name = dump_queue_it.next();\r\n\t\tHashMap<String, HashMap<String, String>> admin_queue_data = task_info\r\n\t\t\t\t.get_queue_data_from_received_admin_queues_treemap(queue_name);\r\n\t\tSystem.out.println(queue_name);\r\n\t\tSystem.out.println(admin_queue_data);\r\n\t\ttry {\r\n\t\t\txml_parser2.dump_admin_data(admin_queue_data, queue_name,\r\n\t\t\t\t\t\"D:/tmp_work_space/logs/finished/admin/test.xml\");\r\n\t\t} catch (IOException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\tTreeMap<String, HashMap<String, HashMap<String, String>>> task_queue_data = task_info\r\n\t\t\t\t.get_received_task_queues_map().get(queue_name);\r\n\t\tSystem.out.println(task_queue_data);\r\n\t\ttry {\r\n\t\t\txml_parser2.dump_task_data(task_queue_data, queue_name,\r\n\t\t\t\t\t\"D:/tmp_work_space/logs/finished/task/test.xml\");\r\n\t\t} catch (IOException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\t*/\r\n\t}", "public static void main(String[] args) throws IOException {\n\t\t\r\n\t\tString path = System.getProperty(\"user.dir\") + \"\\\\src\\\\excelFileHandling\\\\TestData1.xls\";\r\n\t\tFileInputStream file = new FileInputStream(path);\r\n\t\t\r\n\t\tHSSFWorkbook wb = new HSSFWorkbook(file);\r\n\t\tHSSFSheet sheet = wb.createSheet(\"Sheet2\");\r\n\t\t\r\n\t\t\r\n\t\tString[][] data= {{\"Name\",\"Surname\",\"Address\"},\r\n\t\t {\"Vishal\",\"Shinde\",\"Pune\"},\r\n\t\t {\"Satya\",\"Shinde\",\"Pune\"}\r\n\t\t };\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\tfor (int i=0; i<data.length; i++)\r\n\t\t\t\t\t{\r\n\t\t\t\r\n\t\t\tHSSFRow row =sheet.getRow(i);\r\n\t\t\t\r\n\t\t\tif(row==null)\t\r\n\t\t\t\t\r\n\t\t\t\trow= sheet.createRow(i);\r\n\t\t\t\r\n\t\t\tfor (int j=0; j<data[0].length; j++)\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\tHSSFCell cell = row.getCell(j);\r\n\t\t\t\tif(cell == null)\r\n\t\t\t\t\tcell = row.createCell(j);\r\n\t\t\t\t\r\n\t\t\t\tcell.setCellValue(data[i][j]);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tFileOutputStream fileout = new FileOutputStream(path);\r\n\t\twb.write(fileout);\r\n\t\tfileout.close();\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\r\n\t}", "@Test\n\tpublic void registerCandidate() throws Exception{\n\n\t\tString data[]= new String[3];\n\t\tString [][] userData= utilityExcel.readDataFromExcel(accessCodeInputFilePath, \"accessCodes\");\n\t\tArrayList columnHeader = new ArrayList() {{\n\t\t\tadd(\"User Type\");\n\t\t\tadd(\"User Name\");\n\t\t\tadd(\"Password\");\n\t\t\tadd(\"Access Code\");\n\t\t\tadd(\"Email Id\");\n\t\t\tadd(\"First Name\");\n\t\t\tadd(\"Last Name\");\n\t\t\tadd(\"Institution\");\n\t\t\tadd(\"Result\");\n\t\t}}; \n\t\tutilityExcel.addSheet(accessCodeInputFilePath, \"UserNames\", columnHeader);\n\t\tArrayList userInfo= new ArrayList();\n\t\t//userInfo.set(0, \"\");\n\t\ttry{\n\t\tfor(int i=1;i<userData.length;i++){\n\t\t\tString userName=userData[i][0].trim();\n\t\t\tString accessCode=userData[i][1].trim();\n\t\t\t//ArrayList userInfo= new ArrayList();\n\t\t\tenterAccessCodeAndClickNext(accessCode,driver );\n\t\t\tRumbaRegistrationCommon.clickNext(driver);\n\t\t\t//UtilityCommon.pause();\n\t\t\tclickCreateAccountButton(accessCode, driver);\n\t\t\tString userName1=userName+new SimpleDateFormat(\"yyyyMMddhhmmss\").format(new Date());\n\t\t\t//String firstName1= firstName+new SimpleDateFormat(\"yyyyMMddhhmmss\").format(new Date());\n\t\t\tString emailID=userName+\"@abc.com\";\n\t\t\tfillInAccountDetailsAndClickNext(emailID, userName1,\"\", userName, \"PEARSON\",userName1 , \"Password123\", driver);\t\t\n\t\t\tclickOkIfInstituteExists(driver);\n\t\t\tuserInfo.add(userName);\n\t\t\tuserInfo.add(userName1);\n\t\t\tuserInfo.add(\"Password123\");\n\t\t\tuserInfo.add(accessCode);\n\t\t\tuserInfo.add(emailID);\n\t\t\tuserInfo.add(userName1);\n\t\t\tuserInfo.add(userName);\n\t\t\tuserInfo.add(\"PEARSON\");\n\t\t\tclickContinueRegistrationIfEmailExists(driver);\n\t\t\tfinishRegistration(driver);\n\t\t\tUtilityCommon.pause();\n\t\t\tUtilityCommon.waitForElementVisible(RumbaPage.GOTOYOURPRODUCT_BTN.byLocator(), driver);\n\t\t\tThread.sleep(5000);\n\t\t\tUtilityCommon.clickAndWait(RumbaPage.GOTOYOURPRODUCT_BTN.byLocator(), driver);\n\t\t\tThread.sleep(5000);\n\t\t\tString navigateURL=driver.getCurrentUrl();\n\t\t\tif(navigateURL.contains(\"myenglishlab.pearson-intl.com\")){\n\t\t\t\tReporter.log(\"User is avigated to correct url.Test passed.\");\n\t\t\t\tuserInfo.add(\"Test passed.Navigated URL is \"+driver.getCurrentUrl());\n\t\t\t}else{\n\t\t\t\tReporter.log(\"User is navigated to: \"+driver.getCurrentUrl()+\"Test failed.\");\n\t\t\t\tuserInfo.add(\"Test failed.Navigated URL is \"+driver.getCurrentUrl());\n\t\t\t}\t\t\t\t\n\t\t\tFile srcShot=((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);\n\t\t FileUtils.copyFile(srcShot, new File(accessCodeOutputFilePath+\"/ScreenShots/\"+userName1+\".png\"));\n\t\t utilityExcel.updateExcelSingleRow(accessCodeInputFilePath, \"UserNames\", userInfo);\n\t\t\tdriver.navigate().to(rumbaURL);\n\t\t\t\n\t\t\tuserInfo.clear();\n\t\t}\n\t\t}catch(Exception e){\n\t\t\tuserInfo.add(e.getMessage());\n\t\t}\n\n\t}", "@Parameters({ \"Test\", \"env\", \"Parallel\" })\n\t@Test\n\tpublic void createXMLfile(String Test, String env, @Optional(\"false\") Boolean parallel) throws IOException {\n\n\t\tExcel_Handling excel = new Excel_Handling();\n\t\tTimestamp timestamp = new Timestamp(System.currentTimeMillis());\n Instant instant = timestamp.toInstant();\n \n String timeStampString = instant.toString();\n\t\tClassLoader classLoader = getClass().getClassLoader();\n\t\t//SimpleDateFormat formatter = new SimpleDateFormat(\"ddMMyyyyHHmm\"); \n\t\t//Date date = new Date(); \n\t\tFile dataSheet = null;\n\t\tFile dataSheetResult = null;\n\t\tString nameReport = null;\n\t\t\n\t\tnameReport = env+Test+\".html\";\n\t\t//nameReport = env+Test+formatter.format(date)+\".html\";\n\t\t\t\t\n\t\tif (Test.equalsIgnoreCase(\"RegressionIBM\")) {\n\t\t\tdataSheet = new File(classLoader.getResource(\"Datasheet_Regression_IBM.xlsx\").getFile());\n\t\t\tdataSheetResult = new File(classLoader.getResource(\"Datasheet_RegressionIBM_Result.xlsx\").getFile());\n\t\t}\n\t\tif (Test.equalsIgnoreCase(\"RegressionBP\")) {\n\t\t\tdataSheet = new File(classLoader.getResource(\"Datasheet_Regression_BP.xlsx\").getFile());\n\t\t\tdataSheetResult = new File(classLoader.getResource(\"Datasheet_Regression_BP_Result.xlsx\").getFile());\n\t\t}\n\t\tif (Test.equalsIgnoreCase(\"SanityBP\")) {\n\t\t\tSystem.out.println(\"SanityBP reader done!\");\n\t\t\tdataSheet = new File(classLoader.getResource(\"Datasheet_SanityBP.xlsx\").getFile());\n\t\t\tdataSheetResult = new File(classLoader.getResource(\"Datasheet_Sanity_ResultBP.xlsx\").getFile());\n\t\t\tnameReport = \"SanityBPParallel.html\";\n\t\t}\n\t\tif (Test.equalsIgnoreCase(\"SanityIBM\")) {\n\t\t\tSystem.out.println(\"SanityIBM reader done!\");\n\t\t\tdataSheet = new File(classLoader.getResource(\"Datasheet_SanityIBM.xlsx\").getFile());\n\t\t\tdataSheetResult = new File(classLoader.getResource(\"Datasheet_Sanity_ResultIBM.xlsx\").getFile());\n\t\t\tnameReport = \"SanityIBMParallel.html\";\n\t\t}\n\t\tif (Test.equalsIgnoreCase(\"Legal_IBM\"))\n\t\t{\n\t\t\t dataSheet = new File(classLoader.getResource(\"Datasheet_Legal_IBM.xlsx\").getFile());\n\t\t\t dataSheetResult = new File(classLoader.getResource(\"Datasheet_Legal_IBM_Result.xlsx\").getFile());\n\t\t}\n\t\tif (Test.equalsIgnoreCase(\"Legal_BP\"))\n\t\t{\n\t\t\t dataSheet = new File(classLoader.getResource(\"Datasheet_Legal_BP.xlsx\").getFile());\n\t\t\t dataSheetResult = new File(classLoader.getResource(\"Datasheet_Legal_BP_Result.xlsx\").getFile());\n\t\t}\n\t\tif (Test.equalsIgnoreCase(\"Legal_Min\"))\n\t\t{\n\t\t\t dataSheet = new File(classLoader.getResource(\"Datasheet_Legal_Min.xlsx\").getFile());\n\t\t\t dataSheetResult = new File(classLoader.getResource(\"Datasheet_Legal_Min_Result.xlsx\").getFile());\n\t\t}\n\t\ttry {\n\t\t\texcel.ExcelReader(dataSheet.getAbsolutePath(), \"Data\", dataSheetResult.getAbsolutePath(), \"Data\");\n\t\t\texcel.getExcelDataAll(\"Data\", \"Execute\", \"Y\", \"TC_ID\");\n\t\t} catch (Exception e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\tSystem.out.println(\"excel reader done!\");\n\t\tSystem.out.println(\"test env is \" + env);\n\n\t\tMap<String, HashMap<String, String>> map = Excel_Handling.TestData;\n\t\t// creation of the testng xml based on parameters/data\n\t\tTestNG testNG = new TestNG();\n\t\tReport_Setup.getInstance();\n\t\tReport_Setup.setReportName(nameReport);\n\t\t\n\t\tXmlSuite suite = new XmlSuite();\n\t\tif (parallel) {\n\t\t\tsuite.setParallel(ParallelMode.TESTS);\n\t\t}\n\t\tfor (String key : map.keySet()) {\n\t\t\tFile configFile = new File(classLoader.getResource(\"Config.xml\").getFile());\n\t\t\tSystem.out.println(\"configFile:: \" + configFile.getAbsolutePath());\n\t\t\tfinal Common_Functions commonFunctions = new Common_Functions();\n\t\t\tsuite.setName(commonFunctions.GetXMLTagValue(configFile.getAbsolutePath(), \"Regression_Suite_Name\"));\n\t\t\tXmlTest test = new XmlTest(suite);\n\t\t\ttest.setName(key);\n\t\t\ttest.setPreserveOrder(\"true\");\n\t\t\ttest.addParameter(\"browserType\", Excel_Handling.Get_Data(key, \"Browser_Type\"));\n\t\t\ttest.addParameter(\"tcID\", key);\n\t\t\ttest.addParameter(\"ENV\", env);\n\t\t\ttest.addParameter(\"appURL\", commonFunctions.GetXMLTagValue(configFile.getAbsolutePath(), \"AppUrl\"));\n\t\t\ttest.addParameter(\"IBMURL\", commonFunctions.GetXMLTagValue(configFile.getAbsolutePath(), env + \"IBM\"));\n\t\t\ttest.addParameter(\"PCSURL\",commonFunctions.GetXMLTagValue(configFile.getAbsolutePath(), env + \"BPDirectPCS\"));\n\t\t\ttest.addParameter(\"MySAURL\", commonFunctions.GetXMLTagValue(configFile.getAbsolutePath(), env + \"MySA\"));\n\t\t\ttest.addParameter(\"Timestamp\", timeStampString);\n\t\t\tXmlClass testClass = new XmlClass();\n\n\t\t\tif (Test.equalsIgnoreCase(\"RegressionIBM\")) {\n\t\t\t\ttestClass.setName(\"com.ibm.stax.Tests.RegressionIBM.\" + Excel_Handling.Get_Data(key, \"Class_Name\"));\n\t\t\t}\n\t\t\tif (Test.equalsIgnoreCase(\"RegressionBP\")) {\n\t\t\t\ttestClass.setName(\"com.ibm.stax.Tests.RegressionBP.\" + Excel_Handling.Get_Data(key, \"Class_Name\"));\n\t\t\t}\n\t\t\tif (Test.equalsIgnoreCase(\"SanityBP\")) {\n\t\t\t\ttestClass.setName(\"com.ibm.stax.Tests.Sanity.\" + Excel_Handling.Get_Data(key, \"Class_Name\"));\n\t\t\t}\n\t\t\tif (Test.equalsIgnoreCase(\"SanityIBM\")) {\n\t\t\t\ttestClass.setName(\"com.ibm.stax.Tests.Sanity.\" + Excel_Handling.Get_Data(key, \"Class_Name\"));\n\t\t\t}\n\t\t\tif (Test.equalsIgnoreCase(\"Legal_IBM\"))\t{\n\t\t\t\ttestClass.setName(\"com.ibm.stax.Tests.Legal.\" + Excel_Handling.Get_Data(key, \"Class_Name\"));\n\t\t\t}\n\t\t\tif (Test.equalsIgnoreCase(\"Legal_BP\")) { \n\t\t\t\ttestClass.setName(\"com.ibm.stax.Tests.Legal.\" + Excel_Handling.Get_Data(key, \"Class_Name\"));\n\t\t\t}\n\t\t\tif (Test.equalsIgnoreCase(\"Legal_Min\")) {\n\t\t\t\ttestClass.setName(\"com.ibm.stax.Tests.Legal.\" + Excel_Handling.Get_Data(key, \"Class_Name\"));\n\t\t\t}\n\t\t\ttest.setXmlClasses(Arrays.asList(new XmlClass[] { testClass }));\n\t\t}\n\t\tList<String> suites = new ArrayList<String>();\n\t\tfinal File f1 = new File(Create_TestNGXML.class.getProtectionDomain().getCodeSource().getLocation().getPath());\n\t\tSystem.out.println(\"f1:: \" + f1.getAbsolutePath());\n\t\tFile f = new File(\".\\\\testNG.xml\");\n\t\tf.createNewFile();\n\t\tFileWriter fw = new FileWriter(f.getAbsoluteFile());\n\t\tBufferedWriter bw = new BufferedWriter(fw);\n\t\tbw.write(suite.toXml());\n\t\tbw.close();\n\t\tsuites.add(f.getPath());\n\t\ttestNG.setTestSuites(suites);\n\t\ttestNG.run();\n\t\tf.delete();\n\t\tReport_Setup.flush();\n\n\t}", "private void getMoveDescriptorsForOneExperiment( Experiment exp, EnumXLSExportType xlsOption) \r\n\t{\n\t\texpAll.cages.copy(exp.cages);\r\n\t\texpAll.capillaries.copy(exp.capillaries);\r\n\t\texpAll.firstImage_FileTime \t= exp.firstImage_FileTime;\r\n\t\texpAll.lastImage_FileTime \t= exp.lastImage_FileTime;\r\n\t\texpAll.setExperimentDirectory( exp.getExperimentDirectory());\r\n\t\texpAll.setExperimentFieldNoTest(EnumXLSColumnHeader.EXP_BOXID, exp.getExperimentField(EnumXLSColumnHeader.EXP_BOXID));\r\n\t\texpAll.setExperimentFieldNoTest(EnumXLSColumnHeader.EXP_EXPT, exp.getExperimentField(EnumXLSColumnHeader.EXP_EXPT));\r\n\t\texpAll.setExperimentFieldNoTest(EnumXLSColumnHeader.EXP_STIM, exp.getExperimentField(EnumXLSColumnHeader.EXP_STIM));\r\n\t\texpAll.setExperimentFieldNoTest(EnumXLSColumnHeader.EXP_CONC, exp.getExperimentField(EnumXLSColumnHeader.EXP_CONC));\r\n\t\texpAll.setExperimentFieldNoTest(EnumXLSColumnHeader.EXP_SEX, exp.getExperimentField(EnumXLSColumnHeader.EXP_SEX));\r\n\t\texpAll.setExperimentFieldNoTest(EnumXLSColumnHeader.EXP_STRAIN, exp.getExperimentField(EnumXLSColumnHeader.EXP_STRAIN));\r\n\t\r\n\t\tExperiment expi = exp.chainToNextExperiment;\r\n\t\twhile (expi != null ) \r\n\t\t{\r\n\t\t\texpAll.cages.mergeLists(expi.cages);\r\n\t\t\texpAll.lastImage_FileTime = expi.lastImage_FileTime;\r\n\t\t\texpi = expi.chainToNextExperiment;\r\n\t\t}\r\n\t\texpAll.camImageFirst_ms = expAll.firstImage_FileTime.toMillis();\r\n\t\texpAll.camImageLast_ms = expAll.lastImage_FileTime.toMillis();\r\n\t\tint nFrames = (int) ((expAll.camImageLast_ms - expAll.camImageFirst_ms) / options.buildExcelStepMs +1);\r\n\t\tint ncages = expAll.cages.cagesList.size();\r\n\t\trowsForOneExp = new ArrayList <XYTaSeriesArrayList> (ncages);\r\n\t\tfor (int i=0; i< ncages; i++) \r\n\t\t{\r\n\t\t\tCage cage = expAll.cages.cagesList.get(i);\r\n\t\t\tXYTaSeriesArrayList row = new XYTaSeriesArrayList (cage.cageRoi2D.getName(), xlsOption, nFrames, options.buildExcelStepMs);\r\n\t\t\trow.nflies = cage.cageNFlies;\r\n\t\t\trowsForOneExp.add(row);\r\n\t\t}\r\n\t\tCollections.sort(rowsForOneExp, new Comparators.XYTaSeries_Name_Comparator());\r\n\t}", "@Override\n\tpublic Map<String,Object> exinExcel(Map<String, Object> map) {\n\t\tMap<String,Object> resultmap = new HashMap<String, Object>();\n\t\tint result = 0;\n\t\tExinExcel exin = new ExinExcel();\n\t\tList<List<Object>> list = exin.exinExcel(map.get(\"filename\").toString(), (InputStream) map.get(\"content\"));\n\t\tint i = 0, error = 0;\n\t\tif (list.size() > 3) {\n\t\t\tresult = 0;\n\t\t\tresultmap.put(\"total\", list.size()-3);\n\t\t\tresultmap.put(\"returncode\", \"success\");\n\t\t\tfor (List<Object> bis : list) {\n\t\t\t\tif(i<=2){ //跳过前三行\n\t\t\t\t\ti++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\ttry{\n\t\t\t\t\tERM_EmergencyResInstrumentEntity yjzb = new ERM_EmergencyResInstrumentEntity();\n\t\t\t\t\tTimestamp t = DateUtils.getSysTimestamp();\n\t\t\t\t\tyjzb.setS1(t);\n\t\t\t\t\tyjzb.setS2(t);\n\t\t\t\t\tyjzb.setS3(0);\n\t\t\t\t\tif(map.get(\"usertype\").equals(\"1\")){\n\t\t\t\t\t\tyjzb.setQyid(Long.valueOf(map.get(\"qyid\").toString()));\n\t\t\t\t\t}\n\t\t\t\t\tyjzb.setUserid(Long.parseLong(UserUtil.getCurrentUser().getId().toString()));\n\t\t\t\t\tyjzb.setM1(bis.get(0).toString());\n\t\t\t\t\tyjzb.setM2(bis.get(1).toString());\n\t\t\t\t\tyjzb.setM3(bis.get(2).toString());\n\t\t\t\t\tif(bis.get(3).toString()!=null&&bis.get(3).toString()!=\"\"){\n\t\t\t\t\t\tyjzb.setM4(Float.parseFloat(bis.get(3).toString()));\n\t\t\t\t\t}\n\t\t\t\t\tyjzb.setM5(bis.get(4).toString());\n\t\t\t\t\tif(bis.get(5).toString()!=null&&bis.get(5).toString()!=\"\"){\n\t\t\t\t\t\tyjzb.setM6(Float.parseFloat(bis.get(5).toString()));\n\t\t\t\t\t}\n\t\t\t\t\tif(bis.get(6).toString()!=null&&bis.get(6).toString()!=\"\"){\n\t\t\t\t\t\tyjzb.setM7(Float.parseFloat(bis.get(6).toString()));\n\t\t\t\t\t}\n\t\t\t\t\tyjzb.setM8(bis.get(7).toString());\n\t\t\t\t\tyjzb.setM9(bis.get(8).toString());\n\t\t\t\t\tyjzb.setM10(bis.get(9).toString());\n\t\t\t\t\tyjzb.setM11(bis.get(10).toString());\n\t\t\t\t\tyjzb.setM13(bis.get(11).toString());\n\t\t\t\t\termYjzbDao.addInfo(yjzb);\n\t\t\t\t\tresult++;\n\t\t\t\t}catch(Exception e){\n\t\t\t\t\terror++;\n\t\t\t\t}\n\t\t\t\tresultmap.put(\"success\",result);\n\t\t\t\tresultmap.put(\"error\", error);\n\t\t\t}\n\t\t}else if(list.size()==3){\n\t\t\tresultmap.put(\"success\",result);\n\t\t\tresultmap.put(\"error\", error);\n\t\t\tresultmap.put(\"returncode\", \"warn\");\n\t\t}else if(list.size()<3){\n\t\t\tresultmap.put(\"success\",result);\n\t\t\tresultmap.put(\"error\", error);\n\t\t\tresultmap.put(\"returncode\", \"ext\");\n\t\t}\n\t\tif(Integer.valueOf(resultmap.get(\"success\").toString())==0){\n\t\t\tresultmap.put(\"returncode\", \"warn\");\n\t\t}\n\t\treturn resultmap;\n\n\t}", "public static void main(String[] args) {\n\t\tIRowReader reader = new RowReader();\n\t\ttry {\n\t\t\tlong start = System.currentTimeMillis();\n\t\t\tExcelReaderUtil.readExcel(reader, \"/Users/Eric/Downloads/人员信息.xlsx\",true);\n\t\t\tlong end = System.currentTimeMillis();\n\t\t\tSystem.out.println(\"Time used:\"+(end-start)/1000+\"s\");\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public static void main(String[] args){\n \n String loginResponse = \"\";\n String jSessionID = \"\";\n String jsonData = \"\";\n String csvData = \"\";\n String writeToFileOutput = \"\";\n // Change the baseURL to your own jira server's address and port number\n // Note: adding \"rest/\" at the end may not be necessary in your \n // environment\n String baseURL = \"http://ec2-18-235-248-253.compute-1.amazonaws.com:2990/jira/rest/\";\n String loginURL = \"auth/1/session\";\n String biExportURL = \"getbusinessintelligenceexport/1.0/message\";\n // The analysisStartData and analysisEndDate specify an inclusive\n // period over time over which you want to extract issues that \n // have been either added or updated.\n String analysisStartDate = \"01-DEC-18\";\n String analysisEndDate = \"31-DEC-18\";\n // The loginUserName and loginPassWord are the credentials for a user\n // who has permission to view the issues that you wish to export.\n String loginUserName = \"admin\";\n String loginPassWord = \"admin\";\n boolean errorsOccurred = false;\n String exportDirectory = \"./downloads/\";\n \n if(!errorsOccurred)\n {\n loginResponse = loginToJira(baseURL, loginURL, loginUserName, loginPassWord);\n if(loginResponse == \"ERROR\") { errorsOccurred = true; }\n }\n if(!errorsOccurred)\n {\n jSessionID = parseJSessionID(loginResponse);\n if(jSessionID == \"ERROR\") { errorsOccurred = true; }\n }\n if(!errorsOccurred)\n {\n jsonData = getJsonData(baseURL, biExportURL, jSessionID, analysisStartDate, analysisEndDate);\n if(jsonData == \"ERROR\") { errorsOccurred = true; }\n }\n if(!errorsOccurred)\n {\n csvData = formatAsCSV(jsonData);\n if(csvData == \"ERROR\") { errorsOccurred = true; }\n }\n if(!errorsOccurred)\n {\n writeToFileOutput = writeToFile(csvData, exportDirectory);\n if(writeToFileOutput == \"ERROR\") { errorsOccurred = true; }\n }\n if(!errorsOccurred)\n {\n System.out.println(\"SUCCESS\");\n } else {\n System.out.println(\"FAILURE\");\n }\n }", "public static void main(String[] args) throws IOException {\n\t\tSystem.setProperty(\"webdriver.chrome.driver\", \"/Users/fvargas/Selenium/SeleniumDrivers/chromedriver\");\n\t\tChromeDriver driver = new ChromeDriver();\n\t\t\n\t\tdriver.get(\"http://demo.automationtesting.in/Register.html\");\n\t\tdriver.manage().window().maximize();\n\t\t\n\t\t/*\n\t\t * Excel Steering\n\t\t */\n\t\t\n\t\tFileInputStream file = new FileInputStream(\"//Users//fvargas//eclipse-workspace//MySeleniumProject1//XLSTestFile.xlsx\");\n\t\t\n\t\tXSSFWorkbook workbook = new XSSFWorkbook(file);\n\t\t\n\t\tXSSFSheet sheet = workbook.getSheet(\"MySecondSheet\");\n\t\t\n\t\tint rowsCount = sheet.getLastRowNum();\n\t\t\n\t\tfor(int i = 1; i <= rowsCount; i++) {\n\t\t\tXSSFRow currentRow = sheet.getRow(i);\n\t\t\t\n\t\t\tString xlsFirstName = currentRow.getCell(0).toString();\n\t\t\tString xlsLastName = currentRow.getCell(1).toString();\n\t\t\tString xlsAddress = currentRow.getCell(2).toString();\n\t\t\tString xlsEmail = currentRow.getCell(3).toString();\n\t\t\tString xlsPhone = currentRow.getCell(4).toString();\n\t\t\tString xlsHobbies = currentRow.getCell(5).toString();\n\t\t\tString xlsLanguage = currentRow.getCell(6).toString();\n\t\t\tString xlsSkills = currentRow.getCell(7).toString();\n\t\t\tString xlsCountry = currentRow.getCell(8).toString();\n\t\t\tString xlsDOB = currentRow.getCell(9).toString();\n\t\t\tString xlsPassword = currentRow.getCell(10).toString();\n\t\t\t\n\t\t\t// entering values into AUT\n\t\t\t\n\t\t\tdriver.findElement(By.cssSelector(\"*[ng-model='FirstName']\")).sendKeys(xlsFirstName);\n\t\t\tdriver.findElement(By.cssSelector(\"*[ng-model='LastName']\")).sendKeys(xlsLastName);\n\t\t\tdriver.findElement(By.cssSelector(\"*[ng-model='Adress']\")).sendKeys(xlsAddress);\n\t\t\tdriver.findElement(By.cssSelector(\"*[ng-model='EmailAdress']\")).sendKeys(xlsEmail);\n\t\t\tdriver.findElement(By.cssSelector(\"*[ng-model='Phone']\")).sendKeys(xlsPhone);\n\t\t\t\n\t\t\tdriver.findElement(By.cssSelector(\"*[type='radio'][value='Male']\")).click();\n\t\t\t\n\t\t\t// starts hobbies logic\n\t\t\t\n\t\t\tString checkboxID = \"\";\n\t\t\tswitch(xlsHobbies.toLowerCase()) {\n\t\t\tcase \"cricket\":\n\t\t\t\tcheckboxID = \"checkbox1\";\n\t\t\t\tbreak;\n\t\t\tcase \"movies\":\n\t\t\t\tcheckboxID = \"checkbox2\";\n\t\t\t\tbreak;\n\t\t\tcase \"hockey\":\n\t\t\t\tcheckboxID = \"checkbox3\";\n\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tSystem.out.println(\"Hobby not in list\");\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tdriver.findElement(By.id(checkboxID)).click();\n\t\t\t// ends hobbies logic\n\t\t\t\n\t\t\tdriver.findElement(By.id(\"msdd\")).click();\n\t\t\tdriver.findElement(By.linkText(xlsLanguage)).click();\n\t\t\t\n\t\t\tSelect skills = new Select(driver.findElement(By.id(\"Skills\")));\n\t\t\tskills.selectByVisibleText(xlsSkills);\n\t\t\t//skills.getOptions().size(); //returns the number of items in the list\n\t\t\t\n\t\t\tSelect country = new Select(driver.findElement(By.id(\"countries\")));\n\t\t\tcountry.selectByVisibleText(xlsCountry);\n\t\t\t\n\t\t\t// starts DOB logic\n\t\t\ttry {\n\t\t\t\tDate dateOfBirth = new SimpleDateFormat(\"dd/MM/yyyy\").parse(xlsDOB);\n\t\t\t\tLocalDate date = dateOfBirth.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();\n\t\t\t\t\n\t\t\t\tSelect year = new Select(driver.findElement(By.id(\"yearbox\")));\n\t\t\t\tyear.selectByVisibleText(String.valueOf(date.getYear()));\n\t\t\t\t\n\t\t\t\tSelect month = new Select(driver.findElement(By.cssSelector(\"select[ng-model='monthbox']\")));\n\t\t\t\tmonth.selectByIndex(date.getMonthValue()); //index start with zero\n\t\t\t\t\n\t\t\t\tSelect day = new Select(driver.findElement(By.id(\"daybox\")));\n\t\t\t\tday.selectByValue(String.valueOf(date.getDayOfMonth()));\n\t\t\t} catch (ParseException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\t\n\t\t\t// ends DOB logic\n\t\t\t\n\t\t\t//smart drop down with search box\n\t\t\tdriver.findElement(By.cssSelector(\"*[class='select2-selection select2-selection--single']\")).click();\n\t\t\tdriver.findElement(By.cssSelector(\"*[class='select2-search__field']\")).sendKeys(xlsCountry);\n\t\t\tdriver.findElement(By.xpath(\"//li[text()='\"+ xlsCountry + \"']\")).click();\n\t\t\t\n\t\t\t//password fields\n\t\t\tdriver.findElement(By.id(\"firstpassword\")).sendKeys(xlsPassword);\n\t\t\tdriver.findElement(By.id(\"secondpassword\")).sendKeys(xlsPassword);\n\t\t\t\n\t\t\t// refresh form\n\t\t\tdriver.findElement(By.id(\"Button1\")).click();\n\t\t\t\n\t\t}\n\t\t\n\t\tworkbook.close();\n\t\tdriver.close();\n\n\t}", "public static void readFromExcel_ApachePOI(String testCase) throws Exception{\n\t\tString fileName = \"TestData.xlsx\";\n\t\tString SAMPLE_XLSX_FILE_PATH = System.getProperty(\"user.dir\")+\"\\\\src\\\\test\\\\resources\\\\TestData\\\\TestData.xlsx\";\n\t\tFile file = new File(SAMPLE_XLSX_FILE_PATH);\n\t\tFileInputStream inputStream = new FileInputStream(file);\n\t\tWorkbook workbook = null;\n\t\tString fileExtensionName = fileName.substring(fileName.indexOf(\".\"));\n\t\t\n\t if(fileExtensionName.equals(\".xlsx\")){\n\n\n\t \tworkbook = new XSSFWorkbook(inputStream);\n\n\t }\n\n\t //Check condition if the file is xls file\n\n\t else if(fileExtensionName.equals(\".xls\")){\n\n\t //If it is xls file then create object of HSSFWorkbook class\n\n\t \tworkbook = new HSSFWorkbook(inputStream);\n\n\t }\n\t\t//System.out.println(\"Reading from right sheet\"); \n\t\tSheet sheet = workbook.getSheet(\"TestSheet\");\n\t\tfor(int i = 0;i<sheet.getLastRowNum();i++) {\n\t\t\tif(testCase.equalsIgnoreCase(sheet.getRow(i).getCell(0).getStringCellValue())) {\n\t\t\t\tRow row = sheet.getRow(i);\n\t\t\t\tString userID = row.getCell(1).getStringCellValue();\n\t\t\t\tint pwd = (int) row.getCell(2).getNumericCellValue();\n\t\t\t}\n\t\t}\n\t\tRow row = sheet.getRow(1);\n\t\tCell cell = row.getCell(0);\n\t\tString testCaseName = cell.getStringCellValue();\n\t\tString userID = row.getCell(1).getStringCellValue();\n\t\tint pwd = (int) row.getCell(2).getNumericCellValue();\n\t\tSystem.out.println(testCaseName);\n\t\tSystem.out.println(userID);\n\t\tSystem.out.println(pwd);\n\t\t\t\n\t\tworkbook.close();\n\t}", "public FileOutputStream generateFinance14Report(List<Finance14Dto> Finance14DtoList,String fileName) throws IOException, ClassNotFoundException, SQLException {\n\t\tFile file=new File(fileName);\n\n\t\tString sheetName = \"Sheet1\";// name of sheet\n\n//\t\tResultSet resultSet = getDatabase(villageId,yearmonth);\n\t\tXSSFWorkbook workbook = new XSSFWorkbook(); \n\t XSSFSheet spreadsheet = workbook\n\t \t .createSheet(sheetName);\n\t \t XSSFRow row=spreadsheet.createRow(1);\n\t \t /* XSSFRow row1 = spreadsheet.createRow(2);*/\n\t \t XSSFCell cell;\n\t \t cell=row.createCell(1);\n\t \t cell.setCellValue(\"vid\");\n\t \t cell=row.createCell(2);\n\t \t cell.setCellValue(\"month\");\n\t \t cell=row.createCell(3);\n\t \t cell.setCellValue(\"year\");\n\t \t cell=row.createCell(4);\n\t \t cell.setCellValue(\"Total work\");\n\t \t cell=row.createCell(5);\n\t \t cell.setCellValue(\"Works approved\");\n\t \t cell=row.createCell(6);\n\t \t cell.setCellValue(\"Project not started\");\n\t \t cell=row.createCell(7);\n\t \t cell.setCellValue(\"Progress\");\n\t \t cell=row.createCell(8);\n\t \t cell.setCellValue(\"Completed\");\n\t \t cell=row.createCell(9);\n\t \t cell.setCellValue(\"Grant allocated\");\n\t \t cell=row.createCell(10);\n\t \t cell.setCellValue(\"Amount spent\");\n\t \t /* cell=row.createCell(11);\n\t \t cell.setCellValue(\"entry date\");*/\n\t \t \n\t \t int i=2;\n\t \t for(Finance14Dto finance14Dto:Finance14DtoList)\n//\t \t while(resultSet.next())\n\t \t {\n\t \t row=spreadsheet.createRow(i);\n\t \t /* row1=spreadsheet.createRow(i+1);*/\n\t \t cell=row.createCell(1);\n\t \t cell.setCellValue(finance14Dto.getVillageId());\n\t \t cell=row.createCell(2);\n\t \t cell.setCellValue(finance14Dto.getMonth());\n\t \t cell=row.createCell(3);\n\t \t cell.setCellValue(finance14Dto.getYear());\n//\t \t /* spreadsheet.addMergedRegion(new CellRangeAddress(3, 3, 4, 4));*/\n\t \t cell=row.createCell(4);\n\t \t cell.setCellValue(finance14Dto.getTotalWork());\n\t \t cell=row.createCell(5);\n\t \t cell.setCellValue(finance14Dto.getWorksApproved());\n\t \t cell=row.createCell(6);\n\t \t cell.setCellValue(finance14Dto.getProjectNotStarted());\n\t \t cell=row.createCell(7);\n\t \t cell.setCellValue(finance14Dto.getProgress());\n\t \t cell=row.createCell(8);\n\t \t cell.setCellValue(finance14Dto.getCompleted());\n\t \t cell=row.createCell(9);\n\t \t cell.setCellValue(finance14Dto.getGrantAllocated());\n\t \t cell=row.createCell(10);\n\t \t cell.setCellValue(finance14Dto.getAmountSpent());\n\t \t /*cell=row.createCell(11);\n\t \t cell.setCellValue(finance14Dto.getEntryDate());*/\n\t \t i++;\n\t \t }\n\t \t FileOutputStream out = new FileOutputStream(\n\t \t file);\n\t \t workbook.write(out);\n\t \t out.close();\n\t \t System.out.println(\n\t \t \"exceldatabase.xlsx written successfully\");\n\t \t \n\t \treturn out;\n\t}" ]
[ "0.67113525", "0.669173", "0.6549769", "0.6506262", "0.64043516", "0.63417804", "0.63088536", "0.6278991", "0.62440854", "0.6244026", "0.6187298", "0.61755323", "0.6163304", "0.6141837", "0.61234486", "0.61109424", "0.6064126", "0.60113966", "0.6001581", "0.59956205", "0.59915733", "0.59841454", "0.5973202", "0.5948099", "0.5937362", "0.59318036", "0.592651", "0.59125423", "0.59032345", "0.5895317", "0.589459", "0.5894153", "0.5893722", "0.5881363", "0.58511674", "0.58486867", "0.58471334", "0.5840694", "0.5836681", "0.5830278", "0.5826929", "0.5825105", "0.58167964", "0.5816141", "0.5815508", "0.58107376", "0.5804911", "0.57945067", "0.57924324", "0.57771957", "0.57550246", "0.57413524", "0.5732657", "0.57178724", "0.5717136", "0.56936395", "0.56883574", "0.5685307", "0.56828105", "0.5682152", "0.5681416", "0.56713605", "0.5656367", "0.564822", "0.56351054", "0.56348836", "0.56222194", "0.56148213", "0.5609663", "0.5608931", "0.5598448", "0.55913705", "0.5588935", "0.5585527", "0.55785316", "0.5576009", "0.556826", "0.5534023", "0.55260223", "0.55174583", "0.5515576", "0.5509313", "0.5504828", "0.5494233", "0.5485628", "0.5473908", "0.5470564", "0.5467891", "0.54575306", "0.54557526", "0.5449957", "0.54484886", "0.542544", "0.5419544", "0.54148597", "0.54086673", "0.54036844", "0.54024005", "0.539629", "0.5396199" ]
0.5757425
50
/ Faz um insert e traz o id que foi gerado pelo banco para o novo elemento
public int insert(IsEntityInDB obj) throws SQLException { if (!obj.getEntityName().equals(entityName)) { throw new IllegalArgumentException("Entity name and entity no match"); } HashMap<String, String> fields = obj.getNotNullFields(); return execUpdate(new SqlBuilder(entityName) .insert(fields.keySet().toArray(new String[0]), fields.values().toArray(new String[0])) .toString()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tpublic UUID insert(KomponenNilai komp) {\n\t\tSession session = sessionFactory.openSession();\n\t\tTransaction tx = session.beginTransaction();\n\t\tUUID insertId = (UUID)session.save(komp);\n\t\ttx.commit();\n\t\tsession.flush();\n\t\tsession.close();\n\t\treturn insertId;\n\t}", "public void inserir(Comentario c);", "public void guardarDietaComida(DietaComida dietaComida){\r\n try {\r\n \r\n String sql = \"INSERT INTO dietacomida (idDieta,idComida) VALUES ( ? , ? );\";\r\n \r\n PreparedStatement ps = con.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);\r\n ps.setInt(1, dietaComida.getIdDieta());\r\n ps.setInt(2, dietaComida.getIdComida());\r\n \r\n ps.executeQuery();\r\n \r\n ResultSet rs = ps.getGeneratedKeys();\r\n\r\n /* if (rs.next()) {\r\n dietaComida.setId(rs.getInt(1));\r\n } else {\r\n System.out.println(\"No se pudo obtener el id luego de insertar una DietaComida\");\r\n }*/\r\n ps.close();\r\n \r\n } catch (SQLException ex) {\r\n System.out.println(\"Error al insertar una DietaComida \" + ex.getMessage());\r\n }\r\n }", "public SgfensBancoPk insert(SgfensBanco dto) throws SgfensBancoDaoException;", "@Override\n\tpublic void insert(Unidade obj) {\n\n\t}", "@Override\r\n\tpublic Integer insertHangar(Hangar hangar) {\n\t\tSession session= factory.openSession();\r\n\t\tInteger id=(Integer)session.save(hangar);\r\n\t\tsession.close();\r\n\t\treturn id;\r\n\t}", "@Override\n\tpublic void insertar() {\n\t\t\n\t}", "public TipologiaStrutturaPk insert(TipologiaStruttura dto) throws TipologiaStrutturaDaoException;", "public DatiBancariPk insert(DatiBancari dto) throws DatiBancariDaoException;", "public Etudiant insert(Etudiant obj) {\n\t\treturn null;\n\t}", "public void processInsertar() {\n }", "private void insertTupel(Connection c) {\n try {\n String query = \"INSERT INTO \" + getEntityName() + \" VALUES (null,?,?,?,?,?);\";\n PreparedStatement ps = c.prepareStatement(query, Statement.RETURN_GENERATED_KEYS);\n ps.setString(1, getAnlagedatum());\n ps.setString(2, getText());\n ps.setString(3, getBild());\n ps.setString(4, getPolizist());\n ps.setString(5, getFall());\n ps.executeUpdate();\n ResultSet rs = ps.getGeneratedKeys();\n rs.next();\n setID(rs.getString(1));\n getPk().setValue(getID());\n } catch (SQLException e) {\n e.printStackTrace();\n }\n\n }", "public TipoPk insert(Tipo dto) throws TipoDaoException;", "public void insert() {\n\t\tSession session = DBManager.getSession();\n\t\tsession.beginTransaction();\n\t\tsession.save(this);\n\t\tsession.getTransaction().commit();\n\t}", "public RelacionConceptoEmbalajePk insert(RelacionConceptoEmbalaje dto) throws RelacionConceptoEmbalajeDaoException;", "private void insertData() {\n\n cliente = factory.manufacturePojo(ClienteEntity.class);\n em.persist(cliente);\n for (int i = 0; i < 3; i++) {\n FormaPagoEntity formaPagoEntity = factory.manufacturePojo(FormaPagoEntity.class);\n formaPagoEntity.setCliente(cliente);\n em.persist(formaPagoEntity);\n data.add(formaPagoEntity);\n }\n }", "int insert(Tipologia record);", "@Override\n\tpublic MensajeBean inserta(Tramite_informesem nuevo) {\n\t\treturn tramite_informesemDao.inserta(nuevo);\n\t}", "public OrdemDeServico inserir (OrdemDeServico servico) {\n\t\tservico.setId((Long) null);\n\t\treturn repoOrdem.save(servico);\n\t}", "public ClientePk insert(Cliente dto) throws ClienteDaoException;", "public static void inserir(String nome, int id){\n System.out.println(\"Dados inseridos!\");\n }", "public NominaPuestoPk insert(NominaPuesto dto) throws NominaPuestoDaoException;", "void insert(CTipoComprobante record) throws SQLException;", "void insertSelective(CTipoComprobante record) throws SQLException;", "private void insertData() {\n compra = factory.manufacturePojo(CompraVentaEntity.class);\n compra.setId(1L);\n compra.setQuejasReclamos(new ArrayList<>());\n em.persist(compra);\n\n for (int i = 0; i < 3; i++) {\n QuejasReclamosEntity entity = factory.manufacturePojo(QuejasReclamosEntity.class);\n entity.setCompraVenta(compra);\n em.persist(entity);\n data.add(entity);\n compra.getQuejasReclamos().add(entity);\n }\n }", "@Override\r\n\tpublic Usuario insert(Usuario t) {\n\t\treturn null;\r\n\t}", "@Override\r\n\tpublic int inserta(ReservaBean bean) throws Exception {\n\t\treturn 0;\r\n\t}", "@Transactional\n DataRistorante insert(DataRistorante risto);", "public void insertar(Proceso p) {\n\t\tif (p == null) {\n\t\t\treturn;\n\t\t}\n\t\tProceso nuevo = new Proceso();\n\t\tnuevo.rafaga = p.rafaga;\n\t\tnuevo.tllegada = p.tllegada;\n\t\tnuevo.IdCola = this.IdCola;\n\t\tnuevo.NombreCola = this.NombreCola;\n\t\tnuevo.rrejecutada = p.rrejecutada;\n\t\tnuevo.ColaProviene = p.ColaProviene;\n\t\tint tamaņo = p.id.length();\n\t\tif (tamaņo == 1) {\n\t\t\tnuevo.id = p.id + \"1\";\n\t\t} else {\n\t\t\tchar id = p.id.charAt(0);\n\t\t\tint numeroId = Integer.parseInt(String.valueOf(p.id.charAt(1))) + 1;\n\t\t\tnuevo.id = String.valueOf(id) + String.valueOf(numeroId);\n\t\t}\n\t\tif (raiz.sig == raiz) {\n\t\t\traiz.sig = nuevo;\n\t\t\tcabeza = nuevo;\n\t\t\tnuevo.sig = raiz;\n\t\t\tnuevo.padre = raiz;\n\t\t\traiz.padre = nuevo;\n\t\t} else {\n\t\t\tProceso aux = raiz.padre;\n\t\t\taux.sig = nuevo;\n\t\t\tnuevo.sig = raiz;\n\t\t\traiz.padre = nuevo;\n\t\t\tnuevo.padre = aux;\n\t\t}\n\t\tthis.numProcesos++;\n\t\tthis.rafagaTotal += nuevo.rafaga;\n\t\tthis.Ordenamiento();\n\t}", "int insertSelective(Movimiento record);", "private void insertar() {\n try {\n cvo.setNombre_cliente(vista.txtNombre.getText());\n cvo.setApellido_cliente(vista.txtApellido.getText());\n cvo.setDireccion_cliente(vista.txtDireccion.getText());\n cvo.setCorreo_cliente(vista.txtCorreo.getText());\n cvo.setClave_cliente(vista.txtClave.getText());\n cdao.insertar(cvo);\n vista.txtNombre.setText(\"\");\n vista.txtApellido.setText(\"\");\n vista.txtDireccion.setText(\"\");\n vista.txtCorreo.setText(\"\");\n vista.txtClave.setText(\"\");\n JOptionPane.showMessageDialog(null, \"Registro Ingresado\");\n } catch (Exception e) {\n JOptionPane.showMessageDialog(null, \"Debe ingresar Datos para guardar registro!\");\n }\n }", "public int insertTurno(Turno t) {\r\n\t\t// TODO He quitado esta comprobación porque si metes un turno, se le asigna un id nuevo, ¿no? - Dani\r\n//\t\tif (getTurno(t.getIdTurno())!=null) return -1;\r\n\t\tint i = controlador.insertTurno(t);\r\n\t\tt.setIdTurno(i);\r\n\t\tturnos.add(t);\r\n\t\treturn i;\r\n\t}", "@Override\n public CerereDePrietenie save(CerereDePrietenie entity) {\n\n String SQL = \"INSERT INTO cereredeprietenie(id, id_1,id_2,status,datac) VALUES(?,?,?,?,?)\";\n\n long id = 0;\n\n\n try (Connection conn = connect();\n PreparedStatement pstmt = conn.prepareStatement(SQL,\n Statement.RETURN_GENERATED_KEYS)) {\n\n\n pstmt.setInt(1, Math.toIntExact(entity.getId()));\n pstmt.setInt(2, Math.toIntExact(entity.getTrimite().getId()));\n pstmt.setInt(3, Math.toIntExact(entity.getPrimeste().getId()));\n pstmt.setString(4, entity.getStatus());\n pstmt.setObject(5, entity.getData());\n\n\n int affectedRows = pstmt.executeUpdate();\n // check the affected rows\n if (affectedRows > 0) {\n // get the ID back\n try (ResultSet rs = pstmt.getGeneratedKeys()) {\n if (rs.next()) {\n id = rs.getLong(1);\n }\n } catch (SQLException ex) {\n System.out.println(ex.getMessage());\n }\n }\n } catch (SQLException ex) {\n System.out.println(ex.getMessage());\n }\n\n\n return entity;\n\n }", "int insertSelective(Prueba record);", "int insert(Movimiento record);", "public void insertarcola(){\n Cola_banco nuevo=new Cola_banco();// se declara nuestro metodo que contendra la cola\r\n System.out.println(\"ingrese el nombre que contendra la cola: \");// se pide el mensaje desde el teclado\r\n nuevo.nombre=teclado.next();// se ingresa nuestro datos por consola yse almacena en la variable nombre\r\n if (primero==null){// se usa una condicional para indicar si primer dato ingresado es igual al null\r\n primero=nuevo;// se indica que el primer dato ingresado pasa a ser nuestro dato\r\n primero.siguiente=null;// se indica que el el dato ingresado vaya al apuntador siguente y que guarde al null\r\n ultimo=nuevo;// se indica que el ultimo dato ingresado pase como nuevo en la cabeza de nuestro cola\r\n }else{// se usa la condicon sino se cumple la primera\r\n ultimo.siguiente=nuevo;//se indica que ultimo dato ingresado apunte hacia siguente si es que hay un nuevo dato ingresado y que vaya aser el nuevo dato de la cola\r\n nuevo.siguiente=null;// se indica que el nuevo dato ingresado vaya y apunete hacia siguente y quees igual al null\r\n ultimo=nuevo;// se indica que el ultimo dato ingresado pase como nuevo dato\r\n }\r\n System.out.println(\"\\n dato ingresado correctamente\");// se imprime enl mensaje que el dato ha sido ingresado correctamente\r\n}", "@Transactional\r\n\r\n\t@Override\r\n\tpublic void insertar(Distrito distrito) {\n\t\tem.persist(distrito);\t\r\n\t}", "@Override\r\n\tpublic void inserir(Evento evento) {\n\t\trepository.save(evento);\r\n\t}", "public void insere(Pessoa pessoa){\n\t\tdb.save(pessoa);\n\t}", "int insertSelective(Tipologia record);", "public SgfensPedidoProductoPk insert(SgfensPedidoProducto dto) throws SgfensPedidoProductoDaoException;", "public static Efectivo insertEfectivo(int id_efectivo, int numero_pago){\n \n Efectivo miEfectivo = new Efectivo(id_efectivo,numero_pago);\n miEfectivo.registrarEfectivo();\n return miEfectivo;\n }", "@Override\r\n public Kiosque insertKiosque(Kiosque obj) {\r\n em.persist(obj);\r\n return obj;\r\n //To change body of generated methods, choose Tools | Templates.\r\n }", "@RequestMapping(method = RequestMethod.POST)\n\t\tpublic ResponseEntity<Void> inserir(@RequestBody Pedido obj) {\n\t\t\tobj = service.insere(obj);\n\t\t\tURI uri = ServletUriComponentsBuilder.fromCurrentRequest().path(\"/{id}\").buildAndExpand(obj.getId()).toUri();\n\t\t\treturn ResponseEntity.created(uri).build();\n\t\t}", "@Override\n\tpublic boolean insertOne(finalDataBean t) throws Exception {\n\t\treturn false;\n\t}", "int insert(Prueba record);", "public void insert(Object objekt) throws SQLException {\r\n\t\t \r\n\t\tPomagaloVO ul = (PomagaloVO) objekt;\r\n\r\n\t\tif (ul == null)\r\n\t\t\tthrow new SQLException(\"Insert \" + tablica\r\n\t\t\t\t\t+ \", ulazna vrijednost je null!\");\r\n\t\t \r\n\t\tConnection conn = null;\r\n\t\tPreparedStatement ps = null;\r\n\r\n\t\ttry {\r\n\t\t\tconn = conBroker.getConnection();\r\n\r\n\t\t\tps = conn.prepareStatement(insertUpit);\r\n\r\n\t\t\tps.setString(1, ul.getSifraArtikla());\r\n\t\t\tps.setString(2, ul.getNaziv());\r\n\t\t\tps.setInt(3, ul.getPoreznaSkupina().intValue());\r\n\r\n\t\t\tif (ul.getCijenaSPDVom() == null\r\n\t\t\t\t\t|| ul.getCijenaSPDVom().intValue() <= 0)\r\n\t\t\t\tps.setNull(4, Types.INTEGER);\r\n\t\t\telse\r\n\t\t\t\tps.setInt(4, ul.getCijenaSPDVom().intValue());\r\n\r\n\t\t\tString op = ul.getOptickoPomagalo() != null\r\n\t\t\t\t\t&& ul.getOptickoPomagalo().booleanValue() ? DA : NE;\r\n\r\n\t\t\tps.setString(5, op);\r\n\t\t\t\r\n\t\t\tps.setTimestamp(6, new Timestamp(System.currentTimeMillis()));\r\n\t\t\tps.setInt(7, NEPOSTOJECA_SIFRA);\r\n\t\t\tps.setTimestamp(8, null);\r\n\t\t\tps.setNull(9, Types.INTEGER);\r\n\r\n\t\t\tint kom = ps.executeUpdate();\r\n\r\n\t\t\tif (kom == 1) {\r\n\t\t\t\tul.setSifra(Integer.valueOf(0)); // po tome i pozivac zna da je\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t// insert uspio...\r\n\t\t\t}// if kom==1\r\n\t\t\telse {\r\n\t\t\t\t//Logger.fatal(\"neuspio insert zapisa u tablicu \" + tablica, null);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t\t// nema catch-anja SQL exceptiona... neka se pozivatelj iznad jebe ...\r\n\t\tfinally {\r\n\t\t\ttry {\r\n\t\t\t\tif (ps != null)\r\n\t\t\t\t\tps.close();\r\n\t\t\t} catch (SQLException e1) {\r\n\t\t\t}\r\n\t\t\tconBroker.freeConnection(conn);\r\n\t\t}// finally\r\n\r\n\t}", "public FaqPk insert(Faq dto) throws FaqDaoException;", "public RutaPk insert(Ruta dto) throws RutaDaoException;", "@Override\r\n public ProductosPuntoVentaPk insert(ProductosPuntoVenta dto)\r\n throws ProductosPuntoVentaDaoException {\r\n long t1 = System.currentTimeMillis();\r\n PreparedStatement stmt = null;\r\n try {\r\n // Validamos la conexion\r\n this.validateConnection();\r\n stmt = userConn.prepareStatement(SQL_INSERT);\r\n int index = 1;\r\n stmt.setInt(index++, dto.getIdPuntoVenta());\r\n stmt.setInt(index++, dto.getIdProducto());\r\n stmt.setInt(index++, dto.getCantidad());\r\n System.out.println(\"Executing \" + SQL_INSERT + \" with DTO: \" + dto);\r\n int rows = stmt.executeUpdate();\r\n long t2 = System.currentTimeMillis();\r\n System.out.println(rows + \" rows affected (\" + (t2 - t1) + \" ms)\");\r\n reset(dto);\r\n return dto.createPk();\r\n }\r\n catch (SQLException e) {\r\n e.printStackTrace();\r\n throw new ProductosPuntoVentaDaoException(\"Exception: \"\r\n + e.getMessage(), e);\r\n }\r\n finally {\r\n ResourceManager.close(stmt);\r\n }\r\n }", "@Override\r\n\tpublic void insertar() {\n\t\ttab_cuenta.eliminar();\r\n\t\t\r\n\t\t\r\n\t}", "@Override\n public int insertar(ClienteBean cliente) {\n clienteDAO = new ClienteDAOImpl();\n return clienteDAO.insertar (cliente);\n }", "private void insertData() {\r\n \r\n TeatroEntity teatro = factory.manufacturePojo(TeatroEntity.class);\r\n em.persist(teatro);\r\n FuncionEntity funcion = factory.manufacturePojo(FuncionEntity.class);\r\n List<FuncionEntity> lista = new ArrayList();\r\n lista.add(funcion);\r\n em.persist(funcion);\r\n for (int i = 0; i < 3; i++) \r\n {\r\n SalaEntity sala = factory.manufacturePojo(SalaEntity.class);\r\n sala.setTeatro(teatro);\r\n sala.setFuncion(lista);\r\n em.persist(sala);\r\n data.add(sala);\r\n }\r\n for (int i = 0; i < 3; i++) \r\n {\r\n SalaEntity sala = factory.manufacturePojo(SalaEntity.class);\r\n sala.setTeatro(teatro);\r\n em.persist(sala);\r\n sfdata.add(sala);\r\n }\r\n \r\n }", "public Ausschreibung insert(Ausschreibung as) {\r\n\r\n\t\t// DB-Verbindung herstellen\r\n\t\tConnection con = DBConnection.connection();\r\n\r\n\t\ttry {\r\n\t\t\t// Leeres SQL-Statement (JDBC) anlegen\r\n\t\t\tStatement stmt = con.createStatement();\r\n\r\n\t\t\t// Momentan hoechsten Primaerschluesselwert pruefen\r\n\t\t\tResultSet rs = stmt.executeQuery(\"SELECT MAX(id) AS maxid \" + \"FROM ausschreibung \");\r\n\r\n\t\t\t// Wenn wir etwas zurueckerhalten, kann dies nur einzeilig sein\r\n\t\t\tif (rs.next()) {\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t * as erhaelt den bisher maximalen, nun um 1 inkrementierten\r\n\t\t\t\t * Primaerschluessel.\r\n\t\t\t\t */\r\n\r\n\t\t\t\tas.setId(rs.getInt(\"maxid\") + 1);\r\n\r\n\t\t\t\tstmt = con.createStatement();\r\n\r\n\t\t\t\t// Jetzt erst erfolgt die tatsaechliche Einfuegeoperation\r\n\t\t\t\tstmt.executeUpdate(\r\n\t\t\t\t\t\t\"INSERT INTO ausschreibung (ID, Bezeichnung, Ausschreibungstext, Bewerbungsfrist, Projekt_ID) \"\r\n\t\t\t\t\t\t\t\t+ \"VALUES ('\" + as.getId() + \"','\" + as.getBezeichnung() + \"','\"\r\n\t\t\t\t\t\t\t\t+ as.getAusschreibungstext() + \"','\"\r\n\t\t\t\t\t\t\t\t+ DBConnection.convertToSQLDateString(as.getBewerbungsfrist()) + \"','\"\r\n\t\t\t\t\t\t\t\t+ as.getProjektId() + \"')\");\r\n\t\t\t}\r\n\r\n\t\t} catch (SQLException e1) {\r\n\t\t\te1.printStackTrace();\r\n\t\t}\r\n\t\t// Rueckgabe, der evtl. korrigierten Ausschreibung.\r\n\t\treturn as;\r\n\t}", "public void insertarAlimento (int id_alimento, String nombre, String estado, float caloria, float proteinas,float grasas, float hidratos_de_carbono, float H20, float NE, float vitamina_a, float vitamina_B1, float vitamina_B2, float vitamina_C, float Niac, float sodio, float potasio, float calcio, float magnesio, float cobre, float hierro, float fosforo, float azufre, float cloro, float Fen, float Ileu, float Leu, float Lis, float Met, float Tre, float Tri, float Val, float Acid, float AlCAL);", "public int persisteInformacionInsertSelect(String queryInserSelect, String idProceso) throws Exception;", "private long insert(SQLiteDatabase db, Object o) {\n\t\tContentValues values = createContentValues(o);\n\t\tif (values != null) {\n\t\t\treturn db.insert(getTableName(o.getClass()), null, values);\n\t\t}\n\t\treturn -1L;\n\t}", "public SmsAgendaGrupoPk insert(SmsAgendaGrupo dto) throws SmsAgendaGrupoDaoException;", "@Test\n public void testInsert() {\n int resultInt = disciplineDao.insert(disciplineTest);\n // Je pense à le suppr si l'insert à fonctionné\n if(resultInt > 0){\n disciplineTest.setId(resultInt);\n disciplineDao.delete(disciplineTest);\n }\n assertTrue(resultInt > 0);\n }", "public int inserir(Jogador elemento) throws Exception {\n\t\tint posicao = funcaoHash(elemento.getAltura());\n\n\t\t// Verificar se esse elemento ja esta na lista\n\t\tif (tabela[posicao].localizar(elemento.getNome()) == null)\n\t\t\t// Elemento nao inserido ainda\n\t\t\ttabela[posicao].inserir(elemento, 0); // Nao sabe quantos elementos lista vai ter, sempre inserir no inicio\n\t\telse\n\t\t\t// Elemento ja inserido\n\t\t\tposicao = -1;\n\n\t\treturn posicao;\n\n\t}", "public void insertar(Trabajo t){\r\n\t\tif(!estaLlena()){\r\n\t\t\tultimo = siguiente(ultimo);\r\n\t\t\telementos[ultimo] = t;\r\n\t\t}\r\n\t}", "@Override\r\n\tpublic MensajeBean inserta(Tramite_presentan_info_impacto nuevo) {\n\t\treturn tramite.inserta(nuevo);\r\n\t}", "@Override\n\tpublic int insert(Object ob) {\n\t\t\n\t\tint res = session.insert(\"party.party_insert_one\",ob);\n\t\t\n\t\treturn res;\n\t}", "public int insertContrato(Contrato c) {\r\n\t\tif (getContrato(c.getNumeroContrato())!=null) return -1;\r\n//\t\tinsertCache(c, \"Contrato\");\r\n\t\tint i = controlador.insertContrato(c, this.getEmpleadoActual().getDepartamentoId());\t\t\r\n\t\tc.setNumeroContrato(i);\r\n\t\t\r\n\t\tcontratos.add(c);\r\n\t\treturn i;\r\n\t}", "public CrGrupoFormularioPk insert(CrGrupoFormulario dto) throws CrGrupoFormularioDaoException;", "public Bewerbung insert(Bewerbung bewerbung, int ausschreibungId, int organisationsId) {\r\n\t\tConnection con = DBConnection.connection();\r\n\r\n\t\tSimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd\");\r\n\t\t\r\n\t\t\r\n\t\ttry {\r\n\t\t\tStatement stmt = con.createStatement();\r\n\r\n\t\t\tResultSet rs = stmt.executeQuery(\"SELECT MAX(id) AS maxid \" + \"FROM Bewerbung \");\r\n\t\t\t\r\n\t\t\tif(rs.next()){\r\n\t\t\t\tbewerbung.setBewerbungId(rs.getInt(\"maxid\")+1);\r\n\t\t\t\t\r\n\t\t\t\tstmt.executeUpdate(\r\n\t\t\t\t\t\t\"INSERT INTO Bewerbung (id, erstelldatum, bewerbungstext, ausschreibung_id, organisationseinheit_id, status, projektname, ausschreibungsname)\"\r\n\t\t\t\t\t\t\t\t+ \"VALUES ('\" + bewerbung.getBewerbungId() + \"','\"\r\n\t\t\t\t\t\t\t\t+ sdf.format(bewerbung.getErstelldatum()) + \"','\" + bewerbung.getBewerbungstext()\r\n\t\t\t\t\t\t\t\t+ \"', '\" + ausschreibungId + \"', '\" + organisationsId + \"', '\" + bewerbung.getStatus()\r\n\t\t\t\t\t\t\t\t+ \"', '\" + bewerbung.getProjektname() + \"', '\" + bewerbung.getAusschreibungsname()\r\n\t\t\t\t\t\t\t\t+ \"');\");\r\n\n\t\t\t}\r\n\t\t} catch (SQLException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\treturn bewerbung;\r\n\t}", "int insert(ParUsuarios record);", "public int insert(IEntity entity) throws SQLException;", "@RequestMapping(method=RequestMethod.POST)\n\tpublic ResponseEntity<Void> insert(@Valid @RequestBody ClienteNewDTO objDTO){\n\t\t\n\t\tCliente obj = service.fromDTO(objDTO);\n\t\tobj = service.insert(obj);\n\t\t\n\t\t//abaixo uma boa pratica para retornar a url do novo objeto quandro cria-lo\n\t\tURI uri = ServletUriComponentsBuilder.fromCurrentRequest()\n\t\t\t\t\t.path(\"/{id}\").buildAndExpand(obj.getId()).toUri(); //o from currente request vai pegar a requisicao atual, e logo depois a gente add o /id\n\t\t\n\t\treturn ResponseEntity.created(uri).build();\n\t}", "@Test\r\n public void testCarregarPeloId() throws Exception {\r\n tx.begin();\r\n Categoria categoria = new Categoria(\"Teste carregar categoria por id\");\r\n dao.persiste(categoria);\r\n tx.commit();\r\n em.refresh(categoria);\r\n Long id = categoria.getId();\r\n Categoria result = dao.carregarPeloId(id);\r\n assertEquals(categoria, result);\r\n \r\n }", "@Override\r\n\tpublic Ngo insert(Ngo obj) {\n\t\treturn null;\r\n\t}", "public long save(Registro r) {\n\n long id = r.getCodigo();\n SQLiteDatabase db = banco.getWritableDatabase();\n try {\n\n\n ContentValues values = new ContentValues();\n\n SimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-M-d\");\n String dateString = sdf.format(r.getData());\n values.put(\"data\", dateString);\n values.put(\"distancia\", r.getDistancia());\n values.put(\"consumo\", r.getConsumo());\n values.put(\"mediaAceleracao\", r.getMediaAberturaBorboleta());\n values.put(\"mediaConsumo\", r.getMediaConsumo());\n values.put(\"codTipoCombustivel\", r.getTipoCombustivel().getCodigo());\n values.put(\"codCarro\", r.getCarro().getCodigo());\n values.put(\"codUsuario\", r.getUsuario().getCodigo());\n\n if (id != 0) {//SE O ID É DIFERENTE DE 0 ATUALIZA,\n\n System.out.println(\"Entrou !!\");\n String _id = String.valueOf(r.getCodigo());\n String[] whereArgs = new String[]{_id};\n\n // update registro set values = ... where _id=?\n int count = db.update(TABELA, values, \"codigo=?\", whereArgs);\n\n return count;\n } else {\n\n id = db.insert(TABELA, \"\", values);\n System.out.println(\"Deu certo !! \\n \" + values);\n return id;\n }\n } finally {\n db.close();\n }\n }", "int insert(Cargo record);", "int insertSelective(ParUsuarios record);", "public static void inserir(Venda venda)\r\n throws Exception {\r\n venda.setId(totalVenda++);\r\n listaVenda.add(venda);\r\n }", "@Override\r\n\tpublic void insert(Object obj) throws DAOException {\n\t\tOfferta offerta;\r\n\t\ttry {\r\n\t\t\tofferta = (Offerta) obj;\r\n\r\n\t\t\tconn = getConnection(usr, pass);\r\n\r\n\t\t\tps = conn.prepareStatement(insertQuery);\r\n\r\n\t\t\tSystem.out.println(\"Inserimento dell'offerta nel db.\");\r\n\t\t\tofferta.print();\r\n\r\n\t\t\tps.setInt(1, offerta.getIdOfferta());\r\n\t\t\tps.setInt(2, offerta.getIdTratta());\r\n\t\t\tps.setInt(3, offerta.getData().getGiorno());\r\n\t\t\tps.setInt(4, offerta.getData().getMese());\r\n\t\t\tps.setInt(5, offerta.getData().getAnno());\r\n\t\t\tps.setInt(6, offerta.getOraPartenza().getOra());\r\n\t\t\tps.setInt(7, offerta.getOraPartenza().getMinuti());\r\n\t\t\tps.setInt(8, offerta.getOraArrivo().getOra());\r\n\t\t\tps.setInt(9, offerta.getOraArrivo().getMinuti());\r\n\t\t\tps.setInt(10, offerta.getPosti());\r\n\t\t\tps.setInt(11, offerta.getDataInserimento().getGiorno());\r\n\t\t\tps.setInt(12, offerta.getDataInserimento().getMese());\r\n\t\t\tps.setInt(13, offerta.getDataInserimento().getAnno());\r\n\r\n\t\t\tps.executeUpdate();\r\n\r\n\t\t} catch (ClassCastException e) {\r\n\t\t\tthrow new DAOException(\"Errore in insert ClassCastException.\");\r\n\t\t} catch (SQLException e) {\r\n\t\t\tthrow new DAOException(\"Errore in insert SQLException.\");\r\n\t\t}\r\n\r\n\t}", "int insert(DebtsRecordEntity record);", "public void ajouter() {\n position = graph.edges.ajouterElement(this);\n origine.successeurs.inserer(destination);\n destination.predecesseurs.inserer(origine);\n origine.aretes_sortantes.inserer(this);\n destination.aretes_entrantes.inserer(this);\n }", "Reservierung insert(Reservierung reservierung) throws ReservierungException;", "public void inserir(ContaBancaria contaBancaria) {\n\t\tcontas.add(contaBancaria);\n\n\t}", "@Override\n public void insert(J34SiscomexMercadoriaAdi j34SiscomexMercadoriaAdi) {\n super.doInsert(j34SiscomexMercadoriaAdi);\n }", "@Override\n\tpublic Tutorial insert(Tutorial t) {\n\t\treturn cotizadorRepository.save(t);\n\n\t\t\n\t}", "@Override\n public int insert(KlantBedrijf kb) {\n Connection connection = createConnection();\n int id = -1;\n try {\n PreparedStatement preparedStatement = connection.prepareStatement(\"INSERT INTO klant_has_bedrijf (klant_id,bedrijf_id) VALUES (?,?)\", Statement.RETURN_GENERATED_KEYS);\n preparedStatement.setInt(1, kb.getKlantId());\n preparedStatement.setInt(2, kb.getBedrijfId());\n preparedStatement.executeUpdate();\n\n ResultSet rs = preparedStatement.getGeneratedKeys();\n rs.next();\n id = rs.getInt(1);\n rs.close();\n } catch (SQLException e) {\n e.printStackTrace();\n }\n closeConnection(connection);\n return id;\n }", "private void insertar() {\n String nombre = edtNombre.getText().toString();\n String telefono = edtTelefono.getText().toString();\n String correo = edtCorreo.getText().toString();\n // Validaciones\n if (!esNombreValido(nombre)) {\n TextInputLayout mascaraCampoNombre = (TextInputLayout) findViewById(R.id.mcr_edt_nombre_empresa);\n mascaraCampoNombre.setError(\"Este campo no puede quedar vacío\");\n } else {\n mostrarProgreso(true);\n String[] columnasFiltro = {Configuracion.COLUMNA_EMPRESA_NOMBRE, Configuracion.COLUMNA_EMPRESA_TELEFONO\n , Configuracion.COLUMNA_EMPRESA_CORREO, Configuracion.COLUMNA_EMPRESA_STATUS};\n String[] valorFiltro = {nombre, telefono, correo, estado};\n Log.v(\"AGET-ESTADO\", \"ENVIADO: \" + estado);\n resultado = new ObtencionDeResultadoBcst(this, Configuracion.INTENT_EMPRESA_CLIENTE, columnasFiltro, valorFiltro, tabla, null, false);\n if (ID.isEmpty()) {\n resultado.execute(Configuracion.PETICION_EMPRESA_REGISTRO, tipoPeticion);\n } else {\n resultado.execute(Configuracion.PETICION_EMPRESA_MODIFICAR_ELIMINAR + ID, tipoPeticion);\n }\n }\n }", "@Override\n\tpublic void Insert(PersonelContract entity) {\n\n\t}", "@Override\n public boolean insertar(ModelCliente cliente) {\n strSql = \"INSERT INTO CLIENTE (ID_CLIENTE, NOMBRE, APELLIDO, NIT, TELEFONO, DIRECCION,ID_EMPRESA) \"\n + \"VALUES ( (SELECT ISNULL(MAX(ID_CLIENTE),0) + 1 FROM CLIENTE), \" + \n \"'\" + cliente.getNombre() + \"', \" + \n \"'\" + cliente.getApellido()+ \"', \" + \n \"'\" + cliente.getNit() + \"', \" +\n \"'\" + cliente.getTelefono()+ \"', \" +\n \"'\" + cliente.getDireccion()+ \"',\" +\n \"\" + cliente.getIdEmpresa()+ \"\" + \n \")\";\n \n try {\n //se abre una conexión hacia la BD\n conexion.open();\n //Se ejecuta la instrucción y retorna si la ejecución fue satisfactoria\n respuesta = conexion.executeSql(strSql);\n //Se cierra la conexión hacia la BD\n conexion.close();\n \n } catch (ClassNotFoundException ex) {\n Logger.getLogger(DaoCliente.class.getName()).log(Level.SEVERE, null, ex); \n return false;\n } catch(Exception ex){\n Logger.getLogger(DaoCliente.class.getName()).log(Level.SEVERE, null, ex); \n }\n return respuesta;\n }", "public boolean inserir(GrauParentesco grauParentesco) throws Exception ;", "public void insertar(String dato){\r\n \r\n if(estaVacia()){\r\n \r\n primero = new NodoJugador(dato);\r\n }else{\r\n NodoJugador temporal = primero;\r\n while(temporal.getSiguiente()!=null){\r\n temporal = temporal.getSiguiente();\r\n }\r\n \r\n temporal.setSiguiente(new NodoJugador(dato));\r\n }\r\n }", "@Override\n\tpublic int insert(Idol idol) {\n\t\treturn session.insert(\"idols.insert\",idol);\n\t}", "public void insert(Doacao doacao) {\n SQLiteDatabase sqLiteDatabase = getWritableDatabase();\n\n //Abrindo o mapeamento dos dados para o insert\n ContentValues dados = new ContentValues();\n\n dados.put(\"id_participa_campanha\",doacao.getId_participa_campanha());\n dados.put(\"id_recurso\",doacao.getId_recurso());\n dados.put(\"data\",doacao.getData());\n dados.put(\"quantidade\",doacao.getQuantidade());\n\n\n sqLiteDatabase.insert(\"doacao\",null, dados);\n\n }", "public void createDespesaDetalhe(ArrayList<PagamentoDespesasDetalhe> listaDespesasInseridas, int idDespesa) throws Exception {\n\r\n for(int i=0; i < listaDespesasInseridas.size(); i++){\r\n \r\n open(); //abre conexão com o banco de dados\r\n\r\n //define comando para o banco de dados\r\n stmt = con.prepareStatement(\"INSERT INTO pagamentoDespesasDetalhe(valor, dataPagamento, status, idDespesas, idFormaPagamento) VALUES (?,?,?,?,?)\");\r\n\r\n //atribui os valores das marcações do comando acima \r\n stmt.setFloat(1, listaDespesasInseridas.get(i).getValor());\r\n stmt.setString(2, listaDespesasInseridas.get(i).getDataPagamento());\r\n stmt.setInt(3, listaDespesasInseridas.get(i).getStatus());\r\n stmt.setInt(4, idDespesa);\r\n stmt.setInt(5, listaDespesasInseridas.get(i).getIdFormaPagamento());\r\n\r\n stmt.execute();//executa insert no banco de dados\r\n\r\n close();//fecha conexão com o banco de dados\r\n \r\n } \r\n\r\n }", "public ItemsPk insert(Items dto) throws ItemsDaoException;", "public Mascota insert(Mascota mascota){\n if(mascota != null)\n mascotaRepository.save(mascota);\n return mascota;\n }", "@Transactional\n\tpublic void insert(UserMtl userMtl,Integer idt){\n\t\tTree pasteT = owsSession.getSourceT();\n\t\tlog.debug(idt);\n\t\tlog.debug(pasteT);\n\t\tinsert(idt,pasteT,idt);\n\t}", "@Override\n public void add(Curso entity) {\n Connection c = null;\n PreparedStatement pstmt = null;\n\n try {\n c = DBUtils.getConnection();\n pstmt = c.prepareStatement(\"INSERT INTO curso (nombrecurso, idprofesor, claveprofesor, clavealumno) values (?, ?, ?, ?)\");\n\n pstmt.setString(1, entity.getNombre());\n pstmt.setInt(2, (entity.getIdProfesor() == 0)?4:entity.getIdProfesor() ); //creo que es sin profesor confirmado o algo por el estilo\n pstmt.setString(3, entity.getClaveProfesor());\n pstmt.setString(4, entity.getClaveAlumno());\n \n pstmt.execute();\n } catch (Exception e) {\n e.printStackTrace();\n } finally {\n try {\n if (pstmt != null) {\n pstmt.close();\n }\n DBUtils.closeConnection(c);\n } catch (SQLException ex) {\n Logger.getLogger(JdbcCursoRepository.class.getName()).log(Level.SEVERE, null, ex);\n }\n }\n }", "boolean agregarIngreso(Ingreso i) {\n boolean hecho = false;\n try {\n operacion = ayudar.beginTransaction();\n ayudar.save(i);\n operacion.commit();\n } catch (Exception e) {\n operacion.rollback();\n System.out.println(e);\n }\n return hecho;\n }", "public OrderItem insertOrderItem(OrderItem orderItem)\n\t{\n\t\tOrderItem orderIt=orderItemDAO.insert(orderItem);\n\t\tif(findOrderItemById(orderIt.getId())==null)\n\t\t{\n\t\t\tSystem.out.println(\"Produsul comandat nu a putut fi inserat\");\n\t\t\treturn null;\n\t\t}\n\t\treturn orderIt;\n\t}", "@Override\npublic boolean saveCharitCom(Long idcommande,Charite Charite) {\n\tCommande c1= commandeDao.findOne(idcommande);\n\tSet<Commande> c= new HashSet<Commande>();\n\tc.add(c1);\n\t//Events e1 = eventDAO.findOne(idcommande);\n\tCharite.setCommandeCharite(c);\n\tchariteRepository.save(Charite);\n\treturn true;\n}", "private int insert(Consulta p) {\n Connection con = null;\r\n PreparedStatement pstm = null;\r\n int retorno = -1;\r\n try {\r\n con = ConnectionFactory.getConnection();\r\n pstm = con.prepareStatement(INSERT, Statement.RETURN_GENERATED_KEYS);\r\n\r\n pstm.setDate(1, new java.sql.Date(p.getDataDaConsulta().getTime()));\r\n pstm.setString(2, p.getDescricao());\r\n pstm.setString(3, p.getTipoConsulta());\r\n pstm.setTime(4, p.getHorario());\r\n pstm.setInt(5, p.getPaciente().getCodigo());\r\n pstm.execute();\r\n try (ResultSet rs = pstm.getGeneratedKeys()) {\r\n if (rs.next()) {\r\n retorno = rs.getInt(1);\r\n }\r\n }\r\n } catch (SQLException e) {\r\n JOptionPane.showMessageDialog(null, \"Erro ao inserir consulta: \" + e.getMessage());\r\n } finally {\r\n try {\r\n\r\n ConnectionFactory.closeConnection(con, pstm);\r\n\r\n } catch (SQLException e) {\r\n JOptionPane.showMessageDialog(null, \"Erro ao finalizar conexão em inserir paciente: \" + e.getMessage());\r\n }\r\n }\r\n return retorno;\r\n }", "int insert(Commet record);", "public static void insertFournisseur(Fournisseur unFournisseur ) {\n Bdd uneBdd = new Bdd(\"localhost\", \"paruline \", \"root\", \"\");\n\n String checkVille = \"CALL checkExistsCity('\" + unFournisseur.getVille() + \"','\" + unFournisseur.getCp() + \"');\";\n try {\n uneBdd.seConnecter();\n Statement unStat = uneBdd.getMaConnection().createStatement();\n\n ResultSet unRes = unStat.executeQuery(checkVille);\n\n int nb = unRes.getInt(\"nb\");\n\n if (nb == 0) {\n String ajoutVille = \"CALL InsertCity('\" + unFournisseur.getVille() + \"', '\" + unFournisseur.getCp() + \"');\";\n\n try {\n Statement unStatAjout = uneBdd.getMaConnection().createStatement();\n\n unStatAjout.executeQuery(ajoutVille);\n unStatAjout.close();\n }\n catch (SQLException e) {\n System.out.println(\"Erreur : \" + ajoutVille);\n }\n }\n\n String id = \"CALL GetCity('\" + unFournisseur.getVille() + \"', '\" + unFournisseur.getCp() + \"')\";\n\n try {\n Statement unStatId = uneBdd.getMaConnection().createStatement();\n\n ResultSet unResId = unStatId.executeQuery(id);\n\n int id_city = unResId.getInt(\"id_city\");\n\n\n\n String insertFournisseur = \"INSERT INTO fournisseur(id_city, name_f, adresse_f, phoneFour) VALUES (\" + id_city + \", '\" + unFournisseur.getNom() + \"', \" +\n \"'\" + unFournisseur.getAdresse() + \"', '\" + unFournisseur.getTelephone() + \"')\";\n\n try {\n Statement unStatFourn = uneBdd.getMaConnection().createStatement();\n unStatFourn.executeQuery(insertFournisseur);\n\n unStatFourn.close();\n }\n catch (SQLException e) {\n System.out.println(\"Erreur : \" + insertFournisseur);\n }\n\n unResId.close();\n unStatId.close();\n }\n catch (SQLException e) {\n System.out.println(\"Erreur : \" + id);\n }\n\n unRes.close();\n unStat.close();\n uneBdd.seDeConnecter();\n } catch (SQLException exp) {\n System.out.println(\"Erreur : \" + checkVille);\n }\n }" ]
[ "0.67818576", "0.67190343", "0.66672605", "0.66605115", "0.65675634", "0.65429085", "0.65168345", "0.6504122", "0.650037", "0.6500019", "0.6474243", "0.6451661", "0.64505154", "0.6420305", "0.64054334", "0.6398164", "0.6392416", "0.63917345", "0.6366918", "0.6357904", "0.6357682", "0.6351413", "0.6343185", "0.6325481", "0.6324698", "0.6318577", "0.6295544", "0.62913305", "0.627846", "0.6276451", "0.62757504", "0.6270576", "0.62482965", "0.62417287", "0.6239111", "0.6223295", "0.6219867", "0.6214744", "0.6212502", "0.6195288", "0.6188368", "0.6167161", "0.61623406", "0.61582845", "0.61465514", "0.6141766", "0.61328226", "0.6126591", "0.6113636", "0.61089945", "0.6100937", "0.6096891", "0.60902435", "0.6088314", "0.60874474", "0.6080816", "0.60789704", "0.60725164", "0.6068846", "0.60615146", "0.60563874", "0.60529494", "0.6048818", "0.60437495", "0.6015367", "0.6013519", "0.6012972", "0.60124856", "0.6008149", "0.6002743", "0.60006636", "0.59938955", "0.59909093", "0.597916", "0.5962816", "0.5960496", "0.5959295", "0.5957741", "0.5957356", "0.5954947", "0.5954757", "0.59511197", "0.59487826", "0.5940203", "0.5939988", "0.59396195", "0.5938361", "0.5937793", "0.5934976", "0.59346026", "0.5931515", "0.593056", "0.5929551", "0.59267133", "0.59206253", "0.5920469", "0.59198254", "0.5907261", "0.59065706", "0.58992845", "0.58941317" ]
0.0
-1
hier greift das Programm auf die Zeit zu
public void starteSpiel(ActionEvent actionEvent) { System.out.println("Started"); //https://www.programcreek.com/java-api-examples/?api=javafx.animation.AnimationTimer //60 fps new AnimationTimer() { public void handle(long currentNanoTime) { // calculate time since last update. moveBall(); } }.start(); // Was diese? }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void softwareResources() {\n\t\tSystem.out.println(\"I am the software implemented through Multiple inheritence in Desktop class\");\r\n\t\t\r\n\t}", "public static void main(String[] args) {\nDesktop desk=new Desktop();\r\ndesk.hardWareResources();\r\ndesk.softwareWareResources();\r\ndesk.deskTopModel();\r\n\r\n\t\t\r\n\t\t\r\n\t}", "public void startApp()\r\n\t{\n\t}", "public ProgramWilmaa()\n\t{\n\t}", "public static void main(){\n\t}", "public void exec(OxProgram pgm) {\n }", "public static void proManMain(){\n\n //Displaying the menu options by using the system out method\n System.out.println(\"1 - Create a new Project Manager Profile\");\n System.out.println(\"2 - Search for Project Manager Profile\\n\");\n\n System.out.println(\"0 - Continue\");\n }", "private DungeonBotsMain() {\n\t\t// Does nothing.\n\t}", "public static void archMain(){\n\n //Displaying the menu options by using the system out method\n System.out.println(\"1 - Create a new Architect Profile\");\n System.out.println(\"2 - Search for Architect Profile\\n\");\n\n System.out.println(\"0 - Continue\");\n }", "public static void main()\n\t{\n\t}", "public void runProgram() {\n\n\t\tSystem.out.println(\"\\n Time to start the machine... \\n\");\n\n\t\tpress.pressOlive(myOlives);\n\n\t\tSystem.out.println(\"Total amount of oil \" + press.getTotalOil());\n\t}", "private Main() {\n\n super();\n }", "String getProgram()\n\t\t{\n\t\t\treturn mProgram;\n\t\t}", "public static void main() {\n \n }", "public String program();", "protected Program getProgram() {\n final Holder<Program> holder = Holder.of( null );\n Hook.PROGRAM.run( holder );\n if ( holder.get() != null ) {\n return holder.get();\n }\n\n return Programs.standard();\n }", "public String getProgram() {\n return program;\n }", "public void startCommandLine() {\r\n Object[] messageArguments = { System.getProperty(\"app.name.display\"), //$NON-NLS-1$\r\n System.getProperty(\"app.version\") }; //$NON-NLS-1$\r\n MessageFormat formatter = new MessageFormat(\"\"); //$NON-NLS-1$\r\n formatter.applyPattern(Messages.MainModel_13.toString());\r\n TransportLogger.getSysAuditLogger().info(\r\n formatter.format(messageArguments));\r\n }", "public static void main(String[] args) {\n Program1 p=new Program1();\r\n Program1 p1= new Program1();\r\n System.out.println(\"sdsad\");\r\n \r\n \r\n\t\t\r\n\t\t\r\n\t}", "public static void main(String[]args) {\n\t\n\t\t\n\n}", "@Override\r\n\tpublic void program() {\n\t\tSystem.out.println(\"我是一名Java工程师\");\r\n\t}", "@Override\r\n\tpublic void launch() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void launch() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void launch() {\n\t\t\r\n\t}", "public void runProgram() {\n\t\tJTextPane code = ((MinLFile) tabbedPane.getSelectedComponent()).CodeArea;\n\t\tminc.consolearea.setText(\"\");\n\t\tinterpretorMainMethod(code.getText(), 0);\n\t\tdouble_variables.clear();\n\t\tstring_variables.clear();\n\t\tfunctions.clear();\n\t}", "private Main ()\n {\n super ();\n }", "public static void main(String[] args) {\n\n\n //1.5 Call the above instance method into the Main method and Run the programme.\n\n Program1 obj = new Program1();\n obj.m1();\n\n\n }", "public boolean isMainProgram() {\n return this.getName() == null;\n }", "public void runProgram()\n\t{\n\t\tintro();\n\t\tfindLength();\n\t\tguessLetter();\n\t\tguessName();\n\t}", "public static void main(String[] args) {\n ICommand[] commandRegister = {\n new LeagueCmd(),\n new TeamCmd(),\n new MatchCmd(),\n new LoadCmd(),\n new SaveCmd()\n };\n if (Utils.initSaveFileLocation()) {\n final CommandHandler cmdHandler = new CommandHandler(commandRegister);\n Scanner scanner = new Scanner(System.in);\n boolean isExited = false;\n String userInput;\n String[] exitCmd = {\"exit\", \"quit\", \"close\"};\n\n System.out.println(\"# CompetitionManager.\\nAfin d'afficher la liste des commandes, entrez \\\"help\\\".\");\n Utils.displayBasePath();\n\n while (!isExited) {\n // Boucle de lecture des commandes\n System.out.printf(\"%s> \", renderSelected());\n userInput = scanner.nextLine();\n if (Arrays.asList(exitCmd).contains(userInput)) isExited = true;\n else cmdHandler.handleMessage(userInput);\n }\n } else {\n System.out.println(\"Une erreur est survenue lors de l'initialisation de l'application.\");\n }\n }", "public static void main(){\n\t\tint option = getUserOption();\n\t\t/** switch case option start below */\n\t\tswitch (option){\n\t\t\tcase 1 : ToScreen.listEmployee(employee.getAllEmployee(), true); main();\n\t\t\t\tbreak;\n\t\t\tcase 2 : listStaffByCategory();\n\t\t\t\tbreak;\n\t\t\tcase 3 : ToScreen.listAdminStaffTask(employee.getAllAdminStaff(), true);main();\n\t\t\t\tbreak;\n\t\t\tcase 4 : searchStaffByName();\n\t\t\t\tbreak;\n\t\t\tcase 5 : ToScreen.listAnimal(animals.getAllAnimals(), true); main();\n\t\t\t\tbreak;\n\t\t\tcase 6 : ListAnimalByType();\n\t\t\t\tbreak;\n\t\t\tcase 7 : searchAnimalByName();\n\t\t\t\tbreak;\n\t\t\tcase 8 : MenuReception.main();\n\t\t\t\tbreak;\n\t\t\tcase 9 : System.exit(0);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tmain();\n\t\t}\n\t}", "public static void main(String[] args) {\n\t\t\r\n\t\tSystem.out.println(\"Start main\");\r\n\t\tSystem.out.println(\"sum of two num :\"+ new AppManager().sum(5,10));\r\n\t\tSystem.out.println(\"End main\");\r\n\t\t\r\n\t\t\r\n\t}", "public void geraeuschMachen() {\n System.out.println(\"BRUELL\");\n }", "public Main() {\n\t\tsuper();\n\t}", "public static void main(String[] args) {\nBasePotencia pot=new BasePotencia();\r\npot.calculaPot();\r\n\t}", "public String getExecutable();", "void launch();", "void launch();", "void launch();", "public void startProgram()\r\n\t{\r\n\t\tview.displayPlayerNames();\r\n\t\tview.loadGameData();\r\n\t\tview.displayGame();\r\n\t}", "public static void main(String[] args) {\n \r\n\t}", "public void iterateAndClickParticularProgram(final String programeName);", "@Override\r\n\t\t\tpublic void autStartProcess() {\n\t\t\t}", "void startup();", "void startup();", "public abstract void startup();", "public static void main(String[] args) {\n\t \t\n\t \t\n\t }", "public void startup(){}", "public void setMain(Main ProgramaSecundario) {\n\t\t\tSystem.out.println(\"setMain\");\r\n\t\t\tthis.ProgramaSecundario = ProgramaSecundario;\r\n\t\t}", "@Override\r\n\tpublic void work() {\n\t\tSystem.out.println( aname + \"Berkerja\");\r\n\t}", "private static void CLIapplication() {\n\n\t\tboolean done = false;\n\t\tdo {\n\t\t\tint choice = HQmenu();\n\t\t\tSite newSite;\n\n\t\t\tswitch(choice) {\n\t\t\tcase 1:\n\t\t\t\tSystem.out.println(\"Register exchange office\");\n\t\t\t\tnewSite = createNewSite();\n\t\t\t\tif(sites.containsKey(newSite.getSiteName())) {\n\t\t\t\t\tSystem.out.println(\"Site already registred!1\");\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tsites.putIfAbsent(newSite.getSiteName(), newSite);\t\t\t\t\t\n\t\t\t\t\twriteNewSiteToConfigFile(newSite.getSiteName());\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tif(sites.isEmpty()) {\n\t\t\t\t\tSystem.out.println(\"You need to register site(s) first.\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tCLIHelper.menuInput();\n\t\t\t\tbreak;\n\t\t\tcase 0:\n\t\t\t\tdone = true;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tSystem.out.println(\"Not a valid menu choice!\");\n\t\t\t}\n\t\t\tlogger.info(\"-------Task_Done-------\\n\");\n\t\t}while(!done);\n\t}", "public Program getProgram() {\n return this.program;\n }", "Program createProgram();", "Program createProgram();", "Program createProgram();", "public static void main(String args[]) throws Exception\n {\n \n \n \n }", "public static void main(String[] args){\n\n MyApp myApp = new MyApp(); //1\n myApp.runMyApp(); //2\n System.out.println(\"End of Program\"); //3\n }", "public static void main(String[] args) {\n new DisplayManager(new AppointmentMgr()).StartProg(true);\n //AppointmentMgr.makeAppt = new makeAppt(AppointmentMgr);\n //myMgr.screen2 = new Screen2(myMgr);\n\n //new MakeAppoinment().setVisible(true);\n //upldMedRec.setVisible(true);\n //makeAppt.setVisible(true);\n //showScreen1();\n //jButton2ActionPerformed(java.awt.event.ActionEvent evt)\n \n //makeAppt.jButton2ActionPerformed();\n\n \n \n }", "public static void main (String []args){\n }", "public static void main(String[] args) {\n\n\t\t/**************************************/\n\t\tboolean startPlanetensystem = true;\n\t\tboolean startFreierFall = true;\n\n\t\tboolean testExpliziteVerfahren = true;\n\t\tboolean testKonvergenzordnung = true;\n\t\t/**************************************/\n\n\t\tif (startPlanetensystem) {\n\t\t\tnew PlanetenGUI().setVisible(true);\n\t\t}\n\n\t\tif (startFreierFall) {\n\t\t\tnew FastTransportGui().setVisible(true);\n\t\t}\n\n\t\tif (testExpliziteVerfahren)\n\t\t\ttestExpliziteVerfahren();\n\t\t\n\t\tif(testKonvergenzordnung)\n\t\t{\n\t\t\ttestKonvergenzordnung();\n\t\t}\n\t}", "public void setApp(Main application) { this.application = application;}", "public static void main(String[] args)\r\t{", "public static void main (String args[]) {\n\t\t\n }", "String getExecutable();", "public static void main(String[] args){\n var system = VacSys.getInstance();\n system.main();\n }", "public static void main(String[] args) {\n\n\t\t\n\t\tSystem.out.println(\"Second Project !!!\");\n\t\t\n\t\tSystem.out.println(\"Second Project Second Line !!!\");\n\t\t\n\t\tSystem.out.println(\"Second Project Third Line !!!\");\n\t\t\n\t\tSystem.out.println(\"Broweser is close !!!\");\n\t\t\n\t\tSystem.out.println(\"Interner Off !!!\");\n\t\t\n\t\tSystem.out.println(\"New Add Class Friends !!!\");\n\t\t\n\t}", "private ThoseMain()\n {\n // Do nothing\n }", "public static void main(String[] args)\r\n {\n \r\n \r\n }", "@Override\n\tpublic String getExecutingProgramName() throws RemoteException {\n\t return null;\n\t}", "public static void main(String[] args) {\n\t \t\n\t \t\n\t}", "public static void main (String[] args) {\r\n\t\t \r\n\t\t}", "Programming(){\n\t}", "public static void main(String[] args) {\n \r\n MenuPrincipal iniciar=new MenuPrincipal();\r\n iniciar.mostrarMenu();\r\n \r\n \r\n }", "public static void main ( String[] args ) {\n PhoneBook myApp = new PhoneBook(); \r\n }", "public static void main(String args []){\n Vista miVista=new Vista();\n ListaEstudiantes miListaEstudiantes=new ListaEstudiantes();\n Grupo miGrupo=new Grupo();\n Controlador miControlador=new Controlador(miVista,miListaEstudiantes,miGrupo);\n miControlador.iniciar();\n\n }", "boolean launch();", "public static void main(String [] args){\n SmartPhone sm = new SmartPhone();\n sm.run();\n // System.out.println(sm.run());\n }", "@Override\n public void terminateProgram() {\n \n }", "public static void main() {\n }", "public static void main(String argv[]) {\n\n\n\n\t}", "public static void main(String vmargs[]) {\n\t\tewe.sys.Vm.startEwe(vmargs);\n\t\t/*\n\t\t * Gui.screenIs(Gui.PDA_SCREEN); Rect s =\n\t\t * (Rect)Window.getGuiInfo(Window.INFO_SCREEN_RECT,null,new Rect(),0);\n\t\t * //Gui.screenIs(Gui.PDA_SCREEN) if (Vm.isMobile() && s.height >= 400)\n\t\t * { Font defaultGuiFont = mApp.findFont(\"gui\"); int sz =\n\t\t * (int)(defaultGuiFont.getSize()); Font newGuiFont = new\n\t\t * Font(defaultGuiFont.getName(), defaultGuiFont.getStyle(), sz);\n\t\t * mApp.addFont(newGuiFont, \"gui\"); mApp.fontsChanged();\n\t\t * mApp.mainApp.font = newGuiFont; }\n\t\t */\n\t\tif (Gui.screenIs(Gui.PDA_SCREEN) && Vm.isMobile()) {\n\t\t\tVm.setSIP(Vm.SIP_LEAVE_BUTTON);\n\t\t}\n\n\t\t// get program command line parameters and switches\n\t\tString[] args = vmargs; // Vm.getProgramArguments(); <-- only works in\n\t\t// eclipse, but mixes the letters in the ewe-vm\n\t\t// (tested in ewe-1.49 on win xp)\n\t\tString configfile = null;\n\t\tboolean debug = false;\n\n\t\tfor (int i = 0; i < args.length; i++) {\n\t\t\tVm.debug(\"prog: \" + args[i]);\n\t\t\tVm.debug(\"vm: \" + vmargs[i]);\n\t\t\tif (args[i] != null && args[i].length() > 1\n\t\t\t\t\t&& (args[i].startsWith(\"-\") || args[i].startsWith(\"/\"))) {\n\t\t\t\tString c = args[i].substring(1, args[i].length());\n\t\t\t\tif (c.equalsIgnoreCase(\"c\")) {\n\t\t\t\t\tif (i < args.length - 1) {\n\t\t\t\t\t\tconfigfile = args[i + 1];\n\t\t\t\t\t\ti++;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t(new MessageBox(\n\t\t\t\t\t\t\t\t\"Error\",\n\t\t\t\t\t\t\t\tMyLocale\n\t\t\t\t\t\t\t\t\t\t.getMsg(7200,\n\t\t\t\t\t\t\t\t\t\t\t\t\"Usage: CacheWolf [-c <path to pref.xml>] [-debug]\"),\n\t\t\t\t\t\t\t\tFormBase.OKB)).execute();\n\t\t\t\t\t\t// return usage info\n\t\t\t\t\t\tewe.sys.Vm.exit(1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (c.equalsIgnoreCase(\"debug\")) {\n\t\t\t\t\t// Vm.debug(\"d\");\n\t\t\t\t\tdebug = true;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\tif (debug) {\n\t\t\tVm.debug(\"prg-args: \" + args.length);\n\t\t\tVm.debug(\"vm-args: \" + vmargs.length);\n\t\t}\n\n\t\tEditor mainF = new MainForm(debug, configfile);\n\t\tDevice.preventIdleState(true);\n\t\tmainF.execute();\n\t\tDevice.preventIdleState(false);\n\t\tewe.sys.Vm.exit(0);\n\t}", "public static void main(String[] args)\r\n {\r\n \r\n \r\n \r\n }", "public static void main(String[] args) {\r\n// Use for unit testing\r\n }", "public static void main(String[] args) {\n\t\tProperties prop = PropertySingleton.getInstance();\n\t\tif(prop == null){\n\t\t\tlog.error(\"Arquivo não encontrado\");\n\t\t}else{\n\t\t\tlog.debug(\"Ok!\");\n\t\t}\n\t\tlog.debug(\"Exibindo o application name da aplicação\");\n\t\tSystem.out.println(\"Application_name : \" + prop.getProperty(\"application_name\"));\n\t\tlog.debug(\"Exibindo a versão da aplicação\");\n\t\tSystem.out.println(\"Versão : \" + prop.getProperty(\"versao\"));\n\t\t\n\t}", "public Main() {\n initComponents();\n makeDirLookup();\n ta.setEditable(false);\n }", "public static void main(String[] args) {\n \r\n}", "@Override\n \tpublic void logProgramStart(String programName, String args, String whitelist, String blacklist) {\n \t\tSystem.out.println(\"Program started with name [\" + programName + \"] and args [\" + args + \"]\");\n \t\tSystem.out.println(\"Whitelist: \" + whitelist);\n \t\tSystem.out.println(\"Blacklist: \" + blacklist);\n \t\tSystem.out.println(\"=============================\");\n \t}", "public static void main(String[] args){\n\t\t\n\t\t\n \t}", "public String\n getProgram() \n {\n if(PackageInfo.sOsType == OsType.Windows) \n return (\"winimage.exe\");\n return super.getProgram();\n }", "public static void main(String[] args){\n\t\t\r\n\t}", "public static void main(String []args){\n\n }", "@Override\r\n\t\t\tpublic void autInitProcess() {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void autInitProcess() {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void autInitProcess() {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void autInitProcess() {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void autInitProcess() {\n\t\t\t\t\r\n\t\t\t}", "public static void main(String[] args) {\r\n\t\t\r\n\t}", "public static void main(String[] args) {\r\n\t\t\r\n\t}", "public static void main(String[] args) {\r\n\t\t\r\n\t}", "public static void main(String[] args) {\r\n\t\t\r\n\t}", "public void startProgram() {\n this.displayBanner();\n// prompt the player to enter their name Retrieve the name of the player\n String playersName = this.getPlayersName();\n// create and save the player object\n User user = ProgramControl.createPlayer(playersName);\n// Display a personalized welcome message\n this.displayWelcomeMessage(user);\n// Display the Main menu.\n MainMenuView mainMenu = new MainMenuView();\n mainMenu.display();\n }" ]
[ "0.62530255", "0.62043", "0.6192267", "0.6160606", "0.6030262", "0.60265607", "0.6009727", "0.6006827", "0.59947485", "0.5951877", "0.5948095", "0.5947329", "0.59439206", "0.5934995", "0.5895139", "0.58747536", "0.58705837", "0.5842311", "0.5811407", "0.58088756", "0.5805045", "0.5785411", "0.5785411", "0.5785411", "0.5782284", "0.5764157", "0.5763043", "0.5756508", "0.5729459", "0.57137907", "0.57037365", "0.57026416", "0.5674781", "0.5674011", "0.5670756", "0.56672716", "0.56672555", "0.56672555", "0.56672555", "0.5665542", "0.5656926", "0.56552094", "0.5654474", "0.56537336", "0.56537336", "0.5645063", "0.56422824", "0.56421226", "0.56407267", "0.56362164", "0.5634216", "0.56305265", "0.56271964", "0.56271964", "0.56271964", "0.5626412", "0.56255776", "0.56172055", "0.56138164", "0.5613134", "0.5609205", "0.5602359", "0.5600513", "0.56001604", "0.5595078", "0.55932015", "0.55916774", "0.55871284", "0.55855584", "0.5582899", "0.5581307", "0.557299", "0.5564753", "0.55626905", "0.55597544", "0.5557546", "0.5556441", "0.55504864", "0.5547833", "0.55459803", "0.5545381", "0.55350995", "0.5531087", "0.5528338", "0.5527237", "0.55192554", "0.5517155", "0.55165726", "0.55101734", "0.55074084", "0.55028903", "0.55015856", "0.55015856", "0.55015856", "0.55015856", "0.55015856", "0.5500448", "0.5500448", "0.5500448", "0.5500448", "0.5496625" ]
0.0
-1
calculate time since last update.
public void handle(long currentNanoTime) { moveBall(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "long getTsUpdate();", "public long getTimeElapsed() {\r\n\t long now = new Date().getTime();\r\n\t long timePassedSinceLastUpdate = now - this.updatedSimTimeAt;\r\n\t return this.pTrialTime + timePassedSinceLastUpdate;\r\n\t}", "@SuppressWarnings(\"unused\")\n Date getLastUpdateTime();", "public Date getTimeUpdate() {\n return timeUpdate;\n }", "public long getLastUpdateTs() {\n return lastUpdateTs;\n }", "long getLastUpdatedTime();", "public long lastTime()\r\n/* 219: */ {\r\n/* 220:412 */ return this.lastTime.get();\r\n/* 221: */ }", "public Date getUpdateTime()\n/* */ {\n/* 191 */ return this.updateTime;\n/* */ }", "public Date getUpdateTime()\n {\n return data.updateTime;\n }", "Date getUpdateTime();", "public long getTsUpdate() {\n return tsUpdate_;\n }", "public Date getUpdate_time() {\n return update_time;\n }", "public Date getUpdate_time() {\n return update_time;\n }", "public long getTsUpdate() {\n return tsUpdate_;\n }", "private long CurrentTime(){\n return (TotalRunTime + System.nanoTime() - StartTime)/1000000;\n }", "public Date getUpdatetime() {\r\n return updatetime;\r\n }", "public Date getUpdateTime() {\n\t\treturn this.updateTime;\n\t}", "public String getUpdatetime() {\n\t\treturn updatetime;\n\t}", "public String getUpdatetime() {\n\t\treturn updatetime;\n\t}", "public Date getUpdatetime() {\n return updatetime;\n }", "public Date getUpdatetime() {\n return updatetime;\n }", "public long getTimeOfLastValuesChanged();", "public long getLastUpdateTime() {\n return lastUpdateTime;\n }", "private long calculatePostTime() {\n return System.currentTimeMillis();\n }", "public Date getUpdateTime() {\n return this.updateTime;\n }", "public Long getUpdateTime() {\n\t\treturn updateTime;\n\t}", "public Date getUpdateTime() {\r\n\t\treturn updateTime;\r\n\t}", "public Integer getUpdateTime() {\n return updateTime;\n }", "Date getLastTime();", "public Long getUpdateTime() {\n return updateTime;\n }", "public Long getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\r\n return updateTime;\r\n }", "public Date getUpdateTime() {\r\n return updateTime;\r\n }", "public Date getUpdateTime() {\r\n return updateTime;\r\n }", "public Date getUpdateTime() {\r\n return updateTime;\r\n }", "public Date getLastUpdateTime() {\r\n return lastUpdateTime;\r\n }", "com.google.protobuf.Timestamp getUpdateTime();", "com.google.protobuf.Timestamp getUpdateTime();", "com.google.protobuf.Timestamp getUpdateTime();", "public double getLastTime()\n\t{\n\t\tdouble time = Double.NaN;\n\t\tfinal Entry< Double, V > entry = getLastEntry();\n\t\tif( entry != null )\n\t\t{\n\t\t\ttime = entry.getKey();\n\t\t}\n\t\treturn time;\n\t}", "public Timestamp getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n\t\treturn updateTime;\n\t}", "public Date getUpdateTime() {\n\t\treturn updateTime;\n\t}", "public Date getUpdateTime() {\n\t\treturn updateTime;\n\t}", "public Date getLastUpdateTime() {\n return lastUpdateTime;\n }", "public Date getLastUpdateTime() {\n return lastUpdateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\n return updateTime;\n }", "public Date getUpdateTime() {\r\n\t\treturn this.updatedTime;\r\n\t}", "public long getTime() {\n\t\tDate _date = new Date();\n\t\tlong _time = _date.getTime();\n\t\t_time = _time + getDeltaDate();\n\t\treturn _time;\n\t}", "public long getLastUpdateTime() {\n return this.lastUpdateTime;\n }", "private long timeNow()\n {\n // The value of 3506716800000000L is the BAT as at midnight on\n // 1-Jan-1970, which is the base of the time that the system\n // gives us. It has to be adjusted for leap seconds though.\n return (System.currentTimeMillis() * 1000L) + DUTC.get() * 1000000L + 3506716800000000L;\n }", "@Override\n\tpublic long getTime() {\n\t\treturn System.nanoTime() - startTime;\n\t}", "public long sinceStart() {\n return System.currentTimeMillis() - lastStart;\n }", "public DateTime getUpdateTime() {\n return updated;\n }", "public String getUpdateTime() {\r\n return updateTime;\r\n }", "public Instant getLastUpdate() {\n return lastUpdate;\n }", "public long getLastUpdatedTime() {\n return lastUpdatedTime;\n }", "public static void calTime() {\n time = new Date().getTime() - start;\n }" ]
[ "0.7348467", "0.7318762", "0.72762144", "0.72718745", "0.715977", "0.71542615", "0.7066258", "0.70266235", "0.7005183", "0.6935044", "0.6930848", "0.6922743", "0.6922743", "0.69091266", "0.6893019", "0.6880934", "0.6871682", "0.6859732", "0.6859732", "0.6854454", "0.6854454", "0.6848862", "0.6842737", "0.68390715", "0.68370193", "0.6835717", "0.68046796", "0.6800748", "0.6790208", "0.6784431", "0.6784431", "0.6782681", "0.6782681", "0.6782681", "0.6782681", "0.6781013", "0.6779798", "0.6779798", "0.6779798", "0.6775424", "0.676838", "0.67586756", "0.67586756", "0.67586756", "0.67529887", "0.67529887", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6742667", "0.6734858", "0.6733616", "0.67244196", "0.67167777", "0.67131853", "0.6690198", "0.6684159", "0.66769177", "0.66632134", "0.6662812", "0.665544" ]
0.0
-1
searchNode() will search a given node in the list
public void searchNode(int value) { int i = 1; boolean flag = false; Node current = head; if (head == null) { System.out.println("List is empty"); return; } while (current != null) { if (current.data == value) { flag = true; break; } current = current.next; i++; } if (flag) System.out.println("Node is present in the list at the position::" + i); else System.out.println("Node is note present in the list"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private Node search(String name)\r\n\t{\r\n\t\t// Check to see if the list is empty\r\n\t\tif(isEmpty())\r\n\t\t{\r\n\t\t\t// Return null which will be checked for by the method that called it\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\t// Tree is not empty so use the recursive search method starting at the root reference \r\n\t\t// to find the correct Node containing the String name\r\n\t\treturn search(getRoot(), name);\r\n\t}", "public boolean search(Node n){\n \n init(n);\n \n if (check()){\n \n return true;\n \n }else if(currentChildNodeLength == 0){\n \n return false;\n \n }else{\n \n return search(currentNode.getChildren());\n \n }\n \n }", "public Node findNode(Node search, Node node) {\n\n if (search == null) {\n return null;\n }\n if (search.data == node.data) {\n return search;\n } else {\n\n Node returnNode = findNode(search.leftChild, node);\n\n if (returnNode == null) {\n\n returnNode = findNode(search.leftChild, node);\n }\n\n return returnNode;\n }\n\n\n }", "private TFNode search(TFNode node, Object key) throws TFNodeException {\r\n\r\n // Check for empty node\r\n if (node.getNumItems() == 0) {\r\n throw new TFNodeException(\"Search discovered an empty node\");\r\n }\r\n\r\n int index = FFGTE(node, key);\r\n TFNode child = node.getChild(index);\r\n\r\n // If the node contains they key, return node\r\n if (index < node.getNumItems()) {\r\n if(treeComp.isEqual(node.getItem(index).key(), key)){\r\n return node;\r\n }\r\n }\r\n \r\n // If the node is a leaf, return node\r\n if (child == null) {\r\n return node;\r\n // If neither of the above, keep searching\r\n } else {\r\n return search(child, key);\r\n }\r\n \r\n }", "public void searchNode(int value) { \r\n int i = 1; \r\n boolean flag = false; \r\n //Node current will point to head \r\n Node current = head; \r\n \r\n //Checks whether the list is empty \r\n if(head == null) { \r\n System.out.println(\"List is empty\"); \r\n return; \r\n } \r\n while(current != null) { \r\n //Compare value to be searched with each node in the list \r\n if(current.data == value) { \r\n flag = true; \r\n break; \r\n } \r\n current = current.next; \r\n i++; \r\n } \r\n if(flag) \r\n System.out.println(\"Node is present in the list at the position : \" + i); \r\n else \r\n System.out.println(\"Node is not present in the list\"); \r\n }", "public Node search(K key) {\n\t\tNode currentNode = this.mRoot;\n\t\t// start from the root of the tree that calls the method\n\t\twhile (currentNode != mSentinel && key.compareTo(currentNode.getKey()) != 0) {\n\t\t\t// if the current node is not empty and its key is not equal to the\n\t\t\t// search key\n\t\t\tif (key.compareTo(currentNode.getKey()) < 0) {\n\t\t\t\tcurrentNode = currentNode.getLeftChild();\n\t\t\t\t// go left if the search key is lower\n\t\t\t} else {\n\t\t\t\tcurrentNode = currentNode.getrightChild();\n\t\t\t\t// go right if the search key is higher\n\t\t\t}\n\t\t\t// break the loop if the search key matches the node key\n\t\t}\n\t\tif (currentNode == mSentinel) {\n\t\t\treturn null;\n\t\t\t// if there is not a match return nu;;\n\t\t} else {\n\t\t\treturn currentNode;\n\t\t\t// return the first node with the same key as the search key\n\t\t}\n\t}", "public JodeList search(final String nodeName) {\n return search(j -> j.n.equals(nodeName));\n }", "public void search(int target){\n\t\t\n\t\tint position = 0;\n\t\tfor(Node temp = head; temp != null; temp = temp.next){ // loops through list to find the node\n\t\t\tif(temp.data == target){\n\t\t\t\tSystem.out.println(target + \" was found at position \" + position);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tposition++;\n\t\t}\n\t\tSystem.out.println(target + \" was not found\"); // printed if node was not found\n}", "public Node nodeSearch(String s){\t \n\t int i=0;\n\t i++;\n\t if(this.children == null){\n\t\t//\t\tSystem.out.println(\"1\");\n\t\treturn null;\n\t }\n\t if(root.state.equals(s)){\n\t\t//System.out.println(\"2\");\n\t\treturn this;\n\t }\n\t Node v=null;\n\t for(String key:this.children.keySet()){\n\t\tNode nxt=this.children.get(key);\n\t\tif(key.equals(s)){\n\t\t // System.out.println(\"3\");\n\t\t return nxt;\n\t\t}\n\t\telse{\n\t\t v=nxt.nodeSearch(s);\n\t\t}\n\t }\n\n\t if(v!=null){\n\t\t//\t\tSystem.out.println(\"4\");\n\t\treturn v;\n\t }else{\n\t\t//System.out.println(\"5\");\t\t\n\t\treturn null;\n\t }\n\t}", "public Node search(int key) {\n\t\t\t Node node=root;\n\t while (node!= nil){\n\t if(node.id==key){\n\t \treturn node;\n\t }\n\t else if(node.id<key){\n\t \tnode=node.right;\n\t }\n\t else{\n\t \tnode=node.left;\n\t } \n\t }\n\t //key not found in the tree\n\t return nil;\n\t }", "public RBNode<T> search(T key) {\r\n return search1(key);\r\n//\t\treturn search2(root, key); //recursive version\r\n }", "public boolean search(int value)\n{\n if(head==null)\n return false;\nelse\n{\n Node last=head;\n while(last.next!=null)\n{\n if(last.data==value)\n return true;\n\nlast=last.next;\n}\nreturn false;\n}\n}", "public boolean searchNode(int value) \n { \n return searchNode(header.rightChild, value); \n }", "public void searchNodeRequest(long idNode, Address address){\r\n\t\tArrayList<NodeAddress> node = routeTable.get(idNode);\r\n\t\tif ( node != null && node.size() != 0 ){\r\n\t\t\tmyCommunications.send(\r\n\t\t\t\t\tnew NodeAddress(0, address), \r\n\t\t\t\t\tnew FindNodeMessage( node ).toByteArray()\r\n\t\t\t);\r\n\t\t\r\n\t\t//Sending to Entity for broadcast\r\n\t\t}else{\r\n\t\t\tareaWrapper.sendtoEntity(new NodeAddress(0, address), new SearchNodeRequestMessage(idNode).toByteArray());\r\n\t\t}\r\n\t}", "public static Node find(Node node, int search_key){\n if(node!=null){ // node ที่รับมาต้องมีตัวตน\n if (search_key== node.key){ //ถ้าเจอ node ที่ตามหา ส่งค่าออกไป\n return node;\n }\n else if (search_key > node.key) { //ถ้า search_key มากกว่า node.key ตอนนี้ แสดงว่า อยู่ทางด้านขวา\n return find(node.right,search_key); // recursive โดยส่ง right-subtree\n }\n else{\n return find(node.left,search_key); // recursive โดยส่ง left-subtree\n }\n }\n else return null;\n\n }", "public TFNode findNode(Object key) {\r\n\r\n // Search for node possibly containing key\r\n TFNode node = search(root(), key);\r\n\r\n // Note the index of where the key should be\r\n int index = FFGTE(node, key);\r\n\r\n // If the index is greater than the number of items in the node, the key is not in the node\r\n if (index < node.getNumItems()) {\r\n // Look for key in node\r\n if (treeComp.isEqual(node.getItem(index).key(), key)) {\r\n return node;\r\n }\r\n }\r\n\r\n // The search hit a leaf without finding the key\r\n return null;\r\n }", "private Node searchNode(int id) {\n\t\tNode node = searchRec(root,id);\n\t\treturn node;\n\t}", "protected SearchNode<T> getSearchNode( Node<T> node ) {\n\t\treturn node == null ? null : searchNodes.get( node.getNodeId() );\n\t}", "public static <K,V> ItemNode<K,V> search(ItemNode<K,V> node, K k) {\n while (node != null && !k.equals(node.k))\n node = node.next;\n return node;\n }", "public NodeList<T> search(T info){\n NodeList<T> f = first;\n\n while (f != null){\n if(f.getInfo().equals(info)){\n return f;\n }\n f = f.getNext();\n }\n return null;\n }", "public boolean search(RBNode<T, E> node) {\n\t\tRBNode<T, E> c = root;\r\n\t\twhile (c != nillLeaf) {\r\n\t\t\t// If Node is less than the current Node then go left.\r\n\t\t\tif (node.uniqueKey.compareTo(c.uniqueKey) < 0) {\r\n\t\t\t\t// we go left\r\n\t\t\t\tc = c.leftChild;\r\n\t\t\t}\r\n\t\t\t// If Node is bigger than the current Node then go right.\r\n\t\t\telse if (node.uniqueKey.compareTo(c.uniqueKey) > 0) {\r\n\t\t\t\t// we go right\r\n\t\t\t\tc = c.rightChild;\r\n\t\t\t}\r\n\t\t\t// Else they are equal\r\n\t\t\telse {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\t// OtherWise return false, it doesnt exist.\r\n\t\treturn false;\r\n\t}", "@Override\n public boolean search(K key) {\n if (rootNode == null)\n return false;\n try {\n return exist(key, rootNode);\n } catch (IllegalArgumentException e) {\n System.out.println(e.getMessage());\n return false;\n }\n }", "public Node<E> findNode(int index){\t\r\n\t\tcheckIndex(index);\r\n\t\tint k = 0;\r\n\t\tNode<E> foundNode = headNode;\r\n\t\twhile(k < index - 1) {\r\n\t\t\tfoundNode = foundNode.link;\r\n\t\t}\r\n\t\t\r\n\t\treturn foundNode;\r\n\t}", "@Override\n public boolean search(E e) {\n \treturn search(e, root);\n\n }", "public boolean search(String key){\n DataPair dp = getDataPair(key);\n BTNode out=null;\n if (dp != null)\n out = search(dp);\n return out != null;\n }", "private static Node search(Node currentNode, Node nodeToFind) {\n\t\tif (currentNode != null) {\n\t\t\tNode leftNode = search(currentNode.leftChild, nodeToFind);\n\t\t\tNode rightNode = search(currentNode.rightChild, nodeToFind);\n\t\t\t\n\t\t\t// If either node is not null it means that the matching node has\n\t\t\t// been found in a previous recursion.\n\t\t\tif (leftNode != null || rightNode != null) {\n\t\t\t\treturn leftNode == null ? rightNode : leftNode; \n\t\t\t}\n\t\t\t// Otherwise we compare the current node values.\n\t\t\tif (currentNode.value == nodeToFind.value) {\n\t\t\t\treturn currentNode;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn null; // Return null if no match.\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "private Node<Pair<K, V>> search(\n BiDirectionalNullTerminatedTailedLinkedList<Pair<K, V>> list,\n K key) {\n\n for (Node<Pair<K, V>> i = list.getHead().getNext(); i != list.getTail();\n i = i.getNext()) {\n if (i.getData().key.equals(key)) {\n return i;\n }\n }\n\n return null;\n }", "public interface Search {\n public List<Node> find(Node start, Node finish);\n public Node selectNode(List<Node> nodes);\n public List<Node> getPath(Node node);\n public List<Node> getAdjacent(Node node);\n}", "public Node<E> search(E data){\n\tNode<E> tempNode = root; //becomes the root\n\twhile (tempNode != sentinel) {\n\t\tif (tempNode.getData().compareTo(data) == 0) {\n\t\t\treturn tempNode;\n\t\t} else if (tempNode.getData().compareTo(data) > 0) {\n\t\t\ttempNode = tempNode.getLeftChild();\n\t\t} else if (tempNode.getData().compareTo(data) < 0) {\n\t\t\ttempNode = tempNode.getRightChild();\n\t\t}\n\t}\n\treturn null;\n }", "private Node findNode(Node node, String name) {\n Node temp = node;\n\n if (temp.getNext() != null && name.compareTo(temp.getNext().getState().getName()) > 0) {\n temp = findNode(temp.getNext(), name);\n }\n return temp;\n }", "public HPTNode<K, V> search(List<K> key) {\n check(key);\n int size = key.size();\n\n // Start at the root, and only search lower in the tree if it is\n // large enough to produce a match.\n HPTNode<K, V> current = root;\n for (int i = 0; i < size; i++) {\n if (current == null || (size - i) > current.maxDepth()) {\n return null;\n }\n current = find(current, i, key.get(i), false);\n }\n if (current == null || current.values == null) {\n return null;\n }\n return current.values.isEmpty() ? null : current;\n }", "@Nullable\n @Contract(pure = true)\n public static <E> Node<E> listSearch(Node<E> head, E target) {\n Node<E> cursor;\n\n if (target == null) { // Search for a node in which the data is a null reference.\n for (cursor = head; cursor != null; cursor = cursor.getNext()) {\n if (cursor.getData() == null) {\n return cursor;\n }\n }\n } else { // Search for a node that contains the non-null target.\n for (cursor = head; cursor != null; cursor = cursor.getNext()) {\n if (target.equals(cursor.getData())) {\n return cursor;\n }\n }\n }\n\n return null;\n }", "private BTNode search(BTNode btNode, DataPair key) {\n int i =0;\n while (i < btNode.mCurrentKeyNum && key.compareTo(btNode.mKeys[i]) > 0)\n i++;\n\n if (i < btNode.mCurrentKeyNum && key.compareTo(btNode.mKeys[i])==0)\n return btNode;//btNode.mKeys[i];\n if (btNode.mIsLeaf)\n return null;\n return search(btNode.mChildren[i],key);\n }", "@Override\n public boolean search(E data) {\n if (isEmpty()) return false;\n\n Node<E> current = head;\n do {\n if (current.getData().equals(data)) return true;\n current = current.getNext();\n\n } while (current != null);\n return false;\n\n }", "void pathFound(Node node);", "public MyBinaryNode<K> search(K key) {\n\t\t\n\t\treturn searchRecursive(root, key);\n\t}", "public Node searchItemAtNode(Node start, int value) {\n if (start == null)\n return null;\n if (value < start.value)\n return searchItemAtNode(start.left, value);\n if (value > start.value)\n return searchItemAtNode(start.right, value);\n\n return start;\n }", "public btNode search(int m){ \r\n \r\n System .out.println(\"We are searching for \" + m);\r\n btNode current = root; \r\n while(current.getData() != m) \r\n {\r\n if(m < current.getData()) \r\n current = current.getLeft();\r\n else \r\n current = current.getRight();\r\n if(current == null) \r\n return null; \r\n }\r\n return current; \r\n }", "public boolean containsNode(Node n);", "@Override\r\n public Object findElement(Object key) {\r\n\r\n // Search for node possibly containing key\r\n TFNode node = search(root(), key);\r\n \r\n // Note the index of where the key should be\r\n int index = FFGTE(node, key);\r\n\r\n // If the index is greater than the number of items in the node, the key is not in the node\r\n if (index < node.getNumItems()) {\r\n // Look for key in node\r\n if (treeComp.isEqual(node.getItem(index).key(), key)) {\r\n return node.getItem(index);\r\n }\r\n }\r\n\r\n // The search hit a leaf without finding the key\r\n return null;\r\n }", "private int findNodeInList(List<Node> nodelist, Node n) throws Exception {\r\n for (int i=0; i<nodelist.size(); i++) {\r\n if (nodelist.get(i).equals(n)) {\r\n return i;\r\n }\r\n }\r\n \r\n log.error(\"Node not found: \" + n.getBodID());\r\n \r\n // Node could not be found, throw exception\r\n throw new Exception(\"PF exception: The node attached to a link could not be found in the nodes list\");\r\n }", "private static NodeRecord findInList(ArrayList<NodeRecord> list, int nodeId) {\n\t\tfor(NodeRecord node : list){\r\n\t\t\tif (node.getNode() == nodeId)\r\n\t\t\t\treturn node;\r\n\t\t}\r\n\t\treturn null;\r\n\t}", "public int search(String searchTerm){\r\n\t\tNode c = head;\r\n\t\tint index = 0;\r\n\t\t\r\n\t\twhile(c.next != null){\r\n\t\t\tif(c.data.equalsIgnoreCase(searchTerm)) return index;\r\n\t\t\tc = c.next;\r\n\t\t\tindex++;\r\n\t\t}\r\n\t\r\n\t\treturn -1;\r\n\t}", "public boolean search(int key) {\n\t\tNode currentNode = this.head;\n\t\tdo {\n\t\t\twhile (currentNode.next != null && currentNode.next.key < key) {\n\t\t\t\tcurrentNode = currentNode.next;\n\t\t\t}\n\t\t\tif (currentNode.next != null && currentNode.next.key == key) return true;\n\t\t\tcurrentNode = currentNode.down;\n\t\t} while (currentNode != null);\n\t\treturn false;\n\t}", "public BTreeNode search(long key) {\n\t\treturn searcher(root, key);\n\t}", "private Node search(Node traverse, String name)\r\n\t{\t\r\n\t\t// Haven't reached a dead-end yet\r\n\t\tif(traverse != null)\r\n\t\t{\r\n\t\t\t// Check to see if the current Node matches the String\r\n\t\t\tif(name.equalsIgnoreCase(traverse.getName()))\r\n\t\t\t{\r\n\t\t\t\t// return the location of the node\r\n\t\t\t\treturn traverse;\r\n\t\t\t}\r\n\t\t\t// The name is lexicographically less than the current Node's name\r\n\t\t\telse if(name.compareToIgnoreCase(traverse.getName()) < 0)\r\n\t\t\t{\r\n\t\t\t\t// Keep searching through the left subtree\r\n\t\t\t\treturn search(traverse.getLeftChild(), name); \r\n\t\t\t}\r\n\t\t\t// The name is lexicographically greater than the current Node's name\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// Keep searching through the right subtree\r\n\t\t\t\treturn search(traverse.getRightChild(), name);\r\n\t\t\t}\r\n\t\t}\t\r\n\t\t// Node not found in the Binary Tree\r\n\t\treturn null;\r\n\t}", "private Node findNode(int index){\n Node current = start;\n for(int i = 0; i < index; i++){\n current = current.getNext();\n }\n return current;\n }", "public Node<T> search(int id) {\n Node<T> res = root;\n res = search(res, id);\n if (res.getId() == id) return res;\n else return null;\n }", "public void search(int value, Node start) {\r\n\t\tif (start == null) {\r\n\t\t\tSystem.out.println(\"node is not found\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (value == start.value) {\r\n\t\t\tSystem.out.println(\"node is found\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (value == start.value) {\r\n\t\t\tSystem.out.println(\"node is found\");\r\n\t\t}\r\n\r\n\t\t// if value is greater than current node value, it will be set to right\r\n\t\t// side\r\n\t\tif (value > start.value) {\r\n\t\t\tsearch(value, start.right);\r\n\t\t}\r\n\r\n\t\t// if value is less than current node value, it will be set to left side\r\n\t\tif (value < start.value) {\r\n\t\t\tsearch(value, start.left);\r\n\t\t}\r\n\t}", "public boolean searchNodes(Node N, int element) {\n if(N != null) {\n if(N.getData() == element) return true;\n if(searchNodes(N.getLeft(), element)|| searchNodes(N.getRight(), element)) return true;\n return false;\n }\n return false;\n }", "public BinaryNode<T> find(T v);", "public Integer search(Integer currentLine, int key) {\r\n\t\t//Key was found or there is not \r\n\t\t//any new Node to search\r\n\t\tif(increaseCompares() && (currentLine==-1 || key==getKey(currentLine))) {\r\n\t\t\treturn currentLine;\r\n\t\t}\r\n\t\t//Get left subtree for searching\t\r\n\t\tif(increaseCompares() && key<getKey(currentLine)) {\r\n\t\t\treturn search(getLeft(currentLine),key);\r\n\t\t}\r\n\t\t//Get right subtree for searching\r\n\t\telse {\r\n\t\t\treturn search(getRight(currentLine),key);\r\n\t\t}\r\n\t\t\r\n\t}", "private BinaryNode<E> _findNode(BinaryNode<E> node, E e) {\n\t\tif (node == null)\n\t\t\treturn null;\n\t\telse if (comparator.compare(e, node.getData()) < 0) // *****CHANGE THIS for HW#4*****\n\t\t\treturn _findNode(node.getLeftChild(), e);\n\t\telse if (comparator.compare(e, node.getData()) > 0) // *****CHANGE THIS for HW#4*****\n\t\t\treturn _findNode(node.getRightChild(), e);\n\t\telse // found it!\n\t\t\treturn node;\n\t}", "public MyNode findMyNode(Node node){\r\n\t\treturn nodesMap.get(node);\r\n\t}", "public SplayNode search(SplayNode n, int x) {\n\t\t if(x == n.data) {\n\t\t this.splay(n);\n\t\t return n;\n\t\t }\n\t\t else if(x < n.data)\n\t\t return this.search(n.left, x);\n\t\t else if(x > n.data)\n\t\t return this.search(n.right, x);\n\t\t else\n\t\t return null;\n\t\t }", "public Node find(int key) // find node with given key\n\t{ // (assumes non-empty tree)\n\t\tNode current = root; // start at root\n\t\tif(current == null) {\n\t\t\treturn null;\n\t\t}\n\t\twhile(current.iData != key) // while no match,\n\t\t{\n\t\t\tif(key < current.iData) // go left?\n\t\t\t\tcurrent = current.leftChild;\n\t\t\telse // or go right?\n\t\t\t\tcurrent = current.rightChild;\n\t\t\tif(current == null) // if no child,\n\t\t\t\treturn null; // didn't find it\n\t\t}\n\t\treturn current; // found it\n\t}", "Node search(int reqNodeValue){\r\n\t\tNode reqNode = this.root ;\r\n\t\t \r\n\t\twhile(reqNode != null && reqNode.value != reqNodeValue) {\r\n\t\t\tif(reqNode.value < reqNodeValue) {\r\n\t\t\t\treqNode = reqNode.right ; \r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\treqNode = reqNode.left ;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(reqNode == null) {\r\n\t\t\tSystem.out.println(\"No such node exists in the tree\");\r\n\t\t}\r\n\t\treturn reqNode;\r\n\t}", "public int search(String searchValue, LinkedList target, int start) {\n\t\t\n\t\treturn 1;\n\t}", "public static void main(String[] args) {\n\t\tNode a = new Node(10);\r\n\t\tNode b = new Node(-5);\r\n\t\tNode c = new Node(-10);\r\n\t\tNode d = new Node(5);\r\n\t\tNode e = new Node(25);\r\n\t\tNode f = new Node(36);\r\n\t\ta.left = b;\r\n\t\tb.left = c;\r\n\t\tb.right = d;\r\n\t\ta.right = e;\r\n\t\te.right = f;\r\n\t\tboolean found1 = search(a,22);\r\n\t\tboolean found2 = search(a,5);\r\n\t\tSystem.out.println(found1);\r\n\t\tSystem.out.println(found2);\r\n\t}", "int search(E item);", "private Node<Pair<K, V>> findItem(K key) {\n Node<Pair<K, V>> result = null;\n\n int hash1 = hash1(key);\n\n if (table[hash1] != null) {\n Node<Pair<K, V>> node = search(table[hash1].list, key);\n\n if (node != null) {\n result = node;\n }\n }\n\n int hash2 = hash2(key);\n\n if (table[hash2] != null && result == null) {\n Node<Pair<K, V>> node = search(table[hash2].list, key);\n\n if (node != null) {\n result = node;\n }\n }\n\n return result;\n }", "public Node search (String s){\n if(s.equals(word) ){ //if match is found\n return this;\n }\n\n if(s.compareTo(word) <= 0){ //left side\n if(left != null){\n return left.search (s); \n\n }else{\n return null; //value not in the tree\n }\n }else{ //right side\n if(right != null){\n return right.search (s);\n }else{\n return null;\n }\n }\n\n\n\n\n }", "public Node find(int key) {\n Node current = root; // start at root\n while (current.iData != key) {\n // while no match\n if (key < current.iData)\n // go left\n current = current.leftChild;\n else\n current = current.rightChild;\n if (current == null) // if no child, didn't find it\n return null;\n }\n return current; // found it\n }", "private ListNode findNodeWith(T aData){\r\n ListNode temp = head;\r\n while(temp != null){\r\n if (temp.data == aData)\r\n return temp;\r\n temp = temp.link;\r\n }\r\n return null;\r\n }", "@Test\n public void searchNodesBST()\n {\n BinarySearchTree bst = new BinarySearchTree();\n No root = new No(6);\n bst.insert(root, root);\n bst.insert(root, new No(2));\n bst.insert(root, new No(9));\n No k = new No(1);\n bst.insert(root, k);\n bst.insert(root, new No(4));\n bst.insert(root, new No(8));\n assertEquals(k, bst.search(root, k));\n //bst.inOrder(root);\n }", "public static<T> Optional<Node<T>> search(T value, Node<T> start ){\n\n Queue<Node> queue = new ArrayDeque<>();//inicializar cola\n queue.add(start);// se agraga a la cola el inicial\n\n Node<T> currentNode = null; //creacion de variable currenteNode\n\n Node<T> father = null;\n\n Set<Node<T>> closed = new HashSet<>(); //memoria //una coleccion de nodos existentes\n\n while(!queue.isEmpty()){ //1-verificar si puede continuar\n\n currentNode = queue.remove();\n\n System.out.println(\"Visitando el nodo... \" + currentNode.getValue()); //se convierte en string\n\n //2-verificar si se encuentra en la meta\n if(currentNode.getValue().equals(value)){\n return Optional.of(currentNode);\n }\n else{\n if (!closed.contains(currentNode)){ // existe o no en memoria (no repetir caminos.\n closed.add(currentNode); // 3-espacio explorado\n queue.addAll(currentNode.getNeighbors()); // sucesor // expande\n }\n queue.removeAll(closed);//elimina el recien visitado\n }\n\n }\n return Optional.empty();\n }", "public NodeEntry<Boolean, Node> find(T data) {\n\t\tif (this.numberOfNodes == 0)\n\t\t\t// Return the header as the second parameter\n\t\t\t// to indicate that the returned false was\n\t\t\t// as a result of querying data to an empty\n\t\t\t// list.\n\t\t\treturn new NodeEntry<Boolean, Node>(false, this.header);\n\n\t\t// Begin with the header and traverse the list\n\t\t// using right pointers at every visited node.\n\t\tNode currentNode = this.header;\n\t\tNode nodeToCompare = null;\n\t\tNode leftNeighbor = null;\n\t\tint currentLevel = this.listLevel;\n\t\twhile (currentLevel > 1) {\n\t\t\tnodeToCompare = currentNode.nextNodes.get(currentLevel);\n\t\t\tif (nodeToCompare != null) {\n\t\t\t\tif (data.compareTo(nodeToCompare.data) > 0) {\n\t\t\t\t\tcurrentNode = nodeToCompare;\n\t\t\t\t} else if (data.compareTo(nodeToCompare.data) < 0) {\n\t\t\t\t\tcurrentLevel--;\n\t\t\t\t} else\n\t\t\t\t\treturn new NodeEntry<Boolean, Node>(true, nodeToCompare);\n\t\t\t} else currentLevel--;\n\t\t}\n\n\t\t// If the query value is found to be the smallest in the\n\t\t// list, we'd hit the bottom of the list through header.\n\t\t// Return the header as the left hand neighbor for the\n\t\t// position where the query data can be inserted later.\n\t\tif (currentNode.equals(this.header) &&\n\t\t\tcurrentNode.nextNodes.get(1).data.compareTo(data) >= 0) {\n\t\t\treturn new NodeEntry<Boolean, Node>(false, this.header);\n\t\t}\n\n\t\t// Otherwise, continue traversing the remaining nodes\n\t\t// until the last visited node's data value is found\n\t\t// to be equal to or greater than the query.\n\t\twhile (!currentNode.equals(this.sentinel)) {\n\t\t\tif (currentNode.data.compareTo(data) > 0) {\n\t\t\t\t// Return the node immediately before the possible\n\t\t\t\t// position where the data could have been found.\n\t\t\t\t// This can be used for inserting a new node to the\n\t\t\t\t// list containing the same data value as the query.\n\t\t\t\treturn new NodeEntry<Boolean, Node>(false, leftNeighbor);\n\t\t\t} else if (currentNode.data.compareTo(data) < 0) {\n\t\t\t\t// This is where we enter this while loop,\n\t\t\t\t// so we protect ourselves from losing the\n\t\t\t\t// track of the immediate left neighbor.\n\t\t\t\tleftNeighbor = currentNode;\n\t\t\t\tcurrentNode = currentNode.nextNodes.get(1);\n\t\t\t} else {\n\t\t\t\treturn new NodeEntry<Boolean, Node>(true, currentNode);\n\t\t\t}\n\t\t}\n\n\t\t// After reaching the sentinel, return the last node\n\t\t// in the list as the position where the data may be\n\t\t// inserted into the list.\n\t\treturn new NodeEntry<Boolean, Node>(false, leftNeighbor);\n\t}", "private BTNode<T> find ( T data, BTNode<T> node ){\n \t\tfindCount++;\n\t\tif (data.compareTo (node.getData()) == 0){\n \t\treturn node;\n\t\t}else {\n\t\t//findCount++;\n\t\tif (data.compareTo (node.getData()) < 0){\n \t\treturn (node.getLeft() == null) ? null : find (data, node.getLeft());\n\t\t}else{\n \t\treturn (node.getRight() == null) ? null : find (data, node.getRight());\n\t\t}\n\t\t}\n }", "public boolean search(Point p) {\n\t\tif(p == null) {\n\t\t\tSystem.out.println(\"Illegal point argument\");\n\t\t}\n\t\treturn search(head, p);\n\t}", "public boolean SearchElem(int key) {\n\t\t\n\t\tNode curr = head;\n\t\twhile(curr.next!=null) {\n\t\t\tif(curr.data == key)\n\t\t\t\treturn true;\t//Return true if element is found\n\t\t\tcurr = curr.next;\n\t\t}\n\t\t\n\t\treturn false; //Return false if element is not found\n\t}", "public TreeNode<T> Search(TreeNode<T> n, T s){\n if(n == null || n.elem.equals(s)) {return n;}\n else if(s.compareTo(n.elem) < 0) {return Search(n.left, s);}\n else {return Search(n.right, s);}\n\n }", "public boolean search(T key) {\r\n\t\tRBNode<T, E> c = root;\r\n\t\twhile (c != nillLeaf) {\r\n\t\t\t// If Node is less than the current Node then go left.\r\n\t\t\tif (key.compareTo(c.uniqueKey) < 0) {\r\n\t\t\t\t// we go left\r\n\t\t\t\tc = c.leftChild;\r\n\t\t\t}\r\n\t\t\t// If Node is bigger than the current Node then go right.\r\n\t\t\telse if (key.compareTo(c.uniqueKey) > 0) {\r\n\t\t\t\t// we go right\r\n\t\t\t\tc = c.rightChild;\r\n\t\t\t}\r\n\t\t\t// Else they are equal\r\n\t\t\telse {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\t// OtherWise return false, it doesnt exist.\r\n\t\treturn false;\r\n\t}", "public TreeNode find(Integer searchKey) {\n\t\treturn root.find(searchKey);\n\t}", "@Test\n public void whenSearchTwoThenResultIndexOne() {\n tree.addChild(nodeOne, \"1\");\n nodeOne.addChild(nodeTwo, \"2\");\n nodeTwo.addChild(nodeThree, \"3\");\n assertThat(tree.searchByValue(\"4\"), is(\"Element not found\"));\n }", "public SkipListNode<E> search(E element){\n\t\tboolean found = false;\n\t\tSkipListNode<E> p = null;\n\t\ttry {\n\t\t\tp = head.getDown();\n\t\t\tif(p.getNext().getNext()!=null)\n\t\t\t\tp = p.getNext();\n\t\t} catch (Exception e) {\n\t\t\tp = head;\n\t\t}\n\t\twhile(!found && p.element()!=null){\n\t\t\tif(comp.compare(p.element(), element)<0)\n\t\t\t{\n\t\t\t\tif(p.getNext().element()==null)\n\t\t\t\t{\n\t\t\t\t\tif(p.getDown()==null)\n\t\t\t\t\t\tfound=true;\n\t\t\t\t\telse\n\t\t\t\t\t\tp = p.getDown();\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tp = p.getNext();\n\t\t\t}\n\t\t\telse if(comp.compare(p.element(), element)>0)\n\t\t\t{\n\t\t\t\tp = p.getPrevious();\n\t\t\t\tif(p.getDown()==null)\n\t\t\t\t\tfound=true;\n\t\t\t\telse\n\t\t\t\t\tp = p.getDown();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(p.getDown()==null)\n\t\t\t\t\tfound=true;\n\t\t\t\telse\n\t\t\t\t\tp = p.getDown();\n\t\t\t}\n\t\t}\n\t\treturn p;\n\t}", "public Reference search (String val) {\n Node nextPtr = ptrs[this.findPtrIndex(val)];\n return nextPtr.search(val);\n }", "public int searchByValue(T value) {\n Node<T> currNode = head;\n int index = 0;\n if (null != currNode) {\n while ((null != currNode.next) || (null != currNode.data)) {\n if (currNode.data == value) {\n break;\n }\n currNode = currNode.next;\n if (null == currNode) {\n return -1;\n }\n index++;\n }\n }\n return index;\n }", "private boolean search(BTNode r, T val)\r\n {\r\n if (r.getData() == val)\r\n return true;\r\n if (r.getLeft() != null)\r\n if (search(r.getLeft(), val))\r\n return true;\r\n if (r.getRight() != null)\r\n if (search(r.getRight(), val))\r\n return true;\r\n return false; \r\n }", "private Node searchRec(Node node, int id) {\n\t\tNode found = null;\n\t\tif(node == null || node.getId() == id){\n\t\t\treturn node;\n\t\t}\n\t\telse if(node.getId() > id){\n\t\t\tfound = searchRec(node.getLeft(), id);\n\t\t}\n\t\telse if(node.getId() < id){\n\t\t\tfound = searchRec(node.getRight(), id);\n\t\t}\n\t\treturn found;\n\t}", "private Node<T> searchRecursively(Node<T> node, T value) {\n\n // If the key is less than that of the current node, calls this method again with the current node's\n // left branch as the new node to compare keys with.\n if (value.compareTo(node.getValue()) == -1) {\n node = node.getLeft();\n return searchRecursively(node, value);\n }\n\n // Otherwise, calls the method again, comparing with the current node's right branch.\n else if (value.compareTo(node.getValue()) == 1) {\n node = node.getRight();\n return searchRecursively(node, value);\n }\n\n // If the current node contains the key, returns this node.\n return node;\n }", "public BTNode<T> find ( T data ){\n\t\t//reset the find count\n\t\tfindCount = 0;\n\t\t \t\t\n\t\tif (root == null) \n\t\t\treturn null;\n \t\telse\n \t\treturn find (data, root);\n \t}", "private BinaryTreeNode findNode(T item) {\n\t\tif (item.equals(root.data)) {\n\t\t\treturn root;\n\t\t}\n\n\t\telse return findNodeRecursive(item, root);\n\t}", "public Node findSubNode(String name, Node node) {\n\t if (node.getNodeType() != Node.ELEMENT_NODE) {\n\t System.err.println(\"Error: Search node not of element type\");\n\t System.exit(22);\n\t }\n\n\t if (! node.hasChildNodes()) return null;\n\n\t NodeList list = node.getChildNodes();\n\t for (int i=0; i < list.getLength(); i++) {\n\t Node subnode = list.item(i);\n\t if (subnode.getNodeType() == Node.ELEMENT_NODE) {\n\t if (subnode.getNodeName().equals(name)) \n\t return subnode;\n\t }\n\t }\n\t return null;\n\t}", "protected SearchNode<T> getOrAddSearchNode( Node<T> node ) {\n\t\tif ( node == null ) {\n\t\t\tthrow new IllegalArgumentException( \"Null node\" );\n\t\t}\n\t\tif ( ! searchNodes.containsKey( node.getNodeId() ) ) {\n\t\t\tsearchNodes.put( node.getNodeId(), node instanceof SearchNode ? (SearchNode)node : new SearchNode<>( node ) );\n\t\t}\n\t\treturn searchNodes.get( node.getNodeId() );\n\t}", "void search();", "void search();", "private SkipNode<K, V> findNode(Object key) {\n\t\tSkipNode<K, V> nodeOut;\n\t\tnodeOut = headNode;\n\t\twhile (true) {\n\t\t\twhile ((nodeOut.getNext().getKey()) != posInf\n\t\t\t\t\t&& (nodeOut.getNext().getKey()).compareTo((Integer) key) <= 0)\n\t\t\t\tnodeOut = nodeOut.getNext();\n\t\t\tif (nodeOut.getDown() != null)\n\t\t\t\tnodeOut = nodeOut.getDown();\n\t\t\telse\n\t\t\t\tbreak;\n\t\t}\n\t\treturn nodeOut;\n\t}", "@Override\n\tpublic boolean search(E e) {\n\t\tTreeNode<E> curr = root;\n\t\t\n\t\twhile (curr != null) {\n\t\t\tif(e.compareTo( curr.element) < 0) {\n\t\t\t\tcurr = curr.left;\n\t\t\t}\n\t\t\telse if(e.compareTo(curr.element) > 0) {\n\t\t\t\tcurr = curr.right;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "public int findNode(GraphNode pNode){\n int result = 0;\n \n for (int i = 0; i < Nodes.size(); i++){\n if (Nodes.get(i).equals(pNode)){\n result = i;\n }\n }\n \n return result;\n }", "private Node findKey(String key){\n Node N = front;\n while(N != null){\n if(N.key.equals(key)){\n return N; \n }\n else{\n N = N.next; \n }\n }\n return null;\n }", "public ReferenceNode searchMatchNode(Set<String> data) {\n // Try the first first\n ReferenceNode node = nodeList.get(0);\n double similarity = node.calculateSimilarity(data);\n ReferenceNode winningNode = node;\n double newSim = 0.0;\n for (int i = 1; i < nodeList.size(); i++) {\n node = nodeList.get(i);\n newSim = node.calculateSimilarity(data);\n if (newSim > similarity) {\n winningNode = node;\n similarity = newSim;\n }\n if (newSim == 1.0d)\n break; // The highest\n }\n if (similarity == 0.0d) {\n // Try to find an empty node. Otherwise, pathways will be grouped in the\n // first node\n for (ReferenceNode tmp : nodeList) {\n if (tmp.isEmpty()) {\n winningNode = tmp;\n break;\n }\n }\n }\n return winningNode;\n }", "public Node findNode(E val) {\n\t\tif (val == null) return null;\n\t\treturn findNode(root, val);\n\t}", "public NodeD find(Object data){\n if (this.isEmpty()){\n return null;\n }else{\n if (this.head.getObject()==data){\n return this.head;\n }else{\n NodeD tmp = this.head.getNext();\n\n while(tmp!=null){\n if (tmp.getObject()==data){\n return tmp;\n }\n tmp = tmp.getNext();\n }\n return null;\n }\n }\n }", "public boolean search(int data) {\n\t\t// Node search=root;\n\t\t// //System.out.println(\"Deni2\"+\" \"+root.data);\n\t\t// if(search==null)\n\t\t// return false;\n\t\t// while(search!=null) {\n\t\t// if(search.data==data) {\n\t\t// return true;\n\t\t// }\n\t\t// else if(data<search.data) {\n\t\t// search=search.left;\n\t\t// System.out.println(\"going to left\"+data+\" \"+root.data);\n\t\t// }\n\t\t// else if(data>search.data) {\n\t\t// search=search.right;\n\t\t// System.out.println(\"going to right\"+data+\" \"+root.data);\n\t\t// }\n\t\t//\n\t\t// }\n\t\treturn search(root, data);\n\t}", "private Node findNode(Graph g, int id){\r\n for(Node n : g.getListNodes()){\r\n if (n.getId() == id){\r\n return n;\r\n }\r\n }\r\n return null;\r\n }", "private int searchIndex(int listIndex) {\n int currentTreeIndex = this.indexCorrespondingToTheFirstElement;\n Node<T> currentNode = getHelper(currentTreeIndex);\n for (int i = 0; i < listIndex; i++) {\n currentTreeIndex = currentNode.nextIndex;\n currentNode = getHelper(currentTreeIndex);\n }\n return currentTreeIndex;\n }", "public Node searchElement(Object el) {\n\t\n\t\tfor (Node elemento : this.set) {\n\t\t\tif(elemento.getElemento().equals(el)) {\n\t\t\t\treturn elemento;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "private int searchByTextContent(Node node) {\n\t\tif(hashtableIgnoreTags.get(node.getClass().getName()) != null) return 0;\n\t\t\n// \tSystem.out.println( node.getClass().getName());\n// \tSystem.out.println( \"<\" + node.getText() + \">\");\n \t\n \tif( 0 == compareHTMLText(node, strSearchText))\n \t{\n \t\tSystem.out.println( \"MATCH!\");\n \t\tint iret = analyseMatchLocation(node);\n \t\treturn 1;\n \t}\n \t\n \t// if this node text is not matched then search recursively \n \t// under this node using depth-first approach\n \tNodeList nodes = node.getChildren();\n \t\n \tif(nodes == null) return 0; // reached end of the tree nodes so go back and try your luck elsewhere\n \t\n \tint size = nodes.size();\n \t\n \tNode nextnode;\n \t\n \tfor (int i = 0; i < size; i++)\n \t{\n \t\tnextnode = nodes.elementAt(i);\n \t\t\n \t\tString strTagPattern = \"\";\n \t\t\n \t\t// RECURSION\n \t\tint iret = searchByTextContent(nextnode);\n \t\tif(1 == iret) \n \t\t{\n \t\t\tstrTagPattern = HTMLParser.getTagMatchPattern(nextnode);\n \t\t\t\n \t\t\t// There is a match so we need to log all the steps backwards to root node\n \t\t\t// to learn how to access this element in general from the HTML as a rule\n \t\t\t// Append the element number to the match string for each level of the hierarchy\n \t\t\tmatchPath = strTagPattern + \"#\" + String.valueOf(i) + \":\" + matchPath;\n \t\t\treturn 1; // Indicate there was a match indeed!\n \t\t}\n \t}\n \t\t\t\n\t\treturn 0;\n\t}", "public static int searchElement(int info) {\n if (inicio != null) {\n auxiliar = inicio; // Aponta o auxiliar para o inicio da lista\n for (int i = 0; i < contador; i++) {\n if (auxiliar.getInfo() == info) { // Verifica se a info do node\n // e igual a recebida\n return auxiliar.getInfo(); // Caso seja, retorna a info do\n // node\n }\n auxiliar = auxiliar.getNext(); // Aponta o auxiliar para o\n // proximo node\n }\n }\n return 0;\n \n }", "@Override\n\tpublic NodeIterator search(String queryString) throws Exception {\n\t\treturn null;\n\t}" ]
[ "0.7366761", "0.7089835", "0.69922215", "0.6911095", "0.6908256", "0.68637735", "0.67560446", "0.6701215", "0.66746014", "0.66743493", "0.66724324", "0.665408", "0.66259146", "0.66191244", "0.6610446", "0.65976864", "0.6583941", "0.65822166", "0.6566985", "0.65528065", "0.64348316", "0.64257604", "0.64185375", "0.64134413", "0.6405186", "0.63733035", "0.6369203", "0.63661283", "0.63634837", "0.6333756", "0.6320032", "0.63051254", "0.6304828", "0.62881875", "0.62831575", "0.62563664", "0.6255983", "0.6244982", "0.6230051", "0.6215556", "0.62105155", "0.6202613", "0.6199206", "0.61972165", "0.61951995", "0.6180594", "0.61760825", "0.6173502", "0.6169874", "0.61538893", "0.6149576", "0.61421895", "0.61409724", "0.6106832", "0.60958403", "0.60924554", "0.6089161", "0.6083601", "0.6077221", "0.6074544", "0.6072034", "0.6071552", "0.6069306", "0.6056892", "0.60536087", "0.60433537", "0.6034366", "0.6033154", "0.60258174", "0.6017803", "0.6013834", "0.60116976", "0.60036296", "0.59834194", "0.59725636", "0.59688425", "0.596744", "0.59645617", "0.5963243", "0.5961858", "0.5957498", "0.59475935", "0.5945452", "0.5937071", "0.5916379", "0.5916379", "0.5905279", "0.5881062", "0.5878528", "0.58740777", "0.58722454", "0.5871717", "0.5869611", "0.5865856", "0.5856936", "0.58526975", "0.5849365", "0.58490676", "0.5848441", "0.58466846" ]
0.703197
2
Initialize the contents of the frame.
private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 450, 407); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); textFieldEmprestimoModelo = new JTextField(); textFieldEmprestimoModelo.setBounds(10, 66, 86, 20); frame.getContentPane().add(textFieldEmprestimoModelo); textFieldEmprestimoModelo.setColumns(10); textFieldEmprestimoNdeSerie = new JTextField(); textFieldEmprestimoNdeSerie.setBounds(10, 137, 86, 20); frame.getContentPane().add(textFieldEmprestimoNdeSerie); textFieldEmprestimoNdeSerie.setColumns(10); textFieldEmprestimoCalibre = new JTextField(); textFieldEmprestimoCalibre.setBounds(10, 204, 86, 20); frame.getContentPane().add(textFieldEmprestimoCalibre); textFieldEmprestimoCalibre.setColumns(10); JLabel lblEmprestimoMensagem = new JLabel("EMPR\u00C9STIMO DE MATERIAL B\u00C9LICO"); lblEmprestimoMensagem.setFont(new Font("Tahoma", Font.PLAIN, 16)); lblEmprestimoMensagem.setForeground(Color.RED); lblEmprestimoMensagem.setBounds(62, 11, 362, 14); frame.getContentPane().add(lblEmprestimoMensagem); JLabel lblEmprestimoModelo = new JLabel("Modelo:"); lblEmprestimoModelo.setBounds(10, 45, 46, 14); frame.getContentPane().add(lblEmprestimoModelo); JLabel lblEmprestimoNdeSerie = new JLabel("N\u00BA de s\u00E9rie:"); lblEmprestimoNdeSerie.setBounds(10, 114, 69, 14); frame.getContentPane().add(lblEmprestimoNdeSerie); JLabel lblEmprestimoCalibre = new JLabel("Calibre:"); lblEmprestimoCalibre.setBounds(10, 181, 46, 14); frame.getContentPane().add(lblEmprestimoCalibre); rdbtnEmprestimoMunicao = new JRadioButton("Muni\u00E7\u00E3o"); rdbtnEmprestimoMunicao.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if(textFieldEmprestimoModelo.isEnabled()) { textFieldEmprestimoModelo.disable(); textFieldEmprestimoModelo.setText(null); textFieldEmprestimoCalibre.disable(); textFieldEmprestimoCalibre.setText(null); textFieldEmprestimoEspecie.disable(); textFieldEmprestimoEspecie.setText(null); textFieldEmprestimoNdeSerie.disable(); textFieldEmprestimoNdeSerie.setText(null); textFieldEmprestimoMarca.disable(); textFieldEmprestimoMarca.setText(null); textFieldEmprestimoMunCalibre.enable(); textFieldEmprestimoMunQuantidade.enable(); } else{ textFieldEmprestimoModelo.enable(); textFieldEmprestimoCalibre.enable(); textFieldEmprestimoEspecie.enable(); textFieldEmprestimoNdeSerie.enable(); textFieldEmprestimoMarca.enable(); textFieldEmprestimoMunCalibre.disable(); textFieldEmprestimoMunQuantidade.disable(); textFieldEmprestimoMunCalibre.setText(null); textFieldEmprestimoMunQuantidade.setText(null); } } }); JButton btnEmprestimoRetirar = new JButton("Retirar"); btnEmprestimoRetirar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(rdbtnEmprestimoMunicao.isSelected()) { if(textFieldEmprestimoMunCalibre.getText().isEmpty()||textFieldEmprestimoMunQuantidade.getText().isEmpty()) { JOptionPane.showMessageDialog(null, "Preencha todos os dados devidos !"); } else { int valor; try { valor = Integer.parseInt(textFieldEmprestimoMunCalibre.getText()); valor = Integer.parseInt(textFieldEmprestimoMunQuantidade.getText()); }catch(NumberFormatException ex) { JOptionPane.showMessageDialog(null, "Digite apenas números !"); } LocalDate date = LocalDate.now(); Municao municao = new MunicaoPatrimonio(textFieldEmprestimoMunCalibre.getText(), "Munição", date, null, Integer.parseInt(textFieldEmprestimoMunQuantidade.getText()), null); if(CadastrarMunicao.getInstance().checar(municao)) { CadastrarMunicao.getInstance().retirar(municao); JOptionPane.showMessageDialog(null, "Retirado"); new MenuPrincipal(); frame.setVisible(false); } else { JOptionPane.showMessageDialog(null, "Material não encontrado !"); } } } else { if(textFieldEmprestimoCalibre.getText().isEmpty()||textFieldEmprestimoEspecie.getText().isEmpty()||textFieldEmprestimoModelo.getText().isEmpty()||textFieldEmprestimoNdeSerie.getText().isEmpty()||textFieldEmprestimoMarca.getText().isEmpty()) { JOptionPane.showMessageDialog(null, "Preencha todos dados devidos !"); } else { int valor; try { valor = Integer.parseInt(textFieldEmprestimoCalibre.getText()); valor = Integer.parseInt(textFieldEmprestimoNdeSerie.getText()); }catch(NumberFormatException ex) { JOptionPane.showMessageDialog(null, "Digite apenas números !(Nº de série / Calibre"); } valor = Integer.parseInt(textFieldEmprestimoCalibre.getText()); valor = Integer.parseInt(textFieldEmprestimoNdeSerie.getText()); LocalDate date = LocalDate.now(); ArmaDeFogo arma = new ArmaDeFogo(textFieldEmprestimoCalibre.getText(), textFieldEmprestimoEspecie.getText(), date, null, textFieldEmprestimoMarca.getText(), textFieldEmprestimoModelo.getText(), textFieldEmprestimoNdeSerie.getText(), "ativa"); if(CadastrarArmaDeFogo.getInstance().encontradoRetirado(arma)) { JOptionPane.showMessageDialog(null, "Retirado"); new MenuPrincipal(); frame.setVisible(false); } else { JOptionPane.showMessageDialog(null, "Material não encontrado !"); } } } } }); btnEmprestimoRetirar.setBounds(151, 319, 115, 23); frame.getContentPane().add(btnEmprestimoRetirar); JLabel lblEmprestimoEspecie = new JLabel("Esp\u00E9cie:"); lblEmprestimoEspecie.setBounds(10, 245, 69, 14); frame.getContentPane().add(lblEmprestimoEspecie); textFieldEmprestimoEspecie = new JTextField(); textFieldEmprestimoEspecie.setBounds(10, 270, 86, 20); frame.getContentPane().add(textFieldEmprestimoEspecie); textFieldEmprestimoEspecie.setColumns(10); rdbtnEmprestimoMunicao.setBounds(301, 41, 109, 23); frame.getContentPane().add(rdbtnEmprestimoMunicao); textFieldEmprestimoMunCalibre = new JTextField(); textFieldEmprestimoMunCalibre.setEnabled(false); textFieldEmprestimoMunCalibre.setBounds(324, 84, 86, 20); frame.getContentPane().add(textFieldEmprestimoMunCalibre); textFieldEmprestimoMunCalibre.setColumns(10); textFieldEmprestimoMunQuantidade = new JTextField(); textFieldEmprestimoMunQuantidade.setEnabled(false); textFieldEmprestimoMunQuantidade.setBounds(324, 137, 86, 20); frame.getContentPane().add(textFieldEmprestimoMunQuantidade); textFieldEmprestimoMunQuantidade.setColumns(10); JLabel lblEmprestimoMunCalibre = new JLabel("Calibre:"); lblEmprestimoMunCalibre.setBounds(268, 87, 46, 14); frame.getContentPane().add(lblEmprestimoMunCalibre); JLabel lblEmprestimoMunQuantidade = new JLabel("Quantidade:"); lblEmprestimoMunQuantidade.setBounds(236, 140, 78, 14); frame.getContentPane().add(lblEmprestimoMunQuantidade); JButton btnEmprestimoVoltar = new JButton("Voltar"); btnEmprestimoVoltar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new MenuPrincipal(); frame.setVisible(false); } }); btnEmprestimoVoltar.setBounds(321, 319, 89, 23); frame.getContentPane().add(btnEmprestimoVoltar); textFieldEmprestimoMarca = new JTextField(); textFieldEmprestimoMarca.setBounds(118, 66, 86, 20); frame.getContentPane().add(textFieldEmprestimoMarca); textFieldEmprestimoMarca.setColumns(10); JLabel lblEmprestimoMarca = new JLabel("Marca:"); lblEmprestimoMarca.setBounds(113, 45, 46, 14); frame.getContentPane().add(lblEmprestimoMarca); frame.setVisible(true); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public BreukFrame() {\n super();\n initialize();\n }", "public MainFrame() {\n\t\tsuper();\n\t\tinitialize();\n\t}", "private void initialize() {\n\t\tthis.setSize(211, 449);\n\t\tthis.setContentPane(getJContentPane());\n\t\tthis.setTitle(\"JFrame\");\n\t}", "public SiscobanFrame() {\r\n\t\tsuper();\r\n\t\tinitialize();\r\n\t}", "private void initialize() {\n\t\tframe = new JFrame();\n\t\tframe.setBounds(0, 0, 1100, 800);\n\t\tframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n\n\t\tsetUIComponents();\n\t\tsetControllers();\n\n\t}", "private void initialize() {\r\n\t\tthis.setSize(530, 329);\r\n\t\tthis.setContentPane(getJContentPane());\r\n\t\tthis.setTitle(\"JFrame\");\r\n\t}", "private void initialize() {\r\n\t\tthis.setSize(300, 200);\r\n\t\tthis.setContentPane(getJContentPane());\r\n\t\tthis.setTitle(\"JFrame\");\r\n\t}", "private void initialize() {\n\t\tframe = new JFrame();\n\t\taddSampleData();\n\t\tsetDefaultSettings();\n\t\topenHomePage();\n\t\tframe.setVisible(true);\n\t}", "private void initialize() {\n\t\tframe = new JFrame(\"Media Inventory\");\r\n\t\tframe.setBounds(100, 100, 450, 300);\r\n\t\tframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n\t}", "private void initialize() {\n\t\tframe = new JFrame();\n\t\tframe.setBounds(0, 0, 1000, 700);\n\t\tframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n\t\tframe.getContentPane().setLayout(null);\n\t\t\n\t\tframeContent = new JPanel();\n\t\tframe.getContentPane().add(frameContent);\n\t\tframeContent.setBounds(10, 10, 700, 640);\n\t\tframeContent.setLayout(null);\n\t\t\n\t\tinfoPane = new JPanel();\n\t\tframe.getContentPane().add(infoPane);\n\t\tinfoPane.setBounds(710, 10, 300, 640);\n\t\tinfoPane.setLayout(null);\n\t}", "private void initialize() {\n\t\tframe = new JFrame(\"BirdSong\");\n\t\tframe.pack();\n\t\tframe.setVisible(true);\n\t\tframe.setBounds(100, 100, 400, 200);\n\t\tframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n\n\t\tabc = new BirdPanel();\n\t\ttime = new TimePanel();\n\t\tgetContentPane().setLayout(new BoxLayout(frame, BoxLayout.Y_AXIS));\n\n\t\tframe.getContentPane().add(abc, BorderLayout.NORTH);\n\t\tframe.getContentPane().add(time, BorderLayout.CENTER);\n\t}", "private void initialize() {\r\n\t\tthis.setSize(311, 153);\r\n\t\tthis.setContentPane(getJContentPane());\r\n\t\tthis.setTitle(\"JFrame\");\r\n\t\tsetCancelButton( btnCancel );\r\n\t}", "public Frame() {\n initComponents();\n }", "public Frame() {\n initComponents();\n }", "private void initialize() {\r\n\t\tthis.setSize(497, 316);\r\n\t\tthis.setContentPane(getJContentPane());\r\n\t\tthis.setTitle(\"JFrame\");\r\n\t\tthis.setExtendedState(JFrame.MAXIMIZED_BOTH);\r\n\t\tthis.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n\t}", "protected HFrame(){\n\t\tinit();\n\t}", "private void initializeFields() {\r\n myFrame = new JFrame();\r\n myFrame.setSize(DEFAULT_SIZE);\r\n }", "private void initialize() {\r\n\t\t//setFrame\r\n\t\tframe = new JFrame();\r\n\t\tframe.setBounds(125,175, 720, 512);\r\n\t\tframe.setTitle(\"Periodic Table\");\r\n\t\tframe.setResizable(false);\r\n\t\tframe.getContentPane().setLayout(null);\r\n\t\tframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n\t}", "private void initialize() {\n\t\tthis.setSize(329, 270);\n\t\tthis.setContentPane(getJContentPane());\n\t}", "private void initFrame() {\n setLayout(new BorderLayout());\n }", "private void initialize() {\n\t\tthis.setSize(300, 300);\n\t\tthis.setIconifiable(true);\n\t\tthis.setClosable(true);\n\t\tthis.setTitle(\"Sobre\");\n\t\tthis.setContentPane(getJContentPane());\n\t\tthis.setFrameIcon(new ImageIcon(\"images/16x16/info16x16.gif\"));\n\t}", "public FrameControl() {\n initComponents();\n }", "private void initialize() {\r\n\t\tframe = new JFrame();\r\n\t\tframe.setBounds(100, 100, 450, 300);\r\n\t\tframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n\t}", "public MainFrame() {\n initComponents();\n \n }", "private void init(Element frame) {\n\t\tthis.frameWidth = Integer.parseInt(frame.attributeValue(\"width\"));\n\t\tthis.frameHeight = Integer.parseInt(frame.attributeValue(\"height\"));\n\t\tthis.paddle = Integer.parseInt(frame.attributeValue(\"paddle\"));\n\t\tthis.size = Integer.parseInt(frame.attributeValue(\"size\"));\n\t}", "public MainFrame() {\n \n initComponents();\n \n this.initNetwork();\n \n this.render();\n \n }", "public internalFrame() {\r\n initComponents();\r\n }", "private void initialize() {\n\t\tthis.setContentPane(getJContentPane());\n\t\tthis.setContentPane(getJContentPane());\n\t\tthis.setSize(810, 600);\n\t\tthis.setContentPane(getJContentPane());\n\t\tthis.setBackground(new java.awt.Color(226,226,222));\n\t\tthis.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);\n\t\tthis.setModal(true);\n\t\tthis.setResizable(false);\n\t\tthis.setName(\"FramePrincipalLR\");\n\t\tthis.setTitle(\"CR - Lista de Regalos\");\n\t\tthis.setLocale(new java.util.Locale(\"es\", \"VE\", \"\"));\n\t\tthis.setUndecorated(false);\n\t}", "public Mainframe() {\n initComponents();\n }", "private void initialize() {\r\n\t\tthis.setSize(392, 496);\r\n\t\tthis.setContentPane(getJContentPane());\r\n\t\tthis.setTitle(\"Informações\");\r\n\t}", "private void initialize() {\n this.setSize(253, 175);\n this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n this.setContentPane(getJContentPane());\n this.setTitle(\"Breuken vereenvoudigen\");\n }", "private void initialize() {\r\n\t\t// Initialize main frame\r\n\t\tframe = new JFrame();\r\n\t\tframe.setBounds(Constants.C_MAIN_PREFERED_POSITION_X_AT_START, Constants.C_MAIN_PREFERED_POSITION_Y_AT_START, \r\n\t\t\t\tConstants.C_MAIN_PREFERED_SIZE_X, Constants.C_MAIN_PREFERED_SIZE_Y);\r\n\t\tframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n\t\tframe.setTitle(Constants.C_MAIN_WINDOW_TITLE);\r\n\t\t\r\n\t\t// Tab panel and their panels\r\n\t\tmainTabbedPane = new JTabbedPane(JTabbedPane.TOP);\r\n\t\tframe.getContentPane().add(mainTabbedPane, BorderLayout.CENTER);\r\n\t\t\r\n\t\tpanelDecision = new DecisionPanel();\r\n\t\tmainTabbedPane.addTab(Constants.C_TAB_DECISION_TITLE, null, panelDecision, null);\r\n\t\t\r\n\t\tpanelCalculation = new CalculationPanel();\r\n\t\tmainTabbedPane.addTab(Constants.C_TAB_CALCULATION_TITLE, null, panelCalculation, null);\r\n\t\t\r\n\t\tpanelLibrary = new LibraryPanel();\r\n\t\tmainTabbedPane.addTab(Constants.C_TAB_LIBRARY_TITLE, null, panelLibrary, null);\r\n\t\t\r\n\t\t// Menu bar\r\n\t\tmenuBar = new JMenuBar();\r\n\t\tframe.setJMenuBar(menuBar);\r\n\t\tcreateMenus();\r\n\t}", "public void initializeFrame() {\n frame.getContentPane().removeAll();\n createComponents(frame.getContentPane());\n// frame.setSize(new Dimension(1000, 600));\n }", "private void initialize() {\r\n\t\t// this.setSize(271, 295);\r\n\t\tthis.setSize(495, 392);\r\n\t\tthis.setContentPane(getJContentPane());\r\n\t\tthis.setTitle(ResourceBundle.getBundle(\"Etiquetas\").getString(\"MainTitle\"));\r\n\t}", "private void initializeFrame() {\n add(container);\n setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);\n pack();\n }", "private void initialize() {\n\t\tframe = new JFrame(\"DB Filler\");\n\t\tframe.setBounds(100, 100, 700, 500);\n\t\tframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n\n\t\tdbc = new DataBaseConnector();\n\t\tcreateFileChooser();\n\n\t\taddTabbedPane();\n\t\tsl_panel = new SpringLayout();\n\t\taddAddFilePanel();\n\t}", "private void initialize() {\n this.setSize(300, 200);\n this.setContentPane(getJContentPane());\n this.pack();\n }", "public mainframe() {\n initComponents();\n }", "public FrameDesign() {\n initComponents();\n }", "public Jframe() {\n initComponents();\n setIndice();\n loadTextBoxs();\n }", "public JGSFrame() {\n\tsuper();\n\tinitialize();\n }", "public MainFrame() {\n initComponents();\n }", "public MainFrame() {\n initComponents();\n }", "public MainFrame() {\n initComponents();\n }", "public MainFrame() {\n initComponents();\n }", "public MainFrame() {\n initComponents();\n }", "public MainFrame() {\n initComponents();\n }", "public MainFrame() {\n initComponents();\n }", "public MainFrame() {\n initComponents();\n }", "public MainFrame() {\n initComponents();\n }", "public MainFrame() {\n initComponents();\n }", "public MainFrame() {\n initComponents();\n }", "public MainFrame() {\n initComponents();\n }", "public MainFrame() {\n try {\n initComponents();\n initElements();\n } catch (Exception e) {\n JOptionPane.showMessageDialog(null, \"Error \" + e.getMessage());\n }\n }", "private void initialize() {\n this.setSize(495, 276);\n this.setTitle(\"Translate Frost\");\n this.setContentPane(getJContentPane());\n }", "private void initialize() {\r\n\t\t// set specific properties and add inner components.\r\n\t\tthis.setBorder(BorderFactory.createEtchedBorder());\r\n\t\tthis.setSize(300, 400);\r\n\t\tthis.setLayout(new BorderLayout());\r\n\t\taddComponents();\r\n\t}", "private void initialize() {\r\n\t\tthis.setBounds(new Rectangle(0, 0, 670, 576));\r\n\t\tthis.setResizable(false);\r\n\t\tthis.setTitle(\"数据入库 \");\r\n\t\tthis.setLocationRelativeTo(getOwner());\r\n\t\tthis.setContentPane(getJContentPane());\r\n\t}", "public void initializePanelToFrame() {\n\t\tnew ColorResources();\n\t\tnew TextResources().changeLanguage();\n\t\tpanel = new JPanel();\n\t\tpanel.setLayout(null);\n\t\tpanel.setPreferredSize(new Dimension(375, 812));\n\n\t\tconfigureLabels();\n\t\tconfigureButtons();\n\t\taddListeners();\n\t\taddComponentsToPanel();\n\n\t\tthis.setContentPane(panel);\n\t\tthis.pack();\n\t}", "private void initialize() {\n this.setLayout(new BorderLayout());\n this.setSize(new java.awt.Dimension(564, 229));\n this.add(getMessagePanel(), java.awt.BorderLayout.NORTH);\n this.add(getBalloonSettingsListBox(), java.awt.BorderLayout.CENTER);\n this.add(getBalloonSettingsButtonPane(), java.awt.BorderLayout.SOUTH);\n\n editBalloonSettingsFrame = new EditBalloonSettingsFrame();\n\n }", "public SMFrame() {\n initComponents();\n updateComponents();\n }", "private void initialize() {\n m_frame = new JFrame(\"Video Recorder\");\n m_frame.setResizable(false);\n m_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n m_frame.setLayout(new BorderLayout());\n m_frame.add(buildContentPanel(), BorderLayout.CENTER);\n\n JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 5));\n JButton startButton = new JButton(\"Start\");\n startButton.addActionListener(new ActionListener() {\n @Override\n public void actionPerformed(ActionEvent ae) {\n listen();\n }\n });\n buttonPanel.add(startButton);\n\n m_connectionLabel = new JLabel(\"Disconnected\");\n m_connectionLabel.setOpaque(true);\n m_connectionLabel.setBackground(Color.RED);\n m_connectionLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 3));\n m_connectionLabel.setPreferredSize(new Dimension(100, 26));\n m_connectionLabel.setHorizontalAlignment(SwingConstants.CENTER);\n buttonPanel.add(m_connectionLabel);\n\n m_frame.add(buttonPanel, BorderLayout.PAGE_END);\n }", "public FirstNewFrame() {\n\t\tjbInit();\n\t}", "private void initialize() {\n\t\tframe = new JFrame();\n\t\tframe.getContentPane().setBackground(Color.BLACK);\n\t\tframe.setBounds(100, 100, 450, 300);\n\t\tframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n\t\tframe.getContentPane().setLayout(null);\n\t\t\n\t\tJButton btnNewButton = new JButton(\"Play\");\n\t\tbtnNewButton.setFont(new Font(\"Bodoni 72\", Font.BOLD, 13));\n\t\tbtnNewButton.setBounds(frame.getWidth() / 2 - 60, 195, 120, 30);\n\t\tframe.getContentPane().add(btnNewButton);\n\t\t\n\t\tJLabel lblNewLabel = new JLabel(\"Space Escape\");\n\t\tlblNewLabel.setForeground(Color.WHITE);\n\t\tlblNewLabel.setFont(new Font(\"Bodoni 72\", Font.BOLD, 24));\n\t\tlblNewLabel.setBounds(frame.getWidth() / 2 - 60, 30, 135, 25);\n\t\tframe.getContentPane().add(lblNewLabel);\n\t\t\n\t\tJLabel lblNewLabel_1 = new JLabel(\"New label\");\n\t\tlblNewLabel_1.setBounds(0, 0, frame.getWidth(), frame.getHeight());\n\t\tframe.getContentPane().add(lblNewLabel_1);\n\t}", "private void initializeFrame()\r\n\t{\r\n\t\tthis.setResizable(false);\r\n\r\n\t\tsetSize(DIMENSIONS); // set the correct dimensions\r\n\t\tsetDefaultCloseOperation(EXIT_ON_CLOSE);\r\n\t\tsetLayout( new GridLayout(1,1) );\r\n\t}", "private void setupFrame()\n\t{\n\t\tthis.setContentPane(botPanel);\n\t\tthis.setSize(800,700);\n\t\tthis.setTitle(\"- Chatbot v.2.1 -\");\n\t\tthis.setResizable(true);\n\t\tthis.setVisible(true);\n\t}", "public MainFrame() {\n initComponents();\n setLocationRelativeTo(null);\n }", "public EmulatorFrame() {\r\n\t\tsuper(\"Troyboy Chip8 Emulator\");\r\n\t\t\r\n\t\tsetNativeLAndF();\r\n\t\tinitComponents();\r\n\t\tinitMenubar();\r\n\t\tsetupLayout();\r\n\t\tinitFrame();\r\n\t\t//frame is now ready to run a game\r\n\t\t//running of any games must be started by loading a ROM\r\n\t}", "public void init()\n {\n buildUI(getContentPane());\n }", "private void initialize()\n {\n this.setTitle( \"SerialComm\" ); // Generated\n this.setSize( 500, 300 );\n this.setContentPane( getJContentPane() );\n }", "public launchFrame() {\n \n initComponents();\n \n }", "private void initialize() {\r\n\t\tthis.setSize(378, 283);\r\n\t\tthis.setJMenuBar(getMenubar());\r\n\t\tthis.setContentPane(getJContentPane());\r\n\t\tthis.setTitle(\"JAVIER\");\r\n\t}", "private void initialize() {\n\t\tthis.setSize(430, 280);\n\t\tthis.setContentPane(getJContentPane());\n\t\tthis.setUndecorated(true);\n\t\tthis.setModal(true);\n\t\tthis.setBackground(new java.awt.Color(226,226,222));\n\t\tthis.setTitle(\"Datos del Invitado\");\n\t\tthis.addComponentListener(this);\n\t}", "public PilaFrame() {\n initComponents();\n }", "private void initialize() {\n\t\tframe = new JFrame();\n\t\tframe.setBounds(100, 100, 900, 900);\n\t\tframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n\t\t\n\t\tgame = new Game();\n\t\t\n\t\tGameTable puzzle = new GameTable(game.getPuzzle());\n\t\tpuzzle.setBounds(100, 100, 700, 700);\n\t\t\n\t\tframe.add(puzzle);\n\t\t\n\t\tSystem.out.println(\"SAD\");\n\t\t\n\t}", "private void initialize() {\r\n\t\tframe = new JFrame();\r\n\t\tframe.setResizable(false);\r\n\t\tframe.setBounds(100, 100, 450, 300);\r\n\t\tframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n\t\tframe.getContentPane().setLayout(null);\r\n\t\t\r\n\t\tPanel mainFramePanel = new Panel();\r\n\t\tmainFramePanel.setBounds(10, 10, 412, 235);\r\n\t\tframe.getContentPane().add(mainFramePanel);\r\n\t\tmainFramePanel.setLayout(null);\r\n\t\t\r\n\t\tfinal TextField textField = new TextField();\r\n\t\ttextField.setBounds(165, 62, 79, 24);\r\n\t\tmainFramePanel.add(textField);\r\n\t\t\r\n\t\tButton changeTextButt = new Button(\"Change Text\");\r\n\t\tchangeTextButt.addActionListener(new ActionListener() {\r\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\r\n\t\t\t\ttextField.setText(\"Domograf\");\r\n\t\t\t}\r\n\t\t});\r\n\t\tchangeTextButt.setBounds(165, 103, 79, 24);\r\n\t\tmainFramePanel.add(changeTextButt);\r\n\t}", "private void initialize() {\n\t\tframe = new JFrame();\n\t\tframe.setResizable(false);\n\t\tframe.setAlwaysOnTop(true);\n\t\tframe.setBounds(100, 100, 450, 300);\n\t\tframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n\t\tframe.getContentPane().setLayout(null);\n\t}", "StudentFrame() {\n \tgetContentPane().setFont(new Font(\"Times New Roman\", Font.PLAIN, 11));\n s1 = null; // setting to null\n initializeComponents(); // causes frame components to be initialized\n }", "public NewFrame() {\n initComponents();\n }", "private void initialize() {\r\n\t\tthis.setSize(300, 200);\r\n\t\tthis.setTitle(\"Error\");\r\n\t\tthis.setContentPane(getJContentPane());\r\n\t}", "public SerialCommFrame()\n {\n super();\n initialize();\n }", "public LoginFrame() {\n\t\tsuper();\n\t\tinitialize();\n\t}", "public BaseFrame() {\n initComponents();\n }", "private void initialize() {\r\n\t\tthis.setSize(733, 427);\r\n\t\tthis.setContentPane(getJContentPane());\r\n\t\tthis.setTitle(\"jProxyChecker\");\r\n\t}", "public frame() {\r\n\t\tadd(createMainPanel());\r\n\t\tsetTitle(\"Lunch Date\");\r\n\t\tsetSize(FRAME_WIDTH, FRAME_HEIGHT);\r\n\r\n\t}", "public MercadoFrame() {\n initComponents();\n }", "private void initialize() {\r\n\t\tframe = new JFrame();\r\n\t\tframe.setBounds(X_FRAME, Y_FRAME, WIDTH_FRAME, HEIGHT_FRAME);\r\n\t\tframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n\t\tframe.getContentPane().setLayout(null);\r\n\t\t\r\n\t\tJButton btnAddSong = new JButton(\"Add song\");\r\n\t\tbtnAddSong.setBounds(X_BTN, Y_ADDSONG, WIDTH_BTN, HEIGHT_BTN);\r\n\t\tframe.getContentPane().add(btnAddSong);\r\n\t\t\r\n\t\tJTextPane txtpnBlancoYNegro = new JTextPane();\r\n\t\ttxtpnBlancoYNegro.setText(\"Blanco y negro\\r\\nThe Spectre\\r\\nGirasoles\\r\\nFaded\\r\\nTu Foto\\r\\nEsencial\");\r\n\t\ttxtpnBlancoYNegro.setBounds(X_TXT, Y_TXT, WIDTH_TXT, HEIGHT_TXT);\r\n\t\tframe.getContentPane().add(txtpnBlancoYNegro);\r\n\t\t\r\n\t\tJLabel lblSongs = new JLabel(\"Songs\");\r\n\t\tlblSongs.setBounds(X_LBL, Y_LBL, WIDTH_LBL, HEIGHT_LBL);\r\n\t\tframe.getContentPane().add(lblSongs);\r\n\t\t\r\n\t\tJButton btnAddAlbum = new JButton(\"Add album\");\r\n\t\tbtnAddAlbum.setBounds(X_BTN, Y_ADDALBUM, WIDTH_BTN, HEIGHT_BTN);\r\n\t\tframe.getContentPane().add(btnAddAlbum);\r\n\t}", "private void initialize() {\n\t\tframe = new JFrame();\n\t\tframe.setBounds(100, 100, 800, 800);\n\t\tframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n\t\t\n\t\tJPanel browserPanel = new JPanel();\n\t\tframe.getContentPane().add(browserPanel, BorderLayout.CENTER);\n\t\t\n\t\t// create javafx panel for browser\n browserFxPanel = new JFXPanel();\n browserPanel.add(browserFxPanel);\n \n // create JavaFX scene\n Platform.runLater(new Runnable() {\n public void run() {\n createScene();\n }\n });\n\t}", "public holdersframe() {\n initComponents();\n }", "private void setupFrame()\n\t\t{\n\t\t\tthis.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n\t\t\tthis.setResizable(false);\n\t\t\tthis.setSize(800, 600);\n\t\t\tthis.setTitle(\"SEKA Client\");\n\t\t\tthis.setContentPane(panel);\n\t\t\tthis.setVisible(true);\n\t\t}", "public void init() {\n\t\tsetSize(500,300);\n\t}", "public addStFrame() {\n initComponents();\n }", "public JFrame() {\n initComponents();\n }", "public FrameForm() {\n initComponents();\n }", "private void initialize() {\n\t\tframe = new JFrame(\"View Report\");\n\t\tframe.setBounds(100, 100, 450, 300);\n\t\tframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n\t\tframe.getContentPane().setLayout(null);\n\n\t\tJButton backButton = new JButton(\"Back\");\n\t\tbackButton.setBounds(176, 227, 89, 23);\n\t\tframe.getContentPane().add(backButton);\n\t\tbackButton.addActionListener(new ActionListener(){\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tframe.setVisible(false);\n\t\t\t}\n\t\t});\n\t\t\n\t\tJTextArea textArea = new JTextArea();\n\t\ttextArea.setBounds(50, 30, 298, 173);\n\t\tframe.getContentPane().add(textArea);\n\t\ttextArea.append(control.seeReport());\n\t\tframe.setVisible(true);\n\t}", "private void initialize() {\r\n this.setSize(new Dimension(666, 723));\r\n this.setContentPane(getJPanel());\r\n\t\t\t\r\n\t}", "private void initialize() {\n\t\tframe = new JFrame();\n\t\tframe.getContentPane().setBackground(Color.BLACK);\n\t\tframe.getContentPane().setLayout(null);\n\t\t\n\t\tJLabel lblSubmission = new JLabel(\"Submission\");\n\t\tlblSubmission.setForeground(Color.WHITE);\n\t\tlblSubmission.setFont(new Font(\"Comic Sans MS\", Font.PLAIN, 16));\n\t\tlblSubmission.setBounds(164, 40, 83, 14);\n\t\tframe.getContentPane().add(lblSubmission);\n\t\t\n\t\tJLabel lblTitle = new JLabel(\"Title:\");\n\t\tlblTitle.setForeground(Color.WHITE);\n\t\tlblTitle.setFont(new Font(\"Comic Sans MS\", Font.PLAIN, 14));\n\t\tlblTitle.setBounds(77, 117, 41, 14);\n\t\tframe.getContentPane().add(lblTitle);\n\t\t\n\t\tJLabel lblPath = new JLabel(\"Path:\");\n\t\tlblPath.setForeground(Color.WHITE);\n\t\tlblPath.setFont(new Font(\"Comic Sans MS\", Font.PLAIN, 14));\n\t\tlblPath.setBounds(85, 155, 33, 14);\n\t\tframe.getContentPane().add(lblPath);\n\t\t\n\t\ttitle = new JTextField();\n\t\ttitle.setBounds(128, 116, 197, 20);\n\t\tframe.getContentPane().add(title);\n\t\ttitle.setColumns(10);\n\t\t\n\t\tpath = new JTextField();\n\t\tpath.setBounds(128, 154, 197, 20);\n\t\tframe.getContentPane().add(path);\n\t\tpath.setColumns(10);\n\t\t\n\t\tbtnSubmit = new JButton(\"Submit\");\n\t\tbtnSubmit.setBackground(Color.BLACK);\n\t\tbtnSubmit.setForeground(Color.WHITE);\n\t\tbtnSubmit.setFont(new Font(\"Comic Sans MS\", Font.PLAIN, 14));\n\t\tbtnSubmit.setBounds(158, 210, 89, 23);\n\t\tframe.getContentPane().add(btnSubmit);\n\t\tframe.setBounds(100, 100, 450, 300);\n\t\tframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);\n\t\tframe.setVisible(true);\n\t}", "public void init() {\r\n\t\t\r\n\t\tsetSize(WIDTH, HEIGHT);\r\n\t\tColor backgroundColor = new Color(60, 0, 60);\r\n\t\tsetBackground(backgroundColor);\r\n\t\tintro = new GImage(\"EvilMehranIntroGraphic.png\");\r\n\t\tintro.setLocation(0,0);\r\n\t\tadd(intro);\r\n\t\tplayMusic(new File(\"EvilMehransLairThemeMusic.wav\"));\r\n\t\tinitAnimationArray();\r\n\t\taddKeyListeners();\r\n\t\taddMouseListeners();\r\n\t\twaitForClick();\r\n\t\tbuildWorld();\r\n\t}", "private void initialize() {\n\t\tthis.setBounds(100, 100, 950, 740);\n\t\tthis.setLayout(null);\n\n\t\n\t}", "public FrameIntroGUI() {\n\t\ttry {\n\t\t\tjbInit();\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "private void initialize() {\n\t\tframe = new JFrame();\n\t\tframe.setBounds(100, 100, 450, 300);\n\t\tframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n\t\tframe.getContentPane().setLayout(null);\n\t\t\n\t\tJLabel lblCoisa = new JLabel(\"Coisa\");\n\t\tlblCoisa.setBounds(10, 11, 46, 14);\n\t\tframe.getContentPane().add(lblCoisa);\n\t\t\n\t\ttextField = new JTextField();\n\t\ttextField.setBounds(39, 8, 86, 20);\n\t\tframe.getContentPane().add(textField);\n\t\ttextField.setColumns(10);\n\t}", "private void initialize() {\n\t\tthis.setExtendedState(Frame.MAXIMIZED_BOTH);\n\t\tthis.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n\t\tthis.setResizable(true);\n\t\tthis.screenDimensions = Toolkit.getDefaultToolkit().getScreenSize();\n\t\tthis.getContentPane().setLayout(new BorderLayout());\n\t\t// Initialize SubComponents and GUI Commands\n\t\tthis.initializeSplitPane();\n\t\tthis.initializeExplorer();\n\t\tthis.initializeConsole();\n\t\tthis.initializeMenuBar();\n\t\tthis.pack();\n\t\tthis.hydraExplorer.refreshExplorer();\n\t}" ]
[ "0.7769806", "0.75645775", "0.744096", "0.7367939", "0.7366207", "0.7356814", "0.73127955", "0.73093945", "0.72973347", "0.7296576", "0.7276723", "0.72713083", "0.72694886", "0.72694886", "0.72140867", "0.71808106", "0.71675664", "0.7140664", "0.71397793", "0.7125805", "0.7105894", "0.70999616", "0.7091813", "0.7081309", "0.706696", "0.7062362", "0.7060244", "0.7058889", "0.7050907", "0.70430565", "0.69948846", "0.6977318", "0.6971185", "0.6955329", "0.69376785", "0.69292814", "0.69285643", "0.69244397", "0.6921545", "0.6919632", "0.6913407", "0.69102097", "0.69102097", "0.69102097", "0.69102097", "0.69102097", "0.69102097", "0.69102097", "0.69102097", "0.69102097", "0.69102097", "0.69102097", "0.69102097", "0.6900884", "0.6889535", "0.6885302", "0.6872394", "0.6869779", "0.68671405", "0.6864778", "0.68621385", "0.68579245", "0.68535745", "0.6852263", "0.68143743", "0.6813034", "0.68074334", "0.67975104", "0.67918676", "0.67797387", "0.6763989", "0.6746957", "0.67307526", "0.6716625", "0.6711505", "0.67049205", "0.6696294", "0.6691563", "0.6690699", "0.6689472", "0.66709447", "0.66590154", "0.6648341", "0.6640382", "0.66401315", "0.6638011", "0.66368794", "0.66340685", "0.6624794", "0.66244256", "0.6610577", "0.66076916", "0.6600162", "0.65993017", "0.65894395", "0.65860456", "0.6584732", "0.6573833", "0.6573252", "0.65701455", "0.6559242" ]
0.0
-1
Creates new form userinterface
public userinterface() { initComponents(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "FORM createFORM();", "private void setupUI() \n\t{\n\t\t\n\t\tthis.setLayout( new FormLayout() );\n\t\tmyInterfaceContainer = new Composite( this, SWT.NONE );\n\t\tmyInterfaceContainer.setLayoutData( FormDataMaker.makeFullFormData());\n\t\t\n\t\tsetupInterfaceContainer();\n\t}", "public abstract void addEditorForm();", "public void onNew() {\t\t\n\t\tdesignWidget.addNewForm();\n\t}", "public FormMenuUser() {\n super(\"Form Menu User\");\n initComponents();\n }", "private void createUserInterface()\r\n {\r\n // get content pane for attaching GUI components\r\n Container contentPane = getContentPane();\r\n\r\n // enable explicit positioning of GUI components\r\n contentPane.setLayout( null );\r\n \r\n // set up side1JLabel\r\n side1JLabel = new JLabel();\r\n side1JLabel.setBounds( 16, 16, 40, 24 );\r\n side1JLabel.setText( \"Side1:\" );\r\n contentPane.add( side1JLabel );\r\n \r\n // set up side1JTextField\r\n side1JTextField = new JTextField();\r\n side1JTextField.setBounds( 72, 16, 90, 24 );\r\n side1JTextField.setHorizontalAlignment( JTextField.RIGHT ); \r\n contentPane.add( side1JTextField );\r\n \r\n // set up side2JLabel\r\n side2JLabel = new JLabel();\r\n side2JLabel.setBounds( 16, 56, 40, 24 );\r\n side2JLabel.setText( \"Side2:\" );\r\n contentPane.add( side2JLabel );\r\n \r\n // set up side2JTextField\r\n side2JTextField = new JTextField();\r\n side2JTextField.setBounds( 72, 56, 90, 24 );\r\n side2JTextField.setHorizontalAlignment( JTextField.RIGHT );\r\n contentPane.add( side2JTextField );\r\n \r\n // set up side3JLabel\r\n side3JLabel = new JLabel();\r\n side3JLabel.setBounds( 16, 96, 40, 24 );\r\n side3JLabel.setText( \"Side3:\" );\r\n contentPane.add( side3JLabel );\r\n \r\n // set up side3JTextField\r\n side3JTextField = new JTextField();\r\n side3JTextField.setBounds( 72, 96, 90, 24 );\r\n side3JTextField.setHorizontalAlignment( JTextField.RIGHT );\r\n contentPane.add( side3JTextField );\r\n \r\n // set up messageJTextField\r\n messageJTextField = new JTextField();\r\n messageJTextField.setBounds( 16, 140, 252, 24 );\r\n messageJTextField.setEditable( false );\r\n contentPane.add( messageJTextField );\r\n \r\n // set up createJButton\r\n createJButton = new JButton();\r\n createJButton.setBounds( 178, 16, 90, 24 );\r\n createJButton.setText( \"Create\" );\r\n contentPane.add( createJButton );\r\n createJButton.addActionListener( \r\n \r\n new ActionListener() // anonymous inner class\r\n {\r\n // event handler called when createJButton is pressed\r\n public void actionPerformed( ActionEvent event )\r\n {\r\n createJButtonActionPerformed( event );\r\n }\r\n \r\n } // end anonymous inner class\r\n \r\n ); // end call to addActionListener\r\n \r\n // set properties of application's window\r\n setTitle( \"Triangle Creator\" ); // set title bar string\r\n setSize( 290, 208 ); // set window size\r\n setVisible( true ); // display window\r\n \r\n }", "private void criaInterface() {\n\t\tColor azul = new Color(212, 212, 240);\n\n\t\tpainelMetadado.setLayout(null);\n\t\tpainelMetadado.setBackground(azul);\n\n\t\tmetadadoLabel = FactoryInterface.createJLabel(10, 3, 157, 30);\n\t\tpainelMetadado.add(metadadoLabel);\n\n\t\tbotaoAdicionar = FactoryInterface.createJButton(520, 3, 30, 30);\n\t\tbotaoAdicionar.setIcon(FactoryInterface.criarImageIcon(Imagem.ADICIONAR));\n\t\tbotaoAdicionar.setToolTipText(Sap.ADICIONAR.get(Sap.TERMO.get()));\n\t\tpainelMetadado.add(botaoAdicionar);\n\n\t\tbotaoEscolha = FactoryInterface.createJButton(560, 3, 30, 30);\n\t\tbotaoEscolha.setIcon(FactoryInterface.criarImageIcon(Imagem.VOLTAR_PRETO));\n\t\tbotaoEscolha.setToolTipText(Sap.ESCOLHER.get(Sap.TERMO.get()));\n\t\tbotaoEscolha.setEnabled(false);\n\t\tpainelMetadado.add(botaoEscolha);\n\n\t\talterarModo(false);\n\t\tatribuirAcoes();\n\t}", "public UserDialog(JFrame parent){\n\t\t\tsuper(parent, \"New user\");\n\t\t\tadd(new JPanel(), BorderLayout.NORTH);\n\t\t\tadd(new UserDatapanel(),BorderLayout.CENTER);\n\t\t\tadd(getButtonPanel(),BorderLayout.SOUTH);\n\t\t\tsetSize(500,300);\n\t\t}", "private void initialize(CurrentProfile newUser) {\n\t\tfrmSignUp = new JFrame();\n\t\tfrmSignUp.setResizable(false);\n\t\t//frmSignUp.setAlwaysOnTop(true);\n\t\tfrmSignUp.setTitle(\"SIGN UP (1/6)\");\n\t\tfrmSignUp.setBounds(100, 100, 557, 483);\n\t\tfrmSignUp.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n\t\tfrmSignUp.getContentPane().setLayout(null);\n\t\tfrmSignUp.setVisible(true);\n\t\t\n\t\tJPanel panel = new JPanel();\n\t\tpanel.setBounds(12, 12, 531, 432);\n\t\tfrmSignUp.getContentPane().add(panel);\n\t\tpanel.setLayout(null);\n\t\t\n\t\t//allfield[0] = new JTextField();\n\t\t//allfield[0].setBounds(165, 60, 246, 20);\n\t\t//panel.add(allfield[0]);\n\t\t\n\t\tJLabel lblName = new JLabel(\"NAME\");\n\t\tlblName.setBounds(33, 67, 46, 14);\n\t\tpanel.add(lblName);\n\t\t\n\t\tJLabel lblDob = new JLabel(\"D.O.B\");\n\t\tlblDob.setBounds(33, 121, 46, 14);\n\t\tpanel.add(lblDob);\n\t\t\n\t\tJLabel lblFatherName = new JLabel(\"FATHER'S NAME\");\n\t\tlblFatherName.setBounds(33, 167, 109, 14);\n\t\tpanel.add(lblFatherName);\n\t\t\n\t\tJLabel lblEmail = new JLabel(\"EMAIL\");\n\t\tlblEmail.setBounds(33, 222, 46, 14);\n\t\tpanel.add(lblEmail);\n\t\t\n\t\tJLabel lblSex = new JLabel(\"SEX\");\n\t\tlblSex.setBounds(33, 271, 46, 14);\n\t\tpanel.add(lblSex);\n\t\t\n\t\tJLabel lblPicture = new JLabel(\"PICTURE\");\n\t\tlblPicture.setBounds(33, 332, 74, 14);\n\t\tpanel.add(lblPicture);\n\t\t\n\t\tJLabel lblUid = new JLabel(\"UID\");\n\t\tlblUid.setBounds(384, 22, 107, 16);\n\t\tlblUid.setText(Integer.toString(newUser.uid));\n\t\tpanel.add(lblUid);\n\t\t\n\t\ttxtName1 = new JTextField();\n\t\ttxtName1.setBounds(158, 64, 163, 20);\n\t\tpanel.add(txtName1);\n\t\ttxtName1.setColumns(10);\n\t\t\n\t\tJRadioButton rdbtnMale = new JRadioButton(\"Male\");\n\t\trdbtnMale.setBounds(153, 267, 109, 23);\n\t\tpanel.add(rdbtnMale);\n\t\t\n\t\tJRadioButton rdbtnFemale = new JRadioButton(\"Female\");\n\t\trdbtnFemale.setBounds(356, 267, 109, 23);\n\t\tpanel.add(rdbtnFemale);\n\t\t\n\t\tButtonGroup group = new ButtonGroup();\n\t\tgroup.add(rdbtnMale);\n\t\tgroup.add(rdbtnFemale);\n\t\t\n\t\ttxtDate = new JTextField();\n\t\ttxtDate.setText(\"DD-MM-YYYY\");\n\t\ttxtDate.setBounds(158, 118, 333, 20);\n\t\tpanel.add(txtDate);\n\t\ttxtDate.setColumns(10);\n\t\t\n\t\ttxtFather = new JTextField();\n\t\ttxtFather.setBounds(160, 164, 331, 20);\n\t\tpanel.add(txtFather);\n\t\ttxtFather.setColumns(10);\n\t\t\n\t\ttxtEmail = new JTextField();\n\t\ttxtEmail.setBounds(158, 216, 333, 20);\n\t\tpanel.add(txtEmail);\n\t\ttxtEmail.setColumns(10);\n\t\t\n\t\tJButton btnSelect = new JButton(\"SELECT IMAGE\");\n\t\tbtnSelect.addMouseListener(new MouseAdapter() {\n\t\t\t@Override\n\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\ttxtPhoto.setText(\"\");\n\t\t\t\tJFileChooser filechooser = new JFileChooser();\n\t\t\t\tFileNameExtensionFilter filter = new FileNameExtensionFilter(\n\t\t\t\t \"Images\", \"jpg\",\"JPG\",\"GIF\", \"gif\",\"JPEG\",\"png\",\"PNG\");\n\t\t\t\tfilechooser.setFileFilter(filter);\n\t\t\t\t//ThumbNailView thumbsView = new ThumbNailView();\n\t\t\t\t//filechooser.setAccessory(new ImagePreview(filechooser));\n\t\t\t\tint returnVal = filechooser.showDialog(null,\"select an image\");\n\t\t\t\tif (returnVal == JFileChooser.APPROVE_OPTION){\n\t\t\t\t\tfile = filechooser.getSelectedFile();\n\t\t\t\t\ttxtPhoto.setText(file.getPath());\n\t\t\t\t\tnewUser.picLoc=file.getPath();\n\t\t\t\t//\tnewUser.picName=file.getName();\n\t\t\t\t\tnewUser.picLoc=newUser.picLoc.replace(\"\\\\\", \"\\\\\\\\\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tbtnSelect.setBounds(374, 326, 124, 26);\n\t\tpanel.add(btnSelect);\n\t\t\n\t\tJButton btnNext = new JButton(\">>\");\n\t\tbtnNext.addMouseListener(new MouseAdapter() {\n\t\t\t@Override\n\t\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\t\t//String name,father,dob,email,photo;\n\t\t\t\t\n\t\t\t\tboolean f=false;\n\t\t\t\t\n\t\t\t\tdo{\n\t\t\t\t\tnewUser.nameFirst=txtName1.getText();\n\t\t\t\t\tnewUser.nameLast=txtName2.getText();\n\t\t\t\t\n\t\t\t\t\tnewUser.father=txtFather.getText();\n\t\t\t\t\tnewUser.dob=txtDate.getText();\n\t\t\t\t\tnewUser.email=txtEmail.getText();\n\t\t\t\t\tnewUser.picLoc=file.getPath();//.getAbsolutePath();\n\t\t\t\t\t\n\t\t\t\t\tif(rdbtnFemale.isSelected()){\n\t\t\t\t\t\tnewUser.sex='f';\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif(rdbtnMale.isSelected()){\n\t\t\t\t\t\tnewUser.sex='m';\n\t\t\t\t\t}\n\t\t\t\t\tif(newUser.nameFirst.length()!=0&&newUser.father.length()!=0&&newUser.dob.length()!=0&&newUser.email.length()!=0&&newUser.picLoc.length()!=0&&newUser.sex!=0){\n\t\t\t\t\t\tf=true;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tJOptionPane.showMessageDialog(null, \"enter every details!!!\");\n\t\t\t\t\t}\n\t\t\t\t}while(!f);\n\t\t\t\t/*try {\n\t\t\t\t\tf=newUser.l1Tableinsert();\n\t\t\t\t} catch (SQLException e1) {\n\t\t\t\t\tJOptionPane.showMessageDialog(null, \"database connection error !!!\\t\"+e1);\n\t\t\t\t}\n\t\t\t\tif(!f)\n\t\t\t\t\tJOptionPane.showMessageDialog(null, \"database connection error !!!\\t\");\n\t\t\t\t*/\n\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tEventQueue.invokeLater(new Runnable() {\n\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tSignL2Panel window = new SignL2Panel(newUser);\n\t\t\t\t\t\t\twindow.frmSignUp2.setVisible(true);\n\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tfrmSignUp.dispose();\n\t\t\t\t\n\t\t\t}\n\n\t\t\t\n\t\t});\n\t\tbtnNext.setBounds(433, 406, 98, 26);\n\t\tpanel.add(btnNext);\n\t\t\n\t\ttxtPhoto = new JTextField();\n\t\ttxtPhoto.setBounds(158, 329, 204, 20);\n\t\tpanel.add(txtPhoto);\n\t\ttxtPhoto.setColumns(10);\n\t\t\n\t\ttxtName2 = new JTextField();\n\t\ttxtName2.setBounds(333, 64, 158, 20);\n\t\tpanel.add(txtName2);\n\t\ttxtName2.setColumns(10);\n\t\t\n\t\t\n\t//\tpanel.setFocusTraversalPolicy(new FocusTraversalOnArray(new Component[]{textField, datePicker, lblName, lblDob, lblFatherName, lblEmail, lblSex, lblPicture, rdbtnMale, rdbtnFemale}));\n\t\t//allfield[0].setColumns(10);\n\t\t\n\t}", "public abstract void addSelectorForm();", "public UserForm(){ }", "@Override\n\tpublic void createControl(Composite parent) {\n\t\tComposite container = new Composite(parent, SWT.NULL);\n\n\t\tsetControl(container);\n\n\t\tString username = \"\";\n\t\tString password = \"\";\n\t\ttry {\n\t\t\tString[] array = window.ds.getURI().getUserInfo().split(\":\");\n\t\t\tusername = array[0];\n\t\t\tpassword = array[1];\n\t\t} catch (Exception e) {\n\t\t}\n\n\t\tLabel lblUsername = new Label(container, SWT.NONE);\n\t\tlblUsername.setBounds(10, 52, 75, 13);\n\t\tlblUsername.setText(\"Username\");\n\n\t\tusernameText = new Text(container, SWT.BORDER);\n\t\tusernameText.setText(username);\n\t\tusernameText.addModifyListener(new ModifyListener() {\n\t\t\t@Override\n\t\t\tpublic void modifyText(ModifyEvent arg0) {\n\t\t\t\tgetWizard().getContainer().updateButtons();\n\t\t\t}\n\t\t});\n\n\t\tusernameText.setBounds(10, 71, 187, 19);\n\t\tusernameText.setFocus();\n\n\t\tLabel lblPassword = new Label(container, SWT.NONE);\n\t\tlblPassword.setBounds(10, 96, 75, 13);\n\t\tlblPassword.setText(\"Password\");\n\n\t\tpasswordText = new Text(container, SWT.BORDER | SWT.PASSWORD);\n\t\tpasswordText.setText(password);\n\t\tpasswordText.addModifyListener(new ModifyListener() {\n\t\t\t@Override\n\t\t\tpublic void modifyText(ModifyEvent arg0) {\n\t\t\t\tgetWizard().getContainer().updateButtons();\n\t\t\t}\n\t\t});\n\n\t\tpasswordText.setBounds(10, 115, 187, 19);\n\t\tControl[] list = null;\n\t\t\n\t\tif (window.ds.usesComponent(IUserCreation.class)) {\n\t\t\tbtnCreateAnNew = new Button(container, SWT.NONE);\n\t\t\tbtnCreateAnNew.addSelectionListener(new SelectionAdapter() {\n\t\t\t\t@Override\n\t\t\t\tpublic void widgetSelected(SelectionEvent e) {\n\t\t\t\t\tLOG.info(\"Create an account\");\n\t\t\t\t\tSignInWithAuthenticationWizard wizard = (SignInWithAuthenticationWizard) getWizard();\n\t\t\t\t\twizard.getWizardDialog().close();\n\t\t\t\t\twindow.newUserAction.run();\n\t\t\t\t\tLOG.info(\"Create an account 2\");\n\t\t\t\t}\n\t\t\t});\n\t\t\tbtnCreateAnNew.setBounds(10, 10, 152, 25);\n\t\t\tbtnCreateAnNew.setText(\"Create a new account\");\n\t\t\tlist = new Control[] { btnCreateAnNew, usernameText,\n\t\t\t\t\tpasswordText };\n\t\t\tcontainer.setTabList(list);\n\t\t} else {\n\t\t\tlist = new Control[] { usernameText,\n\t\t\t\t\tpasswordText };\n\t\t\tcontainer.setTabList(list);\n\t\t}\n\n\t\t\n\t\t\n\t}", "private void buildUserInterface() {\n\t\t// Create layout manager\n\t\tGridLayout layout = new GridLayout();\n\t\tlayout.numColumns = 2;\n\t\tlayout.horizontalSpacing = 6;\n\t\tlayout.verticalSpacing = 6;\n\t\t\n\t\t// Layout data for the text input fields\n\t\tGridData gridData = new GridData();\n\t\tgridData.horizontalAlignment = SWT.FILL;\n\t\tgridData.grabExcessHorizontalSpace = true;\n\n\t\t// Create composite\n\t\tComposite login = new Composite(shell, SWT.NONE);\n\t\tlogin.setLayout(layout);\n\n\t\t// Add name label\n\t\tLabel nameLabel = new Label(login, SWT.NONE);\n\t\tnameLabel.setText(\"Dein Name: \");\n\n\t\t// Add name input\n\t\tname = new Text(login, SWT.SINGLE | SWT.BORDER);\n\t\tname.setText(\"test \" + (int)(Math.random() * 30));\n\t\tname.selectAll();\n\t\tname.setLayoutData(gridData);\n\n\t\t// Add server label\n\t\tLabel serverLabel = new Label(login, SWT.NONE);\n\t\tserverLabel.setText(\"Server: \");\n\n\t\t// Add server input\n\t\tserver = new Text(login, SWT.SINGLE | SWT.BORDER);\n\t\tserver.setText(\"localhost\");\n\t\tserver.setLayoutData(gridData);\n\n\t\t// Add \"join game\" button\n\t\tjoinGame = new Button(login, SWT.PUSH);\n\t\tjoinGame.setText(\"Spiel beitreten\");\n\t\tshell.setDefaultButton(joinGame);\n\n\t\t// Add \"load game\" button\n\t\tloadGame = new Button(login, SWT.PUSH);\n\t\tloadGame.setText(\"Spiel laden\");\n\n\t\tlogin.setBounds(0, 0, 250, 250);\n\n\t\t// Create composite\n\t\tComposite about = new Composite(shell, SWT.NONE);\n\t\tabout.setLayout(layout);\n\n\t\t// Add about text\n\t\tLabel aboutlabel = new Label(about, SWT.NONE);\n\t\taboutlabel.setText(AppClient.name + \"\\n\" + \"Hochschule Bremen 2011\\n\"\n\t\t\t\t+ \"Hendrik Druse, Jannes Meyer, Timur Teker\");\n\n\t\tabout.setBounds(0, 300, 250, 50);\n\t}", "public interface IGUIFactory {\n Component label(String text);\n Component labelEmpty();\n Component fieldReadOnly(int length, String text);\n Component fieldEditable(int length, String text);\n Component fieldCalc(int length, String text, boolean readonly);\n Component button(String text);\n Component button(String text, ActionListener listener);\n Component button(ImageIcon image, ActionListener listener);\n Component password();\n Container panelEmpty();\n Container panel(LayoutManager manager);\n Container panelBordered();\n TablePanel tablePanel(IGUIEditor parent, Table table);\n TablePanel tablePanel(IGUIEditor parent, TableModel tableModel);\n Table table(TableModel tableModel);\n Component comboBoxFilled(Collection priorities);\n Component checkBox(String text);\n Component checkBox(String text, boolean flag);\n LayoutManager boxLayout(Container comp, int direction);\n LayoutManager gridLayout(int rows, int cols);\n Dimension size(int width, int height);\n JTabbedPane tabbedPane();\n JMenuItem menuItem(String text, Icon icon);\n JMenu menu(String text);\n JMenuBar menuBar();\n WindowEvent windowEvent(Window source, int id);\n}", "@Override\n\tpublic void onFormCreate(AbstractForm arg0, DataMsgBus arg1) {\n\t}", "public NewUser() {\n initComponents();\n }", "public UserInterface() {\n \t setTitle(\"The Cancer Specialist - Diagnostic Application\");\n initComponents();\n }", "public interface UIFormMenuBuilderInterface {\r\n\r\n\t/**\r\n\t * Return a new UIMenu object.\r\n\t * \r\n\t * @param heading String\r\n\t * @return UIMenu UIMenu\r\n\t */\r\n\t//UIFormMenu toUIMenu(String heading);\r\n\t\r\n\t/**\r\n\t * Return a new UIForm object.\r\n\t * \r\n\t * @param heading String\r\n\t * @return UIForm UIForm\r\n\t */\r\n\tUIFormMenu toUIFormMenu(String heading);\r\n\t\r\n\t/**\r\n\t * Add prompt to UIMenu\r\n\t * \r\n\t * @param prompt Prompt\r\n\t * @param action Action to be taken\r\n\t */\r\n\tvoid add(String prompt, UIMenuAction action);\r\n\t\r\n\t/**\r\n\t * Add prompt to UIForm\r\n\t * \r\n\t * @param prompt Prompt\r\n\t * @param test Test for form\r\n\t */\r\n\tvoid add(String prompt, UIFormTest test);\r\n\t\r\n}", "void createGebruikersBeheerPanel() {\n frame.add(gebruikersBeheerView.createGebruikersBeheerPanel());\n frame.setTitle(gebruikersBeheerModel.getTitle());\n }", "@Override\r\n\t\tpublic void onClick(ClickEvent event) {\n\t\t\tRootPanel.get(\"details\").clear();\r\n\t\t\tuf = new UserForm(AktuellerAnwender.getAnwender());\r\n\t\t\tRootPanel.get(\"details\").add(uf);\r\n\t\t}", "protected void createContents() {\n\t\tregister Register = new register();\n\t\tRegisterDAOImpl RDI = new RegisterDAOImpl();\t\n\t\t\n\t\tload = new Shell();\n\t\tload.setSize(519, 370);\n\t\tload.setText(\"XX\\u533B\\u9662\\u6302\\u53F7\\u7CFB\\u7EDF\");\n\t\tload.setLayout(new FormLayout());\n\t\t\n\t\tLabel name = new Label(load, SWT.NONE);\n\t\tFormData fd_name = new FormData();\n\t\tfd_name.top = new FormAttachment(20);\n\t\tfd_name.left = new FormAttachment(45, -10);\n\t\tname.setLayoutData(fd_name);\n\t\tname.setFont(SWTResourceManager.getFont(\"微软雅黑\", 12, SWT.NORMAL));\n\t\tname.setText(\"\\u59D3\\u540D\");\n\t\t\n\t\tLabel subjet = new Label(load, SWT.NONE);\n\t\tFormData fd_subjet = new FormData();\n\t\tfd_subjet.left = new FormAttachment(44);\n\t\tfd_subjet.top = new FormAttachment(50);\n\t\tsubjet.setLayoutData(fd_subjet);\n\t\tsubjet.setFont(SWTResourceManager.getFont(\"微软雅黑\", 12, SWT.NORMAL));\n\t\tsubjet.setText(\"\\u79D1\\u5BA4\");\n\t\t\n\t\tLabel doctor = new Label(load, SWT.NONE);\n\t\tFormData fd_doctor = new FormData();\n\t\tfd_doctor.top = new FormAttachment(60);\n\t\tfd_doctor.left = new FormAttachment(45, -10);\n\t\tdoctor.setLayoutData(fd_doctor);\n\t\tdoctor.setFont(SWTResourceManager.getFont(\"微软雅黑\", 12, SWT.NORMAL));\n\t\tdoctor.setText(\"\\u533B\\u751F\");\n\t\t\n\t\tnametext = new Text(load, SWT.BORDER);\n\t\tnametext.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));\n\t\tnametext.setFont(SWTResourceManager.getFont(\"微软雅黑\", 12, SWT.NORMAL));\n\t\tFormData fd_nametext = new FormData();\n\t\tfd_nametext.right = new FormAttachment(50, 94);\n\t\tfd_nametext.top = new FormAttachment(20);\n\t\tfd_nametext.left = new FormAttachment(50);\n\t\tnametext.setLayoutData(fd_nametext);\n\t\t\n\t\tLabel titlelabel = new Label(load, SWT.NONE);\n\t\tFormData fd_titlelabel = new FormData();\n\t\tfd_titlelabel.right = new FormAttachment(43, 176);\n\t\tfd_titlelabel.top = new FormAttachment(10);\n\t\tfd_titlelabel.left = new FormAttachment(43);\n\t\ttitlelabel.setLayoutData(fd_titlelabel);\n\t\ttitlelabel.setFont(SWTResourceManager.getFont(\"楷体\", 18, SWT.BOLD));\n\t\ttitlelabel.setText(\"XX\\u533B\\u9662\\u95E8\\u8BCA\\u6302\\u53F7\");\n\t\t\n\t\tLabel label = new Label(load, SWT.NONE);\n\t\tFormData fd_label = new FormData();\n\t\tfd_label.top = new FormAttachment(40);\n\t\tfd_label.left = new FormAttachment(44, -10);\n\t\tlabel.setLayoutData(fd_label);\n\t\tlabel.setFont(SWTResourceManager.getFont(\"微软雅黑\", 12, SWT.NORMAL));\n\t\tlabel.setText(\"\\u6302\\u53F7\\u8D39\");\n\t\t\n\t\tcosttext = new Text(load, SWT.BORDER);\n\t\tcosttext.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));\n\t\tcosttext.setFont(SWTResourceManager.getFont(\"微软雅黑\", 12, SWT.NORMAL));\n\t\tFormData fd_costtext = new FormData();\n\t\tfd_costtext.right = new FormAttachment(nametext, 0, SWT.RIGHT);\n\t\tfd_costtext.top = new FormAttachment(40);\n\t\tfd_costtext.left = new FormAttachment(50);\n\t\tcosttext.setLayoutData(fd_costtext);\n\t\t\n\t\tLabel type = new Label(load, SWT.NONE);\n\t\tFormData fd_type = new FormData();\n\t\tfd_type.top = new FormAttachment(30);\n\t\tfd_type.left = new FormAttachment(45, -10);\n\t\ttype.setLayoutData(fd_type);\n\t\ttype.setFont(SWTResourceManager.getFont(\"微软雅黑\", 12, SWT.NORMAL));\n\t\ttype.setText(\"\\u7C7B\\u578B\");\n\t\t\n\t\tCombo typecombo = new Combo(load, SWT.NONE);\n\t\ttypecombo.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));\n\t\ttypecombo.setFont(SWTResourceManager.getFont(\"微软雅黑\", 12, SWT.NORMAL));\n\t\tFormData fd_typecombo = new FormData();\n\t\tfd_typecombo.right = new FormAttachment(nametext, 0, SWT.RIGHT);\n\t\tfd_typecombo.top = new FormAttachment(30);\n\t\tfd_typecombo.left = new FormAttachment(50);\n\t\ttypecombo.setLayoutData(fd_typecombo);\n\t\ttypecombo.setText(\"\\u95E8\\u8BCA\\u7C7B\\u578B\");\n\t\ttypecombo.add(\"普通门诊\",0);\n\t\ttypecombo.add(\"专家门诊\",1);\n\t\tMySelectionListener3 ms3 = new MySelectionListener3(typecombo,costtext);\n\t\ttypecombo.addSelectionListener(ms3);\n\t\t\n\t\tCombo doctorcombo = new Combo(load, SWT.NONE);\n\t\tdoctorcombo.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));\n\t\tdoctorcombo.setFont(SWTResourceManager.getFont(\"微软雅黑\", 12, SWT.NORMAL));\n\t\tFormData fd_doctorcombo = new FormData();\n\t\tfd_doctorcombo.right = new FormAttachment(nametext, 0, SWT.RIGHT);\n\t\tfd_doctorcombo.top = new FormAttachment(60);\n\t\tfd_doctorcombo.left = new FormAttachment(50);\n\t\tdoctorcombo.setLayoutData(fd_doctorcombo);\n\t\tdoctorcombo.setText(\"\\u9009\\u62E9\\u533B\\u751F\");\n\t\t\n\t\tCombo subject = new Combo(load, SWT.NONE);\n\t\tsubject.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));\n\t\tsubject.setFont(SWTResourceManager.getFont(\"微软雅黑\", 12, SWT.NORMAL));\n\t\tfd_subjet.right = new FormAttachment(subject, -6);\n\t\tfd_subjet.top = new FormAttachment(subject, -1, SWT.TOP);\n\t\tFormData fd_subject = new FormData();\n\t\tfd_subject.right = new FormAttachment(nametext, 0, SWT.RIGHT);\n\t\tfd_subject.top = new FormAttachment(50);\n\t\tfd_subject.left = new FormAttachment(50);\n\t\tsubject.setLayoutData(fd_subject);\n\t\tsubject.setText(\"\\u79D1\\u5BA4\\uFF1F\");\n\t\tsubject.add(\"神经内科\", 0);\n\t\tsubject.add(\"呼吸科\", 1);\n\t\tsubject.add(\"泌尿科\", 2);\n\t\tsubject.add(\"放射科\", 3);\n\t\tsubject.add(\"五官\", 4);\n\t\tMySelectionListener myselection = new MySelectionListener(i,subject,doctorcombo,pdtabledaoimpl);\n\t\tsubject.addSelectionListener(myselection);\n\t\t\n\t\tMySelectionListener2 ms2 = new MySelectionListener2(subject,doctorcombo,Register,nametext,RDI);\n\t\tdoctorcombo.addSelectionListener(ms2);\n\t\t\n\t\tButton surebutton = new Button(load, SWT.NONE);\n\t\tFormData fd_surebutton = new FormData();\n\t\tfd_surebutton.top = new FormAttachment(70);\n\t\tfd_surebutton.left = new FormAttachment(44);\n\t\tsurebutton.setLayoutData(fd_surebutton);\n\t\tsurebutton.setFont(SWTResourceManager.getFont(\"楷体\", 12, SWT.BOLD));\n\t\tsurebutton.setText(\"\\u786E\\u5B9A\");\n\t\tsurebutton.addSelectionListener(new SelectionAdapter() {\n\t\t\tpublic void widgetSelected(SelectionEvent e) {\n \t Register register = new Register();\n\t\t\t\tPatientDAOImpl patientdaoimpl = new PatientDAOImpl();\n\n/*\t\t\t\tregisterdaoimpl.Save(Register);*/\n\t\t\t\tPatientInfo patientinfo = null;\n\t\t\t\tpatientinfo = patientdaoimpl.findByname(nametext.getText());\n\t\t\t\tif(patientinfo.getId() > 0 ){\n\t\t\t\t\tMessageBox messagebox = new MessageBox(load);\n\t\t\t\t\tmessagebox.setMessage(\"挂号成功!\");\n\t\t\t\t\tmessagebox.open();\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tMessageBox messagebox = new MessageBox(load);\n\t\t\t\t\tmessagebox.setMessage(\"此用户不存在,请先注册\");\n\t\t\t\t\tmessagebox.open();\n\t\t\t\t\tload.dispose();\n\t\t\t\t\tregister.open();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t\tButton registerbutton = new Button(load, SWT.NONE);\n\t\tFormData fd_registerbutton = new FormData();\n\t\tfd_registerbutton.top = new FormAttachment(70);\n\t\tfd_registerbutton.left = new FormAttachment(53);\n\t\tregisterbutton.setLayoutData(fd_registerbutton);\n\t\tregisterbutton.setFont(SWTResourceManager.getFont(\"楷体\", 12, SWT.BOLD));\n\t\tregisterbutton.setText(\"\\u6CE8\\u518C\");\n\t\tregisterbutton.addSelectionListener(new SelectionAdapter() {\n\t\t\tpublic void widgetSelected(SelectionEvent e) {\t\n\t\t\t\tRegister register = new Register();\n\t\t\t\tload.close();\n\t\t\t\tregister.open();\n\t\t\t}\n\t\t});\n\t}", "public SetupScreen() \r\n { \r\n _userLabel = new LabelField(Ipoki._resources.getString(LBL_USER), DrawStyle.ELLIPSIS);\r\n add(_userLabel);\r\n _userEdit = new EditField(\"\", Ipoki._user, 20, Field.EDITABLE);\r\n add(_userEdit);\r\n _passLabel = new LabelField(Ipoki._resources.getString(LBL_PASSWORD), DrawStyle.ELLIPSIS);\r\n add(_passLabel);\r\n _passEdit = new PasswordEditField(\"\", Ipoki._pass, 20, Field.EDITABLE);\r\n add(_passEdit);\r\n _freqLabel = new LabelField(Ipoki._resources.getString(LBL_FREQ), DrawStyle.ELLIPSIS);\r\n add(_freqLabel);\r\n _freqEdit = new EditField(\"\", String.valueOf(Ipoki._freq), 20, Field.EDITABLE | EditField.FILTER_INTEGER);\r\n add(_freqEdit);\r\n }", "private void initUI() {\n\t\tPanel p = new Panel();\n\t\tp.setLayout(new BorderLayout());\n\t\t\n\t\tPanel flowLayoutPanel = new Panel();\n\t\tflowLayoutPanel.setLayout(new FlowLayout());\n\t\t\n\t\ttextArea = new JTextArea();\n\t\t\n\t\tMyCloseButton exitButton = new MyCloseButton(\"Exit\");\n\t\t/*\n\t\texit.addActionListener(new ActionListener(){\n\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\t\t\t\n\t\t});\n\t\t*/\n\t\tMyOpenButton saveButton = new MyOpenButton(\"Open\");\n\t\t/*\n\t\tsaveButton.addActionListener(new ActionListener(){\n\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\n\t\t});\n\t\t*/\n\t\tMySaveButton mySaveButton =new MySaveButton(\"Save\");\n\t\t//setVisible(mb);\n\t\tp.add(flowLayoutPanel, BorderLayout.SOUTH);\n\t\tflowLayoutPanel.add(exitButton);\n\t\tflowLayoutPanel.add(saveButton);\n\t\tflowLayoutPanel.add(mySaveButton);\n\t\tp.add(textArea, BorderLayout.CENTER); \n\t\tadd(p);\n\t\t\n\t\tcreateMenu();\n\t\t\n\t\tsetTitle(\"Text Editor\");\n\t\tsetSize(600, 600);\n\t\tsetLocationRelativeTo(null);\n\t\tsetDefaultCloseOperation(EXIT_ON_CLOSE);\n\t\t\n\t}", "public TrainModelGUI CreateNewGUI() {\n //Create a GUI object\n \ttrainModelGUI = new TrainModelGUI(this);\n \tsetValuesForDisplay();\n \treturn trainModelGUI;\n }", "public frm_tutor_subida_prueba() {\n }", "public CreateAccount_GUI() {\n initComponents();\n }", "public void createChooseGameUI()\n {\n \tHashMap<InventoryRunnable, InventoryItem> inventoryStuff = new HashMap<InventoryRunnable, InventoryItem>();\n \t\n \tInventoryRunnable gladiatorJoinRunnable = new GladiatorJoinInventoryRunnable(plugin);\n \t\n \tArrayList<String> gladiatorLore = new ArrayList<String>();\n \tgladiatorLore.add(\"FIGHT TO THE DEATH AND WIN YOUR FREEDOM\");\n \tgladiatorLore.add(\"GOOD LUCK WARRIOR!\");\n \tInventoryItem gladiatorItem = new InventoryItem(plugin, Material.SHIELD, \"GLADIATOR\", gladiatorLore, 1, true, 1);\n \tinventoryStuff.put(gladiatorJoinRunnable, gladiatorItem);\n \t\n \tchooseGameUI = new GUIInventory(plugin, \"MINIGAMES\", inventoryStuff, 3);\n }", "private JFrame createFrame() {\n\t\tJFrame frmProfessorgui = new JFrame();\n\t\tfrmProfessorgui.getContentPane().setBackground(new Color(153, 204, 204));\n\t\tfrmProfessorgui.getContentPane().setForeground(SystemColor.desktop);\n\t\tfrmProfessorgui.setTitle(\"ProfessorGUI\");\n\t\tfrmProfessorgui.setBounds(100, 100, 600, 475);\n\t\tfrmProfessorgui.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);\n\t\tfrmProfessorgui.getContentPane().setLayout(null);\n\n\n\t\t//List, ScrollPane and Button Components\n\t\tmodel = new DefaultListModel();\n\t\tsetList();\n\t\tlist = new JList(model);\n\t\tlist.setBackground(new Color(255, 245, 238));\n\t\tJScrollPane scrollPane = new JScrollPane(list, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\n\t\tscrollPane.setBounds(10, 46, 293, 365);\n\t\tfrmProfessorgui.getContentPane().add(scrollPane);\n\n\t\tlist.setFont(new Font(\"Dialog\", Font.PLAIN, 13));\n\t\tlist.setBorder(new LineBorder(new Color(128, 128, 128), 2, true));\n\n\t\tcourse = new JButton(\"View Course\");\n\t\tcourse.setFont(new Font(\"Dialog\", Font.PLAIN, 13));\n\t\tcourse.addActionListener(new profMainListener());\n\n\t\tcourse.setBounds(390, 207, 126, 22);\n\t\tfrmProfessorgui.getContentPane().add(course);\n\n\t\tcreate = new JButton(\"Create Course\");\n\t\tcreate.setFont(new Font(\"Dialog\", Font.PLAIN, 13));\n\t\tcreate.setBounds(390, 250, 126, 22);\n\t\tfrmProfessorgui.getContentPane().add(create);\n\t\tcreate.addActionListener(new profMainListener());\n\n\t\tactivate = new JButton(\"Activate\");\n\t\tactivate.addActionListener(new profMainListener()); \n\t\tactivate.setFont(new Font(\"Dialog\", Font.PLAIN, 13));\n\t\tactivate.setBounds(390, 296, 126, 22);\n\t\tfrmProfessorgui.getContentPane().add(activate);\n\n\t\tdeactivate = new JButton(\"Deactivate\");\n\t\tdeactivate.addActionListener(new profMainListener());\n\n\t\tdeactivate.setFont(new Font(\"Dialog\", Font.PLAIN, 13));\n\t\tdeactivate.setBounds(390, 340, 126, 22);\n\t\tfrmProfessorgui.getContentPane().add(deactivate);\n\n\n\t\t//Aesthetic Pieces\n\t\tJLabel lblCourseList = new JLabel(\"Course List\");\n\t\tlblCourseList.setHorizontalAlignment(SwingConstants.CENTER);\n\t\tlblCourseList.setFont(new Font(\"Dialog\", Font.BOLD, 16));\n\t\tlblCourseList.setBounds(21, 11, 261, 24);\n\t\tfrmProfessorgui.getContentPane().add(lblCourseList);\n\n\t\tJLabel lblWelcome = new JLabel(\"Welcome\");\n\t\tlblWelcome.setHorizontalAlignment(SwingConstants.CENTER);\n\t\tlblWelcome.setFont(new Font(\"Dialog\", Font.BOLD, 16));\n\t\tlblWelcome.setBounds(357, 49, 191, 46);\n\t\tfrmProfessorgui.getContentPane().add(lblWelcome);\n\n\t\tJLabel lblNewLabel = new JLabel(prof.getFirstName() + \" \" + prof.getLastName());\n\t\tlblNewLabel.setFont(new Font(\"Dialog\", Font.ITALIC, 16));\n\t\tlblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);\n\t\tlblNewLabel.setBounds(335, 82, 239, 40);\n\t\tfrmProfessorgui.getContentPane().add(lblNewLabel);\n\n\t\tJPanel panel = new JPanel();\n\t\tpanel.setBorder(new LineBorder(new Color(128, 128, 128), 2, true));\n\t\tpanel.setBackground(new Color(204, 255, 255));\n\t\tpanel.setBounds(367, 178, 174, 213);\n\t\tfrmProfessorgui.getContentPane().add(panel);\n\n\t\treturn frmProfessorgui;\n\t}", "public Form(){\n\t\ttypeOfLicenseApp = new TypeOfLicencsApplication();\n\t\toccupationalTrainingList = new ArrayList<OccupationalTraining>();\n\t\taffiadavit = new Affidavit();\n\t\tapplicationForReciprocity = new ApplicationForReciprocity();\n\t\teducationBackground = new EducationBackground();\n\t\toccupationalLicenses = new OccupationalLicenses();\n\t\tofficeUseOnlyInfo = new OfficeUseOnlyInfo();\n\t}", "public CreateAccountGUI() throws Exception{\n\r\n\t\tsuper();\r\n\r\n\t\tsetTitle(\"Create an account\");\r\n\t\tsetSize(600, 400);\r\n\t\tsetBackground(Color.CYAN);\r\n\t\tsetResizable(false);\r\n\t\tsetDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);\r\n\t\tsetLocationRelativeTo(null);\r\n\r\n\t\tString[] labels = {\"Username: \", \"First Name: \", \"Surname: \",\r\n \"Mobile Number: \", \"Date Of Birth: \", \"City: \",\n \"Profile Pic (e.g. pic.png): \"};\n\t\tint input = labels.length;\n\n ArrayList<JTextField> fields = new ArrayList<JTextField>();\n\n\t\tJPanel create = new JPanel(new SpringLayout());\r\n\t\tfor (int i = 0; i < input; i++) {\r\n\t\t\tJLabel para = new JLabel(labels[i], JLabel.TRAILING);\r\n\t\t\tcreate.add(para);\r\n\t\t\tJTextField form = new JTextField(10);\n fields.add(form);\n\t\t\tpara.setLabelFor(form);\r\n\t\t\tcreate.add(form);\r\n\t\t\tsuper.add(create);\r\n\t\t}\r\n\t\tJButton fin = new JButton(\"Create\");\r\n\t\tfin.addActionListener(new ActionListener(){\r\n\t\t\tpublic void actionPerformed(ActionEvent sendMessage){\n try\n {\n String username = fields.get(0).getText();\n String firstname = fields.get(1).getText();\n String surname = fields.get(2).getText();\n String mobnum = fields.get(3).getText();\n String dob = fields.get(4).getText();\n String city = fields.get(5).getText();\n String imgpath = fields.get(6).getText();\n Account acc = new Account(username, firstname, surname,\n mobnum, dob, city, 0, null, imgpath);\n ReadWriteAccount rwa = new ReadWriteAccount(\"data.db\");\n rwa.write(acc);\n get_main().set_home(acc);\n dispose();\n }\n catch(Exception e)\n {\n System.out.println(e);\n }\n\t\t\t}\r\n\t\t});\r\n\t\tsuper.add(fin, BorderLayout.SOUTH);\r\n\t\tCreateAccountGUI.makeForm(create,\r\n\t\t\t\tinput, 2,\r\n\t\t\t\t6, 6,\r\n\t\t\t\t20, 20);\n\n setVisible(true);\n\r\n\t}", "public createNew(){\n\t\tsuper(\"Create\"); // title for the frame\n\t\t//layout as null\n\t\tgetContentPane().setLayout(null);\n\t\t//get the background image\n\t\ttry {\n\t\t\tbackground =\n\t\t\t\t\tnew ImageIcon (ImageIO.read(getClass().getResource(\"Wallpaper.jpg\")));\n\t\t}//Catch for file error\n\t\tcatch (IOException e1) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\tJOptionPane.showMessageDialog(null, \n\t\t\t\t\t\"ERROR: File(s) Not Found\\n Please Check Your File Format\\n\"\n\t\t\t\t\t\t\t+ \"and The File Name!\");\n\t\t}\n\t\t//Initialize all of the compenents \n\t\tlblBackground = new JLabel (background);\n\t\tlblTitle = new JLabel (\"Create Menu\");\n\t\tlblTitle.setFont(new Font(\"ARIAL\",Font.ITALIC, 30));\n\t\tlblName = new JLabel(\"Please Enter Your First Name.\");\n\t\tlblLastName= new JLabel (\"Please Enter Your Last Name.\");\n\t\tlblPhoneNumber = new JLabel (\"Please Enter Your Phone Number.\");\n\t\tlblAddress = new JLabel (\"Please Enter Your Address.\");\n\t\tlblMiddle = new JLabel (\"Please Enter Your Middle Name (Optional).\");\n\t\tbtnCreate = new JButton (\"Create\");\n\t\tbtnBack = new JButton (\"Back\");\n\t\t//set the font\n\t\tlblName.setFont(new Font(\"Times New Roman\",Font.BOLD, 18));\n\t\tlblLastName.setFont(new Font(\"Times New Roman\",Font.BOLD, 18));\n\t\tlblPhoneNumber.setFont(new Font(\"Times New Roman\",Font.BOLD, 18));\n\t\tlblAddress.setFont(new Font(\"Times New Roman\",Font.BOLD, 18));\n\t\tlblMiddle.setFont(new Font(\"Times New Roman\",Font.BOLD, 18));\n\n\t\t//add action listener\n\t\tbtnCreate.addActionListener(this);\n\t\tbtnBack.addActionListener(this);\n\t\t//set bounds for all the components\n\t\tbtnCreate.setBounds(393, 594, 220, 36);\n\t\ttxtMiddle.setBounds(333, 249, 342, 36);\n\t\ttxtName.setBounds(333, 158, 342, 36);\n\t\ttxtLastName.setBounds(333, 339, 342, 36);\n\t\ttxtPhoneNumber.setBounds(333, 429, 342, 36);\n\t\ttxtAddress.setBounds(333, 511, 342, 36);\n\t\tbtnBack.setBounds(6,716,64,36);\n\t\tlblTitle.setBounds(417, 0, 182, 50);\n\t\tlblMiddle.setBounds(333, 201, 342, 36);\n\t\tlblName.setBounds(387, 110, 239, 36);\n\t\tlblLastName.setBounds(387, 297, 239, 36);\n\t\tlblPhoneNumber.setBounds(369, 387, 269, 36);\n\t\tlblAddress.setBounds(393, 477, 215, 30);\n\t\tbtnBack.setBounds(6,716,64,36);\n\t\tlblTitle.setBounds(417, 0, 182, 50);\n\t\tlblBackground.setBounds(0, 0, 1000, 1000);\n\t\t//add components to frame\n\t\tgetContentPane().add(btnCreate);\n\t\tgetContentPane().add(txtMiddle);\n\t\tgetContentPane().add(txtLastName);\n\t\tgetContentPane().add(txtAddress);\n\t\tgetContentPane().add(txtPhoneNumber);\n\t\tgetContentPane().add(txtName);\n\t\tgetContentPane().add(lblMiddle);\n\t\tgetContentPane().add(lblLastName);\n\t\tgetContentPane().add(lblAddress);\n\t\tgetContentPane().add(lblPhoneNumber);\n\t\tgetContentPane().add(lblName);\n\t\tgetContentPane().add(btnBack);\n\t\tgetContentPane().add(lblTitle);\n\t\tgetContentPane().add(lblBackground);\n\t\t//set size, visible and action for close\n\t\tsetSize(1000,1000);\n\t\tsetVisible(true);\n\t\tsetDefaultCloseOperation(EXIT_ON_CLOSE);\n\n\t}", "public void iniciaGUISesion() {\n\t\ttabbed.removeTabAt(1);\n\t\ttabbed.removeTabAt(1);\n\t\ttabbed.insertTab(\"Evolución bolsa\", null, getPanelControl(), \"Control de los usuarios\", 1);\n\t\ttabbed.insertTab(\"Eventos\", null, getPanelEventos(), \"Control de los eventos\", 2);\n\t}", "public void showUserDefinedInputCreateDialog() {\r\n FXMLLoader loader = fxmlLoaderService.getLoader(getClass().getResource(FXML_USER_DEFINED_INPUT_CREATE_DIALOG));\r\n\r\n Parent page;\r\n\r\n try {\r\n page = loader.load();\r\n } catch (IOException ex) {\r\n logger.warn(\"Failed to load: \" + FXML_USER_DEFINED_INPUT_CREATE_DIALOG, ex);\r\n\r\n return;\r\n }\r\n\r\n // set the stage\r\n Stage stage = new Stage();\r\n stage.setTitle(\"Create Custom Input\");\r\n stage.initModality(Modality.APPLICATION_MODAL);\r\n stage.centerOnScreen();\r\n stage.initOwner(mainStage);\r\n\r\n Scene scene = new Scene(page);\r\n scene.getStylesheets().add(getClass().getResource(STYLESHEET_DEFAULT).toExternalForm());\r\n\r\n stage.setScene(scene);\r\n\r\n // Set the item into the controller.\r\n UserDefinedInputCreateDialogController controller = loader.getController();\r\n controller.setStage(stage);\r\n\r\n stage.showAndWait();\r\n }", "public void createUI() {\r\n\t\ttry {\r\n\t\t\tJPanel centerPanel = this.createCenterPane();\r\n\t\t\tJPanel westPanel = this.createWestPanel();\r\n\t\t\tm_XONContentPane.add(westPanel, BorderLayout.WEST);\r\n\t\t\tm_XONContentPane.add(centerPanel, BorderLayout.CENTER);\r\n\t\t\tm_XONContentPane.revalidate();\r\n\t\t} catch (Exception ex) {\r\n\t\t\tRGPTLogger.logToFile(\"Exception at createUI \", ex);\r\n\t\t}\r\n\t}", "protected abstract void createFieldEditors();", "private void createAndShowGUI (){\n\n JustawieniaPowitalne = new JUstawieniaPowitalne();\n }", "public adduser() {\n initComponents();\n }", "private void creatingElements() {\n\t\ttf1 = new JTextField(20);\n\t\ttf2 = new JTextField(20);\n\t\ttf3 = new JTextField(20);\n\t\tJButton btn = new JButton(\"Add\");\n\t\tbtn.addActionListener(control);\n\t\tbtn.setActionCommand(\"add\");\n\t\t\n\t\tJPanel panel = new JPanel();\n\t\tpanel.add(tf1);\n\t\tpanel.add(tf2);\n\t\tpanel.add(btn);\n\t\tpanel.add(tf3);\n\t\t\n\t\tthis.add(panel);\n\t\t\n\t\tthis.validate();\n\t\tthis.repaint();\t\t\n\t\t\n\t}", "public void createPersonalInfos(JFrame jFrame, ControllerAdmin controllerAdminPersonalInfos){\n JLabel jLabelAcount = new JLabel(\"Compte\");\n jLabelAcount.setBounds(20, 20, 100, 28);\n\n JLabel jLabelId = new JLabel(\"Identifiant :\");\n jLabelId.setBounds(40, 50, 300, 28);\n JTextField jTextFieldId = new JTextField(controllerAdminPersonalInfos.getUser().getId());\n jTextFieldId.setBounds(40, 80, 300, 28);\n\n JLabel jLabelLastName = new JLabel(\"Nom :\");\n jLabelLastName.setBounds(40, 110, 300, 28);\n JTextField jTextFieldLastName = new JTextField(controllerAdminPersonalInfos.getUser().getLastName());\n jTextFieldLastName.setBounds(40, 140, 300, 28);\n\n JLabel jLabelFirstName = new JLabel(\"Prenom :\");\n jLabelFirstName.setBounds(40, 170, 300, 28);\n JTextField jTextFieldFirstName = new JTextField(controllerAdminPersonalInfos.getUser().getFirstName());\n jTextFieldFirstName.setBounds(40, 200, 300, 28);\n\n JLabel jLabelEmail = new JLabel(\"Email :\");\n jLabelEmail.setBounds(40, 230, 300, 28);\n JTextField jTextFieldEmail = new JTextField(controllerAdminPersonalInfos.getUser().getEmail());\n jTextFieldEmail.setBounds(40, 260, 300, 28);\n\n JLabel jLabelPassword = new JLabel(\"Mot de passe :\");\n jLabelPassword.setBounds(40, 290, 300, 28);\n JPasswordField jPasswordFieldPassword = new JPasswordField(controllerAdminPersonalInfos.getUser().getPassword());\n jPasswordFieldPassword.setBounds(40, 320, 300, 28);\n\n JButton jButtonModifPassword = new JButton(\"Modifier le mot de passe\");\n jButtonModifPassword.setBounds(350, 320, 200, 28);\n\n //set editabilite\n jTextFieldId.setEditable(false);\n jTextFieldLastName.setEditable(false);\n jTextFieldFirstName.setEditable(false);\n jTextFieldEmail.setEditable(false);\n jPasswordFieldPassword.setEditable(false);\n\n // Ajout des element à la JFrame\n jFrame.add(jLabelAcount);\n jFrame.add(jLabelId);\n jFrame.add(jTextFieldId);\n jFrame.add(jLabelLastName);\n jFrame.add(jTextFieldLastName);\n jFrame.add(jLabelFirstName);\n jFrame.add(jTextFieldFirstName);\n jFrame.add(jLabelEmail);\n jFrame.add(jTextFieldEmail);\n jFrame.add(jLabelPassword);\n jFrame.add(jButtonModifPassword);\n jFrame.add(jPasswordFieldPassword);\n\n jButtonModifPassword.addActionListener(new ActionListener() {\n @Override\n public void actionPerformed(ActionEvent e) {\n createModifPassword(jFrame, controllerAdminPersonalInfos);\n jFrame.repaint();\n }\n });\n\n jFrame.setLayout(null);\n jFrame.setVisible(true);\n }", "private void putPanels() {\n\t\tfrmUserDesign.getContentPane().add(userDesignPanel, \"userDesign\");\n\t\tfrmUserDesign.getContentPane().add(vendasClass.getVendas(), \"Vendas\");\n\t\tfrmUserDesign.getContentPane().add(maquinaClass.getMaquinas(), \"Maquinas\");\n\t\tfrmUserDesign.getContentPane().add(funcionarioClasse.getFuncionarios(), \"Funcionarios\");\n\t\tfrmUserDesign.getContentPane().add(produtoClass.getProdutos(), \"Produtos\");\n\t\tfrmUserDesign.getContentPane().add(chart.getGrafico(), \"Grafico\");\n\t\tcl.show(frmUserDesign.getContentPane(), \"userDesign\");// mostrar o main menu\n\t}", "private static ISInspectorGui createNewInstance(ISInspectorController controller) {\n try {\n for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {\n if (\"Nimbus\".equals(info.getName())) {\n javax.swing.UIManager.setLookAndFeel(info.getClassName());\n break;\n }\n }\n } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {\n java.util.logging.Logger.getLogger(ISInspectorGui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);\n }\n //</editor-fold>\n Holder<ISInspectorGui> result = new Holder();\n try {\n /* Create and display the form */\n java.awt.EventQueue.invokeAndWait(new Runnable() {\n @Override\n public void run() {\n result.setValue(new ISInspectorGui(controller));\n result.getValue().setVisible(true);\n }\n });\n } catch (InterruptedException | InvocationTargetException ex) {\n Logger.getLogger(ISInspectorGui.class.getName()).log(Level.SEVERE, null, ex);\n }\n return result.getValue();\n }", "public User_Interface() {\n initComponents();\n }", "public void createControl(Composite parent) {\n Group group = SWTFactory.createGroup(parent, PDEUIMessages.ProfileBlock_0, 1, 1, GridData.FILL_HORIZONTAL);\n fGenerateProfileButton = SWTFactory.createCheckButton(group, PDEUIMessages.ProfileBlock_1, null, false, 1);\n fGenerateProfileButton.addSelectionListener(new SelectionAdapter() {\n\n @Override\n public void widgetSelected(SelectionEvent e) {\n fTab.updateLaunchConfigurationDialog();\n }\n });\n }", "public User_gui() {\n initComponents();\n }", "public Frame_Ajouter_Administrateur() {\n initComponents();\n }", "public void createControl(Composite parent) {\n\t\tComposite comp = new Composite(parent, SWT.NONE);\r\n\t\tsetControl(comp);\r\n\r\n\t\tLaunchUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(getControl(), ICDTLaunchHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_MAIN_TAB);\r\n\r\n\t\tGridLayout topLayout = new GridLayout();\r\n\t\ttopLayout.marginHeight = 10;\r\n\t\tcomp.setLayout(topLayout);\r\n\t\t\r\n\t\tcreateTargetCommGroup(comp, 1);\r\n\t\tcreateVerticalSpacer(comp, 1);\r\n\t\tcreateTargetInfoGroup(comp, 1);\r\n\t\t\r\n\t\tLaunchUIPlugin.setDialogShell(parent.getShell());\r\n\t}", "public void createAndShowGUI() {\n frame= new JFrame(\"TabAdmin\");\n frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n frame.setLocation(200,50);\n //Create and set up the content pane.\n \n addComponentToPane(frame.getContentPane());\n \n //Display the window.\n frame.pack();\n frame.setVisible(true);\n //create admin to operate \n \n }", "@SuppressWarnings(\"unchecked\")\n // <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents\n private void initComponents() {\n\n desktop = new javax.swing.JDesktopPane();\n jLabel1 = new javax.swing.JLabel();\n lblUsuario = new javax.swing.JLabel();\n jMenuBar1 = new javax.swing.JMenuBar();\n jMenu1 = new javax.swing.JMenu();\n jMenuItem1 = new javax.swing.JMenuItem();\n jMenu3 = new javax.swing.JMenu();\n jMenuItem6 = new javax.swing.JMenuItem();\n jMenuItem7 = new javax.swing.JMenuItem();\n jMenuItem8 = new javax.swing.JMenuItem();\n jMenuItem9 = new javax.swing.JMenuItem();\n jMenu4 = new javax.swing.JMenu();\n jMenuItem2 = new javax.swing.JMenuItem();\n\n setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);\n setTitle(\"CRUD\");\n setPreferredSize(new java.awt.Dimension(700, 321));\n addWindowListener(new java.awt.event.WindowAdapter() {\n public void windowActivated(java.awt.event.WindowEvent evt) {\n formWindowActivated(evt);\n }\n });\n\n desktop.setPreferredSize(new java.awt.Dimension(600, 345));\n\n javax.swing.GroupLayout desktopLayout = new javax.swing.GroupLayout(desktop);\n desktop.setLayout(desktopLayout);\n desktopLayout.setHorizontalGroup(\n desktopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 600, Short.MAX_VALUE)\n );\n desktopLayout.setVerticalGroup(\n desktopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 0, Short.MAX_VALUE)\n );\n\n jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource(\"/erp/telas/imagens/1891016_user_male_avatar_account_profile_icon (2).png\"))); // NOI18N\n\n lblUsuario.setFont(new java.awt.Font(\"Tahoma\", 1, 12)); // NOI18N\n lblUsuario.setText(\"USUARIO\");\n\n jMenu1.setIcon(new javax.swing.ImageIcon(getClass().getResource(\"/images/page.png\"))); // NOI18N\n jMenu1.setText(\"Arquivo\");\n\n jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource(\"/images/door_out.png\"))); // NOI18N\n jMenuItem1.setText(\"Sair\");\n jMenuItem1.addActionListener(new java.awt.event.ActionListener() {\n public void actionPerformed(java.awt.event.ActionEvent evt) {\n jMenuItem1ActionPerformed(evt);\n }\n });\n jMenu1.add(jMenuItem1);\n\n jMenuBar1.add(jMenu1);\n\n jMenu3.setIcon(new javax.swing.ImageIcon(getClass().getResource(\"/images/group.png\"))); // NOI18N\n jMenu3.setText(\"Clientes\");\n jMenu3.addActionListener(new java.awt.event.ActionListener() {\n public void actionPerformed(java.awt.event.ActionEvent evt) {\n jMenu3ActionPerformed(evt);\n }\n });\n\n jMenuItem6.setIcon(new javax.swing.ImageIcon(getClass().getResource(\"/images/group_add.png\"))); // NOI18N\n jMenuItem6.setText(\"Cadastrar\");\n jMenuItem6.addActionListener(new java.awt.event.ActionListener() {\n public void actionPerformed(java.awt.event.ActionEvent evt) {\n jMenuItem6ActionPerformed(evt);\n }\n });\n jMenu3.add(jMenuItem6);\n\n jMenuItem7.setIcon(new javax.swing.ImageIcon(getClass().getResource(\"/images/group.png\"))); // NOI18N\n jMenuItem7.setText(\"Alterar\");\n jMenuItem7.addActionListener(new java.awt.event.ActionListener() {\n public void actionPerformed(java.awt.event.ActionEvent evt) {\n jMenuItem7ActionPerformed(evt);\n }\n });\n jMenu3.add(jMenuItem7);\n\n jMenuItem8.setIcon(new javax.swing.ImageIcon(getClass().getResource(\"/images/group_delete.png\"))); // NOI18N\n jMenuItem8.setText(\"Excluir\");\n jMenuItem8.addActionListener(new java.awt.event.ActionListener() {\n public void actionPerformed(java.awt.event.ActionEvent evt) {\n jMenuItem8ActionPerformed(evt);\n }\n });\n jMenu3.add(jMenuItem8);\n\n jMenuItem9.setIcon(new javax.swing.ImageIcon(getClass().getResource(\"/images/zoom.png\"))); // NOI18N\n jMenuItem9.setText(\"Pesquisar\");\n jMenuItem9.addActionListener(new java.awt.event.ActionListener() {\n public void actionPerformed(java.awt.event.ActionEvent evt) {\n jMenuItem9ActionPerformed(evt);\n }\n });\n jMenu3.add(jMenuItem9);\n\n jMenuBar1.add(jMenu3);\n\n jMenu4.setIcon(new javax.swing.ImageIcon(getClass().getResource(\"/images/information.png\"))); // NOI18N\n jMenu4.setText(\"Sobre\");\n jMenu4.addActionListener(new java.awt.event.ActionListener() {\n public void actionPerformed(java.awt.event.ActionEvent evt) {\n jMenu4ActionPerformed(evt);\n }\n });\n\n jMenuItem2.setText(\"Informações\");\n jMenuItem2.addActionListener(new java.awt.event.ActionListener() {\n public void actionPerformed(java.awt.event.ActionEvent evt) {\n jMenuItem2ActionPerformed(evt);\n }\n });\n jMenu4.add(jMenuItem2);\n\n jMenuBar1.add(jMenu4);\n\n setJMenuBar(jMenuBar1);\n\n javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());\n getContentPane().setLayout(layout);\n layout.setHorizontalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGroup(layout.createSequentialGroup()\n .addComponent(desktop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)\n .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)\n .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)\n .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)\n .addComponent(lblUsuario, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))\n .addContainerGap())\n );\n layout.setVerticalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGroup(layout.createSequentialGroup()\n .addGap(27, 27, 27)\n .addComponent(lblUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)\n .addGap(18, 18, 18)\n .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)\n .addContainerGap(108, Short.MAX_VALUE))\n .addComponent(desktop, javax.swing.GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE)\n );\n\n setSize(new java.awt.Dimension(758, 406));\n setLocationRelativeTo(null);\n }", "public FormInserir() {\n initComponents();\n }", "public UIMenu() {\n initComponents();\n setLocationRelativeTo(null);\n background.requestFocusInWindow();\n createButtonMode.setVisible(false);\n loginButtonMode.setVisible(false);\n repassword.setVisible(false);\n inputRePass.setVisible(false);\n }", "private void createUserInterface()\n {\n // get content pane for attaching GUI components\n Container contentPane = getContentPane();\n\n // enable explicit positioning of GUI components \n contentPane.setLayout( null );\n\n // set up itemsSoldJLabel\n itemsSoldJLabel = new JLabel();\n itemsSoldJLabel.setBounds( 20, 20, 130, 20 );\n itemsSoldJLabel.setText( \"Number of items sold:\" );\n contentPane.add( itemsSoldJLabel );\n\n // set up itemsSoldJTextField\n itemsSoldJTextField = new JTextField();\n itemsSoldJTextField.setBounds( 170, 20, 90, 20 );\n itemsSoldJTextField.setHorizontalAlignment( JTextField.RIGHT );\n contentPane.add( itemsSoldJTextField );\n\n // set up priceJLabel\n priceJLabel = new JLabel();\n priceJLabel.setBounds( 20, 55, 130, 20 );\n priceJLabel.setText( \"Price of items:\" );\n contentPane.add( priceJLabel );\n\n // set up priceJTextField\n priceJTextField = new JTextField();\n priceJTextField.setBounds( 170, 55, 90, 20 );\n priceJTextField.setHorizontalAlignment( JTextField.RIGHT );\n contentPane.add( priceJTextField );\n\n // set up grossSalesJLabel\n grossSalesJLabel = new JLabel();\n grossSalesJLabel.setBounds( 20, 90, 80, 20 );\n grossSalesJLabel.setText( \"Gross sales:\" );\n contentPane.add( grossSalesJLabel );\n\n // set up grossSalesJTextField\n grossSalesJTextField = new JTextField();\n grossSalesJTextField.setBounds( 170, 90, 90, 20 );\n grossSalesJTextField.setEditable( false );\n grossSalesJTextField.setHorizontalAlignment( \n JTextField.RIGHT );\n contentPane.add( grossSalesJTextField );\n\n // set up commissionJLabel\n commissionJLabel = new JLabel();\n commissionJLabel.setBounds( 20, 130, 110, 20 );\n commissionJLabel.setText( \"Commission (%):\" );\n contentPane.add( commissionJLabel );\n\n // set up commissionJSpinner\n commissionJSpinner = new JSpinner( \n new SpinnerNumberModel( 1, 1, 10, 1 ) );\n commissionJSpinner.setBounds( 170, 130, 90, 20 );\n contentPane.add( commissionJSpinner );\n commissionJSpinner.addChangeListener(\n\n new ChangeListener() // anonymous inner class\n {\n // event handler called when value in \n // commissionJSpinner changes\n public void stateChanged( ChangeEvent event )\n {\n \n }\n\n } // end anonymous inner class\n\n ); // end call to addChangeListener\n \n // set up earningsJLabel\n earningsJLabel = new JLabel();\n earningsJLabel.setBounds( 20, 170, 90, 20 );\n earningsJLabel.setText( \"Earnings:\" );\n contentPane.add( earningsJLabel );\n \n // set up earningsJTextField\n earningsJTextField = new JTextField();\n earningsJTextField.setBounds( 170, 170, 90, 20 );\n earningsJTextField.setEditable( false );\n earningsJTextField.setHorizontalAlignment( JTextField.RIGHT );\n contentPane.add( earningsJTextField );\n\n // set up calculateJButton\n calculateJButton = new JButton();\n calculateJButton.setBounds( 170, 205, 90, 25 );\n calculateJButton.setText( \"Calculate\" );\n contentPane.add( calculateJButton );\n calculateJButton.addActionListener(\n\n new ActionListener() // anonymous inner class\n {\n // event handler called when calculateJButton is pressed\n public void actionPerformed( ActionEvent event )\n {\n \n }\n\n } // end anonymous inner class\n\n ); // end call to addActionListener\n\n // set properties of application's window\n setTitle( \"Sales Commission Calculator\" ); // set window title\n setSize( 285, 285 ); // set window size\n setVisible( true ); // show window\n\n }", "public frmNewArtist() {\n initComponents();\n lblID.setText(Controller.Agent.ManageController.getNewArtistID());\n lblGreeting.setText(\"Dear \"+iMuzaMusic.getLoggedUser().getFirstName()+\", please use the form below to add an artist to your ranks.\");\n \n }", "@Override\n\tprotected void initUi() {\n\t\t\n\t}", "protected void addUser(ActionEvent ae) {\n\t\tAddUsersFrm auf=new AddUsersFrm();\n\t\tauf.setVisible(true);\n\t\tdesktopPane.add(auf);\n\t}", "public final void initUI() {\n\t\tsetLayout(new BoxLayout(this, BoxLayout.X_AXIS));\n\t\tadd(new Box.Filler(minSize, prefSize, null));\n\t\t\n\t\tJPanel nameChoicePanel = new JPanel();\n\t\tnameChoicePanel.setLayout(new BoxLayout(nameChoicePanel, BoxLayout.Y_AXIS));\n\t\tnameChoicePanel.setName(\"Panel\");\n\t\t\n\t\t// Add instructions for what to do:\n\t\tinstructionLabel = new JLabel(\"Enter your name here:\", JLabel.CENTER);\n\t\tinstructionLabel.setMinimumSize(new Dimension(0, 40));\n\t\tinstructionLabel.setPreferredSize(new Dimension(instructionLabel.getPreferredSize().width, 40));\n\t\tinstructionLabel.setAlignmentX(Component.CENTER_ALIGNMENT);\n\t\tnameChoicePanel.add(instructionLabel);\n\t\t\n\t\t// Add textfield for user's name\n\t\tnameField = new JTextField(10);\n\t\tnameField.setName(\"textField\");\n\t\tnameField.getDocument().addDocumentListener(this);\n\t\tnameField.setMinimumSize(new Dimension(nameField.getWidth(), 41));\n\t\tnameField.setMaximumSize(new Dimension(250, 41));\n\t\t\n\t\tnameChoicePanel.add(nameField);\n\t\t\n\t\t// Add button\n\t\ttimeToPick = new JButton(\"Pick your team\");\n\t\ttimeToPick.setName(\"Test\");\n\t\ttimeToPick.addActionListener(nameChoiceListener);\n\t\ttimeToPick.setAlignmentX(Component.CENTER_ALIGNMENT);\n\t\t\n\t\ttimeToPick.setEnabled(false);\n\t\tnameChoicePanel.add(timeToPick);\n\t\t\n\t\t// Add name choice panel dimensions\n\t\tadd(nameChoicePanel);\n\t\tadd(new Box.Filler(minSize, prefSize, null));\n\t\tnameChoicePanel.setMinimumSize(new Dimension(400,240));\n\t\tnameChoicePanel.setPreferredSize(new Dimension(400,240));\n\t}", "protected void setupUI() {\n\n }", "public Element addForm(int screenId, int itemCount, FormProportion proportion, String title, String url) {\r\n\t\tElement form = mDocument.createElement(\"IppForm\");\r\n\t\tform.setAttribute(\"ItemCount\", String.valueOf(itemCount));\r\n\t\tform.setAttribute(\"Proportion\", proportion.getValue());\r\n\t\tmScreens.get(screenId).appendChild(form);\r\n\r\n\t\taddTextNode(form, \"Title\", title);\r\n\r\n\t\taddTextNode(form, \"Url\", url);\r\n\r\n\t\treturn form;\r\n\t}", "@Override\r\n\tprotected void initUI() {\n\r\n\t}", "protected static void create(String[] userDataInput, String billboardID, String currentName) {\n JFrame frame = new RenameBillboard(\"Billboard Client\", userDataInput, billboardID, currentName);\n frame.setVisible(true);\n }", "public interface GuiFactory {\n\n Button createButton();\n CheckBox createCheckbox();\n\n\n}", "public CreateProfile() {\n initComponents();\n }", "public FormPermisos() {\n initComponents();\n setLocationRelativeTo(null);\n setTitle(\"INTERFACE-PERMISOS\");\n }", "@SuppressWarnings(\"unchecked\")\r\n // <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents\r\n private void initComponents() {\r\n\r\n createUserJButton = new javax.swing.JButton();\r\n nameJTextField = new javax.swing.JTextField();\r\n jLabel1 = new javax.swing.JLabel();\r\n jScrollPane1 = new javax.swing.JScrollPane();\r\n userJTable = new javax.swing.JTable();\r\n jLabel2 = new javax.swing.JLabel();\r\n passwordJTextField = new javax.swing.JTextField();\r\n jLabel3 = new javax.swing.JLabel();\r\n employeeJComboBox = new javax.swing.JComboBox();\r\n backjButton1 = new javax.swing.JButton();\r\n jLabel5 = new javax.swing.JLabel();\r\n organizationJComboBox = new javax.swing.JComboBox();\r\n jLabel4 = new javax.swing.JLabel();\r\n roleJComboBox = new javax.swing.JComboBox();\r\n jLabel6 = new javax.swing.JLabel();\r\n\r\n setBackground(new java.awt.Color(102, 0, 102));\r\n setForeground(new java.awt.Color(102, 0, 102));\r\n setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());\r\n\r\n createUserJButton.setBackground(new java.awt.Color(153, 153, 153));\r\n createUserJButton.setFont(new java.awt.Font(\"Lucida Grande\", 1, 24)); // NOI18N\r\n createUserJButton.setForeground(new java.awt.Color(51, 0, 51));\r\n createUserJButton.setText(\" CREATE >>\");\r\n createUserJButton.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 255, 255), 5, true));\r\n createUserJButton.addActionListener(new java.awt.event.ActionListener() {\r\n public void actionPerformed(java.awt.event.ActionEvent evt) {\r\n createUserJButtonActionPerformed(evt);\r\n }\r\n });\r\n add(createUserJButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(470, 660, 253, 52));\r\n\r\n nameJTextField.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 4, true));\r\n add(nameJTextField, new org.netbeans.lib.awtextra.AbsoluteConstraints(527, 529, 198, -1));\r\n\r\n jLabel1.setFont(new java.awt.Font(\"Lucida Grande\", 1, 18)); // NOI18N\r\n jLabel1.setForeground(new java.awt.Color(255, 255, 255));\r\n jLabel1.setText(\" USER NAME \");\r\n jLabel1.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 255, 255), 3, true));\r\n add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(191, 525, -1, -1));\r\n\r\n userJTable.setModel(new javax.swing.table.DefaultTableModel(\r\n new Object [][] {\r\n\r\n },\r\n new String [] {\r\n \"User Name\", \"Role\"\r\n }\r\n ) {\r\n Class[] types = new Class [] {\r\n java.lang.String.class, java.lang.String.class\r\n };\r\n boolean[] canEdit = new boolean [] {\r\n true, false\r\n };\r\n\r\n public Class getColumnClass(int columnIndex) {\r\n return types [columnIndex];\r\n }\r\n\r\n public boolean isCellEditable(int rowIndex, int columnIndex) {\r\n return canEdit [columnIndex];\r\n }\r\n });\r\n jScrollPane1.setViewportView(userJTable);\r\n if (userJTable.getColumnModel().getColumnCount() > 0) {\r\n userJTable.getColumnModel().getColumn(0).setResizable(false);\r\n userJTable.getColumnModel().getColumn(1).setResizable(false);\r\n }\r\n\r\n add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(191, 150, 470, 124));\r\n\r\n jLabel2.setFont(new java.awt.Font(\"Lucida Grande\", 1, 18)); // NOI18N\r\n jLabel2.setForeground(new java.awt.Color(255, 255, 255));\r\n jLabel2.setText(\" PASSWORD \");\r\n jLabel2.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 255, 255), 3, true));\r\n add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(191, 571, -1, -1));\r\n\r\n passwordJTextField.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 4, true));\r\n add(passwordJTextField, new org.netbeans.lib.awtextra.AbsoluteConstraints(527, 575, 198, -1));\r\n\r\n jLabel3.setFont(new java.awt.Font(\"Lucida Grande\", 1, 18)); // NOI18N\r\n jLabel3.setForeground(new java.awt.Color(255, 255, 255));\r\n jLabel3.setText(\" EMPLOYEE \");\r\n jLabel3.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 255, 255), 3, true));\r\n add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(191, 383, -1, -1));\r\n\r\n employeeJComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { \"Item 1\", \"Item 2\", \"Item 3\", \"Item 4\" }));\r\n add(employeeJComboBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(527, 387, 198, -1));\r\n\r\n backjButton1.setBackground(new java.awt.Color(153, 153, 153));\r\n backjButton1.setFont(new java.awt.Font(\"Lucida Grande\", 1, 24)); // NOI18N\r\n backjButton1.setForeground(new java.awt.Color(51, 0, 51));\r\n backjButton1.setText(\" << BACK \");\r\n backjButton1.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 255, 255), 5, true));\r\n backjButton1.addActionListener(new java.awt.event.ActionListener() {\r\n public void actionPerformed(java.awt.event.ActionEvent evt) {\r\n backjButton1ActionPerformed(evt);\r\n }\r\n });\r\n add(backjButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 660, 160, 52));\r\n\r\n jLabel5.setFont(new java.awt.Font(\"Lucida Grande\", 1, 18)); // NOI18N\r\n jLabel5.setForeground(new java.awt.Color(255, 255, 255));\r\n jLabel5.setText(\" ORGANIZATION \");\r\n jLabel5.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 255, 255), 3, true));\r\n add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(191, 343, -1, -1));\r\n\r\n organizationJComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { \"Item 1\", \"Item 2\", \"Item 3\", \"Item 4\" }));\r\n organizationJComboBox.addActionListener(new java.awt.event.ActionListener() {\r\n public void actionPerformed(java.awt.event.ActionEvent evt) {\r\n organizationJComboBoxActionPerformed(evt);\r\n }\r\n });\r\n add(organizationJComboBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(527, 337, 198, -1));\r\n\r\n jLabel4.setFont(new java.awt.Font(\"Lucida Grande\", 1, 18)); // NOI18N\r\n jLabel4.setForeground(new java.awt.Color(255, 255, 255));\r\n jLabel4.setText(\" ROLE \");\r\n jLabel4.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 255, 255), 3, true));\r\n add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(191, 476, -1, -1));\r\n\r\n roleJComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { \"Item 1\", \"Item 2\", \"Item 3\", \"Item 4\" }));\r\n add(roleJComboBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(527, 480, 198, -1));\r\n\r\n jLabel6.setFont(new java.awt.Font(\"Lucida Grande\", 1, 36)); // NOI18N\r\n jLabel6.setForeground(new java.awt.Color(255, 255, 255));\r\n jLabel6.setText(\"MANAGE USER ACCOUNT\");\r\n jLabel6.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 255, 255), 4, true));\r\n add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 40, -1, -1));\r\n }", "private void initUI()\r\n\t{\r\n\t\tthis.label = new Label();\r\n\t\t\r\n\t\tthis.label.setText(\"This view is also saveable\");\r\n\t\t\r\n\t\tthis.label.setSizeUndefined();\r\n\t\tthis.add(this.label);\r\n\t\tthis.setSizeFull();\r\n\t}", "void add(String prompt, UIFormTest test);", "public Managing_Staff_Main_Form() {\n initComponents();\n }", "public void createFieldEditors()\n\t{\n\t}", "public UsuarioEditor() {\n initComponents();\n setLocationRelativeTo(null);\n// control = new PaisControlEditor();\n// control.registrarVentana(this);\n\n }", "public JfrmAdviserSignUp() {\n initComponents();\n setLocationRelativeTo(null);\n setResizable(false);\n setTitle(\"MARKETING DIGITAL\");\n setIconImage(new ImageIcon(getClass().getResource(\"/imagenes/icono.png\")).getImage());\n ((JPanel)getContentPane()).setOpaque(false);\n ImageIcon uno=new ImageIcon(this.getClass().getResource(\"/imagenes/fondo3.jpg\"));\n JLabel fondo= new JLabel();\n fondo.setIcon(uno);\n getLayeredPane().add(fondo,JLayeredPane.FRAME_CONTENT_LAYER);\n fondo.setBounds(0,0,uno.getIconWidth(),uno.getIconHeight());\n }", "private void initUI() {\n\t\tfileInputPanel.setLayout(new GridBagLayout());\n\n\t\tGridBagConstraints gridBagConstraints = new GridBagConstraints();\n\t\tgridBagConstraints.insets = new Insets(10, 5, 10, 5);\n\t\tgridBagConstraints.anchor = GridBagConstraints.NORTH;\n\t\tgridBagConstraints.gridwidth = 2;\n\n\t\tJLabel title = new JLabel(\"Welcome to ANNie\");\n\t\ttitle.setFont(new Font(\"Serif\", Font.BOLD, 36));\n\n\t\tfileInputPanel.add(title, gridBagConstraints);\n\n\t\tgridBagConstraints.gridwidth = 1;\n\t\tgridBagConstraints.insets = new Insets(10, 5, 10, 5);\n\n\t\tfileInputPanel.setBorder(BorderFactory.createLineBorder(Color.black));\n\n\t\tcreateFileDropdownArea(gridBagConstraints);\n\t\tcreateLabelSelectArea(gridBagConstraints);\n\t\tcreateButtons(gridBagConstraints);\n\t}", "private void setAddVisitDialogUI(Frame parent, Point loc) {\n dialog = new JDialog(parent);\n dialog.setLocation(loc.x + 80, loc.y + 80);\n panel = new JPanel();\n panel.setBackground(new Color(248, 248, 251));\n panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));\n panel.add(Box.createVerticalStrut(20));\n\n message = new JPanel();\n text = new JLabel(\"Add visit\");\n\n text.setFont(new Font(\"Nunito\", Font.PLAIN, 14));\n\n message.setBackground(null);\n message.add(text);\n panel.add(message);\n panel.add(Box.createVerticalStrut(20));\n }", "public NewCustomerGUI() {\n initComponents();\n }", "public interface NuevoTesauroForm\r\n{\r\n}", "@Override\n public List<UpdatableItem> createPopup() {\n final List<UpdatableItem> items = new ArrayList<UpdatableItem>();\n \n /* host wizard */\n final MyMenuItem newHostWizardItem =\n new MyMenuItem(Tools.getString(\"EmptyBrowser.NewHostWizard\"),\n HOST_ICON,\n null,\n new AccessMode(ConfigData.AccessType.RO, false),\n new AccessMode(ConfigData.AccessType.RO, false)) {\n private static final long serialVersionUID = 1L;\n \n @Override\n public String enablePredicate() {\n return null;\n }\n \n @Override\n public void action() {\n final AddHostDialog dialog = new AddHostDialog(new Host());\n dialog.showDialogs();\n }\n };\n items.add(newHostWizardItem);\n Tools.getGUIData().registerAddHostButton(newHostWizardItem);\n return items;\n }", "protected void createContents() {\n\t\tshlMenu = new Shell();\n\t\tshlMenu.setImage(SWTResourceManager.getImage(MainMenu.class, \"/ikons/File-delete-icon.png\"));\n\t\tshlMenu.setBackground(SWTResourceManager.getColor(255, 102, 0));\n\t\tshlMenu.setSize(899, 578);\n\t\tshlMenu.setText(\"MENU\");\n\t\t\n\t\tMenu menu = new Menu(shlMenu, SWT.BAR);\n\t\tshlMenu.setMenuBar(menu);\n\t\t\n\t\tMenuItem mnętmBookLists = new MenuItem(menu, SWT.NONE);\n\t\tmnętmBookLists.addSelectionListener(new SelectionAdapter() {\n\t\t\t@Override\n\t\t\tpublic void widgetSelected(SelectionEvent e) {\n\t\t\t\t//call booklist frame \n\t\t\t\tBookListFrame window = new BookListFrame();\n\t\t\t\twindow.open();\n\t\t\t\t\n\t\t\t}\n\t\t});\n\t\tmnętmBookLists.setImage(SWTResourceManager.getImage(MainMenu.class, \"/ikons/Business-Todo-List-icon.png\"));\n\t\tmnętmBookLists.setText(\"Book Lists\");\n\t\t\n\t\tMenuItem mnętmMemberList = new MenuItem(menu, SWT.NONE);\n\t\tmnętmMemberList.addSelectionListener(new SelectionAdapter() {\n\t\t\t@Override\n\t\t\tpublic void widgetSelected(SelectionEvent e) {\n\t\t\t\t//call memberlistframe\n\t\t\t\tMemberListFrame window = new MemberListFrame();\n\t\t\t\twindow.open();\n\t\t\t}\n\t\t});\n\t\tmnętmMemberList.setImage(SWTResourceManager.getImage(MainMenu.class, \"/ikons/Misc-User-icon.png\"));\n\t\tmnętmMemberList.setText(\"Member List\");\n\t\t\n\t\tMenuItem mnętmNewItem = new MenuItem(menu, SWT.NONE);\n\t\tmnętmNewItem.addSelectionListener(new SelectionAdapter() {\n\t\t\t@Override\n\t\t\tpublic void widgetSelected(SelectionEvent e) {\n\t\t\t\t//call rent list\n\t\t\t\tRentListFrame rlf=new RentListFrame();\n\t\t\t\trlf.open();\n\t\t\t}\n\t\t});\n\t\tmnętmNewItem.setImage(SWTResourceManager.getImage(MainMenu.class, \"/ikons/Time-And-Date-Calendar-icon.png\"));\n\t\tmnętmNewItem.setText(\"Rent List\");\n\t\t\n\t\tButton btnNewButton = new Button(shlMenu, SWT.NONE);\n\t\tbtnNewButton.addSelectionListener(new SelectionAdapter() {\n\t\t\t@Override\n\t\t\tpublic void widgetSelected(SelectionEvent e) {\n\t\t\t\t//call booksettingsframe\n\t\t\t\tBookSettingsFrame window = new BookSettingsFrame();\n\t\t\t\twindow.open();\n\t\t\t}\n\t\t});\n\t\tbtnNewButton.setForeground(SWTResourceManager.getColor(SWT.COLOR_INFO_BACKGROUND));\n\t\tbtnNewButton.setImage(SWTResourceManager.getImage(MainMenu.class, \"/ikons/Printing-Books-icon.png\"));\n\t\tbtnNewButton.setBounds(160, 176, 114, 112);\n\t\t\n\t\tButton btnNewButton_1 = new Button(shlMenu, SWT.NONE);\n\t\tbtnNewButton_1.addSelectionListener(new SelectionAdapter() {\n\t\t\t@Override\n\t\t\tpublic void widgetSelected(SelectionEvent e) {\n\t\t\t\t//call membersettingsframe\n\t\t\t\tMemberSettingsFrame window = new MemberSettingsFrame();\n\t\t\t\twindow.open();\n\t\t\t}\n\t\t});\n\t\tbtnNewButton_1.setForeground(SWTResourceManager.getColor(SWT.COLOR_INFO_BACKGROUND));\n\t\tbtnNewButton_1.setImage(SWTResourceManager.getImage(MainMenu.class, \"/ikons/Add-User-icon.png\"));\n\t\tbtnNewButton_1.setBounds(367, 176, 114, 112);\n\t\t\n\t\tButton btnNewButton_2 = new Button(shlMenu, SWT.NONE);\n\t\tbtnNewButton_2.addSelectionListener(new SelectionAdapter() {\n\t\t\t@Override\n\t\t\tpublic void widgetSelected(SelectionEvent e) {\n\t\t\t\tRentingFrame rf=new RentingFrame();\n\t\t\t\trf.open();\n\t\t\t}\n\t\t});\n\t\tbtnNewButton_2.setForeground(SWTResourceManager.getColor(SWT.COLOR_INFO_BACKGROUND));\n\t\tbtnNewButton_2.setImage(SWTResourceManager.getImage(MainMenu.class, \"/ikons/Business-Statistics-icon.png\"));\n\t\tbtnNewButton_2.setBounds(567, 176, 114, 112);\n\n\t}", "@Override\n\tprotected Fragment createFragment() {\n\t\treturn new FormFragment();\n\t}", "public ProfilsFIForm() {\r\n\t\tsuper();\r\n\t}", "public void showFormInstitucion(ActionEvent event) {\r\n\t\tlog.info(\"-------------------------------------Debugging showFormInstitucion-------------------------------------\");\r\n\t\tlog.info(\"blnShowFormInstitucion: \"+getBlnShowFormInstitucion());\r\n\t\tsetBlnShowFormInstitucion(true);\r\n\t\tsetOnNewDisabledInsti(true); //Deshabilita los controles por defecto cuando se desea crear un nuevo registro.\r\n\t\tsetRenderConfigN1(false);\r\n\t\tsetStrBtnAgregarN1(\"Agregar Configuración\");\r\n\t\tsetRenderProcesPlanillaN1(false);\r\n\t\tsetRenderAdministraN1(false);\r\n\t\tsetRenderCobChequesN1(false);\r\n\t\tlimpiarFormInstitucion();\r\n\t}", "private void inicialize() {\n\t\t\n\t\t/**\n\t\t * Labels e textField of the page:\n\t\t * Nome\n\t\t * Descrição\n\t\t */\n\n\t\tJLabel lblNome = new JLabel(\"Nome\");\n\t\tlblNome.setBounds(5, 48, 86, 28);\n\t\tlblNome.setFont(new Font(\"Dubai Light\", Font.PLAIN, 13));\n\t\tcontentPanel.add(lblNome);\n\t\t\n\t\tJLabel lblDescricao = new JLabel(\"Descrição\");\n\t\tlblDescricao.setBounds(5, 117, 86, 51);\n\t\tlblDescricao.setFont(new Font(\"Dubai Light\", Font.PLAIN, 13));\n\t\tcontentPanel.add(lblDescricao);\n\t\t\n\t\ttextFieldNome = new JTextField();\n\t\ttextFieldNome.setBounds(103, 45, 290, 35);\n\t\ttextFieldNome.setFont(new Font(\"Dubai Light\", Font.PLAIN, 13));\n\t\ttextFieldNome.setColumns(10);\n\t\tcontentPanel.add(textFieldNome);\n\t\t\n\t\ttextFieldDescricao = new JTextArea();\n\t\ttextFieldDescricao.setBackground(Color.WHITE);\n\t\ttextFieldDescricao.setLineWrap(true);\n\t\ttextFieldDescricao.setBounds(101, 118, 290, 193);\n\t\ttextFieldDescricao.setFont(new Font(\"Dubai Light\", Font.PLAIN, 13));\n\t\ttextFieldDescricao.setColumns(10);\n\t\tcontentPanel.add(textFieldDescricao);\n\n\t\t/**\n\t\t * Confirmation panel\n\t\t * Confirmation button\n\t\t * Cancellation button\n\t\t */\n\n\t\tpainelConfirmacaoSetup();\n\t}", "public static Result newForm() {\n return ok(newForm.render(palletForm, setOfArticleForm));\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void createUIComponents() {\n }", "private void initUI() {\r\n\t\t//Äußeres Panel\r\n\t\tContainer pane = getContentPane();\r\n\t\tGroupLayout gl = new GroupLayout(pane);\r\n\t\tpane.setLayout(gl);\r\n\t\t//Abstende von den Containern und dem äußeren Rand\r\n\t\tgl.setAutoCreateContainerGaps(true);\r\n\t\tgl.setAutoCreateGaps(true);\r\n\t\t//TextFeld für die Ausgabe\r\n\t\tJTextField output = view.getTextField();\r\n\t\t//Die jeweiligen Panels für die jeweiigen Buttons\r\n\t\tJPanel brackets = view.getBracketPanel();\r\n\t\tJPanel remove = view.getTop2Panel();\r\n\t\tJPanel numbers = view.getNumbersPanel();\r\n\t\tJPanel last = view.getBottomPanel();\r\n\t\t//Anordnung der jeweiligen Panels durch den Layout Manager\r\n\t\tgl.setHorizontalGroup(gl.createParallelGroup().addComponent(output).addComponent(brackets).addComponent(remove).addComponent(numbers).addComponent(last));\r\n\t\tgl.setVerticalGroup(gl.createSequentialGroup().addComponent(output).addComponent(brackets).addComponent(remove).addComponent(numbers).addComponent(last));\r\n\t\tpack();\r\n\t\tsetTitle(\"Basic - Taschenrechner\");\r\n\t\tsetDefaultCloseOperation(EXIT_ON_CLOSE);\r\n\t\tsetResizable(false);\r\n\t}", "private void createUI() {\n\t\tthis.rootPane = new TetrisRootPane(true);\n\t\tthis.controller = new TetrisController(this, rootPane, getWorkingDirectory());\n\t\tthis.listener = new TetrisActionListener(controller, this, rootPane);\n\t\t\n\t\trootPane.setActionListener(listener);\n\t\trootPane.setGameComponents(controller.getGameComponent(), controller.getPreviewComponent());\n\t\trootPane.initialize();\n\t\t\n\t\tPanelBorder border = controller.getPlayer().getPanel().getPanelBorder(\"Tetris v\" + controller.getVersion());\n\t\tborder.setRoundedCorners(true);\n\t\tJPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));\n\t\tpanel.setBackground(getBackgroundColor(border.getLineColor()));\n\t\tpanel.setBorder(border);\n\t\tpanel.setPreferredSize(new Dimension(564, 551));\n\t\tpanel.add(rootPane);\n\t\trootPane.addPanelBorder(border, panel);\n\t\t\n\t\tthis.setContentPane(panel);\n\t\tthis.setSize(564, 550);\n\t\t\n\t\tcontroller.initializeUI();\n\t}" ]
[ "0.6985103", "0.6791546", "0.6626624", "0.6593573", "0.6509669", "0.64963", "0.6453472", "0.64191437", "0.6297523", "0.6273521", "0.6271116", "0.6255435", "0.6246723", "0.6234565", "0.6221849", "0.62153727", "0.6171354", "0.61447567", "0.6127646", "0.6121766", "0.6106603", "0.6103486", "0.6094526", "0.60873663", "0.6082239", "0.6080914", "0.6065073", "0.6064208", "0.6039857", "0.6037937", "0.60356015", "0.60291684", "0.60264146", "0.60236615", "0.60210586", "0.60195255", "0.6019318", "0.6013926", "0.6004077", "0.59983623", "0.599546", "0.5974336", "0.59585404", "0.59511316", "0.59509397", "0.59360784", "0.5928829", "0.5926693", "0.59177476", "0.5915605", "0.5912437", "0.59107566", "0.59075403", "0.5905323", "0.5903623", "0.59022737", "0.58939326", "0.58888066", "0.58851594", "0.58836067", "0.58827025", "0.58819574", "0.5877188", "0.58731645", "0.5866448", "0.5855519", "0.58394355", "0.5838893", "0.5829442", "0.5828472", "0.5823518", "0.58219045", "0.5821445", "0.5810959", "0.58056724", "0.5801281", "0.57976234", "0.5797006", "0.5796655", "0.57913905", "0.57901025", "0.57901025", "0.57901025", "0.57901025", "0.57901025", "0.57901025", "0.57901025", "0.57901025", "0.57901025", "0.57901025", "0.57901025", "0.57901025", "0.57901025", "0.57901025", "0.57901025", "0.57901025", "0.57901025", "0.57901025", "0.57880235", "0.5785151" ]
0.62813854
9
This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel3 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); jLabel21 = new javax.swing.JLabel(); jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel1 = new javax.swing.JPanel(); jButton5 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel12 = new javax.swing.JLabel(); jLabel18 = new javax.swing.JLabel(); jPanel2 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jLabel13 = new javax.swing.JLabel(); jPanel4 = new javax.swing.JPanel(); jLabel14 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); jTextField2 = new javax.swing.JTextField(); jLabel16 = new javax.swing.JLabel(); jTextField3 = new javax.swing.JTextField(); jTextField4 = new javax.swing.JTextField(); jScrollPane2 = new javax.swing.JScrollPane(); jTextArea1 = new javax.swing.JTextArea(); jButton4 = new javax.swing.JButton(); jLabel20 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jLabel19 = new javax.swing.JLabel(); jPanel3 = new javax.swing.JPanel(); jScrollPane3 = new javax.swing.JScrollPane(); jTable2 = new javax.swing.JTable(); jButton6 = new javax.swing.JButton(); jTextField5 = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jLabel17 = new javax.swing.JLabel(); jLabel3.setText("jLabel3"); jLabel6.setText("jLabel6"); jLabel11.setText("jLabel11"); jLabel21.setText("jLabel21"); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setResizable(false); getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jTabbedPane1.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 255, 255), 1, true)); jTabbedPane1.setFont(new java.awt.Font("Monospaced", 1, 12)); // NOI18N jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/manage.jpg"))); // NOI18N jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } }); jPanel1.add(jButton5, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 0, 240, 158)); jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/cart.jpg"))); // NOI18N jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jPanel1.add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 269, 240, 140)); jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/leanet.jpg"))); // NOI18N jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jPanel1.add(jButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(700, 104, 211, 186)); jLabel7.setFont(new java.awt.Font("Monospaced", 1, 30)); // NOI18N jLabel7.setForeground(new java.awt.Color(255, 255, 255)); jLabel7.setText(" Network And Internet"); jPanel1.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 11, 633, -1)); jLabel8.setFont(new java.awt.Font("Monospaced", 1, 30)); // NOI18N jLabel8.setForeground(new java.awt.Color(255, 255, 255)); jLabel8.setText("Services"); jPanel1.add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(367, 57, 161, 36)); jLabel9.setFont(new java.awt.Font("Monospaced", 1, 30)); // NOI18N jLabel9.setForeground(new java.awt.Color(255, 255, 255)); jLabel9.setText("Learn How To Set Up A"); jPanel1.add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(282, 169, 400, 35)); jLabel10.setFont(new java.awt.Font("Monospaced", 1, 18)); // NOI18N jLabel10.setForeground(new java.awt.Color(255, 255, 255)); jLabel10.setText("Network And About Network Devices"); jPanel1.add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 200, 387, -1)); jLabel12.setFont(new java.awt.Font("Monospaced", 1, 30)); // NOI18N jLabel12.setForeground(new java.awt.Color(255, 255, 255)); jLabel12.setText("Buy Network Devices"); jPanel1.add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(268, 312, 365, -1)); jLabel18.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/wp1.jpg"))); // NOI18N jPanel1.add(jLabel18, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 910, 410)); jTabbedPane1.addTab("Our Services", jPanel1); jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Name", "Username", "Password", "Del.Address", "Mobile no." } )); jScrollPane1.setViewportView(jTable1); jPanel2.add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 311, 911, 98)); jLabel13.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N jLabel13.setForeground(new java.awt.Color(255, 255, 255)); jLabel13.setText("Please Re-enter Your Username:"); jPanel2.add(jLabel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 10, 208, 25)); jPanel4.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); jPanel4.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jLabel14.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N jLabel14.setForeground(new java.awt.Color(255, 255, 255)); jLabel14.setText("Name:"); jPanel4.add(jLabel14, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 32, 108, 27)); jLabel15.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N jLabel15.setForeground(new java.awt.Color(255, 255, 255)); jLabel15.setText("Password"); jPanel4.add(jLabel15, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 97, 118, 31)); jPanel4.add(jTextField2, new org.netbeans.lib.awtextra.AbsoluteConstraints(157, 31, 142, 33)); jLabel16.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N jLabel16.setForeground(new java.awt.Color(255, 255, 255)); jLabel16.setText("Mobile No."); jPanel4.add(jLabel16, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 174, 90, 27)); jPanel4.add(jTextField3, new org.netbeans.lib.awtextra.AbsoluteConstraints(157, 99, 142, 31)); jPanel4.add(jTextField4, new org.netbeans.lib.awtextra.AbsoluteConstraints(157, 165, 142, 28)); jScrollPane2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Delivery Address", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(255, 255, 255))); // NOI18N jScrollPane2.setForeground(new java.awt.Color(255, 255, 255)); jTextArea1.setColumns(20); jTextArea1.setRows(5); jScrollPane2.setViewportView(jTextArea1); jPanel4.add(jScrollPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(331, 31, 283, 162)); jButton4.setBackground(new java.awt.Color(255, 255, 255)); jButton4.setText("Update"); jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); } }); jPanel4.add(jButton4, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 219, 133, -1)); jLabel20.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/wp1.jpg"))); // NOI18N jPanel4.add(jLabel20, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 640, 250)); jPanel2.add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 40, 640, -1)); jPanel2.add(jTextField1, new org.netbeans.lib.awtextra.AbsoluteConstraints(500, 10, 249, 25)); jLabel19.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/wp1.jpg"))); // NOI18N jPanel2.add(jLabel19, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 910, 410)); jTabbedPane1.addTab("Update Account Details", jPanel2); jPanel3.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jTable2.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Message" } )); jScrollPane3.setViewportView(jTable2); jPanel3.add(jScrollPane3, new org.netbeans.lib.awtextra.AbsoluteConstraints(1, 61, 910, 347)); jButton6.setBackground(new java.awt.Color(51, 51, 255)); jButton6.setFont(new java.awt.Font("Monospaced", 1, 14)); // NOI18N jButton6.setForeground(new java.awt.Color(255, 255, 255)); jButton6.setText("Show Messages"); jButton6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton6ActionPerformed(evt); } }); jPanel3.add(jButton6, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 10, 193, 32)); jTextField5.setBackground(new java.awt.Color(51, 51, 255)); jTextField5.setForeground(new java.awt.Color(255, 255, 255)); jTextField5.setText("Enter your username here"); jPanel3.add(jTextField5, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 10, 190, 30)); jTabbedPane1.addTab("Admin's Message", jPanel3); getContentPane().add(jTabbedPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 59, -1, 442)); jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/logo_1.png"))); // NOI18N getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 48, 53)); jLabel2.setFont(new java.awt.Font("Monospaced", 1, 40)); // NOI18N jLabel2.setForeground(new java.awt.Color(255, 255, 255)); jLabel2.setText("SWIFT"); getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(54, 0, 237, -1)); jLabel4.setForeground(new java.awt.Color(255, 255, 255)); jLabel4.setText("All Rights Reserved. Copywright 2018 -APHP Softwares"); getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(590, 510, 330, -1)); jLabel5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N jLabel5.setForeground(new java.awt.Color(255, 255, 255)); jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel5.setText("APHP Softwares."); getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(783, 0, 155, 22)); jButton1.setBackground(new java.awt.Color(51, 51, 255)); jButton1.setText("Log Out"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(817, 28, 111, -1)); jLabel17.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/wp1.jpg"))); // NOI18N jLabel17.setText("jLabel17"); getContentPane().add(jLabel17, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 940, 530)); pack(); setLocationRelativeTo(null); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Form() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n }", "public frmRectangulo() {\n initComponents();\n }", "public form() {\n initComponents();\n }", "public AdjointForm() {\n initComponents();\n setDefaultCloseOperation(HIDE_ON_CLOSE);\n }", "public FormListRemarking() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n \n }", "public FormPemilihan() {\n initComponents();\n }", "public GUIForm() { \n initComponents();\n }", "public FrameForm() {\n initComponents();\n }", "public TorneoForm() {\n initComponents();\n }", "public FormCompra() {\n initComponents();\n }", "public muveletek() {\n initComponents();\n }", "public Interfax_D() {\n initComponents();\n }", "public quanlixe_form() {\n initComponents();\n }", "public SettingsForm() {\n initComponents();\n }", "public RegistrationForm() {\n initComponents();\n this.setLocationRelativeTo(null);\n }", "public Soru1() {\n initComponents();\n }", "public FMainForm() {\n initComponents();\n this.setResizable(false);\n setLocationRelativeTo(null);\n }", "public soal2GUI() {\n initComponents();\n }", "public EindopdrachtGUI() {\n initComponents();\n }", "public MechanicForm() {\n initComponents();\n }", "public AddDocumentLineForm(java.awt.Frame parent) {\n super(parent);\n initComponents();\n myInit();\n }", "public BloodDonationGUI() {\n initComponents();\n }", "public quotaGUI() {\n initComponents();\n }", "public Customer_Form() {\n initComponents();\n setSize(890,740);\n \n \n }", "public PatientUI() {\n initComponents();\n }", "public myForm() {\n\t\t\tinitComponents();\n\t\t}", "public Oddeven() {\n initComponents();\n }", "public intrebarea() {\n initComponents();\n }", "public Magasin() {\n initComponents();\n }", "public RadioUI()\n {\n initComponents();\n }", "public NewCustomerGUI() {\n initComponents();\n }", "public ZobrazUdalost() {\n initComponents();\n }", "public FormUtama() {\n initComponents();\n }", "public p0() {\n initComponents();\n }", "public INFORMACION() {\n initComponents();\n this.setLocationRelativeTo(null); \n }", "public ProgramForm() {\n setLookAndFeel();\n initComponents();\n }", "public AmountReleasedCommentsForm() {\r\n initComponents();\r\n }", "public form2() {\n initComponents();\n }", "public MainForm() {\n\t\tsuper(\"Hospital\", List.IMPLICIT);\n\n\t\tstartComponents();\n\t}", "public kunde() {\n initComponents();\n }", "public LixeiraForm() {\n initComponents();\n setLocationRelativeTo(null);\n }", "@SuppressWarnings(\"unchecked\")\n // <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents\n private void initComponents() {\n\n setName(\"Form\"); // NOI18N\n setRequestFocusEnabled(false);\n setVerifyInputWhenFocusTarget(false);\n\n javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);\n this.setLayout(layout);\n layout.setHorizontalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 465, Short.MAX_VALUE)\n );\n layout.setVerticalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 357, Short.MAX_VALUE)\n );\n }", "public frmMain() {\n initComponents();\n }", "public frmMain() {\n initComponents();\n }", "public MusteriEkle() {\n initComponents();\n }", "public DESHBORDPANAL() {\n initComponents();\n }", "public GUIForm() {\n initComponents();\n inputField.setText(NO_FILE_SELECTED);\n outputField.setText(NO_FILE_SELECTED);\n progressLabel.setBackground(INFO);\n progressLabel.setText(SELECT_FILE);\n }", "public frmVenda() {\n initComponents();\n }", "public Botonera() {\n initComponents();\n }", "public FrmMenu() {\n initComponents();\n }", "public OffertoryGUI() {\n initComponents();\n setTypes();\n }", "public JFFornecedores() {\n initComponents();\n }", "@SuppressWarnings(\"unchecked\")\n // <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents\n private void initComponents()\n {\n\n setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);\n setBackground(new java.awt.Color(255, 255, 255));\n\n javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());\n getContentPane().setLayout(layout);\n layout.setHorizontalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 983, Short.MAX_VALUE)\n );\n layout.setVerticalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 769, Short.MAX_VALUE)\n );\n\n pack();\n }", "public EnterDetailsGUI() {\n initComponents();\n }", "public vpemesanan1() {\n initComponents();\n }", "public Kost() {\n initComponents();\n }", "public UploadForm() {\n initComponents();\n }", "public FormHorarioSSE() {\n initComponents();\n }", "public frmacceso() {\n initComponents();\n }", "public HW3() {\n initComponents();\n }", "public Managing_Staff_Main_Form() {\n initComponents();\n }", "@SuppressWarnings(\"unchecked\")\n // <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents\n private void initComponents()\n {\n\n setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);\n getContentPane().setLayout(null);\n\n pack();\n }", "@SuppressWarnings(\"unchecked\")\n // <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents\n private void initComponents() {\n\n setName(\"Form\"); // NOI18N\n\n javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);\n this.setLayout(layout);\n layout.setHorizontalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 400, Short.MAX_VALUE)\n );\n layout.setVerticalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 300, Short.MAX_VALUE)\n );\n }", "public sinavlar2() {\n initComponents();\n }", "public P0405() {\n initComponents();\n }", "public IssueBookForm() {\n initComponents();\n }", "public MiFrame2() {\n initComponents();\n }", "public Choose1() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n\n String oldAuthor = prefs.get(\"AUTHOR\", \"\");\n if(oldAuthor != null) {\n this.authorTextField.setText(oldAuthor);\n }\n String oldBook = prefs.get(\"BOOK\", \"\");\n if(oldBook != null) {\n this.bookTextField.setText(oldBook);\n }\n String oldDisc = prefs.get(\"DISC\", \"\");\n if(oldDisc != null) {\n try {\n int oldDiscNum = Integer.parseInt(oldDisc);\n oldDiscNum++;\n this.discNumberTextField.setText(Integer.toString(oldDiscNum));\n } catch (Exception ex) {\n this.discNumberTextField.setText(oldDisc);\n }\n this.bookTextField.setText(oldBook);\n }\n\n\n }", "public GUI_StudentInfo() {\n initComponents();\n }", "public JFrmPrincipal() {\n initComponents();\n }", "public Lihat_Dokter_Keseluruhan() {\n initComponents();\n }", "public bt526() {\n initComponents();\n }", "public Pemilihan_Dokter() {\n initComponents();\n }", "public Ablak() {\n initComponents();\n }", "@Override\n\tprotected void initUi() {\n\t\t\n\t}", "@SuppressWarnings(\"unchecked\")\n\t// <editor-fold defaultstate=\"collapsed\" desc=\"Generated\n\t// Code\">//GEN-BEGIN:initComponents\n\tprivate void initComponents() {\n\n\t\tlabel1 = new java.awt.Label();\n\t\tlabel2 = new java.awt.Label();\n\t\tlabel3 = new java.awt.Label();\n\t\tlabel4 = new java.awt.Label();\n\t\tlabel5 = new java.awt.Label();\n\t\tlabel6 = new java.awt.Label();\n\t\tlabel7 = new java.awt.Label();\n\t\tlabel8 = new java.awt.Label();\n\t\tlabel9 = new java.awt.Label();\n\t\tlabel10 = new java.awt.Label();\n\t\ttextField1 = new java.awt.TextField();\n\t\ttextField2 = new java.awt.TextField();\n\t\tlabel14 = new java.awt.Label();\n\t\tlabel15 = new java.awt.Label();\n\t\tlabel16 = new java.awt.Label();\n\t\ttextField3 = new java.awt.TextField();\n\t\ttextField4 = new java.awt.TextField();\n\t\ttextField5 = new java.awt.TextField();\n\t\tlabel17 = new java.awt.Label();\n\t\tlabel18 = new java.awt.Label();\n\t\tlabel19 = new java.awt.Label();\n\t\tlabel20 = new java.awt.Label();\n\t\tlabel21 = new java.awt.Label();\n\t\tlabel22 = new java.awt.Label();\n\t\ttextField6 = new java.awt.TextField();\n\t\ttextField7 = new java.awt.TextField();\n\t\ttextField8 = new java.awt.TextField();\n\t\tlabel23 = new java.awt.Label();\n\t\ttextField9 = new java.awt.TextField();\n\t\ttextField10 = new java.awt.TextField();\n\t\ttextField11 = new java.awt.TextField();\n\t\ttextField12 = new java.awt.TextField();\n\t\tlabel24 = new java.awt.Label();\n\t\tlabel25 = new java.awt.Label();\n\t\tlabel26 = new java.awt.Label();\n\t\tlabel27 = new java.awt.Label();\n\t\tlabel28 = new java.awt.Label();\n\t\tlabel30 = new java.awt.Label();\n\t\tlabel31 = new java.awt.Label();\n\t\tlabel32 = new java.awt.Label();\n\t\tjButton1 = new javax.swing.JButton();\n\n\t\tlabel1.setFont(new java.awt.Font(\"Segoe UI Semibold\", 0, 18)); // NOI18N\n\t\tlabel1.setText(\"It seems that some of the buttons on the ATM machine are not working!\");\n\n\t\tlabel2.setFont(new java.awt.Font(\"Segoe UI Semibold\", 0, 18)); // NOI18N\n\t\tlabel2.setText(\"Unfortunately these numbers are exactly what Professor has to use to type in his password.\");\n\n\t\tlabel3.setFont(new java.awt.Font(\"Segoe UI Semibold\", 0, 18)); // NOI18N\n\t\tlabel3.setText(\n\t\t\t\t\"If you want to eat tonight, you have to help him out and construct the numbers of the password with the working buttons and math operators.\");\n\n\t\tlabel4.setFont(new java.awt.Font(\"Segoe UI Semibold\", 0, 14)); // NOI18N\n\t\tlabel4.setText(\"Denver's Password: 2792\");\n\n\t\tlabel5.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel5.setText(\"import java.util.Scanner;\\n\");\n\n\t\tlabel6.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel6.setText(\"public class ATM{\");\n\n\t\tlabel7.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel7.setText(\"public static void main(String[] args){\");\n\n\t\tlabel8.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel8.setText(\"System.out.print(\");\n\n\t\tlabel9.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel9.setText(\" -\");\n\n\t\tlabel10.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel10.setText(\");\");\n\n\t\ttextField1.addActionListener(new java.awt.event.ActionListener() {\n\t\t\tpublic void actionPerformed(java.awt.event.ActionEvent evt) {\n\t\t\t\ttextField1ActionPerformed(evt);\n\t\t\t}\n\t\t});\n\n\t\tlabel14.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel14.setText(\"System.out.print( (\");\n\n\t\tlabel15.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel15.setText(\"System.out.print(\");\n\n\t\tlabel16.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel16.setText(\"System.out.print( ( (\");\n\n\t\tlabel17.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel17.setText(\")\");\n\n\t\tlabel18.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel18.setText(\" +\");\n\n\t\tlabel19.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel19.setText(\");\");\n\n\t\tlabel20.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel20.setText(\" /\");\n\n\t\tlabel21.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel21.setText(\" %\");\n\n\t\tlabel22.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel22.setText(\" +\");\n\n\t\tlabel23.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel23.setText(\");\");\n\n\t\tlabel24.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel24.setText(\" +\");\n\n\t\tlabel25.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel25.setText(\" /\");\n\n\t\tlabel26.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel26.setText(\" *\");\n\n\t\tlabel27.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));\n\t\tlabel27.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel27.setText(\")\");\n\n\t\tlabel28.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel28.setText(\")\");\n\n\t\tlabel30.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel30.setText(\"}\");\n\n\t\tlabel31.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel31.setText(\"}\");\n\n\t\tlabel32.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel32.setText(\");\");\n\n\t\tjButton1.setFont(new java.awt.Font(\"Segoe UI Semibold\", 0, 14)); // NOI18N\n\t\tjButton1.setText(\"Check\");\n\t\tjButton1.addActionListener(new java.awt.event.ActionListener() {\n\t\t\tpublic void actionPerformed(java.awt.event.ActionEvent evt) {\n\t\t\t\tjButton1ActionPerformed(evt);\n\t\t\t}\n\t\t});\n\n\t\tjavax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);\n\t\tlayout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING)\n\t\t\t\t.addGroup(layout.createSequentialGroup().addGap(28).addGroup(layout\n\t\t\t\t\t\t.createParallelGroup(Alignment.LEADING).addComponent(getDoneButton()).addComponent(jButton1)\n\t\t\t\t\t\t.addComponent(label7, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addComponent(label6, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addComponent(label5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addComponent(label4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addComponent(label3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t.addComponent(label1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t.addGap(1)\n\t\t\t\t\t\t\t\t.addComponent(label2, GroupLayout.PREFERRED_SIZE, 774, GroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t.addGap(92).addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout\n\t\t\t\t\t\t\t\t\t\t.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.LEADING, false)\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label15, GroupLayout.PREFERRED_SIZE, 145,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField8, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(2)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label21, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField7, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label8, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField1, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label9, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED).addComponent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttextField2, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label31, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label14, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(37))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGap(174)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField5, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t20, GroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label18, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(7)))\n\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.TRAILING, false).addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField4, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t20, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label17, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label22, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField9, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t20, GroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t\t\t\t\t\t\t.addGap(20)\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label23, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label20, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField3, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t20, GroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t\t\t\t\t\t\t.addGap(20).addComponent(label19, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGap(23).addComponent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel10, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))))\n\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label16, GroupLayout.PREFERRED_SIZE, 177,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField12, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label24, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField6, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label27, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label25, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField11, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label28, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addGap(1)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label26, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField10, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED).addComponent(label32,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))))\n\t\t\t\t\t\t.addComponent(label30, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));\n\t\tlayout.setVerticalGroup(\n\t\t\t\tlayout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap()\n\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t.addComponent(label1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t.addComponent(label2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t.addGap(1)\n\t\t\t\t\t\t.addComponent(label3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t.addComponent(label4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t.addComponent(label5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t.addComponent(label6, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t.addComponent(label7, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t.createParallelGroup(\n\t\t\t\t\t\t\t\t\t\tAlignment.TRAILING)\n\t\t\t\t\t\t\t\t.addGroup(\n\t\t\t\t\t\t\t\t\t\tlayout.createSequentialGroup().addGroup(layout.createParallelGroup(\n\t\t\t\t\t\t\t\t\t\t\t\tAlignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createSequentialGroup().addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.TRAILING).addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label9,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label8,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttextField2, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label10,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(3)))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(19)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField5,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label14,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label18,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label17,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField4,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(1))))\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label20, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label19, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField3, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGap(78)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label27, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGap(76)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField11, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGap(75)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label32,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField10,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tShort.MAX_VALUE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.TRAILING, false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAlignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label15,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField8,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label21,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField7,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(27))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAlignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField9,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAlignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label22,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlayout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(3)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel23,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(29)))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label16,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField12,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAlignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label24,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField6,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(1))))))\n\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t.addComponent(label25, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t.addComponent(label28, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t.addComponent(label26, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t.addGap(30)\n\t\t\t\t\t\t.addComponent(label31, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addGap(25)\n\t\t\t\t\t\t.addComponent(label30, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addGap(26).addComponent(jButton1).addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t.addComponent(getDoneButton()).addContainerGap(23, Short.MAX_VALUE)));\n\t\tthis.setLayout(layout);\n\n\t\tlabel16.getAccessibleContext().setAccessibleName(\"System.out.print( ( (\");\n\t\tlabel17.getAccessibleContext().setAccessibleName(\"\");\n\t\tlabel18.getAccessibleContext().setAccessibleName(\" +\");\n\t}", "public Pregunta23() {\n initComponents();\n }", "public FormMenuUser() {\n super(\"Form Menu User\");\n initComponents();\n }", "public AvtekOkno() {\n initComponents();\n }", "public busdet() {\n initComponents();\n }", "public ViewPrescriptionForm() {\n initComponents();\n }", "public Ventaform() {\n initComponents();\n }", "public Kuis2() {\n initComponents();\n }", "public CreateAccount_GUI() {\n initComponents();\n }", "public POS1() {\n initComponents();\n }", "public Carrera() {\n initComponents();\n }", "public EqGUI() {\n initComponents();\n }", "public JFriau() {\n initComponents();\n this.setLocationRelativeTo(null);\n this.setTitle(\"BuNus - Budaya Nusantara\");\n }", "@SuppressWarnings(\"unchecked\")\n // <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents\n private void initComponents() {\n\n setBackground(new java.awt.Color(204, 204, 204));\n setMinimumSize(new java.awt.Dimension(1, 1));\n setPreferredSize(new java.awt.Dimension(760, 402));\n\n javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);\n this.setLayout(layout);\n layout.setHorizontalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 750, Short.MAX_VALUE)\n );\n layout.setVerticalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 400, Short.MAX_VALUE)\n );\n }", "public nokno() {\n initComponents();\n }", "public dokter() {\n initComponents();\n }", "public ConverterGUI() {\n initComponents();\n }", "public hitungan() {\n initComponents();\n }", "public Modify() {\n initComponents();\n }", "public frmAddIncidencias() {\n initComponents();\n }", "public FP_Calculator_GUI() {\n initComponents();\n \n setVisible(true);\n }" ]
[ "0.73197734", "0.72914416", "0.72914416", "0.72914416", "0.72862023", "0.72487676", "0.7213741", "0.7207628", "0.7196503", "0.7190263", "0.71850693", "0.71594703", "0.7147939", "0.7093137", "0.70808756", "0.70566356", "0.6987119", "0.69778043", "0.6955563", "0.6953879", "0.6945632", "0.6943359", "0.69363457", "0.6931661", "0.6927987", "0.6925778", "0.6925381", "0.69117576", "0.6911631", "0.68930036", "0.6892348", "0.6890817", "0.68904495", "0.6889411", "0.68838716", "0.6881747", "0.6881229", "0.68778914", "0.6876094", "0.6874808", "0.68713", "0.6859444", "0.6856188", "0.68556464", "0.6855074", "0.68549985", "0.6853093", "0.6853093", "0.68530816", "0.6843091", "0.6837124", "0.6836549", "0.6828579", "0.68282986", "0.68268806", "0.682426", "0.6823653", "0.6817904", "0.68167645", "0.68102163", "0.6808751", "0.680847", "0.68083245", "0.6807882", "0.6802814", "0.6795573", "0.6794048", "0.6792466", "0.67904556", "0.67893785", "0.6789265", "0.6788365", "0.67824304", "0.6766916", "0.6765524", "0.6765339", "0.67571205", "0.6755559", "0.6751974", "0.67510027", "0.67433685", "0.67390305", "0.6737053", "0.673608", "0.6733373", "0.67271507", "0.67262334", "0.67205364", "0.6716807", "0.67148036", "0.6714143", "0.67090863", "0.67077154", "0.67046666", "0.6701339", "0.67006236", "0.6699842", "0.66981244", "0.6694887", "0.6691074", "0.66904294" ]
0.0
-1
Generates a list of chromosomes entirely randomly by placing the packages into random bins. No concern for feasibility here.
private int[][] generateInitialPopulation(int binCt, int binSize, int pkgCt, int populationSize) { int[][] population = new int[populationSize][pkgCt]; for (int i = 0; i < populationSize; i++) { for (int j = 0; j < pkgCt; j++) { population[i][j] = rand.nextInt(binCt); } } return population; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Chromosome getRandom();", "private <T> List<Chromosome<T>> breedNewGeneration(List<Chromosome<T>> chromosomes){\n\t\tList<Chromosome<T>> selected = selection.apply(chromosomes);\n\t\tCollections.shuffle(selected);\n\n\t\tList<Chromosome<T>> crossedOver = Lists.newArrayList();\n\t\tfor(int i = 0; i < selected.size(); i+=2){\n\t\t\tChromosome<T>[] bred = crossover.apply(selected.get(i), selected.get(i+1));\n\t\t\tcrossedOver.add(bred[0]);\n\t\t\tcrossedOver.add(bred[1]);\n\t\t}\n\n\t\treturn crossedOver.stream().map(mutation::apply).collect(Collectors.toList());\n\t}", "public void genPopulation(int howMany)\r\n/* 30: */ {\r\n/* 31:54 */ this.pop.removeAllElements();\r\n/* 32:55 */ for (int i = 0; i < howMany; i++)\r\n/* 33: */ {\r\n/* 34:61 */ int[] clusterV = g.genRandomClusterSize();\r\n/* 35:62 */ Cluster c = new Cluster(g, clusterV);\r\n/* 36:63 */ this.pop.addElement(c);\r\n/* 37: */ }\r\n/* 38: */ }", "private static void InitRandBag()\n {\n int k=(int)Math.floor(Math.random()*50);\n R[0]=k;\n\n //Generate the rest of the numbers\n for(int i=1;i<950;i++)\n {\n k=k+(int)Math.floor(Math.random()*50);\n R[i]=k;\n }\n\n //Shuffle the list\n for(int i=0;i<950;i++)\n {\n int temp = R[i];\n k = (int)Math.floor(Math.random()*950);\n R[i]=R[k];\n R[k]=temp;\n }\n }", "private int[] bestFitModified(int[] chromosome) {\n\t\tint[] bins = new int[binCount];\n\t\tArrayList<Integer> cannotPackList = new ArrayList<Integer>();\n\n\t\t//honor chromosome listing when possible\n\t\tfor (int i = 0; i < chromosome.length; i++) {\n\t\t\t//if this bin isnt full & won't be after placement & this chrom hasnt gone off the end \n\t\t\t//(VERY RARE, only happens when binCount is reduced w/ elitism)\n\t\t\tif (chromosome[i] < bins.length && bins[chromosome[i]] + packageWeights[i] <= binSize) {\n\t\t\t\tbins[chromosome[i]] += packageWeights[i]; //put package into bin\n\t\t\t} else { //store those we can't honor\n\t\t\t\tchromosome[i] = -1;\n\t\t\t\tcannotPackList.add(new Integer(i)); //save all those packages whos original bins were full\n\t\t\t}\n\t\t}\n\n\t\t//best fit on all the rest whos bins were full up\n\t\tint tries = 0;\n\t\tfor (int j = 0; j < cannotPackList.size(); j++) {\n\t\t\tint i = cannotPackList.get(j);\n\t\t\tint bestBinIndex = -1;\n\n\t\t\twhile (bestBinIndex < 0 && tries < bins.length * 2) { //while we still havent found a bin to put this in and time isn't up\n\n\t\t\t\tint bestBinLeftOverSpace = binSize * 100; //how much space is left in the bin when the packages is placed in it (ideally 0 = full bin)\n\n\t\t\t\tfor (int bin = 0; bin < bins.length; bin++) {\n\t\t\t\t\t//if this bin is closer to full than the best bin and not overfilled save it\n\t\t\t\t\tif ((binSize - (bins[bin] + packageWeights[i])) >= 0 && (binSize - (bins[bin] + packageWeights[i])) < bestBinLeftOverSpace) {\n\t\t\t\t\t\tbestBinIndex = bin;\n\t\t\t\t\t\tbestBinLeftOverSpace = binSize - (bins[bin] + packageWeights[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (bestBinIndex < 0) { //if could not pack, dump out a bin (mutation)\n\t\t\t\t\tj = 0;\n\t\t\t\t\tint dumpBin = rand.nextInt(binCount);\n\t\t\t\t\tfor (int binIndex = dumpBin; binIndex < binCount; binIndex++) {\n\t\t\t\t\t\tbins[binIndex] = 0;\n\t\t\t\t\t\tfor (int chromIndex = 0; chromIndex < chromosome.length; chromIndex++) {\n\t\t\t\t\t\t\tif (chromosome[chromIndex] == binIndex) {\n\t\t\t\t\t\t\t\tchromosome[chromIndex] = -1;\n\t\t\t\t\t\t\t\tcannotPackList.add(new Integer(chromIndex));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\ttries++;\n\t\t\t}\n\n\t\t\tif (tries >= bins.length * 2) {\n\t\t\t\treturn null; //this chromosome is unsalvageable because it is impossible to fit the packages in the bins\n\t\t\t}\n\n\n\t\t\tbins[bestBinIndex] += packageWeights[i];\n\t\t\tchromosome[i] = bestBinIndex;\n\t\t\tcannotPackList.remove(j);\n\t\t\tj--;\n\t\t}\n\n\t\treturn chromosome;\n\t}", "public void random_init()\r\n\t{\r\n\t\tRandom random_generator = new Random();\r\n\t\t\r\n\t\tfor(int i=0;i<chromosome_size;i++)\r\n\t\t{\r\n\t\t\tchromosome[i] = random_generator.nextInt(num_colors)+1;\r\n\t\t}\r\n\t}", "Chromosome getRandomAmongFittest(int limit);", "private static Set<Chromosome> generateRandomPopulation(int pathLength, int randomPopulationSize) {\n Set<Chromosome> population = new HashSet<>();\n\n // create an arraylist of CityIDs, and initialise it with the cities in order of their ID\n ArrayList<Integer> basePath = new ArrayList<>();\n for (int i = 0; i < pathLength; i++) {\n basePath.add(i);\n }\n\n // repeat the following for as many chromosomes as are required (populationSize)\n while (population.size() < randomPopulationSize) {\n Chromosome chromosome = new Chromosome(pathLength);\n // randomise the order of the arraylist of cities\n Collections.shuffle(basePath);\n for (int j = 0; j < pathLength; j++) {\n chromosome.path[j] = basePath.get(j);\n }\n population.add(chromosome);\n }\n\n return population;\n }", "public void generateGenes() {\n\t\tfor(int i = 0; i < geneNumber; i++){\n\t\t\tdouble[] vector = new double[NUM_HEURISTICS];\n\t\t\tfor(int j = 0; j < NUM_HEURISTICS; j++){\n\t\t\t\t// To get a number in [-0.5, 0.5)\n\t\t\t\tvector[j] = Math.random() - 0.5;\n\t\t\t}\n\t\t\tGene newGene = new Gene(vector, true);\n\t\t\tgenepool.add(newGene);\n\t\t}\n\t}", "void genPermute() {\n\t\tpermute = new ArrayList<Integer>();\n\t\tfor(int idx = 0; idx < dim(); idx++)\n\t\t\tpermute.add(idx);\n\t\tjava.util.Collections.shuffle(permute);\n\t}", "public static int[] genPerm(int bound, int size) {\n Set<Integer> set = new HashSet<>();\n while (set.size() < size) {\n set.add(rand.nextInt(bound));\n }\n int[] randPerm = new int[size];\n int i = 0;\n for (Integer value : set) {\n randPerm[i++] = value;\n }\n return randPerm;\n }", "private List<Integer> generateRandom() {\n Integer[] randArr = new Integer[numCols*numRows];\n\n int start = 0;\n int end;\n for(int i = 0; i < myStateMap.size(); i++) {\n int amt = myStateMap.get(i).getAmount();\n end = amt + start;\n for(int j = start; j < end; j++) {\n if(end > randArr.length) {\n break;\n }\n randArr[j] = myStateMap.get(i).getType();\n }\n start = end;\n }\n\n List<Integer> arr = new ArrayList<>(Arrays.asList(randArr));\n Collections.shuffle(arr);\n return arr;\n }", "private List<Integer> generateProb() {\n Integer[] randArr = new Integer[numCols*numRows];\n\n int start = 0;\n int end;\n for(int i = 0; i < myStateMap.size(); i++) {\n double prob = myStateMap.get(i).getProb();\n end = (int) (prob * numCols * numRows + start);\n for(int j = start; j < end; j++) {\n if(end > randArr.length) {\n break;\n }\n randArr[j] = myStateMap.get(i).getType();\n }\n start = end;\n }\n\n List<Integer> arr = new ArrayList<>(Arrays.asList(randArr));\n Collections.shuffle(arr);\n return arr;\n }", "public Chromosome withRandomKnapsackItems() {\n this.knapsackSelection = generateRandomItems();\n return this;\n }", "public void populateGrid() {\n for (int i=0; i<5; i++) {\n int chance = (int) random(10);\n if (chance <= 3) {\n int hh = ((int) random(50) + 1) * pixelSize;\n int ww = ((int) random(30) + 1) * pixelSize;\n\n int x = ((int) random(((width/2)/pixelSize))) * pixelSize + width/4;\n int y = ((int) random((height-topHeight)/pixelSize)) * pixelSize + topHeight;\n\n new Wall(w/2, 190, hh, ww).render();\n }\n }\n\n int fewestNumberOfPowerUps = 3;\n int greatesNumberOfPowerUps = 6;\n int wSize = 2;\n int hSize = 2;\n\n powerUps = new ArrayList <PowerUp> ();\n createPowerUps (fewestNumberOfPowerUps, greatesNumberOfPowerUps, wSize, hSize);\n}", "@Override\r\n\tpublic int[] getSample(Random rng) {\r\n\t\tif (!ready)\r\n\t\t\tthrow new RuntimeException(\"must normalize first\");\r\n\t\t\r\n\t\tint bins[] = new int[no_goods];\r\n\t\t\r\n\t\tfor (int i = 0; i<no_goods; i++) {\r\n\t\t\tdouble[] pmf = prob[i].get(r_tmp[i]);\r\n\t\r\n\t\t\t// choose a random spot on the cdf\r\n\t\t\tdouble random = rng.nextDouble();\r\n\t\t\t\r\n\t\t\t// compute cdf. todo: maybe we should precompute inverse of cdf in normalize() so that\r\n\t\t\t// we can avoid a loop here?\r\n\t\t\tdouble cdf = 0.0;\r\n\t\t\tfor (int j = 0; j<pmf.length; j++) {\r\n\t\t\t\tcdf += pmf[j];\r\n\t\t\t\t\r\n\t\t\t\tif (cdf >= random) {\r\n\t\t\t\t\tbins[i] = j;\r\n\t\t\t\t\t\r\n\t\t\t\t\t// add index to realized so that in next round we get the pmf conditional\r\n\t\t\t\t\t// on our result for this round\r\n\t\t\t\t\tfor (int k = 0; k<=i; k++)\r\n\t\t\t\t\t\tr_tmp[i+1].d[k] = bins[k];\r\n\t\t\t\t\t\r\n\t\t\t\t\t// go onto next good\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// sanity check: make sure we picked something. \r\n\t\t}\r\n\t\t\r\n\t\treturn bins;\r\n\t}", "public void probabiltDistribution() {\r\n\t\tfor (int k = 0; k < 1000; k++) {\r\n\t\t\tfor (int i = 0; i < 9; i++) {\r\n\t\t\t\tfor (int j = 0; j < 11; j++) {\r\n\t\t\t\t\trandomGrid[i][j] = 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tdeployComputerShips();\r\n\t\t\tfor (int i = 0; i < 9; i++) {\r\n\t\t\t\tfor (int j = 0; j < 11; j++) {\r\n\t\t\t\t\tprobabilityGrid[i][j] = probabilityGrid[i][j] + randomGrid[i][j];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private void generateData(){\n generateP50boys();\n generateP50girls();\n generateP97boys();\n generateP97girls();\n }", "public void generaBuits() {\r\n\r\n //FIX PARA EL OUT OF BOUNDS DE la columna 9 \r\n //int cellId = randomGenerator(N*N) - 1;\r\n //QUITAR \r\n //if (j != 0)\r\n //j = j - 1;\r\n int count = K;\r\n while (count != 0) {\r\n int cellId = generadorAleatoris(N * N) - 1;\r\n\r\n //System.out.println(cellId); \r\n // extract coordinates i and j \r\n int i = (cellId / N);\r\n int j = cellId % 9;\r\n\r\n // System.out.println(i+\" \"+j); \r\n if (mat[i][j] != 0) {\r\n count--;\r\n mat[i][j] = 0;\r\n }\r\n }\r\n }", "private void distribute() {\n\t\t\tfor (Entry<String, List<String>> r : groups.entrySet()) {\n\t\t\t\tRandom random = new Random();\n\t\t\t\tint randomIndex = random.nextInt(r.getValue().size());\n\t\t\t\tdistribution.put(r.getKey(), r.getValue().get(randomIndex));\n\t\t\t}\n\t\t}", "public List<Vec> sample(int count, Random rand);", "private void collectRandomRIDs(){\n\t\tint numRIDs = iterations + 1;\n\t\trandomRID_list = new String[numRIDs];\n\t\tString randomClusterName;\n\t\tint clusterID, randomPosition;\n\t\t\n\t\t// Collect #iterations of random RID's\n\t\tfor(int i=0; i < numRIDs; i++){\n\t\t\trandomClusterName = env.VERTEX_PREFIX + (int) (Math.random() * env.NUM_VERTEX_TYPE);\n\t\t\tclusterID = db.getClusterIdByName(randomClusterName); \n\t\t\tOClusterPosition [] range = db.getStorage().getClusterDataRange(clusterID);\n\t\t\t\n\t\t\trandomPosition = (int) (Math.random() * range[1].intValue()) + range[0].intValue();\n\t\t\trandomRID_list[i] = \"#\" + clusterID + \":\" + randomPosition;\n\t\t}\n\t\t\n\t}", "private static Set<Chromosome> rankBasedRouletteWheelSelection(ArrayList<Chromosome> population, int populationSize) {\n Set<Chromosome> selectedChromosomes = new HashSet<>();\n\n // calculate the sum of all ranks, which will be used as a denominator for all probabilities\n int sumOfRanks = (populationSize + 1) * populationSize / 2;\n\n // declare an array of cumulative probabilities for all the chromosomes in the population\n double[] cumulativeProbability = new double[populationSize];\n // calculate the cumulative probability of the first chromosome as its probability\n cumulativeProbability[0] = (double) populationSize / sumOfRanks;\n // calculate the cumulative probabilities of all successive chromosomes:\n for (int i = 1; i < populationSize; i++) {\n // as the probability of this chromosomes based on its rank\n double probability = (double) (populationSize-i) / sumOfRanks;\n // plus the cumulative proability of the preceeding chromosome\n cumulativeProbability[i] = cumulativeProbability[i-1] + probability;\n }\n\n while (selectedChromosomes.size() < 2) {\n // choose a chromosome randomly based on its cumulative probability (the lower the better)\n double random = ThreadLocalRandom.current().nextDouble();\n int choice = 0;\n while (random > cumulativeProbability[choice]) {\n choice++;\n }\n\n // add the chosen chromosome to the set of selectedChromosomes\n selectedChromosomes.add(population.get(choice));\n }\n\n return selectedChromosomes;\n }", "Chromosome from(List<Chromosome> population);", "public void addRandoms() {\n //Add random boulders on tiles that aren't Lava\n int tileNumber;\n int selector;\n Tile t;\n String tileTexture;\n Random random = new Random();\n SquareVector playerPos = getPlayerEntity().getPosition();\n int tileCount = GameManager.get().getWorld().getTiles().size();\n AbstractWorld world = GameManager.get().getWorld();\n int randIndex;\n\n for (int i = 0; i < 20; i++) {\n //Get respective volcano tile (5 <= Lava tiles Index <= 8\n do {\n randIndex = random.nextInt(tileCount);\n t = world.getTile(randIndex);\n } while (t.getCoordinates().isCloseEnoughToBeTheSame(playerPos));\n\n tileTexture = t.getTextureName();\n tileNumber = Integer.parseInt(tileTexture.split(\"_\")[1]);\n\n selector = random.nextInt(2);\n if (tileNumber < 5 && tileNumber > 1 && selector == 1 && !t.hasParent()) {\n entities.add(new Rock(t, true));\n } else if (t != null && (tileNumber == 3 || tileNumber == 4) &&\n selector == 0 && !t.hasParent()) {\n entities.add(new VolcanoBurningTree(t, true));\n } else {\n i--;\n }\n }\n }", "public void randomize()\n {\n for (int i=0; i<list.length; i++)\n list[i] = (int)(Math.random() * 100) + 1;\n }", "public static void populate() {\n for (int i = 1; i <= 15; i++) {\n B.add(i);\n Collections.shuffle(B);\n\n }\n for (int i = 16; i <= 30; i++) {\n I.add(i);\n Collections.shuffle(I);\n }\n for (int n = 31; n <= 45; n++) {\n N.add(n);\n Collections.shuffle(N);\n }\n for (int g = 46; g <= 60; g++) {\n G.add(g);\n Collections.shuffle(G);\n }\n for (int o = 61; o <= 75; o++) {\n O.add(o);\n Collections.shuffle(O);\n }\n\n for (int i = 1; i <= 75; i++) {\n roll.add(i); // adds the numbers in the check list\n }\n }", "public ArrayList<RandomItem> getRandomItems();", "public void reproduce(){\n\t\t// sort the population from strongest to weakest\n\t\tCollections.sort(population);\n\t\tCollections.reverse(population);\n\t\t\n\t\tfor(int i = 0; i < (int)(POPULATION_SIZE*POPULATION_ACTION_PERCENT); i+=2){\n\t\t\t\n\t\t\t// get two random indexes for reproduction based on the exponential function\n\t\t\t// (1/1000) * (randInt)^2 = index\n\t\t\t// this function favors sequences with higher fitness scores\n\t\t\tint randIndex1 = randomGenerator.nextInt((int)Math.sqrt(1000*POPULATION_SIZE*(1-POPULATION_ACTION_PERCENT)));\n\t\t\tint randIndex2 = randomGenerator.nextInt((int)Math.sqrt(1000*POPULATION_SIZE*(1-POPULATION_ACTION_PERCENT)));\n\t\t\t\n\t\t\trandIndex1 = (int) (Math.pow(randIndex1, 2) / 1000);\n\t\t\trandIndex2 = (int) (Math.pow(randIndex2, 2) / 1000);\n\t\t\t\n\t\t\t// get two pieces\n\t\t\tBuildingPiece[] array1 = population.get(randIndex1).getList();\n\t\t\tBuildingPiece[] array2 = population.get(randIndex2).getList();\n\t\t\t\n\t\t\t// find a splicing point\n\t\t\tint splicePoint = findSplicingPoint(array1, array2);\n\t\t\t\n\t\t\t// generate two new arrays based on the splicing point\n\t\t\tBuildingPiece[] newArray1 = generateNewArray(array1, array2, splicePoint);\n\t\t\tBuildingPiece[] newArray2 = generateNewArray(array2, array1, splicePoint);\n\t\t\t\n\t\t\t// make new buildings with the new arrays\n\t\t\tBuilding bp1 = new Building(newArray1, generation, possiblePieces);\n\t\t\tBuilding bp2 = new Building(newArray2, generation, possiblePieces);\n\t\t\t\n\t\t\t// mutate the new building sequences\n\t\t\tmutateArray(bp1);\n\t\t\tmutateArray(bp2);\n\t\t\t\n\t\t\t// add them into the population\n\t\t\tpopulation.add(randIndex1, bp1);\n\t\t\tpopulation.add(randIndex2, bp2);\n\t\t}\n\t}", "public Chromosome(ArrayList<Teacher_lesson> list){\n\t\tthis.genes=new int[array_size];\n\t\tRandom r= new Random();\n\t\tfor(int i=0;i<genes.length;i++){\n\t\t\t\n\t\t\tthis.genes[i]=r.nextInt(number_of_professors);\n\t\t}\n\t\tthis.DataList=list;\n\t\tthis.calculateFitness();\n\t}", "public int[] LowerPinrandomGen(int LowerPinnumbers) {\n\t\tint[] LowerPincomboNums = new int[LowerPinnumbers];\n\t\tRandom randVal = new Random();\n\t\t\n\t\t//Create biting numbers\n\t\tfor(int i = 0; i < LowerPinnumbers; i++) {\n\t\t\tLowerPincomboNums[i] = randVal.nextInt(3)+1;\n\t\t}\n\t\t\n\t\t//Return combination\n\t\treturn LowerPincomboNums;\n\t}", "private void addPowerUps() {\n\t\tfor (int i = 0; i < 4; i++) {\n\n\t\t\tint x = (int) (Math.random() * 10);\n\t\t\tint y = (int) (Math.random() * 10);\n\n\t\t\twhile (pgrid[x][y] != 0) { // prevents overlaps\n\t\t\t\tx = (int) (Math.random() * 10);\n\t\t\t\ty = (int) (Math.random() * 10);\n\t\t\t}\n\n\t\t\tpgrid[x][y] = 2;\n\t\t}\n\t}", "public Chromosone() {\n Random rand = new Random();\n for(int i=0;i<=75;i++)\n {\n int rnd = rand.nextInt(2);// [1,0...]\n\n Val.add(rnd);\n }\n }", "public void produceRandomBookList(int numOfBooks) {\n\t\tfor (int i = 0; i < numOfBooks; i++) {\n\t\t\tdouble rand = (Math.random() * bookList.size());\n\t\t\tSystem.out.println(bookList.get((int) rand));\n\t\t}\n\t}", "public void populate(IChunkProvider par1IChunkProvider, int par2, int par3)\n {\n int var4 = par2 * 16;\n int var5 = par3 * 16;\n BiomeGenBase var6 = this.worldObj.getBiomeGenForCoords(var4 + 16, var5 + 16);\n boolean var7 = false;\n this.random.setSeed(this.worldObj.getSeed());\n long var8 = this.random.nextLong() / 2L * 2L + 1L;\n long var10 = this.random.nextLong() / 2L * 2L + 1L;\n this.random.setSeed((long)par2 * var8 + (long)par3 * var10 ^ this.worldObj.getSeed());\n Iterator var12 = this.field_82696_f.iterator();\n int k;\n int l;\n \n Random r = random;\n Chunk c = this.worldObj.getChunkFromChunkCoords(par2, par3);\n ArrayList<Object> var20 = rooms;\n \n for (int i = 1; i < 5; i++)\n {\n k = r.nextInt(23); //# of different rooms to generate\n l = r.nextInt(5); //Chance for boss rooms to generate 1/number specified\n\n if (k > 19 && l != 0 || i > 3) // boss chance\n {\n k = r.nextInt(20);\n }\n\n if (k < 21) //boss rooms have to use world gen while the rest use chunk gen\n {\n \t((DungeonComponentBase)(var20.get(k))).generate(c, r, var4, i * 8, var5);\n }\n else\n {\n \t((WorldGenerator)(var20.get(k))).generate(this.worldObj, r, var4, i * 8, var5);\n }\n }\n DungeonCeiling var21 = ceiling;\n var21.generate(c, r, var4, 40, var5);//80\n }", "public Integer[] createPermutation() {\n Integer[] value = createSortedArray();\n\n for (int c = 0; c < 5; c++) {\n for (int i = 0; i<value.length; i++) {\n int j = (int)(Math.random()*value.length);\n int temp = value[i];\n value[i] = value[j];\n value[j] = temp;\n }\n }\n \n return value;\n }", "private void generateLoot( Integer lootLevel ){\n }", "public void generateRandomMap() {\n\n\t}", "private int randomGen(int upperBound) {\n\t\tRandom r = new Random();\n\t\treturn r.nextInt(upperBound);\n\t}", "public static void generatePopulation() {\n population = setupArray(POP_SIZE, NUM_RULES, GENE_SIZE, COND_LEN);\n\n for (Individual individual : population) {\n for (int i = 0; i < individual.getGene().length; i++) {\n individual.gene[i] = bits.get(new Random().nextInt(2));\n }\n individual.generateRulebase();\n }\n }", "public static void genocide() {\n //Assigns fitness levels\n evaluateFitnesses();\n\n //Sorts by fitness\n sortByFitlvl();\n\n //Simple genocide, kills off all until population size.\n for (int i = Population.size() - 1; i >= populationSize; i--) {\n Population.remove(i);\n }\n\n /*\n //Different kind of Genocide, selects organisms based on gaussian distribution\n\n while(Population.size() > populationSize){\n int randomOrganism = (int)(Population.size() - (Population.size()*Utilities.sharpGauss(2)));\n Population.remove(randomOrganism);\n }\n */\n }", "private void generateCandies(){\n\t\tfor (int i = 0; i < 16; i++){\n\t\t\tint coordX = ThreadLocalRandom.current().nextInt(0, 16);\n\t\t\tint coordY = ThreadLocalRandom.current().nextInt(0, 16);\n\t\t\tCandy candy = new Candy(coordX, coordY, i);\n\t\t\tcandies.put(i, candy);\n\t\t}\n\t}", "public void placeRandomNumbers() {\n\t\t\n\t\tArrayList<HexLocation> locations = getShuffledLocations();\n\t\tint[] possibleNumbers = new int[] {2, 3, 3, 4, 4, 5, 5, 6, 6, 8, 8, 9, 9, 10, 10, 11, 11, 12};\n\t\t\n\t\tfor (int i = 0; i < possibleNumbers.length; i++)\n\t\t\tnumbers.get(possibleNumbers[i]).add(locations.get(i));\n\t}", "private ArrayList<Chromosome> selectParentsRandom() {\n ArrayList<Chromosome> parents = new ArrayList<Chromosome>(Defines.crossoverParentCt);\n\n for (int i = 0; i < Defines.crossoverParentCt; i++) {\n // Generate random index into chromosomes in range [0..size-1]\n int randomParent = Defines.randNum(0, chromosomes.size() - 1);\n // Remember the new parent\n parents.add(chromosomes.get(randomParent));\n }\n return parents;\n }", "public static ArrayList<Integer> genRandomArray(int s) {\n\t\t// TODO Auto-generated method stub\n\t\tArrayList<Integer> R = new ArrayList<Integer>();\n\t\tint i = 0;\n\t\tRandom randNum = new Random();\n\t\tfor (i = 0; i < s; i++) {\n\t\t\tint randNumber = MurmurHash.hashLong(i);\n\t\t\tR.add(randNumber);\n\n\t\t}\n\n\t\treturn R;\n\t}", "protected static ArrayList<String> GenNumber() {\n\n ArrayList<String> initialList = new ArrayList<>();\n\n initialList.add(\"1\"); //Add element\n initialList.add(\"2\");\n initialList.add(\"3\");\n initialList.add(\"4\");\n initialList.add(\"5\");\n initialList.add(\"6\");\n initialList.add(\"7\");\n initialList.add(\"8\");\n initialList.add(\"9\");\n\n Collections.shuffle(initialList); //Random the position\n\n return initialList;\n }", "private double[] generateRandomCoordinates() {\n return generateRandomCoordinates(CoordinateDomain.GEOGRAPHIC, 0.05f);\n }", "private void generateRandomCombination() {\n Random num_generator = new Random();\n\n //First combo number should not be in range -5 to 5.\n int temp_combo_one;\n do {\n temp_combo_one = num_generator.nextInt(40);\n } while (temp_combo_one >= -5 && temp_combo_one <= 5);\n\n //Combo numbers should not repeat\n //Consecutive combo numbers should be separated by ~5 ticks in either direction\n int temp_combo_two;\n do {\n temp_combo_two = num_generator.nextInt(40);\n }\n while (temp_combo_two == temp_combo_one || (temp_combo_two >= temp_combo_one - 5 && temp_combo_two <= temp_combo_one + 5));\n\n //If second combo number is a 0, we don't want the third combo number to be in the 38 to 40 range\n int temp_combo_three;\n do {\n temp_combo_three = num_generator.nextInt(40);\n }\n while (temp_combo_three == temp_combo_one || temp_combo_three == temp_combo_two || (temp_combo_three >= temp_combo_two - 5 && temp_combo_three <= temp_combo_two + 5) || (temp_combo_two == 0 && temp_combo_three >= 38));\n\n current_combination[0] = temp_combo_one;\n current_combination[1] = temp_combo_two;\n current_combination[2] = temp_combo_three;\n\n //Display combination\n String combo_one = Integer.toString(current_combination[0]);\n String combo_two = Integer.toString(current_combination[1]);\n String combo_three = Integer.toString(current_combination[2]);\n\n combo_1.setText(combo_one);\n combo_2.setText(combo_two);\n combo_3.setText(combo_three);\n }", "public TSPChromosome(int size) {\t\n\t\tfor(int g=0; g<size; g++){\n\t\t\tgenes.add(new Integer(-1));\n\t\t}\n\t\tinit();\n\t}", "private void initializeAndShuffle() {\r\n\t\t\tsuffixes = new byte[256];\r\n\t\t\tfor (int i = 0; i < ALL_BYTE_VALUES.length; i++) {\r\n\t\t\t\tint j = RAND.nextInt(i + 1);\r\n\t\t\t\tif (j != i) {\r\n\t\t\t\t\tsuffixes[i] = suffixes[j];\r\n\t\t\t\t}\r\n\t\t\t\tsuffixes[j] = ALL_BYTE_VALUES[i];\r\n\t\t\t}\r\n\t\t}", "public DoubleChromosome(int size) {\t\n\t\tfor(int g=0; g<size; g++){\n\t\t\tgenes.add(random.nextDouble()-0.5);\n\t\t}\n\t\tinit();\n\t}", "public void randomize() {\r\n\t\tRandom random = new Random();// random generator used to get random int\r\n\t\tint r;// will hold the random int\r\n\t\tint num;// will hold the filtered random int that determines with entity to use for a tile\r\n\t\tfor (int i = 0; i < WIDTH_TILES; i++) {// loops x-coords\r\n\t\t\tfor (int j = 0; j < HEIGHT_TILES; j++) {// loops y-coords\r\n\t\t\t\tr = random.nextInt(32);// gets random int from 0 to 32\r\n\t\t\t\tif (r < 4) num = 0; else if (r < 8) num = 1; else if (r < 31) num = 2; else num = 3;// distributes different objects\r\n\t\t\t\tif (nodes[i * WIDTH_TILES + j].isOccupied() == false) {// if tile empty or random chosen\r\n\t\t\t\t\tnodes[i * WIDTH_TILES + j] = new Node(new Point(i * BOARD_WIDTH / WIDTH_TILES, j * BOARD_WIDTH / HEIGHT_TILES), new ImageIcon(icons[num]).getImage(), true, occupants[num]);// creates random tile\r\n\t\t\t\t}// if (random)\r\n\t\t\t}// for (j)\r\n\t\t}// for (i)\r\n\t}", "private short[] makeRandomArray(Random r) {\n short[] array = new short[r.nextInt(100)];\n for (int j = 0; j < array.length; j++) {\n array[j] = (short) r.nextInt();\n }\n return array;\n }", "public List<IrregularVerb> getRandomVerbs(int count);", "private static ArrayList<Chromosome> generateNearestNeighbourPopulation(int pathLength, int nnPopulationSize){\n // declaring the arraylist of chromosomes which will store the\n ArrayList<Chromosome> nnPopualtion = new ArrayList<>();\n\n // declaring a set which will contain all the starting cities that will be used for the population\n Set<Integer> startingCities = new HashSet<>();\n // initialising the set of startingCities with random cities. It being a set no duplicates are allowed\n while (startingCities.size() < nnPopulationSize) {\n startingCities.add(ThreadLocalRandom.current().nextInt(0, pathLength));\n }\n\n // An ArrayList with all the cityIDs which can be copied to keep track of visited/unvisited cities\n ArrayList<Integer> cities = new ArrayList<>();\n for (int i = 0; i < pathLength; i++) {\n cities.add(i);\n }\n\n // for every starting city\n for (Integer startingCity : startingCities) {\n // set the currentCity as the Starting City\n int currentCity = startingCity;\n // Declare a new chromosome to store this new path\n Chromosome chromosome = new Chromosome(pathLength);\n // Set the first city in the path as the startingCity\n chromosome.path[0] = startingCity;\n\n // Declare a new Set of unvisitedCities, and initialise it as a copy of the ArrayList of cityIDs\n Set<Integer> unvisitedCities = new HashSet<>(cities);\n // remove the startingCity from the set of unvisitedCities\n unvisitedCities.remove(startingCity);\n\n // for the length of the path\n for (int i = 1; i < pathLength; i++) {\n // initially set the closestCity to a random city from the set of unvisitedCities\n int closestCity = unvisitedCities.iterator().next();\n // loop through every unvisitedCity to find the closestCity\n for (Integer city : unvisitedCities) {\n // if the distance between the currentCity and the unvisitedCity is < the distance between\n // the currentCity and the closestCity\n if (distanceMatrix[currentCity][city] < distanceMatrix[currentCity][closestCity]) {\n // set thet unvisitedCity as the closestCity\n closestCity = city;\n }\n }\n // add the closestCity as the next city in the path\n chromosome.path[i] = closestCity;\n // make the currentCity for the next iteration the current closestCity\n currentCity = closestCity;\n // remove the closestCity from the set of unvisitedCities\n unvisitedCities.remove(closestCity);\n }\n\n // add the generated chromosome to the ArrayList of the initial nnPopulation\n nnPopualtion.add(chromosome);\n }\n\n return nnPopualtion;\n }", "public void generatePlate(){\r\n\t\tfor(int i = 0; i<3; i++){ // Using math random to generate three upper case letter \r\n\t\t\tSystem.out.print((char)((int)'A'+Math.random()*((int)'Z'-(int)'A'+1)));\r\n\t\t}\r\n\t\tSystem.out.print(\"-\");\r\n\t\tfor(int i=0; i<4; i++){ // using math random to generate four integers\r\n\t\t\tSystem.out.print((int)(Math.random()*10));\r\n\t\t}\r\n\t}", "@Override\n public void randomize(int randomSeed) {\n Random rand = new Random(randomSeed);\n for(int j = size - 1; j > 0; j --){\n int randIndex = rand.nextInt(j);\n \n int [] tmp = data[randIndex];\n data[randIndex] = data[j];\n data[j] = tmp;\n \n int tmpl = labels[randIndex];\n labels[randIndex] = labels[j];\n labels[j] = tmpl;\n \n float tmpw = weights[randIndex];\n weights[randIndex] = weights[j];\n weights[j] = tmpw;\n }\n }", "public Position sampleRandomUniformPosition();", "public void reproduce(int generation, IPopulation pop, List<ISpecies> sorted_species) {\n\t\tfor(ISpecies specie : sorted_species){\r\n\r\n\t\t\tList<IOrganism> organisms = specie.getOrganisms();\r\n\r\n\t\t\t// outside the species\r\n\t\t\tint orgnum = 0;\r\n\r\n\t\t\tIOrganism mom = null;\r\n\t\t\tIOrganism baby = null;\r\n\t\t\tIGenome new_genome = null;\r\n\t\t\tIOrganism _organism = null;\r\n\t\t\tIOrganism _dad = null;\r\n\r\n\t\t\tif (specie.getExpectedOffspring() > 0 && organisms.size() == 0)\r\n\t\t\t\treturn;\r\n\r\n\t\t\t// elements for this species\r\n\t\t\tint poolsize = organisms.size() - 1;\r\n\r\n\t\t\t// the champion of the 'this' species is the first element of the species;\r\n\t\t\tIOrganism thechamp = organisms.get(0);\r\n\t\t\tboolean champ_done = false; // Flag the preservation of the champion\r\n\r\n\t\t\t// Create the designated number of offspring for the Species one at a time.\r\n\t\t\tfor (int count = 0; count < specie.getExpectedOffspring(); count++) {\r\n\r\n\t\t\t\t// If we have a super_champ (Population champion), finish off some special clones.\r\n\t\t\t\tif (thechamp.getSuperChampOffspring() > 0) {\r\n\r\n\t\t\t\t\t// save in mom current champ;\r\n\t\t\t\t\tmom = thechamp;\r\n\t\t\t\t\t// create a new genome from this copy\r\n\t\t\t\t\tnew_genome = mom.getGenome().duplicate(count);\r\n\t\t\t\t\tif ((thechamp.getSuperChampOffspring()) > 1) {\r\n\t\t\t\t\t\tif (RandomUtils.randomDouble() < .8 || evolutionParameters.getDoubleParameter(MUTATE_ADD_LINK_PROB) == 0.0)\r\n\t\t\t\t\t\t\tevolutionStrategy.getMutationStrategy().mutateLinkWeight(new_genome, evolutionParameters.getDoubleParameter(WEIGHT_MUT_POWER), 1.0, MutationType.GAUSSIAN);\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t// Sometimes we add a link to a superchamp\r\n\t\t\t\t\t\t\tnew_genome.generatePhenotype(generation);\r\n\t\t\t\t\t\t\tevolutionStrategy.getMutationStrategy().mutateAddLink(new_genome,pop);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation);\r\n\t\t\t\t\tthechamp.incrementSuperChampOffspring();\r\n\t\t\t\t} // end population champ\r\n\r\n\t\t\t\t// If we have a Species champion, just clone it\r\n\t\t\t\telse if ((!champ_done) && (specie.getExpectedOffspring() > 5)) {\r\n\t\t\t\t\tmom = thechamp; // Mom is the champ\r\n\t\t\t\t\tnew_genome = mom.getGenome().duplicate(count);\r\n\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation); // Baby is\r\n\t\t\t\t\t// just like mommy\r\n\t\t\t\t\tchamp_done = true;\r\n\r\n\t\t\t\t} else if (RandomUtils.randomDouble() < evolutionParameters.getDoubleParameter(MUTATE_ONLY_PROB) || poolsize == 1) {\r\n\r\n\t\t\t\t\t// Choose the random parent\r\n\t\t\t\t\torgnum = RandomUtils.randomInt(0, poolsize);\r\n\t\t\t\t\t_organism = organisms.get(orgnum);\r\n\t\t\t\t\tmom = _organism;\r\n\t\t\t\t\tnew_genome = mom.getGenome().duplicate(count);\r\n\r\n\t\t\t\t\t// Do the mutation depending on probabilities of various mutations\r\n\t\t\t\t\tevolutionStrategy.getMutationStrategy().mutate(new_genome,pop,generation);\r\n\r\n\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation);\r\n\t\t\t\t}\r\n\t\t\t\t// Otherwise we should mate\r\n\t\t\t\telse {\r\n\t\t\t\t\t// Choose the random mom\r\n\t\t\t\t\torgnum = RandomUtils.randomInt(0, poolsize);\r\n\t\t\t\t\t_organism = organisms.get(orgnum);\r\n\r\n\t\t\t\t\t// save in mom\r\n\t\t\t\t\tmom = _organism;\r\n\t\t\t\t\t// Choose random dad...\r\n\t\t\t\t\t// Mate within Species\r\n\t\t\t\t\tif (RandomUtils.randomDouble() > evolutionParameters.getDoubleParameter(INTERSPECIES_MATE_RATE)) {\r\n\t\t\t\t\t\torgnum = RandomUtils.randomInt(0, poolsize);\r\n\t\t\t\t\t\t_organism = organisms.get(orgnum);\r\n\t\t\t\t\t\t_dad = _organism;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// Mate outside Species\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\t// save current species\r\n\t\t\t\t\t\tISpecies randspecies = specie;\r\n\t\t\t\t\t\t// Select a random species\r\n\t\t\t\t\t\tint giveup = 0;\r\n\t\t\t\t\t\t// Give up if you can't find a different Species\r\n\t\t\t\t\t\twhile ((randspecies == specie) && (giveup < 5)) {\r\n\r\n\t\t\t\t\t\t\t// Choose a random species tending towards better species\r\n\t\t\t\t\t\t\tdouble randmult = Math.min(1.0, RandomUtils.randomGaussian() / 4);\r\n\r\n\t\t\t\t\t\t\t// This tends to select better species\r\n\t\t\t\t\t\t\tint sp_ext = Math.max(0, (int) Math.floor((randmult * (sorted_species.size() - 1.0)) + 0.5));\r\n\t\t\t\t\t\t\trandspecies = sorted_species.get(sp_ext);\r\n\t\t\t\t\t\t\t++giveup;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t_dad = randspecies.getOrganisms().get(0);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tnew_genome = evolutionStrategy.getCrossoverStrategy().performCrossover(mom,_dad,count);\r\n\r\n\t\t\t\t\t// Determine whether to mutate the baby's Genome\r\n\t\t\t\t\t// This is done randomly or if the mom and dad are the same organism\r\n\t\t\t\t\tif (RandomUtils.randomDouble() > evolutionParameters.getDoubleParameter(MATE_ONLY_PROB) || \r\n\t\t\t\t\t\t\t_dad.getGenome().getId() == mom.getGenome().getId() || \r\n\t\t\t\t\t\t\t_dad.getGenome().compatibility(mom.getGenome()) == 0.0) {\r\n\r\n\t\t\t\t\t\tevolutionStrategy.getMutationStrategy().mutate(new_genome,pop,generation);\r\n\t\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation);\r\n\t\t\t\t\t} \r\n\t\t\t\t\t// end block of prob\r\n\t\t\t\t\t// Determine whether to mutate the baby's Genome\r\n\t\t\t\t\t// This is done randomly or if the mom and dad are the same organism\r\n\r\n\t\t\t\t\t// Create the baby without mutating first\r\n\t\t\t\t\telse \r\n\t\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation);\r\n\t\t\t\t}\r\n\t\t\t\tevolutionStrategy.getSpeciationStrategy().addOrganismToSpecies(pop, baby);\r\n\t\t\t} // end offspring cycle\r\n\t\t}\r\n\t}", "public void initialiseNewRandomPopulation(Random rnd) {\n\t\tthis.population = new ArrayList<Individual>();\n\t\tfor (int i = 0; i < this.popSize; i++) {\t\t\t\t\t//FOR ALL DESIRED POPULATION SIZE\n\t\t\tdouble[] randomValues = new double[DIMENSIONS];\t\t\t//INITIATE RANDOM X ARRAY WITH CORRECT DIMENSIONS\n\t\t\tfor (int j = 0; j < DIMENSIONS; j++) {\t\t\t\t\t//CREATE RANDOM X VALUES\n\t\t\t\trandomValues[j] = -5 + rnd.nextDouble() * 10;\t\t//ASSIGN VALUES TO EACH POSITION IN ARRAY\n\t\t\t}\n\t\t\tIndividual newInd = new Individual(randomValues);\t\t//CREATE NEW INDIVIDUAL WITH RANDOM X VALUES\n\t\t\tthis.population.add(newInd);\t\t\t\t\t\t\t//ADD INDIVIDUAL TO POPULATION\n\t\t}\n\t}", "void pluck()\n\t{\n\t\tfor(int i = 0; i < rb.length(); i++)\n\t\t{\n\t\t\tdouble random = (Math.random() - 0.5) * AMPLITUDE; //[-0.5,0.5)\n\t\t\trb.dequeue();\n\t\t\trb.enqueue(random);\n\t\t}\n\t}", "private static void generaGrupos(PrintWriter salida_grupos, PrintWriter salida_musicos, PrintWriter salida_discos, PrintWriter salida_canciones){\r\n boolean flagm = true;//Indica si el nº de integrantes de a es 10 para contrarestar en la siguiente generación\r\n int a, b;\r\n String nombre = \"nombre\";\r\n String titulo = \"www.web\";\r\n String dominio = \".com\";\r\n \r\n for (long i = 1; i <= num_grupos; i++){\r\n //Calculamos el numero de integrantes que tendrán los dos grupos que se generarán por loop\r\n // si el anterior loop no se han superado los 10 integrantes en la suma de a y b,\r\n // se permitirá la generación de 10 integrantes en el grupo a\r\n // si en el anterior loop se han generado en uno de los grupos 10 integrantes\r\n // debemos reducir el numero para contrarestar en este loop,\r\n // de forma que resulte una generación aleatoria dentro de los límites pedidos\r\n if (flagm){\r\n a = rand.nextInt(10) + 1;\r\n b = 10 - a;\r\n } else {\r\n a = rand.nextInt(8) + 1;\r\n b = 9 - a;\r\n flagm = true;\r\n }\r\n if (b == 0){ b++; flagm = false;}\r\n \r\n //Grupo A del loop\r\n salida_grupos.println(cod_grupo + \",\" + nombre + cod_grupo + \",\"\r\n + genero.getGenero() + \",\" + rand.nextInt(paises.length)\r\n + \",\" + titulo + cod_grupo + dominio);\r\n generaMusicos(salida_musicos, cod_grupo, a);\r\n generaDiscos(salida_discos, salida_canciones, cod_grupo);\r\n \r\n //Aumento de las variables usadas\r\n i++; cod_grupo++;\r\n //Grupo B del loop\r\n salida_grupos.println(cod_grupo + \",\" + nombre + cod_grupo + \",\"\r\n + genero.getGenero() + \",\" + rand.nextInt(paises.length)\r\n + \",\" + titulo + cod_grupo + dominio);\r\n generaMusicos(salida_musicos, cod_grupo, b);\r\n generaDiscos(salida_discos, salida_canciones, cod_grupo);\r\n \r\n cod_grupo++;\r\n }\r\n }", "public Set<Integer> generateLotteryNumbers ()\n {\n\t Set<Integer> randomGenerator = new HashSet<Integer>(6); \n\t Random randomnum = new Random();\n\t \n\t\n\n\t \n\t for (Integer i=0; i<6;i++) \n\t {\n\t\t //keep looping until able to add a add number into a set that does not not exist and is between 1 and49\n\t\t \n\t\t while (randomGenerator.add(1+randomnum.nextInt(49)) == false) {\n\t\t\t \n\t\t\t\n\t\t }\n\t\t \n\n\t }\n\t \n\t \n\t \n return randomGenerator;\n \n }", "public static ArrayList<Integer> barajar(int n){\n ArrayList<Integer> orden = new ArrayList<>();\n Random r = new Random();\n int ng;\n for(int i=0;i<n;i++){\n ng = r.nextInt(n);\n if(!orden.contains(ng)){\n orden.add(ng);\n }\n else{\n i--;\n }\n }\n return orden;\n }", "private ArrayList<Attribute> getRandomFeatures(int featuresCount, ArrayList<Attribute> features) {\n ArrayList<Attribute> featuresSubset = new ArrayList<>(featuresCount);\n //initialize list with indexes\n ArrayList<Integer> featuresIndexes = new ArrayList<>(features.size());\n for (int i = 0; i < features.size(); i++) {\n featuresIndexes.add(i);\n }\n \n //mix indexes and pick first m indexes\n Collections.shuffle(featuresIndexes, new Random());\n int featureIndex;\n for (int i = 0; i < featuresCount; i++) {\n featureIndex = featuresIndexes.get(i);\n featuresSubset.add(features.get(featureIndex));\n }\n \n return featuresSubset;\n }", "public void shuffle()\r\n/* 18: */ {\r\n/* 19:41 */ for (int i = 0; i < this.pop.size(); i++)\r\n/* 20: */ {\r\n/* 21:43 */ Cluster c = (Cluster)this.pop.elementAt(i);\r\n/* 22:44 */ g.setClusters(c.getClusterVector());\r\n/* 23:45 */ g.shuffleClusters();\r\n/* 24:46 */ c.setClusterVector(g.getClusters());\r\n/* 25:47 */ c.setConverged(false);\r\n/* 26: */ }\r\n/* 27: */ }", "private int[] generateRandomHourlyVolume(int length, int upperBound, int seed) {\n Random random = new Random(seed);\n int[] hourlyVolume = new int[length];\n for (int i = 0; i < length; i++) {\n hourlyVolume[i] = random.nextInt(upperBound);\n }\n return hourlyVolume;\n }", "public void initializePopulation(){\n\t\t// create the population\n\t\tfor(int i = 0; i < POPULATION_SIZE; i++){\n\t\t\t// get a random length for the building sequence\n\t\t\tint randArraySize = randomGenerator.nextInt(possiblePieces.length-1)+1;\n\t\t\t\n\t\t\tBuildingPiece[] pieceSequence = new BuildingPiece[randArraySize];\n\t\t\tfor(int j = 0; j < randArraySize; j++){\n\t\t\t\t// get a random possible piece and insert it into the sequence\n\t\t\t\tint randIndex = randomGenerator.nextInt(possiblePieces.length);\n\t\t\t\tpieceSequence[j] = possiblePieces[randIndex];\n\t\t\t}\n\t\t\t\n\t\t\t/* add a new number sequence with the newly created \n\t\t\t * sequence from the input */\n\t\t\tpopulation.add(new Building(pieceSequence, generation, possiblePieces));\n\t\t}\n\t}", "public static int[] generateRandomArray(){\n return new Random().ints(0, 100000)\n .distinct()\n .limit(1000).toArray();\n }", "public static void main(String[] args) {\n\t\tRandom r = new Random(47);\n\t\tBerylliumSphere[] spheres = \n\t\t\t\tGenerated.array(BerylliumSphere.class, new BSGenerator(), 10);\n\t\tCollections.shuffle(Arrays.asList(spheres), r);\n\t\tSystem.out.println(\"Not comparable BS:\");\n\t\tSystem.out.println(Arrays.toString(spheres));\n\t\ttry {\n\t\t\tArrays.sort(spheres);\n\t\t} catch(Exception e) {\n\t\t\tSystem.out.println(\"BerylliumSphere is not sortable!\");\n\t\t\tSystem.out.println(e + \"\");\n\t\t}\n\t\tComparableBerylliumSphere[] comparableSpheres = new ComparableBerylliumSphere[10];\n for(int i = 0; i < 10; i++)\n \tcomparableSpheres[i] = new ComparableBerylliumSphere();\n Collections.shuffle(Arrays.asList(comparableSpheres), r);\n\t\tSystem.out.println(\"Before sorting for comparable BS:\");\n\t\tSystem.out.println(Arrays.toString(comparableSpheres));\n\t\tArrays.sort(comparableSpheres);\n\t\tSystem.out.println(\"After sorting for comparable BS:\");\n\t\tSystem.out.println(Arrays.toString(comparableSpheres));\n\t}", "static int [] rand (int [] m) {\r\n\t\tint [] massive = new int [m.length];\r\n\t\tfor (int i = 0; i < (m.length-1); i++) {\r\n\t\t\tmassive [i] = (int) Math.round( (Math.random() * 100));\r\n\t\t\tSystem.out.print(massive [i] + \" \");\r\n\t\t}\r\n\t\tSystem.out.println();\r\n\t\treturn massive;\r\n\t}", "public ArrayList<PuzzleState> getRandomNeighbors() {\n\t\tArrayList<PuzzleState> ns = getNeighbors();\n\t\tCollections.shuffle(ns);\n\t\treturn ns;\t\n\t}", "public static void breedAll() {\n int a, b; //Pointers to select parents\n\n //While loop to ensure full carrying capacity of population\n while (Population.size() <= maxPop) {\n //Sorts by Fitness level first\n sortByFitlvl();\n\n //Selects Two Random Parents\n a = (int) (Math.abs(Utilities.sharpGauss(4)) * Population.size());\n b = (int) (Math.abs(Utilities.sharpGauss(4)) * Population.size());\n //System.out.println(a+\"\\t\"+b+\"\\t\"+Population.size());\n\n // Between 1-2 children\n int children = rand.nextInt(2)+1;\n for (int i = 0; i < children; i++) {\n Population.add(Breeder.breed(Population.get(a), Population.get(b), 0.1));\n }\n\n //sortByFitlvl();\n }\n\n if (debug)\n printPopulation(true);\n }", "public int[] randomize(int inputSize){\n int[] list = new int[inputSize];\n for(int i = 0; i < inputSize; i++){\n // generate numbers within absolute range of input size to increase the chance to get distinct elements\n list[i] = ThreadLocalRandom.current().nextInt(0, inputSize + 1);\n }\n// System.out.println(Arrays.toString(list));\n return list;\n }", "public abstract void initiateRandomCells(double probabilityForEachCell);", "public void pullPlayerTiles() {\r\n\t\tRandom r = new Random();\r\n\t\tfor (int i=0; i < 7; i++) {\r\n\t\t\tint random = r.nextInt(Launch.getBoneyard().size());\r\n\t\t\t//System.out.println(\"[debug] random = \"+random);\r\n\t\t\t//System.out.println(\"[debug] index\"+random+\" in BONEYARD = \"+Arrays.toString(Launch.BONEYARD.get(random).getDots()));\r\n\t\t\tif (Utils.isSet(Launch.getBoneyard(), random)) {\r\n\t\t\t\tPLAYER_DOMINOS.add(Launch.getBoneyard().get(random));\r\n\t\t\t\tLaunch.getBoneyard().remove(random);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void genRand(int n) {\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\tm[i][j] = rand.nextInt(10);\n\t\t\t}\n\t\t}\n\t}", "public static Collection<Item> generateItems(int numberOfItems) {\n Random r = new Random(97);\n if (numberOfItems > 0) {\n Collection<Item> gameItems = new Stack<>();\n int power;\n for (int i = 0; i < numberOfItems; i++) {\n\n switch (ItemType.random()) {\n case HEALTH_POTION:\n power = (r.nextInt(3) + 1) * 100;\n gameItems.add(new HealthPotion(\"HealthPotion (\" + power + \")\", power));\n break;\n case POISON:\n power = (r.nextInt(8) + 1) * 20;\n gameItems.add(new Poison(\"Poison (\" + power + \")\", power));\n break;\n case ARMOR:\n power = (r.nextInt(6) + 1) * 10;\n gameItems.add(new Armor(\"Armor (\" + power + \")\", power));\n break;\n case WEAPON:\n power = (r.nextInt(7) + 1) * 10;\n gameItems.add(new Weapon(\"Weapon (\" + power + \")\", power));\n break;\n default:\n break;\n }\n }\n return gameItems;\n }\n return null;\n }", "public ArrayList<Integer> generateWinner() {\n if (winner.size() == 7) {\n if (!sorted) {\n Collections.sort(winner);\n sorted = true;\n }\n return winner;\n }\n if (numbers.size() == 32 || winner.size() != 0) {\n init();\n }\n\n for (int i = 0; i < 7; i++) {\n winner.add(numbers.get(random.nextInt(numbers.size())));\n numbers.remove(winner.get(i));\n }\n Collections.sort(winner);\n return winner;\n }", "public void createPowerUps (int low, int high, int h, int w) {\n int num = (int) (random (low, high + 1));\n for (int i = 0; i < num; i++) {\n int x = ((int) random((width/pixelSize))) * pixelSize;\n int y = ((int) random((height-topHeight)/pixelSize)) * pixelSize + topHeight;\n if (getLocation(x, y).getType() == LocationType.AIR) {\n powerUps.add (new PowerUp (x, y, w, h));\n }\n }\n}", "private int generateRandomNumber() {\n\t\treturn new SplittableRandom().nextInt(0, 3);\n\t}", "ArrayList<ArrayList<Vertex>> generateInitVertices() {\n ArrayList<ArrayList<Vertex>> vertices = new ArrayList<ArrayList<Vertex>>();\n for (int x = 0; x < width; x++) {\n ArrayList<Vertex> temp = new ArrayList<Vertex>();\n for (int y = 0; y < height; y++) {\n temp.add(new Vertex(x, y));\n }\n vertices.add(temp);\n }\n Random r = new Random();\n for (ArrayList<Vertex> vList : vertices) {\n for (Vertex v : vList) {\n if (v.x != 0) {\n v.outEdges.add(new Edge(v, vertices.get(v.x - 1).get(v.y), r.nextInt(1000)));\n }\n if (v.x != width - 1) {\n v.outEdges.add(new Edge(v, vertices.get(v.x + 1).get(v.y), r.nextInt(1000)));\n }\n if (v.y != 0) {\n v.outEdges.add(new Edge(v, vertices.get(v.x).get(v.y - 1), r.nextInt(1000)));\n }\n if (v.y != height - 1) {\n v.outEdges.add(new Edge(v, vertices.get(v.x).get(v.y + 1), r.nextInt(1000)));\n }\n }\n }\n return vertices;\n }", "private static byte[] generateCompressibleBytes(Random random, int minSize, int maxSize) {\n if (maxSize < minSize) {\n throw new IllegalArgumentException();\n }\n int size = minSize + random.nextInt(maxSize - minSize);\n byte[] output = new byte[size];\n byte[] oneByte = new byte[1];\n int remaining = size;\n int position = 0;\n while (remaining > 0) {\n int sequenceSize = 1 + random.nextInt(10); //[1-10]\n if (sequenceSize > remaining) {\n sequenceSize = remaining;\n }\n random.nextBytes(oneByte);\n for (int i = 0; i < sequenceSize; i++) {\n output[position++] = oneByte[0];\n }\n remaining -= sequenceSize;\n }\n return output;\n }", "Chromosome fittestChromosome();", "public static void main(String[] args) {\n\t\tint p_numbers = 3; // Partition Numbers\r\n\t int p_size = 5;\r\n\t int z_exponent = 1;\t \t \t \t \r\n\t int d = 0;\r\n\t int d_start = 0;\r\n\t int d_end = p_size;\r\n\t double mu = 0.0;\r\n\t double sigma = 1.0;\r\n\t double z, c, c_rand, n;\r\n\t\t\t \t \r\n\t ZipfDistribution zipf;\t// Parameters = Number of Elements, Exponent \t\t \t \t \t \t \t \r\n\t RandomDataGenerator randData = new RandomDataGenerator();\r\n\t RandomDataGenerator rand = new RandomDataGenerator();\r\n\t rand.reSeed(0);\r\n\t \r\n\t for(int p = 0; p < p_numbers; p++) {\r\n\t \tzipf = new ZipfDistribution(p_size, z_exponent); \r\n\t \tzipf.reseedRandomGenerator(p);\r\n\t \trandData.reSeed(p);\t\t \r\n\t \t\r\n\t \tfor(d = d_start; d < d_end; d++) {\r\n\t \t\tz = randData.nextZipf(p_size, z_exponent);\r\n\t \t\tz += d_start;\r\n\t \t\t\r\n\t \t\tif(z > d_end) z -= 1;\r\n\t \t\t\r\n\t \t\tc = zipf.cumulativeProbability((d - d_start));\r\n\t \t\tc_rand = zipf.cumulativeProbability(((int)z - d_start));\r\n\t \t\t\r\n\t \t\t//n = rand.nextGaussian(mu, sigma);\r\n\t \t\tn = rand.nextUniform(0.0, 1.0);\r\n\t\t \r\n\t\t \tSystem.out.println(p+\" \"+d+\" \"+c+\" \"+(int)z+\" \"+c_rand+\" \"+n);\r\n\t \t}\r\n\t \t\r\n\t \td_start = d_end;\r\n\t \td_end = (d + p_size);\t \t\r\n\t }\t \r\n\t}", "private RandomLocationGen() {}", "ArrayList<ArrayList<Cell>> randomCells(ArrayList<ArrayList<Cell>> c) {\n ArrayList<ArrayList<Cell>> result1 = new ArrayList<ArrayList<Cell>>();\n for (int i = 0; i < c.size(); i = i + 1) {\n ArrayList<Cell> result = new ArrayList<Cell>();\n for (int j = 0; j < c.get(i).size(); j = j + 1) {\n double height = heights().get(i).get(j);\n Cell a = c.get(i).get(j);\n if (height <= 0.0) {\n result.add(a);\n }\n else {\n a.height = new Random().nextInt(ForbiddenIslandWorld.ISLAND_SIZE / 2) + 1 * 1.0;\n result.add(a);\n }\n }\n result1.add(result);\n }\n return result1;\n }", "private Countable[] generateArray(int rank){\n var numbers = new Countable[rank];\n for (int i = 0; i < rank; i++) {\n numbers[i] = getRandomCountable();\n }\n return numbers;\n }", "public static ArrayList<Individuo> mutaHeuristica(ArrayList<Individuo> genAnt,int nB){\n ArrayList<Individuo> aux = genAnt;\n ArrayList<Integer> genesS = new ArrayList<>();\n int nM = (int) (genAnt.size()*0.2); //determina cuantos individuos van a ser mutados\n int iS,gS,i=0,n,c;\n byte gaux[],baux;\n Random r = new Random();\n while(i<nM){\n gS = r.nextInt(nB+1);//selecciona el numero de genes aleatoriamente\n iS = r.nextInt(genAnt.size());//selecciona un individuo aleatoriamente\n gaux = aux.get(iS).getGenotipo();//obtenemos genotipo de ind seleccionado\n c=0;\n System.out.println(gS);\n //seleccionamos genes a ser permutados\n while(c != gS){\n n = r.nextInt(nB);\n if(!genesS.contains(n)){\n genesS.add(n);\n System.out.print(genesS.get(c)+\" \");\n c++;\n }\n }\n System.out.println(\"\");\n //aux.remove(iS);//quitamos elemento\n //aux.add(iS, new Individuo(gaux,genAnt.get(0).getTipoRepre()));//añadimos elemento mutado\n i++;\n }\n return aux;\n }", "private static ArrayList<Chromosome> generatePopulation(ArrayList<City> cities, int pathLength, int populationSize) {\n // generating part of the initial population using a Nearest Neighbour Algorithm\n int nnPopulationSize = (int) (0.1*populationSize);\n // if the required number of chromosomes to be generated by the NN Algorithm is greater then the number of cities\n // then set the required number of chromosomes to the number of cities\n if (nnPopulationSize > cities.size()) {\n nnPopulationSize = cities.size();\n }\n ArrayList<Chromosome> nnPopulation = generateNearestNeighbourPopulation(pathLength, nnPopulationSize);\n\n // generating the rest of the initial population randomly\n int randomPopulationSize = populationSize - nnPopulationSize;\n ArrayList<Chromosome> randomPopulation = new ArrayList<>();\n randomPopulation.addAll( generateRandomPopulation(pathLength, randomPopulationSize) );\n\n // Combining the 2 parts of the population into one initial population\n ArrayList<Chromosome> population = new ArrayList<>();\n population.addAll(nnPopulation);\n population.addAll(randomPopulation);\n\n return population;\n }", "private void generateCombination() {\r\n\r\n\t\tfor (byte x = 0; x < field.length; x++) {\r\n\t\t\tfor (byte y = 0; y < field[x].length; y++) {\r\n\t\t\t\tfield[x][y].setValue((byte) newFigure(Constants.getRandom()));\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private void randomPosBoats(GameData gameData) {\n int x0 = 0;\n int y0 = 0;\n for ( int n = gameData.getBoatArray().size()-1; n>=0; n--){\n Boat b = gameData.getBoatArray().get(n);\n Random rand = new Random();\n int l = b.getLength();\n\n boolean retry = true;\n while(retry) {\n int direction = rand.nextInt(2);\n\n //HORIZONTAL\n if (direction == 1) {\n x0 = rand.nextInt(gameData.getBoard().getWidth() - l);\n y0 = rand.nextInt(gameData.getBoard().getHeight());\n\n // we suppose it's a good starting point\n retry = false;\n for (int i = 0; i < l; i++) {\n //if one of the tiles already has a boat\n if (gameData.existsBoatAround(x0 + i, y0)) {\n retry = true;\n }\n }\n //POSITION BOAT\n if (!retry) {\n ArrayList pos = new ArrayList();\n for (int i = 0; i < l; i++) {\n int x = x0 + i;\n gameData.getMatrix()[y0][x] = b.getBoatid();\n pos.add(new int[]{x, y0});\n }\n b.setPositions(pos);\n }\n\n //VERTICAL\n } else {\n // determine the tile on which to start\n x0 = rand.nextInt(gameData.getBoard().getWidth());\n y0 = rand.nextInt(gameData.getBoard().getHeight() - l);\n\n // we suppose it's a good starting point\n retry = false;\n for (int i = 0; i < l; i++) {\n if (gameData.existsBoatAround(x0, y0 + i)) {\n retry = true;\n }\n }\n if(!retry){\n ArrayList pos = new ArrayList();\n for (int i = 0; i < l; i++) {\n int y = y0 + i;\n gameData.getMatrix()[y][x0] = b.getBoatid();\n pos.add(new int[]{x0, y});\n }\n b.setPositions(pos);\n }\n }\n }\n }\n }", "protected void placeAllShipsRandomly(){\n ArrayList<Ship> shipArrayList = initiateShips();\n Random random = new Random();\n int row;\n int col;\n boolean orientation;\n //place battleship first\n for (Ship ship: shipArrayList){\n row = random.nextInt(10);\n col = random.nextInt(10);\n orientation = random.nextBoolean();\n\n while(!ship.okToPlaceShipAt(row, col, orientation,this)){\n row = random.nextInt(10);\n col = random.nextInt(10);\n orientation = random.nextBoolean();\n }\n\n ship.placeShipAt(row,col,orientation,this);\n }\n\n }", "public void generatePopulation() {\n\t\t\n\t\tif (SCType.getScLayers() <= 2)\n\t\t\tLogger.logError(\"To few supply chain layers, minimum of 3 required:\" + SCType.getScLayers());\n\t\t\n\t\tArrayList<CountryAgent> countryAgents = SU.getObjectsAll(CountryAgent.class);\t\t\n\t\tfor (CountryAgent country : countryAgents) {\n\t\t\t\n\t\t\tif (country.containsSCType(SCType.PRODUCER)) {\n\t\t\t\tfor (int i = 0; i < Constants.N_PRODUCERS; i++) {\n\t\t\t\t\tcountry.spawnAgent(SCType.PRODUCER);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (country.containsSCType(SCType.INTERNATIONAL)) {\n\t\t\t\tfor (int i = 0; i < Constants.N_INTERNATIONALS; i++) {\n\t\t\t\t\tcountry.spawnAgent(SCType.INTERNATIONAL);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (country.containsSCType(SCType.WHOLESALER)) {\n\t\t\t\tfor (int i = 0; i < Constants.N_WHOLESALERS; i++) {\n\t\t\t\t\tcountry.spawnAgent(SCType.WHOLESALER);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (country.containsSCType(SCType.RETAIL)) {\n\t\t\t\tfor (int i = 0; i < Constants.N_RETAILERS; i++) {\n\t\t\t\t\tcountry.spawnAgent(SCType.RETAIL);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (country.containsSCType(SCType.CONSUMER)) {\n\t\t\t\tfor (int i = 0; i < Constants.N_CONSUMERS; i++) {\n\t\t\t\t\tcountry.spawnAgent(SCType.CONSUMER);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Set possible new suppliers and clients\n\t\tfor (BaseAgent agent : SU.getObjectsAll(BaseAgent.class)) {\n\t\t\tagent.setPossibleNewSuppliersAndClients();\n\t\t}\n\t\t\n\t\tSU.getDataCollector().addAllCurrentStock();\n\t}", "@Override\n\tpublic void beginGeneration() {\n\t\tfor(int seqIndex = 0; seqIndex < NUM_SEQUENCES; ++seqIndex) {\n\t\t\tfor(int pieceIndex = 0; pieceIndex < SEQUENCE_LENGTH; ++pieceIndex) {\n\t\t\t\tsequences[seqIndex][pieceIndex] = random.nextInt(State.N_PIECES);\n\t\t\t}\n\t\t}\n\t}", "public void createRandomPorts() {\n\t\t\n\t\tList<String> types = Arrays.asList(new String[] {\"wood\", \"ore\", \"wheat\", \"sheep\", \"brick\", null, null, null, null});\n\t\tCollections.shuffle(types);\n\t\t\n\t\tports[0] = new Port(types.get(0), -3, 2, \"NE\", 2, \"NE\", \"E\");\n\t\tports[1] = new Port(types.get(1), 3, -3, \"SW\", 3, \"SW\", \"W\");\n\t\tports[2] = new Port(types.get(2), 2, 1, \"NW\", 3, \"W\", \"NW\");\n\t\tports[3] = new Port(types.get(3), 0, 3, \"N\", 3, \"NW\", \"NE\");\n\t\tports[4] = new Port(types.get(4), 1, -3, \"S\", 2, \"SE\", \"SW\");\n\t\tports[5] = new Port(types.get(5), -1, -2, \"S\", 2, \"SE\", \"SW\");\n\t\tports[6] = new Port(types.get(6), 3, -1, \"NW\", 2, \"W\", \"NW\");\n\t\tports[7] = new Port(types.get(7), -2, 3, \"NE\", 2, \"NE\", \"E\");\n\t\tports[8] = new Port(types.get(8), -3, 0, \"SE\", 3, \"E\", \"SE\");\n\t}", "public void posiziona_bersaglio() {\n do{\n int r = (int) (Math.random() * POSIZIONI_RANDOM);\n bersaglio_x = ((r * DIMENSIONE_PUNTO));\n }while(bersaglio_x<102 || bersaglio_x>LARGHEZZA);\n do{\n int r = (int) (Math.random() * POSIZIONI_RANDOM);\n bersaglio_y = ((r * DIMENSIONE_PUNTO));\n }while(bersaglio_y<102 || bersaglio_y>ALTEZZA);\n //System.out.println (\"x : \"+bersaglio_x+\" y : \"+bersaglio_y);\n }", "@Override\n protected void dropFewItems(boolean hit, int looting) {\n super.dropFewItems(hit, looting);\n for (int i = this.rand.nextInt(2 + looting); i-- > 0;) {\n this.dropItem(Items.ender_pearl, 1);\n }\n }", "public boolean isRandomPerm()\n\t{\n\t\tboolean[] bins = new boolean[arraySize];\n\t\tfor (int index = 0; index < arraySize; index++)\n\t\t{\n\t\t\tbins[index] = false;\n\t\t}\n\t\tfor (int index = 0; index < arraySize; index++)\n\t\t{\n\t\t\tif (bins[array[index] - 1])\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t} \n\t\t\tbins[array[index] - 1] = true;\n\t\t}\n\t\treturn true;\n\t}", "private int[] randPerm( int n ) {\n int[] perm = new int[n];\n for (int k=0; k<n; ++k) perm[k] = k;\n for (int k=n; k>0; --k) {\n int rand = r.nextInt(k);\n int t = perm[rand]; perm[rand] = perm[k-1]; perm[k-1] = t;\n }\n return( perm );\n }" ]
[ "0.6535823", "0.6178639", "0.5969693", "0.5967586", "0.5923473", "0.59186554", "0.5910417", "0.57993424", "0.57911056", "0.5654903", "0.56299746", "0.5600306", "0.5558949", "0.55232745", "0.5516197", "0.55152017", "0.55127954", "0.54670894", "0.54657435", "0.5424318", "0.54111516", "0.54045534", "0.5368365", "0.5365606", "0.53556204", "0.52919227", "0.52918816", "0.52817696", "0.5244718", "0.5241222", "0.52366996", "0.5219096", "0.5215866", "0.52115816", "0.5205435", "0.51995933", "0.51856416", "0.51712066", "0.5169801", "0.5151851", "0.51490664", "0.51411885", "0.51354706", "0.5116339", "0.51157933", "0.50885874", "0.5084141", "0.5083719", "0.50792414", "0.5072605", "0.5069848", "0.505955", "0.50585973", "0.5053841", "0.50485003", "0.50438505", "0.5035625", "0.50334704", "0.5017032", "0.50128865", "0.5011251", "0.49923217", "0.49808872", "0.49634102", "0.49626297", "0.49618885", "0.4960512", "0.49562645", "0.49469298", "0.49416804", "0.49308458", "0.49305195", "0.49231064", "0.49221048", "0.49217525", "0.49183682", "0.49135235", "0.49060285", "0.49053162", "0.4903148", "0.48990083", "0.48913226", "0.488641", "0.48853913", "0.4884607", "0.48844987", "0.48822093", "0.48805296", "0.48762488", "0.48744905", "0.48697376", "0.4868614", "0.48569345", "0.48528722", "0.48430353", "0.48343375", "0.48336032", "0.48327515", "0.4832323", "0.4817166" ]
0.59562445
4
Evaluates fitness of chromosomes, chooses some for breeding (minimization roulette) returns chromosomes that won breeding lottery.
private ArrayList<int[]> selectionRoulette(int[][] chromosomes, float percentToSelect) { ArrayList<int[]> selectedChromosomes = new ArrayList<int[]>(); //sum up fitnesses for population int fitnessSum = 0; for (int[] chromosome : chromosomes) { fitnessSum += getFitness(chromosome); } //minimization problem - invert fitness int invertFitnessSum = 0; for (int[] chromosome : chromosomes) { invertFitnessSum += Math.round((fitnessSum * 1.0) / getFitness(chromosome)); //small fitness values (few bins) are favored } //get fitnesses of chromosomes, save in array to avoid recalculating int[] fitnesses = new int[chromosomes.length]; for (int i = 0; i < chromosomes.length; i++) { fitnesses[i] = (int) Math.round((fitnessSum * 1.0) / getFitness(chromosomes[i])); } //spin the roulette wheel for (int i = 0; i < chromosomes.length * percentToSelect; i++) { int currentFitnessTotal = 0; int fitnessCutoff = rand.nextInt(invertFitnessSum); //where the wheel stops for (int j = 0; j < chromosomes.length; j++) { //go through all chromosomes to see who is selected this spin if (currentFitnessTotal < fitnessCutoff) currentFitnessTotal += fitnesses[j]; if (currentFitnessTotal >= fitnessCutoff) { //if this chromosome pushed us over the edge, save it selectedChromosomes.add(chromosomes[j]); break; } } }//end roulette spinning return selectedChromosomes; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "<T> GeneticResult<T> train(List<Chromosome<T>> chromosomes){\n\t\tGeneticResult<T> bestFit = maxFitness(chromosomes, 0);\n\t\tfor(int i = 0; i < totalBreedings; i++){\n\t\t\tif(bestFit.getFitness() > sufficientFitness){ break ;}\n\t\t\tchromosomes = breedNewGeneration(chromosomes);\n\t\t\tbestFit = maxFitness(chromosomes, i);\n\t\t}\n\t\treturn bestFit;\n\t}", "private <T> GeneticResult<T> maxFitness(List<Chromosome<T>> chromosomes, int totalBreedings){\n\t\tChromosome<T> bestFit = fittestChromosome(chromosomes);\n\t\treturn new GeneticResult<T>(bestFit, bestFit.getFitness(), totalBreedings);\n\t}", "private Chromosome getRouletteChromosome(ArrayList<Chromosome> chroms, double totalFitness){\n double slice = (Math.random()*totalFitness);\n double fitnessSum = 0;\n for(Chromosome c:chroms){\n fitnessSum += c.getFitness();\n if(fitnessSum >= slice){\n return c;\n }\n }\n \n //The total fitness supplied must have been incorrect\n return null;\n }", "private <T> List<Chromosome<T>> breedNewGeneration(List<Chromosome<T>> chromosomes){\n\t\tList<Chromosome<T>> selected = selection.apply(chromosomes);\n\t\tCollections.shuffle(selected);\n\n\t\tList<Chromosome<T>> crossedOver = Lists.newArrayList();\n\t\tfor(int i = 0; i < selected.size(); i+=2){\n\t\t\tChromosome<T>[] bred = crossover.apply(selected.get(i), selected.get(i+1));\n\t\t\tcrossedOver.add(bred[0]);\n\t\t\tcrossedOver.add(bred[1]);\n\t\t}\n\n\t\treturn crossedOver.stream().map(mutation::apply).collect(Collectors.toList());\n\t}", "private static Set<Chromosome> rankBasedRouletteWheelSelection(ArrayList<Chromosome> population, int populationSize) {\n Set<Chromosome> selectedChromosomes = new HashSet<>();\n\n // calculate the sum of all ranks, which will be used as a denominator for all probabilities\n int sumOfRanks = (populationSize + 1) * populationSize / 2;\n\n // declare an array of cumulative probabilities for all the chromosomes in the population\n double[] cumulativeProbability = new double[populationSize];\n // calculate the cumulative probability of the first chromosome as its probability\n cumulativeProbability[0] = (double) populationSize / sumOfRanks;\n // calculate the cumulative probabilities of all successive chromosomes:\n for (int i = 1; i < populationSize; i++) {\n // as the probability of this chromosomes based on its rank\n double probability = (double) (populationSize-i) / sumOfRanks;\n // plus the cumulative proability of the preceeding chromosome\n cumulativeProbability[i] = cumulativeProbability[i-1] + probability;\n }\n\n while (selectedChromosomes.size() < 2) {\n // choose a chromosome randomly based on its cumulative probability (the lower the better)\n double random = ThreadLocalRandom.current().nextDouble();\n int choice = 0;\n while (random > cumulativeProbability[choice]) {\n choice++;\n }\n\n // add the chosen chromosome to the set of selectedChromosomes\n selectedChromosomes.add(population.get(choice));\n }\n\n return selectedChromosomes;\n }", "public Genotype rouletteSelection() {\n // get a number between 0 and 1 to compare against\n double slice = rnd.nextDouble();\n // keep track of the cumulative fitness\n double cumulativeFitness = 0;\n\n // loop through the population to pick a mate\n for (Genotype g : population) {\n // increment the cumulative fitness with the member's normalized fitness\n cumulativeFitness += g.getNormalizedFitness();\n // if the cumulative fitness is greater than the random number,\n if (cumulativeFitness > slice) {\n // select the member for mating\n return g;\n }\n }\n\n // if no members are chosen, pick the one with the highest fitness score\n return population.get(0);\n }", "private static void getFitness() {\n\t\tint popSize = population.size();\n\t\tChromosome thisChromo = null;\n\t\tdouble bestScore = 0;\n\t\tdouble worstScore = 0;\n\n\t\t// The worst score would be the one with the highest energy, best would be\n\t\t// lowest.\n\t\tworstScore = population.get(maximum()).conflicts();\n\n\t\t// Convert to a weighted percentage.\n\t\tbestScore = worstScore - population.get(minimum()).conflicts();\n\n\t\tfor (int i = 0; i < popSize; i++) {\n\t\t\tthisChromo = population.get(i);\n\t\t\tthisChromo.fitness((worstScore - thisChromo.conflicts()) * 100.0 / bestScore);\n\t\t}\n\n\t\treturn;\n\t}", "private ArrayList<int[]> selectionRank(int[][] chromosomes, float percentToSelect) {\n\n\t\tArrayList<int[]> selectedChromosomes = new ArrayList<int[]>();\n\n\t\t//get fitnesses and ranks of chromosomes, save in array to avoid recalculating\n\t\tint[] fitnesses = new int[chromosomes.length];\n\t\tArrayList<Integer> ranks = new ArrayList<Integer>(); //holds indices of chromosomes, position in arraylist indicates rank\n\n\t\tfor (int i = 0; i < chromosomes.length; i++) { //set up list of fitnesses and ranks\n\t\t\tfitnesses[i] = getFitness(chromosomes[i]);\n\n\n\t\t\tboolean added = false;\n\t\t\tfor (int keyIndex = 0; keyIndex < ranks.size(); keyIndex++) { //only search the second half\n\t\t\t\tif (fitnesses[ranks.get(keyIndex)] > fitnesses[i]) { //if this one is worse\n\t\t\t\t\tranks.add(keyIndex, i); //inverted rank\n\t\t\t\t\tadded = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!added) {\n\t\t\t\tranks.add(i);\n\t\t\t}\n\n\t\t}// end fitness ranking (low fitness is best, last index is worst)\n\n\n\t\t//spin the roulette wheel\n\t\tfor (int i = 0; i < chromosomes.length * percentToSelect; i++) {\n\t\t\tint currentFitnessTotal = 0;\n\t\t\tint fitSelector = rand.nextInt(chromosomes.length); //where the wheel stops\n\t\t\tint fitnessCutoff = (fitSelector * (fitSelector + 1)) / 2;\n\n\t\t\tfor (int j = 0; j < ranks.size(); j++) { //go through all ranks to see who is selected this spin\n\t\t\t\tif (currentFitnessTotal < fitnessCutoff)\n\t\t\t\t\tcurrentFitnessTotal += chromosomes.length - ranks.get(j); //reorder fitness properly\n\n\t\t\t\tif (currentFitnessTotal >= fitnessCutoff) { //if this rank pushed us over the edge, save it\n\t\t\t\t\tselectedChromosomes.add(chromosomes[ranks.get(j)]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}//end roulette spinning\n\n\t\treturn selectedChromosomes;\n\t}", "public void testSelect_4()\n throws Exception {\n BestChromosomesSelector selector = new BestChromosomesSelector(conf);\n selector.setDoubletteChromosomesAllowed(true);\n // the following original rate controls that only 30% of the chromosomes\n // will be considered for selection as given with BestChromosomesSelector.\n // The last 70% will be added as doublettes in this case.\n selector.setOriginalRate(0.3d);\n // add first chromosome\n // --------------------\n Gene gene = new BooleanGene(conf);\n gene.setAllele(Boolean.valueOf(true));\n Chromosome thirdBestChrom = new Chromosome(conf, gene, 7);\n thirdBestChrom.setFitnessValue(10);\n selector.add(thirdBestChrom);\n // add second chromosome\n // ---------------------\n gene = new BooleanGene(conf);\n gene.setAllele(Boolean.valueOf(false));\n Chromosome bestChrom = new Chromosome(conf, gene, 3);\n bestChrom.setFitnessValue(12);\n selector.add(bestChrom);\n // add third chromosome\n // ---------------------\n gene = new IntegerGene(conf);\n gene.setAllele(new Integer(444));\n Chromosome secondBestChrom = new Chromosome(conf, gene, 3);\n secondBestChrom.setFitnessValue(11);\n selector.add(secondBestChrom);\n // receive top 1 (= best) chromosome\n // ---------------------------------\n Population pop = new Population(conf);\n selector.select(1, null, pop);\n IChromosome[] bestChroms = pop.toChromosomes();\n assertEquals(1, bestChroms.length);\n assertEquals(bestChrom, bestChroms[0]);\n // receive top 4 chromosomes with original rate = 0.3\n // --------------------------------------------------\n pop.getChromosomes().clear();\n selector.select(4, null, pop);\n bestChroms = pop.toChromosomes();\n assertEquals(4, bestChroms.length);\n assertEquals(bestChrom, bestChroms[0]);\n assertEquals(bestChrom, bestChroms[1]); //because of originalRate = 0.3\n assertEquals(secondBestChrom, bestChroms[2]);\n assertEquals(thirdBestChrom, bestChroms[3]);\n // Non-unique chromosomes should have been returned, although not the same\n // but a cloned instance!\n assertEquals(bestChroms[0], bestChroms[1]);\n // receive top 4 chromosomes with original rate = 1\n // ------------------------------------------------\n pop.getChromosomes().clear();\n selector.setOriginalRate(1.0d);\n selector.select(4, null, pop);\n bestChroms = pop.toChromosomes();\n assertEquals(4, bestChroms.length);\n assertEquals(bestChrom, bestChroms[0]);\n assertEquals(secondBestChrom, bestChroms[1]);\n assertEquals(thirdBestChrom, bestChroms[2]);\n assertEquals(bestChrom, bestChroms[3]);\n }", "Chromosome fittestChromosome();", "public static void breedAll() {\n int a, b; //Pointers to select parents\n\n //While loop to ensure full carrying capacity of population\n while (Population.size() <= maxPop) {\n //Sorts by Fitness level first\n sortByFitlvl();\n\n //Selects Two Random Parents\n a = (int) (Math.abs(Utilities.sharpGauss(4)) * Population.size());\n b = (int) (Math.abs(Utilities.sharpGauss(4)) * Population.size());\n //System.out.println(a+\"\\t\"+b+\"\\t\"+Population.size());\n\n // Between 1-2 children\n int children = rand.nextInt(2)+1;\n for (int i = 0; i < children; i++) {\n Population.add(Breeder.breed(Population.get(a), Population.get(b), 0.1));\n }\n\n //sortByFitlvl();\n }\n\n if (debug)\n printPopulation(true);\n }", "Chromosome getRandomAmongFittest(int limit);", "private void rouletteSelection() {\n parentChromosomes = new Chromosome[2];\n parentIndices = new int[2];\n Arrays.fill(parentChromosomes, null);\n parentIndices[0] = getFittestChromosomeIndex();\n parentChromosomes[0] = chromosomes[parentIndices[0]];\n parentIndices[1] = getFittestChromosomeIndex();\n parentChromosomes[1] = chromosomes[parentIndices[1]];\n System.out.println(\"Individuals selected from Roulette Wheel for crossover: \\n\" +\n Arrays.toString(parentChromosomes[0].getGenes()) + \"\\n\" +\n Arrays.toString(parentChromosomes[1].getGenes()));\n }", "static double[] evolveWeights() throws Exception {\n\t\t// Create a random initial population\n\t\tRandom r = new Random();\n\t\t// Matrix is a two dimensional array, populationSize are rows, Genes are columns\n\t\tMatrix population = new Matrix(populationSize, numberofGenes);\n\t\tfor (int i = 0; i < 100; i++) {\n\t\t\t// returns elements(genes) of every row\n\t\t\t// Think of every row as a seperate chromosome of parent\n\t\t\tdouble[] chromosome = population.row(i);\n\t\t\t// create every gene for each chrosome in the population\n\t\t\tfor (int j = 0; j < chromosome.length; j++) {\n\t\t\t\tdouble gene = 0.03 * r.nextGaussian();\n\t\t\t\tchromosome[j] = gene;\n\t\t\t}\n\t\t}\n\n\t\tint generationNum = 0;\n\t\t// do battle with chromosomes until winning condition is found\n\t\t// Controller.doBattleNoGui(new ReflexAgent(), new\n\t\t// NeuralAgent(population.row(0)))\n\t\twhile (Controller.doBattleNoGui(new ReflexAgent(), new NeuralAgent(population.row(0))) != -1) {\n\n\t\t\tSystem.out.println(\"Generation \" + (generationNum));\n\n\t\t\tint mightLive = r.nextInt(100);\n\n\t\t\tif (generationNum == 10)\n\t\t\t\tmutationRate -= 0.01;\n\t\t\tif (generationNum == 20)\n\t\t\t\tmutationRate -= 0.02;\n\t\t\tif (generationNum == 30)\n\t\t\t\tmutationRate -= 0.02;\n\n\t\t\t// Mutate the genes of the current population\n\t\t\tfor (int y = 0; y < populationSize; y++) {\n\t\t\t\tfor (int x = 0; x < numberofGenes; x++) {\n\t\t\t\t\tif (Math.random() <= mutationRate) {\n\t\t\t\t\t\tpopulation.changeGene(x, y, r.nextGaussian());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Make random number of battles\n\t\t\tfor (int i = 0; i < 40; i++) {\n\t\t\t\t// Create two teams with two random chromosomes from the population\n\t\t\t\tint soldier_a = r.nextInt(population.rows());\n\t\t\t\tint soldier_b = r.nextInt(population.rows());\n\n\t\t\t\t// Ensure that both teams don't have the same chromosome\n\t\t\t\tif (soldier_a == soldier_b)\n\t\t\t\t\tsoldier_b = r.nextInt(population.rows());\n\n\t\t\t\t// Do Battle between teams and select winner\n\t\t\t\tif (Controller.doBattleNoGui(new NeuralAgent(population.row(soldier_a)),\n\t\t\t\t\t\tnew NeuralAgent(population.row(soldier_b))) == 1) {\n\t\t\t\t\t// Chooses if the winner survives\n\t\t\t\t\tif (mightLive < winnerSurvivalRate)\n\t\t\t\t\t\tpopulation.removeRow(soldier_b);\n\t\t\t\t\telse\n\t\t\t\t\t\tpopulation.removeRow(soldier_a);\n\t\t\t\t}\n\n\t\t\t\telse if (Controller.doBattleNoGui(new NeuralAgent(population.row(soldier_a)),\n\t\t\t\t\t\tnew NeuralAgent(population.row(soldier_b))) == -1) {\n\t\t\t\t\t// Chooses if the winner survives\n\t\t\t\t\tif (mightLive < winnerSurvivalRate)\n\t\t\t\t\t\tpopulation.removeRow(soldier_a);\n\t\t\t\t\telse\n\t\t\t\t\t\tpopulation.removeRow(soldier_b);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Reproduce for the population (This is where the magic happens)\n\t\t\t// int currentPopulation = population.rows();\n\t\t\twhile (population.rows() < 100) {\n\t\t\t\t// Retrieve random parent\n\t\t\t\tint parentID = r.nextInt(population.rows());\n\t\t\t\tdouble[] parent = population.row(parentID);\n\t\t\t\tint[] potentialPartners = new int[10];\n\t\t\t\tint abs_min_value = Integer.MIN_VALUE;\n\t\t\t\tBoolean foundpartner = false;\n\t\t\t\tint partner = 0;\n\n\t\t\t\tfor (int i = 0; i < potentialPartners.length; i++) {\n\t\t\t\t\tint potentialPartnerID = r.nextInt(population.rows());\n\t\t\t\t\tif (parentID == potentialPartnerID)\n\t\t\t\t\t\tpotentialPartnerID = r.nextInt(population.rows());\n\t\t\t\t\tpotentialPartners[i] = potentialPartnerID;\n\t\t\t\t}\n\n\t\t\t\tfor (int i = 0; i < potentialPartners.length; i++) // Finding most compatiable parent #2.\n\t\t\t\t{\n\t\t\t\t\tint compatiablity = similarities(parent, population.row(potentialPartners[i]));\n\t\t\t\t\tif (compatiablity > abs_min_value) {\n\t\t\t\t\t\tpartner = potentialPartners[i];\n\t\t\t\t\t\tfoundpartner = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (foundpartner == false)\n\t\t\t\t\tpartner = r.nextInt(population.rows());\n\n\t\t\t\tdouble[] secondParent = population.row(partner);\n\t\t\t\tdouble[] newChild = population.newRow();\n\t\t\t\tint splitpoint = r.nextInt((int) numberofGenes / 4);\n\n\t\t\t\tfor (int i = 0; i < splitpoint; i++) // logic to a for loop and two if statements\n\t\t\t\t\tnewChild[i] = parent[i];\n\t\t\t\tfor (int i = splitpoint; i < numberofGenes; i++)\n\t\t\t\t\tnewChild[i] = secondParent[i];\n\n\t\t\t\t// for (int i = 0; i < population.rows(); i++) {\n\t\t\t\t// if (Controller.doBattleNoGui(new ReflexAgent(), new\n\t\t\t\t// NeuralAgent(population.row(i))) == -1) {\n\t\t\t\t// population.row(i) = population.newRow();\n\t\t\t\t// numOfWins++;\n\t\t\t\t// } else { }\n\n\t\t\t\t// Test for the best in the given population\n\t\t\t\t// win_Collection.add(numOfWins);\n\t\t\t\t// printWeights(population.row(0));\n\n\t\t\t}\n\t\t\tgenerationNum++;\n\t\t\tfor (int i = 0; i < population.rows(); i++) {\n\t\t\t\tif (Controller.doBattleNoGui(new ReflexAgent(), new NeuralAgent(population.row(i))) == -1) {\n\t\t\t\t\tnumOfWins++;\n\t\t\t\t\t// population.row(i) = population.newRow();\n\t\t\t\t} else {\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(\"Number of Winners: \" + numOfWins);\n\t\t\tnumOfWins = 0;\n\n\t\t}\n\t\tprintWeights(population.row(0));\n\t\treturn population.row(0);\n\t}", "public void evaluate() {\n for (Chromosome chromo : chromosomes) {\n double chromoGH = chromo.getTotalGH();\n if (chromo.isValid()) {\n this.validChromosomes++;\n if (chromoGH > this.getBestScore()) {\n this.bestScore = chromoGH;\n this.setBestChromo(chromo);\n }\n }\n //Log.debugMsg(chromo.getTotalGH().toString());\n// this.map.put(chromoGH, chromo);\n }\n }", "private int intGetRandomGenomeBiasedAdjustedFitness(Species selectFrom, Random random) {\r\n\t\tdouble completeWeight = 0.0;\r\n\t\tfor (integerFitnessGenome fg : selectFrom.fitnessInt) {\r\n\t\t\tcompleteWeight += fg.fitness;\r\n\t\t}\r\n\t\tdouble r = Math.random() * completeWeight;\r\n\t\tdouble countWeight = 0.0;\r\n\t\tfor (integerFitnessGenome fg : selectFrom.fitnessInt) {\r\n\t\t\tcountWeight += fg.fitness;\r\n\t\t\tif (countWeight >= r) {\r\n\t\t\t\treturn fg.id;\r\n\t\t\t}\r\n\t\t}\r\n\t\tthrow new RuntimeException(\"Couldn't find a genome... Number is genomes in selected species is \");\r\n\t}", "Chromosome getRandom();", "private PMCGenotype[] advanceGeneration()\n\t{\n\t\tPMCGenotype[] newPop = new PMCGenotype[population.length];\n\t\tPMCGenotype[] parents = selectParents();\n\t\tArrayList<PMCGenotype> candidates = new ArrayList<PMCGenotype>();\n\n\t\t// Add the current population to the list of candidates.\n\t\tfor (PMCGenotype pmcg : population)\n\t\t{\n\t\t\tcandidates.add(pmcg);\n\t\t}\n\n\t\t// For each parent, generate a number of mutations (children), calculate their fitness\n\t\t// and add them to the list of candidates.\n\t\tint childrenPerParent = this.childrenPerGeneration / this.parentsToSelect;\n\t\tfor (PMCGenotype p : parents)\n\t\t{\n\t\t\tfor (int i = 0; i < childrenPerParent; i++)\n\t\t\t{\n\t\t\t\tPMCGenotype pmcg = PMCGenotype.mutate(p, r);\n\t\t\t\tpmcg.setFitness(fitness(pmcg, this.trials));\n\t\t\t\tcandidates.add(pmcg);\n\t\t\t}\n\t\t}\n\n\t\t// Find candidate with the best fitness and add it to the new population.\n\t\t// Repeat this until the new population size matches the previous population size.\n\t\tint candidatesChosen = 0;\n\t\twhile (candidatesChosen < this.population.length)\n\t\t{\n\t\t\tint numberOfRemainingCandidates = candidates.size();\n\t\t\tdouble currentBestFitnessScore = 0;\n\t\t\tint currentBestFitnessScoreIndex = 0;\n\n\t\t\tfor (int i = 0; i < numberOfRemainingCandidates; i++)\n\t\t\t{\n\t\t\t\tPMCGenotype pmcg = candidates.get(i);\n\t\t\t\tif (pmcg.getFitness() > currentBestFitnessScore)\n\t\t\t\t{\n\t\t\t\t\tcurrentBestFitnessScore = pmcg.getFitness();\n\t\t\t\t\tcurrentBestFitnessScoreIndex = i;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnewPop[candidatesChosen] = candidates.get(currentBestFitnessScoreIndex);\n\t\t\tcandidatesChosen++;\n\n\t\t\tcandidates.remove(currentBestFitnessScoreIndex);\n\t\t}\n\n\t\treturn newPop;\n\t}", "public void evaluate()\r\n {\r\n\tdouble max = ff.evaluate(chromos.get(0),generation());\r\n\tdouble min = max;\r\n\tdouble sum = 0;\r\n\tint max_i = 0;\r\n\tint min_i = 0;\r\n\r\n\tdouble temp = 0;\r\n\r\n\tfor(int i = 0; i < chromos.size(); i++)\r\n\t {\r\n\t\ttemp = ff.evaluate(chromos.get(i),generation());\r\n\t\tif(temp > max)\r\n\t\t {\r\n\t\t\tmax = temp;\r\n\t\t\tmax_i = i;\r\n\t\t }\r\n\r\n\t\tif(temp < min)\r\n\t\t {\r\n\t\t\tmin = temp;\r\n\t\t\tmin_i = i;\r\n\t\t }\r\n\t\tsum += temp;\r\n\t }\r\n\r\n\tbestFitness = max;\r\n\taverageFitness = sum/chromos.size();\r\n\tworstFitness = min;\r\n\tbestChromoIndex = max_i;;\r\n\tworstChromoIndex = min_i;\r\n\tbestChromo = chromos.get(max_i);\r\n\tworstChromo = chromos.get(min_i);\r\n\t\r\n\tevaluated = true;\r\n }", "public Chromosome doDisplacementMutation(){\n for(int i = 0; i < PopulationConfiguration.MUTATION_ATTEMPTS; i++){\n ArrayList<Boolean> newSelection = copyBoolArrayList(this.knapsackSelection);\n\n int allele1 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n int allele2 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n\n int leftAllele = Math.min(allele1, allele2);\n int rightAllele = Math.max(allele1, allele2);\n\n var selectionSublist = new ArrayList<Boolean>(newSelection.subList(leftAllele, rightAllele));\n for(int j = leftAllele; j < rightAllele + 1; j++){\n newSelection.remove(leftAllele);\n }\n\n int index = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size()+1);\n newSelection.addAll(index, selectionSublist);\n\n Chromosome mutatedKnapsack = new Chromosome(newSelection).withFitnessCalculated();\n if(mutatedKnapsack.isValid())\n return mutatedKnapsack;\n }\n return this;\n }", "protected double evaluate(IChromosome chromosome) {\n\t double score = 0;\n\t \t \n\t List dups = new ArrayList();\n\t int badSolution = 1;\n\n\t for (int i = 0; i < chromosome.size(); i++) {\n\n\t //IntegerGene agene = (IntegerGene) chromosome.getGene(i);\n\t //System.out.println(agene);\n\t int index = (Integer) chromosome.getGene(i).getAllele();\n\t \n\t if (dups.contains(index)) {\n\t badSolution = 0;\n\t } else {\n\t dups.add(index);\n\t }\n\n\t Equipo equipo = (Equipo) equipos.get(index);\n\t double genreScore = getGenreScore(equipo);\n\t if (genreScore == 0) {\n\t badSolution = 0;\n\t }\n\t score = (score+genreScore);\n\n\t }\n\t \n\t return (score * badSolution);\n\t }", "public int fitness() {\n\t\t//System.out.println(\"/!\\\\ WARNING: Full fitness() called!\");\n\t\tint fitness = 0;\n\t\tint fitnessCases = (int) Math.pow(2, circuit.order);\n\t\tfor (int i=0; i<fitnessCases; i++) {\n\t\t\tValuation v = new Valuation(i, circuit.order);\n\t\t\tboolean actualOutput = tree.evaluate(v);\n\t\t\tboolean correctOutput = v.correctOutput();\n\t\t\t\n\t\t\tif (actualOutput == correctOutput) fitness++;\n\t\t}\n\t\t\n\t\tthis.fitness = fitness;\n\t\tthis.fitnessCases = null;\n\t\t\n\t\treturn fitness;\n\t}", "public double fitness()\n/* */ {\n/* 40 */ return 1.0D / (1.0D + this.distance);\n/* */ }", "public ArrayList<Tour> doSelection(Population population) {\n double totalFitness = 0;\n for(Tour tour : population.getTourList()){\n totalFitness = totalFitness + tour.getFitness();\n }\n\n //sort tours by relative fitness\n SortedMap<Double, Tour> totalFitnessRelativity = new TreeMap<>();\n for(Tour tour: population.getTourList()){\n double key = tour.getFitness()/totalFitness;\n totalFitnessRelativity.put(key, tour);\n }\n\n //put tours on a number bar\n SortedMap<Double, Tour> numberBar = new TreeMap<>();\n double previousProbability = 0;\n for(Map.Entry<Double, Tour> entry : totalFitnessRelativity.entrySet()){\n double currentProbability = previousProbability + entry.getKey();\n numberBar.put(currentProbability, entry.getValue());\n previousProbability = currentProbability;\n }\n\n //choose a tour randomly according to how near it is to\n ArrayList<Tour> rouletteWheelOrder = new ArrayList<>();\n do{\n double randomNumber = new random.MersenneTwisterFast().nextDouble(0, numberBar.lastKey());\n for(Map.Entry<Double, Tour> numberBarSection : numberBar.entrySet()){\n if(randomNumber <= numberBarSection.getKey() && !rouletteWheelOrder.contains(numberBarSection.getValue())){\n rouletteWheelOrder.add(numberBarSection.getValue());\n break;\n }\n }\n } while(rouletteWheelOrder.size() != population.getTourList().size());\n return rouletteWheelOrder;\n }", "private static void calculateFitnessOfPopulation(ArrayList<Chromosome> population) {\n for (Chromosome chromosome : population) {\n // if the fitness of the chromosome has not yet been calculated (i.e. is still -1)\n fitnessFunction(chromosome);\n }\n }", "public abstract double getFitness(Genotype genotype);", "public Chromosome bestChromosome()\r\n {\r\n\treturn bestChromo.clone();\r\n }", "public interface Population {\n\n /**\n * Add the specified chromosome to the population.\n * If the size of the population has reached to maxSize, eviction is done\n * removing chromosomes with the worst fitness\n * @param chromosome\n */\n void addChromosome(@NotNull final Chromosome chromosome);\n\n /**\n * Return a random chromosome\n * @return\n */\n Chromosome getRandom();\n\n\n /**\n * Return a random chromosome among the first limit fittest chromosomes\n * @param limit Nth fittest chromosome\n * @return\n */\n Chromosome getRandomAmongFittest(int limit);\n\n /**\n * Remove the specified chromosome from the population\n * @param chromosome\n */\n boolean removeChromosome(@NotNull final Chromosome chromosome);\n\n /**\n * Return the fittest chromosome\n * @return\n */\n Chromosome fittestChromosome();\n\n /**\n * Number of chromosome in the population\n * @return\n */\n int size();\n\n /**\n * Return the hits of each chromosomes\n * @return\n */\n Map<String, Long> hits();\n}", "public int randomGene();", "public static void GA(ArrayList<City> cities){\n int pathLength = cities.size();\n // the number of chromosomes which will be generated\n int populationSize = 100;\n // the number of chromosomes that will be generated from crossover as a percentage of the population\n double crossoverRate = 0.8;\n // the number of chromosomes that will be generated from crossover\n int crossoverSize = (int) (populationSize * crossoverRate);\n // the probability that a chromosome can have a random mutation\n double mutationRate = 0.05;\n // the number of generations\n int generations = 5000;\n\n // Initialising the distance matrix using the initialiseDistanceMatrix method\n initialiseDistanceMatrix(cities);\n\n // Generating the Initial Population\n ArrayList<Chromosome> population = generatePopulation(cities, pathLength, populationSize);\n\n // The following is done for each generation of the population\n for (int i = 0; i < generations; i++) {\n // calculating the fitness of every chromosome in the current generation\n calculateFitnessOfPopulation(population);\n // sort the population so that the chromosomes with the highest fitness are at the start of the list\n Collections.sort(population);\n // call the method which performs crossover on the population\n Set<Chromosome> children = crossoverPopulation(population, populationSize, crossoverSize);\n // carry out mutation on the children of the current population\n children.addAll( mutatePopulation(children, mutationRate) );\n\n // evolve the population\n population.addAll(children);\n ArrayList<Chromosome> currentGeneration = new ArrayList<>(population);\n ArrayList<Chromosome> nextGeneration = evolvePopulation(currentGeneration, populationSize, cities, pathLength);\n population = new ArrayList<>(nextGeneration);\n }\n\n // find the fittest chromosome\n Chromosome fittestChromosome = population.get(0);\n double maxFitness = population.get(0).fitness;\n for (Chromosome c : population) {\n if (c.fitness > maxFitness) {\n maxFitness = c.fitness;\n fittestChromosome = c;\n }\n }\n // display the path and distance of the fittest chromosome\n System.out.println(fittestChromosome.getPath());\n System.out.println(\"Total Route Distance: \" + routeDistance(fittestChromosome));\n\n //printPopulation(population);\n }", "public static void genocide() {\n //Assigns fitness levels\n evaluateFitnesses();\n\n //Sorts by fitness\n sortByFitlvl();\n\n //Simple genocide, kills off all until population size.\n for (int i = Population.size() - 1; i >= populationSize; i--) {\n Population.remove(i);\n }\n\n /*\n //Different kind of Genocide, selects organisms based on gaussian distribution\n\n while(Population.size() > populationSize){\n int randomOrganism = (int)(Population.size() - (Population.size()*Utilities.sharpGauss(2)));\n Population.remove(randomOrganism);\n }\n */\n }", "private Integer getFitness(int[] chromosome) {\n\t\tint[] bins = new int[binCount]; //list of found bins\n\t\tfor (int binIndex = 0; binIndex < bins.length; binIndex++) { //initialize list of bins to unfound\n\t\t\tbins[binIndex] = -1;\n\t\t}\n\t\tint[] newChrom = bestFitModified(chromosome.clone()); //fix if infeasible\n\t\tif (newChrom == null) { //this is an unfixable chromosome, inform caller\n\t\t\treturn binCount * 2 + totalInfeasibility(chromosome);\n\t\t}\n\n\t\tfor (int i = 0; i < newChrom.length; i++) {\n\t\t\tchromosome[i] = newChrom[i]; //copy over to take advantage of side-effects\n\t\t}\n\t\tint uniqueBins = 0;\n\n\t\tfor (int i = 0; i < chromosome.length; i++) {\n\t\t\tif (bins[chromosome[i]] == -1) { //if we haven't seen this bin before track it and increment bin counter\n\t\t\t\tbins[chromosome[i]] = chromosome[i];\n\t\t\t\tuniqueBins++;\n\t\t\t} else\n\t\t\t\tcontinue;\n\t\t}\n\n\t\treturn uniqueBins;\n\t}", "public static boolean [][] breedChoice (Species [][] map, int x, int y, int plantHealth) {\n // First int: direction\n // Second int: sheep or wolf\n boolean [][] breeding = {\n {false, false},\n {false, false},\n {false, false},\n {false, false},\n };\n \n // Check null pointer exceptions\n if (map[y][x] != null) {\n\n // Breed sheep\n if ((map[y][x] instanceof Sheep) && (y > 0) && (map[y-1][x] instanceof Sheep)) {\n if ((((Sheep)map[y][x]).getGender() != ((Sheep)map[y-1][x]).getGender()) && (map[y][x].getHealth() > 20) && (map[y-1][x].getHealth() > 20) && (((Sheep)map[y][x]).getAge() > 5) && (((Sheep)map[y-1][x]).getAge() > 5)) {\n breeding[0][0] = true;\n }\n } else if ((map[y][x] instanceof Sheep) && (y < map[0].length - 2) && (map[y+1][x] instanceof Sheep)) {\n if ((((Sheep)map[y][x]).getGender() != ((Sheep)map[y+1][x]).getGender()) && (map[y][x].getHealth() > 20) && (map[y+1][x].getHealth() > 20) && (((Sheep)map[y][x]).getAge() > 5) && (((Sheep)map[y+1][x]).getAge() > 5)) {\n breeding[1][0] = true;\n }\n } else if ((map[y][x] instanceof Sheep) && (x > 0) && (map[y][x-1] instanceof Sheep)) {\n if ((((Sheep)map[y][x]).getGender() != ((Sheep)map[y][x-1]).getGender()) && (map[y][x].getHealth() > 20) && (map[y][x-1].getHealth() > 20) && (((Sheep)map[y][x]).getAge() > 5) && (((Sheep)map[y][x-1]).getAge() > 5)) {\n breeding[2][0] = true;\n }\n } else if ((map[y][x] instanceof Sheep) && (x < map.length - 2) && (map[y][x+1] instanceof Sheep)) {\n if ((((Sheep)map[y][x]).getGender() != ((Sheep)map[y][x+1]).getGender()) && (map[y][x].getHealth() > 20) && (map[y][x+1].getHealth() > 20) && (((Sheep)map[y][x]).getAge() > 5) && (((Sheep)map[y][x+1]).getAge() > 5)) {\n breeding[3][0] = true;\n }\n \n // Breed wolves\n } else if ((map[y][x] instanceof Wolf) && (y > 0) && (map[y-1][x] instanceof Wolf)) {\n if ((((Wolf)map[y][x]).getGender() != ((Wolf)map[y-1][x]).getGender()) && (map[y][x].getHealth() > 20) && (map[y-1][x].getHealth() > 20) && (((Wolf)map[y][x]).getAge() > 5) && (((Wolf)map[y-1][x]).getAge() > 5)) {\n breeding[0][1] = true;\n }\n } else if ((map[y][x] instanceof Wolf) && (y < map[0].length - 2) && (map[y+1][x] instanceof Wolf)) {\n if ((((Wolf)map[y][x]).getGender() != ((Wolf)map[y+1][x]).getGender()) && (map[y][x].getHealth() > 20) && (map[y+1][x].getHealth() > 20) && (((Wolf)map[y][x]).getAge() > 5) && (((Wolf)map[y+1][x]).getAge() > 5)) {\n breeding[1][1] = true;\n }\n } else if ((map[y][x] instanceof Wolf) && (x > 0) && (map[y][x-1] instanceof Wolf)) {\n if ((((Wolf)map[y][x]).getGender() != ((Wolf)map[y][x-1]).getGender()) && (map[y][x].getHealth() > 20) && (map[y][x-1].getHealth() > 20) && (((Wolf)map[y][x]).getAge() > 5) && (((Wolf)map[y][x-1]).getAge() > 5)) {\n breeding[2][1] = true;\n }\n } else if ((map[y][x] instanceof Wolf) && (x < map.length - 2) && (map[y][x+1] instanceof Wolf)) {\n if ((((Wolf)map[y][x]).getGender() != ((Wolf)map[y][x+1]).getGender()) && (map[y][x].getHealth() > 20) && (map[y][x+1].getHealth() > 20) && (((Wolf)map[y][x]).getAge() > 5) && (((Wolf)map[y][x+1]).getAge() > 5)) {\n breeding[3][1] = true;\n }\n }\n \n }\n return breeding;\n }", "public void runTournament() {\n\t\t//ArrayList<Gene> tournament = new ArrayList<Gene>();\n\t\tPriorityQueue<Gene> tournament = new PriorityQueue<Gene>(Collections.reverseOrder());\n\t\tint numContenders = (int)(FRAC_IN_TOURNAMENT * geneNumber);\n\t\tSet<Integer> chosenOnes = new HashSet<Integer>();\n\t\t\n\t\twhile(chosenOnes.size() < numContenders) {\n\t\t\tint randIndex = (int) (Math.random() * geneNumber);\n\t\t\tchosenOnes.add(randIndex);\n\t\t}\n\t\tfor(int i : chosenOnes){\n\t\t\ttournament.add(genepool.get(i));\n\t\t}\n\t\t//int firstIndex = getMax(tournament, -1);\n\t\t//int secondIndex = getMax(tournament, firstIndex);\n\t\t//Gene parent1 = tournament.get(firstIndex);\n\t\t//Gene parent2 = tournament.get(secondIndex);\n\t\tGene parent1 = tournament.poll();\n\t\tGene parent2 = tournament.poll();\n\t\t// Create a new gene from the 2 fittest genes\n\t\tGene newGene = parent1.waCrossover(parent2);\n\t\t\n\t\t// Calculate fitness for the new gene\n\t\tPlayerSkeleton.runGames(numGames, newGene);\n\t\toffspringPool.add(newGene);\n\t}", "public Chromosome worstChromosome()\r\n {\r\n\treturn worstChromo.clone();\r\n }", "private Species getRandomSpeciesBaisedAdjustedFitness(Random random) {\r\n\t\tdouble completeWeight = 0.0;\r\n\t\tfor (Species s : species) {\r\n\t\t\tcompleteWeight += s.totalAdjustedFitness;\r\n\t\t}\r\n\t\tdouble r = Math.random() * completeWeight;\r\n\t\tdouble countWeight = 0.0;\r\n\t\tfor (Species s : species) {\r\n\t\t\tcountWeight += s.totalAdjustedFitness;\r\n\t\t\tif (countWeight >= r) {\r\n\t\t\t\treturn s;\r\n\t\t\t}\r\n\t\t}\r\n\t\tthrow new RuntimeException(\"Couldn't find a species... Number is species in total is \" + species.size()\r\n\t\t\t\t+ \", and the toatl adjusted fitness is \" + completeWeight);\r\n\t}", "private int[] bestFitModified(int[] chromosome) {\n\t\tint[] bins = new int[binCount];\n\t\tArrayList<Integer> cannotPackList = new ArrayList<Integer>();\n\n\t\t//honor chromosome listing when possible\n\t\tfor (int i = 0; i < chromosome.length; i++) {\n\t\t\t//if this bin isnt full & won't be after placement & this chrom hasnt gone off the end \n\t\t\t//(VERY RARE, only happens when binCount is reduced w/ elitism)\n\t\t\tif (chromosome[i] < bins.length && bins[chromosome[i]] + packageWeights[i] <= binSize) {\n\t\t\t\tbins[chromosome[i]] += packageWeights[i]; //put package into bin\n\t\t\t} else { //store those we can't honor\n\t\t\t\tchromosome[i] = -1;\n\t\t\t\tcannotPackList.add(new Integer(i)); //save all those packages whos original bins were full\n\t\t\t}\n\t\t}\n\n\t\t//best fit on all the rest whos bins were full up\n\t\tint tries = 0;\n\t\tfor (int j = 0; j < cannotPackList.size(); j++) {\n\t\t\tint i = cannotPackList.get(j);\n\t\t\tint bestBinIndex = -1;\n\n\t\t\twhile (bestBinIndex < 0 && tries < bins.length * 2) { //while we still havent found a bin to put this in and time isn't up\n\n\t\t\t\tint bestBinLeftOverSpace = binSize * 100; //how much space is left in the bin when the packages is placed in it (ideally 0 = full bin)\n\n\t\t\t\tfor (int bin = 0; bin < bins.length; bin++) {\n\t\t\t\t\t//if this bin is closer to full than the best bin and not overfilled save it\n\t\t\t\t\tif ((binSize - (bins[bin] + packageWeights[i])) >= 0 && (binSize - (bins[bin] + packageWeights[i])) < bestBinLeftOverSpace) {\n\t\t\t\t\t\tbestBinIndex = bin;\n\t\t\t\t\t\tbestBinLeftOverSpace = binSize - (bins[bin] + packageWeights[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (bestBinIndex < 0) { //if could not pack, dump out a bin (mutation)\n\t\t\t\t\tj = 0;\n\t\t\t\t\tint dumpBin = rand.nextInt(binCount);\n\t\t\t\t\tfor (int binIndex = dumpBin; binIndex < binCount; binIndex++) {\n\t\t\t\t\t\tbins[binIndex] = 0;\n\t\t\t\t\t\tfor (int chromIndex = 0; chromIndex < chromosome.length; chromIndex++) {\n\t\t\t\t\t\t\tif (chromosome[chromIndex] == binIndex) {\n\t\t\t\t\t\t\t\tchromosome[chromIndex] = -1;\n\t\t\t\t\t\t\t\tcannotPackList.add(new Integer(chromIndex));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\ttries++;\n\t\t\t}\n\n\t\t\tif (tries >= bins.length * 2) {\n\t\t\t\treturn null; //this chromosome is unsalvageable because it is impossible to fit the packages in the bins\n\t\t\t}\n\n\n\t\t\tbins[bestBinIndex] += packageWeights[i];\n\t\t\tchromosome[i] = bestBinIndex;\n\t\t\tcannotPackList.remove(j);\n\t\t\tj--;\n\t\t}\n\n\t\treturn chromosome;\n\t}", "private void tournament_selection() {\r\n\r\n individual[] temp_pop = new individual[this.pop_size];\r\n\r\n for (int i = 0; i < this.pop_size; i++) {\r\n\r\n // pick 2 random ints to for indices of parents\r\n int parent1 = new Random().nextInt(this.pop_size);\r\n int parent2 = new Random().nextInt(this.pop_size);\r\n\r\n individual p1 = new individual(main_population.getPopulation()[parent1].getGenes(), solutions, output);\r\n individual p2 = new individual(main_population.getPopulation()[parent2].getGenes(), solutions, output);\r\n\r\n if (p1.getFitness() >= p2.getFitness()) {\r\n temp_pop[i] = p1;\r\n } else {\r\n temp_pop[i] = p2;\r\n }\r\n }\r\n this.main_population.setPopulation(temp_pop);\r\n this.main_population.update_population();\r\n }", "private void calculateFitness() {\n\t\tint day1=this.getNumberOfHours()*this.getNumberOfClasses();\n\t\tint day2=2*day1;\n\t\tint day3=3*day1;\n\t\tint day4=4*day1;\n\t\tint day5=5*day1;\n\t\tTeacher_lesson temp=null;\n\t\t//day 1//\n\t\tHashSet<Integer> closedSet=new HashSet<Integer>();\n\t\t\n\t\t\n\t\t\n\t\tfor(int i=0;i<day1;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day1;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t}\n\t\t\t\n\t\t}\n\t\n\t\t\n\t\t\n\t\t\n\t\t//day2//\n\t\tclosedSet.clear();;\n\t\t\n\t\tfor(int i=day1;i<day2;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day2;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t}\n\t\t\t\n\t\t}\n\t\t//day3//\n\t\tclosedSet.clear();;\n\t\tfor(int i=day2;i<day3;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day3;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\t//day4//\n\t\tclosedSet.clear();;\n\t\tfor(int i=day3;i<day4;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day4;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\t\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t}\n\t\t\t\n\t\t}\n\t\t//day5//\n\t\tclosedSet.clear();;\n\t\tfor(int i=day4;i<day5;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day5;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t\t\t\n\t\t}\n\t\t\t/*if(temp.get_td_hour()<0){this.fitness=this.fitness-100;}//adunato na ginei giati o ka8igitis exei parapanw wres apo oti mporei na kanei//\n\t\t\t\telse if (temp.get_td_hour()==0){this.fitness=this.fitness-2;}//meiwnoume giati o ka8igitis 8a epivarin8ei oles tou tis wres thn idia mera//\n\t\t\t\telse{++this.fitness;}//kalh prosegisi*/\n\t\t}\n\t\t//*********************END OF DAILY EVALUATION*****************************//\n\t\t\n\t\t//**********************START OF WEEKLY EVALUATION************************//\n\t\t\n\t\tclosedSet.clear();\n\t\t\n\t int \t_weeklyhours = 1;\n\t \n\t\tfor(int i=0;i<day5;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp!=null){\n\t\t\tif(!closedSet.contains(this.genes[i])){\n\t\t\t\t\n\t\t\t\n\t\t\tfor(int j=i+1;j<day5;j++){\n\t\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\t\t++_weeklyhours; }\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t/*if(_weeklyhours>temp.get_tw_hour()){\n\t\t\t\tthis.fitness=this.fitness-100 ; //adunato na kanei parapanw wres ma8hma//\n\t\t\t}else\n\t\t\t\t{++this.fitness;}*/\n\t\t\tif(_weeklyhours<temp.get_tw_hour()){++this.fitness;}\n\t\t\tclosedSet.add(this.genes[i]);}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//*************END OF WEEKLY EVALUATION**********//\n\t\n\t\t//**START OF LESSON EVALUATION***//\n\t\tArraylistLesson set=new ArraylistLesson();\n\t\tclass_lid templ=null;\n\t\tTeacher_lesson tempj=null;\n\t\tint lid=0;\n\t\tString _class;\n\t\tint _classhours=1;\n\t\tfor(int i=0;i<day5;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp!=null){\n\t\t\tlid=temp.get_lid();\n\t\t\t_class=temp.get_class();\n\t\t\ttempl=new class_lid(lid,_class);\n\t\t\tif(!set.contains(templ)){\n\t\t\t\t\n\t\t\t\tfor(int j=i+1;j<day5;j++){\n\t\t\t\t\ttempj=getdata(this.genes[j]);{\n\t\t\t\t\t\tif(tempj!=null){\n\t\t\t\t\t\t\tif(temp.get_tid()==tempj.get_tid()){\n\t\t\t\t\t\t\t\tif(temp.get_lid()==tempj.get_lid()&&temp.get_class().equalsIgnoreCase(tempj.get_class())){\n\t\t\t\t\t\t\t\t\t++_classhours;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\tint hours;\n\t\t\t\thours=temp.get_lhours();\n\t\t\t\n\t\tif(_classhours==hours){\n\t\t\t++this.fitness;\n\t\t}\n\t\tset.add(templ);\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t}", "@Override\n\tpublic int compareTo(Chromosome o) {\n\n\t\treturn this.fitness - o.fitness;\n\t}", "public static void main(String[] args) throws IOException {\n\t\tint p = 8;\n\t\t// r is the fraction of the population to be replaced by Crossover at\n\t\t// each step\n//\t\tdouble r = Double.valueOf(8).doubleValue();\n\t\tdouble r = 8;\n\t\t// m is the rate of mutation\n//\t\tdouble m = Double.valueOf(8).doubleValue();\n\t\tdouble m = 8;\n\n\t\t// Write into files...\n\t\tFile outputFile = new File(\"testGA.txt\");\n\t\tFileWriter out = new FileWriter(outputFile);\n\n\t\t////////////////////////\n\t\tp = 33;\n\t\tr = 0.6;\n\t\tm = 0.1;\n\n\t\t// Report the population size, crossover rate and mutation rate\n\t\tSystem.out.println();\n\t\tSystem.out.println(\"Learning the 8-queens problem with a Genetic Algorithm\");\n\t\tSystem.out.println(\"Population Size: \" + p);\n\t\tSystem.out.println(\"Crossover Rate: \" + r);\n\t\tSystem.out.println(\"Mutation Rate: \" + m);\n\t\tSystem.out.println();\n\t\tout.write(\"Parameters are p=\" + p + \", \" + \"r=\" + r + \" and m=\" + m + \"\\r\");\n\n\t\t// The genetic algorithm\n\t\tint iterationNum = 0;\n\t\tHypothesis bestIndividual;\n\t\tint bestFitness;\n\t\tdouble aveFitness;\n\t\t// Randomly generate initial population\n\t\tGA algorithm = new GA(p, r, m);\n\t\t// For each individual compute fitness\n\t\talgorithm.computeFitness();\n\t\t// Get the best individual\n\t\tbestIndividual = (algorithm.getPopulation())[0];\n\t\tbestFitness = bestIndividual.getFitness();\n\t\taveFitness = algorithm.computeAveFitness();\n\t\t// Iterate till we get the very best individual\n\t\twhile (bestFitness != 0) {\n\t\t\t// Select the very best members of the population to survive\n\t\t\talgorithm.select();\n\t\t\t// Make the best members reproduce themselves\n\t\t\talgorithm.crossover();\n\t\t\t// Add some mutations to new population\n\t\t\talgorithm.mutate();\n\t\t\t// The successor population becomes the current population\n\t\t\talgorithm.setNextGeneration();\n\t\t\t// For each individual compute fitness\n\t\t\talgorithm.computeFitness();\n\t\t\t// Get the best individual\n\t\t\tbestIndividual = (algorithm.getPopulation())[0];\n\t\t\tbestFitness = bestIndividual.getFitness();\n\t\t\taveFitness = algorithm.computeAveFitness();\n\t\t\t// Report best results to the user at every five iterations\n\t\t\tif (iterationNum % 5 == 0) {\n\t\t\t\tSystem.out.println(\"Iteration: \" + iterationNum + \" Best Fitness: \" + bestFitness\n\t\t\t\t\t\t+ \" Average Fitness \" + aveFitness);\n\t\t\t\tSystem.out.println(\"Best solution: \" + bestIndividual.toString());\n\t\t\t\tSystem.out.println();\n\t\t\t\tout.write(\"\\n\" + iterationNum + \",\" + bestFitness + \",\" + aveFitness + \"\\r\");\n\t\t\t}\n\t\t\titerationNum++;\n\t\t}\n\t\tSystem.out.println(\n\t\t\t\t\"Iteration: \" + iterationNum + \" Best Fitness: \" + bestFitness + \" Average Fitness \" + aveFitness);\n\t\tSystem.out.println(\"Solution is \" + bestIndividual.toString());\n\t\tout.write(\"\\n\" + iterationNum + \",\" + bestFitness + \",\" + aveFitness + \"\\r\");\n\t\tout.close();\n\t}", "public Chromosome doExchangeMutation(){\n for(int i = 0; i < PopulationConfiguration.MUTATION_ATTEMPTS; i++){\n ArrayList<Boolean> newSelection = copyBoolArrayList(this.knapsackSelection);\n\n int allele1 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n int allele2 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n Collections.swap(newSelection, allele1, allele2);\n\n Chromosome mutatedKnapsack = new Chromosome(newSelection).withFitnessCalculated();\n if(mutatedKnapsack.isValid())\n return mutatedKnapsack;\n }\n return this;\n }", "public Chromosome(ArrayList<Teacher_lesson> list){\n\t\tthis.genes=new int[array_size];\n\t\tRandom r= new Random();\n\t\tfor(int i=0;i<genes.length;i++){\n\t\t\t\n\t\t\tthis.genes[i]=r.nextInt(number_of_professors);\n\t\t}\n\t\tthis.DataList=list;\n\t\tthis.calculateFitness();\n\t}", "int tournament() {\r\n \tint ch1,ch2;\r\n\t\tch1 = (int)Math.floor(Math.random()*SIZE);\r\n\t\tdo {\r\n\t\t\tch2 = (int)Math.floor(Math.random()*SIZE);\r\n\t\t} while (ch1==ch2);\r\n\t\tif (fit[ch1]<fit[ch2]) return ch1;\r\n\t\telse return ch2;\r\n }", "void CalculateProbabilities()\n\t{\n\t int i;\n\t double maxfit;\n\t maxfit=fitness[0];\n\t for (i=1;i<FoodNumber;i++)\n\t {\n\t if (fitness[i]>maxfit)\n\t maxfit=fitness[i];\n\t }\n\n\t for (i=0;i<FoodNumber;i++)\n\t {\n\t prob[i]=(0.9*(fitness[i]/maxfit))+0.1;\n\t }\n\n\t}", "private ArrayList<Chromosome> selectParentsRoulette() {\n ArrayList<Chromosome> parents = new ArrayList<Chromosome>(Defines.crossoverParentCt);\n double sumGH = 0.0; // sums GH for all chromosomes in this pop\n Random randgen = new Random(); // random number generator\n for (Chromosome chromo : this.chromosomes) {\n sumGH += chromo.getTotalGH();\n }\n for (int i = 0; i < Defines.crossoverParentCt; i++) {\n double parentRandomizer = randgen.nextDouble() * sumGH; // get random #\n double aggGH = 0.0; // aggregate the GH until we reach our random #\n int chromoIdx = 0; // identifies the chromosome in the pop\n Chromosome parentCandidate;\n do {\n parentCandidate = this.chromosomes.get(chromoIdx++);\n aggGH += parentCandidate.getTotalGH();\n } while (aggGH < parentRandomizer);\n parents.add(parentCandidate);\n }\n return parents;\n }", "public Population breedPopulation(EvolutionState state)\r\n {\n if( previousPopulation != null )\r\n {\r\n if( previousPopulation.subpops.length != state.population.subpops.length )\r\n state.output.fatal( \"The current population should have the same number of subpopulations as the previous population.\" );\r\n for( int i = 0 ; i < previousPopulation.subpops.length ; i++ )\r\n {\r\n if( state.population.subpops[i].individuals.length != previousPopulation.subpops[i].individuals.length )\r\n state.output.fatal( \"Subpopulation \" + i + \" should have the same number of individuals in all generations.\" );\r\n for( int j = 0 ; j < state.population.subpops[i].individuals.length ; j++ )\r\n if( previousPopulation.subpops[i].individuals[j].fitness.betterThan( state.population.subpops[i].individuals[j].fitness ) )\r\n state.population.subpops[i].individuals[j] = previousPopulation.subpops[i].individuals[j];\r\n }\r\n previousPopulation = null;\r\n }\r\n\r\n // prepare the breeder (some global statistics might need to be computed here)\r\n prepareDEBreeder(state);\r\n\r\n // create the new population\r\n Population newpop = (Population) state.population.emptyClone();\r\n\r\n // breed the children\r\n for( int subpop = 0 ; subpop < state.population.subpops.length ; subpop++ )\r\n {\r\n if (state.population.subpops[subpop].individuals.length < 4) // Magic number, sorry. createIndividual() requires at least 4 individuals in the pop\r\n state.output.fatal(\"Subpopulation \" + subpop + \" has fewer than four individuals, and so cannot be used with DEBreeder.\");\r\n \r\n Individual[] inds = state.population.subpops[subpop].individuals;\r\n for( int i = 0 ; i < inds.length ; i++ )\r\n {\r\n newpop.subpops[subpop].individuals[i] = createIndividual( state, subpop, inds, i, 0); // unthreaded for now\r\n }\r\n }\r\n\r\n // store the current population for competition with the new children\r\n previousPopulation = state.population;\r\n return newpop;\r\n }", "static int getFitness(double[][] matrix, Chromosome ch){\n int fitness = 0,\n tmpInd = 0;\n\n for (int i = 0; i < ch.size(); i++) {\n if (ch.getGene(i) == 1){\n fitness += matrix[tmpInd][i];\n tmpInd = i;\n }\n }\n return fitness;\n }", "private Vector step(){\n// System.out.println();\n// System.out.println(generationCount);\n// System.out.println(\"The Population is:\");\n// System.out.println(population);\n \n //DETERMINE WHO SURVIVES INTO NEXT GENERATION\n Vector nextGeneration = surviveType.run(population, fitnessArray);\n\n //DO THE CROSSOVER PROCESS\n //WHILE THE NEXT GENERATION ISN'T FULL\n while (nextGeneration.size() < (populationSize - randGenes)){\n //FIND PARENTS\n Gene parentOne, parentTwo;\n do {\n Gene[] parents = selectType.run(population, fitnessArray);\n parentOne = parents[0];\n parentTwo = parents[1];\n } while (selectPairs && (! closeEnough(parentOne, parentTwo)));\n //ADD CHILDREN\n Gene[] kids = crossType.children(parentOne, parentTwo);\n\n nextGeneration.add(kids[0]);\n if (nextGeneration.size() < (populationSize - randGenes)){\n nextGeneration.add(kids[1]);\n }\n }\n //ADD RANDOM GENES TO THE POPULATION\n while (nextGeneration.size() < populationSize){\n nextGeneration.add(initializer.createRandomGene(fitnessFunction, minRadius, maxRadius));\n }\n //MUTATE THE NEXT GENERATION\n for (int j = 0; j < populationSize; j++){\n if (Math.random() < mutationProb){\n nextGeneration.set(j, mutationType.run((Gene) nextGeneration.get(j)));\n }\n }\n\n //COMPUTE FITNESSES AND RELOCATE IF NECESSARY\n Gene bestGene = (Gene) nextGeneration.get(0);\n int bestX = 0;\n for (int x = 0; x < populationSize; x++){\n Gene next = (Gene) nextGeneration.get(x);\n while (relocationType.move(bannedList, next)){\n Gene newGene = initializer.createRandomGene(fitnessFunction, minRadius, maxRadius);\n next = newGene;\n nextGeneration.set(x, next);\n }\n fitnessArray[x] = next.getFitness();\n\n //FOR THE PURPOSES OF UPDATING THE BANNED LIST\n if (next.getFitness() > bestGene.getFitness()){\n bestGene = next;\n bestX = x;\n }\n } //End for (int x = 0;...\n\n Arrays.sort(fitnessArray);\n\n //UPDATE THE BANNED LIST BY ADDING THE BEST GENE IN THE NEXT GENERATION IF IT'S ABOVE minAccepted AND CONTAINS MORE THAN minPoints POINTS\n if (useList){\n if ((generationCount >= firstAdd) &&\n (solutionCounter >= countNum) &&\n (bestGene.getFitness() >= minAccepted) &&\n (bestGene.getCount() >= minPoints)){\n solutionCounter = 0;\n// System.out.println(bestGene);\n Gene bestClone = new Gene (bestGene.getMajorAxisRadius(), //THIS KLUDGE IS DONE B/C .clone() IS\n bestGene.getMinorAxisRadius(), //PROTECTED, AND I CAN'T UNPROTECT IT.\n bestGene.getX(), //I USE A CLONED GENE TO PREVENT A MUTATION\n bestGene.getY(), //IN THE NEXT GENERATION FROM ALTERING bannedList\n bestGene.getOrientation(),\n bestGene.getFunction());\n bannedList = relocationType.updateBannedList(bannedList, bestClone);\n\n\n //IF NECESSARY, UPDATE THE SOLUTION LIST BY ADDING ALL CLUSTERS WITH MORE THAN minPoints POINTS AND A FITNESS OF AT LEAST minAccepted\n if (returnAllSolutions){\n for (int i = 0; i < populationSize; i++){\n Gene next = (Gene) nextGeneration.get(i);\n if ((next.getFitness() >= minAccepted) && (next.getCount() >= minPoints)){\n solutionList.add(next);\n }\n }//End for (int i = 0...\n } else {\n solutionList = bannedList;\n } //End if (returnAllSolutions){...}else{\n } //End if (generationCount > 4...\n } //End if (useList){\n\n generationCount = generationCount + 1;\n solutionCounter = solutionCounter + 1;\n\n //IF AVOIDING CONVERGENCE, AND IT HAS CONVERGED, START OVER WITH RANDOM GENES\n\n double bestFitness = bestGene.getFitness();\n double medianFitness = roundToHundredths((double) fitnessArray[(int) Math.floor(populationSize / 2)]);\n\n// System.out.println(bestFitness);\n// System.out.println(medianFitness);\n\n if ((antiConvergence) &&\n ((bestFitness - medianFitness) < (0.01 * bestFitness)) &&\n (generationCount > firstAdd)){\n nextGeneration = initializer.getGenes(populationSize, fitnessFunction, minRadius, maxRadius);\n// System.out.println(\"EXPLODED CONVERGENCE!\");\n for (int x = 0; x < populationSize; x++){\n Gene next = (Gene) nextGeneration.get(x);\n fitnessArray[x] = next.getFitness();\n }\n Arrays.sort(fitnessArray);\n }\n\n return nextGeneration;\n }", "public static List<Double> selection(PolyPopulation pop, double cutoff) {\n\t\tint lastGenerationNum = pop.getGroupCapacity();\n\t\tList<PolyIndividual> nextGeneration = new ArrayList<>();\n\t\tList<Double> fitList = new ArrayList<>();\n\t\tList<Double> valueList = new ArrayList<>();\n\t\tList<Double> actValueList = new ArrayList<>();\n\t\tdouble max = 0.0;\n\t\tdouble totalFit = 0.0;\n\t\t//calculate the value of each individual in the population\n\t\tfor(int i = 0; i < pop.getGroupCapacity(); i++) {\n\t\t\tdouble val = f(pop.getIndis().get(i).getGenotype());\n\t\t\tvalueList.add(val);\n\t\t\t//get the Max value, use it\n\t\t\tif(i == 0) max = val;\n\t\t\telse if(val > max) max = val;\n\t\t}\n\t\t//based on the value insists now, calculate the fitness of each individual and their total fitness\n\t\tfor(int i = 0; i < pop.getGroupCapacity(); i++) {\n\t\t\tdouble fit = 1/(max - valueList.get(i) + 10);\n\t\t\tfitList.add(fit);\n\t\t\ttotalFit+=fit;\n\t\t}\n\t\t\n\t\twhile(nextGeneration.size() < lastGenerationNum*cutoff) {\t\t\t\n\t\t\tdouble selectionVal = Math.random();\n\t\t\tdouble accumulateVal = 0.0;\n\t\t\tfor(int i = 0; i < pop.getGroupCapacity(); i++) {\n\t\t\t\tif(selectionVal >= accumulateVal && selectionVal < (accumulateVal+fitList.get(i)/totalFit)) {\n\t\t\t\t\tnextGeneration.add(pop.getIndis().get(i));\n\t\t\t\t\tactValueList.add(valueList.get(i));\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\taccumulateVal+=(fitList.get(i)/totalFit);\n\t\t\t}\n\t\t}\n\t\tpop.setIndis(nextGeneration);\n\t\tpop.setGroupCapacity(nextGeneration.size());\n\t\treturn actValueList;\n\t}", "public void fitnessFunction()\n\t{\n\t\t\n\t}", "protected float getFitness()\t\t\t{\treturn fitness;\t\t}", "public Population evolve()\r\n {\r\n\tArrayList<Chromosome> tempPop = \r\n\t new ArrayList<Chromosome>(chromos.size());\r\n\tChromosome u;\r\n\tChromosome v;\r\n\r\n\tfor(int i = 0; i < chromos.size()/2; i++)\r\n\t {\r\n\t\tu = selectParent();\r\n\t\tv = selectParent();\r\n\t\t\r\n\t\t//System.out.println(\"*****Parent 1 : \\n\" + v);\r\n\t\t\r\n Chromosome c1 = u.child(v);\r\n Chromosome c2 = v.child(u);\r\n\t\ttempPop.add(c1);\r\n\t\ttempPop.add(c2);\r\n\t\t\r\n //System.out.println(\"****Generated new child: \\n\" + c1);\r\n\t }\t \r\n\t\r\n\t// if needed, add in the code for keeping the best chromosome\r\n\tPopulation pop = new Population(tempPop, selMethod, selPara, \r\n\t\t\t\t\tcrossMethod, crossPara, mutMethod, mutPara, \r\n\t\t\t\t\treplaceMethod, replacePara, powerStep, tourStep, ff);\r\n\r\n\tif(replaceMethod == ELITISM)\r\n\t {\r\n\t\tpop.remove(worstChromoIndex);\r\n\t\tpop.add(bestChromo.clone());\r\n\t\tpop.initialize();\r\n\t }\r\n\r\n\tgeneration++;\r\n\treturn pop;\r\n }", "@Test\n public void testChromosome() {\n\n Assert.assertTrue(this.chromB1.getGenes().length == 4);\n Assert.assertTrue(this.chromB1.getSize() == 4);\n Assert.assertTrue(this.chromB1.getGenes()[0] == 1);\n Assert.assertTrue(this.chromB1.getGenes()[1] == 2);\n Assert.assertTrue(this.chromB1.getGenes()[2] == 3);\n Assert.assertTrue(this.chromB1.getGenes()[3] == 4);\n }", "@Override\n\tpublic int compareTo(Chromosome o) {\n\t\tif(this.getFitness()<o.getFitness())\n\t\t\treturn -1;\n\t\telse if(this.getFitness()>o.getFitness())\n\t\t\treturn 1;\n\t\telse\n\t\t\treturn 0;\n\t}", "void ComputeFitness(){\n\t\tint i, pos;\n\t\t// individual t;\n\t\tdouble min, sum = 0, sumSize = 0, tm;\n\t\t// First Compute Raw fitness\n\t\tfor(i = 0; i < poplen; i++)\n\t\t{\n\t\t\tif(oldpop[i].evaluated==FALSE)\n\t\t\t{ tm=ComputeRF(oldpop[i]);\n\t\t\t\toldpop[i].fitness = tm;\n\t\t\t\toldpop[i].oldfitness = tm;\n\t\t\t\toldpop[i].evaluated=TRUE;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\toldpop[i].fitness=oldpop[i].oldfitness;\n\t\t\t}\n\t\t\t\n\t\t\t//oldpop[i].DisplayIndividual();\n\t\t\t//System.out.println(oldpop[i].fitness);\n\t\t}\n\t\t//tim individual co fitness be nhat\n\t\tmin = oldpop[0].fitness;\n\t\tpos = 0;\n\t\tsum = oldpop[0].fitness;\n\t\tsumSize = oldpop[0].size;\n\t\t\n\t\tfor(i = 1; i < poplen; i++) {\n\t\t\tif(oldpop[i].fitness < min) {\n\t\t\t\tmin = oldpop[i].fitness;\n\t\t\t\tpos = i;\n\t\t\t}\n\t\t\tsum += oldpop[i].fitness;\n\t\t\tsumSize += oldpop[i].size;\n//\t\t\tpopSize[gen][i]= oldpop[i].size;\n\t\t}\n\t\t// copy the best and average\n\t\tbestcurrent[gen] = new individual();\n\t\tbestcurrent[gen].CopyIndividual(oldpop[pos], TRUE);\n\t\taverage[gen] = sum /poplen;\n\t\taverageSize[gen] = sumSize /poplen;\n\t\t// Third Compute Adjusted fitness\n\t\tAdjustFitness();\n\t\t// Finally Compute nomarlized fitness\n \t\tNormalizeFitness();\n\t}", "void calculateFitness() {\n if (reachedGoal) {\n fitness = 1d / 16d + 8192d / (genome.step * genome.step);\n } else {\n double d = position.distance(Game.Setup.goal);\n fitness = 1d / (d * d);\n }\n }", "float genChance();", "private int tournament()\r\n {\r\n\tint out = spinTheWheel();\r\n\tdouble max = ff.evaluate(chromos.get(out),generation());\r\n\tdouble temp_fitness = 0;\r\n\tint temp_index = 0;\r\n\r\n\tfor(int i = 0; i < selPara - 1 + tourStep*generation(); i++)\r\n\t {\r\n\t\ttemp_index = spinTheWheel();\r\n\t\ttemp_fitness = ff.evaluate(chromos.get(temp_index),generation());\r\n\t\tif(temp_fitness > max)\r\n\t\t {\r\n\t\t\tmax = temp_fitness;\r\n\t\t\tout = temp_index;\r\n\t\t }\r\n\t }\r\n\treturn out;\r\n }", "private static double fitness(PMCGenotype gene, int trials)\n\t{\n\t\tController<MOVE> btc = new PacManBTController(decode(gene));\n\t\treturn runExperiment(btc, ghostController, trials);\n\t}", "public int getFitness(){\n return fitness;\n }", "public static void reproduce (Species [][] map, int sheepHealth, int wolfHealth, int plantHealth) {\n \n // Place the baby\n int babyY, babyX;\n \n // Check if the baby has been placed\n int spawned = 0;\n \n for (int y = 0; y < map[0].length; y++){\n for (int x = 0; x < map.length; x++){\n \n boolean [][] breeding = breedChoice (map, x, y, plantHealth);\n \n // Sheep upwards to breed with\n if (breeding[0][0]) {\n ((Sheep)map[y][x]).reproduceHealthLost(10);\n ((Sheep)map[y-1][x]).reproduceHealthLost(10);\n \n // Make baby sheep\n Sheep sheep = new Sheep(sheepHealth, x, y);\n \n // Place the baby sheep\n do {\n babyY = (int)(Math.random() * map.length);\n babyX = (int)(Math.random() * map.length);\n if (map[babyY][babyX] == null) {\n map[babyY][babyX] = sheep;\n spawned = 1;\n }\n } while (spawned == 0);\n \n // Sheep downwards to breed with\n } else if (breeding[1][0]) {\n ((Sheep)map[y][x]).reproduceHealthLost(10);\n ((Sheep)map[y+1][x]).reproduceHealthLost(10);\n \n // Make baby sheep\n Sheep sheep = new Sheep(sheepHealth, x, y);\n \n // Place the baby sheep\n do {\n babyY = (int)(Math.random() * map.length);\n babyX = (int)(Math.random() * map.length);\n if (map[babyY][babyX] == null) {\n map[babyY][babyX] = sheep;\n spawned = 1;\n }\n } while (spawned == 0);\n \n // Sheep to the left to breed with\n } else if (breeding[2][0]) {\n ((Sheep)map[y][x]).reproduceHealthLost(10);\n ((Sheep)map[y][x-1]).reproduceHealthLost(10);\n \n // Make baby sheep\n Sheep sheep = new Sheep(sheepHealth, x, y);\n \n // Place the baby sheep\n do {\n babyY = (int)(Math.random() * map.length);\n babyX = (int)(Math.random() * map.length);\n if (map[babyY][babyX] == null) {\n map[babyY][babyX] = sheep;\n spawned = 1;\n }\n } while (spawned == 0);\n \n // Sheep to the right to breed with\n } else if (breeding[3][0]) {\n ((Sheep)map[y][x]).reproduceHealthLost(10);\n ((Sheep)map[y][x+1]).reproduceHealthLost(10);\n \n // Make baby sheep\n Sheep sheep = new Sheep(sheepHealth, x, y);\n \n // Place the baby sheep\n do {\n babyY = (int)(Math.random() * map.length);\n babyX = (int)(Math.random() * map.length);\n if (map[babyY][babyX] == null) {\n map[babyY][babyX] = sheep;\n spawned = 1;\n }\n } while (spawned == 0);\n \n // Wolf upwards to breed with\n } else if (breeding[0][1]) {\n ((Wolf)map[y][x]).reproduceHealthLost(10);\n ((Wolf)map[y-1][x]).reproduceHealthLost(10);\n \n // Make baby wolf\n Wolf wolf = new Wolf(wolfHealth, x, y);\n \n // Place the baby wolf\n do { \n babyY = (int)(Math.random() * map.length);\n babyX = (int)(Math.random() * map.length);\n if (map[babyY][babyX] == null) {\n map[babyY][babyX] = wolf;\n spawned = 1; \n }\n } while (spawned == 0);\n \n // Wolf downwards to breed with\n } else if (breeding[1][1]) {\n ((Wolf)map[y][x]).reproduceHealthLost(10);\n ((Wolf)map[y+1][x]).reproduceHealthLost(10);\n \n // Make baby wolf\n Wolf wolf = new Wolf(wolfHealth, x, y);\n \n // Place the baby wolf\n do { \n babyY = (int)(Math.random() * map.length);\n babyX = (int)(Math.random() * map.length);\n if (map[babyY][babyX] == null) {\n map[babyY][babyX] = wolf;\n spawned = 1; \n }\n } while (spawned == 0);\n \n // Wolf to the left to breed with\n } else if (breeding[2][1]) {\n ((Wolf)map[y][x]).reproduceHealthLost(10);\n ((Wolf)map[y][x-1]).reproduceHealthLost(10);\n \n // Make baby wolf\n Wolf wolf = new Wolf(wolfHealth, x, y);\n \n // Place the baby wolf\n do { \n babyY = (int)(Math.random() * map.length);\n babyX = (int)(Math.random() * map.length);\n if (map[babyY][babyX] == null) {\n map[babyY][babyX] = wolf;\n spawned = 1; \n }\n } while (spawned == 0);\n \n // Wolf to the right to breed with\n } else if (breeding[3][1]) {\n ((Wolf)map[y][x]).reproduceHealthLost(10);\n ((Wolf)map[y][x+1]).reproduceHealthLost(10);\n \n // Make baby wolf\n Wolf wolf = new Wolf(wolfHealth, x, y);\n \n // Place the baby wolf\n do { \n babyY = (int)(Math.random() * map.length);\n babyX = (int)(Math.random() * map.length);\n if (map[babyY][babyX] == null) {\n map[babyY][babyX] = wolf;\n spawned = 1; \n }\n } while (spawned == 0);\n \n }\n \n }\n }\n \n }", "public void modifyFitness(Population population) {\n // prepare the calculation\n double[][] data = new double[population.size()][];\n for (int i = 0; i < data.length; i++) {\n data[i] = ((AbstractEAIndividual)population.get(i)).getFitness();\n }\n double min = Double.POSITIVE_INFINITY, fitnessSharing;\n double[] result = new double[data.length];\n AbstractEAIndividual tmpIndy;\n\n for (int x = 0; x < data[0].length; x++) {\n for (int i = 0; i < data.length; i++) data[i][x] = -data[i][x];\n for (int i = 0; i < data.length; i++) {\n if (data[i][x] < min) min = data[i][x];\n }\n\n for (int i = 0; i < data.length; i++) {\n // This will cause the worst individual to have no chance of being selected\n // also note that if all individual achieve equal fitness the sum will be zero\n result[i] = data[i][x] -min + 0.1;\n }\n\n for (int i = 0; i < population.size(); i++) {\n tmpIndy = (AbstractEAIndividual)population.get(i);\n fitnessSharing = 0;\n for (int j = 0; j < population.size(); j++) {\n if (this.m_SharingDistance < this.m_Metric.distance(tmpIndy, (AbstractEAIndividual)population.get(j))) {\n fitnessSharing += 1 - (this.m_Metric.distance(tmpIndy, (AbstractEAIndividual)population.get(j))/this.m_SharingDistance);\n }\n }\n result[i] = result[i]/fitnessSharing;\n }\n\n for (int i = 0; i < population.size(); i++) {\n ((AbstractEAIndividual)population.get(i)).SetFitness(x, result[i]);\n }\n }\n }", "public void evaluatePopulation() {\n // reset the total fitness score\n totalFitness = 0;\n\n for (int i = 0; i < populationSize; i++) {\n population.get(i).setRawFitness(\n FeederCollection.getFeeders().get(i).GetFitness());\n totalFitness += population.get(i).getRawFitness();\n }\n\n // set the normalized fitness for each population member\n for (Genotype g : population) {\n // normalized fitness = raw fitness / total fitness\n g.setNormalizedFitness((g.getRawFitness() / totalFitness));\n }\n\n // sort the popoulation\n Collections.sort(population, Genotype.FitnessOrder);\n\n highFitnesses.add(population.get(0).getRawFitness());\n avgFitnesses.add(totalFitness / population.size());\n\n\n }", "public Chromosome doInsertionMutation(){\n for(int i = 0; i < PopulationConfiguration.MUTATION_ATTEMPTS; i++){\n ArrayList<Boolean> newSelection = copyBoolArrayList(this.knapsackSelection);\n\n int allele1 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n int allele2 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n boolean value = newSelection.get(allele2);\n\n newSelection.remove(allele2);\n try{\n newSelection.add(allele1 + 1, value);\n }\n catch(IndexOutOfBoundsException e){\n newSelection.add(value);\n }\n \n Chromosome mutatedKnapsack = new Chromosome(newSelection).withFitnessCalculated();\n if(mutatedKnapsack.isValid())\n return mutatedKnapsack;\n }\n return this;\n }", "public double calcFitness(int[] genes) {\n\t\treturn 0;\n\t}", "@Test\n\tpublic void testGA() {\n\t\tGenetic ga = new Genetic(100, 500, 10, SelectionType.TOURNAMENT , 0.6, 0.1);\n\t\tOptimumSolution os = ga.run();\n\t\tSystem.out.println(os.getSolution());\n\t}", "public void calcularFitness() {\n double fit = 0;\r\n for (int x=0; x < this.genotipo.length;x++){\r\n if (x!=this.genotipo.length-1){\r\n fit+=distancias[this.genotipo[x]][this.genotipo[x+1]];\r\n }else{\r\n fit+=distancias[this.genotipo[x]][this.genotipo[0]];\r\n }\r\n }\r\n this.fitness = fit;\r\n }", "private static ArrayList<Chromosome> generateNearestNeighbourPopulation(int pathLength, int nnPopulationSize){\n // declaring the arraylist of chromosomes which will store the\n ArrayList<Chromosome> nnPopualtion = new ArrayList<>();\n\n // declaring a set which will contain all the starting cities that will be used for the population\n Set<Integer> startingCities = new HashSet<>();\n // initialising the set of startingCities with random cities. It being a set no duplicates are allowed\n while (startingCities.size() < nnPopulationSize) {\n startingCities.add(ThreadLocalRandom.current().nextInt(0, pathLength));\n }\n\n // An ArrayList with all the cityIDs which can be copied to keep track of visited/unvisited cities\n ArrayList<Integer> cities = new ArrayList<>();\n for (int i = 0; i < pathLength; i++) {\n cities.add(i);\n }\n\n // for every starting city\n for (Integer startingCity : startingCities) {\n // set the currentCity as the Starting City\n int currentCity = startingCity;\n // Declare a new chromosome to store this new path\n Chromosome chromosome = new Chromosome(pathLength);\n // Set the first city in the path as the startingCity\n chromosome.path[0] = startingCity;\n\n // Declare a new Set of unvisitedCities, and initialise it as a copy of the ArrayList of cityIDs\n Set<Integer> unvisitedCities = new HashSet<>(cities);\n // remove the startingCity from the set of unvisitedCities\n unvisitedCities.remove(startingCity);\n\n // for the length of the path\n for (int i = 1; i < pathLength; i++) {\n // initially set the closestCity to a random city from the set of unvisitedCities\n int closestCity = unvisitedCities.iterator().next();\n // loop through every unvisitedCity to find the closestCity\n for (Integer city : unvisitedCities) {\n // if the distance between the currentCity and the unvisitedCity is < the distance between\n // the currentCity and the closestCity\n if (distanceMatrix[currentCity][city] < distanceMatrix[currentCity][closestCity]) {\n // set thet unvisitedCity as the closestCity\n closestCity = city;\n }\n }\n // add the closestCity as the next city in the path\n chromosome.path[i] = closestCity;\n // make the currentCity for the next iteration the current closestCity\n currentCity = closestCity;\n // remove the closestCity from the set of unvisitedCities\n unvisitedCities.remove(closestCity);\n }\n\n // add the generated chromosome to the ArrayList of the initial nnPopulation\n nnPopualtion.add(chromosome);\n }\n\n return nnPopualtion;\n }", "public abstract double evaluateFitness();", "private static void mating() {\n\t\tint getRand = 0;\n\t\tint parentA = 0;\n\t\tint parentB = 0;\n\t\tint newIndex1 = 0;\n\t\tint newIndex2 = 0;\n\t\tChromosome newChromo1 = null;\n\t\tChromosome newChromo2 = null;\n\n\t\tfor (int i = 0; i < OFFSPRING_PER_GENERATION; i++) {\n\t\t\tparentA = chooseParent();\n\t\t\t// Test probability of mating.\n\t\t\tgetRand = getRandomNumber(0, 100);\n\t\t\tif (getRand <= MATING_PROBABILITY * 100) {\n\t\t\t\tparentB = chooseParent(parentA);\n\t\t\t\tnewChromo1 = new Chromosome();\n\t\t\t\tnewChromo2 = new Chromosome();\n\t\t\t\tpopulation.add(newChromo1);\n\t\t\t\tnewIndex1 = population.indexOf(newChromo1);\n\t\t\t\tpopulation.add(newChromo2);\n\t\t\t\tnewIndex2 = population.indexOf(newChromo2);\n\n\t\t\t\t// Choose either, or both of these:\n\t\t\t\tpartiallyMappedCrossover(parentA, parentB, newIndex1, newIndex2);\n\t\t\t\t// positionBasedCrossover(parentA, parentB, newIndex1, newIndex2);\n\n\t\t\t\tif (childCount - 1 == nextMutation) {\n\t\t\t\t\texchangeMutation(newIndex1, 1);\n\t\t\t\t} else if (childCount == nextMutation) {\n\t\t\t\t\texchangeMutation(newIndex2, 1);\n\t\t\t\t}\n\n\t\t\t\tpopulation.get(newIndex1).computeConflicts();\n\t\t\t\tpopulation.get(newIndex2).computeConflicts();\n\n\t\t\t\tchildCount += 2;\n\n\t\t\t\t// Schedule next mutation.\n\t\t\t\tif (childCount % (int) Math.round(1.0 / MUTATION_RATE) == 0) {\n\t\t\t\t\tnextMutation = childCount + getRandomNumber(0, (int) Math.round(1.0 / MUTATION_RATE));\n\t\t\t\t}\n\t\t\t}\n\t\t} // i\n\t\treturn;\n\t}", "private double getUnadjustedFitness(Computer computer){\n double score = 0;\n score += 6 * getMatchPercent(computer);\n if(computer.compatible() && sizeCompatability(computer))\n score += 9.5;\n int ramAmount =computer.ramAmount();\n if(ramAmount < 8)\n score -= (8 - ramAmount) * 2;\n else if(ramAmount > 8 && ramAmount < 17)\n score += .06 * (ramAmount - 8);\n else if(ramAmount > 17)\n score += .03 * (ramAmount - 8);\n\n if(computer.cpu.name.contains(\"Intel\") && computer.cpu.name.endsWith(\"K\")){\n if (!computer.motherboard.overclock()){\n score -= 6;\n }\n }\n\n if(computer.cpu.name.contains(\"Intel\") && !(computer.cpu.shortname.contains(\"-5\") || computer.cpu.shortname.contains(\"-6\"))){\n score -= 2;\n }\n if(computer.cpu.name.contains(\"GeForce\") && !(computer.gpu.name.contains(\"GTX 9\") || computer.gpu.name.contains(\"GTX 1\"))){\n score -= 2;\n }\n if(computer.bootDrive.size < 240)\n score -= settings.diskSize * 0.33;\n if(computer.bootDrive.size > 700)\n score += settings.diskSize * 5;\n else\n score += settings.diskSize * computer.bootDrive.size / 140;\n if(computer.secondaryDrive != null)\n score += settings.diskSize * computer.secondaryDrive.size / 1000;\n\n //Now ensure there's enough power, and give a bonus for there being ~300 watts more than needed;\n //there are 4.5 points to gain in powersupply, 10 points to lose\n int basePower = computer.powerConsumption();\n int ideal = basePower + 65;\n if(computer.power.watts < basePower)\n score -= 10;\n else if(computer.power.watts < ideal)\n score += (basePower - computer.power.watts) / 100;\n else\n score += 2.5 - (computer.power.watts - basePower) / 250;\n score += (3 - computer.power.tier) * .6;\n\n // Now motherboard, one point to gain, one to lose\n score += 2 - computer.motherboard.getQuality();\n\n double driveScore = ((computer.bootDrive.reads + computer.bootDrive.writes) / 2) / 88;\n driveScore -= 2;\n if(driveScore > 7.5){\n driveScore = 7.5;\n }\n score += driveScore;\n double rawCpu = ((1 - settings.multicore) / 3) * computer.cpu.singlecore + ((settings.multicore / 3) * (computer.cpu.multicore));\n double adjustedCpu = 26 + 40* ((settings.cpuIntensity / (settings.cpuIntensity + settings.gpuIntensity))* rawCpu - lowCpuScore()) / (maxCpuScore() - lowCpuScore());\n double rawGpu = computer.gpu.fps + (computer.gpu.threedmark / 100);\n double adjustedGpu = 17 + 40 * ((settings.gpuIntensity / (settings.cpuIntensity + settings.gpuIntensity)) * rawGpu - lowGpuScore()) / (maxGpuScore() - lowGpuScore());\n //Inflate the GPU score slightly\n // adjustedGpu * ((35 - adjustedGpu) / 35);\n score += adjustedGpu;\n score += adjustedCpu;\n\n return score;\n }", "public void testSelect_0()\n throws Exception {\n BestChromosomesSelector selector = new BestChromosomesSelector(conf);\n Gene gene = new IntegerGene(conf);\n gene.setAllele(new Integer(444));\n Chromosome secondBestChrom = new Chromosome(conf, gene, 3);\n secondBestChrom.setFitnessValue(11);\n selector.add(secondBestChrom);\n gene = new BooleanGene(conf);\n gene.setAllele(Boolean.valueOf(false));\n Chromosome bestChrom = new Chromosome(conf, gene, 3);\n bestChrom.setFitnessValue(12);\n selector.add(bestChrom);\n selector.select(1, null, new Population(conf));\n }", "private static List<Gene> getGenePool() {\n List<Gene> list = new ArrayList<>();\n\n Item item1 = new Item();\n item1.setName(\"Swiss Army Knife\");\n item1.setWeight(0.08125);\n item1.setVal(15);\n Gene gene1 = new Gene(item1);\n\n Item item2 = new Item();\n item2.setName(\"Duct Tape\");\n item2.setWeight(1.3);\n item2.setVal(3);\n Gene gene2 = new Gene(item2);\n\n Item item3 = new Item();\n item3.setName(\"Rope (50 feet)\");\n item3.setWeight(7);\n item3.setVal(10);\n Gene gene3 = new Gene(item3);\n\n Item item4 = new Item();\n item4.setName(\"Satellite phone\");\n item4.setWeight(2);\n item4.setVal(8);\n Gene gene4 = new Gene(item4);\n\n Item item5 = new Item();\n item5.setName(\"Elmer's Glue\");\n item5.setWeight(0.25);\n item5.setVal(2);\n Gene gene5 = new Gene(item5);\n\n Item item6 = new Item();\n item6.setName(\"Toilet Paper Roll\");\n item6.setWeight(.5);\n item6.setVal(4);\n Gene gene6 = new Gene(item6);\n\n Item item7 = new Item();\n item7.setName(\"Binoculars\");\n item7.setWeight(3);\n item7.setVal(5);\n Gene gene7 = new Gene(item7);\n\n Item item8 = new Item();\n item8.setName(\"Compass\");\n item8.setWeight(0.0573202);\n item8.setVal(15);\n Gene gene8 = new Gene(item8);\n\n Item item9 = new Item();\n item9.setName(\"Jug (pre-filled with water)\");\n item9.setWeight(4);\n item9.setVal(6);\n Gene gene9 = new Gene(item9);\n\n Item item10 = new Item();\n item10.setName(\"Flashlight\");\n item10.setWeight(2);\n item10.setVal(4);\n Gene gene10 = new Gene(item10);\n\n Item item11 = new Item();\n item11.setName(\"Box of paper clips\");\n item11.setWeight(.9);\n item11.setVal(2);\n Gene gene11 = new Gene(item11);\n\n Item item12 = new Item();\n item12.setName(\"Gloves (1 pair)\");\n item12.setWeight(.8125);\n item12.setVal(3);\n Gene gene12 = new Gene(item12);\n\n Item item13 = new Item();\n item13.setName(\"Scissors\");\n item13.setWeight(0.2);\n item13.setVal(2);\n Gene gene13 = new Gene(item13);\n\n Item item14 = new Item();\n item14.setName(\"Signal Flair (4pk)\");\n item14.setWeight(4);\n item14.setVal(5);\n Gene gene14 = new Gene(item14);\n\n Item item15 = new Item();\n item15.setName(\"Water Purifying System\");\n item15.setWeight(0.5125);\n item15.setVal(4);\n Gene gene15 = new Gene(item15);\n\n Item item16 = new Item();\n item16.setName(\"Whistle\");\n item16.setWeight(0.075);\n item16.setVal(2);\n Gene gene16 = new Gene(item16);\n\n Item item17 = new Item();\n item17.setName(\"Sleeping Bag\");\n item17.setWeight(0.38125);\n item17.setVal(4);\n Gene gene17 = new Gene(item17);\n\n Item item18 = new Item();\n item18.setName(\"Insect Repellent\");\n item18.setWeight(1.15);\n item18.setVal(3);\n Gene gene18 = new Gene(item18);\n\n Item item19 = new Item();\n item19.setName(\"Trowel\");\n item19.setWeight(0.31875);\n item19.setVal(3);\n Gene gene19 = new Gene(item19);\n\n Item item20 = new Item();\n item20.setName(\"Lighter\");\n item20.setWeight(.2);\n item20.setVal(4);\n Gene gene20 = new Gene(item20);\n\n Item item21 = new Item();\n item21.setName(\"Safety Horn\");\n item21.setWeight(.21);\n item21.setVal(3);\n Gene gene21 = new Gene(item21);\n\n Item item22 = new Item();\n item22.setName(\"Headlamp\");\n item22.setWeight(.8);\n item22.setVal(4);\n Gene gene22 = new Gene(item22);\n\n Item item23 = new Item();\n item23.setName(\"Freeze Dried Food Kit\");\n item23.setWeight(2);\n item23.setVal(6);\n Gene gene23 = new Gene(item23);\n\n Item item24 = new Item();\n item24.setName(\"Sunscreen\");\n item24.setWeight(.5);\n item24.setVal(4);\n Gene gene24 = new Gene(item24);\n\n Item item25 = new Item();\n item25.setName(\"Trekking Pole (Adjustable)\");\n item25.setWeight(1.3);\n item25.setVal(4);\n Gene gene25 = new Gene(item25);\n\n Item item26 = new Item();\n item26.setName(\"Counter Assault Bear Spray\");\n item26.setWeight(.5);\n item26.setVal(4);\n Gene gene26 = new Gene(item26);\n\n Item item27 = new Item();\n item27.setName(\"Insect Spray\");\n item27.setWeight(.5);\n item27.setVal(3);\n Gene gene27 = new Gene(item27);\n\n Item item28 = new Item();\n item28.setName(\"Hand sanitizer\");\n item28.setWeight(.625);\n item28.setVal(3);\n Gene gene28 = new Gene(item28);\n\n Item item29 = new Item();\n item29.setName(\"Mirror\");\n item29.setWeight(.5);\n item29.setVal(3);\n Gene gene29 = new Gene(item29);\n\n Item item30 = new Item();\n item30.setName(\"First Aid Kit\");\n item30.setWeight(3);\n item30.setVal(6);\n Gene gene30 = new Gene(item30);\n\n list.add(gene1);\n list.add(gene2);\n list.add(gene3);\n list.add(gene4);\n list.add(gene5);\n list.add(gene6);\n list.add(gene7);\n list.add(gene8);\n list.add(gene9);\n list.add(gene10);\n list.add(gene11);\n list.add(gene12);\n list.add(gene13);\n list.add(gene14);\n list.add(gene15);\n list.add(gene16);\n list.add(gene17);\n list.add(gene18);\n list.add(gene19);\n list.add(gene20);\n list.add(gene21);\n list.add(gene22);\n list.add(gene23);\n list.add(gene24);\n list.add(gene25);\n list.add(gene26);\n list.add(gene27);\n list.add(gene28);\n list.add(gene29);\n list.add(gene30);\n\n return list;\n }", "private static int maximum() {\n\t\tint popSize = 0;\n\t\tChromosome thisChromo = null;\n\t\tChromosome thatChromo = null;\n\t\tint winner = 0;\n\t\tboolean foundNewWinner = false;\n\t\tboolean done = false;\n\n\t\twhile (!done) {\n\t\t\tfoundNewWinner = false;\n\t\t\tpopSize = population.size();\n\t\t\tfor (int i = 0; i < popSize; i++) {\n\t\t\t\tif (i != winner) { // Avoid self-comparison.\n\t\t\t\t\tthisChromo = population.get(i);\n\t\t\t\t\tthatChromo = population.get(winner);\n\t\t\t\t\tif (thisChromo.conflicts() > thatChromo.conflicts()) {\n\t\t\t\t\t\twinner = i;\n\t\t\t\t\t\tfoundNewWinner = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (foundNewWinner == false) {\n\t\t\t\tdone = true;\n\t\t\t}\n\t\t}\n\t\treturn winner;\n\t}", "@Override\n public void mutate(Chromosome c) {\n if (c.getFitness() == 0) return;\n\n boolean[] genes = c.getGenes();\n int weight = c.getWeight();\n\n for (int i = 0; i < genes.length; i++) {\n if (weight == Config.CAPACITY) break;\n\n if (!genes[i]) {\n if (weight + Config.ITEMS[i].getWeight() <= Config.CAPACITY) {\n c.flipGene(i);\n }\n }\n }\n \n }", "private static Set<Chromosome> mutatePopulation(Set<Chromosome> population, double mutationRate) {\n Set<Chromosome> mutatedChromosomes = new HashSet<>(population);\n\n for (Chromosome path : mutatedChromosomes) {\n double mutationProbability = ThreadLocalRandom.current().nextDouble();\n if (mutationProbability > (1-mutationRate)) {\n // mutate the path using the RSM mutation operator\n mutateRoute(path);\n // indicate that the fitness of this path needs to be recalculated\n path.fitness = -1;\n }\n }\n\n // The set will most probably include certain chromosomes which are already present in the set of children\n // however, given that both are sets, any duplicates will be discarded\n return mutatedChromosomes;\n }", "public void runGenerational() {\n\n\t\tSystem.out.println(\"Runing pure generational demo.\");\n\t\tFunction<BitSet, Double> knapsackFitnessFunction = new KnapsackFitness(capacity, parseElements());\n\t\tSpace<BitSet> space = new BitSetSpace(weights.length);\n\n\t\tGeneticSelector<BitSet, Double> rouletteSelector = new RouletteGeneticSelector<>(POP_SIZE);\n\t\tGeneticCrossover<BitSet, Double> crossover = new BinaryCrossover<>(0.9);\n\t\tGeneticOperator<BitSet, Double> geneticOperator = new CustomGeneticOperator<>(crossover);\n\t\tGeneticReplacement<BitSet, Double> replacement = new GenerationalReplacement<>();\n\t\tTracer.add(Population.class);\n\t\tTracer.start();\n\n\t\tSearch<BitSet, Double> search = new GeneticAlgorithm<>(POP_SIZE, NUM_ITER, rouletteSelector, geneticOperator,\n\t\t\t\treplacement);\n\t\tOptimizationProblem<BitSet, Double> problem = new OptimizationProblem<>(space, knapsackFitnessFunction,\n\t\t\t\tComparator.reverseOrder());\n\t\tSolution<BitSet, Double> foundSolution = search.solve(problem);\n\n\t\tSystem.out.println(String.format(\"Best found solution: %f, bitset: %s\",\n\t\t\t\tknapsackFitnessFunction.calculate(foundSolution.getSolution()), foundSolution.getSolution()));\n\n\t\tBitSet optimalBitSet = parseOptimalBitSet();\n\t\tSystem.out.println(String.format(\"Optimal solution: %f, bitset: %s\",\n\t\t\t\tknapsackFitnessFunction.calculate(optimalBitSet), optimalBitSet));\n\t\tKnapsackMetric metric = new KnapsackMetric();\n\t\tmetric.putDataOfBestInFile(1);\n\t}", "public Individu selection() {\n\t\t// Pioche au hasard deux individus differents\n\t\tRandom rand = new Random();\n\t\tint index1 = 0, index2 = 0;\n\t\tindex1 = rand.nextInt(this.individus.size());\n\t\twhile(index1 == index2) {\n\t\t\tindex2 = rand.nextInt(this.individus.size());\n\t\t}\n\n\t\t//double fitness1 =\n\t\tdouble fitness1 = this.individus.get(index1).fitness();\n\t\tdouble fitness2 = this.individus.get(index2).fitness();\n\n\t\t// Determine le meilleur du moins bon\n\t\tIndividu better, worse;\n\t\tif(fitness1 > fitness2) {\n\t\t\tbetter = this.individus.get(index1);\n\t\t\tworse = this.individus.get(index2);\n\t\t} else {\n\t\t\tworse = this.individus.get(index1);\n\t\t\tbetter = this.individus.get(index2);\n\t\t}\n\n\t\t// Dans 75% des cas, onp rend le meilleur des deux\n\t\tif(rand.nextDouble() <= 0.75) {\n\t\t\treturn better;\n\t\t} else {\n\t\t\treturn worse;\n\t\t}\n\t}", "public int tournament(int size) {\n\t\t\n\t\tint best = 0;\n\t\tfloat bestFitness = Float.NEGATIVE_INFINITY;\n\t\t\n\t\t//selects the best individual from randomly sampled tournament participants\n\t\tfor(int i = 0; i < size; i++){\n\t\t\tint index = R.nextInt(populationSize);\n\t\t\tif(fitness[index] > bestFitness){\n\t\t\t\tbestFitness = fitness[index];\n\t\t\t\tbest = index;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn best;\n\t}", "double fitness(int gene) {\r\n \tint sum = 0;\r\n \tint prod= 1;\r\n \tfor (int j=0; j<LEN; j++) {\r\n \t\tif (oldpop[gene][j]==0) {\r\n \t\t\tsum += (j+1);\r\n \t\t} else {\r\n \t\t\tprod *= (j+1);\r\n \t\t}\r\n \t}\r\n \treturn Math.abs(sum - SUMTARG)/SUMTARG \r\n \t + Math.abs(prod - PRODTARG)/PRODTARG;\r\n }", "public Chromosome withRandomKnapsackItems() {\n this.knapsackSelection = generateRandomItems();\n return this;\n }", "public static void mutate(Chromosome chrome) {\n \n // Loop through tour cities\n for(int rosterNursePos1=0; rosterNursePos1 < chrome.ChromosomeRowSize(); rosterNursePos1++){\n for (int rosterDayPos1=0; rosterDayPos1<chrome.chromosomeColumnCount();rosterDayPos1++){\n if(RosterManager.isPreviousShift(chrome.getShift(rosterNursePos1, rosterDayPos1))==false || RosterManager.isNextShift(chrome.getShift(rosterNursePos1, rosterDayPos1))==false || chrome.getShift(rosterNursePos1, rosterDayPos1).getHours()!=0 ){\n if(Math.random() < mutationRate){\n // Get a second random position in the tour\n int rosterNursePos2= rosterNursePos1;\n int rosterDayPos2 = returnValidPos(rosterNursePos2, randomizeShiftGeneration(chrome), chrome );\n\n // Get the cities at target position in tour\n Gene gene1 = chrome.retrieveGene(rosterNursePos1, rosterDayPos1);\n Gene gene2 = chrome.retrieveGene(rosterNursePos2, rosterDayPos2);\n\n // Swap them around\n chrome.saveGene(rosterNursePos1, rosterDayPos1, gene2);\n chrome.saveGene(rosterNursePos2, rosterDayPos2, gene1);\n \n }\n \n \n } \n // Apply mutation rate\n \n }\n \n }\n \n \n }", "public double calculateFitness(DNA dna);", "float getFitnessScore(MapLocation l) {\n\t\ttry{\n\t\t\tif(rc.canSenseLocation(l) && !rc.onTheMap(l)) {\n\t\t\t\t//System.out.println(\"dead square\");\n\t\t\t\treturn -999999.0f;\n\t\t\t}\n\t\t} catch(Exception e){e.printStackTrace();}\n\t\t\n\t\tfloat fitness = 0.0f;\n\t\t\n\t\tfor(RobotInfo ri : allRobots) {\n\t\t\tfitness -= 1f/l.distanceSquaredTo(ri.location);\n\t\t}\n\t\tif(type.equals(RobotType.GARDENER)) {\n\t\t\tfor(TreeInfo ti : allTrees) {\n\t\t\t\tif(ti.team.equals(Team.NEUTRAL)) {\n\t\t\t\t\tfitness -= 1f/l.distanceSquaredTo(ti.location);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\tfitness -= 10f/l.distanceSquaredTo(lastLocation);\n\t\t\n\t\treturn fitness;\n\t}", "private int[] getElite(int[][] population) {\n\t\tfloat[] fitnesses = new float[population.length];\n\n\t\tfor (int i = 0; i < population.length; i++) {\n\t\t\tfitnesses[i] = getFitness(population[i]);\n\t\t\tif (fitnesses[i] < eliteFitness) {\n\t\t\t\tSystem.out.println(getFitness(eliteChromosome) + \" old\" + getFitness(population[i]) + \" new\");\n\t\t\t\teliteFitness = fitnesses[i];\n\t\t\t\teliteChromosome = population[i];\n\t\t\t}\n\t\t}\n\t\treturn eliteChromosome;\n\t}", "public double computeHeuristicGrade();", "public Vector run(){\n generationCount = 0;\n solutionList = new Vector();\n bannedList = new Vector();\n solutionCounter = 0;\n whenToHalt.init();\n //INITIALIZE THE POPULATION\n\n population = initializer.getGenes(populationSize, fitnessFunction, minRadius, maxRadius);\n fitnessArray = new double[populationSize];\n //COMPUTE FITNESSES\n for (int x = 0; x < populationSize; x++){\n Gene next = (Gene) population.get(x);\n fitnessArray[x] = next.getFitness();\n }\n\n Arrays.sort(fitnessArray);\n\n while (! stop()){\n //RUN THROUGH THE GENERATIONS\n population = step();\n }\n\n if (useList){\n return solutionList;\n } else {\n return population;\n }\n }", "public Chromosome doBitFlipMutation(){\n for(int i = 0; i < PopulationConfiguration.MUTATION_ATTEMPTS; i++){\n ArrayList<Boolean> newSelection = copyBoolArrayList(this.knapsackSelection);\n int itemToMutate = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n newSelection.set(itemToMutate, !newSelection.get(itemToMutate));\n\n Chromosome mutatedKnapsack = new Chromosome(newSelection).withFitnessCalculated();\n if(mutatedKnapsack.isValid())\n return mutatedKnapsack;\n }\n return this;\n }", "public Chromosome withFitnessCalculated() {\n this.fitness = calculateFitness();\n return this;\n }", "protected void SelectTournament() {\n\t // Torneo.length -> tournament size\n\t // if (tournament size == 2) then BinaryTournament\n this.setRanking();\n\t \n\t for (int i=0; i<this.PopLength; i++) {\n\t Torneo[0] = Randint(0,this.PopLength-1);\n\t int mejor_torneo=Torneo[0];\n\t \n\t for (int j=1; j<Torneo.length; j++) {\n\t boolean repetido= false;\n\t do {\n\t Torneo[j] = Randint(0,this.PopLength-1);\n\t repetido=false;\n\t int k=0;\n\t while ((k<j) && (!repetido))\n\t if (Torneo[j]==Torneo[k])\n\t repetido=true;\n\t else\n\t k++;\n\t } while (repetido);\n\t \n\t if (OLDevaluation[Torneo[j]] < OLDevaluation[mejor_torneo])\n\t mejor_torneo=Torneo[j];\n\t }\n\t sample[i] = mejor_torneo;\n\t }\n\t // Se crea la nueva poblacion\n\t for (int n=0; n<this.PopLength; n++) {\n\t int kk=sample[n];\n\t for (int m=0; m<this.NbGenes; m++) {\n\t NEWpopulation[n][m]= OLDpopulation[kk][m];\n\t }\n\t NEWevaluation[n]= OLDevaluation[kk];\n\t NEWevalIndex[n]= OLDevalIndex[kk];\n\t }\n }", "public float getFitness()\r\n\t{\r\n\t\treturn fitness;\r\n\t}", "public void testSelect_3()\n throws Exception {\n BestChromosomesSelector selector = new BestChromosomesSelector(conf);\n selector.setDoubletteChromosomesAllowed(false);\n // add first chromosome\n // --------------------\n Gene gene = new BooleanGene(conf);\n gene.setAllele(Boolean.valueOf(true));\n Chromosome thirdBestChrom = new Chromosome(conf, gene, 7);\n thirdBestChrom.setFitnessValue(10);\n selector.add(thirdBestChrom);\n // add second chromosome\n // ---------------------\n gene = new BooleanGene(conf);\n gene.setAllele(Boolean.valueOf(false));\n Chromosome bestChrom = new Chromosome(conf, gene, 3);\n bestChrom.setFitnessValue(12);\n selector.add(bestChrom);\n selector.setOriginalRate(1.0d);\n // receive top 30 chromosomes (select-method should take into account only\n // 2 chroms!)\n // -----------------------------------------------------------------------\n Population pop = new Population(conf);\n selector.select(30, null, pop);\n Population bestChroms = pop;\n Population chromosomes = (Population) privateAccessor.getField(selector,\n \"m_chromosomes\");\n assertTrue(bestChroms.equals(chromosomes));\n }", "public void reproduce(){\n\t\t// sort the population from strongest to weakest\n\t\tCollections.sort(population);\n\t\tCollections.reverse(population);\n\t\t\n\t\tfor(int i = 0; i < (int)(POPULATION_SIZE*POPULATION_ACTION_PERCENT); i+=2){\n\t\t\t\n\t\t\t// get two random indexes for reproduction based on the exponential function\n\t\t\t// (1/1000) * (randInt)^2 = index\n\t\t\t// this function favors sequences with higher fitness scores\n\t\t\tint randIndex1 = randomGenerator.nextInt((int)Math.sqrt(1000*POPULATION_SIZE*(1-POPULATION_ACTION_PERCENT)));\n\t\t\tint randIndex2 = randomGenerator.nextInt((int)Math.sqrt(1000*POPULATION_SIZE*(1-POPULATION_ACTION_PERCENT)));\n\t\t\t\n\t\t\trandIndex1 = (int) (Math.pow(randIndex1, 2) / 1000);\n\t\t\trandIndex2 = (int) (Math.pow(randIndex2, 2) / 1000);\n\t\t\t\n\t\t\t// get two pieces\n\t\t\tBuildingPiece[] array1 = population.get(randIndex1).getList();\n\t\t\tBuildingPiece[] array2 = population.get(randIndex2).getList();\n\t\t\t\n\t\t\t// find a splicing point\n\t\t\tint splicePoint = findSplicingPoint(array1, array2);\n\t\t\t\n\t\t\t// generate two new arrays based on the splicing point\n\t\t\tBuildingPiece[] newArray1 = generateNewArray(array1, array2, splicePoint);\n\t\t\tBuildingPiece[] newArray2 = generateNewArray(array2, array1, splicePoint);\n\t\t\t\n\t\t\t// make new buildings with the new arrays\n\t\t\tBuilding bp1 = new Building(newArray1, generation, possiblePieces);\n\t\t\tBuilding bp2 = new Building(newArray2, generation, possiblePieces);\n\t\t\t\n\t\t\t// mutate the new building sequences\n\t\t\tmutateArray(bp1);\n\t\t\tmutateArray(bp2);\n\t\t\t\n\t\t\t// add them into the population\n\t\t\tpopulation.add(randIndex1, bp1);\n\t\t\tpopulation.add(randIndex2, bp2);\n\t\t}\n\t}", "public StrategyByGA(double ProbabilityOfCooperatingGivenCooperation,\n double ProbabilityOfCooperatingGivenDefection) {\n\n name = \"Strategy Developed by the Genetic Algorithm\";\n opponentLastMove = 1;\n proCoopGivCoop = ProbabilityOfCooperatingGivenCooperation;\n proCoopGivDef = ProbabilityOfCooperatingGivenDefection;\n }", "public List<Chromosome> doCrossover(Chromosome other, String crossoverType){\n int geneSize = this.knapsackSelection.size();\n\n ArrayList<Chromosome> children = new ArrayList<>();\n\n //Allow for multiple crossover attempts to better the chance of a valid crossover.\n //Note that this can be disabled by setting GAConfiguration.CONCEPTION_ATTEMPTS = 1.\n for(int i = 0; i < PopulationConfiguration.CONCEPTION_ATTEMPTS; i++){\n\n //Set first crossover point to 0 if 1PX Crossover.\n int crossPoint1 = crossoverType.equals(\"1PX\") ? 0 : Configuration.RANDOM_GENERATOR.nextInt(geneSize);\n int crossPoint2 = Configuration.RANDOM_GENERATOR.nextInt(geneSize - crossPoint1) + crossPoint1;\n\n ArrayList<Boolean> c1 = new ArrayList<>();\n ArrayList<Boolean> c2 = new ArrayList<>();\n\n c1.addAll(this.knapsackSelection.subList(0, crossPoint1));\n c1.addAll(other.getKnapsackSelection().subList(crossPoint1, crossPoint2));\n c1.addAll(this.knapsackSelection.subList(crossPoint2, geneSize));\n Chromosome child1 = new Chromosome(c1).withFitnessCalculated();\n\n c2.addAll(other.getKnapsackSelection().subList(0, crossPoint1));\n c2.addAll(this.knapsackSelection.subList(crossPoint1, crossPoint2));\n c2.addAll(other.getKnapsackSelection().subList(crossPoint2, geneSize));\n Chromosome child2 = new Chromosome(c2).withFitnessCalculated();\n \n if(child1.isValid() && children.size() < 2){\n children.add(child1);\n }\n if(child2.isValid() && children.size() < 2){\n children.add(child2);\n }\n if(children.size() == 2){\n break;\n }\n }\n //If the crossover failed to generate a valid child, return the parents.\n if(children.size() == 0){\n children.add(other);\n children.add(this);\n }\n else if(children.size() == 1){\n children.add(this);\n }\n return children;\n }", "private static Set<Chromosome> generateRandomPopulation(int pathLength, int randomPopulationSize) {\n Set<Chromosome> population = new HashSet<>();\n\n // create an arraylist of CityIDs, and initialise it with the cities in order of their ID\n ArrayList<Integer> basePath = new ArrayList<>();\n for (int i = 0; i < pathLength; i++) {\n basePath.add(i);\n }\n\n // repeat the following for as many chromosomes as are required (populationSize)\n while (population.size() < randomPopulationSize) {\n Chromosome chromosome = new Chromosome(pathLength);\n // randomise the order of the arraylist of cities\n Collections.shuffle(basePath);\n for (int j = 0; j < pathLength; j++) {\n chromosome.path[j] = basePath.get(j);\n }\n population.add(chromosome);\n }\n\n return population;\n }", "public int getFitness()\n {\n return this.fitness;\n }", "public int getFitness(Graph_GA obj)\r\n\t{\r\n\t\tint fitness_score = 0;\r\n\t\tSet<DefaultEdge> edges= obj.graph_inp.edgeSet();\r\n Iterator<DefaultEdge> edges_list = edges.iterator();\r\n \r\n while(edges_list.hasNext())\r\n {\r\n \tDefaultEdge new_edge = edges_list.next();\r\n \tGA_Graph_Node source = obj.graph_inp.getEdgeSource(new_edge);\r\n \tGA_Graph_Node target = obj.graph_inp.getEdgeTarget(new_edge);\r\n \tif(chromosome[source.numID-1] == chromosome[target.numID-1])\r\n \t{\r\n \t\tfitness_score = fitness_score-1;\r\n \t}\r\n }\r\n\t\treturn fitness_score;\r\n\t}", "public int produce(int min, int max, int start, int subpopulation, Individual[] inds, ec.EvolutionState state, int thread)\n/* */ {\n/* 27 */ int n = this.sources[0].produce(min, max, start, subpopulation, inds, state, thread);\n/* */ \n/* */ \n/* */ \n/* 31 */ if (!state.random[thread].nextBoolean(this.likelihood)) {\n/* 32 */ return reproduce(n, start, subpopulation, inds, state, thread, false);\n/* */ }\n/* */ \n/* */ \n/* */ \n/* */ \n/* 38 */ if (!(this.sources[0] instanceof ec.BreedingPipeline)) {\n/* 39 */ for (int q = start; q < n + start; q++) {\n/* 40 */ inds[q] = ((Individual)inds[q].clone());\n/* */ }\n/* */ }\n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* 48 */ if (!(inds[start] instanceof TestCaseCandidate))\n/* 49 */ state.output.fatal(\"OurMutatorPipeline didn't get an Chromosome.The offending individual is in subpopulation \" + \n/* 50 */ subpopulation + \" and it's:\" + inds[start]);\n/* 51 */ ChromosomeSpecies species = (ChromosomeSpecies)inds[start].species;\n/* */ \n/* */ \n/* */ \n/* 55 */ for (int q = start; q < n + start; q++)\n/* */ {\n/* 57 */ TestCaseCandidate i = (TestCaseCandidate)inds[q];\n/* 58 */ double mutp = 1.0D / i.getGenes().size();\n/* */ \n/* 60 */ double[] propa = new double[i.getGenes().size()];\n/* 61 */ for (int x = 0; x < i.getGenes().size(); x++)\n/* 62 */ propa[x] = mutp;\n/* 63 */ for (int x = 0; x < i.getGenes().size(); x++) {\n/* 64 */ if (state.random[thread].nextBoolean(propa[x]))\n/* */ {\n/* */ \n/* 67 */ ((csbst.generators.AbsractGenerator)i.getGenes().get(x)).mutate();\n/* */ }\n/* */ }\n/* */ \n/* 71 */ i.evaluated = false;\n/* */ }\n/* */ \n/* 74 */ return n;\n/* */ }" ]
[ "0.72646266", "0.7148892", "0.69722986", "0.690695", "0.68784004", "0.6656468", "0.6455764", "0.640304", "0.6313098", "0.62769985", "0.6191032", "0.6141752", "0.60353607", "0.60285634", "0.60225713", "0.5935665", "0.58755225", "0.5805986", "0.5785949", "0.57781154", "0.57740605", "0.57554704", "0.5748133", "0.57275665", "0.56897515", "0.5685054", "0.5684402", "0.56749964", "0.5652295", "0.56460494", "0.5644793", "0.56333643", "0.5621819", "0.561336", "0.5609495", "0.56080323", "0.5605852", "0.553463", "0.5529565", "0.5528842", "0.5518413", "0.55173963", "0.55091935", "0.5507651", "0.54758817", "0.5426495", "0.5416075", "0.54109406", "0.5409166", "0.53857017", "0.5385181", "0.5350738", "0.5324716", "0.53207844", "0.5318652", "0.5314007", "0.5298672", "0.52974635", "0.5297023", "0.52688164", "0.52573496", "0.52491057", "0.5240098", "0.52361655", "0.52328163", "0.5225732", "0.52125627", "0.5210935", "0.52075934", "0.520244", "0.5196257", "0.5193467", "0.5183111", "0.5175798", "0.516563", "0.51643455", "0.5160794", "0.51550883", "0.5154971", "0.5154256", "0.51486266", "0.5147205", "0.51461875", "0.51427376", "0.5132542", "0.51299727", "0.5113413", "0.5112802", "0.50983095", "0.50964206", "0.50746524", "0.5061171", "0.5058195", "0.50575703", "0.5055738", "0.50534236", "0.50500304", "0.5043494", "0.5041909", "0.50390375" ]
0.64987624
6
Evaluates the fitness of chromosomes, chooses some for breeding (min rank) returns chromosomes that won breeding lottery.
private ArrayList<int[]> selectionRank(int[][] chromosomes, float percentToSelect) { ArrayList<int[]> selectedChromosomes = new ArrayList<int[]>(); //get fitnesses and ranks of chromosomes, save in array to avoid recalculating int[] fitnesses = new int[chromosomes.length]; ArrayList<Integer> ranks = new ArrayList<Integer>(); //holds indices of chromosomes, position in arraylist indicates rank for (int i = 0; i < chromosomes.length; i++) { //set up list of fitnesses and ranks fitnesses[i] = getFitness(chromosomes[i]); boolean added = false; for (int keyIndex = 0; keyIndex < ranks.size(); keyIndex++) { //only search the second half if (fitnesses[ranks.get(keyIndex)] > fitnesses[i]) { //if this one is worse ranks.add(keyIndex, i); //inverted rank added = true; break; } } if (!added) { ranks.add(i); } }// end fitness ranking (low fitness is best, last index is worst) //spin the roulette wheel for (int i = 0; i < chromosomes.length * percentToSelect; i++) { int currentFitnessTotal = 0; int fitSelector = rand.nextInt(chromosomes.length); //where the wheel stops int fitnessCutoff = (fitSelector * (fitSelector + 1)) / 2; for (int j = 0; j < ranks.size(); j++) { //go through all ranks to see who is selected this spin if (currentFitnessTotal < fitnessCutoff) currentFitnessTotal += chromosomes.length - ranks.get(j); //reorder fitness properly if (currentFitnessTotal >= fitnessCutoff) { //if this rank pushed us over the edge, save it selectedChromosomes.add(chromosomes[ranks.get(j)]); break; } } }//end roulette spinning return selectedChromosomes; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "<T> GeneticResult<T> train(List<Chromosome<T>> chromosomes){\n\t\tGeneticResult<T> bestFit = maxFitness(chromosomes, 0);\n\t\tfor(int i = 0; i < totalBreedings; i++){\n\t\t\tif(bestFit.getFitness() > sufficientFitness){ break ;}\n\t\t\tchromosomes = breedNewGeneration(chromosomes);\n\t\t\tbestFit = maxFitness(chromosomes, i);\n\t\t}\n\t\treturn bestFit;\n\t}", "private <T> GeneticResult<T> maxFitness(List<Chromosome<T>> chromosomes, int totalBreedings){\n\t\tChromosome<T> bestFit = fittestChromosome(chromosomes);\n\t\treturn new GeneticResult<T>(bestFit, bestFit.getFitness(), totalBreedings);\n\t}", "private static Set<Chromosome> rankBasedRouletteWheelSelection(ArrayList<Chromosome> population, int populationSize) {\n Set<Chromosome> selectedChromosomes = new HashSet<>();\n\n // calculate the sum of all ranks, which will be used as a denominator for all probabilities\n int sumOfRanks = (populationSize + 1) * populationSize / 2;\n\n // declare an array of cumulative probabilities for all the chromosomes in the population\n double[] cumulativeProbability = new double[populationSize];\n // calculate the cumulative probability of the first chromosome as its probability\n cumulativeProbability[0] = (double) populationSize / sumOfRanks;\n // calculate the cumulative probabilities of all successive chromosomes:\n for (int i = 1; i < populationSize; i++) {\n // as the probability of this chromosomes based on its rank\n double probability = (double) (populationSize-i) / sumOfRanks;\n // plus the cumulative proability of the preceeding chromosome\n cumulativeProbability[i] = cumulativeProbability[i-1] + probability;\n }\n\n while (selectedChromosomes.size() < 2) {\n // choose a chromosome randomly based on its cumulative probability (the lower the better)\n double random = ThreadLocalRandom.current().nextDouble();\n int choice = 0;\n while (random > cumulativeProbability[choice]) {\n choice++;\n }\n\n // add the chosen chromosome to the set of selectedChromosomes\n selectedChromosomes.add(population.get(choice));\n }\n\n return selectedChromosomes;\n }", "private Chromosome getRouletteChromosome(ArrayList<Chromosome> chroms, double totalFitness){\n double slice = (Math.random()*totalFitness);\n double fitnessSum = 0;\n for(Chromosome c:chroms){\n fitnessSum += c.getFitness();\n if(fitnessSum >= slice){\n return c;\n }\n }\n \n //The total fitness supplied must have been incorrect\n return null;\n }", "private <T> List<Chromosome<T>> breedNewGeneration(List<Chromosome<T>> chromosomes){\n\t\tList<Chromosome<T>> selected = selection.apply(chromosomes);\n\t\tCollections.shuffle(selected);\n\n\t\tList<Chromosome<T>> crossedOver = Lists.newArrayList();\n\t\tfor(int i = 0; i < selected.size(); i+=2){\n\t\t\tChromosome<T>[] bred = crossover.apply(selected.get(i), selected.get(i+1));\n\t\t\tcrossedOver.add(bred[0]);\n\t\t\tcrossedOver.add(bred[1]);\n\t\t}\n\n\t\treturn crossedOver.stream().map(mutation::apply).collect(Collectors.toList());\n\t}", "private static void getFitness() {\n\t\tint popSize = population.size();\n\t\tChromosome thisChromo = null;\n\t\tdouble bestScore = 0;\n\t\tdouble worstScore = 0;\n\n\t\t// The worst score would be the one with the highest energy, best would be\n\t\t// lowest.\n\t\tworstScore = population.get(maximum()).conflicts();\n\n\t\t// Convert to a weighted percentage.\n\t\tbestScore = worstScore - population.get(minimum()).conflicts();\n\n\t\tfor (int i = 0; i < popSize; i++) {\n\t\t\tthisChromo = population.get(i);\n\t\t\tthisChromo.fitness((worstScore - thisChromo.conflicts()) * 100.0 / bestScore);\n\t\t}\n\n\t\treturn;\n\t}", "public Genotype rouletteSelection() {\n // get a number between 0 and 1 to compare against\n double slice = rnd.nextDouble();\n // keep track of the cumulative fitness\n double cumulativeFitness = 0;\n\n // loop through the population to pick a mate\n for (Genotype g : population) {\n // increment the cumulative fitness with the member's normalized fitness\n cumulativeFitness += g.getNormalizedFitness();\n // if the cumulative fitness is greater than the random number,\n if (cumulativeFitness > slice) {\n // select the member for mating\n return g;\n }\n }\n\n // if no members are chosen, pick the one with the highest fitness score\n return population.get(0);\n }", "Chromosome getRandomAmongFittest(int limit);", "Chromosome fittestChromosome();", "public void testSelect_4()\n throws Exception {\n BestChromosomesSelector selector = new BestChromosomesSelector(conf);\n selector.setDoubletteChromosomesAllowed(true);\n // the following original rate controls that only 30% of the chromosomes\n // will be considered for selection as given with BestChromosomesSelector.\n // The last 70% will be added as doublettes in this case.\n selector.setOriginalRate(0.3d);\n // add first chromosome\n // --------------------\n Gene gene = new BooleanGene(conf);\n gene.setAllele(Boolean.valueOf(true));\n Chromosome thirdBestChrom = new Chromosome(conf, gene, 7);\n thirdBestChrom.setFitnessValue(10);\n selector.add(thirdBestChrom);\n // add second chromosome\n // ---------------------\n gene = new BooleanGene(conf);\n gene.setAllele(Boolean.valueOf(false));\n Chromosome bestChrom = new Chromosome(conf, gene, 3);\n bestChrom.setFitnessValue(12);\n selector.add(bestChrom);\n // add third chromosome\n // ---------------------\n gene = new IntegerGene(conf);\n gene.setAllele(new Integer(444));\n Chromosome secondBestChrom = new Chromosome(conf, gene, 3);\n secondBestChrom.setFitnessValue(11);\n selector.add(secondBestChrom);\n // receive top 1 (= best) chromosome\n // ---------------------------------\n Population pop = new Population(conf);\n selector.select(1, null, pop);\n IChromosome[] bestChroms = pop.toChromosomes();\n assertEquals(1, bestChroms.length);\n assertEquals(bestChrom, bestChroms[0]);\n // receive top 4 chromosomes with original rate = 0.3\n // --------------------------------------------------\n pop.getChromosomes().clear();\n selector.select(4, null, pop);\n bestChroms = pop.toChromosomes();\n assertEquals(4, bestChroms.length);\n assertEquals(bestChrom, bestChroms[0]);\n assertEquals(bestChrom, bestChroms[1]); //because of originalRate = 0.3\n assertEquals(secondBestChrom, bestChroms[2]);\n assertEquals(thirdBestChrom, bestChroms[3]);\n // Non-unique chromosomes should have been returned, although not the same\n // but a cloned instance!\n assertEquals(bestChroms[0], bestChroms[1]);\n // receive top 4 chromosomes with original rate = 1\n // ------------------------------------------------\n pop.getChromosomes().clear();\n selector.setOriginalRate(1.0d);\n selector.select(4, null, pop);\n bestChroms = pop.toChromosomes();\n assertEquals(4, bestChroms.length);\n assertEquals(bestChrom, bestChroms[0]);\n assertEquals(secondBestChrom, bestChroms[1]);\n assertEquals(thirdBestChrom, bestChroms[2]);\n assertEquals(bestChrom, bestChroms[3]);\n }", "public static void breedAll() {\n int a, b; //Pointers to select parents\n\n //While loop to ensure full carrying capacity of population\n while (Population.size() <= maxPop) {\n //Sorts by Fitness level first\n sortByFitlvl();\n\n //Selects Two Random Parents\n a = (int) (Math.abs(Utilities.sharpGauss(4)) * Population.size());\n b = (int) (Math.abs(Utilities.sharpGauss(4)) * Population.size());\n //System.out.println(a+\"\\t\"+b+\"\\t\"+Population.size());\n\n // Between 1-2 children\n int children = rand.nextInt(2)+1;\n for (int i = 0; i < children; i++) {\n Population.add(Breeder.breed(Population.get(a), Population.get(b), 0.1));\n }\n\n //sortByFitlvl();\n }\n\n if (debug)\n printPopulation(true);\n }", "public void evaluate() {\n for (Chromosome chromo : chromosomes) {\n double chromoGH = chromo.getTotalGH();\n if (chromo.isValid()) {\n this.validChromosomes++;\n if (chromoGH > this.getBestScore()) {\n this.bestScore = chromoGH;\n this.setBestChromo(chromo);\n }\n }\n //Log.debugMsg(chromo.getTotalGH().toString());\n// this.map.put(chromoGH, chromo);\n }\n }", "private int intGetRandomGenomeBiasedAdjustedFitness(Species selectFrom, Random random) {\r\n\t\tdouble completeWeight = 0.0;\r\n\t\tfor (integerFitnessGenome fg : selectFrom.fitnessInt) {\r\n\t\t\tcompleteWeight += fg.fitness;\r\n\t\t}\r\n\t\tdouble r = Math.random() * completeWeight;\r\n\t\tdouble countWeight = 0.0;\r\n\t\tfor (integerFitnessGenome fg : selectFrom.fitnessInt) {\r\n\t\t\tcountWeight += fg.fitness;\r\n\t\t\tif (countWeight >= r) {\r\n\t\t\t\treturn fg.id;\r\n\t\t\t}\r\n\t\t}\r\n\t\tthrow new RuntimeException(\"Couldn't find a genome... Number is genomes in selected species is \");\r\n\t}", "private ArrayList<int[]> selectionRoulette(int[][] chromosomes, float percentToSelect) {\n\n\t\tArrayList<int[]> selectedChromosomes = new ArrayList<int[]>();\n\n\t\t//sum up fitnesses for population\n\t\tint fitnessSum = 0;\n\t\tfor (int[] chromosome : chromosomes) {\n\t\t\tfitnessSum += getFitness(chromosome);\n\t\t}\n\n\t\t//minimization problem - invert fitness\n\t\tint invertFitnessSum = 0;\n\t\tfor (int[] chromosome : chromosomes) {\n\t\t\tinvertFitnessSum += Math.round((fitnessSum * 1.0) / getFitness(chromosome)); //small fitness values (few bins) are favored\n\t\t}\n\n\t\t//get fitnesses of chromosomes, save in array to avoid recalculating\n\t\tint[] fitnesses = new int[chromosomes.length];\n\t\tfor (int i = 0; i < chromosomes.length; i++) {\n\t\t\tfitnesses[i] = (int) Math.round((fitnessSum * 1.0) / getFitness(chromosomes[i]));\n\t\t}\n\n\t\t//spin the roulette wheel\n\t\tfor (int i = 0; i < chromosomes.length * percentToSelect; i++) {\n\t\t\tint currentFitnessTotal = 0;\n\t\t\tint fitnessCutoff = rand.nextInt(invertFitnessSum); //where the wheel stops\n\n\t\t\tfor (int j = 0; j < chromosomes.length; j++) { //go through all chromosomes to see who is selected this spin\n\t\t\t\tif (currentFitnessTotal < fitnessCutoff)\n\t\t\t\t\tcurrentFitnessTotal += fitnesses[j];\n\n\t\t\t\tif (currentFitnessTotal >= fitnessCutoff) { //if this chromosome pushed us over the edge, save it\n\t\t\t\t\tselectedChromosomes.add(chromosomes[j]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}//end roulette spinning\n\t\treturn selectedChromosomes;\n\t}", "private Integer getFitness(int[] chromosome) {\n\t\tint[] bins = new int[binCount]; //list of found bins\n\t\tfor (int binIndex = 0; binIndex < bins.length; binIndex++) { //initialize list of bins to unfound\n\t\t\tbins[binIndex] = -1;\n\t\t}\n\t\tint[] newChrom = bestFitModified(chromosome.clone()); //fix if infeasible\n\t\tif (newChrom == null) { //this is an unfixable chromosome, inform caller\n\t\t\treturn binCount * 2 + totalInfeasibility(chromosome);\n\t\t}\n\n\t\tfor (int i = 0; i < newChrom.length; i++) {\n\t\t\tchromosome[i] = newChrom[i]; //copy over to take advantage of side-effects\n\t\t}\n\t\tint uniqueBins = 0;\n\n\t\tfor (int i = 0; i < chromosome.length; i++) {\n\t\t\tif (bins[chromosome[i]] == -1) { //if we haven't seen this bin before track it and increment bin counter\n\t\t\t\tbins[chromosome[i]] = chromosome[i];\n\t\t\t\tuniqueBins++;\n\t\t\t} else\n\t\t\t\tcontinue;\n\t\t}\n\n\t\treturn uniqueBins;\n\t}", "public Chromosome bestChromosome()\r\n {\r\n\treturn bestChromo.clone();\r\n }", "static double[] evolveWeights() throws Exception {\n\t\t// Create a random initial population\n\t\tRandom r = new Random();\n\t\t// Matrix is a two dimensional array, populationSize are rows, Genes are columns\n\t\tMatrix population = new Matrix(populationSize, numberofGenes);\n\t\tfor (int i = 0; i < 100; i++) {\n\t\t\t// returns elements(genes) of every row\n\t\t\t// Think of every row as a seperate chromosome of parent\n\t\t\tdouble[] chromosome = population.row(i);\n\t\t\t// create every gene for each chrosome in the population\n\t\t\tfor (int j = 0; j < chromosome.length; j++) {\n\t\t\t\tdouble gene = 0.03 * r.nextGaussian();\n\t\t\t\tchromosome[j] = gene;\n\t\t\t}\n\t\t}\n\n\t\tint generationNum = 0;\n\t\t// do battle with chromosomes until winning condition is found\n\t\t// Controller.doBattleNoGui(new ReflexAgent(), new\n\t\t// NeuralAgent(population.row(0)))\n\t\twhile (Controller.doBattleNoGui(new ReflexAgent(), new NeuralAgent(population.row(0))) != -1) {\n\n\t\t\tSystem.out.println(\"Generation \" + (generationNum));\n\n\t\t\tint mightLive = r.nextInt(100);\n\n\t\t\tif (generationNum == 10)\n\t\t\t\tmutationRate -= 0.01;\n\t\t\tif (generationNum == 20)\n\t\t\t\tmutationRate -= 0.02;\n\t\t\tif (generationNum == 30)\n\t\t\t\tmutationRate -= 0.02;\n\n\t\t\t// Mutate the genes of the current population\n\t\t\tfor (int y = 0; y < populationSize; y++) {\n\t\t\t\tfor (int x = 0; x < numberofGenes; x++) {\n\t\t\t\t\tif (Math.random() <= mutationRate) {\n\t\t\t\t\t\tpopulation.changeGene(x, y, r.nextGaussian());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Make random number of battles\n\t\t\tfor (int i = 0; i < 40; i++) {\n\t\t\t\t// Create two teams with two random chromosomes from the population\n\t\t\t\tint soldier_a = r.nextInt(population.rows());\n\t\t\t\tint soldier_b = r.nextInt(population.rows());\n\n\t\t\t\t// Ensure that both teams don't have the same chromosome\n\t\t\t\tif (soldier_a == soldier_b)\n\t\t\t\t\tsoldier_b = r.nextInt(population.rows());\n\n\t\t\t\t// Do Battle between teams and select winner\n\t\t\t\tif (Controller.doBattleNoGui(new NeuralAgent(population.row(soldier_a)),\n\t\t\t\t\t\tnew NeuralAgent(population.row(soldier_b))) == 1) {\n\t\t\t\t\t// Chooses if the winner survives\n\t\t\t\t\tif (mightLive < winnerSurvivalRate)\n\t\t\t\t\t\tpopulation.removeRow(soldier_b);\n\t\t\t\t\telse\n\t\t\t\t\t\tpopulation.removeRow(soldier_a);\n\t\t\t\t}\n\n\t\t\t\telse if (Controller.doBattleNoGui(new NeuralAgent(population.row(soldier_a)),\n\t\t\t\t\t\tnew NeuralAgent(population.row(soldier_b))) == -1) {\n\t\t\t\t\t// Chooses if the winner survives\n\t\t\t\t\tif (mightLive < winnerSurvivalRate)\n\t\t\t\t\t\tpopulation.removeRow(soldier_a);\n\t\t\t\t\telse\n\t\t\t\t\t\tpopulation.removeRow(soldier_b);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Reproduce for the population (This is where the magic happens)\n\t\t\t// int currentPopulation = population.rows();\n\t\t\twhile (population.rows() < 100) {\n\t\t\t\t// Retrieve random parent\n\t\t\t\tint parentID = r.nextInt(population.rows());\n\t\t\t\tdouble[] parent = population.row(parentID);\n\t\t\t\tint[] potentialPartners = new int[10];\n\t\t\t\tint abs_min_value = Integer.MIN_VALUE;\n\t\t\t\tBoolean foundpartner = false;\n\t\t\t\tint partner = 0;\n\n\t\t\t\tfor (int i = 0; i < potentialPartners.length; i++) {\n\t\t\t\t\tint potentialPartnerID = r.nextInt(population.rows());\n\t\t\t\t\tif (parentID == potentialPartnerID)\n\t\t\t\t\t\tpotentialPartnerID = r.nextInt(population.rows());\n\t\t\t\t\tpotentialPartners[i] = potentialPartnerID;\n\t\t\t\t}\n\n\t\t\t\tfor (int i = 0; i < potentialPartners.length; i++) // Finding most compatiable parent #2.\n\t\t\t\t{\n\t\t\t\t\tint compatiablity = similarities(parent, population.row(potentialPartners[i]));\n\t\t\t\t\tif (compatiablity > abs_min_value) {\n\t\t\t\t\t\tpartner = potentialPartners[i];\n\t\t\t\t\t\tfoundpartner = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (foundpartner == false)\n\t\t\t\t\tpartner = r.nextInt(population.rows());\n\n\t\t\t\tdouble[] secondParent = population.row(partner);\n\t\t\t\tdouble[] newChild = population.newRow();\n\t\t\t\tint splitpoint = r.nextInt((int) numberofGenes / 4);\n\n\t\t\t\tfor (int i = 0; i < splitpoint; i++) // logic to a for loop and two if statements\n\t\t\t\t\tnewChild[i] = parent[i];\n\t\t\t\tfor (int i = splitpoint; i < numberofGenes; i++)\n\t\t\t\t\tnewChild[i] = secondParent[i];\n\n\t\t\t\t// for (int i = 0; i < population.rows(); i++) {\n\t\t\t\t// if (Controller.doBattleNoGui(new ReflexAgent(), new\n\t\t\t\t// NeuralAgent(population.row(i))) == -1) {\n\t\t\t\t// population.row(i) = population.newRow();\n\t\t\t\t// numOfWins++;\n\t\t\t\t// } else { }\n\n\t\t\t\t// Test for the best in the given population\n\t\t\t\t// win_Collection.add(numOfWins);\n\t\t\t\t// printWeights(population.row(0));\n\n\t\t\t}\n\t\t\tgenerationNum++;\n\t\t\tfor (int i = 0; i < population.rows(); i++) {\n\t\t\t\tif (Controller.doBattleNoGui(new ReflexAgent(), new NeuralAgent(population.row(i))) == -1) {\n\t\t\t\t\tnumOfWins++;\n\t\t\t\t\t// population.row(i) = population.newRow();\n\t\t\t\t} else {\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(\"Number of Winners: \" + numOfWins);\n\t\t\tnumOfWins = 0;\n\n\t\t}\n\t\tprintWeights(population.row(0));\n\t\treturn population.row(0);\n\t}", "public void evaluate()\r\n {\r\n\tdouble max = ff.evaluate(chromos.get(0),generation());\r\n\tdouble min = max;\r\n\tdouble sum = 0;\r\n\tint max_i = 0;\r\n\tint min_i = 0;\r\n\r\n\tdouble temp = 0;\r\n\r\n\tfor(int i = 0; i < chromos.size(); i++)\r\n\t {\r\n\t\ttemp = ff.evaluate(chromos.get(i),generation());\r\n\t\tif(temp > max)\r\n\t\t {\r\n\t\t\tmax = temp;\r\n\t\t\tmax_i = i;\r\n\t\t }\r\n\r\n\t\tif(temp < min)\r\n\t\t {\r\n\t\t\tmin = temp;\r\n\t\t\tmin_i = i;\r\n\t\t }\r\n\t\tsum += temp;\r\n\t }\r\n\r\n\tbestFitness = max;\r\n\taverageFitness = sum/chromos.size();\r\n\tworstFitness = min;\r\n\tbestChromoIndex = max_i;;\r\n\tworstChromoIndex = min_i;\r\n\tbestChromo = chromos.get(max_i);\r\n\tworstChromo = chromos.get(min_i);\r\n\t\r\n\tevaluated = true;\r\n }", "private int[] bestFitModified(int[] chromosome) {\n\t\tint[] bins = new int[binCount];\n\t\tArrayList<Integer> cannotPackList = new ArrayList<Integer>();\n\n\t\t//honor chromosome listing when possible\n\t\tfor (int i = 0; i < chromosome.length; i++) {\n\t\t\t//if this bin isnt full & won't be after placement & this chrom hasnt gone off the end \n\t\t\t//(VERY RARE, only happens when binCount is reduced w/ elitism)\n\t\t\tif (chromosome[i] < bins.length && bins[chromosome[i]] + packageWeights[i] <= binSize) {\n\t\t\t\tbins[chromosome[i]] += packageWeights[i]; //put package into bin\n\t\t\t} else { //store those we can't honor\n\t\t\t\tchromosome[i] = -1;\n\t\t\t\tcannotPackList.add(new Integer(i)); //save all those packages whos original bins were full\n\t\t\t}\n\t\t}\n\n\t\t//best fit on all the rest whos bins were full up\n\t\tint tries = 0;\n\t\tfor (int j = 0; j < cannotPackList.size(); j++) {\n\t\t\tint i = cannotPackList.get(j);\n\t\t\tint bestBinIndex = -1;\n\n\t\t\twhile (bestBinIndex < 0 && tries < bins.length * 2) { //while we still havent found a bin to put this in and time isn't up\n\n\t\t\t\tint bestBinLeftOverSpace = binSize * 100; //how much space is left in the bin when the packages is placed in it (ideally 0 = full bin)\n\n\t\t\t\tfor (int bin = 0; bin < bins.length; bin++) {\n\t\t\t\t\t//if this bin is closer to full than the best bin and not overfilled save it\n\t\t\t\t\tif ((binSize - (bins[bin] + packageWeights[i])) >= 0 && (binSize - (bins[bin] + packageWeights[i])) < bestBinLeftOverSpace) {\n\t\t\t\t\t\tbestBinIndex = bin;\n\t\t\t\t\t\tbestBinLeftOverSpace = binSize - (bins[bin] + packageWeights[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (bestBinIndex < 0) { //if could not pack, dump out a bin (mutation)\n\t\t\t\t\tj = 0;\n\t\t\t\t\tint dumpBin = rand.nextInt(binCount);\n\t\t\t\t\tfor (int binIndex = dumpBin; binIndex < binCount; binIndex++) {\n\t\t\t\t\t\tbins[binIndex] = 0;\n\t\t\t\t\t\tfor (int chromIndex = 0; chromIndex < chromosome.length; chromIndex++) {\n\t\t\t\t\t\t\tif (chromosome[chromIndex] == binIndex) {\n\t\t\t\t\t\t\t\tchromosome[chromIndex] = -1;\n\t\t\t\t\t\t\t\tcannotPackList.add(new Integer(chromIndex));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\ttries++;\n\t\t\t}\n\n\t\t\tif (tries >= bins.length * 2) {\n\t\t\t\treturn null; //this chromosome is unsalvageable because it is impossible to fit the packages in the bins\n\t\t\t}\n\n\n\t\t\tbins[bestBinIndex] += packageWeights[i];\n\t\t\tchromosome[i] = bestBinIndex;\n\t\t\tcannotPackList.remove(j);\n\t\t\tj--;\n\t\t}\n\n\t\treturn chromosome;\n\t}", "public int fitness() {\n\t\t//System.out.println(\"/!\\\\ WARNING: Full fitness() called!\");\n\t\tint fitness = 0;\n\t\tint fitnessCases = (int) Math.pow(2, circuit.order);\n\t\tfor (int i=0; i<fitnessCases; i++) {\n\t\t\tValuation v = new Valuation(i, circuit.order);\n\t\t\tboolean actualOutput = tree.evaluate(v);\n\t\t\tboolean correctOutput = v.correctOutput();\n\t\t\t\n\t\t\tif (actualOutput == correctOutput) fitness++;\n\t\t}\n\t\t\n\t\tthis.fitness = fitness;\n\t\tthis.fitnessCases = null;\n\t\t\n\t\treturn fitness;\n\t}", "protected double evaluate(IChromosome chromosome) {\n\t double score = 0;\n\t \t \n\t List dups = new ArrayList();\n\t int badSolution = 1;\n\n\t for (int i = 0; i < chromosome.size(); i++) {\n\n\t //IntegerGene agene = (IntegerGene) chromosome.getGene(i);\n\t //System.out.println(agene);\n\t int index = (Integer) chromosome.getGene(i).getAllele();\n\t \n\t if (dups.contains(index)) {\n\t badSolution = 0;\n\t } else {\n\t dups.add(index);\n\t }\n\n\t Equipo equipo = (Equipo) equipos.get(index);\n\t double genreScore = getGenreScore(equipo);\n\t if (genreScore == 0) {\n\t badSolution = 0;\n\t }\n\t score = (score+genreScore);\n\n\t }\n\t \n\t return (score * badSolution);\n\t }", "Chromosome getRandom();", "public Chromosome worstChromosome()\r\n {\r\n\treturn worstChromo.clone();\r\n }", "public double fitness()\n/* */ {\n/* 40 */ return 1.0D / (1.0D + this.distance);\n/* */ }", "private PMCGenotype[] advanceGeneration()\n\t{\n\t\tPMCGenotype[] newPop = new PMCGenotype[population.length];\n\t\tPMCGenotype[] parents = selectParents();\n\t\tArrayList<PMCGenotype> candidates = new ArrayList<PMCGenotype>();\n\n\t\t// Add the current population to the list of candidates.\n\t\tfor (PMCGenotype pmcg : population)\n\t\t{\n\t\t\tcandidates.add(pmcg);\n\t\t}\n\n\t\t// For each parent, generate a number of mutations (children), calculate their fitness\n\t\t// and add them to the list of candidates.\n\t\tint childrenPerParent = this.childrenPerGeneration / this.parentsToSelect;\n\t\tfor (PMCGenotype p : parents)\n\t\t{\n\t\t\tfor (int i = 0; i < childrenPerParent; i++)\n\t\t\t{\n\t\t\t\tPMCGenotype pmcg = PMCGenotype.mutate(p, r);\n\t\t\t\tpmcg.setFitness(fitness(pmcg, this.trials));\n\t\t\t\tcandidates.add(pmcg);\n\t\t\t}\n\t\t}\n\n\t\t// Find candidate with the best fitness and add it to the new population.\n\t\t// Repeat this until the new population size matches the previous population size.\n\t\tint candidatesChosen = 0;\n\t\twhile (candidatesChosen < this.population.length)\n\t\t{\n\t\t\tint numberOfRemainingCandidates = candidates.size();\n\t\t\tdouble currentBestFitnessScore = 0;\n\t\t\tint currentBestFitnessScoreIndex = 0;\n\n\t\t\tfor (int i = 0; i < numberOfRemainingCandidates; i++)\n\t\t\t{\n\t\t\t\tPMCGenotype pmcg = candidates.get(i);\n\t\t\t\tif (pmcg.getFitness() > currentBestFitnessScore)\n\t\t\t\t{\n\t\t\t\t\tcurrentBestFitnessScore = pmcg.getFitness();\n\t\t\t\t\tcurrentBestFitnessScoreIndex = i;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnewPop[candidatesChosen] = candidates.get(currentBestFitnessScoreIndex);\n\t\t\tcandidatesChosen++;\n\n\t\t\tcandidates.remove(currentBestFitnessScoreIndex);\n\t\t}\n\n\t\treturn newPop;\n\t}", "private Species getRandomSpeciesBaisedAdjustedFitness(Random random) {\r\n\t\tdouble completeWeight = 0.0;\r\n\t\tfor (Species s : species) {\r\n\t\t\tcompleteWeight += s.totalAdjustedFitness;\r\n\t\t}\r\n\t\tdouble r = Math.random() * completeWeight;\r\n\t\tdouble countWeight = 0.0;\r\n\t\tfor (Species s : species) {\r\n\t\t\tcountWeight += s.totalAdjustedFitness;\r\n\t\t\tif (countWeight >= r) {\r\n\t\t\t\treturn s;\r\n\t\t\t}\r\n\t\t}\r\n\t\tthrow new RuntimeException(\"Couldn't find a species... Number is species in total is \" + species.size()\r\n\t\t\t\t+ \", and the toatl adjusted fitness is \" + completeWeight);\r\n\t}", "int tournament() {\r\n \tint ch1,ch2;\r\n\t\tch1 = (int)Math.floor(Math.random()*SIZE);\r\n\t\tdo {\r\n\t\t\tch2 = (int)Math.floor(Math.random()*SIZE);\r\n\t\t} while (ch1==ch2);\r\n\t\tif (fit[ch1]<fit[ch2]) return ch1;\r\n\t\telse return ch2;\r\n }", "private void rouletteSelection() {\n parentChromosomes = new Chromosome[2];\n parentIndices = new int[2];\n Arrays.fill(parentChromosomes, null);\n parentIndices[0] = getFittestChromosomeIndex();\n parentChromosomes[0] = chromosomes[parentIndices[0]];\n parentIndices[1] = getFittestChromosomeIndex();\n parentChromosomes[1] = chromosomes[parentIndices[1]];\n System.out.println(\"Individuals selected from Roulette Wheel for crossover: \\n\" +\n Arrays.toString(parentChromosomes[0].getGenes()) + \"\\n\" +\n Arrays.toString(parentChromosomes[1].getGenes()));\n }", "public void runTournament() {\n\t\t//ArrayList<Gene> tournament = new ArrayList<Gene>();\n\t\tPriorityQueue<Gene> tournament = new PriorityQueue<Gene>(Collections.reverseOrder());\n\t\tint numContenders = (int)(FRAC_IN_TOURNAMENT * geneNumber);\n\t\tSet<Integer> chosenOnes = new HashSet<Integer>();\n\t\t\n\t\twhile(chosenOnes.size() < numContenders) {\n\t\t\tint randIndex = (int) (Math.random() * geneNumber);\n\t\t\tchosenOnes.add(randIndex);\n\t\t}\n\t\tfor(int i : chosenOnes){\n\t\t\ttournament.add(genepool.get(i));\n\t\t}\n\t\t//int firstIndex = getMax(tournament, -1);\n\t\t//int secondIndex = getMax(tournament, firstIndex);\n\t\t//Gene parent1 = tournament.get(firstIndex);\n\t\t//Gene parent2 = tournament.get(secondIndex);\n\t\tGene parent1 = tournament.poll();\n\t\tGene parent2 = tournament.poll();\n\t\t// Create a new gene from the 2 fittest genes\n\t\tGene newGene = parent1.waCrossover(parent2);\n\t\t\n\t\t// Calculate fitness for the new gene\n\t\tPlayerSkeleton.runGames(numGames, newGene);\n\t\toffspringPool.add(newGene);\n\t}", "public static boolean [][] breedChoice (Species [][] map, int x, int y, int plantHealth) {\n // First int: direction\n // Second int: sheep or wolf\n boolean [][] breeding = {\n {false, false},\n {false, false},\n {false, false},\n {false, false},\n };\n \n // Check null pointer exceptions\n if (map[y][x] != null) {\n\n // Breed sheep\n if ((map[y][x] instanceof Sheep) && (y > 0) && (map[y-1][x] instanceof Sheep)) {\n if ((((Sheep)map[y][x]).getGender() != ((Sheep)map[y-1][x]).getGender()) && (map[y][x].getHealth() > 20) && (map[y-1][x].getHealth() > 20) && (((Sheep)map[y][x]).getAge() > 5) && (((Sheep)map[y-1][x]).getAge() > 5)) {\n breeding[0][0] = true;\n }\n } else if ((map[y][x] instanceof Sheep) && (y < map[0].length - 2) && (map[y+1][x] instanceof Sheep)) {\n if ((((Sheep)map[y][x]).getGender() != ((Sheep)map[y+1][x]).getGender()) && (map[y][x].getHealth() > 20) && (map[y+1][x].getHealth() > 20) && (((Sheep)map[y][x]).getAge() > 5) && (((Sheep)map[y+1][x]).getAge() > 5)) {\n breeding[1][0] = true;\n }\n } else if ((map[y][x] instanceof Sheep) && (x > 0) && (map[y][x-1] instanceof Sheep)) {\n if ((((Sheep)map[y][x]).getGender() != ((Sheep)map[y][x-1]).getGender()) && (map[y][x].getHealth() > 20) && (map[y][x-1].getHealth() > 20) && (((Sheep)map[y][x]).getAge() > 5) && (((Sheep)map[y][x-1]).getAge() > 5)) {\n breeding[2][0] = true;\n }\n } else if ((map[y][x] instanceof Sheep) && (x < map.length - 2) && (map[y][x+1] instanceof Sheep)) {\n if ((((Sheep)map[y][x]).getGender() != ((Sheep)map[y][x+1]).getGender()) && (map[y][x].getHealth() > 20) && (map[y][x+1].getHealth() > 20) && (((Sheep)map[y][x]).getAge() > 5) && (((Sheep)map[y][x+1]).getAge() > 5)) {\n breeding[3][0] = true;\n }\n \n // Breed wolves\n } else if ((map[y][x] instanceof Wolf) && (y > 0) && (map[y-1][x] instanceof Wolf)) {\n if ((((Wolf)map[y][x]).getGender() != ((Wolf)map[y-1][x]).getGender()) && (map[y][x].getHealth() > 20) && (map[y-1][x].getHealth() > 20) && (((Wolf)map[y][x]).getAge() > 5) && (((Wolf)map[y-1][x]).getAge() > 5)) {\n breeding[0][1] = true;\n }\n } else if ((map[y][x] instanceof Wolf) && (y < map[0].length - 2) && (map[y+1][x] instanceof Wolf)) {\n if ((((Wolf)map[y][x]).getGender() != ((Wolf)map[y+1][x]).getGender()) && (map[y][x].getHealth() > 20) && (map[y+1][x].getHealth() > 20) && (((Wolf)map[y][x]).getAge() > 5) && (((Wolf)map[y+1][x]).getAge() > 5)) {\n breeding[1][1] = true;\n }\n } else if ((map[y][x] instanceof Wolf) && (x > 0) && (map[y][x-1] instanceof Wolf)) {\n if ((((Wolf)map[y][x]).getGender() != ((Wolf)map[y][x-1]).getGender()) && (map[y][x].getHealth() > 20) && (map[y][x-1].getHealth() > 20) && (((Wolf)map[y][x]).getAge() > 5) && (((Wolf)map[y][x-1]).getAge() > 5)) {\n breeding[2][1] = true;\n }\n } else if ((map[y][x] instanceof Wolf) && (x < map.length - 2) && (map[y][x+1] instanceof Wolf)) {\n if ((((Wolf)map[y][x]).getGender() != ((Wolf)map[y][x+1]).getGender()) && (map[y][x].getHealth() > 20) && (map[y][x+1].getHealth() > 20) && (((Wolf)map[y][x]).getAge() > 5) && (((Wolf)map[y][x+1]).getAge() > 5)) {\n breeding[3][1] = true;\n }\n }\n \n }\n return breeding;\n }", "@Override\n\tpublic int compareTo(Chromosome o) {\n\n\t\treturn this.fitness - o.fitness;\n\t}", "public abstract double getFitness(Genotype genotype);", "private static void calculateFitnessOfPopulation(ArrayList<Chromosome> population) {\n for (Chromosome chromosome : population) {\n // if the fitness of the chromosome has not yet been calculated (i.e. is still -1)\n fitnessFunction(chromosome);\n }\n }", "static int getFitness(double[][] matrix, Chromosome ch){\n int fitness = 0,\n tmpInd = 0;\n\n for (int i = 0; i < ch.size(); i++) {\n if (ch.getGene(i) == 1){\n fitness += matrix[tmpInd][i];\n tmpInd = i;\n }\n }\n return fitness;\n }", "public int randomGene();", "private void calculateFitness() {\n\t\tint day1=this.getNumberOfHours()*this.getNumberOfClasses();\n\t\tint day2=2*day1;\n\t\tint day3=3*day1;\n\t\tint day4=4*day1;\n\t\tint day5=5*day1;\n\t\tTeacher_lesson temp=null;\n\t\t//day 1//\n\t\tHashSet<Integer> closedSet=new HashSet<Integer>();\n\t\t\n\t\t\n\t\t\n\t\tfor(int i=0;i<day1;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day1;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t}\n\t\t\t\n\t\t}\n\t\n\t\t\n\t\t\n\t\t\n\t\t//day2//\n\t\tclosedSet.clear();;\n\t\t\n\t\tfor(int i=day1;i<day2;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day2;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t}\n\t\t\t\n\t\t}\n\t\t//day3//\n\t\tclosedSet.clear();;\n\t\tfor(int i=day2;i<day3;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day3;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\t//day4//\n\t\tclosedSet.clear();;\n\t\tfor(int i=day3;i<day4;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day4;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\t\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t}\n\t\t\t\n\t\t}\n\t\t//day5//\n\t\tclosedSet.clear();;\n\t\tfor(int i=day4;i<day5;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day5;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t\t\t\n\t\t}\n\t\t\t/*if(temp.get_td_hour()<0){this.fitness=this.fitness-100;}//adunato na ginei giati o ka8igitis exei parapanw wres apo oti mporei na kanei//\n\t\t\t\telse if (temp.get_td_hour()==0){this.fitness=this.fitness-2;}//meiwnoume giati o ka8igitis 8a epivarin8ei oles tou tis wres thn idia mera//\n\t\t\t\telse{++this.fitness;}//kalh prosegisi*/\n\t\t}\n\t\t//*********************END OF DAILY EVALUATION*****************************//\n\t\t\n\t\t//**********************START OF WEEKLY EVALUATION************************//\n\t\t\n\t\tclosedSet.clear();\n\t\t\n\t int \t_weeklyhours = 1;\n\t \n\t\tfor(int i=0;i<day5;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp!=null){\n\t\t\tif(!closedSet.contains(this.genes[i])){\n\t\t\t\t\n\t\t\t\n\t\t\tfor(int j=i+1;j<day5;j++){\n\t\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\t\t++_weeklyhours; }\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t/*if(_weeklyhours>temp.get_tw_hour()){\n\t\t\t\tthis.fitness=this.fitness-100 ; //adunato na kanei parapanw wres ma8hma//\n\t\t\t}else\n\t\t\t\t{++this.fitness;}*/\n\t\t\tif(_weeklyhours<temp.get_tw_hour()){++this.fitness;}\n\t\t\tclosedSet.add(this.genes[i]);}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//*************END OF WEEKLY EVALUATION**********//\n\t\n\t\t//**START OF LESSON EVALUATION***//\n\t\tArraylistLesson set=new ArraylistLesson();\n\t\tclass_lid templ=null;\n\t\tTeacher_lesson tempj=null;\n\t\tint lid=0;\n\t\tString _class;\n\t\tint _classhours=1;\n\t\tfor(int i=0;i<day5;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp!=null){\n\t\t\tlid=temp.get_lid();\n\t\t\t_class=temp.get_class();\n\t\t\ttempl=new class_lid(lid,_class);\n\t\t\tif(!set.contains(templ)){\n\t\t\t\t\n\t\t\t\tfor(int j=i+1;j<day5;j++){\n\t\t\t\t\ttempj=getdata(this.genes[j]);{\n\t\t\t\t\t\tif(tempj!=null){\n\t\t\t\t\t\t\tif(temp.get_tid()==tempj.get_tid()){\n\t\t\t\t\t\t\t\tif(temp.get_lid()==tempj.get_lid()&&temp.get_class().equalsIgnoreCase(tempj.get_class())){\n\t\t\t\t\t\t\t\t\t++_classhours;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\tint hours;\n\t\t\t\thours=temp.get_lhours();\n\t\t\t\n\t\tif(_classhours==hours){\n\t\t\t++this.fitness;\n\t\t}\n\t\tset.add(templ);\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t}", "public interface Population {\n\n /**\n * Add the specified chromosome to the population.\n * If the size of the population has reached to maxSize, eviction is done\n * removing chromosomes with the worst fitness\n * @param chromosome\n */\n void addChromosome(@NotNull final Chromosome chromosome);\n\n /**\n * Return a random chromosome\n * @return\n */\n Chromosome getRandom();\n\n\n /**\n * Return a random chromosome among the first limit fittest chromosomes\n * @param limit Nth fittest chromosome\n * @return\n */\n Chromosome getRandomAmongFittest(int limit);\n\n /**\n * Remove the specified chromosome from the population\n * @param chromosome\n */\n boolean removeChromosome(@NotNull final Chromosome chromosome);\n\n /**\n * Return the fittest chromosome\n * @return\n */\n Chromosome fittestChromosome();\n\n /**\n * Number of chromosome in the population\n * @return\n */\n int size();\n\n /**\n * Return the hits of each chromosomes\n * @return\n */\n Map<String, Long> hits();\n}", "public Chromosome doDisplacementMutation(){\n for(int i = 0; i < PopulationConfiguration.MUTATION_ATTEMPTS; i++){\n ArrayList<Boolean> newSelection = copyBoolArrayList(this.knapsackSelection);\n\n int allele1 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n int allele2 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n\n int leftAllele = Math.min(allele1, allele2);\n int rightAllele = Math.max(allele1, allele2);\n\n var selectionSublist = new ArrayList<Boolean>(newSelection.subList(leftAllele, rightAllele));\n for(int j = leftAllele; j < rightAllele + 1; j++){\n newSelection.remove(leftAllele);\n }\n\n int index = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size()+1);\n newSelection.addAll(index, selectionSublist);\n\n Chromosome mutatedKnapsack = new Chromosome(newSelection).withFitnessCalculated();\n if(mutatedKnapsack.isValid())\n return mutatedKnapsack;\n }\n return this;\n }", "public int tournament(int size) {\n\t\t\n\t\tint best = 0;\n\t\tfloat bestFitness = Float.NEGATIVE_INFINITY;\n\t\t\n\t\t//selects the best individual from randomly sampled tournament participants\n\t\tfor(int i = 0; i < size; i++){\n\t\t\tint index = R.nextInt(populationSize);\n\t\t\tif(fitness[index] > bestFitness){\n\t\t\t\tbestFitness = fitness[index];\n\t\t\t\tbest = index;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn best;\n\t}", "private static int maximum() {\n\t\tint popSize = 0;\n\t\tChromosome thisChromo = null;\n\t\tChromosome thatChromo = null;\n\t\tint winner = 0;\n\t\tboolean foundNewWinner = false;\n\t\tboolean done = false;\n\n\t\twhile (!done) {\n\t\t\tfoundNewWinner = false;\n\t\t\tpopSize = population.size();\n\t\t\tfor (int i = 0; i < popSize; i++) {\n\t\t\t\tif (i != winner) { // Avoid self-comparison.\n\t\t\t\t\tthisChromo = population.get(i);\n\t\t\t\t\tthatChromo = population.get(winner);\n\t\t\t\t\tif (thisChromo.conflicts() > thatChromo.conflicts()) {\n\t\t\t\t\t\twinner = i;\n\t\t\t\t\t\tfoundNewWinner = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (foundNewWinner == false) {\n\t\t\t\tdone = true;\n\t\t\t}\n\t\t}\n\t\treturn winner;\n\t}", "public static void genocide() {\n //Assigns fitness levels\n evaluateFitnesses();\n\n //Sorts by fitness\n sortByFitlvl();\n\n //Simple genocide, kills off all until population size.\n for (int i = Population.size() - 1; i >= populationSize; i--) {\n Population.remove(i);\n }\n\n /*\n //Different kind of Genocide, selects organisms based on gaussian distribution\n\n while(Population.size() > populationSize){\n int randomOrganism = (int)(Population.size() - (Population.size()*Utilities.sharpGauss(2)));\n Population.remove(randomOrganism);\n }\n */\n }", "private static int minimum() {\n\t\tint popSize = 0;\n\t\tChromosome thisChromo = null;\n\t\tChromosome thatChromo = null;\n\t\tint winner = 0;\n\t\tboolean foundNewWinner = false;\n\t\tboolean done = false;\n\n\t\twhile (!done) {\n\t\t\tfoundNewWinner = false;\n\t\t\tpopSize = population.size();\n\t\t\tfor (int i = 0; i < popSize; i++) {\n\t\t\t\tif (i != winner) { // Avoid self-comparison.\n\t\t\t\t\tthisChromo = population.get(i);\n\t\t\t\t\tthatChromo = population.get(winner);\n\t\t\t\t\tif (thisChromo.conflicts() < thatChromo.conflicts()) {\n\t\t\t\t\t\twinner = i;\n\t\t\t\t\t\tfoundNewWinner = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (foundNewWinner == false) {\n\t\t\t\tdone = true;\n\t\t\t}\n\t\t}\n\t\treturn winner;\n\t}", "public static void GA(ArrayList<City> cities){\n int pathLength = cities.size();\n // the number of chromosomes which will be generated\n int populationSize = 100;\n // the number of chromosomes that will be generated from crossover as a percentage of the population\n double crossoverRate = 0.8;\n // the number of chromosomes that will be generated from crossover\n int crossoverSize = (int) (populationSize * crossoverRate);\n // the probability that a chromosome can have a random mutation\n double mutationRate = 0.05;\n // the number of generations\n int generations = 5000;\n\n // Initialising the distance matrix using the initialiseDistanceMatrix method\n initialiseDistanceMatrix(cities);\n\n // Generating the Initial Population\n ArrayList<Chromosome> population = generatePopulation(cities, pathLength, populationSize);\n\n // The following is done for each generation of the population\n for (int i = 0; i < generations; i++) {\n // calculating the fitness of every chromosome in the current generation\n calculateFitnessOfPopulation(population);\n // sort the population so that the chromosomes with the highest fitness are at the start of the list\n Collections.sort(population);\n // call the method which performs crossover on the population\n Set<Chromosome> children = crossoverPopulation(population, populationSize, crossoverSize);\n // carry out mutation on the children of the current population\n children.addAll( mutatePopulation(children, mutationRate) );\n\n // evolve the population\n population.addAll(children);\n ArrayList<Chromosome> currentGeneration = new ArrayList<>(population);\n ArrayList<Chromosome> nextGeneration = evolvePopulation(currentGeneration, populationSize, cities, pathLength);\n population = new ArrayList<>(nextGeneration);\n }\n\n // find the fittest chromosome\n Chromosome fittestChromosome = population.get(0);\n double maxFitness = population.get(0).fitness;\n for (Chromosome c : population) {\n if (c.fitness > maxFitness) {\n maxFitness = c.fitness;\n fittestChromosome = c;\n }\n }\n // display the path and distance of the fittest chromosome\n System.out.println(fittestChromosome.getPath());\n System.out.println(\"Total Route Distance: \" + routeDistance(fittestChromosome));\n\n //printPopulation(population);\n }", "private void tournament_selection() {\r\n\r\n individual[] temp_pop = new individual[this.pop_size];\r\n\r\n for (int i = 0; i < this.pop_size; i++) {\r\n\r\n // pick 2 random ints to for indices of parents\r\n int parent1 = new Random().nextInt(this.pop_size);\r\n int parent2 = new Random().nextInt(this.pop_size);\r\n\r\n individual p1 = new individual(main_population.getPopulation()[parent1].getGenes(), solutions, output);\r\n individual p2 = new individual(main_population.getPopulation()[parent2].getGenes(), solutions, output);\r\n\r\n if (p1.getFitness() >= p2.getFitness()) {\r\n temp_pop[i] = p1;\r\n } else {\r\n temp_pop[i] = p2;\r\n }\r\n }\r\n this.main_population.setPopulation(temp_pop);\r\n this.main_population.update_population();\r\n }", "@Override\n\tpublic int compareTo(Chromosome o) {\n\t\tif(this.getFitness()<o.getFitness())\n\t\t\treturn -1;\n\t\telse if(this.getFitness()>o.getFitness())\n\t\t\treturn 1;\n\t\telse\n\t\t\treturn 0;\n\t}", "void CalculateProbabilities()\n\t{\n\t int i;\n\t double maxfit;\n\t maxfit=fitness[0];\n\t for (i=1;i<FoodNumber;i++)\n\t {\n\t if (fitness[i]>maxfit)\n\t maxfit=fitness[i];\n\t }\n\n\t for (i=0;i<FoodNumber;i++)\n\t {\n\t prob[i]=(0.9*(fitness[i]/maxfit))+0.1;\n\t }\n\n\t}", "public Population breedPopulation(EvolutionState state)\r\n {\n if( previousPopulation != null )\r\n {\r\n if( previousPopulation.subpops.length != state.population.subpops.length )\r\n state.output.fatal( \"The current population should have the same number of subpopulations as the previous population.\" );\r\n for( int i = 0 ; i < previousPopulation.subpops.length ; i++ )\r\n {\r\n if( state.population.subpops[i].individuals.length != previousPopulation.subpops[i].individuals.length )\r\n state.output.fatal( \"Subpopulation \" + i + \" should have the same number of individuals in all generations.\" );\r\n for( int j = 0 ; j < state.population.subpops[i].individuals.length ; j++ )\r\n if( previousPopulation.subpops[i].individuals[j].fitness.betterThan( state.population.subpops[i].individuals[j].fitness ) )\r\n state.population.subpops[i].individuals[j] = previousPopulation.subpops[i].individuals[j];\r\n }\r\n previousPopulation = null;\r\n }\r\n\r\n // prepare the breeder (some global statistics might need to be computed here)\r\n prepareDEBreeder(state);\r\n\r\n // create the new population\r\n Population newpop = (Population) state.population.emptyClone();\r\n\r\n // breed the children\r\n for( int subpop = 0 ; subpop < state.population.subpops.length ; subpop++ )\r\n {\r\n if (state.population.subpops[subpop].individuals.length < 4) // Magic number, sorry. createIndividual() requires at least 4 individuals in the pop\r\n state.output.fatal(\"Subpopulation \" + subpop + \" has fewer than four individuals, and so cannot be used with DEBreeder.\");\r\n \r\n Individual[] inds = state.population.subpops[subpop].individuals;\r\n for( int i = 0 ; i < inds.length ; i++ )\r\n {\r\n newpop.subpops[subpop].individuals[i] = createIndividual( state, subpop, inds, i, 0); // unthreaded for now\r\n }\r\n }\r\n\r\n // store the current population for competition with the new children\r\n previousPopulation = state.population;\r\n return newpop;\r\n }", "void ComputeFitness(){\n\t\tint i, pos;\n\t\t// individual t;\n\t\tdouble min, sum = 0, sumSize = 0, tm;\n\t\t// First Compute Raw fitness\n\t\tfor(i = 0; i < poplen; i++)\n\t\t{\n\t\t\tif(oldpop[i].evaluated==FALSE)\n\t\t\t{ tm=ComputeRF(oldpop[i]);\n\t\t\t\toldpop[i].fitness = tm;\n\t\t\t\toldpop[i].oldfitness = tm;\n\t\t\t\toldpop[i].evaluated=TRUE;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\toldpop[i].fitness=oldpop[i].oldfitness;\n\t\t\t}\n\t\t\t\n\t\t\t//oldpop[i].DisplayIndividual();\n\t\t\t//System.out.println(oldpop[i].fitness);\n\t\t}\n\t\t//tim individual co fitness be nhat\n\t\tmin = oldpop[0].fitness;\n\t\tpos = 0;\n\t\tsum = oldpop[0].fitness;\n\t\tsumSize = oldpop[0].size;\n\t\t\n\t\tfor(i = 1; i < poplen; i++) {\n\t\t\tif(oldpop[i].fitness < min) {\n\t\t\t\tmin = oldpop[i].fitness;\n\t\t\t\tpos = i;\n\t\t\t}\n\t\t\tsum += oldpop[i].fitness;\n\t\t\tsumSize += oldpop[i].size;\n//\t\t\tpopSize[gen][i]= oldpop[i].size;\n\t\t}\n\t\t// copy the best and average\n\t\tbestcurrent[gen] = new individual();\n\t\tbestcurrent[gen].CopyIndividual(oldpop[pos], TRUE);\n\t\taverage[gen] = sum /poplen;\n\t\taverageSize[gen] = sumSize /poplen;\n\t\t// Third Compute Adjusted fitness\n\t\tAdjustFitness();\n\t\t// Finally Compute nomarlized fitness\n \t\tNormalizeFitness();\n\t}", "float getFitnessScore(MapLocation l) {\n\t\ttry{\n\t\t\tif(rc.canSenseLocation(l) && !rc.onTheMap(l)) {\n\t\t\t\t//System.out.println(\"dead square\");\n\t\t\t\treturn -999999.0f;\n\t\t\t}\n\t\t} catch(Exception e){e.printStackTrace();}\n\t\t\n\t\tfloat fitness = 0.0f;\n\t\t\n\t\tfor(RobotInfo ri : allRobots) {\n\t\t\tfitness -= 1f/l.distanceSquaredTo(ri.location);\n\t\t}\n\t\tif(type.equals(RobotType.GARDENER)) {\n\t\t\tfor(TreeInfo ti : allTrees) {\n\t\t\t\tif(ti.team.equals(Team.NEUTRAL)) {\n\t\t\t\t\tfitness -= 1f/l.distanceSquaredTo(ti.location);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\tfitness -= 10f/l.distanceSquaredTo(lastLocation);\n\t\t\n\t\treturn fitness;\n\t}", "public void fitnessFunction()\n\t{\n\t\t\n\t}", "public Chromosome(ArrayList<Teacher_lesson> list){\n\t\tthis.genes=new int[array_size];\n\t\tRandom r= new Random();\n\t\tfor(int i=0;i<genes.length;i++){\n\t\t\t\n\t\t\tthis.genes[i]=r.nextInt(number_of_professors);\n\t\t}\n\t\tthis.DataList=list;\n\t\tthis.calculateFitness();\n\t}", "public void calcularFitness() {\n double fit = 0;\r\n for (int x=0; x < this.genotipo.length;x++){\r\n if (x!=this.genotipo.length-1){\r\n fit+=distancias[this.genotipo[x]][this.genotipo[x+1]];\r\n }else{\r\n fit+=distancias[this.genotipo[x]][this.genotipo[0]];\r\n }\r\n }\r\n this.fitness = fit;\r\n }", "private static ArrayList<Chromosome> generateNearestNeighbourPopulation(int pathLength, int nnPopulationSize){\n // declaring the arraylist of chromosomes which will store the\n ArrayList<Chromosome> nnPopualtion = new ArrayList<>();\n\n // declaring a set which will contain all the starting cities that will be used for the population\n Set<Integer> startingCities = new HashSet<>();\n // initialising the set of startingCities with random cities. It being a set no duplicates are allowed\n while (startingCities.size() < nnPopulationSize) {\n startingCities.add(ThreadLocalRandom.current().nextInt(0, pathLength));\n }\n\n // An ArrayList with all the cityIDs which can be copied to keep track of visited/unvisited cities\n ArrayList<Integer> cities = new ArrayList<>();\n for (int i = 0; i < pathLength; i++) {\n cities.add(i);\n }\n\n // for every starting city\n for (Integer startingCity : startingCities) {\n // set the currentCity as the Starting City\n int currentCity = startingCity;\n // Declare a new chromosome to store this new path\n Chromosome chromosome = new Chromosome(pathLength);\n // Set the first city in the path as the startingCity\n chromosome.path[0] = startingCity;\n\n // Declare a new Set of unvisitedCities, and initialise it as a copy of the ArrayList of cityIDs\n Set<Integer> unvisitedCities = new HashSet<>(cities);\n // remove the startingCity from the set of unvisitedCities\n unvisitedCities.remove(startingCity);\n\n // for the length of the path\n for (int i = 1; i < pathLength; i++) {\n // initially set the closestCity to a random city from the set of unvisitedCities\n int closestCity = unvisitedCities.iterator().next();\n // loop through every unvisitedCity to find the closestCity\n for (Integer city : unvisitedCities) {\n // if the distance between the currentCity and the unvisitedCity is < the distance between\n // the currentCity and the closestCity\n if (distanceMatrix[currentCity][city] < distanceMatrix[currentCity][closestCity]) {\n // set thet unvisitedCity as the closestCity\n closestCity = city;\n }\n }\n // add the closestCity as the next city in the path\n chromosome.path[i] = closestCity;\n // make the currentCity for the next iteration the current closestCity\n currentCity = closestCity;\n // remove the closestCity from the set of unvisitedCities\n unvisitedCities.remove(closestCity);\n }\n\n // add the generated chromosome to the ArrayList of the initial nnPopulation\n nnPopualtion.add(chromosome);\n }\n\n return nnPopualtion;\n }", "public ArrayList<Tour> doSelection(Population population) {\n double totalFitness = 0;\n for(Tour tour : population.getTourList()){\n totalFitness = totalFitness + tour.getFitness();\n }\n\n //sort tours by relative fitness\n SortedMap<Double, Tour> totalFitnessRelativity = new TreeMap<>();\n for(Tour tour: population.getTourList()){\n double key = tour.getFitness()/totalFitness;\n totalFitnessRelativity.put(key, tour);\n }\n\n //put tours on a number bar\n SortedMap<Double, Tour> numberBar = new TreeMap<>();\n double previousProbability = 0;\n for(Map.Entry<Double, Tour> entry : totalFitnessRelativity.entrySet()){\n double currentProbability = previousProbability + entry.getKey();\n numberBar.put(currentProbability, entry.getValue());\n previousProbability = currentProbability;\n }\n\n //choose a tour randomly according to how near it is to\n ArrayList<Tour> rouletteWheelOrder = new ArrayList<>();\n do{\n double randomNumber = new random.MersenneTwisterFast().nextDouble(0, numberBar.lastKey());\n for(Map.Entry<Double, Tour> numberBarSection : numberBar.entrySet()){\n if(randomNumber <= numberBarSection.getKey() && !rouletteWheelOrder.contains(numberBarSection.getValue())){\n rouletteWheelOrder.add(numberBarSection.getValue());\n break;\n }\n }\n } while(rouletteWheelOrder.size() != population.getTourList().size());\n return rouletteWheelOrder;\n }", "private int tournament()\r\n {\r\n\tint out = spinTheWheel();\r\n\tdouble max = ff.evaluate(chromos.get(out),generation());\r\n\tdouble temp_fitness = 0;\r\n\tint temp_index = 0;\r\n\r\n\tfor(int i = 0; i < selPara - 1 + tourStep*generation(); i++)\r\n\t {\r\n\t\ttemp_index = spinTheWheel();\r\n\t\ttemp_fitness = ff.evaluate(chromos.get(temp_index),generation());\r\n\t\tif(temp_fitness > max)\r\n\t\t {\r\n\t\t\tmax = temp_fitness;\r\n\t\t\tout = temp_index;\r\n\t\t }\r\n\t }\r\n\treturn out;\r\n }", "public static void main(String[] args) throws IOException {\n\t\tint p = 8;\n\t\t// r is the fraction of the population to be replaced by Crossover at\n\t\t// each step\n//\t\tdouble r = Double.valueOf(8).doubleValue();\n\t\tdouble r = 8;\n\t\t// m is the rate of mutation\n//\t\tdouble m = Double.valueOf(8).doubleValue();\n\t\tdouble m = 8;\n\n\t\t// Write into files...\n\t\tFile outputFile = new File(\"testGA.txt\");\n\t\tFileWriter out = new FileWriter(outputFile);\n\n\t\t////////////////////////\n\t\tp = 33;\n\t\tr = 0.6;\n\t\tm = 0.1;\n\n\t\t// Report the population size, crossover rate and mutation rate\n\t\tSystem.out.println();\n\t\tSystem.out.println(\"Learning the 8-queens problem with a Genetic Algorithm\");\n\t\tSystem.out.println(\"Population Size: \" + p);\n\t\tSystem.out.println(\"Crossover Rate: \" + r);\n\t\tSystem.out.println(\"Mutation Rate: \" + m);\n\t\tSystem.out.println();\n\t\tout.write(\"Parameters are p=\" + p + \", \" + \"r=\" + r + \" and m=\" + m + \"\\r\");\n\n\t\t// The genetic algorithm\n\t\tint iterationNum = 0;\n\t\tHypothesis bestIndividual;\n\t\tint bestFitness;\n\t\tdouble aveFitness;\n\t\t// Randomly generate initial population\n\t\tGA algorithm = new GA(p, r, m);\n\t\t// For each individual compute fitness\n\t\talgorithm.computeFitness();\n\t\t// Get the best individual\n\t\tbestIndividual = (algorithm.getPopulation())[0];\n\t\tbestFitness = bestIndividual.getFitness();\n\t\taveFitness = algorithm.computeAveFitness();\n\t\t// Iterate till we get the very best individual\n\t\twhile (bestFitness != 0) {\n\t\t\t// Select the very best members of the population to survive\n\t\t\talgorithm.select();\n\t\t\t// Make the best members reproduce themselves\n\t\t\talgorithm.crossover();\n\t\t\t// Add some mutations to new population\n\t\t\talgorithm.mutate();\n\t\t\t// The successor population becomes the current population\n\t\t\talgorithm.setNextGeneration();\n\t\t\t// For each individual compute fitness\n\t\t\talgorithm.computeFitness();\n\t\t\t// Get the best individual\n\t\t\tbestIndividual = (algorithm.getPopulation())[0];\n\t\t\tbestFitness = bestIndividual.getFitness();\n\t\t\taveFitness = algorithm.computeAveFitness();\n\t\t\t// Report best results to the user at every five iterations\n\t\t\tif (iterationNum % 5 == 0) {\n\t\t\t\tSystem.out.println(\"Iteration: \" + iterationNum + \" Best Fitness: \" + bestFitness\n\t\t\t\t\t\t+ \" Average Fitness \" + aveFitness);\n\t\t\t\tSystem.out.println(\"Best solution: \" + bestIndividual.toString());\n\t\t\t\tSystem.out.println();\n\t\t\t\tout.write(\"\\n\" + iterationNum + \",\" + bestFitness + \",\" + aveFitness + \"\\r\");\n\t\t\t}\n\t\t\titerationNum++;\n\t\t}\n\t\tSystem.out.println(\n\t\t\t\t\"Iteration: \" + iterationNum + \" Best Fitness: \" + bestFitness + \" Average Fitness \" + aveFitness);\n\t\tSystem.out.println(\"Solution is \" + bestIndividual.toString());\n\t\tout.write(\"\\n\" + iterationNum + \",\" + bestFitness + \",\" + aveFitness + \"\\r\");\n\t\tout.close();\n\t}", "public Chromosome doExchangeMutation(){\n for(int i = 0; i < PopulationConfiguration.MUTATION_ATTEMPTS; i++){\n ArrayList<Boolean> newSelection = copyBoolArrayList(this.knapsackSelection);\n\n int allele1 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n int allele2 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n Collections.swap(newSelection, allele1, allele2);\n\n Chromosome mutatedKnapsack = new Chromosome(newSelection).withFitnessCalculated();\n if(mutatedKnapsack.isValid())\n return mutatedKnapsack;\n }\n return this;\n }", "protected float getFitness()\t\t\t{\treturn fitness;\t\t}", "private ArrayList<Chromosome> selectParentsRoulette() {\n ArrayList<Chromosome> parents = new ArrayList<Chromosome>(Defines.crossoverParentCt);\n double sumGH = 0.0; // sums GH for all chromosomes in this pop\n Random randgen = new Random(); // random number generator\n for (Chromosome chromo : this.chromosomes) {\n sumGH += chromo.getTotalGH();\n }\n for (int i = 0; i < Defines.crossoverParentCt; i++) {\n double parentRandomizer = randgen.nextDouble() * sumGH; // get random #\n double aggGH = 0.0; // aggregate the GH until we reach our random #\n int chromoIdx = 0; // identifies the chromosome in the pop\n Chromosome parentCandidate;\n do {\n parentCandidate = this.chromosomes.get(chromoIdx++);\n aggGH += parentCandidate.getTotalGH();\n } while (aggGH < parentRandomizer);\n parents.add(parentCandidate);\n }\n return parents;\n }", "void calculateFitness() {\n if (reachedGoal) {\n fitness = 1d / 16d + 8192d / (genome.step * genome.step);\n } else {\n double d = position.distance(Game.Setup.goal);\n fitness = 1d / (d * d);\n }\n }", "public double calcFitness(int[] genes) {\n\t\treturn 0;\n\t}", "private int[][] replaceLowestFitness(int[][] population, ArrayList<int[]> replacers) {\n\t\tfloat[] fitnesses = new float[population.length];\n\t\tfor (int i = 0; i < population.length; i++) {\n\t\t\tfitnesses[i] = getFitness(population[i]);\n\t\t}\n\n\t\t//find worst chromosomes around\n\t\tArrayList<Integer> worstFitnessesIndexes = new ArrayList<Integer>();\n\t\tfloat[] fitnessesSorted = fitnesses.clone();\n\t\tArrays.sort(fitnessesSorted);\n\t\tfor (int i = 0; i < population.length; i++) {\n\t\t\tfor (int j = 0; j < replacers.size() + 1; j++) {\n\t\t\t\tif (fitnesses[i] <= fitnessesSorted[j]) {\n\t\t\t\t\tworstFitnessesIndexes.add(new Integer(i));\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (worstFitnessesIndexes.size() > replacers.size() + 1) //only find as many bad chromosomes as we have replacements\n\t\t\t\tbreak;\n\t\t}\n\n\t\tfor (int i = 0; i < replacers.size(); i++) {\n\t\t\tint[] replacer = replacers.get(i);\n\t\t\tpopulation[worstFitnessesIndexes.get(i)] = replacer; //replace worst fitnesses with replacements\n\t\t}\n\n\t\tpopulation[worstFitnessesIndexes.get(replacers.size())] = eliteChromosome; //make sure elite stays\n\t\treturn population;\n\t}", "public int getFitness(Graph_GA obj)\r\n\t{\r\n\t\tint fitness_score = 0;\r\n\t\tSet<DefaultEdge> edges= obj.graph_inp.edgeSet();\r\n Iterator<DefaultEdge> edges_list = edges.iterator();\r\n \r\n while(edges_list.hasNext())\r\n {\r\n \tDefaultEdge new_edge = edges_list.next();\r\n \tGA_Graph_Node source = obj.graph_inp.getEdgeSource(new_edge);\r\n \tGA_Graph_Node target = obj.graph_inp.getEdgeTarget(new_edge);\r\n \tif(chromosome[source.numID-1] == chromosome[target.numID-1])\r\n \t{\r\n \t\tfitness_score = fitness_score-1;\r\n \t}\r\n }\r\n\t\treturn fitness_score;\r\n\t}", "public Population evolve()\r\n {\r\n\tArrayList<Chromosome> tempPop = \r\n\t new ArrayList<Chromosome>(chromos.size());\r\n\tChromosome u;\r\n\tChromosome v;\r\n\r\n\tfor(int i = 0; i < chromos.size()/2; i++)\r\n\t {\r\n\t\tu = selectParent();\r\n\t\tv = selectParent();\r\n\t\t\r\n\t\t//System.out.println(\"*****Parent 1 : \\n\" + v);\r\n\t\t\r\n Chromosome c1 = u.child(v);\r\n Chromosome c2 = v.child(u);\r\n\t\ttempPop.add(c1);\r\n\t\ttempPop.add(c2);\r\n\t\t\r\n //System.out.println(\"****Generated new child: \\n\" + c1);\r\n\t }\t \r\n\t\r\n\t// if needed, add in the code for keeping the best chromosome\r\n\tPopulation pop = new Population(tempPop, selMethod, selPara, \r\n\t\t\t\t\tcrossMethod, crossPara, mutMethod, mutPara, \r\n\t\t\t\t\treplaceMethod, replacePara, powerStep, tourStep, ff);\r\n\r\n\tif(replaceMethod == ELITISM)\r\n\t {\r\n\t\tpop.remove(worstChromoIndex);\r\n\t\tpop.add(bestChromo.clone());\r\n\t\tpop.initialize();\r\n\t }\r\n\r\n\tgeneration++;\r\n\treturn pop;\r\n }", "@Test\n public void testChromosome() {\n\n Assert.assertTrue(this.chromB1.getGenes().length == 4);\n Assert.assertTrue(this.chromB1.getSize() == 4);\n Assert.assertTrue(this.chromB1.getGenes()[0] == 1);\n Assert.assertTrue(this.chromB1.getGenes()[1] == 2);\n Assert.assertTrue(this.chromB1.getGenes()[2] == 3);\n Assert.assertTrue(this.chromB1.getGenes()[3] == 4);\n }", "public boolean smallerThan(ChromosomeFitness obj)\n {\n if( this.fitness <= obj.fitness) \n {\n return true;\n }\n \n return false;\n }", "protected void SelectTournament() {\n\t // Torneo.length -> tournament size\n\t // if (tournament size == 2) then BinaryTournament\n this.setRanking();\n\t \n\t for (int i=0; i<this.PopLength; i++) {\n\t Torneo[0] = Randint(0,this.PopLength-1);\n\t int mejor_torneo=Torneo[0];\n\t \n\t for (int j=1; j<Torneo.length; j++) {\n\t boolean repetido= false;\n\t do {\n\t Torneo[j] = Randint(0,this.PopLength-1);\n\t repetido=false;\n\t int k=0;\n\t while ((k<j) && (!repetido))\n\t if (Torneo[j]==Torneo[k])\n\t repetido=true;\n\t else\n\t k++;\n\t } while (repetido);\n\t \n\t if (OLDevaluation[Torneo[j]] < OLDevaluation[mejor_torneo])\n\t mejor_torneo=Torneo[j];\n\t }\n\t sample[i] = mejor_torneo;\n\t }\n\t // Se crea la nueva poblacion\n\t for (int n=0; n<this.PopLength; n++) {\n\t int kk=sample[n];\n\t for (int m=0; m<this.NbGenes; m++) {\n\t NEWpopulation[n][m]= OLDpopulation[kk][m];\n\t }\n\t NEWevaluation[n]= OLDevaluation[kk];\n\t NEWevalIndex[n]= OLDevalIndex[kk];\n\t }\n }", "public static List<Double> selection(PolyPopulation pop, double cutoff) {\n\t\tint lastGenerationNum = pop.getGroupCapacity();\n\t\tList<PolyIndividual> nextGeneration = new ArrayList<>();\n\t\tList<Double> fitList = new ArrayList<>();\n\t\tList<Double> valueList = new ArrayList<>();\n\t\tList<Double> actValueList = new ArrayList<>();\n\t\tdouble max = 0.0;\n\t\tdouble totalFit = 0.0;\n\t\t//calculate the value of each individual in the population\n\t\tfor(int i = 0; i < pop.getGroupCapacity(); i++) {\n\t\t\tdouble val = f(pop.getIndis().get(i).getGenotype());\n\t\t\tvalueList.add(val);\n\t\t\t//get the Max value, use it\n\t\t\tif(i == 0) max = val;\n\t\t\telse if(val > max) max = val;\n\t\t}\n\t\t//based on the value insists now, calculate the fitness of each individual and their total fitness\n\t\tfor(int i = 0; i < pop.getGroupCapacity(); i++) {\n\t\t\tdouble fit = 1/(max - valueList.get(i) + 10);\n\t\t\tfitList.add(fit);\n\t\t\ttotalFit+=fit;\n\t\t}\n\t\t\n\t\twhile(nextGeneration.size() < lastGenerationNum*cutoff) {\t\t\t\n\t\t\tdouble selectionVal = Math.random();\n\t\t\tdouble accumulateVal = 0.0;\n\t\t\tfor(int i = 0; i < pop.getGroupCapacity(); i++) {\n\t\t\t\tif(selectionVal >= accumulateVal && selectionVal < (accumulateVal+fitList.get(i)/totalFit)) {\n\t\t\t\t\tnextGeneration.add(pop.getIndis().get(i));\n\t\t\t\t\tactValueList.add(valueList.get(i));\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\taccumulateVal+=(fitList.get(i)/totalFit);\n\t\t\t}\n\t\t}\n\t\tpop.setIndis(nextGeneration);\n\t\tpop.setGroupCapacity(nextGeneration.size());\n\t\treturn actValueList;\n\t}", "public void evaluatePopulation() {\n // reset the total fitness score\n totalFitness = 0;\n\n for (int i = 0; i < populationSize; i++) {\n population.get(i).setRawFitness(\n FeederCollection.getFeeders().get(i).GetFitness());\n totalFitness += population.get(i).getRawFitness();\n }\n\n // set the normalized fitness for each population member\n for (Genotype g : population) {\n // normalized fitness = raw fitness / total fitness\n g.setNormalizedFitness((g.getRawFitness() / totalFitness));\n }\n\n // sort the popoulation\n Collections.sort(population, Genotype.FitnessOrder);\n\n highFitnesses.add(population.get(0).getRawFitness());\n avgFitnesses.add(totalFitness / population.size());\n\n\n }", "public int getNumChromosomes();", "private Vector step(){\n// System.out.println();\n// System.out.println(generationCount);\n// System.out.println(\"The Population is:\");\n// System.out.println(population);\n \n //DETERMINE WHO SURVIVES INTO NEXT GENERATION\n Vector nextGeneration = surviveType.run(population, fitnessArray);\n\n //DO THE CROSSOVER PROCESS\n //WHILE THE NEXT GENERATION ISN'T FULL\n while (nextGeneration.size() < (populationSize - randGenes)){\n //FIND PARENTS\n Gene parentOne, parentTwo;\n do {\n Gene[] parents = selectType.run(population, fitnessArray);\n parentOne = parents[0];\n parentTwo = parents[1];\n } while (selectPairs && (! closeEnough(parentOne, parentTwo)));\n //ADD CHILDREN\n Gene[] kids = crossType.children(parentOne, parentTwo);\n\n nextGeneration.add(kids[0]);\n if (nextGeneration.size() < (populationSize - randGenes)){\n nextGeneration.add(kids[1]);\n }\n }\n //ADD RANDOM GENES TO THE POPULATION\n while (nextGeneration.size() < populationSize){\n nextGeneration.add(initializer.createRandomGene(fitnessFunction, minRadius, maxRadius));\n }\n //MUTATE THE NEXT GENERATION\n for (int j = 0; j < populationSize; j++){\n if (Math.random() < mutationProb){\n nextGeneration.set(j, mutationType.run((Gene) nextGeneration.get(j)));\n }\n }\n\n //COMPUTE FITNESSES AND RELOCATE IF NECESSARY\n Gene bestGene = (Gene) nextGeneration.get(0);\n int bestX = 0;\n for (int x = 0; x < populationSize; x++){\n Gene next = (Gene) nextGeneration.get(x);\n while (relocationType.move(bannedList, next)){\n Gene newGene = initializer.createRandomGene(fitnessFunction, minRadius, maxRadius);\n next = newGene;\n nextGeneration.set(x, next);\n }\n fitnessArray[x] = next.getFitness();\n\n //FOR THE PURPOSES OF UPDATING THE BANNED LIST\n if (next.getFitness() > bestGene.getFitness()){\n bestGene = next;\n bestX = x;\n }\n } //End for (int x = 0;...\n\n Arrays.sort(fitnessArray);\n\n //UPDATE THE BANNED LIST BY ADDING THE BEST GENE IN THE NEXT GENERATION IF IT'S ABOVE minAccepted AND CONTAINS MORE THAN minPoints POINTS\n if (useList){\n if ((generationCount >= firstAdd) &&\n (solutionCounter >= countNum) &&\n (bestGene.getFitness() >= minAccepted) &&\n (bestGene.getCount() >= minPoints)){\n solutionCounter = 0;\n// System.out.println(bestGene);\n Gene bestClone = new Gene (bestGene.getMajorAxisRadius(), //THIS KLUDGE IS DONE B/C .clone() IS\n bestGene.getMinorAxisRadius(), //PROTECTED, AND I CAN'T UNPROTECT IT.\n bestGene.getX(), //I USE A CLONED GENE TO PREVENT A MUTATION\n bestGene.getY(), //IN THE NEXT GENERATION FROM ALTERING bannedList\n bestGene.getOrientation(),\n bestGene.getFunction());\n bannedList = relocationType.updateBannedList(bannedList, bestClone);\n\n\n //IF NECESSARY, UPDATE THE SOLUTION LIST BY ADDING ALL CLUSTERS WITH MORE THAN minPoints POINTS AND A FITNESS OF AT LEAST minAccepted\n if (returnAllSolutions){\n for (int i = 0; i < populationSize; i++){\n Gene next = (Gene) nextGeneration.get(i);\n if ((next.getFitness() >= minAccepted) && (next.getCount() >= minPoints)){\n solutionList.add(next);\n }\n }//End for (int i = 0...\n } else {\n solutionList = bannedList;\n } //End if (returnAllSolutions){...}else{\n } //End if (generationCount > 4...\n } //End if (useList){\n\n generationCount = generationCount + 1;\n solutionCounter = solutionCounter + 1;\n\n //IF AVOIDING CONVERGENCE, AND IT HAS CONVERGED, START OVER WITH RANDOM GENES\n\n double bestFitness = bestGene.getFitness();\n double medianFitness = roundToHundredths((double) fitnessArray[(int) Math.floor(populationSize / 2)]);\n\n// System.out.println(bestFitness);\n// System.out.println(medianFitness);\n\n if ((antiConvergence) &&\n ((bestFitness - medianFitness) < (0.01 * bestFitness)) &&\n (generationCount > firstAdd)){\n nextGeneration = initializer.getGenes(populationSize, fitnessFunction, minRadius, maxRadius);\n// System.out.println(\"EXPLODED CONVERGENCE!\");\n for (int x = 0; x < populationSize; x++){\n Gene next = (Gene) nextGeneration.get(x);\n fitnessArray[x] = next.getFitness();\n }\n Arrays.sort(fitnessArray);\n }\n\n return nextGeneration;\n }", "public int getFitness(){\n return fitness;\n }", "private double getUnadjustedFitness(Computer computer){\n double score = 0;\n score += 6 * getMatchPercent(computer);\n if(computer.compatible() && sizeCompatability(computer))\n score += 9.5;\n int ramAmount =computer.ramAmount();\n if(ramAmount < 8)\n score -= (8 - ramAmount) * 2;\n else if(ramAmount > 8 && ramAmount < 17)\n score += .06 * (ramAmount - 8);\n else if(ramAmount > 17)\n score += .03 * (ramAmount - 8);\n\n if(computer.cpu.name.contains(\"Intel\") && computer.cpu.name.endsWith(\"K\")){\n if (!computer.motherboard.overclock()){\n score -= 6;\n }\n }\n\n if(computer.cpu.name.contains(\"Intel\") && !(computer.cpu.shortname.contains(\"-5\") || computer.cpu.shortname.contains(\"-6\"))){\n score -= 2;\n }\n if(computer.cpu.name.contains(\"GeForce\") && !(computer.gpu.name.contains(\"GTX 9\") || computer.gpu.name.contains(\"GTX 1\"))){\n score -= 2;\n }\n if(computer.bootDrive.size < 240)\n score -= settings.diskSize * 0.33;\n if(computer.bootDrive.size > 700)\n score += settings.diskSize * 5;\n else\n score += settings.diskSize * computer.bootDrive.size / 140;\n if(computer.secondaryDrive != null)\n score += settings.diskSize * computer.secondaryDrive.size / 1000;\n\n //Now ensure there's enough power, and give a bonus for there being ~300 watts more than needed;\n //there are 4.5 points to gain in powersupply, 10 points to lose\n int basePower = computer.powerConsumption();\n int ideal = basePower + 65;\n if(computer.power.watts < basePower)\n score -= 10;\n else if(computer.power.watts < ideal)\n score += (basePower - computer.power.watts) / 100;\n else\n score += 2.5 - (computer.power.watts - basePower) / 250;\n score += (3 - computer.power.tier) * .6;\n\n // Now motherboard, one point to gain, one to lose\n score += 2 - computer.motherboard.getQuality();\n\n double driveScore = ((computer.bootDrive.reads + computer.bootDrive.writes) / 2) / 88;\n driveScore -= 2;\n if(driveScore > 7.5){\n driveScore = 7.5;\n }\n score += driveScore;\n double rawCpu = ((1 - settings.multicore) / 3) * computer.cpu.singlecore + ((settings.multicore / 3) * (computer.cpu.multicore));\n double adjustedCpu = 26 + 40* ((settings.cpuIntensity / (settings.cpuIntensity + settings.gpuIntensity))* rawCpu - lowCpuScore()) / (maxCpuScore() - lowCpuScore());\n double rawGpu = computer.gpu.fps + (computer.gpu.threedmark / 100);\n double adjustedGpu = 17 + 40 * ((settings.gpuIntensity / (settings.cpuIntensity + settings.gpuIntensity)) * rawGpu - lowGpuScore()) / (maxGpuScore() - lowGpuScore());\n //Inflate the GPU score slightly\n // adjustedGpu * ((35 - adjustedGpu) / 35);\n score += adjustedGpu;\n score += adjustedCpu;\n\n return score;\n }", "public abstract double evaluateFitness();", "private void findBest()\r\n\t{\r\n\t\tint i;\r\n\t\tint size_mature_pool;\r\n\t\tint idx_current;//index of a currently checked genotype\r\n\t\tint num_errors;//number of errors of the current chromosome\r\n\t\tdouble min_error;//smallest error among the oldest genotypes\r\n\t\tVector<Integer> idx_oldest;\r\n\t\t\r\n\t\tsize_mature_pool = _pool_of_bests.size();\r\n\t\t\r\n\t\tidx_oldest = new Vector<Integer>(0, 1);\r\n\t\t\r\n\t\t//find all oldest genotypes\r\n\t\tfor(i=0; i<size_mature_pool; i++)\r\n\t\t{\r\n\t\t\tnum_errors = _pool_of_bests.get(i)._error.all_single_squares.size();\r\n\t\t\tif(num_errors>=_min_life_span)\r\n\t\t\t{\r\n\t\t\t\tidx_oldest.add(i);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//find the best oldest gentypes with a span above a threshold\r\n\t\t_best_idx = -1;\r\n\t\tif(idx_oldest.size() > 0)\r\n\t\t{\r\n\t\t\t_best_idx = idx_oldest.get(0);\r\n\t\t\tmin_error = _pool_of_bests.get(_best_idx)._error.getAverageError();\r\n\t\t\tfor(i=1; i<idx_oldest.size(); i++)\r\n\t\t\t{\r\n\t\t\t\tidx_current = idx_oldest.get(i);\r\n\t\t\t\tif(min_error > _pool_of_bests.get(idx_current)._error.getAverageError())\r\n\t\t\t\t{\r\n\t\t\t\t\t_best_idx = idx_current;\r\n\t\t\t\t\tmin_error = _pool_of_bests.get(_best_idx)._error.getAverageError();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public double calculateFitness(DNA dna);", "private int[] getElite(int[][] population) {\n\t\tfloat[] fitnesses = new float[population.length];\n\n\t\tfor (int i = 0; i < population.length; i++) {\n\t\t\tfitnesses[i] = getFitness(population[i]);\n\t\t\tif (fitnesses[i] < eliteFitness) {\n\t\t\t\tSystem.out.println(getFitness(eliteChromosome) + \" old\" + getFitness(population[i]) + \" new\");\n\t\t\t\teliteFitness = fitnesses[i];\n\t\t\t\teliteChromosome = population[i];\n\t\t\t}\n\t\t}\n\t\treturn eliteChromosome;\n\t}", "public Chromosome doInsertionMutation(){\n for(int i = 0; i < PopulationConfiguration.MUTATION_ATTEMPTS; i++){\n ArrayList<Boolean> newSelection = copyBoolArrayList(this.knapsackSelection);\n\n int allele1 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n int allele2 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n boolean value = newSelection.get(allele2);\n\n newSelection.remove(allele2);\n try{\n newSelection.add(allele1 + 1, value);\n }\n catch(IndexOutOfBoundsException e){\n newSelection.add(value);\n }\n \n Chromosome mutatedKnapsack = new Chromosome(newSelection).withFitnessCalculated();\n if(mutatedKnapsack.isValid())\n return mutatedKnapsack;\n }\n return this;\n }", "public static void reproduce (Species [][] map, int sheepHealth, int wolfHealth, int plantHealth) {\n \n // Place the baby\n int babyY, babyX;\n \n // Check if the baby has been placed\n int spawned = 0;\n \n for (int y = 0; y < map[0].length; y++){\n for (int x = 0; x < map.length; x++){\n \n boolean [][] breeding = breedChoice (map, x, y, plantHealth);\n \n // Sheep upwards to breed with\n if (breeding[0][0]) {\n ((Sheep)map[y][x]).reproduceHealthLost(10);\n ((Sheep)map[y-1][x]).reproduceHealthLost(10);\n \n // Make baby sheep\n Sheep sheep = new Sheep(sheepHealth, x, y);\n \n // Place the baby sheep\n do {\n babyY = (int)(Math.random() * map.length);\n babyX = (int)(Math.random() * map.length);\n if (map[babyY][babyX] == null) {\n map[babyY][babyX] = sheep;\n spawned = 1;\n }\n } while (spawned == 0);\n \n // Sheep downwards to breed with\n } else if (breeding[1][0]) {\n ((Sheep)map[y][x]).reproduceHealthLost(10);\n ((Sheep)map[y+1][x]).reproduceHealthLost(10);\n \n // Make baby sheep\n Sheep sheep = new Sheep(sheepHealth, x, y);\n \n // Place the baby sheep\n do {\n babyY = (int)(Math.random() * map.length);\n babyX = (int)(Math.random() * map.length);\n if (map[babyY][babyX] == null) {\n map[babyY][babyX] = sheep;\n spawned = 1;\n }\n } while (spawned == 0);\n \n // Sheep to the left to breed with\n } else if (breeding[2][0]) {\n ((Sheep)map[y][x]).reproduceHealthLost(10);\n ((Sheep)map[y][x-1]).reproduceHealthLost(10);\n \n // Make baby sheep\n Sheep sheep = new Sheep(sheepHealth, x, y);\n \n // Place the baby sheep\n do {\n babyY = (int)(Math.random() * map.length);\n babyX = (int)(Math.random() * map.length);\n if (map[babyY][babyX] == null) {\n map[babyY][babyX] = sheep;\n spawned = 1;\n }\n } while (spawned == 0);\n \n // Sheep to the right to breed with\n } else if (breeding[3][0]) {\n ((Sheep)map[y][x]).reproduceHealthLost(10);\n ((Sheep)map[y][x+1]).reproduceHealthLost(10);\n \n // Make baby sheep\n Sheep sheep = new Sheep(sheepHealth, x, y);\n \n // Place the baby sheep\n do {\n babyY = (int)(Math.random() * map.length);\n babyX = (int)(Math.random() * map.length);\n if (map[babyY][babyX] == null) {\n map[babyY][babyX] = sheep;\n spawned = 1;\n }\n } while (spawned == 0);\n \n // Wolf upwards to breed with\n } else if (breeding[0][1]) {\n ((Wolf)map[y][x]).reproduceHealthLost(10);\n ((Wolf)map[y-1][x]).reproduceHealthLost(10);\n \n // Make baby wolf\n Wolf wolf = new Wolf(wolfHealth, x, y);\n \n // Place the baby wolf\n do { \n babyY = (int)(Math.random() * map.length);\n babyX = (int)(Math.random() * map.length);\n if (map[babyY][babyX] == null) {\n map[babyY][babyX] = wolf;\n spawned = 1; \n }\n } while (spawned == 0);\n \n // Wolf downwards to breed with\n } else if (breeding[1][1]) {\n ((Wolf)map[y][x]).reproduceHealthLost(10);\n ((Wolf)map[y+1][x]).reproduceHealthLost(10);\n \n // Make baby wolf\n Wolf wolf = new Wolf(wolfHealth, x, y);\n \n // Place the baby wolf\n do { \n babyY = (int)(Math.random() * map.length);\n babyX = (int)(Math.random() * map.length);\n if (map[babyY][babyX] == null) {\n map[babyY][babyX] = wolf;\n spawned = 1; \n }\n } while (spawned == 0);\n \n // Wolf to the left to breed with\n } else if (breeding[2][1]) {\n ((Wolf)map[y][x]).reproduceHealthLost(10);\n ((Wolf)map[y][x-1]).reproduceHealthLost(10);\n \n // Make baby wolf\n Wolf wolf = new Wolf(wolfHealth, x, y);\n \n // Place the baby wolf\n do { \n babyY = (int)(Math.random() * map.length);\n babyX = (int)(Math.random() * map.length);\n if (map[babyY][babyX] == null) {\n map[babyY][babyX] = wolf;\n spawned = 1; \n }\n } while (spawned == 0);\n \n // Wolf to the right to breed with\n } else if (breeding[3][1]) {\n ((Wolf)map[y][x]).reproduceHealthLost(10);\n ((Wolf)map[y][x+1]).reproduceHealthLost(10);\n \n // Make baby wolf\n Wolf wolf = new Wolf(wolfHealth, x, y);\n \n // Place the baby wolf\n do { \n babyY = (int)(Math.random() * map.length);\n babyX = (int)(Math.random() * map.length);\n if (map[babyY][babyX] == null) {\n map[babyY][babyX] = wolf;\n spawned = 1; \n }\n } while (spawned == 0);\n \n }\n \n }\n }\n \n }", "void ComputeFitnessBefore(){\n\t\t\t\tint i, pos;\n\t\t\t\t// individual t;\n\t\t\t\tdouble min, sum = 0, tm;\n\t\t\t\t// First Compute Raw fitness\n\t\t\t\tfor(i = 0; i < poplen; i++)\n\t\t\t\t{\n\t\t\t\t\tif(oldpop[i].evaluated==FALSE)\n\t\t\t\t\t{ tm=ComputeRF(oldpop[i]);\n\t\t\t\t\t\toldpop[i].fitness = tm;\n\t\t\t\t\t\toldpop[i].oldfitness = tm;\n\t\t\t\t\t\toldpop[i].evaluated=TRUE;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\toldpop[i].fitness=oldpop[i].oldfitness;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t//oldpop[i].DisplayIndividual();\n\t\t\t\t\t//System.out.println(oldpop[i].fitness);\n\t\t\t\t}\n\t\t\t\t//tim individual co fitness be nhat\n\t\t\t\tmin = oldpop[0].fitness;\t\t\t\n\t\t\t\tsum = oldpop[0].fitness;\t\t\t\n\t\t\t\t\n\t\t\t\tfor(i = 1; i < poplen; i++) {\n\t\t\t\t\tif(oldpop[i].fitness < min) {\n\t\t\t\t\t\tmin = oldpop[i].fitness;\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\tsum += oldpop[i].fitness;\t\t\t\t\n\t\t\t\t}\n\t\t\t\t// copy the best and average\n//\t\t\t\tbestBeforeFitness[gen]=min;\n//\t\t\t\tavgBeforeFitness[gen]=sum/poplen;\n//\t\t\t\tbestcurrent[gen] = new individual();\n//\t\t\t\tbestcurrent[gen].CopyIndividual(oldpop[pos], TRUE);\n//\t\t\t\taverage[gen] = sum /poplen;\t\t\t\n\t\t\t\t\n\t\t\t}", "public int getFitness()\n {\n return this.fitness;\n }", "@Test\n\tpublic void testGA() {\n\t\tGenetic ga = new Genetic(100, 500, 10, SelectionType.TOURNAMENT , 0.6, 0.1);\n\t\tOptimumSolution os = ga.run();\n\t\tSystem.out.println(os.getSolution());\n\t}", "public Individu selection() {\n\t\t// Pioche au hasard deux individus differents\n\t\tRandom rand = new Random();\n\t\tint index1 = 0, index2 = 0;\n\t\tindex1 = rand.nextInt(this.individus.size());\n\t\twhile(index1 == index2) {\n\t\t\tindex2 = rand.nextInt(this.individus.size());\n\t\t}\n\n\t\t//double fitness1 =\n\t\tdouble fitness1 = this.individus.get(index1).fitness();\n\t\tdouble fitness2 = this.individus.get(index2).fitness();\n\n\t\t// Determine le meilleur du moins bon\n\t\tIndividu better, worse;\n\t\tif(fitness1 > fitness2) {\n\t\t\tbetter = this.individus.get(index1);\n\t\t\tworse = this.individus.get(index2);\n\t\t} else {\n\t\t\tworse = this.individus.get(index1);\n\t\t\tbetter = this.individus.get(index2);\n\t\t}\n\n\t\t// Dans 75% des cas, onp rend le meilleur des deux\n\t\tif(rand.nextDouble() <= 0.75) {\n\t\t\treturn better;\n\t\t} else {\n\t\t\treturn worse;\n\t\t}\n\t}", "public static void generateMoveDatabase(boolean rook) {\n\t\tlong validMoves = 0;\n\t\tint variations;\n\t\tint varCount;\n\t\tint index, i, j;\n\t\tlong mask;\n\t\tint magicIndex;\n\t\tint[] setBitsMask = new int[64];\n\t\tint[] setBitsIndex = new int[64];\n\t\tint bitCount = 0;\n\t\t// Loop through each index in the board\n\t\tfor (index = 0; index < 64; index++) {\n\n\t\t\tmask = rook ? CoreConstants.occupancyMaskRook[index]\n\t\t\t\t\t: CoreConstants.occupancyMaskBishop[index];\n\t\t\tgetIndexSetBits(setBitsMask, mask);\n\t\t\tbitCount = Long.bitCount(mask);\n\t\t\tvarCount = (int) (1L << bitCount);\n\t\t\t// Go through each possible variation\n\t\t\tfor (i = 0; i < varCount; i++) {\n\t\t\t\tCoreConstants.occupancyVariation[index][i] = 0;\n\t\t\t\tgetIndexSetBits(setBitsIndex, i);\n\t\t\t\tfor (j = 0; setBitsIndex[j] != -1; j++) {\n\t\t\t\t\tCoreConstants.occupancyVariation[index][i] |= (1L << setBitsMask[setBitsIndex[j]]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Generate moves for the piece considering each possible\n\t\t\t// variation\n\t\t\t// Then add moves to the lookup table\n\t\t\t// Indexed by the the position of the piece and a second index based\n\t\t\t// on the precomputed magic numbers\n\t\t\tvariations = (int) (1L << bitCount);\n\t\t\tfor (i = 0; i < variations; i++) {\n\t\t\t\tvalidMoves = 0;\n\t\t\t\tif (rook) {\n\t\t\t\t\tmagicIndex = (int) ((CoreConstants.occupancyVariation[index][i]\n\t\t\t\t\t\t\t* CoreConstants.magicNumbersRook[index]) >>> CoreConstants.magicShiftRook[index]);\n\t\t\t\t\tfor (j = index + 8; j < 64; j += 8) {\n\t\t\t\t\t\tvalidMoves |= (1L << j);\n\t\t\t\t\t\tif ((CoreConstants.occupancyVariation[index][i] & (1L << j)) != 0) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfor (j = index - 8; j >= 0; j -= 8) {\n\t\t\t\t\t\tvalidMoves |= (1L << j);\n\t\t\t\t\t\tif ((CoreConstants.occupancyVariation[index][i] & (1L << j)) != 0) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfor (j = index + 1; j % 8 != 0; j++) {\n\t\t\t\t\t\tvalidMoves |= (1L << j);\n\t\t\t\t\t\tif ((CoreConstants.occupancyVariation[index][i] & (1L << j)) != 0) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfor (j = index - 1; j % 8 != 7 && j >= 0; j--) {\n\t\t\t\t\t\tvalidMoves |= (1L << j);\n\t\t\t\t\t\tif ((CoreConstants.occupancyVariation[index][i] & (1L << j)) != 0) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tCoreConstants.magicMovesRook[index][magicIndex] = validMoves;\n\t\t\t\t} else {\n\t\t\t\t\tmagicIndex = (int) ((CoreConstants.occupancyVariation[index][i]\n\t\t\t\t\t\t\t* CoreConstants.magicNumbersBishop[index]) >>> CoreConstants.magicShiftBishop[index]);\n\t\t\t\t\tfor (j = index + 9; j % 8 != 0 && j < 64; j += 9) {\n\t\t\t\t\t\tvalidMoves |= (1L << j);\n\t\t\t\t\t\tif ((CoreConstants.occupancyVariation[index][i] & (1L << j)) != 0) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfor (j = index - 9; j % 8 != 7 && j >= 0; j -= 9) {\n\t\t\t\t\t\tvalidMoves |= (1L << j);\n\t\t\t\t\t\tif ((CoreConstants.occupancyVariation[index][i] & (1L << j)) != 0) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfor (j = index + 7; j % 8 != 7 && j < 64; j += 7) {\n\t\t\t\t\t\tvalidMoves |= (1L << j);\n\t\t\t\t\t\tif ((CoreConstants.occupancyVariation[index][i] & (1L << j)) != 0) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfor (j = index - 7; j % 8 != 0 && j >= 0; j -= 7) {\n\t\t\t\t\t\tvalidMoves |= (1L << j);\n\t\t\t\t\t\tif ((CoreConstants.occupancyVariation[index][i] & (1L << j)) != 0) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tCoreConstants.magicMovesBishop[index][magicIndex] = validMoves;\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public void testSelect_0()\n throws Exception {\n BestChromosomesSelector selector = new BestChromosomesSelector(conf);\n Gene gene = new IntegerGene(conf);\n gene.setAllele(new Integer(444));\n Chromosome secondBestChrom = new Chromosome(conf, gene, 3);\n secondBestChrom.setFitnessValue(11);\n selector.add(secondBestChrom);\n gene = new BooleanGene(conf);\n gene.setAllele(Boolean.valueOf(false));\n Chromosome bestChrom = new Chromosome(conf, gene, 3);\n bestChrom.setFitnessValue(12);\n selector.add(bestChrom);\n selector.select(1, null, new Population(conf));\n }", "public void modifyFitness(Population population) {\n // prepare the calculation\n double[][] data = new double[population.size()][];\n for (int i = 0; i < data.length; i++) {\n data[i] = ((AbstractEAIndividual)population.get(i)).getFitness();\n }\n double min = Double.POSITIVE_INFINITY, fitnessSharing;\n double[] result = new double[data.length];\n AbstractEAIndividual tmpIndy;\n\n for (int x = 0; x < data[0].length; x++) {\n for (int i = 0; i < data.length; i++) data[i][x] = -data[i][x];\n for (int i = 0; i < data.length; i++) {\n if (data[i][x] < min) min = data[i][x];\n }\n\n for (int i = 0; i < data.length; i++) {\n // This will cause the worst individual to have no chance of being selected\n // also note that if all individual achieve equal fitness the sum will be zero\n result[i] = data[i][x] -min + 0.1;\n }\n\n for (int i = 0; i < population.size(); i++) {\n tmpIndy = (AbstractEAIndividual)population.get(i);\n fitnessSharing = 0;\n for (int j = 0; j < population.size(); j++) {\n if (this.m_SharingDistance < this.m_Metric.distance(tmpIndy, (AbstractEAIndividual)population.get(j))) {\n fitnessSharing += 1 - (this.m_Metric.distance(tmpIndy, (AbstractEAIndividual)population.get(j))/this.m_SharingDistance);\n }\n }\n result[i] = result[i]/fitnessSharing;\n }\n\n for (int i = 0; i < population.size(); i++) {\n ((AbstractEAIndividual)population.get(i)).SetFitness(x, result[i]);\n }\n }\n }", "public Chromosome withFitnessCalculated() {\n this.fitness = calculateFitness();\n return this;\n }", "public int randomGQ() {\n\t\treturn(getRandomInteger(10,100));\n\t}", "public float getFitness()\r\n\t{\r\n\t\treturn fitness;\r\n\t}", "double fitness(int gene) {\r\n \tint sum = 0;\r\n \tint prod= 1;\r\n \tfor (int j=0; j<LEN; j++) {\r\n \t\tif (oldpop[gene][j]==0) {\r\n \t\t\tsum += (j+1);\r\n \t\t} else {\r\n \t\t\tprod *= (j+1);\r\n \t\t}\r\n \t}\r\n \treturn Math.abs(sum - SUMTARG)/SUMTARG \r\n \t + Math.abs(prod - PRODTARG)/PRODTARG;\r\n }", "public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(new FileReader(\"talent.in\"));// new InputStreamReader(System.in)); //\n PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(\"talent.out\")));\n int N = sc.nextInt();\n int minWeight = sc.nextInt();\n int[] weight = new int[N];\n int[] value = new int[N];\n int totalTalent = 0;\n for (int i = 0; i < N; i++) {\n int wt = sc.nextInt();\n int val = sc.nextInt();\n weight[i] = wt;\n value[i] = val;\n totalTalent += val;\n }\n\n // Store, for a given talent, what is the smallest weight used to achieve it?\n int[] dp = new int[totalTalent + 1];\n Arrays.fill(dp, (int) 1e9);\n dp[0] = 0;\n // the min weight to produce 0 talent is 0. However,\n // it is necessary to make everything else big because we can only BUILD\n // from 0\n double bestRatio = 0;\n for (int cow = 0; cow < N; cow++) {\n // look at each cow, and go DOWN THROUGH THE dp array, updating the\n // best weight achievable BEHIND US. This countercurrent motion ensures no repeated\n // counting of a single cow's talents\n int contribution = value[cow];\n int wt = weight[cow];\n for (int talent = totalTalent; talent >= 0; talent--) {\n int boostedTalent = contribution + talent;\n int boostedWeight = dp[talent] + wt;\n // with the min weight of a certain talent,\n // is it possible to get a smaller boostedWeight for a boostedTalent\n if (boostedTalent <= totalTalent) {\n // If we are in bounds,\n if (boostedWeight < dp[boostedTalent]) {\n // and the attempted team has a better weight value\n // then update it!\n // Initially, when everything is 1 billion, this cannot\n // happen except for from the base cases, building outward\n dp[boostedTalent] = boostedWeight;\n\n // At the same time, we can be more efficient by constantly\n // checking if we had enough weight first of all, and\n // second of all had a better talent/weight ratio!\n double ratio = (double) boostedTalent / boostedWeight;\n if (ratio > bestRatio && boostedWeight >= minWeight) {\n bestRatio = ratio;\n }\n }\n }\n }\n }\n\n out.println((int) (1000 * bestRatio));\n out.close();\n }", "public Chromosome withRandomKnapsackItems() {\n this.knapsackSelection = generateRandomItems();\n return this;\n }", "float genChance();", "public Object eval(Individual ind)\r\n {\r\n BinaryIndividual bi = (BinaryIndividual)ind;\r\n int partialFitness = 0;\r\n int distance = 0;\r\n double fitness = 0.0;\r\n\r\n\t for (int i=0; i<100; i++){\r\n\r\n\t distance = 0;\r\n\r\n\t for (int j=0; j<100; j++){\r\n\t if (!((BinaryIndividual)target[i]).getBooleanAllele(j)^bi.getBooleanAllele(j)) { \r\n\t\t distance++;\r\n\t }\r\n \r\n\t if (distance > partialFitness) {\r\n\t partialFitness = distance;\r\n\t }\r\n\t }\r\n }\r\n\r\n fitness = (double)partialFitness/100.0;\r\n return new Double(fitness);\r\n \r\n\r\n }", "public int getBestGuy () {\r\n return poblac.getBestGuy();\r\n }", "public Vector run(){\n generationCount = 0;\n solutionList = new Vector();\n bannedList = new Vector();\n solutionCounter = 0;\n whenToHalt.init();\n //INITIALIZE THE POPULATION\n\n population = initializer.getGenes(populationSize, fitnessFunction, minRadius, maxRadius);\n fitnessArray = new double[populationSize];\n //COMPUTE FITNESSES\n for (int x = 0; x < populationSize; x++){\n Gene next = (Gene) population.get(x);\n fitnessArray[x] = next.getFitness();\n }\n\n Arrays.sort(fitnessArray);\n\n while (! stop()){\n //RUN THROUGH THE GENERATIONS\n population = step();\n }\n\n if (useList){\n return solutionList;\n } else {\n return population;\n }\n }", "private PMCGenotype[] selectParents()\n\t{\n\t\tPMCGenotype[] bestGenes = new PMCGenotype[parentsToSelect];\n\n\t\tint lowestFitnessOfSelectedIndex = 0;\n\t\tdouble lowestFitnessOfSelected = -1;\n\n\t\t// Select initial set of parents.\n\t\tbestGenes[0] = population[0];\n\t\tlowestFitnessOfSelectedIndex = 0;\n\t\tlowestFitnessOfSelected = bestGenes[0].getFitness();\n\t\tfor (int i = 1; i < this.parentsToSelect; i++)\n\t\t{\n\t\t\tbestGenes[i] = population[i];\n\n\t\t\tif (bestGenes[i].getFitness() < lowestFitnessOfSelected)\n\t\t\t{\n\t\t\t\tlowestFitnessOfSelectedIndex = i;\n\t\t\t\tlowestFitnessOfSelected = bestGenes[i].getFitness();\n\t\t\t}\n\t\t}\n\n\t\t// Select candidates with the highest fitness, replacing those with lowest fitness.\n\t\tfor (int i = parentsToSelect; i < population.length; i++)\n\t\t{\n\t\t\tPMCGenotype pmcg = population[i];\n\t\t\tif (pmcg.getFitness() > lowestFitnessOfSelected)\n\t\t\t{\n\t\t\t\tbestGenes[lowestFitnessOfSelectedIndex] = pmcg;\n\n\t\t\t\tlowestFitnessOfSelectedIndex = 0;\n\t\t\t\tlowestFitnessOfSelected = bestGenes[0].getFitness();\n\n\t\t\t\tfor (int j = 1; j < parentsToSelect; j++)\n\t\t\t\t{\n\t\t\t\t\tif (bestGenes[j].getFitness() < lowestFitnessOfSelected)\n\t\t\t\t\t{\n\t\t\t\t\t\tlowestFitnessOfSelectedIndex = j;\n\t\t\t\t\t\tlowestFitnessOfSelected = bestGenes[j].getFitness();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn bestGenes;\n\t}", "public double getBestScore();", "public List<Chromosome> doCrossover(Chromosome other, String crossoverType){\n int geneSize = this.knapsackSelection.size();\n\n ArrayList<Chromosome> children = new ArrayList<>();\n\n //Allow for multiple crossover attempts to better the chance of a valid crossover.\n //Note that this can be disabled by setting GAConfiguration.CONCEPTION_ATTEMPTS = 1.\n for(int i = 0; i < PopulationConfiguration.CONCEPTION_ATTEMPTS; i++){\n\n //Set first crossover point to 0 if 1PX Crossover.\n int crossPoint1 = crossoverType.equals(\"1PX\") ? 0 : Configuration.RANDOM_GENERATOR.nextInt(geneSize);\n int crossPoint2 = Configuration.RANDOM_GENERATOR.nextInt(geneSize - crossPoint1) + crossPoint1;\n\n ArrayList<Boolean> c1 = new ArrayList<>();\n ArrayList<Boolean> c2 = new ArrayList<>();\n\n c1.addAll(this.knapsackSelection.subList(0, crossPoint1));\n c1.addAll(other.getKnapsackSelection().subList(crossPoint1, crossPoint2));\n c1.addAll(this.knapsackSelection.subList(crossPoint2, geneSize));\n Chromosome child1 = new Chromosome(c1).withFitnessCalculated();\n\n c2.addAll(other.getKnapsackSelection().subList(0, crossPoint1));\n c2.addAll(this.knapsackSelection.subList(crossPoint1, crossPoint2));\n c2.addAll(other.getKnapsackSelection().subList(crossPoint2, geneSize));\n Chromosome child2 = new Chromosome(c2).withFitnessCalculated();\n \n if(child1.isValid() && children.size() < 2){\n children.add(child1);\n }\n if(child2.isValid() && children.size() < 2){\n children.add(child2);\n }\n if(children.size() == 2){\n break;\n }\n }\n //If the crossover failed to generate a valid child, return the parents.\n if(children.size() == 0){\n children.add(other);\n children.add(this);\n }\n else if(children.size() == 1){\n children.add(this);\n }\n return children;\n }", "public int getHeuristic(){\n\t\tint count = 0;\n\t\tfor (int i = 0; i < getRows(); i++) {\n\t\t\tfor (int j = 0; j < getColumns(); j++) {\n\t\t\t\tif (cells[i][j].getSand() != getK()) \n\t\t\t\t\tcount++;\n\t\t\t}\n\t\t} \n\t\treturn count;\n\t}" ]
[ "0.70784813", "0.70453215", "0.6809448", "0.6667385", "0.6451361", "0.64040184", "0.6269492", "0.6089563", "0.6059861", "0.6049043", "0.6005405", "0.5995659", "0.58572316", "0.58178294", "0.578063", "0.5764337", "0.5739164", "0.57330596", "0.5715709", "0.56755954", "0.5630394", "0.56027275", "0.5574473", "0.5572651", "0.556846", "0.55371755", "0.5515526", "0.5506258", "0.54958445", "0.54697365", "0.5466187", "0.5461211", "0.54588497", "0.5456945", "0.54565877", "0.54334575", "0.5426206", "0.54188126", "0.54118574", "0.5361077", "0.53291446", "0.53215575", "0.5298565", "0.52726954", "0.527111", "0.52325344", "0.5230719", "0.52249044", "0.52024627", "0.51997906", "0.51996547", "0.5198696", "0.51962095", "0.5196044", "0.5188066", "0.5181882", "0.51812273", "0.51722753", "0.5166186", "0.5165722", "0.51642174", "0.5157692", "0.5145707", "0.51366335", "0.5123378", "0.5112422", "0.5105445", "0.5092085", "0.5086182", "0.50831485", "0.5079187", "0.5071265", "0.5063038", "0.5056956", "0.5053093", "0.50363123", "0.50199217", "0.5010224", "0.50088227", "0.50047475", "0.49888918", "0.4979615", "0.49762705", "0.4972413", "0.4962787", "0.49546584", "0.4942721", "0.4934806", "0.4932716", "0.4930893", "0.4922369", "0.4921675", "0.4919468", "0.49067253", "0.4905451", "0.48905638", "0.4888921", "0.48843154", "0.48825076", "0.48607558" ]
0.6307293
6
Crossover of two parents using two random crossover points, crossover takes form P2 | P1 | P2
private int[][] crossoverTwoPoint(int[] parent1, int[] parent2) { int crossPoint1 = rand.nextInt(parent1.length); int crossLength = rand.nextInt(parent1.length + 1 - crossPoint1); int crossPoint2 = crossPoint1 + crossLength; int[] child = new int[parent1.length]; int[] child2 = new int[parent1.length]; for (int i = crossPoint1; i < crossPoint2; i++) { child[i] = parent1[i]; //items between cross points are direct copied from p1 child2[i] = parent2[i]; //opposite for child 2 } for (int i = 0; i < crossPoint1; i++) { child[i] = parent2[i]; //items on either side copied direct from p2 child2[i] = parent1[i]; //opposite for child 2 } for (int i = crossPoint2; i < parent1.length; i++) { child[i] = parent2[i]; //items on either side copied direct from p2 child2[i] = parent1[i]; //opposite for child 2 } return new int[][] { child, child2 }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private int[][] crossoverOnePoint(int[] parent1, int[] parent2) {\n\t\tint crossPoint1 = rand.nextInt(parent1.length);\n\n\t\tint[] child = new int[parent1.length];\n\t\tint[] child2 = new int[parent1.length];\n\t\tfor (int i = 0; i < crossPoint1; i++) {\n\t\t\tchild[i] = parent1[i]; //before cross point = p1\n\t\t\tchild2[i] = parent2[i]; //opposite for child2\n\t\t}\n\n\t\tfor (int i = crossPoint1; i < parent1.length; i++) {\n\t\t\tchild[i] = parent2[i]; //after and including crosspoint = p2\n\t\t\tchild2[i] = parent1[i]; //opposite for child2\n\t\t}\n\t\treturn new int[][] { child, child2 };\n\n\t}", "public Chromosome crossover(Chromosome firstParent, Chromosome secondParent);", "private void crossover() {\r\n\r\n individual[] temp_pop = new individual[this.pop_size];\r\n\r\n for (int i = 0; i < pop_size; i++) { // go through population\r\n\r\n int a = new Random().nextInt(this.pop_size);\r\n int b = new Random().nextInt(this.pop_size);\r\n\r\n int split_point = new Random().nextInt(this.gene_size);\r\n\r\n float[] p1_genes = this.parent_population.getPopulation()[a].getGenes();\r\n float[] p2_genes = this.parent_population.getPopulation()[b].getGenes();\r\n\r\n float[] c1_genes = new float[gene_size];\r\n float[] c2_genes = new float[gene_size];\r\n\r\n for (int j = 0; j < gene_size; j++) {\r\n\r\n if (j < split_point) {\r\n c1_genes[j] = p1_genes[j];\r\n c2_genes[j] = p2_genes[j];\r\n } else {\r\n c2_genes[j] = p1_genes[j];\r\n c1_genes[j] = p2_genes[j];\r\n }\r\n }\r\n individual child1 = new individual(c1_genes, solutions, output);\r\n individual child2 = new individual(c2_genes, solutions, output);\r\n\r\n if (child1.getFitness() > child2.getFitness()) {\r\n temp_pop[i] = child1;\r\n } else {\r\n temp_pop[i] = child2;\r\n }\r\n }\r\n this.offspring_population.setPopulation(temp_pop);\r\n this.offspring_population.update_population();\r\n }", "@SuppressWarnings(\"unchecked\")\r\n\t@Override\r\n\tpublic void crossover() {\r\n\t\tfinal double CROSSOVER_PROB = 0.5;\r\n\t\tfor (int i=0; i<this.nChromosomes-(this.nChromosomes%2); i=i+2) {\r\n\t\t\tif (Math.random() < CROSSOVER_PROB) {\r\n\t\t\t\tArrayList<Integer> chr1 = (ArrayList<Integer>) this.chromosomes.get(i);\r\n\t\t\t\tArrayList<Integer> chr2 = (ArrayList<Integer>) this.chromosomes.get(i+1);\r\n\t\t\t\t// Uniform crossover\r\n\t\t\t\tif (!chr1.equals(chr2)) {\r\n\t\t\t\t\tfor (int j=0; j<this.nViaPoints; j=j+2) {\r\n\t\t\t\t\t\t// swap via points between 2 chromosomes\r\n\t\t\t\t\t\tInteger tmp = chr2.get(j);\r\n\t\t\t\t\t\tchr2.remove(j);\r\n\t\t\t\t\t\tchr2.add(j, chr1.get(j));\r\n\t\t\t\t\t\tchr1.remove(j);\r\n\t\t\t\t\t\tchr1.add(j, tmp);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tthis.printChromosomes(\"After crossover\");\r\n\t}", "public void crossover() {\n\n // Perform crossover with probability Defines.PROB_CROSSOVER\n if (Defines.probCrossover > Math.random()) {\n this.crossoverOX();\n } else {\n // randomly select one of the parents to copy without crossover\n int idx = Defines.randNum(0, this.parents.size() - 1);\n Chromosome newChild = this.parents.get(idx);\n this.offspring = new ArrayList<Chromosome>();\n this.offspring.add(newChild);\n }\n }", "public void origCrossover() {\n\n ArrayList<Integer> crossPoints;\n\n // Perform crossover with probability Defines.PROB_CROSSOVER\n if (Defines.probCrossover > Math.random()) {\n // Choose random crossover points within the chromosome\n // [TODO: consider usefulness of a crossover point that coincides with\n // group boundary. If both crossovers are group boundaries, the crossover does nothing.]\n crossPoints = new ArrayList<Integer>();\n for (int i = 0; i < Defines.crossoverPoints; i++) {\n crossPoints.add(Defines.randNum(0, Defines.chromosomeSize - 1));\n }\n } else {\n // Parents are used without crossover - no crossover points; \n crossPoints = null;\n }\n\n ChromosomeGenerator chromoGen = new ChromosomeGenerator(this.pool);\n this.offspring = new ArrayList<Chromosome>(Arrays.asList(chromoGen.generateOffspring(this.parents, crossPoints)));\n }", "public List<Individual> crossover2Point2(Individual parent1, Individual parent2) {\n List <Individual> listOffsprings = new ArrayList<Individual>();\n Individual offspring1 = new Individual(parent1.getChromosomeLength());\n Individual offspring2 = new Individual(parent1.getChromosomeLength());\n int crossoverPoint1 = Service.rand(0, parent1.getChromosomeLength()-1);\n int crossoverPoint2 = Service.rand(crossoverPoint1 + 1, crossoverPoint1 + parent1.getChromosomeLength() - 1);\n\n for(int geneIndex = 0; geneIndex < parent1.getChromosomeLength(); geneIndex++) {\n if (crossoverPoint2 >= parent1.getChromosomeLength()) {\n if(geneIndex >= crossoverPoint1 || geneIndex < (crossoverPoint2 - parent1.getChromosomeLength())) {\n offspring1.setGene(geneIndex, parent2.getGene(geneIndex ));\n offspring2.setGene(geneIndex, parent1.getGene(geneIndex ));\n } else {\n offspring1.setGene(geneIndex, parent1.getGene(geneIndex ));\n offspring2.setGene(geneIndex, parent2.getGene(geneIndex ));\n }\n }else {\n if(geneIndex >= crossoverPoint1 && geneIndex < crossoverPoint2) {\n offspring1.setGene(geneIndex, parent2.getGene(geneIndex ));\n offspring2.setGene(geneIndex, parent1.getGene(geneIndex ));\n } else {\n offspring1.setGene(geneIndex, parent1.getGene(geneIndex ));\n offspring2.setGene(geneIndex, parent2.getGene(geneIndex ));\n }\n }\n }\n listOffsprings.add(offspring1);\n listOffsprings.add(offspring2);\n return listOffsprings;\n }", "public static void crossover(Individual[] parent) {\n Individual[] children = new Individual[POP_SIZE];\n for (int i = 0; i < POP_SIZE; i += 2) {\n Individual child1 = new Individual(GENE_SIZE, NUM_RULES, COND_LEN);\n child1.generateRulebase();\n Individual child2 = new Individual(GENE_SIZE, NUM_RULES, COND_LEN);\n child2.generateRulebase();\n\n int crossOverPoint = new Random().nextInt(GENE_SIZE);\n for (int j = 0; j < crossOverPoint; j++) {\n child1.gene[j] = parent[i].gene[j];\n child2.gene[j] = parent[i + 1].gene[j];\n }\n\n for (int j = crossOverPoint; j < GENE_SIZE; j++) {\n child1.gene[j] = parent[i + 1].gene[j];\n child2.gene[j] = parent[i].gene[j];\n }\n\n child1.generateRulebase();\n child2.generateRulebase();\n children[i] = new Individual(child1);\n children[i + 1] = new Individual(child2);\n }\n\n matingPool = Arrays.copyOf(children, parent.length);\n }", "public Individual crossover1Point(Individual parent1, Individual parent2) {\n Individual offspring = new Individual(parent1.getChromosomeLength());\n int crossoverPoint = Service.rand(0, parent1.getChromosomeLength());\n for (int geneIndex = 0; geneIndex < parent1.getChromosomeLength(); geneIndex++) {\n // Use half of parent1's genes and half of parent2's genes\n if (crossoverPoint > geneIndex) {\n offspring.setGene(geneIndex, parent1.getGene(geneIndex));\n } else {\n offspring.setGene(geneIndex, parent2.getGene(geneIndex));\n }\n }\n return offspring;\n }", "public Individual crossover2Point(Individual parent1, Individual parent2) {\n Individual offspring = new Individual(parent1.getChromosomeLength());\n int crossoverPoint1 = Service.rand(0, parent1.getChromosomeLength()-1);\n int crossoverPoint2 = Service.rand(crossoverPoint1 + 1, crossoverPoint1 + parent1.getChromosomeLength());\n\n for(int geneIndex = 0; geneIndex < parent1.getChromosomeLength(); geneIndex++) {\n if (crossoverPoint2 >= parent1.getChromosomeLength()) {\n if(geneIndex >= crossoverPoint1 || geneIndex < (crossoverPoint2 - parent1.getChromosomeLength())) {\n offspring.setGene(geneIndex, parent2.getGene(geneIndex));\n } else {\n offspring.setGene(geneIndex, parent1.getGene(geneIndex));\n }\n }else {\n if(geneIndex >= crossoverPoint1 && geneIndex < crossoverPoint2) {\n offspring.setGene(geneIndex, parent2.getGene(geneIndex));\n } else {\n offspring.setGene(geneIndex, parent1.getGene(geneIndex));\n }\n }\n }\n return offspring;\n }", "public static Tour[] partiallyMatchedCrossover(Tour parent1, Tour parent2){\n Tour child1 = new Tour(false);\n child1.getTour().addAll(parent1.getTour());\n // Remove the end city in the cycle\n child1.getTour().remove(child1.getLength()-1);\n // Start with the parent genotypes\n Tour child2 = new Tour(false);\n child2.getTour().addAll(parent2.getTour());\n child2.getTour().remove(child2.getLength()-1);\n // Return the parents unchanged as offspring if crossover rate not met or clones\n if((parent1 == parent2) || Math.random() > RunGA.crossoverRate){\n return new Tour[]{parent1, parent2};\n } else{\n int start = (int)(Math.random()*child1.getLength());\n int end = (int)(Math.random()*child1.getLength());\n if(start > end){\n int temp = start;\n start = end;\n end = temp;\n }\n // Swap the cities between the start and end indeces to the corresponding indeces in other parent\n for(int i=start; i<=end; i++){\n // Find index of the each city to be swapped in the genotype\n int swapIndex1 = child1.getTour().indexOf(parent2.getTour().get(i));\n int swapIndex2 = child2.getTour().indexOf(parent1.getTour().get(i));\n City temp1 = child1.getTour().get(i);\n City temp2 = child2.getTour().get(i);\n child1.getTour().set(i, parent2.getTour().get(i));\n child2.getTour().set(i, parent1.getTour().get(i));\n child1.getTour().set(swapIndex1, temp1);\n child2.getTour().set(swapIndex2, temp2);\n }\n // Reform cycle\n child1.getTour().add(child1.getTour().get(0));\n child2.getTour().add(child2.getTour().get(0));\n }\n Tour[] children = new Tour[]{child1, child2};\n return children;\n }", "public abstract Individual doCrossover(Individual ind1, Individual ind2, MOEAD init);", "public void crossoverOX() {\n\n // [TODO: consider usefulness of a crossover point that coincides with\n // group boundary. If both crossovers are group boundaries, the crossover does nothing.]\n ArrayList<Integer> crossPoints = getCrossoverPoints(Defines.cpMode);\n\n Collections.sort(crossPoints);\n\n ChromosomeGenerator chromoGen = new ChromosomeGenerator(this.pool);\n\n this.offspring = new ArrayList<Chromosome>(Arrays.asList(chromoGen.generateOffspringOX(this.parents, crossPoints)));\n\n }", "private void crossover(Chromosome c1, Chromosome c2){\n int split = (int)(Math.random()*c1.getNumWeights());\n \n double[][] m1 = c1.getGeneData();\n double[][] m2 = c2.getGeneData();\n double store;\n \n //Begin the switch\n for(int r=0; r<m1.length; r++){\n //Stop spliting\n if(split <= 0){\n break;\n }\n for(int c=0; c<m1[r].length;c++){\n store = m1[r][c];\n m1[r][c] = m2[r][c];\n m2[r][c] = store;\n split--;\n //Stop spliting\n if(split <= 0){\n break;\n }\n }\n }\n }", "public List<Chromosome> doCrossover(Chromosome other, String crossoverType){\n int geneSize = this.knapsackSelection.size();\n\n ArrayList<Chromosome> children = new ArrayList<>();\n\n //Allow for multiple crossover attempts to better the chance of a valid crossover.\n //Note that this can be disabled by setting GAConfiguration.CONCEPTION_ATTEMPTS = 1.\n for(int i = 0; i < PopulationConfiguration.CONCEPTION_ATTEMPTS; i++){\n\n //Set first crossover point to 0 if 1PX Crossover.\n int crossPoint1 = crossoverType.equals(\"1PX\") ? 0 : Configuration.RANDOM_GENERATOR.nextInt(geneSize);\n int crossPoint2 = Configuration.RANDOM_GENERATOR.nextInt(geneSize - crossPoint1) + crossPoint1;\n\n ArrayList<Boolean> c1 = new ArrayList<>();\n ArrayList<Boolean> c2 = new ArrayList<>();\n\n c1.addAll(this.knapsackSelection.subList(0, crossPoint1));\n c1.addAll(other.getKnapsackSelection().subList(crossPoint1, crossPoint2));\n c1.addAll(this.knapsackSelection.subList(crossPoint2, geneSize));\n Chromosome child1 = new Chromosome(c1).withFitnessCalculated();\n\n c2.addAll(other.getKnapsackSelection().subList(0, crossPoint1));\n c2.addAll(this.knapsackSelection.subList(crossPoint1, crossPoint2));\n c2.addAll(other.getKnapsackSelection().subList(crossPoint2, geneSize));\n Chromosome child2 = new Chromosome(c2).withFitnessCalculated();\n \n if(child1.isValid() && children.size() < 2){\n children.add(child1);\n }\n if(child2.isValid() && children.size() < 2){\n children.add(child2);\n }\n if(children.size() == 2){\n break;\n }\n }\n //If the crossover failed to generate a valid child, return the parents.\n if(children.size() == 0){\n children.add(other);\n children.add(this);\n }\n else if(children.size() == 1){\n children.add(this);\n }\n return children;\n }", "@Override\n\tpublic Tour crossover(Tour parent1, Tour parent2) {\n\t\tTour child = new Tour(parent1.getSize());\n\t\t\n\t\t// Select a parent randomly\n\t\tdouble randomNum = Math.random();\n\t\tTour parent = randomNum > 0.5 ? parent1 : parent2;\n\t\t\n\t\t// Add cities from parent to the child\n\t\tfor (int i=0; i<child.getSize(); i++) {\n\t\t\tchild.setCity(i, parent.getCity(i));\t\t\n\t\t}\n\t\t\n\t\treturn child;\n\t\t\n\t}", "private Evolvable zipperCross(Evolvable parent1, Evolvable parent2)\n\t{\n\t\tint[] dnaP1 = ((SNSAgent)parent1).getDna();\n\t\t//dna of second parent\n\t\tint[] dnaP2 = ((SNSAgent)parent2).getDna();\n\t\t\n\t\t//result dna\n\t\tint dnaChild[] = new int[3000];\n\t\t//simple cross\n\t\tfor(int i = 0; i < 3000; i++)\n\t\t{\t\t\n\t\t\tif(i%2 == 0)\n\t\t\t\tdnaChild[i] = dnaP1[i];\n\t\t\telse\n\t\t\t\tdnaChild[i] = dnaP2[i];\n\t\t}\n\t\treturn new SNSAgent(dnaChild, ((SNSAgent)parent1).behavior);\t\n\t}", "public void MultipointCrossoverCAN (TableVar Variables) {\r\n int i, mom, dad, xpoint1, xpoint2;\r\n \r\n // We cross the two better individuals (the first ones)\r\n mom = 0; // Better individual\r\n dad = 1; // Second individual\r\n \r\n // Copy the individuals to cross\r\n for (i=0; i<Variables.getNVars(); i++) {\r\n Des.setCromElem (0, i, Inter.getCromElem(mom,i));\r\n Des.setCromElem (1, i, Inter.getCromElem(dad,i));\r\n }\r\n\r\n // Generation of the two points for the crossover\r\n xpoint1 = Randomize.Randint (0,(Variables.getNVars()-1));\r\n if (xpoint1!=Variables.getNVars()-1)\r\n xpoint2 = Randomize.Randint ((xpoint1+1),(Variables.getNVars()-1));\r\n else\r\n xpoint2 = Variables.getNVars()-1;\r\n\r\n // Cross the parts between both points\r\n for (i=xpoint1;i<=xpoint2;i++) {\r\n Des.setCromElem(mom, i, Inter.getCromElem(dad,i));\r\n Des.setCromElem(dad, i, Inter.getCromElem(mom,i));\r\n }\r\n\r\n // New individuals are not evaluated\r\n Des.setIndivEvaluated (mom, false);\r\n Des.setIndivEvaluated (dad, false);\r\n \r\n }", "Tour crossOver(Tour p2, int x1, int x2) {\r\n\t\t// make an empty tour and then fill it in\r\n\t\tTour child = new Tour();\r\n\r\n\t\t// copy the 1st segment of (this) to the child\r\n\t\tfor (int i = 0; i < x1; i++) {\r\n\t\t child.index[i] = this.index[i];\r\n\t\t}\r\n\t\t\r\n\t\tfor (int i = x1; i <= x2; i++) {\r\n\t\t child.index[i] = p2.index[i];\r\n\t\t}\r\n\t\t// copy the cross-over portion of p2 to the child\r\n\t\t\r\n for (int i = x2 + 1; i < index.length; i++) {\r\n child.index[i] = this.index[i];\r\n }\t\t\r\n\t\t// copy the last segment of (this) to the child\r\n\r\n\t\t// Now we need to correct the child for any duplicate cities\r\n\t\t\r\n\t\t// First find out the unique elements of the cross-over segment\r\n\t\t// i.e., those elements of the cross-over segment of\r\n\t\t// p1 that are not in p2\r\n\t\tint[] uniq = new int[x2 - x1 + 1];\r\n\t\tint k = 0;\r\n\t\tboolean found = false;\r\n for (int i = x1; i <= x2; i++) {\r\n for (int j = x1; j <= x2; j++) {\r\n if (this.index[i] == p2.index[j]) {\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (found) {\r\n found = false;\r\n continue;\r\n }\r\n uniq[k] = this.index[i];\r\n k++;\r\n }\r\n System.out.println();\r\n\t\t// *** TODO ***\r\n \r\n k--;\r\n found = false;\r\n for (int i = x1; i <= x2; i++) {\r\n for (int j = 0; j < x1; j++) {\r\n if (child.index[i] == child.index[j]) {\r\n child.index[i] = uniq[k];\r\n k--;\r\n found = true;\r\n break;\r\n }\r\n }\r\n \r\n if (found) {\r\n found = false;\r\n continue;\r\n }\r\n \r\n for (int j = x2 + 1; j < index.length; j++) {\r\n if (child.index[i] == child.index[j]) {\r\n child.index[i] = uniq[k];\r\n k--;\r\n break;\r\n }\r\n }\r\n }\r\n\t\t// scan the two portions of p1 that have been crossed into the\r\n\t\t// the child for any duplicates in the crossed-over \r\n\t\t// segment and if so replace with an element from the uniq list\r\n\t\t\r\n\t\tchild.distance = child.distance();\r\n\t\treturn child;\r\n\t}", "private Evolvable cross(Evolvable parent1, Evolvable parent2)\n\t{\n\t\tif(((SNSAgent)parent1).getBehavior().equals(\"RuleBased\"))\n\t\t{\t\n\t\t\tint split = R.nextInt(7) + 1;\n\t\t\tif(crossBehavior.equals(\"zipperCross\"))\n\t\t\t\treturn ruleZipperCross(parent1, parent2);\n\t\t\telse if(crossBehavior.equals(\"splitCross\"))\n\t\t\t\treturn ruleSplitCross(parent1, parent2, split);\n\t\t\telse if(crossBehavior.equals(\"smartCross\"))\n\t\t\t\treturn ruleSplitCross(parent1, parent2, split);\n\t\t\telse\n\t\t\t\tSystem.out.println(\"WARNING: Cross Behavior not defined.\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tint split = R.nextInt(1000) + 100;\n\t\t\tif(crossBehavior.equals(\"zipperCross\"))\n\t\t\t\treturn zipperCross(parent1, parent2);\n\t\t\telse if (crossBehavior.equals(\"splitCross\"))\n\t\t\t\treturn splitCross(parent1, parent2, split);\n\t\t\telse if (crossBehavior.equals(\"freeSplitCross\")){\n\t\t\t\treturn splitCross(parent1, parent2, R.nextInt(3000));\n\t\t\t}\n\t\t\telse if(crossBehavior.equals(\"smartCross\"))\n\t\t\t{\n\t\t\t\tsplit = ((SNSAgent)parent1).getCurrentMove() - R.nextInt(30);\n\t\t\t\treturn splitCross(parent1, parent2, split);\n\t\t\t}\n\t\t\telse\n\t\t\t\tSystem.out.println(\"WARNING: Cross Behavior not defined.\");\n\t\t}\n\n\t\treturn zipperCross(parent1, parent2);\n\t}", "private Vector crossover(Individual mother, Individual father) {\n \n //don't want to do crossover on two chromosomes that are equal\n if(mother.equals(father)) {\n Vector to_return = new Vector();\n to_return.add(mother);\n to_return.add(father);\n return to_return;\n }\n \n println(\"crossover\", 1);\n int[] mom = mother.getChromosome();\n int[] dad = father.getChromosome();\n int[] child1 = new int[num_shipping_points]; \n int[] child2 = new int[num_shipping_points]; \n \n println(\"mother is\", 1);\n displayChromosome(mother, 1);\n println(\"father is\", 1);\n displayChromosome(father, 1);\n \n int breakpoint = (int)(Math.random() * num_shipping_points) + 3;\n println(\"breakpoint = \" + breakpoint, 1);\n \n int comparisons = 0;\n \n for(int i = 0; i < num_shipping_points; i++) {\n if(i < breakpoint) {\n child1[i] = mom[i];\n child2[i] = dad[i];\n }\n else {\n child1[i] = -1;\n child2[i] = -1;\n }\n } \n \n int j = breakpoint; //index on other chromosome\n\n for(int i = breakpoint; i < num_shipping_points; i++) {\n\n while(containsGene(child2, mom[j])) {\n j++;\n comparisons++;\n if(comparisons > 30) {\n println(\"leaving\", 1);\n System.exit(0);\n }\n \n if(j == num_shipping_points) {\n j = 0;\n }\n if(j == breakpoint) //not supposed to happen, but it does\n break;\n }\n child2[i] = mom[j];\n j++;\n if(j == num_shipping_points) {\n j = 0;\n }\n\n }\n \n j = breakpoint;\n comparisons = 0; \n for(int i = breakpoint; i < num_shipping_points; i++) {\n\n while(containsGene(child1, dad[j])) {\n j++;\n comparisons++;\n if(comparisons > 30) {\n println(\"leaving\", 1);\n System.exit(0);\n }\n if(j == num_shipping_points) {\n j = 0;\n }\n if(j == breakpoint)\n break;\n }\n child1[i] = dad[j];\n j++;\n if(j == num_shipping_points) {\n j = 0;\n }\n }\n \n Vector v = new Vector();\n Individual i1 = new Individual(child1, this);\n Individual i2 = new Individual(child2, this);\n //i1.setFitness(evaluateFitness(i1));\n //i2.setFitness(evaluateFitness(i1));\n v.add(i1);\n v.add(i2);\n println(\"kid1:\",1);\n displayChromosome(i1, 1);\n println(\"kid2:\", 1);\n displayChromosome(i2, 1);\n println(\"returning from crossover\",1);\n return v;\n }", "public void crossover(){\n \t\n \t//int cut2 = ((NODELENGTH * 3 + 1) / 3) + cut;\n \tfor (int g = 0; g < (wallpapers.size() - 1); g += 2){\n \t\tint cut = getCutPoint();\n \t\tint[] parent1 = wallpapers.get(g);\n \t\tint[] parent2 = wallpapers.get(g + 1);\n \t\t\n \t\tint[] child1 = new int[parent1.length];\n \t\tint[] child2 = new int[parent2.length];\n \t\tfor (int i = 0; i < (cut); i++){\n \t\t\tchild1[i] = parent1[i];\n \t\t\tchild2[i] = parent2[i];\n \t\t}\n \t\tfor (int j = cut; j < parent1.length; j++){\n \t\t\tchild1[j] = parent2[j];\n \t\t\tchild2[j] = parent1[j];\n \t\t}\n \t\t\n \t\t\n \t\twallpapers.set(g, child1);\n \t\twallpapers.set(g + 1, child2);\n \t}\n \tfor (int d = 0; d < (wallpapers.size() * 2); d++){\n \t\tif (d < wallpapers.size()){\n \t\t\ttemp_wallpapers.add(wallpapers.get(d));\n \t\t}\n \t\telse {\n \t\t\ttemp_wallpapers.add(node());\n \t\t}\n \t}\n \twallpapers.clear();\n \tfor (int u = 0; u < temp_wallpapers.size(); u++){\n\t\t\twallpapers.add(u, temp_wallpapers.get(u));\n\t\t}\n \ttemp_wallpapers.clear();\n }", "public Population doCrossover(Population p) {\n\t\t// TODO Auto-generated method stub\n\t\tSystem.out.println(\"Performing 1 point crossover for config1's selection population.\");\n\t\tSystem.out.println(\"Selecting bits to crossover.\");\n\t\tSystem.out.println(\"Completed.\");\n\t\treturn p;\n\t }", "public void MultipointCrossoverDNF (TableVar Variables) {\r\n int i, j, mom, dad, xpoint1, xpoint2;\r\n\r\n // We cross the two better individuals (the first ones)\r\n mom = 0; // Better individual\r\n dad = 1; // Second individual\r\n\r\n // Copy the individuals to cross\r\n for (i=0; i<Variables.getNVars(); i++) {\r\n for (j=0; j<=Variables.getNLabelVar(i); j++) {\r\n Des.setCromElemGene(0, i, j, Inter.getCromElemGene(mom,i, j));\r\n Des.setCromElemGene (1, i, j, Inter.getCromElemGene(dad,i, j));\r\n }\r\n }\r\n\r\n // Generation of the two points for the crossover\r\n xpoint1 = Randomize.Randint (0,(Variables.getNVars()-1));\r\n if (xpoint1!=Variables.getNVars()-1)\r\n xpoint2 = Randomize.Randint ((xpoint1+1),(Variables.getNVars()-1));\r\n else\r\n xpoint2 = Variables.getNVars()-1;\r\n\r\n // Cross the parts between both points\r\n for (i=xpoint1;i<=xpoint2;i++) {\r\n for (j=0; j<=Variables.getNLabelVar(i); j++) {\r\n Des.setCromElemGene(mom, i, j, Inter.getCromElemGene(dad,i,j));\r\n Des.setCromElemGene(dad, i, j, Inter.getCromElemGene(mom,i,j));\r\n }\r\n }\r\n\r\n // New individuals are not evaluated\r\n Des.setIndivEvaluated (mom, false);\r\n Des.setIndivEvaluated (dad, false);\r\n\r\n }", "public Evolvable cross(Evolvable parent1, Evolvable parent2, int crossoverPoint)\n\t{\n\t\tif(((SNSAgent)parent1).getBehavior().equals(\"RuleBased\"))\n\t\t{\t\n\t\t\tif(crossBehavior.equals(\"zipperCross\"))\n\t\t\t\treturn ruleZipperCross(parent1, parent2);\n\t\t\telse if(crossBehavior.equals(\"splitCross\"))\n\t\t\t\treturn ruleSplitCross(parent1, parent2, crossoverPoint);\n\t\t\telse if(crossBehavior.equals(\"smartCross\"))\n\t\t\t\treturn ruleSplitCross(parent1, parent2, crossoverPoint);\n\t\t\telse\n\t\t\t\tSystem.out.println(\"WARNING: Cross Behavior not defined.\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(crossBehavior.equals(\"zipperCross\"))\n\t\t\t\treturn zipperCross(parent1, parent2);\n\t\t\t\n\t\t\telse if (crossBehavior.equals(\"splitCross\"))\n\t\t\t\treturn splitCross(parent1, parent2, crossoverPoint);\n\t\t\t\n\t\t\telse if (crossBehavior.equals(\"freeSplitCross\")){\n\t\t\t\treturn splitCross(parent1, parent2, crossoverPoint);\n\t\t\t}\n\t\t\t\n\t\t\telse if(crossBehavior.equals(\"smartCross\")) {\n\t\t\t\tint split = ((SNSAgent)parent1).getCurrentMove() - R.nextInt(30);\n\t\t\t\treturn splitCross(parent1, parent2, split);\n\t\t\t}\n\t\t\telse\n\t\t\t\tSystem.out.println(\"WARNING: Cross Behavior not defined.\");\n\t\t}\n\n\t\treturn zipperCross(parent1, parent2);\n\t}", "private void mate(NeuralPlayer org1, NeuralPlayer org2, NeuralPlayer offspring)\n\t{\n\t\tBasicNetwork newGuy = (BasicNetwork)org1.net.clone();\n\t\tRandom g = new Random();\n\t\tdouble[] genome1 = NetworkCODEC.networkToArray(org1.net);\n\t\tdouble[] genome2 = NetworkCODEC.networkToArray(org2.net);\n\t\t\n\t\tint numCrosses = 1;//g.nextInt(20)+2;//g.nextInt(genome1.length/4)+1;\n\t\tfor (int j = 0; j< numCrosses; j++)\n\t\t{\n\t\t\tint crossIndex = g.nextInt(genome1.length);\n\t\t\t//int crossLength = g.nextInt(genome1.length)+1;//g.nextInt(50);\n\t\t\t//int stop = Math.min(crossIndex+crossLength,genome1.length);\n\t\t\tfor (int i = crossIndex; i<genome1.length; i++)\n\t\t\t\tgenome2[i] = genome1[i]; // 1 point crossover\n\t\t}\n\t\tNetworkCODEC.arrayToNetwork(genome2, newGuy);\n\t\toffspring.net = newGuy;\n\t}", "public static Tree crossover(double[] distribution, Tree[] trees){\n Tree tree1 = chooseRandTree(distribution, trees);\n Tree tree2 = chooseRandTree(distribution, trees);\n if (tree2 == null) System.out.println(\"Null1\");\n while (tree1.equals(tree2)){\n tree2 = chooseRandTree(distribution,trees);\n if (tree2 == null) System.out.println(\"Null2\");\n }\n return reproduce(tree1, tree2);\n \n }", "public Individual crossover(Individual parentB)\r\n\t{\r\n\t\tIndividual ind = new Individual(intSize, intCount, signedInt);\r\n\r\n\t\t// Copy over genes randomly\r\n\t\tfor (int i = 0; i < binary.length; i++)\r\n\t\t{\r\n\t\t\tboolean parentA = Math.random() >= 0.5;\r\n\t\t\tind.binary[i] = parentA ? binary[i] : parentB.binary[i];\r\n\t\t}\r\n\r\n\t\treturn ind;\r\n\t}", "public static Tour crossover(Tour parent1, Tour parent2) {\n // Create new child tour\n Tour child = new Tour();\n\n // Get start and end sub tour positions for parent1's tour\n int startPos = (int) (Math.random() * parent1.tourSize());\n int endPos = (int) (Math.random() * parent1.tourSize());\n\n // Loop and add the sub tour from parent1 to our child\n for (int i = 0; i < child.tourSize(); i++) {\n // If our start position is less than the end position\n if (startPos < endPos && i > startPos && i < endPos) {\n child.setCity(i, parent1.getCity(i));\n } // If our start position is larger\n else if (startPos > endPos) {\n if (!(i < startPos && i > endPos)) {\n child.setCity(i, parent1.getCity(i));\n }\n }\n }\n\n // Loop through parent2's city tour\n for (int i = 0; i < parent2.tourSize(); i++) {\n // If child doesn't have the city add it\n if (!child.containsCity(parent2.getCity(i))) {\n // Loop to find a spare position in the child's tour\n for (int ii = 0; ii < child.tourSize(); ii++) {\n // Spare position found, add city\n if (child.getCity(ii) == null) {\n child.setCity(ii, parent2.getCity(i));\n break;\n }\n }\n }\n }\n return child;\n }", "public void simulatedBinaryCrossover(MersenneTwisterFast random, TraceableFloatVectorIndividual other, float eta_c)\n {\n final double EPS = FloatVectorSpecies.SIMULATED_BINARY_CROSSOVER_EPS;\n FloatVectorSpecies s = (FloatVectorSpecies) species;\n TraceableFloat[] parent1 = genome;\n TraceableFloat[] parent2 = other.genome;\n // double[] min_realvar = s.minGenes;\n // double[] max_realvar = s.maxGenes;\n \n \n double y1, y2, yl, yu;\n double c1, c2;\n double alpha, beta, betaq;\n double rand;\n \n for(int i = 0; i < parent1.length; i++)\n {\n if (random.nextBoolean()) // 0.5f\n {\n if (Math.abs(parent1[i].getValue() - parent2[i].getValue()) > EPS)\n {\n if (parent1[i].getValue() < parent2[i].getValue())\n {\n y1 = parent1[i].getValue();\n y2 = parent2[i].getValue();\n }\n else\n {\n y1 = parent2[i].getValue();\n y2 = parent1[i].getValue();\n }\n yl = s.minGene(i); //min_realvar[i];\n yu = s.maxGene(i); //max_realvar[i]; \n rand = random.nextFloat();\n beta = 1.0 + (2.0*(y1-yl)/(y2-y1));\n alpha = 2.0 - Math.pow(beta,-(eta_c+1.0));\n if (rand <= (1.0/alpha))\n {\n betaq = Math.pow((rand*alpha),(1.0/(eta_c+1.0)));\n }\n else\n {\n betaq = Math.pow((1.0/(2.0 - rand*alpha)),(1.0/(eta_c+1.0)));\n }\n c1 = 0.5*((y1+y2)-betaq*(y2-y1));\n beta = 1.0 + (2.0*(yu-y2)/(y2-y1));\n alpha = 2.0 - Math.pow(beta,-(eta_c+1.0));\n if (rand <= (1.0/alpha))\n {\n betaq = Math.pow((rand*alpha),(1.0/(eta_c+1.0)));\n }\n else\n {\n betaq = Math.pow((1.0/(2.0 - rand*alpha)),(1.0/(eta_c+1.0)));\n }\n c2 = 0.5*((y1+y2)+betaq*(y2-y1));\n if (c1<yl)\n c1=yl;\n if (c2<yl)\n c2=yl;\n if (c1>yu)\n c1=yu;\n if (c2>yu)\n c2=yu;\n if (random.nextBoolean())\n {\n parent1[i] = this.recombineGenes(parent1[i], parent2[i], (float) c2);\n parent2[i] = this.recombineGenes(parent2[i], parent1[i], (float) c1);\n }\n else\n {\n parent1[i] = this.recombineGenes(parent1[i], parent2[i], (float) c2);\n parent2[i] = this.recombineGenes(parent2[i], parent1[i], (float) c1);\n }\n }\n else\n {\n // do nothing\n }\n }\n else\n {\n // do nothing\n }\n }\n }", "@Test\n\tpublic void testCrossover() {\n\t\tint pivot = 5;\n\t\tint size = g10.getUnits().size();\n\t\tArrayList<GenomeDouble> expectedWeights1;\n\t\tArrayList<GenomeDouble> expectedWeights2;\n\t\t\n\t\texpectedWeights1 = new ArrayList<GenomeDouble>(g10.getUnits().size());\n\t\texpectedWeights2 = new ArrayList<GenomeDouble>(g10_2.getUnits().size());\n\t\t\n\t\texpectedWeights1.addAll(g10.getUnits().subList(0, pivot));\n\t\texpectedWeights1.addAll(g10_2.getUnits().subList(pivot, size));\n\t\texpectedWeights2.addAll(g10_2.getUnits().subList(0, pivot));\n\t\texpectedWeights2.addAll(g10.getUnits().subList(pivot, size));\n\t\t\n\t\tList<Genome<GenomeDouble>> results = Genome.crossover(g10, g10_2, 0.7, 10);\n\t\tassertEquals(expectedWeights1, results.get(0).getUnits());\n\t\tassertEquals(expectedWeights2, results.get(1).getUnits());\n\t}", "public OnePointCrossoverOne(Population p) {\n\t\tdoCrossover(p);\n\t}", "public static Graph_chromosome generateChild(Graph_chromosome parent1,\r\n\t\t\tGraph_chromosome parent2 )\r\n\t{\r\n\t\tRandom random_generator = new Random();\r\n\t\tint crossover_point = random_generator.nextInt(parent1.chromosome_size);\r\n\t\t\r\n\t\tGraph_chromosome child = new Graph_chromosome(parent1.chromosome_size,parent1.num_colors);\r\n\t\t\r\n\t\tfor(int i=0;i<child.chromosome_size;i++)\r\n\t\t{\r\n\t\t\tif(i<crossover_point)\r\n\t\t\t\tchild.chromosome[i] = parent1.getChromosomeAt(i+1);\r\n\t\t\telse\r\n\t\t\t\tchild.chromosome[i] = parent2.getChromosomeAt(i+1);\r\n\t\t}\r\n\t\treturn child;\r\n\t}", "public static Double[] crossover(Double[] g1, Double[] g2){\n\t\tRandom random = new Random();\n\t\tint start = random.nextInt(variableNum-1);\n\t\tint end = start + 1 + random.nextInt(variableNum-start);\n\t\t//which one is better, why\n//\t\tfor(int i = start; i < end; i++) g1[i] = g2[i] + Math.random()*(g1[i]-g2[i]);\n//\t\tfor(int i = start; i < end; i++) g1[i] = g2[i];\n\t\tfor(int i = start; i < end; i++) {\n\t\t\tg1[i] = g2[i] + (Math.random()*2-1)*(g1[i]-g2[i]);\n\t\t\tif(g1[i] > maxValue) g1[i] = maxValue;\n\t\t\tif(g1[i] < minValue) g1[i] = minValue;\n\t\t}\n\t\treturn Arrays.copyOf(g1, g1.length);\n\t}", "public static Tree reproduce(Tree tree1, Tree tree2){\n Tree tree1Copy = tree1.treeCopy();\n if (tree2 == null) System.out.println(\"know\");\n if (tree1 == null) System.out.println(\"know\");\n Tree tree2Copy = tree2.treeCopy();\n //select tree1 one crossover point\n //select terminal node as crossover with 10 percent probability. o\\w pick function\n \n Node tree1Cross;\n tree1Cross = getCrossType(tree1Copy);\n //select tree2 crossover points\n \n Node tree2Cross;\n tree2Cross = getCrossType(tree2Copy);\n \n tree1Cross.setData(tree2Cross.getData());\n tree1Cross.setLeft(tree2Cross.getLeft());\n tree1Cross.setRight(tree2Cross.getRight());\n return tree1Copy;\n \n \n }", "abstract int[] crossOver();", "public CrossoverOrder() {\n\t\tthis.randomGenerator = new Random(System.currentTimeMillis());\n\t}", "public Dna crossover(Dna partner) {\n int splitPosition = I.random.nextInt(this.length);\n\n // The final len is the segment from this [0..splitPosition] + what is added from partner\n // [splitPosition..partner.length] If partner.length < splitPosition then nothing is added and the final len =\n // the segment from this, which is splitPosition +1 because splitPosition starts from 0\n int child_len = splitPosition >= partner.length - 1 ? splitPosition + 1 : partner.length;\n\n MyString[] gene = new MyString[child_len];\n\n assert(this.length == this.dna.myStr.length) : \"this.len\";\n assert(partner.length == partner.dna.myStr.length) : \"partner.len\";\n for (int i = 0; i < child_len; i++) {\n if (i <= splitPosition)\n gene[i] = new MyString(this.dna.myStr[i].val, true);\n else\n gene[i] = new MyString(partner.dna.myStr[i].val, true);\n }\n return new Dna(new MyInput(gene));\n }", "private Individual[] crossOver(Individual father, Individual mother){\n\t\tIndividual[] children = problem.makeChild(mother, father);\r\n\t\treturn children;\r\n\t}", "public void doMutation(double probability, Solution offsbring) throws JMException {\r\n\t\r\n\t\r\n\t\t \r\n\t\t try {\r\n\t\t \t//System.out.println(offsbring.get);\r\n\t\t int chrmosomesize= offsbring.getCompositionService().size();\r\n\t\t //int random = PseudoRandom.randInt()%chrmosomesize;\r\n\t\t int random = PseudoRandom.randInt()%chrmosomesize;\r\n\t\t if (random<probability){\r\n\t\t \t System.out.println(\" classs \"+offsbring.getCompositionService().get(random).getServiceClass());//getSeviceClass();\r\n\t\t\t \r\n\t\t \t String Sclass=(String) offsbring.getCompositionService().get(random).getServiceClass();//getSeviceClass();\r\n\t\t \r\n\t\t for (int i=0; i<z.ServicePool.size();i++){\r\n\t// if (z.ServicePool.get(i).getServiceFunctionality().equalsIgnoreCase(Sclass))\r\n\t\t \t if (z.ServicePool.get(i).getServiceClass().equalsIgnoreCase(Sclass))\r\n\t\t\tRequiredClass.add(z.ServicePool.get(i));\r\n\t\t }\r\n\t\t // z.ServicePool.get(9).\r\n\t\tint random2 = (PseudoRandom.randInt())%(RequiredClass.size());\r\n\t\toffsbring.getCompositionService().set(random,RequiredClass.get(random2));\r\n\t\t \t\t\r\n\t\t\r\n\t\toffsbring.getCompositionService().set(random,RequiredClass.get(random2));\t\t \t \r\n\t\t \r\n\t\t }\r\n\t\t } catch (ClassCastException e1) {\r\n\t\t Configuration.logger_.severe(\"SinglePointCrossover.doCrossover: Cannot perfom \" +\r\n\t\t \"SinglePointCrossover\");\r\n\t\t Class cls = java.lang.String.class;\r\n\t\t String name = cls.getName();\r\n\t\t throw new JMException(\"Exception in \" + name + \".doCrossover()\");\r\n\t\t }\r\n\t\t \r\n\t\t \r\n\t\t }", "public Individe crossoveri(Individe individe1, Individe individe2) {\n Individe rez = new Individe(pikatEVeturave.length, pikat);\r\n\r\n for (int i = 0; i < pikatEVeturave.length; i++) {\r\n int select = (int) (Math.random() * 2);//zgjedh prej cilit individe mi marr qit veture\r\n if (select == 0) {\r\n rez.pikatEVeturave[i] = (ArrayList<Point>) individe1.pikatEVeturave[i].clone();//clone se dilke ni problem en lidhje me referencat\r\n } else {\r\n rez.pikatEVeturave[i] = (ArrayList<Point>) individe2.pikatEVeturave[i].clone();\r\n }\r\n }\r\n\r\n rez = normalizimi(rez);//duhet mi normalizu individin dmth mi hek pozitat(qytetet) e dyfishta edhe mi shtu pika(qytetet) qe jane mongu\r\n\r\n return rez;\r\n }", "private static Set<Chromosome> crossoverPopulation(ArrayList<Chromosome> population, int populationSize, int crossoverSize) {\n\n // declare a set of chromosomes which will store all thr chromosomes generated by the crossover operation\n Set<Chromosome> crossoverChromosomes = new HashSet<>();\n\n while (crossoverChromosomes.size() < crossoverSize) {\n // retrieve a set of chromosomes (of size 2) on which crossover will occur\n // using the Rank-Based Roulette Wheel Selection method\n Set<Chromosome> selectedChromosomes = rankBasedRouletteWheelSelection(population, populationSize);\n\n // store the 2 Chromosomes in parent 1 and parent 2\n Chromosome parent1 = selectedChromosomes.iterator().next();\n selectedChromosomes.remove(parent1);\n Chromosome parent2 = selectedChromosomes.iterator().next();\n\n // perform crossover using the crossoverChromosomes method\n // the method is called twice, switching the order of the parents for the second time, since SCX produces only\n // one child, however produces a different child when the parents are switched\n crossoverChromosomes.add(crossover(parent1, parent2));\n crossoverChromosomes.add(crossover(parent2, parent1));\n }\n\n return crossoverChromosomes;\n }", "private void cross(String[] pop) {\n\t\tString temp1, temp2;\n\t\tfor (int i = (int) (ChrNum*survial_fraction); i < ChrNum; i+=2) {\n\t\t\tif (Math.random() < 0.60) {\n\t\t\t\tint pos = (int)(Math.random()*GENE)+1; \n\t\t\t\ttemp1 = pop[i].substring(0, pos) + pop[i + 1].substring(pos); \n\t\t\t\ttemp2 = pop[i + 1].substring(0, pos) + pop[i].substring(pos);\n\t\t\t\tpop[i] = temp1;\n\t\t\t\tpop[i + 1] = temp2;\n\t\t\t}\n\t\t}\n\t}", "private static void mating() {\n\t\tint getRand = 0;\n\t\tint parentA = 0;\n\t\tint parentB = 0;\n\t\tint newIndex1 = 0;\n\t\tint newIndex2 = 0;\n\t\tChromosome newChromo1 = null;\n\t\tChromosome newChromo2 = null;\n\n\t\tfor (int i = 0; i < OFFSPRING_PER_GENERATION; i++) {\n\t\t\tparentA = chooseParent();\n\t\t\t// Test probability of mating.\n\t\t\tgetRand = getRandomNumber(0, 100);\n\t\t\tif (getRand <= MATING_PROBABILITY * 100) {\n\t\t\t\tparentB = chooseParent(parentA);\n\t\t\t\tnewChromo1 = new Chromosome();\n\t\t\t\tnewChromo2 = new Chromosome();\n\t\t\t\tpopulation.add(newChromo1);\n\t\t\t\tnewIndex1 = population.indexOf(newChromo1);\n\t\t\t\tpopulation.add(newChromo2);\n\t\t\t\tnewIndex2 = population.indexOf(newChromo2);\n\n\t\t\t\t// Choose either, or both of these:\n\t\t\t\tpartiallyMappedCrossover(parentA, parentB, newIndex1, newIndex2);\n\t\t\t\t// positionBasedCrossover(parentA, parentB, newIndex1, newIndex2);\n\n\t\t\t\tif (childCount - 1 == nextMutation) {\n\t\t\t\t\texchangeMutation(newIndex1, 1);\n\t\t\t\t} else if (childCount == nextMutation) {\n\t\t\t\t\texchangeMutation(newIndex2, 1);\n\t\t\t\t}\n\n\t\t\t\tpopulation.get(newIndex1).computeConflicts();\n\t\t\t\tpopulation.get(newIndex2).computeConflicts();\n\n\t\t\t\tchildCount += 2;\n\n\t\t\t\t// Schedule next mutation.\n\t\t\t\tif (childCount % (int) Math.round(1.0 / MUTATION_RATE) == 0) {\n\t\t\t\t\tnextMutation = childCount + getRandomNumber(0, (int) Math.round(1.0 / MUTATION_RATE));\n\t\t\t\t}\n\t\t\t}\n\t\t} // i\n\t\treturn;\n\t}", "private ArrayList<Chromosome> selectParentsRandom() {\n ArrayList<Chromosome> parents = new ArrayList<Chromosome>(Defines.crossoverParentCt);\n\n for (int i = 0; i < Defines.crossoverParentCt; i++) {\n // Generate random index into chromosomes in range [0..size-1]\n int randomParent = Defines.randNum(0, chromosomes.size() - 1);\n // Remember the new parent\n parents.add(chromosomes.get(randomParent));\n }\n return parents;\n }", "public static void main(String args[]) {\n\t\t\n\t\tint populationSize = 5;\n\t\tint crossCount = (int)(populationSize * 0.9);\n\t\tint mutCount = (int)(populationSize * 0.05);\n\t\tint copyCount = populationSize - crossCount - mutCount;\n\n\t\t//90% through crossover\n\t\tfor(int i = 0; i < crossCount; i++) \n\t\t\tSystem.out.println(\"Cross: \" + i);\n\t\t\n\t\t//5% by copying\n\t\tfor(int i = crossCount; i < crossCount + copyCount; i++) \n\t\t\tSystem.out.println(\"Copy: \" + i);\n\t\t\n\t\t\n\t\t//5% by mutation\n\t\tfor(int i = crossCount + copyCount; i < populationSize; i++) \n\t\t\tSystem.out.println(\"Mut: \" + i);\n\t\t\n\t\tfor(int i = 0; i < 60; i++) {\n\t\t\t\n\t\t\tPoint p1 = new Point((int)(Math.random() * 600) , (int)(Math.random() * 600)); //bot's point\n\t\t\tPoint p2 = new Point((int)(Math.random() * 600) , (int)(Math.random() * 600)); //enemy point\n\t\t\twhile(p2.equals(p1))\n\t\t\t\tp2 = new Point((int)(Math.random() * 600) , (int)(Math.random() * 600));\n\t\t\t\n\t\t\tfloat angle = (float) Math.atan2(p2.y - p1.y, p2.x - p1.x);\n\t\t\tDecimalFormat df = new DecimalFormat(\"0.0000\");\n\t\t\tSystem.out.println(p1.x + \" \" + p1.y + \" \" + p2.x + \" \" + p2.y + \" \" + df.format(angle));\n\t\t\t\n\t\t}\n\t\t\n\t}", "public abstract void crossoverWith(LevelRepresentation levelRepresentation);", "private Evolvable splitCross(Evolvable parent1, Evolvable parent2, int split)\n\t{\n\t\tint[] dnaP1 = ((SNSAgent)parent1).getDna();\n\t\t//dna of second parent\n\t\tint[] dnaP2 = ((SNSAgent)parent2).getDna();\n\t\t\n\t\t//result dna\n\t\tint dnaChild[] = new int[3000];\n\t\t//simple cross\n\t\tfor(int i = 0; i < 3000; i++)\n\t\t{\t\t\n\t\t\tif(i < split)\n\t\t\t\tdnaChild[i] = dnaP1[i];\n\t\t\telse\n\t\t\t\tdnaChild[i] = dnaP2[i];\n\t\t}\n\t\treturn new SNSAgent(dnaChild, ((SNSAgent)parent1).behavior);\n\t\t\n\t}", "@SuppressWarnings({ \"unchecked\", \"deprecation\" })\n\tprivate static NeuralNetwork crossover(NeuralNetwork cross, NeuralNetwork over, Singleton s1) throws IOException, ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException {\n\t\tEvolveSingleton s = (EvolveSingleton) s1;\n\t\t//determines which of the two networks was more fit and less fit\n\t\tClass<? extends NeuralNetwork> networkClass = (Class<? extends NeuralNetwork>) Class.forName(\"BackEvolution.\"+s.getType()+\".\"+s.getType()+\"Network\");\n\t\tClass<? extends Layer> layerClass = (Class<? extends Layer>) Class.forName(\"BackEvolution.\"+s.getType()+\".\"+s.getType()+\"Layer\");\n\t\tClass<? extends Neuron> neuronClass = (Class<? extends Neuron>) Class.forName(\"BackEvolution.\"+s.getType()+\".\"+s.getType()+\"Neuron\");\n\t\tNeuralNetwork newnn = null;\n\t\tNeuralNetwork lessfit = null;\n\t\tNeuralNetwork morefit = null;\n\t\tif (cross.getFitness() > over.getFitness()){\n\t\t\tmorefit = cross;\n\t\t\tlessfit = over;\n\t\t}\n\t\telse{\n\t\t\tmorefit = over;\n\t\t\tlessfit = cross;\n\t\t}\n\t\t//creates the structure for the new network\n\t\tLayer[] puts = NetworkCreator.creator(s);\n\t\tClass<?>[] types2 = {Class.forName(\"BackEvolution.Layer\"),Class.forName(\"BackEvolution.Layer\")};\n\t\tConstructor<? extends NeuralNetwork> con2 = networkClass.getConstructor(types2);\n\t\tClass<? extends SpecialCreator> managerClass = (Class<? extends SpecialCreator>) Class.forName(\"BackEvolution.\"+s.getType()+\".\"+s.getType()+\"Creator\");\n\t\tSpecialCreator manager = managerClass.newInstance();\n\t\tmanager.InputOutputcreator(puts);\n\t\tnewnn = con2.newInstance(puts[0],puts[1]);\n\t\tNetworkCreator.Neuraltracker(newnn);\n\t\t//pretty sure this is obsolete from when i tried to breed different layered networks but not sure if I can delete.\n\t\tArrayList<Layer> lesslayers = lessfit.getLayers();\n\t\tArrayList<Layer> morelayers = morefit.getLayers();\n\t\tint maxlayers = 1;\n\t\tif (lesslayers.size() > morelayers.size()){\n\t\t\tmaxlayers = lesslayers.size();\n\t\t}\n\t\telse { \n\t\t\tmaxlayers = morelayers.size();\n\t\t}\n\t\t//adds the neuron to each layer based on which network had the most neurons in that layer\n\t\tfor (int i = 1; i < maxlayers-1; i++){\n\t\t\tLayer lesslayer = null;\n\t\t\tLayer morelayer = null;\n\t\t\tint lessnum = 0;\n\t\t\tint morenum = 0;\n\t\t\ttry{\n\t\t\tlesslayer = lesslayers.get(i);\n\t\t\tlessnum = lesslayer.getNeurons().size();\n\t\t\t}\n\t\t\tcatch(Exception e){\n\t\t\t\tmorelayer = morelayers.get(i);\n\t\t\t\tmorenum = morelayer.getNeurons().size();\n\t\t\t}\n\t\t\ttry{\n\t\t\tmorelayer = morelayers.get(i);\n\t\t\tmorenum = morelayer.getNeurons().size();\n\t\t\t}\n\t\t\tcatch (Exception e){\n\t\t\t}\n\t\t\tif (morelayer == null) morenum = 0;\n\t\t\telse if (morelayer.isOutput()){\n\t\t\t\tmorenum = 0;\n\t\t\t}\n\t\t\tif (lesslayer == null) lessnum = 0;\n\t\t\telse if (lesslayer.isOutput()){\n\t\t\t\tlessnum = 0;\n\t\t\t}\n\t\t\tClass<?>[] types = {boolean.class,boolean.class};\n\t\t\tConstructor<? extends Layer> con = layerClass.getConstructor(types);\n\t\t\tLayer newl = con.newInstance(false, false);\n\t\t\tnewnn.addLayer(newl);\n\t\t\tnewl.setNumber(newnn.getLayers().size()-1);\n\t\t\tfor (int j = 0; j < morenum || j < lessnum; j++){\n\t\t\t\tNeuron newn = neuronClass.newInstance();\n\t\t\t\tnewl.addNeuron(newn);\n\t\t\t\tnewn.setLayernumber(newl.getNumber());\n\t\t\t\tnewn.setNumber(newl.getNeurons().size()-1);\n\t\t\t}\n\t\t}\n\t\tfor (int i = 1; i <=lesslayers.size(); i++){\n\t\t\tLayer l = lesslayers.get(i-1);\n\t\t\tfor (Neuron n : l.getNeurons()){\n\t\t\t\tn.setLayernumber(i);\n\t\t\t\t\n\t\t\t}\n\t\t\tl.setNumber(i);\n\t\t}\n\t\tfor (int i = 1; i <=morelayers.size(); i++){\n\t\t\tLayer l = lesslayers.get(i-1);\n\t\t\tfor (Neuron n : l.getNeurons()){\n\t\t\t\tn.setLayernumber(i);\n\t\t\t\t\n\t\t\t}\n\t\t\tl.setNumber(i);\t\n\t\t}\n\t\t//adds genes to the structure. if the same conection exists in the more fit network, it gets preference over the less fit network. if one or the other does not have this gene at all it gets added. currently more fit is always selected may add random chance that the less fit networks gene is selected.\n\t\t//gets all the data from the more fit layer.\n\t\tArrayList<double[]> geneIdentities = new ArrayList<double[]>();\n\t\tfor(Layer l : morelayers){\t\t\n\t\t\t\tfor (Neuron n : l.getNeurons()){\n\t\t\t\t\tfor(Gene g : n.getGenes()){\n\t\t\t\t\t\tdouble data[] = new double[5];\n\t\t\t\t\t\tdata[0] = l.getNumber();\n\t\t\t\t\t\tdata[1] = n.getNumber();\n\t\t\t\t\t\tdata[2] = g.getConnection().getNumber();\n\t\t\t\t\t\tif (morelayers.get(g.getConnection().getLayernumber()-1).isOutput()) data[3] = maxlayers;\n\t\t\t\t\t\telse data[3] = g.getConnection().getLayernumber();\n\t\t\t\t\t\tdata[4] = g.getWeight();\n\t\t\t\t\t\tgeneIdentities.add(data);\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t}\t\t\t\n\t\t}\n\t\t//gets all the gene data from the less fit layer.\n\t\tArrayList<double[]> geneIdentities2 = new ArrayList<double[]>();\n\t\tfor(Layer l : lesslayers){\n\t\t\t\tfor (Neuron n : l.getNeurons()){\n\t\t\t\t\tfor(Gene g : n.getGenes()){\n\t\t\t\t\t\tdouble data[] = new double[5];\n\t\t\t\t\t\tdata[0] = l.getNumber();\n\t\t\t\t\t\tdata[1] = n.getNumber();\n\t\t\t\t\t\tdata[2] = g.getConnection().getNumber();\n\t\t\t\t\t\tif (lesslayers.get(g.getConnection().getLayernumber()-1).isOutput()) data[3] = maxlayers;\n\t\t\t\t\t\telse data[3] = g.getConnection().getLayernumber();\n\t\t\t\t\t\tdata[4] = g.getWeight();\n\t\t\t\t\t\tgeneIdentities2.add(data);\n\t\t\t\t\t}\n\t\t\t\t}\t\t\n\t\t}\n\t\t//if two genes connect the same neuron, it averages the weights of them and removes one leaving the other with the average weight\n\t\tfor (double[] nums : geneIdentities){\n\t\t\tfor (int i = 0; i < geneIdentities2.size(); i++){\n\t\t\t\tdouble[] nums2 = geneIdentities2.get(i);\n\t\t\t\tif (nums[0] == nums2[0] && nums[1] == nums2[1] && nums[2] == nums2[2] && nums[3] == nums2[3]){\n\t\t\t\t\tnums[4] = (nums[4] + nums2[4])/2;\n\t\t\t\t\tgeneIdentities2.remove(nums2);\n\t\t\t\t\ti--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//adds the new genes to the new neural network based on the gene data.\n\t\tfor(double[] nums : geneIdentities){\t\t\n\t\t\tGene newGene = new Gene(newnn.getLayers().get((int) nums[3]-1).getNeurons().get((int) nums[2]-1), nums[4]);\n\t\t\tNeuron newNeuron = newnn.getLayers().get((int) (nums[0]-1)).getNeurons().get((int) nums[1]-1);\n\t\t\tnewNeuron.AddGenes(newGene);\n\t\t\tnewGene.setInput(newNeuron);\t\t\t\n\t\t}\n\t\tfor(double[] nums : geneIdentities2){\t\t\t\n\t\t\tGene newGene = new Gene(newnn.getLayers().get((int) nums[3]-1).getNeurons().get((int) nums[2]-1), nums[4]);\n\t\t\tNeuron newNeuron = newnn.getLayers().get((int) (nums[0]-1)).getNeurons().get((int) nums[1]-1);\n\t\t\tnewNeuron.AddGenes(newGene);\n\t\t\tnewGene.setInput(newNeuron);\n\t\t}\n\t\t//returns mutated bred network\n\t\treturn mutate(newnn,s);\n\t}", "public int getCrossoverPoints() {\n\t\treturn 1;\r\n\t}", "private int getCrossoverPoint(int mode) {\n int cPoint = 0;\n\n switch (mode) {\n case Defines.CP_PURE_RANDOM:\n cPoint = Defines.randNum(0, Defines.chromosomeSize - 1);\n break;\n\n case Defines.CP_NO_BOUNDARY:\n do {\n cPoint = Defines.randNum(0, Defines.chromosomeSize - 1);\n } while (cPoint % Defines.GROUP_SIZE == 0 || cPoint % Defines.GROUP_SIZE == 3);\n break;\n }\n\n return cPoint;\n }", "public static void setCrossoverProbability(double value) { crossoverProbability = value; }", "public Population crossoverPopulation(Population population, List<FogDevice> fogDevices, List<? extends Cloudlet> cloudletList) {\n Individual queen = population.getFittest(0);\n // Loop over current population by fitness\n for (int dronesIndex = 1; dronesIndex < (numberDrones + 1); dronesIndex++) {\n Individual husband = population.getFittest(dronesIndex);\n\n // Apply crossover to this individual?\n if (this.crossoverRate > Math.random()) {\n // Initialize offspring\n Individual offspring = new Individual(husband.getChromosomeLength());\n\n offspring = crossover2Point(husband, queen);\n\n if(husband.getFitness() <= calcFitness(offspring, fogDevices, cloudletList)\n && !doesPopupationIncludeIndividual(population, offspring)) {\n population.getPopulation().remove(husband);\n population.getPopulation().add(offspring);\n }\n }\n }\n return population;\n }", "public static double getCrossoverProbability() { return crossoverProbability; }", "public void setCrossoverMethod(Crossover c){\n crossType = c;\n }", "public MidiIndividual crossover(MidiIndividual that)\r\n\t{\n\t\tassert this.size() == that.size();\r\n\r\n\t\tVector<MidiIndividualTrack> newIndividualTracks = \r\n\t\t\tnew Vector<MidiIndividualTrack>();\r\n\r\n\t\tfor (int i = 0; i < midiIndividualTracks.size(); i++)\r\n\t\t{\r\n\t\t\tMidiIndividualTrack newIndv = \r\n\t\t\t\tthis.getIndividualTrack(i).crossover(that.getIndividualTrack(i));\r\n\t\t\tnewIndividualTracks.add(newIndv);\r\n\t\t}\r\n\r\n\t\treturn new MidiIndividual(newIndividualTracks);\r\n\t}", "@Test\r\n\tpublic final void testCross() throws GeneticProgrammingException {\r\n\t\tfinal int[] training = TestHelper.genertateTrainingDataSet(-100, 100);\r\n\t\tfinal double[] targetValues = TestHelper.calculateTargetValues(\r\n\t\t\t\t\"x*2-1/2\", training);\r\n\t\tfinal Node root = new Node(null, \"/\", null, Node.OPERATOR);\r\n\t\tfinal Tree newTree = new Tree(root, new TerminalSet(),\r\n\t\t\t\tnew FunctionalSet());\r\n\t\tfinal Node minusOperator = new Node(root, \"-\", Node.LEFT, Node.OPERATOR);\r\n\t\tnewTree.addNode(minusOperator);\r\n\t\tfinal Node multiOperator = new Node(root, \"*\", Node.RIGHT,\r\n\t\t\t\tNode.OPERATOR);\r\n\t\tnewTree.addNode(multiOperator);\r\n\t\tnewTree.addNode(new Node(minusOperator, \"1\", Node.LEFT, Node.OPERAND));\r\n\t\tnewTree.addNode(new Node(minusOperator, \"3\", Node.RIGHT, Node.OPERAND));\r\n\t\tnewTree.addNode(new Node(multiOperator, \"x\", Node.LEFT, Node.OPERAND));\r\n\t\tnewTree.addNode(new Node(multiOperator, \"5\", Node.RIGHT, Node.OPERAND));\r\n\t\tassertEquals(\"Tree did not get generated corectly\", \"(1-3)/(x*5)\",\r\n\t\t\t\tnewTree.getEquation().toString());\r\n\t\tfinal Node root2 = new Node(null, \"/\", null, Node.OPERATOR);\r\n\t\tfinal Tree newTree2 = new Tree(root2, new TerminalSet(),\r\n\t\t\t\tnew FunctionalSet());\r\n\t\tfinal Node minusOperator2 = new Node(root2, \"-\", Node.LEFT,\r\n\t\t\t\tNode.OPERATOR);\r\n\t\tnewTree2.addNode(minusOperator2);\r\n\t\tfinal Node multiOperator2 = new Node(root2, \"*\", Node.RIGHT,\r\n\t\t\t\tNode.OPERATOR);\r\n\t\tnewTree2.addNode(multiOperator2);\r\n\t\tnewTree2\r\n\t\t\t\t.addNode(new Node(minusOperator2, \"x\", Node.LEFT, Node.OPERAND));\r\n\t\tnewTree2\r\n\t\t\t\t.addNode(new Node(minusOperator2, \"7\", Node.RIGHT, Node.OPERAND));\r\n\t\tnewTree2\r\n\t\t\t\t.addNode(new Node(multiOperator2, \"8\", Node.LEFT, Node.OPERAND));\r\n\t\tnewTree2\r\n\t\t\t\t.addNode(new Node(multiOperator2, \"9\", Node.RIGHT, Node.OPERAND));\r\n\t\tassertEquals(\"Tree did not get generated corectly\", \"(x-7)/(8*9)\",\r\n\t\t\t\tnewTree2.getEquation().toString());\r\n\r\n\t\tfinal Node root3 = new Node(null, \"/\", null, Node.OPERATOR);\r\n\t\tfinal Tree newTree3 = new Tree(root3, new TerminalSet(),\r\n\t\t\t\tnew FunctionalSet());\r\n\t\tfinal Node minusOperator3 = new Node(root3, \"-\", Node.LEFT,\r\n\t\t\t\tNode.OPERATOR);\r\n\t\tnewTree3.addNode(minusOperator3);\r\n\t\tfinal Node multiOperator3 = new Node(root3, \"*\", Node.RIGHT,\r\n\t\t\t\tNode.OPERATOR);\r\n\t\tnewTree3.addNode(multiOperator3);\r\n\t\tfinal Node multiOperator4 = new Node(multiOperator3, \"*\", Node.LEFT,\r\n\t\t\t\tNode.OPERATOR);\r\n\t\tnewTree3.addNode(multiOperator4);\r\n\t\tfinal Node multiOperator5 = new Node(multiOperator3, \"*\", Node.RIGHT,\r\n\t\t\t\tNode.OPERATOR);\r\n\t\tnewTree3.addNode(multiOperator5);\r\n\t\tnewTree3\r\n\t\t\t\t.addNode(new Node(minusOperator3, \"x\", Node.LEFT, Node.OPERAND));\r\n\t\tnewTree3\r\n\t\t\t\t.addNode(new Node(minusOperator3, \"7\", Node.RIGHT, Node.OPERAND));\r\n\t\tnewTree3\r\n\t\t\t\t.addNode(new Node(multiOperator4, \"1\", Node.LEFT, Node.OPERAND));\r\n\t\tnewTree3\r\n\t\t\t\t.addNode(new Node(multiOperator4, \"2\", Node.RIGHT, Node.OPERAND));\r\n\t\tnewTree3\r\n\t\t\t\t.addNode(new Node(multiOperator5, \"3\", Node.LEFT, Node.OPERAND));\r\n\t\tnewTree3\r\n\t\t\t\t.addNode(new Node(multiOperator5, \"4\", Node.RIGHT, Node.OPERAND));\r\n\t\tassertEquals(\"Tree did not get generated corectly\",\r\n\t\t\t\t\"(x-7)/(1*2)*(3*4)\", newTree3.getEquation().toString());\r\n\t\tfinal ArrayList<Tree> newTrees = new ArrayList<Tree>();\r\n\t\tnewTrees.add(newTree3);\r\n\t\tnewTrees.add(newTree2);\r\n\t\tnewTrees.add(newTree);\r\n\t\tassertEquals(\"Tree should have a size of 3 before the cross\", 3,\r\n\t\t\t\tnewTrees.size());\r\n\t\tCrossover.cross(newTrees, 1, 100, training, targetValues);\r\n\t\tfinal Iterator<Tree> iterator = newTrees.iterator();\r\n\t\twhile (iterator.hasNext()) {\r\n\t\t\t// All five trees should be different\r\n\t\t\tfinal String firstTree = iterator.next().toString();\r\n\t\t\tassertNotSame(\"Cross should change the tree but did not 1\",\r\n\t\t\t\t\tfirstTree, iterator.next().toString());\r\n\t\t\tassertNotSame(\"Cross should change the tree but did not 2\",\r\n\t\t\t\t\tfirstTree, iterator.next().toString());\r\n\t\t\tassertNotSame(\"Cross should change the tree but did not 3\",\r\n\t\t\t\t\tfirstTree, iterator.next().toString());\r\n\t\t\tassertNotSame(\"Cross should change the tree but did not 4\",\r\n\t\t\t\t\tfirstTree, iterator.next().toString());\r\n\t\t}\r\n\t\t// should be 5 trees after the crossover\r\n\t\tassertEquals(\"Tree should have a size of 5 but was not\", 5, newTrees\r\n\t\t\t\t.size());\r\n\t}", "private ArrayList<Chromosome> selectParentsRoulette() {\n ArrayList<Chromosome> parents = new ArrayList<Chromosome>(Defines.crossoverParentCt);\n double sumGH = 0.0; // sums GH for all chromosomes in this pop\n Random randgen = new Random(); // random number generator\n for (Chromosome chromo : this.chromosomes) {\n sumGH += chromo.getTotalGH();\n }\n for (int i = 0; i < Defines.crossoverParentCt; i++) {\n double parentRandomizer = randgen.nextDouble() * sumGH; // get random #\n double aggGH = 0.0; // aggregate the GH until we reach our random #\n int chromoIdx = 0; // identifies the chromosome in the pop\n Chromosome parentCandidate;\n do {\n parentCandidate = this.chromosomes.get(chromoIdx++);\n aggGH += parentCandidate.getTotalGH();\n } while (aggGH < parentRandomizer);\n parents.add(parentCandidate);\n }\n return parents;\n }", "public TesteCrossover() {\n initComponents();\n }", "private void rouletteSelection() {\n parentChromosomes = new Chromosome[2];\n parentIndices = new int[2];\n Arrays.fill(parentChromosomes, null);\n parentIndices[0] = getFittestChromosomeIndex();\n parentChromosomes[0] = chromosomes[parentIndices[0]];\n parentIndices[1] = getFittestChromosomeIndex();\n parentChromosomes[1] = chromosomes[parentIndices[1]];\n System.out.println(\"Individuals selected from Roulette Wheel for crossover: \\n\" +\n Arrays.toString(parentChromosomes[0].getGenes()) + \"\\n\" +\n Arrays.toString(parentChromosomes[1].getGenes()));\n }", "public Pair doXover(Object chromosome1, Object chromosome2, HashMap params) throws OptimizerException;", "private double cross(Point A, Point B, Point C) {\n\t\tdouble AB_X = B.x - A.x;\n\t\tdouble AB_Y = B.y - A.y;\n\t\tdouble AC_X = C.x - A.x;\n\t\tdouble AC_Y = C.y - A.y;\n\t\tdouble cross = AB_X * AC_Y - AB_Y * AC_X;\n\t\treturn cross;\n\t}", "void generate() {\n rouletteSelection();\n do {\n updateParents();\n crossover();\n mutation();\n } while (!isValidOffset());\n insertOffspring();\n }", "IVec3 cross(IVec3 v);", "private Pair<Integer, Integer> genRandomSrcDst(){\n int src = (int)(Math.random()*nodesNum);\n int dst = src;\n do {\n dst = (int)(Math.random()*nodesNum);\n }while(dst == src);\n return new Pair<Integer, Integer>(src, dst);\n }", "protected void randomStep() {\n\t\tint n = curNode.getDegree();\n\t\tint r = 0;\n\n\t\tif (n > 0) {\n\t\t\tr = ctx.random().nextInt(n);\n\n\t\t\tAntCo2Edge curEdge = (AntCo2Edge) curNode.getEdge(r);\n\n\t\t\tassert curEdge != null : \"found no edge\";\n\n\t\t\tcross(curEdge, true);\n\t\t}\n\t}", "public void generateOffspringPopulation() throws JMException{\n\n offspringPopulation_ = new SolutionSet[problemSet_.size()];\n\n for (int task = 0; task < problemSet_.size(); task++){\n offspringPopulation_[task] = new SolutionSet(populationSize_);\n if (crossover_.getClass() == SBXCrossover.class){\n Solution[] parents = new Solution[2];\n for (int i = 0; i < (populationSize_); i++) {\n // obtain parents\n parents = (Solution[]) selection_.execute(population_[task]);\n\n Solution[] offSpring = (Solution[]) crossover_\n .execute(parents);\n mutation_.execute(offSpring[0]);\n problemSet_.get(task).evaluate(offSpring[0]);\n problemSet_.get(task).evaluateConstraints(offSpring[0]);\n offspringPopulation_[task].add(offSpring[0]);\n } // for\n }\n else if (crossover_.getClass() == EGG.class){\n\n int[] permutation = new int[populationSize_];\n Utils.randomPermutation(permutation, populationSize_);\n etmo.util.Ranking ranking = new etmo.util.Ranking(population_[task]);\n SolutionSet front = ranking.getSubfront(0);\n\n front.Suppress();\n SolutionSet KP = null;\n if(front.size()> problemSet_.get(task).getNumberOfObjectives())\n KP = findingKneePoint(front, task);\n if(KP == null){\n KP = population_[task];\n }\n\n for (int i = 0; i < (populationSize_); i++) {\n // obtain parents\n int n = permutation[i];\n // STEP 2.1. Mating selection\n int r1,r2;\n r1 = PseudoRandom.randInt(0, KP.size() - 1);\n do {\n r2 = PseudoRandom.randInt(0, KP.size() - 1);\n } while (r2==r1);\n // STEP 2.2. Reproduction\n Solution child;\n Solution[] parents = new Solution[3];\n\n// 加入迁移:\n double tranRand = PseudoRandom.randDouble();\n if (tranRand <= 0.1){\n parents[1] = population_[PseudoRandom.randInt(0, problemSet_.size() - 1)].get(PseudoRandom.randInt(0, populationSize_ - 1));\n parents[2] = population_[PseudoRandom.randInt(0, problemSet_.size() - 1)].get(PseudoRandom.randInt(0, populationSize_ - 1));\n parents[0] = population_[task].get(n);\n child = (Solution) crossover_.execute(parents);\n\n mutation_.execute(child);\n\n problemSet_.get(task).evaluate(child);\n problemSet_.get(task).evaluateConstraints(child);\n offspringPopulation_[task].add(child);\n }\n\n\n\n else {\n parents[1] = KP.get(r1);\n parents[2] = KP.get(r2);\n parents[0] = population_[task].get(n);\n child = (Solution) crossover_.execute(parents);\n\n mutation_.execute(child);\n\n problemSet_.get(task).evaluate(child);\n problemSet_.get(task).evaluateConstraints(child);\n offspringPopulation_[task].add(child);\n }\n\n\n } // for\n }\n\n }\n\n\n\n\n }", "private <T> List<Chromosome<T>> breedNewGeneration(List<Chromosome<T>> chromosomes){\n\t\tList<Chromosome<T>> selected = selection.apply(chromosomes);\n\t\tCollections.shuffle(selected);\n\n\t\tList<Chromosome<T>> crossedOver = Lists.newArrayList();\n\t\tfor(int i = 0; i < selected.size(); i+=2){\n\t\t\tChromosome<T>[] bred = crossover.apply(selected.get(i), selected.get(i+1));\n\t\t\tcrossedOver.add(bred[0]);\n\t\t\tcrossedOver.add(bred[1]);\n\t\t}\n\n\t\treturn crossedOver.stream().map(mutation::apply).collect(Collectors.toList());\n\t}", "public static void cross(LogicProblem logicProblem, boolean applyChanges) \r\n throws RelationshipConflictException {\r\n// System.out.println(\"cross invoked\");\r\n HashMap<ItemPair,Relationship> relationshipTable = logicProblem.getRelationshipTable();\r\n\r\n HashSet<CategoryPair> categoryPairs = logicProblem.getCategoryPairs();\r\n \r\n for (CategoryPair categoryPair : categoryPairs) {\r\n //for (Category cat1 : logicProblem.getCategories()){\r\n // for (Category cat2 : logicProblem.getCategories()){\r\n // if (cat1!=cat2) {\r\n Category cat1 = categoryPair.first();\r\n Category cat2 = categoryPair.last();\r\n\r\n \r\n //for (Category cat1 : logicProblem.getCategories()){\r\n // for (Category cat2 : logicProblem.getCategories()){\r\n // if (cat1!=cat2) {\r\n for (Item item1 : cat1.getItems()){\r\n for (Item item2 : cat2.getItems()){\r\n Relationship sourceRelationship = relationshipTable.get(new ItemPair(item1,item2));\r\n if (sourceRelationship.getValue()==Relationship.ValueType.VALUE_YES) {\r\n// System.out.println(\"discovered VALUE_YES, setting up the cross\");\r\n for (Item itemA : cat1.getItems()){\r\n if (itemA != item1) {\r\n Relationship rel = relationshipTable.get(new ItemPair(itemA,item2));\r\n // could track superfluous and conflicts here\r\n if (rel.getValue() == Relationship.ValueType.VALUE_UNKNOWN) {\r\n Processor.setRelationship(logicProblem, applyChanges, rel, \r\n Relationship.ValueType.VALUE_NO,\r\n Relationship.LogicType.CROSS, sourceRelationship);\r\n// rel.setValue(Relationship.ValueType.VALUE_NO,Relationship.LogicType.CROSS,sourceRelationship);\r\n// System.out.println(\"created VALUE_NO relationship between \"+itemA.getName()+\" and \"+item2.getName()+ \" (CROSS)\");\r\n }\r\n }\r\n }\r\n for (Item itemB : cat2.getItems()){\r\n if (itemB != item2) {\r\n Relationship rel = relationshipTable.get(new ItemPair(item1,itemB));\r\n // could track superfluous and conflicts here\r\n if (rel.getValue() == Relationship.ValueType.VALUE_UNKNOWN) {\r\n Processor.setRelationship(logicProblem, applyChanges, rel, \r\n Relationship.ValueType.VALUE_NO,\r\n Relationship.LogicType.CROSS, sourceRelationship);\r\n// rel.setValue(Relationship.ValueType.VALUE_NO,Relationship.LogicType.CROSS,sourceRelationship);\r\n// System.out.println(\"created VALUE_NO relationship between \"+item1.getName()+\" and \"+itemB.getName()+ \" (CROSS)\");\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }", "public static Data crossover(Data d1, Data d2, int x) {\n try {\n if (d1.numberOfBytes() != d2.numberOfBytes())\n throw new Exception(\"Data crossover is impossible between two Data objects having different byte length\");\n if (x < 0 || x > d1.numberOfBits())\n throw new Exception(\"Pivot point in crossover is out of bounds (0<=\" + x + \"<\" + d1.numberOfBits() + \")\");\n } catch (Exception e) {\n e.printStackTrace();\n System.exit(1);\n }\n\n int bitx = x % 8;\n int bytex = x / 8;\n int n = d1.numberOfBytes();\n int m = d1.numberOfBits();\n\n ArrayList<Object> bytelist = new ArrayList<Object>(n);\n for (int i = 0; i < bytex; i++) bytelist.add(d1.getByte(i));\n int b1 = 0;\n for (int k = 0; k < bitx; k++) b1 = b1 + (1 << (7 - k));\n int b2 = 0;\n for (int k = bitx; k < 8; k++) b2 = b2 + (1 << (7 - k));\n int middle = (b1 & d1.getByte(bytex)) + (b2 & d2.getByte(bytex));\n byte bmiddle = (byte) middle;\n bytelist.add(bmiddle);\n for (int i = bytex + 1; i < n; i++) bytelist.add(d2.getByte(i));\n\n return new Data(bytelist);\n }", "public void crossEdge(Edge e) {}", "private Vector step(){\n// System.out.println();\n// System.out.println(generationCount);\n// System.out.println(\"The Population is:\");\n// System.out.println(population);\n \n //DETERMINE WHO SURVIVES INTO NEXT GENERATION\n Vector nextGeneration = surviveType.run(population, fitnessArray);\n\n //DO THE CROSSOVER PROCESS\n //WHILE THE NEXT GENERATION ISN'T FULL\n while (nextGeneration.size() < (populationSize - randGenes)){\n //FIND PARENTS\n Gene parentOne, parentTwo;\n do {\n Gene[] parents = selectType.run(population, fitnessArray);\n parentOne = parents[0];\n parentTwo = parents[1];\n } while (selectPairs && (! closeEnough(parentOne, parentTwo)));\n //ADD CHILDREN\n Gene[] kids = crossType.children(parentOne, parentTwo);\n\n nextGeneration.add(kids[0]);\n if (nextGeneration.size() < (populationSize - randGenes)){\n nextGeneration.add(kids[1]);\n }\n }\n //ADD RANDOM GENES TO THE POPULATION\n while (nextGeneration.size() < populationSize){\n nextGeneration.add(initializer.createRandomGene(fitnessFunction, minRadius, maxRadius));\n }\n //MUTATE THE NEXT GENERATION\n for (int j = 0; j < populationSize; j++){\n if (Math.random() < mutationProb){\n nextGeneration.set(j, mutationType.run((Gene) nextGeneration.get(j)));\n }\n }\n\n //COMPUTE FITNESSES AND RELOCATE IF NECESSARY\n Gene bestGene = (Gene) nextGeneration.get(0);\n int bestX = 0;\n for (int x = 0; x < populationSize; x++){\n Gene next = (Gene) nextGeneration.get(x);\n while (relocationType.move(bannedList, next)){\n Gene newGene = initializer.createRandomGene(fitnessFunction, minRadius, maxRadius);\n next = newGene;\n nextGeneration.set(x, next);\n }\n fitnessArray[x] = next.getFitness();\n\n //FOR THE PURPOSES OF UPDATING THE BANNED LIST\n if (next.getFitness() > bestGene.getFitness()){\n bestGene = next;\n bestX = x;\n }\n } //End for (int x = 0;...\n\n Arrays.sort(fitnessArray);\n\n //UPDATE THE BANNED LIST BY ADDING THE BEST GENE IN THE NEXT GENERATION IF IT'S ABOVE minAccepted AND CONTAINS MORE THAN minPoints POINTS\n if (useList){\n if ((generationCount >= firstAdd) &&\n (solutionCounter >= countNum) &&\n (bestGene.getFitness() >= minAccepted) &&\n (bestGene.getCount() >= minPoints)){\n solutionCounter = 0;\n// System.out.println(bestGene);\n Gene bestClone = new Gene (bestGene.getMajorAxisRadius(), //THIS KLUDGE IS DONE B/C .clone() IS\n bestGene.getMinorAxisRadius(), //PROTECTED, AND I CAN'T UNPROTECT IT.\n bestGene.getX(), //I USE A CLONED GENE TO PREVENT A MUTATION\n bestGene.getY(), //IN THE NEXT GENERATION FROM ALTERING bannedList\n bestGene.getOrientation(),\n bestGene.getFunction());\n bannedList = relocationType.updateBannedList(bannedList, bestClone);\n\n\n //IF NECESSARY, UPDATE THE SOLUTION LIST BY ADDING ALL CLUSTERS WITH MORE THAN minPoints POINTS AND A FITNESS OF AT LEAST minAccepted\n if (returnAllSolutions){\n for (int i = 0; i < populationSize; i++){\n Gene next = (Gene) nextGeneration.get(i);\n if ((next.getFitness() >= minAccepted) && (next.getCount() >= minPoints)){\n solutionList.add(next);\n }\n }//End for (int i = 0...\n } else {\n solutionList = bannedList;\n } //End if (returnAllSolutions){...}else{\n } //End if (generationCount > 4...\n } //End if (useList){\n\n generationCount = generationCount + 1;\n solutionCounter = solutionCounter + 1;\n\n //IF AVOIDING CONVERGENCE, AND IT HAS CONVERGED, START OVER WITH RANDOM GENES\n\n double bestFitness = bestGene.getFitness();\n double medianFitness = roundToHundredths((double) fitnessArray[(int) Math.floor(populationSize / 2)]);\n\n// System.out.println(bestFitness);\n// System.out.println(medianFitness);\n\n if ((antiConvergence) &&\n ((bestFitness - medianFitness) < (0.01 * bestFitness)) &&\n (generationCount > firstAdd)){\n nextGeneration = initializer.getGenes(populationSize, fitnessFunction, minRadius, maxRadius);\n// System.out.println(\"EXPLODED CONVERGENCE!\");\n for (int x = 0; x < populationSize; x++){\n Gene next = (Gene) nextGeneration.get(x);\n fitnessArray[x] = next.getFitness();\n }\n Arrays.sort(fitnessArray);\n }\n\n return nextGeneration;\n }", "public EdgeCrosser(S2Point a, S2Point b) {\n init(a, b);\n }", "public interface MonogamousCrossover {\r\n\r\n\tpublic Embryo mate(Individual mother, Individual father);\r\n}", "private void tournament_selection() {\r\n\r\n individual[] temp_pop = new individual[this.pop_size];\r\n\r\n for (int i = 0; i < this.pop_size; i++) {\r\n\r\n // pick 2 random ints to for indices of parents\r\n int parent1 = new Random().nextInt(this.pop_size);\r\n int parent2 = new Random().nextInt(this.pop_size);\r\n\r\n individual p1 = new individual(main_population.getPopulation()[parent1].getGenes(), solutions, output);\r\n individual p2 = new individual(main_population.getPopulation()[parent2].getGenes(), solutions, output);\r\n\r\n if (p1.getFitness() >= p2.getFitness()) {\r\n temp_pop[i] = p1;\r\n } else {\r\n temp_pop[i] = p2;\r\n }\r\n }\r\n this.main_population.setPopulation(temp_pop);\r\n this.main_population.update_population();\r\n }", "public EdgeCrosser(S2Point a, S2Point b, S2Point c) {\n this(a, b);\n restartAt(c);\n }", "@Override\n\t// Select individuals for crossover\n\tprotected Individual tournamentSelection(Population pop) {\n\t\tSortingIndividual baseIndiv = (SortingIndividual) pop.individuals[0];\n\t\tPopulation tournament = new SortingPopulation(tournamentSize, baseIndiv.getBase(), false);\n\t\t// For each place in the tournament get a random individual\n\t\tfor (int i = 0; i < tournamentSize; i++) {\n\t\t\tint randomId = (int) (Math.random() * pop.size());\n\t\t\ttournament.saveIndividual(i, pop.getIndividual(randomId));\n\t\t}\n\t\t// Get the fittest\n\t\tIndividual fittest = tournament.getFittest();\n\t\treturn fittest;\n\t}", "public void croisements(double probability) {\n\t\tRandom rand = new Random();\n\t\tint nbCroisements = rand.nextInt(10);\n\t\tfor (int i = 0; i < nbCroisements; i++) {\n\t\t\tint index1 = 0, index2 = 0;\n\t\t\twhile(index1 == index2) {\n\t\t\t\tindex1 = rand.nextInt(this.individus.size());\n\t\t\t\tindex2 = rand.nextInt(this.individus.size());\n\t\t\t}\n\t\t\tif(rand.nextDouble() <= probability) {\n\t\t\t\tthis.individus.get(index1).cross(this.individus.get(index2));\n\t\t\t}\n\t\t}\n\t}", "public Point3D cross(Point3D p) {\n\t\treturn new Point3D(\n\t\t\t\tthis.y*p.z - this.z*p.y, \n\t\t\t\tthis.z*p.x - this.x*p.z, \n\t\t\t\tthis.x*p.y - this.y*p.x);\n\t}", "public void touchToScatter() {\n for (int i = 0; i < pointCount; i++) {\n int speedX = random.nextInt(2 * speedXBarrier) - speedXBarrier;\n int speedY = random.nextInt(2 * speedYBarrier) - speedYBarrier;\n points.get(i).setSpeedX(speedX);\n points.get(i).setSpeedY(speedY);\n }\n }", "private void crossProduct() {\n BaseCandidateElement[] it = o.inputObject.firstStageCandidates.values().toArray(new BaseCandidateElement[0]);\n // logger.info(Arrays.toString(it));\n for (int i = 0; i < it.length; i++) {\n for (int j = i + 1; j < it.length; j++) {\n if (PrecisConfigProperties.HIERARCHY_DIMS_ENABLED && hierarchyDimsNegation.checkIfBelongToSameHierarchyGroup(it[i], it[j]))\n continue;\n if (it[i].xor(it[j]).cardinality() == 4) {\n BitSet b = it[i].or(it[j]);\n o.inputObject.addCandidate(b);\n }\n }\n }\n }", "static double cross(Vec a, Vec b) {\n return a.x * b.y - a.y * b.x;\n }", "public void crossInto(final WB_Point3d p, final WB_Normal3d result) {\r\n\t\tresult.x = y * p.z - z * p.y;\r\n\t\tresult.y = z * p.x - x * p.z;\r\n\t\tresult.z = x * p.y - y * p.x;\r\n\t}", "public Cop generateCop(){\r\n\r\n\t\t\tPatch currentPatch = randPatch();\r\n\r\n\t\t\tCop cop= new Cop(currentPatch);\r\n\r\n\t\t\tcurrentPatch.setPerson(cop);\r\n\r\n\t\t\treturn cop;\r\n\t\t}", "default void process_crosslinks(MutableBeaconState state) {\n state.getPreviousCrosslinks().replaceAll(state.getCurrentCrosslinks().listCopy());\n\n for (EpochNumber epoch : get_previous_epoch(state).iterateTo(get_current_epoch(state).increment())) {\n for (UInt64 offset : UInt64s.iterate(UInt64.ZERO, get_epoch_committee_count(state, epoch))) {\n ShardNumber shard = get_epoch_start_shard(state, epoch)\n .plusModulo(offset, getConstants().getShardCount());\n List<ValidatorIndex> crosslink_committee = get_crosslink_committee(state, epoch, shard);\n Pair<Crosslink, List<ValidatorIndex>> winner =\n get_winning_crosslink_and_attesting_indices(state, epoch, shard);\n Crosslink winning_crosslink = winner.getValue0();\n List<ValidatorIndex> attesting_indices = winner.getValue1();\n if (get_total_balance(state, attesting_indices).times(3)\n .greaterEqual(get_total_balance(state, crosslink_committee).times(2))) {\n state.getCurrentCrosslinks().set(shard, winning_crosslink);\n }\n };\n }\n }", "private void generateSquarePartners() {\r\n\t\t// 2 copies of each end point,\r\n\t\t// which will be \"shifted\" to simulate the 2 adjacent squares\r\n\t\tint[] point1Shift1 = Arrays.copyOf(point1, 2);\r\n\t\tint[] point1Shift2 = Arrays.copyOf(point1, 2);\r\n\t\tint[] point2Shift1 = Arrays.copyOf(point2, 2);\r\n\t\tint[] point2Shift2 = Arrays.copyOf(point2, 2);\r\n\t\t\r\n\t\t// used to indicate the orientation of the Line and which axis needs to be shifted\r\n\t\t// 0 == vertical, 1 == horizontal\r\n\t\tint index;\r\n\t\t\r\n\t\tif (point1[0] == point2[0]) {\r\n\t\t\tindex = 0;\r\n\t\t} else {\r\n\t\t\tindex = 1;\r\n\t\t}\r\n\t\t\r\n\t\tif (point1[index] - 1 > 0) {\r\n\t\t\t// square1Partners form the square to the left or above *this* Line\r\n\t\t\t// so shifted points get decremented\r\n\t\t\tpoint1Shift1[index] = point1[index] - 1;\r\n\t\t\tpoint2Shift1[index] = point2[index] - 1;\r\n\t\t\t\r\n\t\t\tsquare1Partners.add(new Line(point1, point1Shift1));\r\n\t\t\tsquare1Partners.add(new Line(point1Shift1, point2Shift1));\r\n\t\t\tsquare1Partners.add(new Line(point2Shift1, point2));\r\n\t\t}\r\n\t\tif (point1[index] + 1 < boardSize) {\r\n\t\t\t// square2Partners form the square to the right or below *this* Line\r\n\t\t\t// so shifted points get incremented\r\n\t\t\tpoint1Shift2[index] = point1[index] + 1;\r\n\t\t\tpoint2Shift2[index] = point2[index] + 1;\r\n\t\t\t\r\n\t\t\tsquare2Partners.add(new Line(point1, point1Shift2));\r\n\t\t\tsquare2Partners.add(new Line(point1Shift2, point2Shift2));\r\n\t\t\tsquare2Partners.add(new Line(point2Shift2, point2));\r\n\t\t}\r\n\t}", "public static void createMazeMinus(DrawMaze maze) {\n Set<Point> loose = new HashSet<Point>();\n Set<Point> source = new HashSet<Point>();\n \n maze.getLoosePoints(loose);\n maze.getSourcePoints(source);\n\n //Repeat until the loose collection is empty.\n while (!loose.isEmpty()) {\n //point randomly selected from the source collection\n //checked for adjacent points that are not connected\n \tint size = source.size();\n \tint item = new Random().nextInt(size);\n \tint i = 0;\n \tPoint currentSourcePoint = null;\n \tfor(Point p : source) {\n \t if (i == item)\n \t currentSourcePoint = p;\n \t i = i + 1;\n \t}\n \t\n \tArrayList<Point> toChoose =\n \t\t\tmaze.getAdjacentLoosePoints(currentSourcePoint, loose);\n \t\n //If there is exactly one loose adjacent point,\n \t//the wall between the source point and the loose point is added to the maze\n \t//source point can be removed from the source collection\n \tif (toChoose.size() == 1) {\n \t\t\n \t\tPoint drawTo = toChoose.get(0);\n \t\tmaze.connectWall(currentSourcePoint, drawTo);\n \t\tloose.remove(drawTo);\n \t\tsource.remove(currentSourcePoint);\n \t\tsource.add(drawTo);\n \t\n //else If there are more than one loose points adjacent to the source point,\n \t//randomly select a direction for the wall, from the possibilities,\n \t//and add that wall to the maze. In this case, do not remove the\n \t//source point from the source collection.\n \t} else if (toChoose.size() > 1) {\n \n \t\tint rand = (int) (Math.random() * (toChoose.size() - 1)) / 1;\n \t\tPoint drawTo = toChoose.get(rand);\n maze.connectWall(currentSourcePoint, drawTo);\n loose.remove(drawTo);\n source.add(drawTo);\n \t}\n }\n }", "public void\n\tcrossProduct( Vector3 other )\n\t{\n\t\tdouble x;\n\t\tdouble y;\n\n\t\tx = ( data[1] * other.data[2] ) - ( data[2] * other.data[1] );\n\t\ty = ( data[2] * other.data[0] ) - ( data[0] * other.data[2] );\n\t\tdata[2] = ( data[0] * other.data[1] ) - ( data[1] * other.data[0] );\n\t\tdata[0] = x;\n\t\tdata[1] = y;\n\t}", "private ArrayList<Chromosome> selectParentsTournament() {\n ArrayList<Chromosome> parents = new ArrayList<Chromosome>(Defines.crossoverParentCt);\n ArrayList<Chromosome> matingPool = new ArrayList<Chromosome>(Defines.crossoverParentCt);\n\n // Run tournaments to select parents - for each parent\n for (int parentIdx = 0; parentIdx < Defines.crossoverParentCt; parentIdx++) {\n\n // Run tournaments - get random contestants (run.getPaTournamentSize())\n for (int tournIdx = 0; tournIdx < Defines.tournamentSize; tournIdx++) {\n int contestantID = Defines.randNum(0, this.chromosomes.size() - 1);\n matingPool.add(this.chromosomes.get(contestantID));\n }\n Collections.sort(matingPool);\n parents.add(matingPool.get(0));\n }\n\n return parents;\n }", "private static double crossProduct(Point2D a, Point2D b) {\r\n return a.getX() * b.getY() - b.getX() * a.getY();\r\n }", "public RandomAssortment getRandomAssortment(CrossoverEvents crossoverEvents)\n\t{\n\t\tHashMap<Chromosome,Boolean> randAssort=new HashMap<Chromosome,Boolean>();\n\t\tfor(ArrayList<Chromosome> chromlist:chroms)\n\t\t{\n\t\t\t// Assign a random haplotype to the first chromosome in the list\n\t\t\tassert(chromlist.size()>0);\n\t\t\tboolean randGenotype= MimicrEERandom.getDouble()<0.5?true:false;\n\t\t\tChromosome c=chromlist.get(0);\n\t\t\trandAssort.put(c, randGenotype);\n\t\t\t\n\t\t\t// if there are more than one chromosome in the list the haplotype of the current chromosomes (i for i>0) is determined by the \n\t\t\t// crossover events of the previous chromosome (i-1)\n\t\t\tif(chromlist.size()>1)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tfor(int i=1; i<chromlist.size(); i++)\n\t\t\t\t{\n\t\t\t\t\tChromosome activeChr=chromlist.get(i);\n\t\t\t\t\tChromosome prevChr=chromlist.get(i-1);\n\t\t\t\t\tboolean prevHaplo=randAssort.get(prevChr);\n\t\t\t\t\tboolean activeHaplo=recombineWithinChromosome(crossoverEvents,prevChr,prevHaplo);\n\t\t\t\t\trandAssort.put(activeChr, activeHaplo);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn new RandomAssortment(randAssort);\n\t}", "private void phaseTwo(){\r\n\r\n\t\tCollections.shuffle(allNodes, random);\r\n\t\tList<Pair<Node, Node>> pairs = new ArrayList<Pair<Node, Node>>();\r\n\t\t\r\n\t\t//For each node in allNode, get all relationshpis and iterate through each relationship.\r\n\t\tfor (Node n1 : allNodes){\r\n\r\n\t\t\ttry (Transaction tx = graphDb.beginTx()){\r\n\t\t\t\t//If a node n1 is related to any other node in allNodes, add those relationships to rels.\r\n\t\t\t\t//Avoid duplication, and self loops.\r\n\t\t\t\tIterable<Relationship> ite = n1.getRelationships(Direction.BOTH);\t\t\t\t\r\n\r\n\t\t\t\tfor (Relationship rel : ite){\r\n\t\t\t\t\tNode n2 = rel.getOtherNode(n1);\t//Get the other node\r\n\t\t\t\t\tif (allNodes.contains(n2) && !n1.equals(n2)){\t\t\t\t\t//If n2 is part of allNodes and n1 != n2\r\n\t\t\t\t\t\tif (!rels.contains(rel)){\t\t\t\t\t\t\t\t\t//If the relationship is not already part of rels\r\n\t\t\t\t\t\t\tPair<Node, Node> pA = new Pair<Node, Node>(n1, n2);\r\n\t\t\t\t\t\t\tPair<Node, Node> pB = new Pair<Node, Node>(n2, n1);\r\n\r\n\t\t\t\t\t\t\tif (!pairs.contains(pA)){\r\n\t\t\t\t\t\t\t\trels.add(rel);\t\t\t\t\t\t\t\t\t\t\t//Add the relationship to the lists.\r\n\t\t\t\t\t\t\t\tpairs.add(pA);\r\n\t\t\t\t\t\t\t\tpairs.add(pB);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\ttx.success();\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn;\r\n\t}", "public boolean cross(Edge edge) {\n Vector3f P1 = this.getOrigin(), P2 = edge.getOrigin();\n Vector3f u = this.getDirection();\n Vector3f v = edge.getDirection();\n float t2 = (u.x * (P2.y - P1.y) - u.y * (P2.x - P1.x)) / (u.y * v.x - u.x * v.y);\n float t1 = (P2.x - P1.x + v.x * t2) / u.x;\n Vector3f p1 = P1.add(u.mult(t1));\n Vector3f p2 = P2.add(v.mult(t2));\n\n if (p1.distance(p2) <= FastMath.FLT_EPSILON) {\n // the lines cross, check if p1 and p2 are within the edges\n Vector3f p = p1.subtract(P1);\n float cos = p.dot(u) / (p.length() * u.length());\n if (cos > 0 && p.length() <= u.length()) {\n // p1 is inside the first edge, lets check the other edge now\n p = p2.subtract(P2);\n cos = p.dot(v) / (p.length() * v.length());\n return cos > 0 && p.length() <= u.length();\n }\n }\n return false;\n }", "private void sampleEdge() {\n int rand = RandomUtil.getInstance().nextInt(\n getNumNodes() * (getNumNodes() - 1));\n randomParent = rand / (getNumNodes() - 1);\n int rest = rand - randomParent * (getNumNodes() - 1);\n if (rest >= randomParent) {\n randomChild = rest + 1;\n }\n else {\n randomChild = rest;\n }\n }", "public SoPickedPoint \ncopy() \n//\n////////////////////////////////////////////////////////////////////////\n{\n SoPickedPoint newCopy = new SoPickedPoint(this);\n return newCopy;\n}", "public interface ISpecimenCrossover {\n\n StrategySpecimen doCrossover(StrategySpecimen specimen1, StrategySpecimen specimen2);\n}", "public void toss()\n {\n rand = new Random();//create an object\n num = rand.nextInt(2);//randomly generate two numbers\n if(num == 0)\n sideUp = \"heads\";\n else\n sideUp = \"tails\";//decide what up side is\n }", "protected DNA NEATcross(DNA other) {\n\t\tDNA hifit;\n\t\tDNA lofit;\n\n\t\tif (this.fitness == null || other.fitness == null)\n\t\t\treturn null;\n\n\t\tDNA ret = new DNA(population, false);\n\n\t\t// Choose the genome with the higher fitness\n\t\tif (this.fitness > other.fitness) {\n\t\t\thifit = this;\n\t\t\tlofit = other;\n\t\t} else {\n\t\t\thifit = this;\n\t\t\tlofit = other;\n\t\t}\n\n\t\t// Populate gene list of ret\n\t\tfor (Integer i : hifit.getInnovations()) {\n\t\t\tGene submission;\n\t\t\tif (!lofit.hasGene(i)) {\n\t\t\t\tsubmission = hifit.getGene(i);\n\t\t\t} else {\n\t\t\t\tGene newgene;\n\t\t\t\tif (Braincraft\n\t\t\t\t\t\t.randomChance(population.inheritFromHigherFitRate))\n\t\t\t\t\tnewgene = new Gene(hifit.getGene(i));\n\t\t\t\telse\n\t\t\t\t\tnewgene = new Gene(lofit.getGene(i));\n\t\t\t\tif (!hifit.getGene(i).enabled || !lofit.getGene(i).enabled) {\n\t\t\t\t\tif (Braincraft.randomChance(population.disabledRate))\n\t\t\t\t\t\tnewgene.enabled = false;\n\t\t\t\t\telse\n\t\t\t\t\t\tnewgene.enabled = true;\n\t\t\t\t}\n\t\t\t\tsubmission = newgene;\n\t\t\t}\n\t\t\tif (!ret.hasNode(submission.start)) {\n\t\t\t\tret.submitNewNode(hifit.getNode(submission.start));\n\t\t\t}\n\t\t\tif (!ret.hasNode(submission.end)) {\n\t\t\t\tret.submitNewNode(hifit.getNode(submission.end));\n\t\t\t}\n\t\t\tret.submitNewGene(submission);\n\t\t}\n\n\t\tif (Braincraft.randomChance(population.weightMutationRate))\n\t\t\tret.mutateWeights();\n\t\tif (Braincraft.randomChance(population.linkMutationRate))\n\t\t\tret.mutateAddLink();\n\t\tif (Braincraft.randomChance(population.nodeMutationRate))\n\t\t\tret.mutateAddNode();\n\t\tif (Braincraft.randomChance(population.linkDisableRate))\n\t\t\tret.mutateDisableLink();\n\n\t\treturn ret;\n\t}", "private void establishPairings() {\n int splineIdx = 0;\n double splineDist = 0.0;\n double seqDist = 0.0;\n Pt pt;\n Pt prevSeq = sequence.get(0);\n Pt prevSpline;\n for (int seqIdx=0; seqIdx < sequence.size(); seqIdx++) {\n\n // part 1: get pt and seqDist set up correctly\n pt = sequence.get(seqIdx);\n seqDist += prevSeq.distance(pt);\n prevSeq = pt;\n\n // part 2: find index of spline point that is just past where we\n // want to be, then find the interpolated point between our\n // known point and that spline point. Set the \"tween\" attribute\n // of the sequence point.\n double additionalDist = 0.0;\n prevSpline = spline.get(splineIdx);\n Pt spt;\n for (int sidx = splineIdx; sidx < spline.size(); sidx++) {\n\tspt = spline.get(sidx);\n\tadditionalDist = spt.distance(prevSpline);\n\tif (additionalDist + splineDist >= seqDist) {\n\t // the target point is between splineIdx and sidx\n\t Pt target = Functions.getPointAtDistance(spline, splineIdx, splineDist, 1, seqDist);\n\t pt.setAttribute(\"tween\", target);\n\t break;\n\t} else if (sidx >= (spline.size() -1)) {\n\t pt.setAttribute(\"tween\", spline.getLast());\n\t}\n\tprevSpline = spt;\n\tsplineIdx = sidx;\n\tsplineDist += additionalDist;\n }\n }\n }", "Point getRandomPoint() {\n\t\t\t\t\tdouble val = Math.random() * 3;\n\t\t\t\t\tif (val >=0.0 && val <1.0)\n\t\t\t\t\t\treturn p1;\n\t\t\t\t\telse if (val >=1.0 && val <2.0)\n\t\t\t\t\t\t\treturn p2;\n\t\t\t\t\telse\n\t\t\t\t\t\t\treturn p3;\n\t\t\t\t\t}" ]
[ "0.7779503", "0.76906025", "0.76778495", "0.763815", "0.757135", "0.7545747", "0.7391708", "0.7296285", "0.7281713", "0.7254853", "0.7224446", "0.69773227", "0.6937442", "0.68622065", "0.6843294", "0.68299115", "0.6758075", "0.6738032", "0.66754615", "0.6660488", "0.66495234", "0.66460866", "0.65714216", "0.6558995", "0.6553632", "0.65042925", "0.64823425", "0.64425915", "0.6359819", "0.63290167", "0.6324903", "0.6312812", "0.6244388", "0.62254995", "0.62194455", "0.61655563", "0.6142476", "0.60249233", "0.6022538", "0.5973778", "0.592622", "0.59185815", "0.5906285", "0.58786696", "0.58079404", "0.57766914", "0.5748205", "0.57289636", "0.5716465", "0.5708583", "0.5697211", "0.558208", "0.55418366", "0.5490867", "0.5437313", "0.54123163", "0.540437", "0.5377544", "0.53552455", "0.5345977", "0.53029937", "0.52989167", "0.52409345", "0.52370703", "0.523696", "0.5219782", "0.520965", "0.51267123", "0.5105568", "0.5094074", "0.50920165", "0.50850874", "0.5069349", "0.5065225", "0.50366586", "0.5006189", "0.5002099", "0.4999435", "0.49850708", "0.4981272", "0.49761403", "0.4968925", "0.49552646", "0.49502426", "0.49487036", "0.49387515", "0.4932257", "0.49052194", "0.489359", "0.4885188", "0.4871264", "0.48616493", "0.48589277", "0.48516726", "0.48466614", "0.4840238", "0.48284274", "0.48197028", "0.4811343", "0.47830644" ]
0.7681136
2
Crossover of two parents using two random crossover points crossover takes form P1|P2
private int[][] crossoverOnePoint(int[] parent1, int[] parent2) { int crossPoint1 = rand.nextInt(parent1.length); int[] child = new int[parent1.length]; int[] child2 = new int[parent1.length]; for (int i = 0; i < crossPoint1; i++) { child[i] = parent1[i]; //before cross point = p1 child2[i] = parent2[i]; //opposite for child2 } for (int i = crossPoint1; i < parent1.length; i++) { child[i] = parent2[i]; //after and including crosspoint = p2 child2[i] = parent1[i]; //opposite for child2 } return new int[][] { child, child2 }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private int[][] crossoverTwoPoint(int[] parent1, int[] parent2) {\n\t\tint crossPoint1 = rand.nextInt(parent1.length);\n\t\tint crossLength = rand.nextInt(parent1.length + 1 - crossPoint1);\n\t\tint crossPoint2 = crossPoint1 + crossLength;\n\n\t\tint[] child = new int[parent1.length];\n\t\tint[] child2 = new int[parent1.length];\n\t\tfor (int i = crossPoint1; i < crossPoint2; i++) {\n\t\t\tchild[i] = parent1[i]; //items between cross points are direct copied from p1\n\t\t\tchild2[i] = parent2[i]; //opposite for child 2\n\t\t}\n\t\tfor (int i = 0; i < crossPoint1; i++) {\n\t\t\tchild[i] = parent2[i]; //items on either side copied direct from p2\n\t\t\tchild2[i] = parent1[i]; //opposite for child 2\n\t\t}\n\t\tfor (int i = crossPoint2; i < parent1.length; i++) {\n\t\t\tchild[i] = parent2[i]; //items on either side copied direct from p2\n\t\t\tchild2[i] = parent1[i]; //opposite for child 2\n\t\t}\n\t\treturn new int[][] { child, child2 };\n\t}", "private void crossover() {\r\n\r\n individual[] temp_pop = new individual[this.pop_size];\r\n\r\n for (int i = 0; i < pop_size; i++) { // go through population\r\n\r\n int a = new Random().nextInt(this.pop_size);\r\n int b = new Random().nextInt(this.pop_size);\r\n\r\n int split_point = new Random().nextInt(this.gene_size);\r\n\r\n float[] p1_genes = this.parent_population.getPopulation()[a].getGenes();\r\n float[] p2_genes = this.parent_population.getPopulation()[b].getGenes();\r\n\r\n float[] c1_genes = new float[gene_size];\r\n float[] c2_genes = new float[gene_size];\r\n\r\n for (int j = 0; j < gene_size; j++) {\r\n\r\n if (j < split_point) {\r\n c1_genes[j] = p1_genes[j];\r\n c2_genes[j] = p2_genes[j];\r\n } else {\r\n c2_genes[j] = p1_genes[j];\r\n c1_genes[j] = p2_genes[j];\r\n }\r\n }\r\n individual child1 = new individual(c1_genes, solutions, output);\r\n individual child2 = new individual(c2_genes, solutions, output);\r\n\r\n if (child1.getFitness() > child2.getFitness()) {\r\n temp_pop[i] = child1;\r\n } else {\r\n temp_pop[i] = child2;\r\n }\r\n }\r\n this.offspring_population.setPopulation(temp_pop);\r\n this.offspring_population.update_population();\r\n }", "public Chromosome crossover(Chromosome firstParent, Chromosome secondParent);", "@SuppressWarnings(\"unchecked\")\r\n\t@Override\r\n\tpublic void crossover() {\r\n\t\tfinal double CROSSOVER_PROB = 0.5;\r\n\t\tfor (int i=0; i<this.nChromosomes-(this.nChromosomes%2); i=i+2) {\r\n\t\t\tif (Math.random() < CROSSOVER_PROB) {\r\n\t\t\t\tArrayList<Integer> chr1 = (ArrayList<Integer>) this.chromosomes.get(i);\r\n\t\t\t\tArrayList<Integer> chr2 = (ArrayList<Integer>) this.chromosomes.get(i+1);\r\n\t\t\t\t// Uniform crossover\r\n\t\t\t\tif (!chr1.equals(chr2)) {\r\n\t\t\t\t\tfor (int j=0; j<this.nViaPoints; j=j+2) {\r\n\t\t\t\t\t\t// swap via points between 2 chromosomes\r\n\t\t\t\t\t\tInteger tmp = chr2.get(j);\r\n\t\t\t\t\t\tchr2.remove(j);\r\n\t\t\t\t\t\tchr2.add(j, chr1.get(j));\r\n\t\t\t\t\t\tchr1.remove(j);\r\n\t\t\t\t\t\tchr1.add(j, tmp);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tthis.printChromosomes(\"After crossover\");\r\n\t}", "public List<Individual> crossover2Point2(Individual parent1, Individual parent2) {\n List <Individual> listOffsprings = new ArrayList<Individual>();\n Individual offspring1 = new Individual(parent1.getChromosomeLength());\n Individual offspring2 = new Individual(parent1.getChromosomeLength());\n int crossoverPoint1 = Service.rand(0, parent1.getChromosomeLength()-1);\n int crossoverPoint2 = Service.rand(crossoverPoint1 + 1, crossoverPoint1 + parent1.getChromosomeLength() - 1);\n\n for(int geneIndex = 0; geneIndex < parent1.getChromosomeLength(); geneIndex++) {\n if (crossoverPoint2 >= parent1.getChromosomeLength()) {\n if(geneIndex >= crossoverPoint1 || geneIndex < (crossoverPoint2 - parent1.getChromosomeLength())) {\n offspring1.setGene(geneIndex, parent2.getGene(geneIndex ));\n offspring2.setGene(geneIndex, parent1.getGene(geneIndex ));\n } else {\n offspring1.setGene(geneIndex, parent1.getGene(geneIndex ));\n offspring2.setGene(geneIndex, parent2.getGene(geneIndex ));\n }\n }else {\n if(geneIndex >= crossoverPoint1 && geneIndex < crossoverPoint2) {\n offspring1.setGene(geneIndex, parent2.getGene(geneIndex ));\n offspring2.setGene(geneIndex, parent1.getGene(geneIndex ));\n } else {\n offspring1.setGene(geneIndex, parent1.getGene(geneIndex ));\n offspring2.setGene(geneIndex, parent2.getGene(geneIndex ));\n }\n }\n }\n listOffsprings.add(offspring1);\n listOffsprings.add(offspring2);\n return listOffsprings;\n }", "public void origCrossover() {\n\n ArrayList<Integer> crossPoints;\n\n // Perform crossover with probability Defines.PROB_CROSSOVER\n if (Defines.probCrossover > Math.random()) {\n // Choose random crossover points within the chromosome\n // [TODO: consider usefulness of a crossover point that coincides with\n // group boundary. If both crossovers are group boundaries, the crossover does nothing.]\n crossPoints = new ArrayList<Integer>();\n for (int i = 0; i < Defines.crossoverPoints; i++) {\n crossPoints.add(Defines.randNum(0, Defines.chromosomeSize - 1));\n }\n } else {\n // Parents are used without crossover - no crossover points; \n crossPoints = null;\n }\n\n ChromosomeGenerator chromoGen = new ChromosomeGenerator(this.pool);\n this.offspring = new ArrayList<Chromosome>(Arrays.asList(chromoGen.generateOffspring(this.parents, crossPoints)));\n }", "public void crossover() {\n\n // Perform crossover with probability Defines.PROB_CROSSOVER\n if (Defines.probCrossover > Math.random()) {\n this.crossoverOX();\n } else {\n // randomly select one of the parents to copy without crossover\n int idx = Defines.randNum(0, this.parents.size() - 1);\n Chromosome newChild = this.parents.get(idx);\n this.offspring = new ArrayList<Chromosome>();\n this.offspring.add(newChild);\n }\n }", "public Individual crossover2Point(Individual parent1, Individual parent2) {\n Individual offspring = new Individual(parent1.getChromosomeLength());\n int crossoverPoint1 = Service.rand(0, parent1.getChromosomeLength()-1);\n int crossoverPoint2 = Service.rand(crossoverPoint1 + 1, crossoverPoint1 + parent1.getChromosomeLength());\n\n for(int geneIndex = 0; geneIndex < parent1.getChromosomeLength(); geneIndex++) {\n if (crossoverPoint2 >= parent1.getChromosomeLength()) {\n if(geneIndex >= crossoverPoint1 || geneIndex < (crossoverPoint2 - parent1.getChromosomeLength())) {\n offspring.setGene(geneIndex, parent2.getGene(geneIndex));\n } else {\n offspring.setGene(geneIndex, parent1.getGene(geneIndex));\n }\n }else {\n if(geneIndex >= crossoverPoint1 && geneIndex < crossoverPoint2) {\n offspring.setGene(geneIndex, parent2.getGene(geneIndex));\n } else {\n offspring.setGene(geneIndex, parent1.getGene(geneIndex));\n }\n }\n }\n return offspring;\n }", "public Individual crossover1Point(Individual parent1, Individual parent2) {\n Individual offspring = new Individual(parent1.getChromosomeLength());\n int crossoverPoint = Service.rand(0, parent1.getChromosomeLength());\n for (int geneIndex = 0; geneIndex < parent1.getChromosomeLength(); geneIndex++) {\n // Use half of parent1's genes and half of parent2's genes\n if (crossoverPoint > geneIndex) {\n offspring.setGene(geneIndex, parent1.getGene(geneIndex));\n } else {\n offspring.setGene(geneIndex, parent2.getGene(geneIndex));\n }\n }\n return offspring;\n }", "public static Tour[] partiallyMatchedCrossover(Tour parent1, Tour parent2){\n Tour child1 = new Tour(false);\n child1.getTour().addAll(parent1.getTour());\n // Remove the end city in the cycle\n child1.getTour().remove(child1.getLength()-1);\n // Start with the parent genotypes\n Tour child2 = new Tour(false);\n child2.getTour().addAll(parent2.getTour());\n child2.getTour().remove(child2.getLength()-1);\n // Return the parents unchanged as offspring if crossover rate not met or clones\n if((parent1 == parent2) || Math.random() > RunGA.crossoverRate){\n return new Tour[]{parent1, parent2};\n } else{\n int start = (int)(Math.random()*child1.getLength());\n int end = (int)(Math.random()*child1.getLength());\n if(start > end){\n int temp = start;\n start = end;\n end = temp;\n }\n // Swap the cities between the start and end indeces to the corresponding indeces in other parent\n for(int i=start; i<=end; i++){\n // Find index of the each city to be swapped in the genotype\n int swapIndex1 = child1.getTour().indexOf(parent2.getTour().get(i));\n int swapIndex2 = child2.getTour().indexOf(parent1.getTour().get(i));\n City temp1 = child1.getTour().get(i);\n City temp2 = child2.getTour().get(i);\n child1.getTour().set(i, parent2.getTour().get(i));\n child2.getTour().set(i, parent1.getTour().get(i));\n child1.getTour().set(swapIndex1, temp1);\n child2.getTour().set(swapIndex2, temp2);\n }\n // Reform cycle\n child1.getTour().add(child1.getTour().get(0));\n child2.getTour().add(child2.getTour().get(0));\n }\n Tour[] children = new Tour[]{child1, child2};\n return children;\n }", "public static void crossover(Individual[] parent) {\n Individual[] children = new Individual[POP_SIZE];\n for (int i = 0; i < POP_SIZE; i += 2) {\n Individual child1 = new Individual(GENE_SIZE, NUM_RULES, COND_LEN);\n child1.generateRulebase();\n Individual child2 = new Individual(GENE_SIZE, NUM_RULES, COND_LEN);\n child2.generateRulebase();\n\n int crossOverPoint = new Random().nextInt(GENE_SIZE);\n for (int j = 0; j < crossOverPoint; j++) {\n child1.gene[j] = parent[i].gene[j];\n child2.gene[j] = parent[i + 1].gene[j];\n }\n\n for (int j = crossOverPoint; j < GENE_SIZE; j++) {\n child1.gene[j] = parent[i + 1].gene[j];\n child2.gene[j] = parent[i].gene[j];\n }\n\n child1.generateRulebase();\n child2.generateRulebase();\n children[i] = new Individual(child1);\n children[i + 1] = new Individual(child2);\n }\n\n matingPool = Arrays.copyOf(children, parent.length);\n }", "private void crossover(Chromosome c1, Chromosome c2){\n int split = (int)(Math.random()*c1.getNumWeights());\n \n double[][] m1 = c1.getGeneData();\n double[][] m2 = c2.getGeneData();\n double store;\n \n //Begin the switch\n for(int r=0; r<m1.length; r++){\n //Stop spliting\n if(split <= 0){\n break;\n }\n for(int c=0; c<m1[r].length;c++){\n store = m1[r][c];\n m1[r][c] = m2[r][c];\n m2[r][c] = store;\n split--;\n //Stop spliting\n if(split <= 0){\n break;\n }\n }\n }\n }", "public abstract Individual doCrossover(Individual ind1, Individual ind2, MOEAD init);", "public List<Chromosome> doCrossover(Chromosome other, String crossoverType){\n int geneSize = this.knapsackSelection.size();\n\n ArrayList<Chromosome> children = new ArrayList<>();\n\n //Allow for multiple crossover attempts to better the chance of a valid crossover.\n //Note that this can be disabled by setting GAConfiguration.CONCEPTION_ATTEMPTS = 1.\n for(int i = 0; i < PopulationConfiguration.CONCEPTION_ATTEMPTS; i++){\n\n //Set first crossover point to 0 if 1PX Crossover.\n int crossPoint1 = crossoverType.equals(\"1PX\") ? 0 : Configuration.RANDOM_GENERATOR.nextInt(geneSize);\n int crossPoint2 = Configuration.RANDOM_GENERATOR.nextInt(geneSize - crossPoint1) + crossPoint1;\n\n ArrayList<Boolean> c1 = new ArrayList<>();\n ArrayList<Boolean> c2 = new ArrayList<>();\n\n c1.addAll(this.knapsackSelection.subList(0, crossPoint1));\n c1.addAll(other.getKnapsackSelection().subList(crossPoint1, crossPoint2));\n c1.addAll(this.knapsackSelection.subList(crossPoint2, geneSize));\n Chromosome child1 = new Chromosome(c1).withFitnessCalculated();\n\n c2.addAll(other.getKnapsackSelection().subList(0, crossPoint1));\n c2.addAll(this.knapsackSelection.subList(crossPoint1, crossPoint2));\n c2.addAll(other.getKnapsackSelection().subList(crossPoint2, geneSize));\n Chromosome child2 = new Chromosome(c2).withFitnessCalculated();\n \n if(child1.isValid() && children.size() < 2){\n children.add(child1);\n }\n if(child2.isValid() && children.size() < 2){\n children.add(child2);\n }\n if(children.size() == 2){\n break;\n }\n }\n //If the crossover failed to generate a valid child, return the parents.\n if(children.size() == 0){\n children.add(other);\n children.add(this);\n }\n else if(children.size() == 1){\n children.add(this);\n }\n return children;\n }", "public void crossoverOX() {\n\n // [TODO: consider usefulness of a crossover point that coincides with\n // group boundary. If both crossovers are group boundaries, the crossover does nothing.]\n ArrayList<Integer> crossPoints = getCrossoverPoints(Defines.cpMode);\n\n Collections.sort(crossPoints);\n\n ChromosomeGenerator chromoGen = new ChromosomeGenerator(this.pool);\n\n this.offspring = new ArrayList<Chromosome>(Arrays.asList(chromoGen.generateOffspringOX(this.parents, crossPoints)));\n\n }", "public void MultipointCrossoverCAN (TableVar Variables) {\r\n int i, mom, dad, xpoint1, xpoint2;\r\n \r\n // We cross the two better individuals (the first ones)\r\n mom = 0; // Better individual\r\n dad = 1; // Second individual\r\n \r\n // Copy the individuals to cross\r\n for (i=0; i<Variables.getNVars(); i++) {\r\n Des.setCromElem (0, i, Inter.getCromElem(mom,i));\r\n Des.setCromElem (1, i, Inter.getCromElem(dad,i));\r\n }\r\n\r\n // Generation of the two points for the crossover\r\n xpoint1 = Randomize.Randint (0,(Variables.getNVars()-1));\r\n if (xpoint1!=Variables.getNVars()-1)\r\n xpoint2 = Randomize.Randint ((xpoint1+1),(Variables.getNVars()-1));\r\n else\r\n xpoint2 = Variables.getNVars()-1;\r\n\r\n // Cross the parts between both points\r\n for (i=xpoint1;i<=xpoint2;i++) {\r\n Des.setCromElem(mom, i, Inter.getCromElem(dad,i));\r\n Des.setCromElem(dad, i, Inter.getCromElem(mom,i));\r\n }\r\n\r\n // New individuals are not evaluated\r\n Des.setIndivEvaluated (mom, false);\r\n Des.setIndivEvaluated (dad, false);\r\n \r\n }", "@Override\n\tpublic Tour crossover(Tour parent1, Tour parent2) {\n\t\tTour child = new Tour(parent1.getSize());\n\t\t\n\t\t// Select a parent randomly\n\t\tdouble randomNum = Math.random();\n\t\tTour parent = randomNum > 0.5 ? parent1 : parent2;\n\t\t\n\t\t// Add cities from parent to the child\n\t\tfor (int i=0; i<child.getSize(); i++) {\n\t\t\tchild.setCity(i, parent.getCity(i));\t\t\n\t\t}\n\t\t\n\t\treturn child;\n\t\t\n\t}", "private Evolvable zipperCross(Evolvable parent1, Evolvable parent2)\n\t{\n\t\tint[] dnaP1 = ((SNSAgent)parent1).getDna();\n\t\t//dna of second parent\n\t\tint[] dnaP2 = ((SNSAgent)parent2).getDna();\n\t\t\n\t\t//result dna\n\t\tint dnaChild[] = new int[3000];\n\t\t//simple cross\n\t\tfor(int i = 0; i < 3000; i++)\n\t\t{\t\t\n\t\t\tif(i%2 == 0)\n\t\t\t\tdnaChild[i] = dnaP1[i];\n\t\t\telse\n\t\t\t\tdnaChild[i] = dnaP2[i];\n\t\t}\n\t\treturn new SNSAgent(dnaChild, ((SNSAgent)parent1).behavior);\t\n\t}", "private Vector crossover(Individual mother, Individual father) {\n \n //don't want to do crossover on two chromosomes that are equal\n if(mother.equals(father)) {\n Vector to_return = new Vector();\n to_return.add(mother);\n to_return.add(father);\n return to_return;\n }\n \n println(\"crossover\", 1);\n int[] mom = mother.getChromosome();\n int[] dad = father.getChromosome();\n int[] child1 = new int[num_shipping_points]; \n int[] child2 = new int[num_shipping_points]; \n \n println(\"mother is\", 1);\n displayChromosome(mother, 1);\n println(\"father is\", 1);\n displayChromosome(father, 1);\n \n int breakpoint = (int)(Math.random() * num_shipping_points) + 3;\n println(\"breakpoint = \" + breakpoint, 1);\n \n int comparisons = 0;\n \n for(int i = 0; i < num_shipping_points; i++) {\n if(i < breakpoint) {\n child1[i] = mom[i];\n child2[i] = dad[i];\n }\n else {\n child1[i] = -1;\n child2[i] = -1;\n }\n } \n \n int j = breakpoint; //index on other chromosome\n\n for(int i = breakpoint; i < num_shipping_points; i++) {\n\n while(containsGene(child2, mom[j])) {\n j++;\n comparisons++;\n if(comparisons > 30) {\n println(\"leaving\", 1);\n System.exit(0);\n }\n \n if(j == num_shipping_points) {\n j = 0;\n }\n if(j == breakpoint) //not supposed to happen, but it does\n break;\n }\n child2[i] = mom[j];\n j++;\n if(j == num_shipping_points) {\n j = 0;\n }\n\n }\n \n j = breakpoint;\n comparisons = 0; \n for(int i = breakpoint; i < num_shipping_points; i++) {\n\n while(containsGene(child1, dad[j])) {\n j++;\n comparisons++;\n if(comparisons > 30) {\n println(\"leaving\", 1);\n System.exit(0);\n }\n if(j == num_shipping_points) {\n j = 0;\n }\n if(j == breakpoint)\n break;\n }\n child1[i] = dad[j];\n j++;\n if(j == num_shipping_points) {\n j = 0;\n }\n }\n \n Vector v = new Vector();\n Individual i1 = new Individual(child1, this);\n Individual i2 = new Individual(child2, this);\n //i1.setFitness(evaluateFitness(i1));\n //i2.setFitness(evaluateFitness(i1));\n v.add(i1);\n v.add(i2);\n println(\"kid1:\",1);\n displayChromosome(i1, 1);\n println(\"kid2:\", 1);\n displayChromosome(i2, 1);\n println(\"returning from crossover\",1);\n return v;\n }", "Tour crossOver(Tour p2, int x1, int x2) {\r\n\t\t// make an empty tour and then fill it in\r\n\t\tTour child = new Tour();\r\n\r\n\t\t// copy the 1st segment of (this) to the child\r\n\t\tfor (int i = 0; i < x1; i++) {\r\n\t\t child.index[i] = this.index[i];\r\n\t\t}\r\n\t\t\r\n\t\tfor (int i = x1; i <= x2; i++) {\r\n\t\t child.index[i] = p2.index[i];\r\n\t\t}\r\n\t\t// copy the cross-over portion of p2 to the child\r\n\t\t\r\n for (int i = x2 + 1; i < index.length; i++) {\r\n child.index[i] = this.index[i];\r\n }\t\t\r\n\t\t// copy the last segment of (this) to the child\r\n\r\n\t\t// Now we need to correct the child for any duplicate cities\r\n\t\t\r\n\t\t// First find out the unique elements of the cross-over segment\r\n\t\t// i.e., those elements of the cross-over segment of\r\n\t\t// p1 that are not in p2\r\n\t\tint[] uniq = new int[x2 - x1 + 1];\r\n\t\tint k = 0;\r\n\t\tboolean found = false;\r\n for (int i = x1; i <= x2; i++) {\r\n for (int j = x1; j <= x2; j++) {\r\n if (this.index[i] == p2.index[j]) {\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (found) {\r\n found = false;\r\n continue;\r\n }\r\n uniq[k] = this.index[i];\r\n k++;\r\n }\r\n System.out.println();\r\n\t\t// *** TODO ***\r\n \r\n k--;\r\n found = false;\r\n for (int i = x1; i <= x2; i++) {\r\n for (int j = 0; j < x1; j++) {\r\n if (child.index[i] == child.index[j]) {\r\n child.index[i] = uniq[k];\r\n k--;\r\n found = true;\r\n break;\r\n }\r\n }\r\n \r\n if (found) {\r\n found = false;\r\n continue;\r\n }\r\n \r\n for (int j = x2 + 1; j < index.length; j++) {\r\n if (child.index[i] == child.index[j]) {\r\n child.index[i] = uniq[k];\r\n k--;\r\n break;\r\n }\r\n }\r\n }\r\n\t\t// scan the two portions of p1 that have been crossed into the\r\n\t\t// the child for any duplicates in the crossed-over \r\n\t\t// segment and if so replace with an element from the uniq list\r\n\t\t\r\n\t\tchild.distance = child.distance();\r\n\t\treturn child;\r\n\t}", "public void MultipointCrossoverDNF (TableVar Variables) {\r\n int i, j, mom, dad, xpoint1, xpoint2;\r\n\r\n // We cross the two better individuals (the first ones)\r\n mom = 0; // Better individual\r\n dad = 1; // Second individual\r\n\r\n // Copy the individuals to cross\r\n for (i=0; i<Variables.getNVars(); i++) {\r\n for (j=0; j<=Variables.getNLabelVar(i); j++) {\r\n Des.setCromElemGene(0, i, j, Inter.getCromElemGene(mom,i, j));\r\n Des.setCromElemGene (1, i, j, Inter.getCromElemGene(dad,i, j));\r\n }\r\n }\r\n\r\n // Generation of the two points for the crossover\r\n xpoint1 = Randomize.Randint (0,(Variables.getNVars()-1));\r\n if (xpoint1!=Variables.getNVars()-1)\r\n xpoint2 = Randomize.Randint ((xpoint1+1),(Variables.getNVars()-1));\r\n else\r\n xpoint2 = Variables.getNVars()-1;\r\n\r\n // Cross the parts between both points\r\n for (i=xpoint1;i<=xpoint2;i++) {\r\n for (j=0; j<=Variables.getNLabelVar(i); j++) {\r\n Des.setCromElemGene(mom, i, j, Inter.getCromElemGene(dad,i,j));\r\n Des.setCromElemGene(dad, i, j, Inter.getCromElemGene(mom,i,j));\r\n }\r\n }\r\n\r\n // New individuals are not evaluated\r\n Des.setIndivEvaluated (mom, false);\r\n Des.setIndivEvaluated (dad, false);\r\n\r\n }", "private void mate(NeuralPlayer org1, NeuralPlayer org2, NeuralPlayer offspring)\n\t{\n\t\tBasicNetwork newGuy = (BasicNetwork)org1.net.clone();\n\t\tRandom g = new Random();\n\t\tdouble[] genome1 = NetworkCODEC.networkToArray(org1.net);\n\t\tdouble[] genome2 = NetworkCODEC.networkToArray(org2.net);\n\t\t\n\t\tint numCrosses = 1;//g.nextInt(20)+2;//g.nextInt(genome1.length/4)+1;\n\t\tfor (int j = 0; j< numCrosses; j++)\n\t\t{\n\t\t\tint crossIndex = g.nextInt(genome1.length);\n\t\t\t//int crossLength = g.nextInt(genome1.length)+1;//g.nextInt(50);\n\t\t\t//int stop = Math.min(crossIndex+crossLength,genome1.length);\n\t\t\tfor (int i = crossIndex; i<genome1.length; i++)\n\t\t\t\tgenome2[i] = genome1[i]; // 1 point crossover\n\t\t}\n\t\tNetworkCODEC.arrayToNetwork(genome2, newGuy);\n\t\toffspring.net = newGuy;\n\t}", "private Evolvable cross(Evolvable parent1, Evolvable parent2)\n\t{\n\t\tif(((SNSAgent)parent1).getBehavior().equals(\"RuleBased\"))\n\t\t{\t\n\t\t\tint split = R.nextInt(7) + 1;\n\t\t\tif(crossBehavior.equals(\"zipperCross\"))\n\t\t\t\treturn ruleZipperCross(parent1, parent2);\n\t\t\telse if(crossBehavior.equals(\"splitCross\"))\n\t\t\t\treturn ruleSplitCross(parent1, parent2, split);\n\t\t\telse if(crossBehavior.equals(\"smartCross\"))\n\t\t\t\treturn ruleSplitCross(parent1, parent2, split);\n\t\t\telse\n\t\t\t\tSystem.out.println(\"WARNING: Cross Behavior not defined.\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tint split = R.nextInt(1000) + 100;\n\t\t\tif(crossBehavior.equals(\"zipperCross\"))\n\t\t\t\treturn zipperCross(parent1, parent2);\n\t\t\telse if (crossBehavior.equals(\"splitCross\"))\n\t\t\t\treturn splitCross(parent1, parent2, split);\n\t\t\telse if (crossBehavior.equals(\"freeSplitCross\")){\n\t\t\t\treturn splitCross(parent1, parent2, R.nextInt(3000));\n\t\t\t}\n\t\t\telse if(crossBehavior.equals(\"smartCross\"))\n\t\t\t{\n\t\t\t\tsplit = ((SNSAgent)parent1).getCurrentMove() - R.nextInt(30);\n\t\t\t\treturn splitCross(parent1, parent2, split);\n\t\t\t}\n\t\t\telse\n\t\t\t\tSystem.out.println(\"WARNING: Cross Behavior not defined.\");\n\t\t}\n\n\t\treturn zipperCross(parent1, parent2);\n\t}", "public void crossover(){\n \t\n \t//int cut2 = ((NODELENGTH * 3 + 1) / 3) + cut;\n \tfor (int g = 0; g < (wallpapers.size() - 1); g += 2){\n \t\tint cut = getCutPoint();\n \t\tint[] parent1 = wallpapers.get(g);\n \t\tint[] parent2 = wallpapers.get(g + 1);\n \t\t\n \t\tint[] child1 = new int[parent1.length];\n \t\tint[] child2 = new int[parent2.length];\n \t\tfor (int i = 0; i < (cut); i++){\n \t\t\tchild1[i] = parent1[i];\n \t\t\tchild2[i] = parent2[i];\n \t\t}\n \t\tfor (int j = cut; j < parent1.length; j++){\n \t\t\tchild1[j] = parent2[j];\n \t\t\tchild2[j] = parent1[j];\n \t\t}\n \t\t\n \t\t\n \t\twallpapers.set(g, child1);\n \t\twallpapers.set(g + 1, child2);\n \t}\n \tfor (int d = 0; d < (wallpapers.size() * 2); d++){\n \t\tif (d < wallpapers.size()){\n \t\t\ttemp_wallpapers.add(wallpapers.get(d));\n \t\t}\n \t\telse {\n \t\t\ttemp_wallpapers.add(node());\n \t\t}\n \t}\n \twallpapers.clear();\n \tfor (int u = 0; u < temp_wallpapers.size(); u++){\n\t\t\twallpapers.add(u, temp_wallpapers.get(u));\n\t\t}\n \ttemp_wallpapers.clear();\n }", "public Population doCrossover(Population p) {\n\t\t// TODO Auto-generated method stub\n\t\tSystem.out.println(\"Performing 1 point crossover for config1's selection population.\");\n\t\tSystem.out.println(\"Selecting bits to crossover.\");\n\t\tSystem.out.println(\"Completed.\");\n\t\treturn p;\n\t }", "public static Double[] crossover(Double[] g1, Double[] g2){\n\t\tRandom random = new Random();\n\t\tint start = random.nextInt(variableNum-1);\n\t\tint end = start + 1 + random.nextInt(variableNum-start);\n\t\t//which one is better, why\n//\t\tfor(int i = start; i < end; i++) g1[i] = g2[i] + Math.random()*(g1[i]-g2[i]);\n//\t\tfor(int i = start; i < end; i++) g1[i] = g2[i];\n\t\tfor(int i = start; i < end; i++) {\n\t\t\tg1[i] = g2[i] + (Math.random()*2-1)*(g1[i]-g2[i]);\n\t\t\tif(g1[i] > maxValue) g1[i] = maxValue;\n\t\t\tif(g1[i] < minValue) g1[i] = minValue;\n\t\t}\n\t\treturn Arrays.copyOf(g1, g1.length);\n\t}", "public void simulatedBinaryCrossover(MersenneTwisterFast random, TraceableFloatVectorIndividual other, float eta_c)\n {\n final double EPS = FloatVectorSpecies.SIMULATED_BINARY_CROSSOVER_EPS;\n FloatVectorSpecies s = (FloatVectorSpecies) species;\n TraceableFloat[] parent1 = genome;\n TraceableFloat[] parent2 = other.genome;\n // double[] min_realvar = s.minGenes;\n // double[] max_realvar = s.maxGenes;\n \n \n double y1, y2, yl, yu;\n double c1, c2;\n double alpha, beta, betaq;\n double rand;\n \n for(int i = 0; i < parent1.length; i++)\n {\n if (random.nextBoolean()) // 0.5f\n {\n if (Math.abs(parent1[i].getValue() - parent2[i].getValue()) > EPS)\n {\n if (parent1[i].getValue() < parent2[i].getValue())\n {\n y1 = parent1[i].getValue();\n y2 = parent2[i].getValue();\n }\n else\n {\n y1 = parent2[i].getValue();\n y2 = parent1[i].getValue();\n }\n yl = s.minGene(i); //min_realvar[i];\n yu = s.maxGene(i); //max_realvar[i]; \n rand = random.nextFloat();\n beta = 1.0 + (2.0*(y1-yl)/(y2-y1));\n alpha = 2.0 - Math.pow(beta,-(eta_c+1.0));\n if (rand <= (1.0/alpha))\n {\n betaq = Math.pow((rand*alpha),(1.0/(eta_c+1.0)));\n }\n else\n {\n betaq = Math.pow((1.0/(2.0 - rand*alpha)),(1.0/(eta_c+1.0)));\n }\n c1 = 0.5*((y1+y2)-betaq*(y2-y1));\n beta = 1.0 + (2.0*(yu-y2)/(y2-y1));\n alpha = 2.0 - Math.pow(beta,-(eta_c+1.0));\n if (rand <= (1.0/alpha))\n {\n betaq = Math.pow((rand*alpha),(1.0/(eta_c+1.0)));\n }\n else\n {\n betaq = Math.pow((1.0/(2.0 - rand*alpha)),(1.0/(eta_c+1.0)));\n }\n c2 = 0.5*((y1+y2)+betaq*(y2-y1));\n if (c1<yl)\n c1=yl;\n if (c2<yl)\n c2=yl;\n if (c1>yu)\n c1=yu;\n if (c2>yu)\n c2=yu;\n if (random.nextBoolean())\n {\n parent1[i] = this.recombineGenes(parent1[i], parent2[i], (float) c2);\n parent2[i] = this.recombineGenes(parent2[i], parent1[i], (float) c1);\n }\n else\n {\n parent1[i] = this.recombineGenes(parent1[i], parent2[i], (float) c2);\n parent2[i] = this.recombineGenes(parent2[i], parent1[i], (float) c1);\n }\n }\n else\n {\n // do nothing\n }\n }\n else\n {\n // do nothing\n }\n }\n }", "public static Tree crossover(double[] distribution, Tree[] trees){\n Tree tree1 = chooseRandTree(distribution, trees);\n Tree tree2 = chooseRandTree(distribution, trees);\n if (tree2 == null) System.out.println(\"Null1\");\n while (tree1.equals(tree2)){\n tree2 = chooseRandTree(distribution,trees);\n if (tree2 == null) System.out.println(\"Null2\");\n }\n return reproduce(tree1, tree2);\n \n }", "public Evolvable cross(Evolvable parent1, Evolvable parent2, int crossoverPoint)\n\t{\n\t\tif(((SNSAgent)parent1).getBehavior().equals(\"RuleBased\"))\n\t\t{\t\n\t\t\tif(crossBehavior.equals(\"zipperCross\"))\n\t\t\t\treturn ruleZipperCross(parent1, parent2);\n\t\t\telse if(crossBehavior.equals(\"splitCross\"))\n\t\t\t\treturn ruleSplitCross(parent1, parent2, crossoverPoint);\n\t\t\telse if(crossBehavior.equals(\"smartCross\"))\n\t\t\t\treturn ruleSplitCross(parent1, parent2, crossoverPoint);\n\t\t\telse\n\t\t\t\tSystem.out.println(\"WARNING: Cross Behavior not defined.\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(crossBehavior.equals(\"zipperCross\"))\n\t\t\t\treturn zipperCross(parent1, parent2);\n\t\t\t\n\t\t\telse if (crossBehavior.equals(\"splitCross\"))\n\t\t\t\treturn splitCross(parent1, parent2, crossoverPoint);\n\t\t\t\n\t\t\telse if (crossBehavior.equals(\"freeSplitCross\")){\n\t\t\t\treturn splitCross(parent1, parent2, crossoverPoint);\n\t\t\t}\n\t\t\t\n\t\t\telse if(crossBehavior.equals(\"smartCross\")) {\n\t\t\t\tint split = ((SNSAgent)parent1).getCurrentMove() - R.nextInt(30);\n\t\t\t\treturn splitCross(parent1, parent2, split);\n\t\t\t}\n\t\t\telse\n\t\t\t\tSystem.out.println(\"WARNING: Cross Behavior not defined.\");\n\t\t}\n\n\t\treturn zipperCross(parent1, parent2);\n\t}", "public Individual crossover(Individual parentB)\r\n\t{\r\n\t\tIndividual ind = new Individual(intSize, intCount, signedInt);\r\n\r\n\t\t// Copy over genes randomly\r\n\t\tfor (int i = 0; i < binary.length; i++)\r\n\t\t{\r\n\t\t\tboolean parentA = Math.random() >= 0.5;\r\n\t\t\tind.binary[i] = parentA ? binary[i] : parentB.binary[i];\r\n\t\t}\r\n\r\n\t\treturn ind;\r\n\t}", "public static Tree reproduce(Tree tree1, Tree tree2){\n Tree tree1Copy = tree1.treeCopy();\n if (tree2 == null) System.out.println(\"know\");\n if (tree1 == null) System.out.println(\"know\");\n Tree tree2Copy = tree2.treeCopy();\n //select tree1 one crossover point\n //select terminal node as crossover with 10 percent probability. o\\w pick function\n \n Node tree1Cross;\n tree1Cross = getCrossType(tree1Copy);\n //select tree2 crossover points\n \n Node tree2Cross;\n tree2Cross = getCrossType(tree2Copy);\n \n tree1Cross.setData(tree2Cross.getData());\n tree1Cross.setLeft(tree2Cross.getLeft());\n tree1Cross.setRight(tree2Cross.getRight());\n return tree1Copy;\n \n \n }", "public static Tour crossover(Tour parent1, Tour parent2) {\n // Create new child tour\n Tour child = new Tour();\n\n // Get start and end sub tour positions for parent1's tour\n int startPos = (int) (Math.random() * parent1.tourSize());\n int endPos = (int) (Math.random() * parent1.tourSize());\n\n // Loop and add the sub tour from parent1 to our child\n for (int i = 0; i < child.tourSize(); i++) {\n // If our start position is less than the end position\n if (startPos < endPos && i > startPos && i < endPos) {\n child.setCity(i, parent1.getCity(i));\n } // If our start position is larger\n else if (startPos > endPos) {\n if (!(i < startPos && i > endPos)) {\n child.setCity(i, parent1.getCity(i));\n }\n }\n }\n\n // Loop through parent2's city tour\n for (int i = 0; i < parent2.tourSize(); i++) {\n // If child doesn't have the city add it\n if (!child.containsCity(parent2.getCity(i))) {\n // Loop to find a spare position in the child's tour\n for (int ii = 0; ii < child.tourSize(); ii++) {\n // Spare position found, add city\n if (child.getCity(ii) == null) {\n child.setCity(ii, parent2.getCity(i));\n break;\n }\n }\n }\n }\n return child;\n }", "@Test\n\tpublic void testCrossover() {\n\t\tint pivot = 5;\n\t\tint size = g10.getUnits().size();\n\t\tArrayList<GenomeDouble> expectedWeights1;\n\t\tArrayList<GenomeDouble> expectedWeights2;\n\t\t\n\t\texpectedWeights1 = new ArrayList<GenomeDouble>(g10.getUnits().size());\n\t\texpectedWeights2 = new ArrayList<GenomeDouble>(g10_2.getUnits().size());\n\t\t\n\t\texpectedWeights1.addAll(g10.getUnits().subList(0, pivot));\n\t\texpectedWeights1.addAll(g10_2.getUnits().subList(pivot, size));\n\t\texpectedWeights2.addAll(g10_2.getUnits().subList(0, pivot));\n\t\texpectedWeights2.addAll(g10.getUnits().subList(pivot, size));\n\t\t\n\t\tList<Genome<GenomeDouble>> results = Genome.crossover(g10, g10_2, 0.7, 10);\n\t\tassertEquals(expectedWeights1, results.get(0).getUnits());\n\t\tassertEquals(expectedWeights2, results.get(1).getUnits());\n\t}", "public OnePointCrossoverOne(Population p) {\n\t\tdoCrossover(p);\n\t}", "public static Graph_chromosome generateChild(Graph_chromosome parent1,\r\n\t\t\tGraph_chromosome parent2 )\r\n\t{\r\n\t\tRandom random_generator = new Random();\r\n\t\tint crossover_point = random_generator.nextInt(parent1.chromosome_size);\r\n\t\t\r\n\t\tGraph_chromosome child = new Graph_chromosome(parent1.chromosome_size,parent1.num_colors);\r\n\t\t\r\n\t\tfor(int i=0;i<child.chromosome_size;i++)\r\n\t\t{\r\n\t\t\tif(i<crossover_point)\r\n\t\t\t\tchild.chromosome[i] = parent1.getChromosomeAt(i+1);\r\n\t\t\telse\r\n\t\t\t\tchild.chromosome[i] = parent2.getChromosomeAt(i+1);\r\n\t\t}\r\n\t\treturn child;\r\n\t}", "abstract int[] crossOver();", "public Individe crossoveri(Individe individe1, Individe individe2) {\n Individe rez = new Individe(pikatEVeturave.length, pikat);\r\n\r\n for (int i = 0; i < pikatEVeturave.length; i++) {\r\n int select = (int) (Math.random() * 2);//zgjedh prej cilit individe mi marr qit veture\r\n if (select == 0) {\r\n rez.pikatEVeturave[i] = (ArrayList<Point>) individe1.pikatEVeturave[i].clone();//clone se dilke ni problem en lidhje me referencat\r\n } else {\r\n rez.pikatEVeturave[i] = (ArrayList<Point>) individe2.pikatEVeturave[i].clone();\r\n }\r\n }\r\n\r\n rez = normalizimi(rez);//duhet mi normalizu individin dmth mi hek pozitat(qytetet) e dyfishta edhe mi shtu pika(qytetet) qe jane mongu\r\n\r\n return rez;\r\n }", "public void doMutation(double probability, Solution offsbring) throws JMException {\r\n\t\r\n\t\r\n\t\t \r\n\t\t try {\r\n\t\t \t//System.out.println(offsbring.get);\r\n\t\t int chrmosomesize= offsbring.getCompositionService().size();\r\n\t\t //int random = PseudoRandom.randInt()%chrmosomesize;\r\n\t\t int random = PseudoRandom.randInt()%chrmosomesize;\r\n\t\t if (random<probability){\r\n\t\t \t System.out.println(\" classs \"+offsbring.getCompositionService().get(random).getServiceClass());//getSeviceClass();\r\n\t\t\t \r\n\t\t \t String Sclass=(String) offsbring.getCompositionService().get(random).getServiceClass();//getSeviceClass();\r\n\t\t \r\n\t\t for (int i=0; i<z.ServicePool.size();i++){\r\n\t// if (z.ServicePool.get(i).getServiceFunctionality().equalsIgnoreCase(Sclass))\r\n\t\t \t if (z.ServicePool.get(i).getServiceClass().equalsIgnoreCase(Sclass))\r\n\t\t\tRequiredClass.add(z.ServicePool.get(i));\r\n\t\t }\r\n\t\t // z.ServicePool.get(9).\r\n\t\tint random2 = (PseudoRandom.randInt())%(RequiredClass.size());\r\n\t\toffsbring.getCompositionService().set(random,RequiredClass.get(random2));\r\n\t\t \t\t\r\n\t\t\r\n\t\toffsbring.getCompositionService().set(random,RequiredClass.get(random2));\t\t \t \r\n\t\t \r\n\t\t }\r\n\t\t } catch (ClassCastException e1) {\r\n\t\t Configuration.logger_.severe(\"SinglePointCrossover.doCrossover: Cannot perfom \" +\r\n\t\t \"SinglePointCrossover\");\r\n\t\t Class cls = java.lang.String.class;\r\n\t\t String name = cls.getName();\r\n\t\t throw new JMException(\"Exception in \" + name + \".doCrossover()\");\r\n\t\t }\r\n\t\t \r\n\t\t \r\n\t\t }", "public CrossoverOrder() {\n\t\tthis.randomGenerator = new Random(System.currentTimeMillis());\n\t}", "private Individual[] crossOver(Individual father, Individual mother){\n\t\tIndividual[] children = problem.makeChild(mother, father);\r\n\t\treturn children;\r\n\t}", "public Dna crossover(Dna partner) {\n int splitPosition = I.random.nextInt(this.length);\n\n // The final len is the segment from this [0..splitPosition] + what is added from partner\n // [splitPosition..partner.length] If partner.length < splitPosition then nothing is added and the final len =\n // the segment from this, which is splitPosition +1 because splitPosition starts from 0\n int child_len = splitPosition >= partner.length - 1 ? splitPosition + 1 : partner.length;\n\n MyString[] gene = new MyString[child_len];\n\n assert(this.length == this.dna.myStr.length) : \"this.len\";\n assert(partner.length == partner.dna.myStr.length) : \"partner.len\";\n for (int i = 0; i < child_len; i++) {\n if (i <= splitPosition)\n gene[i] = new MyString(this.dna.myStr[i].val, true);\n else\n gene[i] = new MyString(partner.dna.myStr[i].val, true);\n }\n return new Dna(new MyInput(gene));\n }", "public static void main(String args[]) {\n\t\t\n\t\tint populationSize = 5;\n\t\tint crossCount = (int)(populationSize * 0.9);\n\t\tint mutCount = (int)(populationSize * 0.05);\n\t\tint copyCount = populationSize - crossCount - mutCount;\n\n\t\t//90% through crossover\n\t\tfor(int i = 0; i < crossCount; i++) \n\t\t\tSystem.out.println(\"Cross: \" + i);\n\t\t\n\t\t//5% by copying\n\t\tfor(int i = crossCount; i < crossCount + copyCount; i++) \n\t\t\tSystem.out.println(\"Copy: \" + i);\n\t\t\n\t\t\n\t\t//5% by mutation\n\t\tfor(int i = crossCount + copyCount; i < populationSize; i++) \n\t\t\tSystem.out.println(\"Mut: \" + i);\n\t\t\n\t\tfor(int i = 0; i < 60; i++) {\n\t\t\t\n\t\t\tPoint p1 = new Point((int)(Math.random() * 600) , (int)(Math.random() * 600)); //bot's point\n\t\t\tPoint p2 = new Point((int)(Math.random() * 600) , (int)(Math.random() * 600)); //enemy point\n\t\t\twhile(p2.equals(p1))\n\t\t\t\tp2 = new Point((int)(Math.random() * 600) , (int)(Math.random() * 600));\n\t\t\t\n\t\t\tfloat angle = (float) Math.atan2(p2.y - p1.y, p2.x - p1.x);\n\t\t\tDecimalFormat df = new DecimalFormat(\"0.0000\");\n\t\t\tSystem.out.println(p1.x + \" \" + p1.y + \" \" + p2.x + \" \" + p2.y + \" \" + df.format(angle));\n\t\t\t\n\t\t}\n\t\t\n\t}", "private void cross(String[] pop) {\n\t\tString temp1, temp2;\n\t\tfor (int i = (int) (ChrNum*survial_fraction); i < ChrNum; i+=2) {\n\t\t\tif (Math.random() < 0.60) {\n\t\t\t\tint pos = (int)(Math.random()*GENE)+1; \n\t\t\t\ttemp1 = pop[i].substring(0, pos) + pop[i + 1].substring(pos); \n\t\t\t\ttemp2 = pop[i + 1].substring(0, pos) + pop[i].substring(pos);\n\t\t\t\tpop[i] = temp1;\n\t\t\t\tpop[i + 1] = temp2;\n\t\t\t}\n\t\t}\n\t}", "private static void mating() {\n\t\tint getRand = 0;\n\t\tint parentA = 0;\n\t\tint parentB = 0;\n\t\tint newIndex1 = 0;\n\t\tint newIndex2 = 0;\n\t\tChromosome newChromo1 = null;\n\t\tChromosome newChromo2 = null;\n\n\t\tfor (int i = 0; i < OFFSPRING_PER_GENERATION; i++) {\n\t\t\tparentA = chooseParent();\n\t\t\t// Test probability of mating.\n\t\t\tgetRand = getRandomNumber(0, 100);\n\t\t\tif (getRand <= MATING_PROBABILITY * 100) {\n\t\t\t\tparentB = chooseParent(parentA);\n\t\t\t\tnewChromo1 = new Chromosome();\n\t\t\t\tnewChromo2 = new Chromosome();\n\t\t\t\tpopulation.add(newChromo1);\n\t\t\t\tnewIndex1 = population.indexOf(newChromo1);\n\t\t\t\tpopulation.add(newChromo2);\n\t\t\t\tnewIndex2 = population.indexOf(newChromo2);\n\n\t\t\t\t// Choose either, or both of these:\n\t\t\t\tpartiallyMappedCrossover(parentA, parentB, newIndex1, newIndex2);\n\t\t\t\t// positionBasedCrossover(parentA, parentB, newIndex1, newIndex2);\n\n\t\t\t\tif (childCount - 1 == nextMutation) {\n\t\t\t\t\texchangeMutation(newIndex1, 1);\n\t\t\t\t} else if (childCount == nextMutation) {\n\t\t\t\t\texchangeMutation(newIndex2, 1);\n\t\t\t\t}\n\n\t\t\t\tpopulation.get(newIndex1).computeConflicts();\n\t\t\t\tpopulation.get(newIndex2).computeConflicts();\n\n\t\t\t\tchildCount += 2;\n\n\t\t\t\t// Schedule next mutation.\n\t\t\t\tif (childCount % (int) Math.round(1.0 / MUTATION_RATE) == 0) {\n\t\t\t\t\tnextMutation = childCount + getRandomNumber(0, (int) Math.round(1.0 / MUTATION_RATE));\n\t\t\t\t}\n\t\t\t}\n\t\t} // i\n\t\treturn;\n\t}", "private Evolvable splitCross(Evolvable parent1, Evolvable parent2, int split)\n\t{\n\t\tint[] dnaP1 = ((SNSAgent)parent1).getDna();\n\t\t//dna of second parent\n\t\tint[] dnaP2 = ((SNSAgent)parent2).getDna();\n\t\t\n\t\t//result dna\n\t\tint dnaChild[] = new int[3000];\n\t\t//simple cross\n\t\tfor(int i = 0; i < 3000; i++)\n\t\t{\t\t\n\t\t\tif(i < split)\n\t\t\t\tdnaChild[i] = dnaP1[i];\n\t\t\telse\n\t\t\t\tdnaChild[i] = dnaP2[i];\n\t\t}\n\t\treturn new SNSAgent(dnaChild, ((SNSAgent)parent1).behavior);\n\t\t\n\t}", "private static Set<Chromosome> crossoverPopulation(ArrayList<Chromosome> population, int populationSize, int crossoverSize) {\n\n // declare a set of chromosomes which will store all thr chromosomes generated by the crossover operation\n Set<Chromosome> crossoverChromosomes = new HashSet<>();\n\n while (crossoverChromosomes.size() < crossoverSize) {\n // retrieve a set of chromosomes (of size 2) on which crossover will occur\n // using the Rank-Based Roulette Wheel Selection method\n Set<Chromosome> selectedChromosomes = rankBasedRouletteWheelSelection(population, populationSize);\n\n // store the 2 Chromosomes in parent 1 and parent 2\n Chromosome parent1 = selectedChromosomes.iterator().next();\n selectedChromosomes.remove(parent1);\n Chromosome parent2 = selectedChromosomes.iterator().next();\n\n // perform crossover using the crossoverChromosomes method\n // the method is called twice, switching the order of the parents for the second time, since SCX produces only\n // one child, however produces a different child when the parents are switched\n crossoverChromosomes.add(crossover(parent1, parent2));\n crossoverChromosomes.add(crossover(parent2, parent1));\n }\n\n return crossoverChromosomes;\n }", "private ArrayList<Chromosome> selectParentsRandom() {\n ArrayList<Chromosome> parents = new ArrayList<Chromosome>(Defines.crossoverParentCt);\n\n for (int i = 0; i < Defines.crossoverParentCt; i++) {\n // Generate random index into chromosomes in range [0..size-1]\n int randomParent = Defines.randNum(0, chromosomes.size() - 1);\n // Remember the new parent\n parents.add(chromosomes.get(randomParent));\n }\n return parents;\n }", "@SuppressWarnings({ \"unchecked\", \"deprecation\" })\n\tprivate static NeuralNetwork crossover(NeuralNetwork cross, NeuralNetwork over, Singleton s1) throws IOException, ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException {\n\t\tEvolveSingleton s = (EvolveSingleton) s1;\n\t\t//determines which of the two networks was more fit and less fit\n\t\tClass<? extends NeuralNetwork> networkClass = (Class<? extends NeuralNetwork>) Class.forName(\"BackEvolution.\"+s.getType()+\".\"+s.getType()+\"Network\");\n\t\tClass<? extends Layer> layerClass = (Class<? extends Layer>) Class.forName(\"BackEvolution.\"+s.getType()+\".\"+s.getType()+\"Layer\");\n\t\tClass<? extends Neuron> neuronClass = (Class<? extends Neuron>) Class.forName(\"BackEvolution.\"+s.getType()+\".\"+s.getType()+\"Neuron\");\n\t\tNeuralNetwork newnn = null;\n\t\tNeuralNetwork lessfit = null;\n\t\tNeuralNetwork morefit = null;\n\t\tif (cross.getFitness() > over.getFitness()){\n\t\t\tmorefit = cross;\n\t\t\tlessfit = over;\n\t\t}\n\t\telse{\n\t\t\tmorefit = over;\n\t\t\tlessfit = cross;\n\t\t}\n\t\t//creates the structure for the new network\n\t\tLayer[] puts = NetworkCreator.creator(s);\n\t\tClass<?>[] types2 = {Class.forName(\"BackEvolution.Layer\"),Class.forName(\"BackEvolution.Layer\")};\n\t\tConstructor<? extends NeuralNetwork> con2 = networkClass.getConstructor(types2);\n\t\tClass<? extends SpecialCreator> managerClass = (Class<? extends SpecialCreator>) Class.forName(\"BackEvolution.\"+s.getType()+\".\"+s.getType()+\"Creator\");\n\t\tSpecialCreator manager = managerClass.newInstance();\n\t\tmanager.InputOutputcreator(puts);\n\t\tnewnn = con2.newInstance(puts[0],puts[1]);\n\t\tNetworkCreator.Neuraltracker(newnn);\n\t\t//pretty sure this is obsolete from when i tried to breed different layered networks but not sure if I can delete.\n\t\tArrayList<Layer> lesslayers = lessfit.getLayers();\n\t\tArrayList<Layer> morelayers = morefit.getLayers();\n\t\tint maxlayers = 1;\n\t\tif (lesslayers.size() > morelayers.size()){\n\t\t\tmaxlayers = lesslayers.size();\n\t\t}\n\t\telse { \n\t\t\tmaxlayers = morelayers.size();\n\t\t}\n\t\t//adds the neuron to each layer based on which network had the most neurons in that layer\n\t\tfor (int i = 1; i < maxlayers-1; i++){\n\t\t\tLayer lesslayer = null;\n\t\t\tLayer morelayer = null;\n\t\t\tint lessnum = 0;\n\t\t\tint morenum = 0;\n\t\t\ttry{\n\t\t\tlesslayer = lesslayers.get(i);\n\t\t\tlessnum = lesslayer.getNeurons().size();\n\t\t\t}\n\t\t\tcatch(Exception e){\n\t\t\t\tmorelayer = morelayers.get(i);\n\t\t\t\tmorenum = morelayer.getNeurons().size();\n\t\t\t}\n\t\t\ttry{\n\t\t\tmorelayer = morelayers.get(i);\n\t\t\tmorenum = morelayer.getNeurons().size();\n\t\t\t}\n\t\t\tcatch (Exception e){\n\t\t\t}\n\t\t\tif (morelayer == null) morenum = 0;\n\t\t\telse if (morelayer.isOutput()){\n\t\t\t\tmorenum = 0;\n\t\t\t}\n\t\t\tif (lesslayer == null) lessnum = 0;\n\t\t\telse if (lesslayer.isOutput()){\n\t\t\t\tlessnum = 0;\n\t\t\t}\n\t\t\tClass<?>[] types = {boolean.class,boolean.class};\n\t\t\tConstructor<? extends Layer> con = layerClass.getConstructor(types);\n\t\t\tLayer newl = con.newInstance(false, false);\n\t\t\tnewnn.addLayer(newl);\n\t\t\tnewl.setNumber(newnn.getLayers().size()-1);\n\t\t\tfor (int j = 0; j < morenum || j < lessnum; j++){\n\t\t\t\tNeuron newn = neuronClass.newInstance();\n\t\t\t\tnewl.addNeuron(newn);\n\t\t\t\tnewn.setLayernumber(newl.getNumber());\n\t\t\t\tnewn.setNumber(newl.getNeurons().size()-1);\n\t\t\t}\n\t\t}\n\t\tfor (int i = 1; i <=lesslayers.size(); i++){\n\t\t\tLayer l = lesslayers.get(i-1);\n\t\t\tfor (Neuron n : l.getNeurons()){\n\t\t\t\tn.setLayernumber(i);\n\t\t\t\t\n\t\t\t}\n\t\t\tl.setNumber(i);\n\t\t}\n\t\tfor (int i = 1; i <=morelayers.size(); i++){\n\t\t\tLayer l = lesslayers.get(i-1);\n\t\t\tfor (Neuron n : l.getNeurons()){\n\t\t\t\tn.setLayernumber(i);\n\t\t\t\t\n\t\t\t}\n\t\t\tl.setNumber(i);\t\n\t\t}\n\t\t//adds genes to the structure. if the same conection exists in the more fit network, it gets preference over the less fit network. if one or the other does not have this gene at all it gets added. currently more fit is always selected may add random chance that the less fit networks gene is selected.\n\t\t//gets all the data from the more fit layer.\n\t\tArrayList<double[]> geneIdentities = new ArrayList<double[]>();\n\t\tfor(Layer l : morelayers){\t\t\n\t\t\t\tfor (Neuron n : l.getNeurons()){\n\t\t\t\t\tfor(Gene g : n.getGenes()){\n\t\t\t\t\t\tdouble data[] = new double[5];\n\t\t\t\t\t\tdata[0] = l.getNumber();\n\t\t\t\t\t\tdata[1] = n.getNumber();\n\t\t\t\t\t\tdata[2] = g.getConnection().getNumber();\n\t\t\t\t\t\tif (morelayers.get(g.getConnection().getLayernumber()-1).isOutput()) data[3] = maxlayers;\n\t\t\t\t\t\telse data[3] = g.getConnection().getLayernumber();\n\t\t\t\t\t\tdata[4] = g.getWeight();\n\t\t\t\t\t\tgeneIdentities.add(data);\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t}\t\t\t\n\t\t}\n\t\t//gets all the gene data from the less fit layer.\n\t\tArrayList<double[]> geneIdentities2 = new ArrayList<double[]>();\n\t\tfor(Layer l : lesslayers){\n\t\t\t\tfor (Neuron n : l.getNeurons()){\n\t\t\t\t\tfor(Gene g : n.getGenes()){\n\t\t\t\t\t\tdouble data[] = new double[5];\n\t\t\t\t\t\tdata[0] = l.getNumber();\n\t\t\t\t\t\tdata[1] = n.getNumber();\n\t\t\t\t\t\tdata[2] = g.getConnection().getNumber();\n\t\t\t\t\t\tif (lesslayers.get(g.getConnection().getLayernumber()-1).isOutput()) data[3] = maxlayers;\n\t\t\t\t\t\telse data[3] = g.getConnection().getLayernumber();\n\t\t\t\t\t\tdata[4] = g.getWeight();\n\t\t\t\t\t\tgeneIdentities2.add(data);\n\t\t\t\t\t}\n\t\t\t\t}\t\t\n\t\t}\n\t\t//if two genes connect the same neuron, it averages the weights of them and removes one leaving the other with the average weight\n\t\tfor (double[] nums : geneIdentities){\n\t\t\tfor (int i = 0; i < geneIdentities2.size(); i++){\n\t\t\t\tdouble[] nums2 = geneIdentities2.get(i);\n\t\t\t\tif (nums[0] == nums2[0] && nums[1] == nums2[1] && nums[2] == nums2[2] && nums[3] == nums2[3]){\n\t\t\t\t\tnums[4] = (nums[4] + nums2[4])/2;\n\t\t\t\t\tgeneIdentities2.remove(nums2);\n\t\t\t\t\ti--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//adds the new genes to the new neural network based on the gene data.\n\t\tfor(double[] nums : geneIdentities){\t\t\n\t\t\tGene newGene = new Gene(newnn.getLayers().get((int) nums[3]-1).getNeurons().get((int) nums[2]-1), nums[4]);\n\t\t\tNeuron newNeuron = newnn.getLayers().get((int) (nums[0]-1)).getNeurons().get((int) nums[1]-1);\n\t\t\tnewNeuron.AddGenes(newGene);\n\t\t\tnewGene.setInput(newNeuron);\t\t\t\n\t\t}\n\t\tfor(double[] nums : geneIdentities2){\t\t\t\n\t\t\tGene newGene = new Gene(newnn.getLayers().get((int) nums[3]-1).getNeurons().get((int) nums[2]-1), nums[4]);\n\t\t\tNeuron newNeuron = newnn.getLayers().get((int) (nums[0]-1)).getNeurons().get((int) nums[1]-1);\n\t\t\tnewNeuron.AddGenes(newGene);\n\t\t\tnewGene.setInput(newNeuron);\n\t\t}\n\t\t//returns mutated bred network\n\t\treturn mutate(newnn,s);\n\t}", "private int getCrossoverPoint(int mode) {\n int cPoint = 0;\n\n switch (mode) {\n case Defines.CP_PURE_RANDOM:\n cPoint = Defines.randNum(0, Defines.chromosomeSize - 1);\n break;\n\n case Defines.CP_NO_BOUNDARY:\n do {\n cPoint = Defines.randNum(0, Defines.chromosomeSize - 1);\n } while (cPoint % Defines.GROUP_SIZE == 0 || cPoint % Defines.GROUP_SIZE == 3);\n break;\n }\n\n return cPoint;\n }", "public int getCrossoverPoints() {\n\t\treturn 1;\r\n\t}", "public Population crossoverPopulation(Population population, List<FogDevice> fogDevices, List<? extends Cloudlet> cloudletList) {\n Individual queen = population.getFittest(0);\n // Loop over current population by fitness\n for (int dronesIndex = 1; dronesIndex < (numberDrones + 1); dronesIndex++) {\n Individual husband = population.getFittest(dronesIndex);\n\n // Apply crossover to this individual?\n if (this.crossoverRate > Math.random()) {\n // Initialize offspring\n Individual offspring = new Individual(husband.getChromosomeLength());\n\n offspring = crossover2Point(husband, queen);\n\n if(husband.getFitness() <= calcFitness(offspring, fogDevices, cloudletList)\n && !doesPopupationIncludeIndividual(population, offspring)) {\n population.getPopulation().remove(husband);\n population.getPopulation().add(offspring);\n }\n }\n }\n return population;\n }", "public abstract void crossoverWith(LevelRepresentation levelRepresentation);", "private ArrayList<Chromosome> selectParentsRoulette() {\n ArrayList<Chromosome> parents = new ArrayList<Chromosome>(Defines.crossoverParentCt);\n double sumGH = 0.0; // sums GH for all chromosomes in this pop\n Random randgen = new Random(); // random number generator\n for (Chromosome chromo : this.chromosomes) {\n sumGH += chromo.getTotalGH();\n }\n for (int i = 0; i < Defines.crossoverParentCt; i++) {\n double parentRandomizer = randgen.nextDouble() * sumGH; // get random #\n double aggGH = 0.0; // aggregate the GH until we reach our random #\n int chromoIdx = 0; // identifies the chromosome in the pop\n Chromosome parentCandidate;\n do {\n parentCandidate = this.chromosomes.get(chromoIdx++);\n aggGH += parentCandidate.getTotalGH();\n } while (aggGH < parentRandomizer);\n parents.add(parentCandidate);\n }\n return parents;\n }", "private void rouletteSelection() {\n parentChromosomes = new Chromosome[2];\n parentIndices = new int[2];\n Arrays.fill(parentChromosomes, null);\n parentIndices[0] = getFittestChromosomeIndex();\n parentChromosomes[0] = chromosomes[parentIndices[0]];\n parentIndices[1] = getFittestChromosomeIndex();\n parentChromosomes[1] = chromosomes[parentIndices[1]];\n System.out.println(\"Individuals selected from Roulette Wheel for crossover: \\n\" +\n Arrays.toString(parentChromosomes[0].getGenes()) + \"\\n\" +\n Arrays.toString(parentChromosomes[1].getGenes()));\n }", "public Pair doXover(Object chromosome1, Object chromosome2, HashMap params) throws OptimizerException;", "public static void setCrossoverProbability(double value) { crossoverProbability = value; }", "@Test\r\n\tpublic final void testCross() throws GeneticProgrammingException {\r\n\t\tfinal int[] training = TestHelper.genertateTrainingDataSet(-100, 100);\r\n\t\tfinal double[] targetValues = TestHelper.calculateTargetValues(\r\n\t\t\t\t\"x*2-1/2\", training);\r\n\t\tfinal Node root = new Node(null, \"/\", null, Node.OPERATOR);\r\n\t\tfinal Tree newTree = new Tree(root, new TerminalSet(),\r\n\t\t\t\tnew FunctionalSet());\r\n\t\tfinal Node minusOperator = new Node(root, \"-\", Node.LEFT, Node.OPERATOR);\r\n\t\tnewTree.addNode(minusOperator);\r\n\t\tfinal Node multiOperator = new Node(root, \"*\", Node.RIGHT,\r\n\t\t\t\tNode.OPERATOR);\r\n\t\tnewTree.addNode(multiOperator);\r\n\t\tnewTree.addNode(new Node(minusOperator, \"1\", Node.LEFT, Node.OPERAND));\r\n\t\tnewTree.addNode(new Node(minusOperator, \"3\", Node.RIGHT, Node.OPERAND));\r\n\t\tnewTree.addNode(new Node(multiOperator, \"x\", Node.LEFT, Node.OPERAND));\r\n\t\tnewTree.addNode(new Node(multiOperator, \"5\", Node.RIGHT, Node.OPERAND));\r\n\t\tassertEquals(\"Tree did not get generated corectly\", \"(1-3)/(x*5)\",\r\n\t\t\t\tnewTree.getEquation().toString());\r\n\t\tfinal Node root2 = new Node(null, \"/\", null, Node.OPERATOR);\r\n\t\tfinal Tree newTree2 = new Tree(root2, new TerminalSet(),\r\n\t\t\t\tnew FunctionalSet());\r\n\t\tfinal Node minusOperator2 = new Node(root2, \"-\", Node.LEFT,\r\n\t\t\t\tNode.OPERATOR);\r\n\t\tnewTree2.addNode(minusOperator2);\r\n\t\tfinal Node multiOperator2 = new Node(root2, \"*\", Node.RIGHT,\r\n\t\t\t\tNode.OPERATOR);\r\n\t\tnewTree2.addNode(multiOperator2);\r\n\t\tnewTree2\r\n\t\t\t\t.addNode(new Node(minusOperator2, \"x\", Node.LEFT, Node.OPERAND));\r\n\t\tnewTree2\r\n\t\t\t\t.addNode(new Node(minusOperator2, \"7\", Node.RIGHT, Node.OPERAND));\r\n\t\tnewTree2\r\n\t\t\t\t.addNode(new Node(multiOperator2, \"8\", Node.LEFT, Node.OPERAND));\r\n\t\tnewTree2\r\n\t\t\t\t.addNode(new Node(multiOperator2, \"9\", Node.RIGHT, Node.OPERAND));\r\n\t\tassertEquals(\"Tree did not get generated corectly\", \"(x-7)/(8*9)\",\r\n\t\t\t\tnewTree2.getEquation().toString());\r\n\r\n\t\tfinal Node root3 = new Node(null, \"/\", null, Node.OPERATOR);\r\n\t\tfinal Tree newTree3 = new Tree(root3, new TerminalSet(),\r\n\t\t\t\tnew FunctionalSet());\r\n\t\tfinal Node minusOperator3 = new Node(root3, \"-\", Node.LEFT,\r\n\t\t\t\tNode.OPERATOR);\r\n\t\tnewTree3.addNode(minusOperator3);\r\n\t\tfinal Node multiOperator3 = new Node(root3, \"*\", Node.RIGHT,\r\n\t\t\t\tNode.OPERATOR);\r\n\t\tnewTree3.addNode(multiOperator3);\r\n\t\tfinal Node multiOperator4 = new Node(multiOperator3, \"*\", Node.LEFT,\r\n\t\t\t\tNode.OPERATOR);\r\n\t\tnewTree3.addNode(multiOperator4);\r\n\t\tfinal Node multiOperator5 = new Node(multiOperator3, \"*\", Node.RIGHT,\r\n\t\t\t\tNode.OPERATOR);\r\n\t\tnewTree3.addNode(multiOperator5);\r\n\t\tnewTree3\r\n\t\t\t\t.addNode(new Node(minusOperator3, \"x\", Node.LEFT, Node.OPERAND));\r\n\t\tnewTree3\r\n\t\t\t\t.addNode(new Node(minusOperator3, \"7\", Node.RIGHT, Node.OPERAND));\r\n\t\tnewTree3\r\n\t\t\t\t.addNode(new Node(multiOperator4, \"1\", Node.LEFT, Node.OPERAND));\r\n\t\tnewTree3\r\n\t\t\t\t.addNode(new Node(multiOperator4, \"2\", Node.RIGHT, Node.OPERAND));\r\n\t\tnewTree3\r\n\t\t\t\t.addNode(new Node(multiOperator5, \"3\", Node.LEFT, Node.OPERAND));\r\n\t\tnewTree3\r\n\t\t\t\t.addNode(new Node(multiOperator5, \"4\", Node.RIGHT, Node.OPERAND));\r\n\t\tassertEquals(\"Tree did not get generated corectly\",\r\n\t\t\t\t\"(x-7)/(1*2)*(3*4)\", newTree3.getEquation().toString());\r\n\t\tfinal ArrayList<Tree> newTrees = new ArrayList<Tree>();\r\n\t\tnewTrees.add(newTree3);\r\n\t\tnewTrees.add(newTree2);\r\n\t\tnewTrees.add(newTree);\r\n\t\tassertEquals(\"Tree should have a size of 3 before the cross\", 3,\r\n\t\t\t\tnewTrees.size());\r\n\t\tCrossover.cross(newTrees, 1, 100, training, targetValues);\r\n\t\tfinal Iterator<Tree> iterator = newTrees.iterator();\r\n\t\twhile (iterator.hasNext()) {\r\n\t\t\t// All five trees should be different\r\n\t\t\tfinal String firstTree = iterator.next().toString();\r\n\t\t\tassertNotSame(\"Cross should change the tree but did not 1\",\r\n\t\t\t\t\tfirstTree, iterator.next().toString());\r\n\t\t\tassertNotSame(\"Cross should change the tree but did not 2\",\r\n\t\t\t\t\tfirstTree, iterator.next().toString());\r\n\t\t\tassertNotSame(\"Cross should change the tree but did not 3\",\r\n\t\t\t\t\tfirstTree, iterator.next().toString());\r\n\t\t\tassertNotSame(\"Cross should change the tree but did not 4\",\r\n\t\t\t\t\tfirstTree, iterator.next().toString());\r\n\t\t}\r\n\t\t// should be 5 trees after the crossover\r\n\t\tassertEquals(\"Tree should have a size of 5 but was not\", 5, newTrees\r\n\t\t\t\t.size());\r\n\t}", "public static double getCrossoverProbability() { return crossoverProbability; }", "private Pair<Integer, Integer> genRandomSrcDst(){\n int src = (int)(Math.random()*nodesNum);\n int dst = src;\n do {\n dst = (int)(Math.random()*nodesNum);\n }while(dst == src);\n return new Pair<Integer, Integer>(src, dst);\n }", "public void generateOffspringPopulation() throws JMException{\n\n offspringPopulation_ = new SolutionSet[problemSet_.size()];\n\n for (int task = 0; task < problemSet_.size(); task++){\n offspringPopulation_[task] = new SolutionSet(populationSize_);\n if (crossover_.getClass() == SBXCrossover.class){\n Solution[] parents = new Solution[2];\n for (int i = 0; i < (populationSize_); i++) {\n // obtain parents\n parents = (Solution[]) selection_.execute(population_[task]);\n\n Solution[] offSpring = (Solution[]) crossover_\n .execute(parents);\n mutation_.execute(offSpring[0]);\n problemSet_.get(task).evaluate(offSpring[0]);\n problemSet_.get(task).evaluateConstraints(offSpring[0]);\n offspringPopulation_[task].add(offSpring[0]);\n } // for\n }\n else if (crossover_.getClass() == EGG.class){\n\n int[] permutation = new int[populationSize_];\n Utils.randomPermutation(permutation, populationSize_);\n etmo.util.Ranking ranking = new etmo.util.Ranking(population_[task]);\n SolutionSet front = ranking.getSubfront(0);\n\n front.Suppress();\n SolutionSet KP = null;\n if(front.size()> problemSet_.get(task).getNumberOfObjectives())\n KP = findingKneePoint(front, task);\n if(KP == null){\n KP = population_[task];\n }\n\n for (int i = 0; i < (populationSize_); i++) {\n // obtain parents\n int n = permutation[i];\n // STEP 2.1. Mating selection\n int r1,r2;\n r1 = PseudoRandom.randInt(0, KP.size() - 1);\n do {\n r2 = PseudoRandom.randInt(0, KP.size() - 1);\n } while (r2==r1);\n // STEP 2.2. Reproduction\n Solution child;\n Solution[] parents = new Solution[3];\n\n// 加入迁移:\n double tranRand = PseudoRandom.randDouble();\n if (tranRand <= 0.1){\n parents[1] = population_[PseudoRandom.randInt(0, problemSet_.size() - 1)].get(PseudoRandom.randInt(0, populationSize_ - 1));\n parents[2] = population_[PseudoRandom.randInt(0, problemSet_.size() - 1)].get(PseudoRandom.randInt(0, populationSize_ - 1));\n parents[0] = population_[task].get(n);\n child = (Solution) crossover_.execute(parents);\n\n mutation_.execute(child);\n\n problemSet_.get(task).evaluate(child);\n problemSet_.get(task).evaluateConstraints(child);\n offspringPopulation_[task].add(child);\n }\n\n\n\n else {\n parents[1] = KP.get(r1);\n parents[2] = KP.get(r2);\n parents[0] = population_[task].get(n);\n child = (Solution) crossover_.execute(parents);\n\n mutation_.execute(child);\n\n problemSet_.get(task).evaluate(child);\n problemSet_.get(task).evaluateConstraints(child);\n offspringPopulation_[task].add(child);\n }\n\n\n } // for\n }\n\n }\n\n\n\n\n }", "private double cross(Point A, Point B, Point C) {\n\t\tdouble AB_X = B.x - A.x;\n\t\tdouble AB_Y = B.y - A.y;\n\t\tdouble AC_X = C.x - A.x;\n\t\tdouble AC_Y = C.y - A.y;\n\t\tdouble cross = AB_X * AC_Y - AB_Y * AC_X;\n\t\treturn cross;\n\t}", "void generate() {\n rouletteSelection();\n do {\n updateParents();\n crossover();\n mutation();\n } while (!isValidOffset());\n insertOffspring();\n }", "public TesteCrossover() {\n initComponents();\n }", "private Vector step(){\n// System.out.println();\n// System.out.println(generationCount);\n// System.out.println(\"The Population is:\");\n// System.out.println(population);\n \n //DETERMINE WHO SURVIVES INTO NEXT GENERATION\n Vector nextGeneration = surviveType.run(population, fitnessArray);\n\n //DO THE CROSSOVER PROCESS\n //WHILE THE NEXT GENERATION ISN'T FULL\n while (nextGeneration.size() < (populationSize - randGenes)){\n //FIND PARENTS\n Gene parentOne, parentTwo;\n do {\n Gene[] parents = selectType.run(population, fitnessArray);\n parentOne = parents[0];\n parentTwo = parents[1];\n } while (selectPairs && (! closeEnough(parentOne, parentTwo)));\n //ADD CHILDREN\n Gene[] kids = crossType.children(parentOne, parentTwo);\n\n nextGeneration.add(kids[0]);\n if (nextGeneration.size() < (populationSize - randGenes)){\n nextGeneration.add(kids[1]);\n }\n }\n //ADD RANDOM GENES TO THE POPULATION\n while (nextGeneration.size() < populationSize){\n nextGeneration.add(initializer.createRandomGene(fitnessFunction, minRadius, maxRadius));\n }\n //MUTATE THE NEXT GENERATION\n for (int j = 0; j < populationSize; j++){\n if (Math.random() < mutationProb){\n nextGeneration.set(j, mutationType.run((Gene) nextGeneration.get(j)));\n }\n }\n\n //COMPUTE FITNESSES AND RELOCATE IF NECESSARY\n Gene bestGene = (Gene) nextGeneration.get(0);\n int bestX = 0;\n for (int x = 0; x < populationSize; x++){\n Gene next = (Gene) nextGeneration.get(x);\n while (relocationType.move(bannedList, next)){\n Gene newGene = initializer.createRandomGene(fitnessFunction, minRadius, maxRadius);\n next = newGene;\n nextGeneration.set(x, next);\n }\n fitnessArray[x] = next.getFitness();\n\n //FOR THE PURPOSES OF UPDATING THE BANNED LIST\n if (next.getFitness() > bestGene.getFitness()){\n bestGene = next;\n bestX = x;\n }\n } //End for (int x = 0;...\n\n Arrays.sort(fitnessArray);\n\n //UPDATE THE BANNED LIST BY ADDING THE BEST GENE IN THE NEXT GENERATION IF IT'S ABOVE minAccepted AND CONTAINS MORE THAN minPoints POINTS\n if (useList){\n if ((generationCount >= firstAdd) &&\n (solutionCounter >= countNum) &&\n (bestGene.getFitness() >= minAccepted) &&\n (bestGene.getCount() >= minPoints)){\n solutionCounter = 0;\n// System.out.println(bestGene);\n Gene bestClone = new Gene (bestGene.getMajorAxisRadius(), //THIS KLUDGE IS DONE B/C .clone() IS\n bestGene.getMinorAxisRadius(), //PROTECTED, AND I CAN'T UNPROTECT IT.\n bestGene.getX(), //I USE A CLONED GENE TO PREVENT A MUTATION\n bestGene.getY(), //IN THE NEXT GENERATION FROM ALTERING bannedList\n bestGene.getOrientation(),\n bestGene.getFunction());\n bannedList = relocationType.updateBannedList(bannedList, bestClone);\n\n\n //IF NECESSARY, UPDATE THE SOLUTION LIST BY ADDING ALL CLUSTERS WITH MORE THAN minPoints POINTS AND A FITNESS OF AT LEAST minAccepted\n if (returnAllSolutions){\n for (int i = 0; i < populationSize; i++){\n Gene next = (Gene) nextGeneration.get(i);\n if ((next.getFitness() >= minAccepted) && (next.getCount() >= minPoints)){\n solutionList.add(next);\n }\n }//End for (int i = 0...\n } else {\n solutionList = bannedList;\n } //End if (returnAllSolutions){...}else{\n } //End if (generationCount > 4...\n } //End if (useList){\n\n generationCount = generationCount + 1;\n solutionCounter = solutionCounter + 1;\n\n //IF AVOIDING CONVERGENCE, AND IT HAS CONVERGED, START OVER WITH RANDOM GENES\n\n double bestFitness = bestGene.getFitness();\n double medianFitness = roundToHundredths((double) fitnessArray[(int) Math.floor(populationSize / 2)]);\n\n// System.out.println(bestFitness);\n// System.out.println(medianFitness);\n\n if ((antiConvergence) &&\n ((bestFitness - medianFitness) < (0.01 * bestFitness)) &&\n (generationCount > firstAdd)){\n nextGeneration = initializer.getGenes(populationSize, fitnessFunction, minRadius, maxRadius);\n// System.out.println(\"EXPLODED CONVERGENCE!\");\n for (int x = 0; x < populationSize; x++){\n Gene next = (Gene) nextGeneration.get(x);\n fitnessArray[x] = next.getFitness();\n }\n Arrays.sort(fitnessArray);\n }\n\n return nextGeneration;\n }", "IVec3 cross(IVec3 v);", "public MidiIndividual crossover(MidiIndividual that)\r\n\t{\n\t\tassert this.size() == that.size();\r\n\r\n\t\tVector<MidiIndividualTrack> newIndividualTracks = \r\n\t\t\tnew Vector<MidiIndividualTrack>();\r\n\r\n\t\tfor (int i = 0; i < midiIndividualTracks.size(); i++)\r\n\t\t{\r\n\t\t\tMidiIndividualTrack newIndv = \r\n\t\t\t\tthis.getIndividualTrack(i).crossover(that.getIndividualTrack(i));\r\n\t\t\tnewIndividualTracks.add(newIndv);\r\n\t\t}\r\n\r\n\t\treturn new MidiIndividual(newIndividualTracks);\r\n\t}", "private <T> List<Chromosome<T>> breedNewGeneration(List<Chromosome<T>> chromosomes){\n\t\tList<Chromosome<T>> selected = selection.apply(chromosomes);\n\t\tCollections.shuffle(selected);\n\n\t\tList<Chromosome<T>> crossedOver = Lists.newArrayList();\n\t\tfor(int i = 0; i < selected.size(); i+=2){\n\t\t\tChromosome<T>[] bred = crossover.apply(selected.get(i), selected.get(i+1));\n\t\t\tcrossedOver.add(bred[0]);\n\t\t\tcrossedOver.add(bred[1]);\n\t\t}\n\n\t\treturn crossedOver.stream().map(mutation::apply).collect(Collectors.toList());\n\t}", "private void crossProduct() {\n BaseCandidateElement[] it = o.inputObject.firstStageCandidates.values().toArray(new BaseCandidateElement[0]);\n // logger.info(Arrays.toString(it));\n for (int i = 0; i < it.length; i++) {\n for (int j = i + 1; j < it.length; j++) {\n if (PrecisConfigProperties.HIERARCHY_DIMS_ENABLED && hierarchyDimsNegation.checkIfBelongToSameHierarchyGroup(it[i], it[j]))\n continue;\n if (it[i].xor(it[j]).cardinality() == 4) {\n BitSet b = it[i].or(it[j]);\n o.inputObject.addCandidate(b);\n }\n }\n }\n }", "public static Data crossover(Data d1, Data d2, int x) {\n try {\n if (d1.numberOfBytes() != d2.numberOfBytes())\n throw new Exception(\"Data crossover is impossible between two Data objects having different byte length\");\n if (x < 0 || x > d1.numberOfBits())\n throw new Exception(\"Pivot point in crossover is out of bounds (0<=\" + x + \"<\" + d1.numberOfBits() + \")\");\n } catch (Exception e) {\n e.printStackTrace();\n System.exit(1);\n }\n\n int bitx = x % 8;\n int bytex = x / 8;\n int n = d1.numberOfBytes();\n int m = d1.numberOfBits();\n\n ArrayList<Object> bytelist = new ArrayList<Object>(n);\n for (int i = 0; i < bytex; i++) bytelist.add(d1.getByte(i));\n int b1 = 0;\n for (int k = 0; k < bitx; k++) b1 = b1 + (1 << (7 - k));\n int b2 = 0;\n for (int k = bitx; k < 8; k++) b2 = b2 + (1 << (7 - k));\n int middle = (b1 & d1.getByte(bytex)) + (b2 & d2.getByte(bytex));\n byte bmiddle = (byte) middle;\n bytelist.add(bmiddle);\n for (int i = bytex + 1; i < n; i++) bytelist.add(d2.getByte(i));\n\n return new Data(bytelist);\n }", "private void tournament_selection() {\r\n\r\n individual[] temp_pop = new individual[this.pop_size];\r\n\r\n for (int i = 0; i < this.pop_size; i++) {\r\n\r\n // pick 2 random ints to for indices of parents\r\n int parent1 = new Random().nextInt(this.pop_size);\r\n int parent2 = new Random().nextInt(this.pop_size);\r\n\r\n individual p1 = new individual(main_population.getPopulation()[parent1].getGenes(), solutions, output);\r\n individual p2 = new individual(main_population.getPopulation()[parent2].getGenes(), solutions, output);\r\n\r\n if (p1.getFitness() >= p2.getFitness()) {\r\n temp_pop[i] = p1;\r\n } else {\r\n temp_pop[i] = p2;\r\n }\r\n }\r\n this.main_population.setPopulation(temp_pop);\r\n this.main_population.update_population();\r\n }", "protected void randomStep() {\n\t\tint n = curNode.getDegree();\n\t\tint r = 0;\n\n\t\tif (n > 0) {\n\t\t\tr = ctx.random().nextInt(n);\n\n\t\t\tAntCo2Edge curEdge = (AntCo2Edge) curNode.getEdge(r);\n\n\t\t\tassert curEdge != null : \"found no edge\";\n\n\t\t\tcross(curEdge, true);\n\t\t}\n\t}", "public void setCrossoverMethod(Crossover c){\n crossType = c;\n }", "public EdgeCrosser(S2Point a, S2Point b) {\n init(a, b);\n }", "private ClusterCombination checkAndDoJoinMultiPearson(ClusterCombination CC1, ClusterCombination CC2) {\n boolean doJoin = true;\r\n ArrayList<Cluster> CCList = new ArrayList<>(CC1.getClusters().size()+1); //list of output clusters for new CC if join is succesfull\r\n\r\n ArrayList<Cluster> CC1Clusters = CC1.getClusters();\r\n ArrayList<Cluster> CC2Clusters = CC2.getClusters();\r\n\r\n ArrayList<Cluster> LHS1 = CC1.getLHS();\r\n ArrayList<Cluster> LHS2 = CC2.getLHS();\r\n\r\n ArrayList<Cluster> RHS1 = CC1.getRHS();\r\n ArrayList<Cluster> RHS2 = CC2.getRHS();\r\n\r\n for(int i =0; i<CC1Clusters.size()-1; i++) {\r\n Cluster C1 = CC1Clusters.get(i);\r\n Cluster C2 = CC2Clusters.get(i);\r\n\r\n boolean overlap = checkClusterOverlap(C1, C2); // check if there is some overlap\r\n\r\n\r\n\r\n if(!overlap){ //the cluster in this position does not overlap, we don't need to join\r\n doJoin=false;\r\n break;\r\n }else{ // there is overlap, add the intersection of C1 and C2\r\n if(C1.getNPoints() <= C2.getNPoints()){\r\n CCList.add(C1);\r\n }else{\r\n CCList.add(C2);\r\n }\r\n\r\n }\r\n\r\n\r\n }\r\n\r\n\r\n if(doJoin){ // each cluster in the candidate (except the last) does overlap\r\n // so, according to apriori, we join -> return the overlapping clusters + the last clusters of CC1 and CC2\r\n Cluster lastCC1 = CC1Clusters.get(CC1Clusters.size()-1);\r\n Cluster lastCC2 = CC2Clusters.get(CC2Clusters.size()-1);\r\n if(lastCC1.getClusterId() <= lastCC2.getClusterId()){ // make sure to respect ordering of clusters within a candidate by ID. otherwise this could be designated as a duplicate\r\n CCList.add(lastCC1); CCList.add(lastCC2);\r\n }else{\r\n CCList.add(lastCC2); CCList.add(lastCC1);\r\n }\r\n\r\n ArrayList<Cluster> newLHS = new ArrayList<>();\r\n ArrayList<Cluster> newRHS = new ArrayList<>();\r\n for(int i = 0; i<LHS1.size(); i++){\r\n newLHS.add(CCList.get(i));\r\n }\r\n for(int i = LHS1.size(); i<CCList.size(); i++){\r\n newRHS.add(CCList.get(i));\r\n }\r\n\r\n ClusterCombination newCC = new MultiPearsonClusterCombination(newLHS, newRHS);\r\n newCC.checkAndSetMaxSubsetLowerBound(Math.max(CC1.getLB(), CC1.getMaxLowerBoundSubset()));\r\n newCC.checkAndSetMaxSubsetLowerBound(Math.max(CC2.getLB(), CC2.getMaxLowerBoundSubset()));\r\n\r\n return newCC;\r\n\r\n }else{\r\n return null;\r\n }\r\n }", "static double cross(Vec a, Vec b) {\n return a.x * b.y - a.y * b.x;\n }", "private static double crossProduct(Point2D a, Point2D b) {\r\n return a.getX() * b.getY() - b.getX() * a.getY();\r\n }", "public void croisements(double probability) {\n\t\tRandom rand = new Random();\n\t\tint nbCroisements = rand.nextInt(10);\n\t\tfor (int i = 0; i < nbCroisements; i++) {\n\t\t\tint index1 = 0, index2 = 0;\n\t\t\twhile(index1 == index2) {\n\t\t\t\tindex1 = rand.nextInt(this.individus.size());\n\t\t\t\tindex2 = rand.nextInt(this.individus.size());\n\t\t\t}\n\t\t\tif(rand.nextDouble() <= probability) {\n\t\t\t\tthis.individus.get(index1).cross(this.individus.get(index2));\n\t\t\t}\n\t\t}\n\t}", "@Override\n\t// Select individuals for crossover\n\tprotected Individual tournamentSelection(Population pop) {\n\t\tSortingIndividual baseIndiv = (SortingIndividual) pop.individuals[0];\n\t\tPopulation tournament = new SortingPopulation(tournamentSize, baseIndiv.getBase(), false);\n\t\t// For each place in the tournament get a random individual\n\t\tfor (int i = 0; i < tournamentSize; i++) {\n\t\t\tint randomId = (int) (Math.random() * pop.size());\n\t\t\ttournament.saveIndividual(i, pop.getIndividual(randomId));\n\t\t}\n\t\t// Get the fittest\n\t\tIndividual fittest = tournament.getFittest();\n\t\treturn fittest;\n\t}", "public void\n\tcrossProduct( Vector3 other )\n\t{\n\t\tdouble x;\n\t\tdouble y;\n\n\t\tx = ( data[1] * other.data[2] ) - ( data[2] * other.data[1] );\n\t\ty = ( data[2] * other.data[0] ) - ( data[0] * other.data[2] );\n\t\tdata[2] = ( data[0] * other.data[1] ) - ( data[1] * other.data[0] );\n\t\tdata[0] = x;\n\t\tdata[1] = y;\n\t}", "private void phaseTwo(){\r\n\r\n\t\tCollections.shuffle(allNodes, random);\r\n\t\tList<Pair<Node, Node>> pairs = new ArrayList<Pair<Node, Node>>();\r\n\t\t\r\n\t\t//For each node in allNode, get all relationshpis and iterate through each relationship.\r\n\t\tfor (Node n1 : allNodes){\r\n\r\n\t\t\ttry (Transaction tx = graphDb.beginTx()){\r\n\t\t\t\t//If a node n1 is related to any other node in allNodes, add those relationships to rels.\r\n\t\t\t\t//Avoid duplication, and self loops.\r\n\t\t\t\tIterable<Relationship> ite = n1.getRelationships(Direction.BOTH);\t\t\t\t\r\n\r\n\t\t\t\tfor (Relationship rel : ite){\r\n\t\t\t\t\tNode n2 = rel.getOtherNode(n1);\t//Get the other node\r\n\t\t\t\t\tif (allNodes.contains(n2) && !n1.equals(n2)){\t\t\t\t\t//If n2 is part of allNodes and n1 != n2\r\n\t\t\t\t\t\tif (!rels.contains(rel)){\t\t\t\t\t\t\t\t\t//If the relationship is not already part of rels\r\n\t\t\t\t\t\t\tPair<Node, Node> pA = new Pair<Node, Node>(n1, n2);\r\n\t\t\t\t\t\t\tPair<Node, Node> pB = new Pair<Node, Node>(n2, n1);\r\n\r\n\t\t\t\t\t\t\tif (!pairs.contains(pA)){\r\n\t\t\t\t\t\t\t\trels.add(rel);\t\t\t\t\t\t\t\t\t\t\t//Add the relationship to the lists.\r\n\t\t\t\t\t\t\t\tpairs.add(pA);\r\n\t\t\t\t\t\t\t\tpairs.add(pB);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\ttx.success();\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn;\r\n\t}", "private void generateSquarePartners() {\r\n\t\t// 2 copies of each end point,\r\n\t\t// which will be \"shifted\" to simulate the 2 adjacent squares\r\n\t\tint[] point1Shift1 = Arrays.copyOf(point1, 2);\r\n\t\tint[] point1Shift2 = Arrays.copyOf(point1, 2);\r\n\t\tint[] point2Shift1 = Arrays.copyOf(point2, 2);\r\n\t\tint[] point2Shift2 = Arrays.copyOf(point2, 2);\r\n\t\t\r\n\t\t// used to indicate the orientation of the Line and which axis needs to be shifted\r\n\t\t// 0 == vertical, 1 == horizontal\r\n\t\tint index;\r\n\t\t\r\n\t\tif (point1[0] == point2[0]) {\r\n\t\t\tindex = 0;\r\n\t\t} else {\r\n\t\t\tindex = 1;\r\n\t\t}\r\n\t\t\r\n\t\tif (point1[index] - 1 > 0) {\r\n\t\t\t// square1Partners form the square to the left or above *this* Line\r\n\t\t\t// so shifted points get decremented\r\n\t\t\tpoint1Shift1[index] = point1[index] - 1;\r\n\t\t\tpoint2Shift1[index] = point2[index] - 1;\r\n\t\t\t\r\n\t\t\tsquare1Partners.add(new Line(point1, point1Shift1));\r\n\t\t\tsquare1Partners.add(new Line(point1Shift1, point2Shift1));\r\n\t\t\tsquare1Partners.add(new Line(point2Shift1, point2));\r\n\t\t}\r\n\t\tif (point1[index] + 1 < boardSize) {\r\n\t\t\t// square2Partners form the square to the right or below *this* Line\r\n\t\t\t// so shifted points get incremented\r\n\t\t\tpoint1Shift2[index] = point1[index] + 1;\r\n\t\t\tpoint2Shift2[index] = point2[index] + 1;\r\n\t\t\t\r\n\t\t\tsquare2Partners.add(new Line(point1, point1Shift2));\r\n\t\t\tsquare2Partners.add(new Line(point1Shift2, point2Shift2));\r\n\t\t\tsquare2Partners.add(new Line(point2Shift2, point2));\r\n\t\t}\r\n\t}", "public void crossInto(final WB_Point3d p, final WB_Normal3d result) {\r\n\t\tresult.x = y * p.z - z * p.y;\r\n\t\tresult.y = z * p.x - x * p.z;\r\n\t\tresult.z = x * p.y - y * p.x;\r\n\t}", "public interface MonogamousCrossover {\r\n\r\n\tpublic Embryo mate(Individual mother, Individual father);\r\n}", "public static void cross(LogicProblem logicProblem, boolean applyChanges) \r\n throws RelationshipConflictException {\r\n// System.out.println(\"cross invoked\");\r\n HashMap<ItemPair,Relationship> relationshipTable = logicProblem.getRelationshipTable();\r\n\r\n HashSet<CategoryPair> categoryPairs = logicProblem.getCategoryPairs();\r\n \r\n for (CategoryPair categoryPair : categoryPairs) {\r\n //for (Category cat1 : logicProblem.getCategories()){\r\n // for (Category cat2 : logicProblem.getCategories()){\r\n // if (cat1!=cat2) {\r\n Category cat1 = categoryPair.first();\r\n Category cat2 = categoryPair.last();\r\n\r\n \r\n //for (Category cat1 : logicProblem.getCategories()){\r\n // for (Category cat2 : logicProblem.getCategories()){\r\n // if (cat1!=cat2) {\r\n for (Item item1 : cat1.getItems()){\r\n for (Item item2 : cat2.getItems()){\r\n Relationship sourceRelationship = relationshipTable.get(new ItemPair(item1,item2));\r\n if (sourceRelationship.getValue()==Relationship.ValueType.VALUE_YES) {\r\n// System.out.println(\"discovered VALUE_YES, setting up the cross\");\r\n for (Item itemA : cat1.getItems()){\r\n if (itemA != item1) {\r\n Relationship rel = relationshipTable.get(new ItemPair(itemA,item2));\r\n // could track superfluous and conflicts here\r\n if (rel.getValue() == Relationship.ValueType.VALUE_UNKNOWN) {\r\n Processor.setRelationship(logicProblem, applyChanges, rel, \r\n Relationship.ValueType.VALUE_NO,\r\n Relationship.LogicType.CROSS, sourceRelationship);\r\n// rel.setValue(Relationship.ValueType.VALUE_NO,Relationship.LogicType.CROSS,sourceRelationship);\r\n// System.out.println(\"created VALUE_NO relationship between \"+itemA.getName()+\" and \"+item2.getName()+ \" (CROSS)\");\r\n }\r\n }\r\n }\r\n for (Item itemB : cat2.getItems()){\r\n if (itemB != item2) {\r\n Relationship rel = relationshipTable.get(new ItemPair(item1,itemB));\r\n // could track superfluous and conflicts here\r\n if (rel.getValue() == Relationship.ValueType.VALUE_UNKNOWN) {\r\n Processor.setRelationship(logicProblem, applyChanges, rel, \r\n Relationship.ValueType.VALUE_NO,\r\n Relationship.LogicType.CROSS, sourceRelationship);\r\n// rel.setValue(Relationship.ValueType.VALUE_NO,Relationship.LogicType.CROSS,sourceRelationship);\r\n// System.out.println(\"created VALUE_NO relationship between \"+item1.getName()+\" and \"+itemB.getName()+ \" (CROSS)\");\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }", "public void touchToScatter() {\n for (int i = 0; i < pointCount; i++) {\n int speedX = random.nextInt(2 * speedXBarrier) - speedXBarrier;\n int speedY = random.nextInt(2 * speedYBarrier) - speedYBarrier;\n points.get(i).setSpeedX(speedX);\n points.get(i).setSpeedY(speedY);\n }\n }", "public EdgeCrosser(S2Point a, S2Point b, S2Point c) {\n this(a, b);\n restartAt(c);\n }", "public Point3D cross(Point3D p) {\n\t\treturn new Point3D(\n\t\t\t\tthis.y*p.z - this.z*p.y, \n\t\t\t\tthis.z*p.x - this.x*p.z, \n\t\t\t\tthis.x*p.y - this.y*p.x);\n\t}", "private ArrayList<Chromosome> selectParentsTournament() {\n ArrayList<Chromosome> parents = new ArrayList<Chromosome>(Defines.crossoverParentCt);\n ArrayList<Chromosome> matingPool = new ArrayList<Chromosome>(Defines.crossoverParentCt);\n\n // Run tournaments to select parents - for each parent\n for (int parentIdx = 0; parentIdx < Defines.crossoverParentCt; parentIdx++) {\n\n // Run tournaments - get random contestants (run.getPaTournamentSize())\n for (int tournIdx = 0; tournIdx < Defines.tournamentSize; tournIdx++) {\n int contestantID = Defines.randNum(0, this.chromosomes.size() - 1);\n matingPool.add(this.chromosomes.get(contestantID));\n }\n Collections.sort(matingPool);\n parents.add(matingPool.get(0));\n }\n\n return parents;\n }", "private Point[] moveCars(ParkingLot p)\r\n {\r\n ArrayList<Point> emptySpots = new ArrayList<>();\r\n ArrayList<Point> oneSpotTaken = new ArrayList<>();\r\n for(int i = 0; i < p.getTotalRow(); i++){\r\n for(int j = 0; j < p.getTotalColumn(); j++){\r\n if(!p.getOccupany(i,j)){\r\n emptySpots.add(new Point(i,j));\r\n }else{\r\n if(p.getSpotInfo(i,j).getVehicle().getSpotsTaken() == 1){\r\n oneSpotTaken.add(new Point(i,j));\r\n }\r\n }\r\n }\r\n }\r\n\r\n if(oneSpotTaken.size() <= 1){\r\n System.out.println(\"There are not enough spots in this lot to park this car.\");\r\n return null;\r\n }\r\n\r\n Random rand = new Random();\r\n Point randomPoint = emptySpots.get(rand.nextInt(emptySpots.size()));\r\n\r\n if(((int)randomPoint.getY()-1) >= 0 && oneSpotTaken.contains(new Point((int)randomPoint.getX(),(int)randomPoint.getY()-1))){\r\n emptySpots.remove(randomPoint);\r\n Point newEmpty = emptySpots.get(rand.nextInt(emptySpots.size()));\r\n p.setSpot((int)newEmpty.getX(),(int)newEmpty.getY(),p.getSpotInfo((int)randomPoint.getX(),(int)randomPoint.getY()-1));\r\n p.setSpot((int)randomPoint.getX(),(int)randomPoint.getY()-1,null);\r\n return new Point[]{new Point((int)randomPoint.getX(),((int)randomPoint.getY()-1)),randomPoint};\r\n }else if((int)randomPoint.getY()+1 <= p.getTotalColumn()-1 && oneSpotTaken.contains(new Point((int)randomPoint.getX(),(int)randomPoint.getY()+1))){\r\n emptySpots.remove(randomPoint);\r\n Point newEmpty = emptySpots.get(rand.nextInt(emptySpots.size()));\r\n p.setSpot((int)newEmpty.getX(),(int)newEmpty.getY(),p.getSpotInfo((int)randomPoint.getX(),(int)randomPoint.getY()+1));\r\n p.setSpot((int)randomPoint.getX(),(int)randomPoint.getY()+1,null);\r\n return new Point[]{randomPoint,new Point((int)randomPoint.getX(),((int)randomPoint.getY()+1))};\r\n }else{\r\n return moveCars(p);\r\n }\r\n }", "Point getRandomPoint() {\n\t\t\t\t\tdouble val = Math.random() * 3;\n\t\t\t\t\tif (val >=0.0 && val <1.0)\n\t\t\t\t\t\treturn p1;\n\t\t\t\t\telse if (val >=1.0 && val <2.0)\n\t\t\t\t\t\t\treturn p2;\n\t\t\t\t\telse\n\t\t\t\t\t\t\treturn p3;\n\t\t\t\t\t}", "protected DNA NEATcross(DNA other) {\n\t\tDNA hifit;\n\t\tDNA lofit;\n\n\t\tif (this.fitness == null || other.fitness == null)\n\t\t\treturn null;\n\n\t\tDNA ret = new DNA(population, false);\n\n\t\t// Choose the genome with the higher fitness\n\t\tif (this.fitness > other.fitness) {\n\t\t\thifit = this;\n\t\t\tlofit = other;\n\t\t} else {\n\t\t\thifit = this;\n\t\t\tlofit = other;\n\t\t}\n\n\t\t// Populate gene list of ret\n\t\tfor (Integer i : hifit.getInnovations()) {\n\t\t\tGene submission;\n\t\t\tif (!lofit.hasGene(i)) {\n\t\t\t\tsubmission = hifit.getGene(i);\n\t\t\t} else {\n\t\t\t\tGene newgene;\n\t\t\t\tif (Braincraft\n\t\t\t\t\t\t.randomChance(population.inheritFromHigherFitRate))\n\t\t\t\t\tnewgene = new Gene(hifit.getGene(i));\n\t\t\t\telse\n\t\t\t\t\tnewgene = new Gene(lofit.getGene(i));\n\t\t\t\tif (!hifit.getGene(i).enabled || !lofit.getGene(i).enabled) {\n\t\t\t\t\tif (Braincraft.randomChance(population.disabledRate))\n\t\t\t\t\t\tnewgene.enabled = false;\n\t\t\t\t\telse\n\t\t\t\t\t\tnewgene.enabled = true;\n\t\t\t\t}\n\t\t\t\tsubmission = newgene;\n\t\t\t}\n\t\t\tif (!ret.hasNode(submission.start)) {\n\t\t\t\tret.submitNewNode(hifit.getNode(submission.start));\n\t\t\t}\n\t\t\tif (!ret.hasNode(submission.end)) {\n\t\t\t\tret.submitNewNode(hifit.getNode(submission.end));\n\t\t\t}\n\t\t\tret.submitNewGene(submission);\n\t\t}\n\n\t\tif (Braincraft.randomChance(population.weightMutationRate))\n\t\t\tret.mutateWeights();\n\t\tif (Braincraft.randomChance(population.linkMutationRate))\n\t\t\tret.mutateAddLink();\n\t\tif (Braincraft.randomChance(population.nodeMutationRate))\n\t\t\tret.mutateAddNode();\n\t\tif (Braincraft.randomChance(population.linkDisableRate))\n\t\t\tret.mutateDisableLink();\n\n\t\treturn ret;\n\t}", "public static void crossValidation() {\n\t\t\n\t\t//---------------------分为k折-----------------------------\n\t\t//初始化为k fold\n\t\tfor(int i=0;i<FOLD;i++) {\n\t\t\tArrayList<Point> tmp = new ArrayList<Point>();\n\t\t\tallData.add(tmp);\n\t\t}\n\t\t//选一个 删一个\n\t\tList<Integer> chosen = new ArrayList<Integer>();\n\t\tfor(int i=0;i<dataSet.size();i++) {\n\t\t\tchosen.add(i);\n\t\t}\n\t\t\n\t\t/*//按照原有比例采样\n\t\tfor(int i=0;i<FOLD;i++) { \n\t\t\tint choose = 0;\n\t\t\twhile( choose < ROW/FOLD && i != FOLD-1) {\n\t\t\t\tint p = pData.size() / FOLD; //采样的小类样本的个数\n\t\t\t\tint rand = new Random().nextInt(dataSet.size());\n\t\t\t\tif( choose < p) {\n\t\t\t\t\tif( chosen.contains(rand) && dataSet.get(rand).getLabel() == 0) {\n\t\t\t\t\t\tchosen.remove(new Integer(rand));\n\t\t\t\t\t\tchoose ++;\n\t\t\t\t\t\tallData.get(i).add(dataSet.get(rand));\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif( chosen.contains(rand) && dataSet.get(rand).getLabel() != 0) {\n\t\t\t\t\t\tchosen.remove(new Integer(rand));\n\t\t\t\t\t\tchoose ++;\n\t\t\t\t\t\tallData.get(i).add(dataSet.get(rand));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t//最后一折全部添加\n\t\t\tif( i == FOLD-1) {\n\t\t\t\tfor (Integer o : chosen) {\n\t\t\t\t\tallData.get(i).add(dataSet.get(o));\n\t\t\t\t}\n\t\t\t}\n\t\t\t\t\n\t\t}*/\n\t\tfor(int i=0;i<FOLD;i++) { \n\t\t\tint choose = 0;\n\t\t\twhile( choose < ROW/FOLD && i != FOLD-1) {\n\t\t\t\tint rand = new Random().nextInt(dataSet.size());\n\t\t\t\tif( chosen.contains(rand)) {\n\t\t\t\t\tchosen.remove(new Integer(rand));\n\t\t\t\t\tchoose ++;\n\t\t\t\t\tallData.get(i).add(dataSet.get(rand));\n\t\t\t\t}\n\t\t\t}\n\t\t\t//最后一折全部添加\n\t\t\tif( i == FOLD-1) {\n\t\t\t\tfor (Integer o : chosen) {\n\t\t\t\t\tallData.get(i).add(dataSet.get(o));\n\t\t\t\t}\n\t\t\t}\n\t\t\t\t\n\t\t}\n\t\t\n\t\t//------------------取一折为测试,其余为训练集-----------------------------\n\t\tfor(int fold=0;fold<FOLD;fold++) {\n\t\t\tlong start = System.currentTimeMillis();\n\t\t\t\n\t\t\tList<Point> trainData = new ArrayList<Point>();\n\t\t\tList<Point> testData = new ArrayList<Point>();\n\t\t\tList<Point> positiveTrainData = new ArrayList<Point>();\n\t\t\tList<Point> positiveTestData = new ArrayList<Point>();\n\t\t\t\n\t\t\ttestData.addAll(allData.get(fold));\n\t\t\tfor (List<Point> ps : allData) {\n\t\t\t\tif( ps != allData.get(fold))\n\t\t\t\t\ttrainData.addAll(ps);\n\t\t\t}\n\t\t\t//select the minority class instances\n\t\t\tfor (Point point : trainData) {\n\t\t\t\tif(point.getLabel() == 0)\n\t\t\t\t\tpositiveTrainData.add(point);\n\t\t\t}\n\t\t\tSystem.out.print(\"train data :\"+trainData.size() + \"\\t\");\n\t\t\tSystem.out.println(\"train positive :\"+positiveTrainData.size());\n\t\t\tfor (Point point : testData) {\n\t\t\t\tif(point.getLabel() == 0)\n\t\t\t\t\tpositiveTestData.add(point);\n\t\t\t}\n\t\t\tSystem.out.print(\"test data :\"+testData.size() + \"\\t\");\n\t\t\tSystem.out.println(\"test positive :\"+positiveTestData.size());\n\t\t\t\n\t\t\tborderline(positiveTrainData,trainData);\n\t\t\t\n\t\t\t//generate new dataset\n\t\t\tString trainFileName = NAME + \"BLTrain\"+fold+\".arff\";\n\t\t\tString testFileName = NAME + \"BLTest\"+fold+\".arff\";\n\t\t\t//TODO dataSet is a bug\n\t\t\tGenerate.generate(trainData,pointSet,COL,fileName,trainFileName);\n\t\t\tGenerate.generate(testData,new ArrayList<Point>(),COL,fileName,testFileName);\n\t\t\tpointSet.clear();\n\t\t\tlong endGenerating = System.currentTimeMillis();\n\t\t\tSystem.out.println(\"产生数据所用时间为:\"+ (endGenerating-start)*1.0/1000 + \"s\");\n\t\t\t\n\t\t\t\n\t\t/*\t//不进行任何处理\n\t\t\ttrainFileName = NAME + \"TrainWS\"+\".arff\";\n\t\t\ttestFileName = NAME + \"TestWS\"+\".arff\";\n\t\t\tGenerate.generate(dataSet,new ArrayList<Point>(),COL,fileName,trainFileName);\n\t\t\tGenerate.generate(testSet,new ArrayList<Point>(),COL,fileName,testFileName);\n//\t\t\tpointSet.clear();\n\t*/\t\t\n\t\t\t\n\t\t\t\n\t\t\tclassify(trainFileName,testFileName);\n\t\t\tlong endClassifying = System.currentTimeMillis();\n\t\t\tSystem.out.println(\"产生数据所用时间为:\"+ (endClassifying-start)*1.0/1000 + \"s\");\n\t\t}\n\t}", "public void mutate() {\n if (this.offspring != null) {\n for (int i = 0; i < this.offspring.size(); i++) {\n\n if (Defines.probMutate > Math.random()) {\n // OK, choose two genes to switch\n int nGene1 = Defines.randNum(0, Defines.chromosomeSize - 1);\n int nGene2 = nGene1;\n // Make sure gene2 is not the same gene as gene1\n while (nGene2 == nGene1) {\n nGene2 = Defines.randNum(0, Defines.chromosomeSize - 1);\n }\n\n // Switch two genes\n String temp = this.offspring.get(i).getGene(nGene1);\n\n this.offspring.get(i).setGene(nGene1, this.offspring.get(i).getGene(nGene2));\n this.offspring.get(i).setGene(nGene2, temp);\n }\n // Regenerate the chromosome\n ChromosomeGenerator chromoGen = new ChromosomeGenerator();\n chromoGen.update(this.offspring.get(i));\n }\n\n }\n\n }", "public Cop generateCop(){\r\n\r\n\t\t\tPatch currentPatch = randPatch();\r\n\r\n\t\t\tCop cop= new Cop(currentPatch);\r\n\r\n\t\t\tcurrentPatch.setPerson(cop);\r\n\r\n\t\t\treturn cop;\r\n\t\t}", "public SoPickedPoint \ncopy() \n//\n////////////////////////////////////////////////////////////////////////\n{\n SoPickedPoint newCopy = new SoPickedPoint(this);\n return newCopy;\n}", "public static void createMazeMinus(DrawMaze maze) {\n Set<Point> loose = new HashSet<Point>();\n Set<Point> source = new HashSet<Point>();\n \n maze.getLoosePoints(loose);\n maze.getSourcePoints(source);\n\n //Repeat until the loose collection is empty.\n while (!loose.isEmpty()) {\n //point randomly selected from the source collection\n //checked for adjacent points that are not connected\n \tint size = source.size();\n \tint item = new Random().nextInt(size);\n \tint i = 0;\n \tPoint currentSourcePoint = null;\n \tfor(Point p : source) {\n \t if (i == item)\n \t currentSourcePoint = p;\n \t i = i + 1;\n \t}\n \t\n \tArrayList<Point> toChoose =\n \t\t\tmaze.getAdjacentLoosePoints(currentSourcePoint, loose);\n \t\n //If there is exactly one loose adjacent point,\n \t//the wall between the source point and the loose point is added to the maze\n \t//source point can be removed from the source collection\n \tif (toChoose.size() == 1) {\n \t\t\n \t\tPoint drawTo = toChoose.get(0);\n \t\tmaze.connectWall(currentSourcePoint, drawTo);\n \t\tloose.remove(drawTo);\n \t\tsource.remove(currentSourcePoint);\n \t\tsource.add(drawTo);\n \t\n //else If there are more than one loose points adjacent to the source point,\n \t//randomly select a direction for the wall, from the possibilities,\n \t//and add that wall to the maze. In this case, do not remove the\n \t//source point from the source collection.\n \t} else if (toChoose.size() > 1) {\n \n \t\tint rand = (int) (Math.random() * (toChoose.size() - 1)) / 1;\n \t\tPoint drawTo = toChoose.get(rand);\n maze.connectWall(currentSourcePoint, drawTo);\n loose.remove(drawTo);\n source.add(drawTo);\n \t}\n }\n }", "public void crossEdge(Edge e) {}", "private static void crossProductMerge(int[][] pointSet, int start, int mid, int end)\n {\n int[][] L = new int[2][mid-start+1];\n int[][] R = new int[2][end-mid];\n for (int i = 0; i<= L[0].length-1; i++)\n {\n L[0][i] = pointSet[0][start+i]; L[1][i] = pointSet[1][start+i];\n }\n for (int j = 0; j<= R[0].length-1; j++)\n {\n R[0][j] = pointSet[0][mid+j+1]; R[1][j] = pointSet[1][mid+j+1];\n }\n int i = 0;\n int j = 0;\n for (int k = start; k <= end; k++) \n {\n if (i == L[0].length || j == R[0].length)\n {\n if (i == L[0].length)\n {\n pointSet[0][k] = R[0][j]; pointSet[1][k] = R[1][j]; j++;\n }\n else\n {\n pointSet[0][k] = L[0][i]; pointSet[1][k] = L[1][i]; i++;\n }\n }\n else\n {\n if (((L[0][i]-pointSet[0][0])*(R[1][j]-pointSet[1][0]))-\n ((R[0][j]-pointSet[0][0])*(L[1][i]-pointSet[1][0])) > 0)\n {\n pointSet[0][k] = L[0][i]; pointSet[1][k] = L[1][i]; i++; \n }\n else\n {\n pointSet[0][k] = R[0][j]; pointSet[1][k] = R[1][j]; j++; \n }\n }\n }\n }", "public pair[] modifyAPosition(pair[] p, int[] values){\n int parameter = values.length;\n pair[] res = new pair[p.length];\n int index = random.nextInt(p.length);\n int j = 0;\n for(int i = 0; i < p.length; i++){\n if(i != index){\n res[j] = new pair(p[i].par, p[i].val);\n j++;\n\t }\n\t}\n\tint par = random.nextInt(parameter);\n while(containsPar(res, res.length - 1, par))\n\t par = random.nextInt(parameter);\n res[res.length - 1] = new pair(par, random.nextInt(values[par]));\n return res;\n }", "public RandomAssortment getRandomAssortment(CrossoverEvents crossoverEvents)\n\t{\n\t\tHashMap<Chromosome,Boolean> randAssort=new HashMap<Chromosome,Boolean>();\n\t\tfor(ArrayList<Chromosome> chromlist:chroms)\n\t\t{\n\t\t\t// Assign a random haplotype to the first chromosome in the list\n\t\t\tassert(chromlist.size()>0);\n\t\t\tboolean randGenotype= MimicrEERandom.getDouble()<0.5?true:false;\n\t\t\tChromosome c=chromlist.get(0);\n\t\t\trandAssort.put(c, randGenotype);\n\t\t\t\n\t\t\t// if there are more than one chromosome in the list the haplotype of the current chromosomes (i for i>0) is determined by the \n\t\t\t// crossover events of the previous chromosome (i-1)\n\t\t\tif(chromlist.size()>1)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tfor(int i=1; i<chromlist.size(); i++)\n\t\t\t\t{\n\t\t\t\t\tChromosome activeChr=chromlist.get(i);\n\t\t\t\t\tChromosome prevChr=chromlist.get(i-1);\n\t\t\t\t\tboolean prevHaplo=randAssort.get(prevChr);\n\t\t\t\t\tboolean activeHaplo=recombineWithinChromosome(crossoverEvents,prevChr,prevHaplo);\n\t\t\t\t\trandAssort.put(activeChr, activeHaplo);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn new RandomAssortment(randAssort);\n\t}" ]
[ "0.7663752", "0.7611329", "0.75338024", "0.7467766", "0.74277896", "0.72748035", "0.7245263", "0.72424066", "0.7203969", "0.7118722", "0.69917864", "0.6925289", "0.6800968", "0.6798136", "0.6745449", "0.6713084", "0.66552955", "0.6651118", "0.66153365", "0.65889496", "0.6544577", "0.6540459", "0.649209", "0.64780504", "0.6471845", "0.6431923", "0.6429295", "0.64200616", "0.63218224", "0.6282978", "0.62534016", "0.6251747", "0.6203224", "0.61615384", "0.61360896", "0.6030699", "0.60167795", "0.59996724", "0.5993901", "0.59129095", "0.5835851", "0.5781652", "0.5771853", "0.57681626", "0.5759523", "0.5748421", "0.5689505", "0.5631112", "0.56252056", "0.5550548", "0.54529715", "0.5417415", "0.54133415", "0.5393017", "0.53904843", "0.53784794", "0.53681195", "0.5341237", "0.5257569", "0.52331406", "0.5219682", "0.52101946", "0.52092457", "0.5184903", "0.5153831", "0.5150982", "0.51343554", "0.51257867", "0.5123546", "0.5107445", "0.5078724", "0.5073632", "0.5052594", "0.5052113", "0.50411695", "0.5001124", "0.50010514", "0.4987319", "0.49718776", "0.49681032", "0.4959093", "0.4955598", "0.4941116", "0.49187788", "0.49127427", "0.4899708", "0.48980582", "0.48621723", "0.4844359", "0.4840778", "0.48390085", "0.48305944", "0.4827921", "0.48238972", "0.48193872", "0.48177516", "0.48060703", "0.47977266", "0.47809556", "0.4776508" ]
0.77018946
0
Mutation Chooses two elements in different bins and swaps them (acts like partition problem)
private int[] mutationPairwiseExchange(int[] mutant) { int pairPoint1 = rand.nextInt(mutant.length); int pairPoint2 = pairPoint1; while (mutant[pairPoint2] == mutant[pairPoint1]) { pairPoint2 = rand.nextInt(mutant.length); //find element in different bucket } int temp = mutant[pairPoint1]; mutant[pairPoint1] = mutant[pairPoint2]; mutant[pairPoint2] = temp; return mutant; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private int[] mutationSingleMove(int[] mutant) {\n\t\tint pairPoint1 = rand.nextInt(mutant.length);\n\t\tint newBin = mutant[pairPoint1];\n\t\twhile (newBin == mutant[pairPoint1]) {\n\t\t\tnewBin = rand.nextInt(binCount);\n\t\t}\n\t\tmutant[pairPoint1] = newBin; //swap to a different bucket\n\t\treturn mutant;\n\t}", "private void switchElements(int a, int b) {\r\n\t\tE temp = c[a];\r\n\t\tc[a] = c[b];\r\n\t\tc[b] = temp;\r\n\t}", "public void swapAdjacentElements(int[] values)\n {\n // your work here\n\n\n\n\n }", "private void swapElement ( int p1, int p2 )\n\t{\n\t}", "private int[] mutateSwapChild(int[] child) {\n println(\"before mutateSwapChild\", 1);\n displayChromosome(child, 1);\n int first = (int)(Math.random() * num_shipping_points);\n int second = (int)(Math.random() * num_shipping_points);\n //make sure first and second are different\n while(first == second) {\n second = (int)(Math.random() * num_shipping_points);\n }\n int temp = child[first];\n child[first] = child[second];\n child[second] = temp;\n \n println(\"after mutateSwapChild\", 1);\n displayChromosome(child, 1);\n return child;\n }", "int partition(int arr[], int low, int high, SequentialTransition sq,ArrayList<StackPane> list,double speed) \n\t {\n\t\t\tint step;\n//\t\t\tint n = arr.length;\n\t int pivot = arr[high]; \n\t int i = (low-1);\n\t for (int j=low; j<high; j++) \n\t { \n\t if (arr[j] <= pivot) \n\t { \n\t i++; \n\t int temp = arr[i]; \n\t arr[i] = arr[j]; \n\t arr[j] = temp; \n\t step = j - i;\n\t sq.getChildren().add(FillBeforeSwap(list.get(i), list.get(j),speed));\n\t sq.getChildren().add(swapMe(list.get(i), list.get(j), step, list, speed));\n\t sq.getChildren().add(FillAfterSwap(list.get(j), list.get(i), speed));\n\t } \n\t } \n\t int temp = arr[i+1]; \n\t arr[i+1] = arr[high]; \n\t arr[high] = temp; \n\t step = (high) - (i+1);\n\t sq.getChildren().add(FillBeforeSwap(list.get(i+1), list.get(high), speed));\n\t sq.getChildren().add(swapMe(list.get(i+1), list.get(high), step, list, speed));\n\t sq.getChildren().add(FillAfterSwap(list.get(i+1), list.get(high), speed));\n\t \n\t return i+1; \n\t }", "public synchronized void elementSwapped(Object newParam, int index1,\n\t\t\tint index2) {\n\n\t\tif (index1 < index2) {\n\t\t\tswapElements(newParam, index1, index2);\n\t\t} else {\n\t\t\tswapElements(newParam, index2, index1);\n\t\t}\n\n\t}", "private void swap(int idx1, int idx2) {\n int temp = heap[idx1];\n heap[idx1] = heap[idx2];\n heap[idx2] = temp;\n }", "private static <E> void siftDown(E[] array, Comparator<E> comparator, int offset, int start, int end) {\n int root = start, child = (root-offset)*2+1+offset;\n while (child <= end) {\n if (child+1<=end && comparator.compare(array[child], array[child+1])<0) {\n child = child+1;\n }\n if (comparator.compare(array[root], array[child])<0) {\n DataManipulator.swapData(array, root, child);\n root = child;\n child = (root-offset)*2+1+offset;\n } else {\n return;\n }\n }\n }", "private static <T> void vecswap(int x[], double[] a2, int a, int b, int n) {\n\t\tfor (int i=0; i<n; i++, a++, b++)\n\t\t\tswap(x, a2, a, b);\n\t}", "private static void vecswap(double x[], int[] a2, int a, int b, int n) {\n\t\tfor (int i=0; i<n; i++, a++, b++)\n\t\t\tswap(x,a2, a, b);\n\t}", "public synchronized void elementSwapped(Object source, int index1,\n\t\t\tObject other, int index2) {\n\n\t}", "private static <T,P> void vecswap(T x[], int[] a2,int a, int b, int n) {\n\t\tfor (int i=0; i<n; i++, a++, b++)\n\t\t\tswap(x,a2, a, b);\n\t}", "private void swap(int firstIdx, int secondIdx) {\r\n // TODO\r\n }", "@Override\n protected void swap(int i, int j)\n {\n E temp = this.elements[i];\n this.elements[i] = this.elements[j];\n \tthis.elementsToArrayIndex.put(elements[i], i);\n this.elements[j] = temp;\n \tthis.elementsToArrayIndex.put(elements[j], j);\n }", "private static void vecswap(int x[], int[] a2, int a, int b, int n) {\n\t\tfor (int i=0; i<n; i++, a++, b++)\n\t\t\tswap(x, a2, a, b);\n\t}", "private static <T> void vecswap(byte x[], T[] a2, int a, int b, int n) {\n\t\tfor (int i=0; i<n; i++, a++, b++)\n\t\t\tswap(x, a2, a, b);\n\t}", "private static <T> void vecswap(int x[], T[] a2, int a, int b, int n) {\n\t\tfor (int i=0; i<n; i++, a++, b++)\n\t\t\tswap(x, a2, a, b);\n\t}", "private static void vecswap(double x[], double[] a2, int a, int b, int n) {\n\t\tfor (int i=0; i<n; i++, a++, b++)\n\t\t\tswap(x,a2, a, b);\n\t}", "public void sequenceSwaps(int[] tempItem1, int[] tempItem2, Vector<int[]> cyclePosition, int distTotal, Vector<int[]> sequence, int mut_rate){\n boolean b;\n int[] cycles2 = new int[cyclePosition.size()];\n int nrSwaps = 0;\n Arrays.fill(cycles2,-1);\n sequence.clear();\n while(true){\n int j = r.nextInt(cyclePosition.size());\n\n b = false;\n for(int i = 0; i < cycles2.length; i++)\n if(cycles2[i] == -1){\n b = true;\n break;\n }\n if(!b){\n break;\n }\n while(cycles2[j] != -1)\n j = r.nextInt(cyclePosition.size());\n cycles2[j] = 1;\n int[] indexSwap = cyclePosition.elementAt(j).clone();\n int dist = indexSwap.length; //+1;//ps1.getDistance(tempDist1,tempDist2);\n\n //\n int rInt = r.nextInt(indexSwap.length);\n int indexI, indexII;\n \n //tempR.clear();\n for(int i = 0; i < dist-1; i++){\n indexI = tempItem1[indexSwap[rInt]];\n //find indexI in temp2\n indexII = -1;\n for(int k = 0; k < indexSwap.length; k++)\n if(tempItem2[indexSwap[k]] == indexI){\n indexII = indexSwap[k];\n break;\n }\n \n int[] tempInt = new int[2];\n tempInt[0] = indexII;\n tempInt[1] = indexSwap[rInt];\n\n sequence.add(tempInt);\n\n //swaps the two positions\n int temp = tempItem1[indexSwap[rInt]];\n tempItem1[indexSwap[rInt]]=tempItem1[indexII];\n tempItem1[indexII]=temp;\n\n nrSwaps++;\n if(nrSwaps >= mut_rate-1)\n break;\n\n }\n if(nrSwaps >= mut_rate-1)\n break;\n }\n }", "private static <T,P> void vecswap(T x[], P[] a2,int a, int b, int n) {\n\t\tfor (int i=0; i<n; i++, a++, b++)\n\t\t\tswap(x,a2, a, b);\n\t}", "private static <T> void vecswap(short x[], T[] a2, int a, int b, int n) {\n\t\tfor (int i=0; i<n; i++, a++, b++)\n\t\t\tswap(x, a2, a, b);\n\t}", "private static void swap(int x[], int[] a2, int a, int b) {\n\t\tint t = x[a];\n\t\tx[a] = x[b];\n\t\tx[b] = t;\n\t\tint t2 = a2[a];\n\t\ta2[a] = a2[b];\n\t\ta2[b] = t2;\n\t}", "private void swap(int one, int two)\r\n {\r\n//*** one->two\r\n long temp = a[two];\r\n a[one] = a[two];\r\n a[two] = temp;\r\n }", "private void swap(int index1, int index2) {\r\n int temp = heap.get(index1);\r\n heap.set(index1, heap.get(index2));\r\n heap.set(index2, temp);\r\n }", "private static void vecswap(int x[], int a, int b, int n) {\n\t\tfor (int i=0; i<n; i++, a++, b++)\n\t\t\tswap(x, a, b);\n\t}", "private static <T,P> void vecswap(List<T> x, List<P> a2,int a, int b, int n) {\n\t\tfor (int i=0; i<n; i++, a++, b++)\n\t\t\tswap(x,a2, a, b);\n\t}", "private static void swap(int[] nums, int i, int j) {\n nums[i] += nums[j];\n nums[j] = nums[i] - nums[j];\n nums[i] = nums[i] - nums[j];\n }", "private static <T> void vecswap(double x[], T[] a2, int a, int b, int n) {\n\t\tfor (int i=0; i<n; i++, a++, b++)\n\t\t\tswap(x,a2, a, b);\n\t}", "@Override\n protected void runAlgorithm() {\n for (int i = 0; i < getArray().length; i++) {\n for (int j = i + 1; j < getArray().length; j++) {\n if (applySortingOperator(getValue(j), getValue(i))) {\n swap(i, j);\n }\n }\n }\n }", "public void wiggleSortSubOptimal(int[] nums) {\n Arrays.sort(nums);\n \n for (int i = 1; i < nums.length - 1; i += 2)\n swap(nums, i, i + 1);\n }", "private static <T> void vecswap(long x[], T[] a2,int a, int b, int n) {\n\t\tfor (int i=0; i<n; i++, a++, b++)\n\t\t\tswap(x,a2, a, b);\n\t}", "private synchronized void swapElements(Object newParam, int index1,\n\t\t\tint index2) {\n\n\t\t// the two elements to be swapped\n\t\tLinearElement firstElement = root.getVector().get(index1);\n\t\tLinearElement secondElement = root.getVector().get(index2);\n\n\t\t// the two elements after each of the elements to be swapped\n\t\tLinearElement secondElementNext;\n\t\tLinearElement firstElementNext;\n\t\t/*\n\t\t * There is a corner case where secondElement.previousChild is\n\t\t * firstElement\n\t\t */\n\n\t\t// the first element's previous child before it is reassigned\n\t\tLinearElement tempPrevChild = firstElement.getPreviousChild();\n\n\t\tif (index2 != index1 + 1) {// the elements are not adjacent\n\n\t\t\t// set previous elements for the two nodes\n\t\t\tfirstElement.setPreviousChild(secondElement.getPreviousChild());\n\t\t\tsecondElement.setPreviousChild(tempPrevChild);\n\n\t\t\t// set previous elements for the nodes referencing the swapped nodes\n\t\t\tif (index1 + 1 < root.getVector().size()) {\n\t\t\t\tfirstElementNext = root.getVector().get(index1 + 1);\n\t\t\t\tfirstElementNext.setPreviousChild(secondElement);\n\t\t\t}\n\t\t\tif (index2 + 1 < root.getVector().size()) {\n\t\t\t\tsecondElementNext = root.getVector().get(index2 + 1);\n\t\t\t\tsecondElementNext.setPreviousChild(firstElement);\n\t\t\t}\n\n\t\t} else { // the elements are adjacent\n\t\t\tfirstElement.setPreviousChild(secondElement);\n\t\t\tsecondElement.setPreviousChild(tempPrevChild);\n\n\t\t\t// set previous elements for the nodes referencing the second node\n\t\t\tif (index2 + 1 < root.getVector().size()) {\n\t\t\t\tsecondElementNext = root.getVector().get(index2 + 1);\n\t\t\t\tsecondElementNext.setPreviousChild(firstElement);\n\t\t\t}\n\t\t}\n\n\t\t// swap the elements in root\n\t\troot.getVector().swap(index1, index2);\n\n\t\troot.focusPosition();\n\t}", "private static <T> void swap(int x[], double[] a2, int a, int b) {\n\t\tint t = x[a];\n\t\tx[a] = x[b];\n\t\tx[b] = t;\n\t\tdouble t2 = a2[a];\n\t\ta2[a] = a2[b];\n\t\ta2[b] = t2;\n\t}", "private void swap(int i, int j) {\n\t\t//gets elements\n\t\tPair e1 = heap.get(i);\n\t\tPair e2 = heap.get(j);\n\t\t//swaps them in heap\n\t\theap.remove(i);\n\t\theap.add(i,e2);\n\t\theap.remove(j);\n\t\theap.add(j,e1);\n\t\t//removes and re-adds their mappings\n\t\tlocation.remove(e1.element);\n\t\tlocation.remove(e2.element);\n\t\tlocation.put((int)e1.element, j);\n\t\tlocation.put((int)e2.element, i);\n\t}", "private static void exch(Comparable[] a, int i, int j) {\n Comparable swap = a[i];\n a[i] = a[j];\n a[j] = swap;\n }", "private void swap(int index1, int index2) {\n Node tmp = heap[index1];\n heap[index1] = heap[index2];\n heap[index2] = tmp;\n }", "private void merge() {\n for (int i = low; i<high; i++){\n temparray[i]=nums[i];\n }\n\n int i = low;\n int j = middle;\n //index of the original array for which we are making compare\n int index = low;\n //copy the smallest from the left and right partition to temp\n while ((i<middle)&&(j<high)){\n if(temparray[i]<=temparray[j]){\n nums[index]=temparray[i];\n i++;\n }\n else {\n nums[index]=temparray[j];\n j++;\n }\n index++;\n }\n // copy the rest of the the left side\n while (i<middle){\n nums[index]= temparray[i];\n i++;\n index++;\n }\n //and the right\n while (j<high){\n nums[index]=temparray[j];\n j++;\n index++;\n }\n\n }", "private static <Item extends Comparable> void partitionBear(\n List<Item> unsorted, Bed pivot,\n List<Item> less, List<Item> equal, List<Item> greater) {\n for (Item s : unsorted) {\n if (s.compareTo(pivot) < 0) {\n less.add(s);\n } else if (s.compareTo(pivot) == 0) {\n equal.add(s);\n } else {\n greater.add(s);\n }\n }\n }", "private static void swap(double x[], int[] a2, int a, int b) {\n\t\tdouble t = x[a];\n\t\tx[a] = x[b];\n\t\tx[b] = t;\n\t\tint t2 = a2[a];\n\t\ta2[a] = a2[b];\n\t\ta2[b] = t2;\n\t}", "private static <T> void vecswap(float x[],T[] a2, int a, int b, int n) {\n\t\tfor (int i=0; i<n; i++, a++, b++)\n\t\t\tswap(x, a2, a, b);\n\t}", "public void flipIndexes() {\n int temp = index1;\n index1 = index2;\n index2 = temp;\n }", "static void minimumBribes(int[] q) {\n \t\n \tfor(int i=0;i<q.length;i++){\n if((q[i] - (i+1)) > 2){\n System.out.println(\"Too chaotic\");\n return; \n }\n }\n \n int swaps=0;\n for(int i=0;i< q.length;i++){\n for(int j=i+1;j<q.length;j++){\n if(q[i] > q[j]){ \n int tmp=q[j];\n q[j]=q[i];\n q[i]=tmp;\n swaps++;\n }\n }\n }\n \n System.out.println(swaps);\n \n }", "public void swapRows (int pos1, int pos2) {\n\t \tint swap = this.subset[pos1];\n\t \tthis.subset[pos1] = this.subset[pos2];\n\t \tthis.subset[pos2] = swap;\n\t }", "public void partition();", "private void swim(int index)\r\n\t{\n\t\twhile (index > 1)\r\n\t\t{\r\n\t\t\tint parentIndex = index / 2;\r\n\t\t\t\r\n\t\t\tif (data[index].compareTo(data[parentIndex]) < 0)\r\n\t\t\t{\r\n\t\t\t\tswap(index, parentIndex);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tindex = parentIndex;\r\n\t\t}\r\n\t}", "private void swap(int a, int b) {\n Node newB = aHeap.get(a);\n Node newA = aHeap.get(b);\n aHeap.remove(a);\n aHeap.add(a, newA);\n itemMap.put(aHeap.get(a).getItem(), a);\n aHeap.remove(b);\n aHeap.add(b, newB);\n itemMap.put(aHeap.get(b).getItem(), b);\n }", "private void exchange(int i, int j){\n\t\tnode_data t = _a[i];\n\t\t_a[i] = _a[j];\n\t\t_a[j] = t;\n\t}", "private static <T> void swap(byte x[],T[] a2, int a, int b) {\n\t\tbyte t = x[a];\n\t\tx[a] = x[b];\n\t\tx[b] = t;\n\t\tT t2 = a2[a];\n\t\ta2[a] = a2[b];\n\t\ta2[b] = t2;\n\t}", "private static <Item extends Comparable> void partitionBed(\n List<Item> unsorted, Bear pivot,\n List<Item> less, List<Item> equal, List<Item> greater) {\n for (Item s : unsorted) {\n if (s.compareTo(pivot) < 0) {\n less.add(s);\n } else if (s.compareTo(pivot) == 0) {\n equal.add(s);\n } else {\n greater.add(s);\n }\n }\n }", "private static <T> void swap(int x[], T[] a2, int a, int b) {\n\t\tint t = x[a];\n\t\tx[a] = x[b];\n\t\tx[b] = t;\n\t\tT t2 = a2[a];\n\t\ta2[a] = a2[b];\n\t\ta2[b] = t2;\n\t}", "private static <T,S> void swap(T x[], int[] a2, int a, int b) {\n\t\tT t = x[a];\n\t\tx[a] = x[b];\n\t\tx[b] = t;\n\t\tint t2 = a2[a];\n\t\ta2[a] = a2[b];\n\t\ta2[b] = t2;\n\t}", "private static <T> void vecswap(List<T> x, int a, int b, int n) {\n for (int i = 0; i < n; i++, a++, b++) {\n swapElements(x, a, b);\n }\n }", "public void swap(int index1, int index2) {\n \n }", "private void swap(int from, int to) {\n E tmp = array[from];\n array[from] = array[to];\n array[to] = tmp;\n }", "private void swap(Comparable[] array, int toSwapOne, int toSwapTwo){\r\n\t\tswaps++;\r\n\t\tComparable storage = array[toSwapOne];\r\n\t\tarray[toSwapOne] = array[toSwapTwo];\r\n\t\tarray[toSwapTwo] = storage;\r\n\t}", "private void swap(int i, int j) {\n\t\tint tmp = data.get(i);\n\t\tdata.set(i, data.get(j));\n\t\tdata.set(j, tmp);\n\t}", "private static <Key extends Comparable<Key>> void exch(Key[] a, int i, int j)\n\t{\n\t\tKey tmp = a[i];\n\t\ta[i] = a[j];\n\t\ta[j] = tmp;\n\t}", "private static void swap(int[] A, int a, int b){\n\t\tint temp = A[a];\n\t\tA[a] = A[b];\n\t\tA[b] = temp;\n\t}", "private static void mergeHalves(\n\t\tint[] ints,\n\t\tint[] copyOfInts,\n\t\tint min,\n\t\tint mid,\n\t\tint max\n\t\t) {\n\n\t\tSystem.arraycopy(ints, min, copyOfInts, min, max - min);\n\n\t\tint overallPos = min;\n\t\tint firstHalfPos = min;\n\t\tint secondHalfPos = mid;\n\n\t\twhile (firstHalfPos < mid && secondHalfPos < max) {\n\t\t\tif (copyOfInts[firstHalfPos] < copyOfInts[secondHalfPos]) {\n\t\t\t\tints[overallPos] = copyOfInts[firstHalfPos];\n\t\t\t\tfirstHalfPos++;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tints[overallPos] = copyOfInts[secondHalfPos];\n\t\t\t\tsecondHalfPos++;\n\t\t\t}\n\t\t\toverallPos++;\n\t\t}\n\n\t\t// if the second half has been exhausted, move the remainder\n\t\t// of the first half to the end of the sorted array\n\t\twhile (firstHalfPos < mid) {\n\t\t\tints[overallPos] = copyOfInts[firstHalfPos];\n\t\t\tfirstHalfPos++;\n\t\t\toverallPos++;\n\t\t}\n\n\t}", "private static void swap(int[] array, int first, int second) {\n int temp = array[first];\n array[first] = array[second];\n array[second] = temp;\n }", "private static <T,S> void swap(List<T> x, List<S> a2, int a, int b) {\n\t\tT t = x.get(a);\n\t\tx.set(a, x.get(b));\n\t\tx.set(b,t);\n\t\tS t2 = a2.get(a);\n\t\ta2.set(a,a2.get(b));\n\t\ta2.set(b,t2);\n\t}", "private static <T> void swap(long x[], T[] a2, int a, int b) {\n\t\tlong t = x[a];\n\t\tx[a] = x[b];\n\t\tx[b] = t;\n\t\tT t2 = a2[a];\n\t\ta2[a] = a2[b];\n\t\ta2[b] = t2;\n\t}", "private static void swap(Integer[] a, int x, int y) {\n\t\tInteger temp = a[x];\n\t\ta[x] = a[y];\n\t\ta[y] = temp;\n\t}", "void rndSwapTwo(int i, int j) {\r\n\t\tint a, b;\r\n\t\tint tmp;\r\n\r\n\t\ta = Util.rndInt(i, j);\r\n\t\tb = Util.rndInt(i, j);\r\n\t\ttmp = index[a];\r\n\t\tindex[a] = index[b];\r\n\t\tindex[b] = tmp;\r\n\t}", "private static <E> void heapify(E[] array, Comparator<E> comparator, int i1, int i2) {\n int start = (i1 + i2) / 2;\n \n while (start >= i1) {\n siftDown(array, comparator, i1, start, i2);\n start -= 1;\n }\n }", "public static void balanceHeaps()\n {\n // add your code here\n if(Math.abs(s.size()-g.size()) > 1){\n if(s.size() > g.size()){\n g.add(s.poll());\n }\n else {\n s.add(g.poll());\n }\n }\n }", "private static void swap(double x[], double[] a2, int a, int b) {\n\t\tdouble t = x[a];\n\t\tx[a] = x[b];\n\t\tx[b] = t;\n\t\tdouble t2 = a2[a];\n\t\ta2[a] = a2[b];\n\t\ta2[b] = t2;\n\t}", "public Chromosome doBitFlipMutation(){\n for(int i = 0; i < PopulationConfiguration.MUTATION_ATTEMPTS; i++){\n ArrayList<Boolean> newSelection = copyBoolArrayList(this.knapsackSelection);\n int itemToMutate = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n newSelection.set(itemToMutate, !newSelection.get(itemToMutate));\n\n Chromosome mutatedKnapsack = new Chromosome(newSelection).withFitnessCalculated();\n if(mutatedKnapsack.isValid())\n return mutatedKnapsack;\n }\n return this;\n }", "private void swap(Comparable[] array, int pos1, int pos2) {\n\t\tComparable tmp = array[pos1];\n\t\tarray[pos1] = array[pos2];\n\t\tarray[pos2] = tmp;\n\t}", "private static void exchange( Comparable[] datos, int i, int j)\n\t{\n\t\t// TODO implementar\n\t\tComparable copia=datos[j];\n\t\tdatos[j]=datos[i];\n\t\tdatos[i]=copia; \n\t}", "private static <T> void vecswap(char x[], T[] a2, int a, int b, int n) {\n\t\tfor (int i=0; i<n; i++, a++, b++)\n\t\t\tswap(x, a2, a, b);\n\t}", "@Override\n\tpublic void swap(int pos1, int pos2) {\n\t}", "private void vecswap(double x[], int a, int b, int n) {\r\n for (int i = 0; i < n; i++, a++, b++) {\r\n swap(x, a, b);\r\n }\r\n }", "public void selectionSort(int[] x)\n {\n for (int i = 0; i < x.length-1; i++) {\n int minIndex = i;\n for (int j = i+1; j < x.length; j++) {\n if (x[minIndex] > x[j]) {\n minIndex = j;\n }\n }\n int temp = x[i];\n x[i] = x[minIndex];\n x[minIndex] = temp;\n }\n \n public void replaceFirst(int oldVal, int newVal)\n {\n \n }\n}", "private static void swap(int[] arr, int a, int b) {\n int temp = arr[a];\n arr[a] = arr[b];\n arr[b] = temp;\n }", "private void swap(int index1, int index2) {\n E element1 = getElement(index1);\n E element2 = getElement(index2);\n setElement(index2, element1);\n setElement(index1, element2);\n }", "private static <E extends Comparable<? super E>> void swap(\r\n\t\t\tComparable<E>[] data, int i, int j) {\r\n\t\tComparable<E> temp = data[i];\r\n\t\tdata[i] = data[j];\r\n\t\tdata[j] = temp;\r\n\t}", "private static void swap(Object[] x, int a, int b)\n {\n Object t = x[a];\n x[a] = x[b];\n x[b] = t;\n }", "private static <T> void swap(short x[], T[] a2, int a, int b) {\n\t\tshort t = x[a];\n\t\tx[a] = x[b];\n\t\tx[b] = t;\n\t\tT t2 = a2[a];\n\t\ta2[a] = a2[b];\n\t\ta2[b] = t2;\n\t}", "private static void vecswap(char x[], char[] a2, int a, int b, int n) {\n\t\tfor (int i=0; i<n; i++, a++, b++)\n\t\t\tswap(x, a2, a, b);\n\t}", "public void swap( Ingredient array[], int first, int second ){\t\t\n\t\tIngredient hold; // temp variable\n\t\thold = array[ first ];\n\t\tarray[ first ] = array[ second ];\n\t\tarray[ second ] = hold;\n\t}", "private static int[] ArraySwapper(int[] arr) {\n\t\tint size=Array.getLength(arr),temp;\n\t\tfor(int i=0;i<size/2;i++) {\n\t\t\ttemp =arr[i];\n\t\t\tarr[i]=arr[size-i-1];\n\t\t\tarr[size-i-1]=temp;\n\t\t}\n\t\treturn arr;\n\t\t\n\t}", "private static void sort(Object[] a, Object[] tmp,\n int from, int to, Fun isLess) {\n int split = (from + to) / 2;\n if (split - from > 1)\n sort(tmp, a, from, split, isLess);\n if (to - split > 1)\n sort(tmp, a, split, to, isLess);\n int i = from, j = split;\n while (i < split && j < to) {\n if (isLess.apply(tmp[i], tmp[j]) == Boolean.TRUE)\n a[from] = tmp[i++];\n else\n a[from] = tmp[j++];\n ++from;\n }\n if (i < split)\n System.arraycopy(tmp, i, a, from, split - i);\n else if (j < to)\n System.arraycopy(tmp, j, a, from, to - j);\n }", "public void permutate(int[] x) {\n for (int i = 0; i < x.length; i++) {\n int j = i + nextInt(x.length - i);\n Math.swap(x, i, j);\n }\n }", "private void swap(int[] nums, int i, int j) {\n\t\tint tmp=nums[i];\n\t\tnums[i]=nums[j];\n\t\tnums[j]=tmp;\n\t}", "void swap(int index_1,int index_2){\n int temp=arr[index_1];\n arr[index_1]=arr[index_2];\n arr[index_2]=temp;\n }", "private static <Key extends Comparable<Key> > void exch(Key []a, int i, int j){\n Key tmp=a[i-1];\n a[i-1]=a[j-1];\n a[j-1]=tmp;\n }", "@Override\n \tpublic void swap(int i, int j) {\n \t\tint t=data[i];\n \t\tdata[i]=data[j];\n \t\tdata[j]=t;\n \t}", "private int[] swap(int[] a, int i, int j) {\n int tmp;\n tmp = a[i];\n a[i] = a[j];\n a[j] = tmp;\n return a;\n }", "private static void swap(int[] arr, int i, int j) {\n arr[i] = arr[j]^arr[i]^(arr[j] = arr[i]);\n }", "private static void swap(int fi, int si, int d)\r\n\t{\r\n\t int i, temp;\r\n\t for(i = 0; i<d; i++) \r\n\t {\r\n\t temp = arr[fi + i];\r\n\t arr[fi + i] = arr[si + i];\r\n\t arr[si + i] = temp;\r\n\t } \r\n\t}", "private void mergeHalves(int[] array, int[] temp, int leftStart, int rightEnd){\r\n int leftEnd = (rightEnd + leftStart)/2;\r\n int rightStart = leftEnd + 1;\r\n int size = rightEnd - leftStart + 1;\r\n\r\n int left = leftStart;\r\n int right = rightStart;\r\n int index = leftStart;\r\n\r\n while(left <= leftEnd && right <= rightEnd){\r\n if(array[left] <= array[right]){\r\n temp[index] = array[left];\r\n left++;\r\n }else {\r\n temp[index] = array[right];\r\n right++;\r\n }\r\n index++;\r\n }\r\n System.arraycopy(array, left, temp, index, leftEnd - left + 1);\r\n System.arraycopy(array, right, temp, index, rightEnd - right + 1);\r\n System.arraycopy(temp, leftStart, array, leftStart, size);\r\n }", "private void swap(int[] a, int index1, int index2) {\n int temp = a[index1];\n a[index1] = a[index2];\n a[index2] = temp;\n }", "private static void swap(int[] array, int ind1, int ind2) {\n int temp = array[ind1];\n array[ind1] = array[ind2];\n array[ind2] = temp;\n }", "@Test\n public void doubleSortWithExchangeUnbalancedNodes() {\n ExternalSort es1 = new ExternalSort(OpProps.prototype(0, Long.MAX_VALUE).cloneWithMemoryExpensive(true).cloneWithMemoryFactor(options.getOption(SORT_FACTOR)).cloneWithBound(options.getOption(SORT_BOUNDED)), ARBTRIARY_LEAF, Collections.emptyList(), false);\n SingleSender ss = new SingleSender(OpProps.prototype(1, Long.MAX_VALUE).cloneWithMemoryFactor(options.getOption(SORT_FACTOR)).cloneWithBound(options.getOption(SORT_BOUNDED)), Mockito.mock(BatchSchema.class), es1, 0,\n MinorFragmentIndexEndpoint.newBuilder().setMinorFragmentId(0).build());\n Fragment f1 = new Fragment();\n f1.addOperator(ss);\n Wrapper w1 = new Wrapper(f1, 0);\n w1.overrideEndpoints(Arrays.asList(N1, N2));\n\n UnorderedReceiver or = new UnorderedReceiver(OpProps.prototype(1, Long.MAX_VALUE), Mockito.mock(BatchSchema.class), 0, Collections.emptyList(), false);\n ExternalSort es2 = new ExternalSort(OpProps.prototype(0, Long.MAX_VALUE).cloneWithMemoryExpensive(true).cloneWithMemoryFactor(options.getOption(SORT_FACTOR)).cloneWithBound(options.getOption(SORT_BOUNDED)), or, Collections.emptyList(), false);\n Fragment f2 = new Fragment();\n f2.addOperator(es2);\n Wrapper w2 = new Wrapper(f2, 0);\n w2.overrideEndpoints(Collections.singletonList(N1));\n\n\n MemoryAllocationUtilities.setMemory(options, ImmutableMap.of(f1, w1, f2, w2), 10 + adjustReserve);\n assertEquals(3L, es1.getProps().getMemLimit());\n assertEquals(3L, es2.getProps().getMemLimit());\n }", "public void resize(int a1, int b1, int a2, int b2)\n {\n this.a1 = a1;\n this.b1 = b1;\n this.a2 = a2;\n this.b2 = b2;\n\n n *= 2;\n\n int [] temp1;\n int [] temp2;\n\n temp1 = array1.clone();\n temp2 = array2.clone();\n\n array1 = new int[n];\n array2 = new int[n];\n\n for(int elem : temp1)\n insert(elem);\n for(int elem : temp2)\n insert(elem);\n\n }", "private static void swap(int[] array, int index1, int index2) {\n int x = array[index1];\n array[index1] = array[index2];\n array[index2] = x;\n }", "private static void exch(Object[] a, int i, int j) {\r\n Object swap = a[i];\r\n a[i] = a[j];\r\n a[j] = swap;\r\n }", "private void swap(int i, int j) {\n Item tmp = heap[i-1];\n heap[i-1] = heap[j-1];\n heap[j-1] = tmp;\n }" ]
[ "0.6276171", "0.61506236", "0.6039928", "0.60033506", "0.5993983", "0.5925314", "0.5895175", "0.5889789", "0.5868158", "0.5861998", "0.58612263", "0.5820398", "0.579924", "0.57925636", "0.57837105", "0.578168", "0.5772545", "0.57504123", "0.57410014", "0.57207423", "0.5700746", "0.56842524", "0.5674067", "0.56708497", "0.56700385", "0.5652348", "0.565025", "0.5642121", "0.56266344", "0.56180674", "0.5617667", "0.5612837", "0.5612263", "0.5603434", "0.5601406", "0.55885917", "0.5585194", "0.5582821", "0.55820626", "0.5577722", "0.5576627", "0.5576037", "0.556962", "0.5563046", "0.5556222", "0.5550287", "0.55354387", "0.55349517", "0.55272233", "0.55263984", "0.5519784", "0.55186254", "0.5504924", "0.5504632", "0.5492212", "0.54884064", "0.54829025", "0.54748803", "0.5471274", "0.5470887", "0.54665154", "0.546553", "0.5459978", "0.54598767", "0.5454509", "0.54524446", "0.545066", "0.54505616", "0.54502255", "0.54472464", "0.5441075", "0.54304206", "0.54281753", "0.5425922", "0.5424316", "0.54145676", "0.5414022", "0.5413805", "0.54101557", "0.5408099", "0.54079735", "0.54071563", "0.5399664", "0.5398525", "0.53951406", "0.5393313", "0.53922266", "0.5390604", "0.5390594", "0.53898275", "0.53897196", "0.5384999", "0.53825736", "0.53822494", "0.5381347", "0.5380986", "0.53791904", "0.53750974", "0.5373365", "0.5373342" ]
0.64750075
0
Mutation chooses one element, places it in a different bin. Behaves like a partition problem.
private int[] mutationSingleMove(int[] mutant) { int pairPoint1 = rand.nextInt(mutant.length); int newBin = mutant[pairPoint1]; while (newBin == mutant[pairPoint1]) { newBin = rand.nextInt(binCount); } mutant[pairPoint1] = newBin; //swap to a different bucket return mutant; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Chromosome doInsertionMutation(){\n for(int i = 0; i < PopulationConfiguration.MUTATION_ATTEMPTS; i++){\n ArrayList<Boolean> newSelection = copyBoolArrayList(this.knapsackSelection);\n\n int allele1 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n int allele2 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n boolean value = newSelection.get(allele2);\n\n newSelection.remove(allele2);\n try{\n newSelection.add(allele1 + 1, value);\n }\n catch(IndexOutOfBoundsException e){\n newSelection.add(value);\n }\n \n Chromosome mutatedKnapsack = new Chromosome(newSelection).withFitnessCalculated();\n if(mutatedKnapsack.isValid())\n return mutatedKnapsack;\n }\n return this;\n }", "private int[] mutationPairwiseExchange(int[] mutant) {\n\t\tint pairPoint1 = rand.nextInt(mutant.length);\n\t\tint pairPoint2 = pairPoint1;\n\t\twhile (mutant[pairPoint2] == mutant[pairPoint1]) {\n\t\t\tpairPoint2 = rand.nextInt(mutant.length); //find element in different bucket\n\t\t}\n\t\tint temp = mutant[pairPoint1];\n\t\tmutant[pairPoint1] = mutant[pairPoint2];\n\t\tmutant[pairPoint2] = temp;\n\t\treturn mutant;\n\t}", "public Chromosome doBitFlipMutation(){\n for(int i = 0; i < PopulationConfiguration.MUTATION_ATTEMPTS; i++){\n ArrayList<Boolean> newSelection = copyBoolArrayList(this.knapsackSelection);\n int itemToMutate = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n newSelection.set(itemToMutate, !newSelection.get(itemToMutate));\n\n Chromosome mutatedKnapsack = new Chromosome(newSelection).withFitnessCalculated();\n if(mutatedKnapsack.isValid())\n return mutatedKnapsack;\n }\n return this;\n }", "public Chromosome doInversionMutation(){\n for(int i = 0; i < PopulationConfiguration.MUTATION_ATTEMPTS; i++){\n ArrayList<Boolean> newSelection = copyBoolArrayList(this.knapsackSelection);\n\n int allele1 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n int allele2 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n Collections.reverse(newSelection.subList(Math.min(allele1, allele2), Math.max(allele1, allele2)));\n\n Chromosome mutatedKnapsack = new Chromosome(newSelection).withFitnessCalculated();\n if(mutatedKnapsack.isValid())\n return mutatedKnapsack;\n }\n return this;\n }", "private int[] mutateSwapChild(int[] child) {\n println(\"before mutateSwapChild\", 1);\n displayChromosome(child, 1);\n int first = (int)(Math.random() * num_shipping_points);\n int second = (int)(Math.random() * num_shipping_points);\n //make sure first and second are different\n while(first == second) {\n second = (int)(Math.random() * num_shipping_points);\n }\n int temp = child[first];\n child[first] = child[second];\n child[second] = temp;\n \n println(\"after mutateSwapChild\", 1);\n displayChromosome(child, 1);\n return child;\n }", "private int[] mutateInversionChild(int[] child) {\n println(\"before inversion mutation:\",1);\n displayChromosome(child, 1);\n int first = (int)(Math.random() * num_shipping_points);\n int second = (int)(Math.random() * num_shipping_points);\n \n //make sure first and second are different\n while(first == second) {\n second = (int)(Math.random() * num_shipping_points);\n }\n \n //Now make sure front < back.\n int front, back = 0;\n if(first < second) {\n front = first;\n back = second;\n }\n else {\n back = first;\n front = second;\n }\n //front = 5;\n //back = 10;\n \n //output(\"\\nchild before mutation:\", 2);\n //displayChromosome(child);\n //Perform the inversion.\n while(front < back) {\n int temp = child[front];\n child[front] = child[back];\n child[back] = temp;\n front++;\n back--;\n }\n //output(\"\\nchild after mutation:\", 2);\n //displayChromosome(child);\n \n println(\"after inversion mutation:\",1);\n displayChromosome(child, 1);\n return child;\n }", "public Chromosome doExchangeMutation(){\n for(int i = 0; i < PopulationConfiguration.MUTATION_ATTEMPTS; i++){\n ArrayList<Boolean> newSelection = copyBoolArrayList(this.knapsackSelection);\n\n int allele1 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n int allele2 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n Collections.swap(newSelection, allele1, allele2);\n\n Chromosome mutatedKnapsack = new Chromosome(newSelection).withFitnessCalculated();\n if(mutatedKnapsack.isValid())\n return mutatedKnapsack;\n }\n return this;\n }", "private Object mutation(Individual child){\n\t\treturn problem.improve(child.getId());\r\n\t}", "public abstract Chromosome mutation(Chromosome child);", "private int[] mutateScramble(int[] child) {\n println(\"Doing a scramble mutation\", 4);\n displayChromosome(child, 4);\n for(int r = 0; r < 3; r++) {\n child = mutateSwapChild(child);\n child = mutateInversionChild(child);\n }\n displayChromosome(child, 4);\n return child;\n }", "public void mutation(){\n \n \tfor (int[] temp : wallpapers) {\n \t\tint e = random.nextInt(20);\n \t\tfor (int y = 0; y < e; y++){\n \t\t\tint h = random.nextInt(temp.length);\n \t\t\t//Log.d(\"MUT\", \"selected index \" + h);\n \t\t\tif (h == temp.length - 1 || h == temp.length - 2 || h == temp.length - 3){\n \t\t\t\tint newrgb = random.nextInt(NODELENGTH) + 2;\n \t\t\t\t//Log.d(\"MUT\", \"Picking new node \" + newrgb);\n \t\t\t\ttemp[h] = newrgb;\n \t\t\t} else if (((h + 1) % 3) == 0){\n \t\t\t\tint newfunction = random.nextInt(NUM_FUNCTIONS);\n \t\t\t\t//Log.d(\"MUT\", \"Picking new function \" + newfunction);\n \t\t\t\ttemp[h] = newfunction;\n \t\t\t} else {\n \t\t\t\tint newinput = random.nextInt(h / 3 +1);\n \t\t\t\ttemp[h] = newinput;\n \t\t\t\t//Log.d(\"MUT\", \"Picking new input \" + newinput);\n \t\t\t}\n \t\t}\n \t}\n }", "public BTreeInternalNode splitAt(int index){\n if (parent_id == 0){\n BTreeInternalNode root_node = new BTreeInternalNode(M,buffer.getFreeId(DB_name,table_name,index_attrs),0,0,0,0,0,0,0,buffer,index_attrs,DB_name,table_name);\n updateParent(root_node.node_id);\n root_node.insertOneKeyPointer(getBiggestKey(),node_id);\n buffer.addNewNode(root_node);\n buffer.newRootNode(root_node.node_id,DB_name,table_name,index_attrs);\n }\n\n BTreeInternalNode new_node = new BTreeInternalNode(M,buffer.getFreeId(DB_name,table_name,index_attrs),parent_id,0,right_bro_id,0,0,0,0,buffer,index_attrs,DB_name,table_name);\n if (index < key_number -1){\n byte[] temp_key;\n short pt;\n int origin_key_number = key_number;\n for(int i = index + 1; i < origin_key_number; i++){\n pt = getPointer(index+1);\n temp_key = keys.get(index+1);\n new_node.insertOneKeyPointer(temp_key,pt);\n deleteKeyPointer(index+1);\n }\n\n BTreeInternalNode temp_node;\n if(next_id != 0){\n //new node next node id\n new_node.updateNextBro(next_id);\n //new node next node - prior id\n temp_node = (BTreeInternalNode) buffer.getNode(new_node.next_id,DB_name,table_name,index_attrs);\n temp_node.updatePriorBro(new_node.node_id);\n //next key number\n new_node.updateNumberToRight();\n //this next id\n updateNextBro(0);\n updateNextKeyNumber(0);\n }\n updateNumberToLeft();\n\n //neighbor\n //right bro node\n if(right_bro_id != 0){\n BTreeInternalNode origin_right_node = (BTreeInternalNode) buffer.getNode(right_bro_id,DB_name,table_name,index_attrs);\n origin_right_node.updateLeftBro(new_node.node_id);\n }\n updateRightBro(new_node.node_id);\n //left bro\n new_node.updateLeftBro(getHeadNode().node_id);\n //sons'parent id\n BTreeNode temp;\n for (int i = 0; i < new_node.key_number; i ++){\n temp = buffer.getNode(new_node.getPointer(i),DB_name,table_name,index_attrs);\n temp.updateParent(new_node.node_id);\n }\n //freespace\n buffer.addNewNode(new_node);\n return new_node;\n }else{\n return null;\n }\n }", "private int[] mutateChild(int[] child) {\n println(\"mutateChild()\", 1);\n int first = (int)(Math.random() * num_shipping_points);\n int second = (int)(Math.random() * num_shipping_points);\n //make sure first and second are different\n while(first == second) {\n second = (int)(Math.random() * num_shipping_points);\n }\n int temp = child[first];\n child[first] = child[second];\n child[second] = temp;\n \n return child;\n }", "@SuppressWarnings(\"unchecked\")\r\n\t@Override\r\n\tpublic void mutation() {\r\n\t\tfinal double MUTATION_PROB = 0.1;\r\n\t\tfor (int i=0; i<this.nChromosomes; i++) {\r\n\t\t\tArrayList<Integer> chr = (ArrayList<Integer>) this.chromosomes.get(i);\r\n\t\t\tfor (int j=0; j<this.nViaPoints; j++) {\r\n\t\t\t\tdouble rand = Math.random();\r\n\t\t\t\tif (rand < MUTATION_PROB) {\r\n\t\t\t\t\t// change the sign\r\n\t\t\t\t\tInteger vPoint = chr.get(j);\r\n\t\t\t\t\tchr.remove(j);\r\n\t\t\t\t\tchr.add(j, new Integer(- (vPoint.intValue()%100)));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.printChromosomes(\"After Mutation\");\r\n\t}", "@Override\n\tpublic void applyMutation(int index, double a_percentage) {\n\n\t}", "BinaryArrayReadWrite set(int index, byte x);", "public void partition();", "protected void elementInstered(MutationEvent evt) throws MelodyException {\r\n\t\tsuper.elementInstered(evt);\r\n\t\t// the inserted node\r\n\t\tElement t = (Element) evt.getTarget();\r\n\t\t// its next sibling\r\n\t\tNode s = t.getNextSibling();\r\n\t\twhile (s != null && s.getNodeType() != Node.ELEMENT_NODE) {\r\n\t\t\ts = s.getNextSibling();\r\n\t\t}\r\n\t\tDUNID sdunid = DUNIDDocHelper.getDUNID((Element) s);\r\n\t\t// its parent node\r\n\t\tElement p = (Element) t.getParentNode();\r\n\t\tDUNID pdunid = DUNIDDocHelper.getDUNID(p);\r\n\t\t// Modify the DUNIDDoc\r\n\t\tDocument d = getOwnerDUNIDDoc(p).getDocument();\r\n\t\tElement pori = DUNIDDocHelper.getElement(d, pdunid);\r\n\t\tpori.insertBefore(d.importNode(t, true),\r\n\t\t\t\tDUNIDDocHelper.getElement(d, sdunid));\r\n\t\t// Modify the targets descriptor\r\n\t\tif (!areTargetsFiltersDefined()) {\r\n\t\t\t/*\r\n\t\t\t * If there is no targets filters defined, there's no need to modify\r\n\t\t\t * the targets descriptor.\r\n\t\t\t */\r\n\t\t\treturn;\r\n\t\t}\r\n\t\td = getTargetsDescriptor().getDocument();\r\n\t\tpori = DUNIDDocHelper.getElement(d, pdunid);\r\n\t\tif (pori != null) { // inserted node parent is in the targets descriptor\r\n\t\t\tpori.insertBefore(d.importNode(t, true),\r\n\t\t\t\t\tDUNIDDocHelper.getElement(d, sdunid));\r\n\t\t}\r\n\t}", "private void setElement(int index, E element) {\n// if (getElement(index) != null) {\n// setContents.remove(getElement(index));\n// }\n while (index >= contents.size()) {\n contents.add(null);\n }\n contents.set(index, element);\n// contents.put(index, element);\n backwards.put(element, index);\n\n// if (element != null) {\n// setContents.add(getElement(index));\n// }\n }", "private void uniformMutation(){\n Random random = new Random();\n double newValue = random.nextGaussian()*16.6 + 50.0;\n if(newValue < 0) newValue = 0;\n if(newValue > 100) newValue = 100;\n int gene = random.nextInt(6);\n switch (gene){\n case 0 : this.x1 = newValue; break;\n case 1 : this.x2 = newValue; break;\n case 2 : this.x3 = newValue; break;\n case 3 : this.y1 = newValue; break;\n case 4 : this.y2 = newValue; break;\n case 5 : this.y3 = newValue; break;\n }\n }", "public Integer mutate(int index);", "@Override\n public void insert(int element) {\n if (isFull()) {\n throw new IllegalStateException(\"Heap is full.\");\n }\n\n // Percolate up\n usedSize++;\n heap[heapSize++] = element; // insert element\n heapifyUp(heapSize - 1);\n\n // Percolate down (doesn't work)\n //usedSize++;\n //heap[heapSize++] = element;\n //heapifyDown(heapSize - 1);\n }", "private void mutate() {\n\t\tfor (int i = 0; i < population; ++i) {\n\t\t\tpopulationArray.set(i, populationArray.get(i).generateNeighbor());\n\t\t}\n\t}", "public Chromosome doDisplacementMutation(){\n for(int i = 0; i < PopulationConfiguration.MUTATION_ATTEMPTS; i++){\n ArrayList<Boolean> newSelection = copyBoolArrayList(this.knapsackSelection);\n\n int allele1 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n int allele2 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n\n int leftAllele = Math.min(allele1, allele2);\n int rightAllele = Math.max(allele1, allele2);\n\n var selectionSublist = new ArrayList<Boolean>(newSelection.subList(leftAllele, rightAllele));\n for(int j = leftAllele; j < rightAllele + 1; j++){\n newSelection.remove(leftAllele);\n }\n\n int index = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size()+1);\n newSelection.addAll(index, selectionSublist);\n\n Chromosome mutatedKnapsack = new Chromosome(newSelection).withFitnessCalculated();\n if(mutatedKnapsack.isValid())\n return mutatedKnapsack;\n }\n return this;\n }", "private int insertForciblyIntoPopulation(Individual new_child) {\n int position = insertIntoPopulation(new_child);\n if( position == population_size) {\n population[population_size - 1] = new_child;\n position = population_size - 1;\n }\n return position;\n }", "private void heapify(int idx) {\r\n // TODO\r\n }", "private BTreeNode split(BTreeNode parentNode, int index, BTreeSearchResult oldChild) throws IOException{\r\n\t\t\r\n\t\t// Allocate new node and find median\r\n\t\tBTreeNode newChild = new BTreeNode(this.order);\r\n\t\tint median = (int) Math.round( (double) this.order/2);\r\n\t\t\r\n\t\t// Move values to new node\r\n\t\tfor (int i=0; i < median-1; i++){\r\n\t\t\tnewChild.key[i] = oldChild.node.key[i+median];\r\n\t\t\tnewChild.info[i] = oldChild.node.info[i+median];\r\n\t\t}\r\n\t\tnewChild.numKeys = median-1;\r\n\t\tnewChild.parent = oldChild.node.parent;\r\n\t\tif (!oldChild.node.isLeaf()){\r\n\t\t\tfor (int i=0; i < median; i++){\r\n\t\t\t\tnewChild.child[i] = oldChild.node.child[i+median];\r\n\t\t\t}\r\n\t\t}\r\n\t\t// Update numKeys left\r\n\t\toldChild.node.numKeys = oldChild.node.numKeys - newChild.numKeys - 1;\r\n\t\t\r\n\t\t// Move median key to parent\r\n\t\tfor (int i = parentNode.numKeys; i > index; i--){\r\n\t\t\tparentNode.child[i+1] = parentNode.child[i];\r\n\t\t}\r\n\t\tfor (int i = parentNode.numKeys-1; i > index-1; i--){\r\n\t\t\tparentNode.key[i+1] = parentNode.key[i];\r\n\t\t\tparentNode.info[i+1] = parentNode.info[i];\r\n\t\t}\r\n\t\tparentNode.key[index] = oldChild.node.key[median-1];\r\n\t\tparentNode.info[index] = oldChild.node.info[median-1];\r\n\t\tparentNode.numKeys++;\r\n\t\t\r\n\t\t// Write 3 nodes to disk\r\n\t\tbyte[] byteBuffer = new byte[this.pageSize];\r\n\t\tbyteBuffer = oldChild.node.serialize(this.pageSize);\r\n\t\tthis.writePage(byteBuffer, oldChild.pageFound*this.pageSize);\r\n\t\t\r\n\t\tbyteBuffer = newChild.serialize(this.pageSize);\r\n\t\tthis.writePage(byteBuffer, this.length());\r\n\t\t\r\n\t\tparentNode.child[index+1] = (int) (this.length()/this.pageSize - 1); //New node is always in last page\r\n\t\tbyteBuffer = parentNode.serialize(this.pageSize);\r\n\t\tthis.writePage(byteBuffer, newChild.parent*this.pageSize);\r\n\t\treturn newChild;\r\n\t}", "public void update(Tuple2<Integer, Float> input){\n totalFrequencies += input.f1;\n double maxSize = (MAXCOEF * totalFrequencies) / maxNumBars; // maximum value a bar can have before it should split\n float binFrequency;\n int next = input.f0;\n if (bars.isEmpty()){\n bars.put(next, input.f1);\n rightBoundary = next;\n\n }else {\n int key;\n if (bars.floorKey(next) != null) {\n key = bars.floorKey(next);\n if (key == bars.lastKey() && next > rightBoundary){ // if key greater than current right boundary it becomes the new boundary\n rightBoundary = next;\n }\n binFrequency = bars.get(key) + input.f1;\n bars.replace(key, binFrequency);\n }else{ // element is new leftmost boundary\n key = bars.ceilingKey(next);\n binFrequency = bars.get(key) + input.f1;\n bars.remove(key); // remove old bin\n key = next;\n bars.put(key, binFrequency); // create new bin with new left boundary\n }\n\n\n if (binFrequency > maxSize){ // split bins while\n /**\n * Split Bin\n */\n splitBin(key, maxSize); // split this bin until all bins within the original bin's bounds are below maxSize\n\n\n /**\n * Merge the two smallest adjacent bars\n */\n while (bars.size() > maxNumBars){\n // Find Bars to Merge\n float currentMin = Float.MAX_VALUE;\n int lowKey = 0;\n\n int currentKey = bars.firstKey();\n while (bars.higherKey(currentKey) != null){\n if (bars.get(currentKey) + bars.get(bars.higherKey(currentKey)) < currentMin){\n lowKey = currentKey;\n currentMin = bars.get(currentKey) + bars.get(bars.higherKey(currentKey));\n }\n currentKey = bars.higherKey(currentKey);\n }\n bars.remove(bars.higherKey(lowKey));\n bars.replace(lowKey, currentMin);\n }\n }\n\n }\n\n }", "protected void percolateUp(int leaf){\n int parent = parent(leaf);\n Bloque value = (Bloque)data.get(leaf);\n while (leaf > 0 && (value.compareTo(data.get(parent)) > 0)){\n data.set(leaf,data.get(parent));\n leaf = parent;\n parent = parent(leaf);\n }\n data.set(leaf,value);\n }", "protected void mutateAddNode() {\n\t\t// Test if genome is fully disabled\n\t\tboolean fullydisabled = true;\n\t\tfor (Gene g : genes.values()) {\n\t\t\tif (g.enabled) {\n\t\t\t\tfullydisabled = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (fullydisabled)\n\t\t\treturn;\n\n\t\t// Select the gene to be split\n\t\tGene mutated;\n\t\tdo {\n\t\t\tmutated = getRandomGene();\n\t\t} while (!mutated.enabled);\n\n\t\t// Create the new structure\n\t\tNNode addition = new NNode(population.getNewNodeID(), NNode.HIDDEN);\n\t\tpopulation.registerNode(addition);\n\n\t\tint earlystart = mutated.start;\n\t\tint earlyend = addition.ID;\n\t\tint earlyinnov = population.getInnovation(earlystart, earlyend);\n\t\tGene early = new Gene(earlyinnov, earlystart, earlyend, 1, true);\n\t\tpopulation.registerGene(early);\n\n\t\tint latestart = addition.ID;\n\t\tint lateend = mutated.end;\n\t\tint lateinnov = population.getInnovation(latestart, lateend);\n\t\tGene late = new Gene(lateinnov, latestart, lateend, mutated.weight,\n\t\t\t\ttrue);\n\t\tpopulation.registerGene(late);\n\n\t\t// Disable old gene\n\t\tmutated.enabled = false;\n\n\t\t// Submit new node\n\t\tsubmitNewNode(addition);\n\n\t\t// Submit new genes\n\t\tsubmitNewGene(early);\n\t\tsubmitNewGene(late);\n\n\t\tif (Braincraft.gatherStats)\n\t\t\tBraincraft.genetics.add(\"node mutation \" + ID + \" \"\n\t\t\t\t\t+ mutated.innovation + \" \" + early.innovation + \" \"\n\t\t\t\t\t+ late.innovation + \" \" + addition.ID);\n\t}", "private static <E> void siftDown(E[] array, Comparator<E> comparator, int offset, int start, int end) {\n int root = start, child = (root-offset)*2+1+offset;\n while (child <= end) {\n if (child+1<=end && comparator.compare(array[child], array[child+1])<0) {\n child = child+1;\n }\n if (comparator.compare(array[root], array[child])<0) {\n DataManipulator.swapData(array, root, child);\n root = child;\n child = (root-offset)*2+1+offset;\n } else {\n return;\n }\n }\n }", "private void mutate(float probability) {\r\n\r\n individual[] temp_pop = new individual[this.pop_size];\r\n\r\n for (int i = 0; i < this.pop_size; i++) {\r\n\r\n float temp_genes[] = this.offspring_population.getPopulation()[i].getGenes();\r\n\r\n // mutation can now mutate wild cards\r\n for (int j = 0; j < temp_genes.length; j++) {\r\n float k = new Random().nextFloat();\r\n\r\n if (k <= probability) {\r\n float temp = new Random().nextFloat();\r\n temp_genes[j] = temp; // add a float between 0-1 // just mutate a new float\r\n }\r\n }\r\n individual child = new individual(temp_genes, solutions, output);\r\n temp_pop[i] = child;\r\n }\r\n this.main_population.setPopulation(temp_pop);\r\n this.main_population.update_population();\r\n }", "@Override\n public E set(int index, E elem) {\n\t E first = _store[index];\n\t _store[index] =elem;\n\t return first;\n }", "private void mutation() {\n\t\tfor (int i = 0; i < 4; i++) {\n\t\t\tint num = (int) (Math.random() * GENE * ChrNum + 1);\n\t\t\tint chromosomeNum = (int) (num / GENE) + 1;\n\n\t\t\tint mutationNum = num - (chromosomeNum - 1) * GENE; \n\t\t\tif (mutationNum == 0) \n\t\t\t\tmutationNum = 1;\n\t\t\tchromosomeNum = chromosomeNum - 1;\n\t\t\tif (chromosomeNum >= ChrNum)\n\t\t\t\tchromosomeNum = 9;\n\t\t\tString temp;\n\t\t\tString a; \n\t\t\tif (ipop[chromosomeNum].charAt(mutationNum - 1) == '0') { \n a = \"1\";\n\t\t\t} else { \n\t\t\t\ta = \"0\";\n\t\t\t}\n\t\t\t\n\t\t\tif (mutationNum == 1) {\n\t\t\t\ttemp = a + ipop[chromosomeNum].substring(mutationNum);\n\t\t\t} else {\n\t\t\t\tif (mutationNum != GENE) {\n\t\t\t\t\ttemp = ipop[chromosomeNum].substring(0, mutationNum -1) + a \n\t\t\t\t\t\t\t+ ipop[chromosomeNum].substring(mutationNum);\n\t\t\t\t} else {\n\t\t\t\t\ttemp = ipop[chromosomeNum].substring(0, mutationNum - 1) + a;\n\t\t\t\t}\n\t\t\t}\n \tipop[chromosomeNum] = temp;\n\t\t}\n\t}", "public @Override E set(int index, E element) {\n \tNode n = getNode(index);\n \tE result = n.data;\n \tn.data = element;\n \treturn result;\n }", "private void rehash() {\n\t\tint oldSize = this.size;\n\t\tint newSize = size * 2;\n\t\twhile (!isPrime(newSize))\n\t\t\tnewSize++;\n\t\tthis.size = newSize;\n\t\tDataItem[] newHashArray = new DataItem[newSize];\n\t\tString temp;\n\t\tthis.collision = 0;\n\t\tBoolean repeatValue;\n\t\tfor (int i = 0; i < oldSize; i++) {\n\t\t\tif (hashArray[i] != null && hashArray[i] != deleted)\n\t\t\t\ttemp = hashArray[i].value;\n\t\t\telse\n\t\t\t\tcontinue;\n\t\t\trepeatValue = false;\n\t\t\tint hashVal = hashFunc(temp);\n\t\t\tboolean collisionFlag = false;\n\t\t\twhile (newHashArray[hashVal] != null\n\t\t\t\t\t&& !newHashArray[hashVal].value.equals(deleted.value)) {\n\n\t\t\t\tif (!collisionFlag) {\n\n\t\t\t\t\tthis.collision++;\n\t\t\t\t\tcollisionFlag = true;\n\n\t\t\t\t}\n\t\t\t\thashVal++;\n\t\t\t\thashVal = hashVal % size;\n\n\t\t\t}\n\t\t\tif (repeatValue)\n\t\t\t\tcontinue;\n\t\t\telse {\n\t\t\t\tnewHashArray[hashVal] = hashArray[i];\n\t\t\t}\n\t\t}\n\n\t\tthis.hashArray = newHashArray;\n\t}", "private void coins_a1B(){\n\t\tthis.cube[22] = this.cube[9]; \n\t\tthis.cube[9] = this.cube[45];\n\t\tthis.cube[45] = this.cube[36];\n\t\tthis.cube[36] = this.cube[0];\n\t\tthis.cube[0] = this.cube[22];\n\t}", "public int set(int index, int element);", "public LinearGenomeShrinkMutation(){\n\t\tnumberGenesToRemove = 1;\n\t}", "@Test\n public void partitionCorrectness() {\n List<Integer> ns = new Node<>(5, new Node<>(3,\n new Node<>(7, new Node<>(1, new Empty<>()))));\n List<Integer> empty = new Empty<>();\n assertFalse(DP.bupartition(ns, 2));\n assertTrue(DP.bupartition(ns, 8));\n assertTrue(DP.bupartition(ns, 6));\n assertTrue(DP.bupartition(ns,4));\n assertTrue(DP.bupartition(ns,11));\n assertFalse(DP.bupartition(empty, 6));\n }", "protected abstract int getBucketIndex(int freeSpace);", "private void updateBIT(int []arr, int n, int index, int val) {\n while(index <= n) {\n // Add 'val' to current node of BIT Tree\n arr[index] += val;\n\n // Update index to that of parent in update View\n index += index & (-index);\n }\n }", "public void split(){\n\t\tamountOfShares = amountOfShares*2;\n\t}", "public V bubbaPut(K key, V value) {\n int idx = hash(key);\n int hashVal = idx;\n var entry = new Entry(key, value, 0);\n\n while (table[idx] != null) {\n if (table[idx].offset == calcOff(hashVal, idx) && table[idx].key.equals(key)) {\n V oldVal = table[idx].value;\n table[idx].value = value;\n return oldVal;\n } else if (table[idx].offset < calcOff(hashVal, idx)) {\n var temp = table[idx];\n table[idx] = entry;\n entry.offset = calcOff(hashVal, idx);\n entry = temp;\n hashVal = hash(entry.key);\n }\n idx = increment(idx);\n }\n table[idx] = entry;\n entry.offset = calcOff(hashVal, idx);\n size++;\n if (size >= loadFactor * table.length) {\n rehash(table.length * 2);\n }\n return value;\n }", "public void placePiece(Piece newPiece){pieceAtVertex = newPiece;}", "void Union(int parent[], int x, int y){ \n int xset = find(parent, x); \n int yset = find(parent, y); \n parent[xset] = yset; \n }", "private void rehashing(boolean increase){\r\n int newLength;\r\n // if loadFactor is too big. //\r\n if (increase){\r\n newLength = capacity()*CAPACITY_CHANGE;\r\n }\r\n // if loadFactor is too small. //\r\n else{newLength = capacity()/CAPACITY_CHANGE;}\r\n // builds the new hashSet with the new capacity. //\r\n ClosedHashCell[] newHashSet = new ClosedHashCell[newLength];\r\n buildHashSet(newLength, newHashSet);\r\n for (ClosedHashCell cell : hashSet){\r\n if (cell.getValue() != null) {\r\n int j = 0;\r\n int clamping = (cell.getValue().hashCode() + (j+j*j) / 2) & (newLength - 1);\r\n while (!newHashSet[clamping].addMe(cell.getValue())) {\r\n j++;\r\n clamping = (cell.getValue().hashCode() + (j+j*j) / 2) & (newLength - 1);\r\n }\r\n }\r\n }\r\n hashSet = newHashSet;\r\n }", "protected int insertionIndex(int key) {\r\n\t\tint hash = key & 0x7fffffff;\r\n\t\tint index = this.hashFunc1(hash) * FREE.length;\r\n\t\t// int stepSize = hashFunc2(hash);\r\n\t\tbyte[] cur = new byte[4];\r\n\t\tkeys.position(index);\r\n\t\tkeys.get(cur);\r\n int storehash=(cur[0] << 24)+ ((cur[1] & 0xFF) << 16)+ ((cur[2] & 0xFF) << 8)+ (cur[3] & 0xFF);\r\n\r\n\t\tif (Arrays.equals(cur, FREE)) {\r\n\t\t\treturn index; // empty, all done\r\n\t\t} else if (storehash==key) {\r\n\t\t\treturn -index - 1; // already stored\r\n\t\t} else { // already FULL or REMOVED, must probe\r\n\t\t\t// compute the double hash\r\n\t\t\tfinal int probe = (1 + (hash % (size - 2))) * FREE.length;\r\n\r\n\t\t\t// if the slot we landed on is FULL (but not removed), probe\r\n\t\t\t// until we find an empty slot, a REMOVED slot, or an element\r\n\t\t\t// equal to the one we are trying to insert.\r\n\t\t\t// finding an empty slot means that the value is not present\r\n\t\t\t// and that we should use that slot as the insertion point;\r\n\t\t\t// finding a REMOVED slot means that we need to keep searching,\r\n\t\t\t// however we want to remember the offset of that REMOVED slot\r\n\t\t\t// so we can reuse it in case a \"new\" insertion (i.e. not an update)\r\n\t\t\t// is possible.\r\n\t\t\t// finding a matching value means that we've found that our desired\r\n\t\t\t// key is already in the table\r\n\t\t\tif (!Arrays.equals(cur, REMOVED)) {\r\n\t\t\t\t// starting at the natural offset, probe until we find an\r\n\t\t\t\t// offset that isn't full.\r\n\t\t\t\tdo {\r\n\t\t\t\t\tindex += (probe); // add the step\r\n\t\t\t\t\tindex %= (size * FREE.length); // for wraparound\r\n\t\t\t\t\tcur = new byte[FREE.length];\r\n\t\t\t\t\tkeys.position(index);\r\n\t\t\t\t\tkeys.get(cur);\r\n\t\t\t\t} while (!Arrays.equals(cur, FREE)\r\n\t\t\t\t\t\t&& !Arrays.equals(cur, REMOVED)\r\n\t\t\t\t\t\t&& storehash!=hash);\r\n\t\t\t}\r\n\r\n\t\t\t// if the index we found was removed: continue probing until we\r\n\t\t\t// locate a free location or an element which equal()s the\r\n\t\t\t// one we have.\r\n\t\t\tif (Arrays.equals(cur, REMOVED)) {\r\n\t\t\t\tint firstRemoved = index;\r\n\t\t\t\twhile (!Arrays.equals(cur, FREE)\r\n\t\t\t\t\t\t&& (Arrays.equals(cur, REMOVED) || storehash!=hash)) {\r\n\t\t\t\t\tindex += (probe); // add the step\r\n\t\t\t\t\tindex %= (size * FREE.length); // for wraparound\r\n\t\t\t\t\tcur = new byte[FREE.length];\r\n\t\t\t\t\tkeys.position(index);\r\n\t\t\t\t\tkeys.get(cur);\r\n\t\t\t\t}\r\n\t\t\t\t// NOTE: cur cannot == REMOVED in this block\r\n\t\t\t\treturn (!Arrays.equals(cur, FREE)) ? -index - 1 : firstRemoved;\r\n\t\t\t}\r\n\t\t\t// if it's full, the key is already stored\r\n\t\t\t// NOTE: cur cannot equal REMOVE here (would have retuned already\r\n\t\t\t// (see above)\r\n\t\t\treturn storehash!=hash ? -index - 1 : index;\r\n\t\t}\r\n\t}", "public static ArrayList<Individuo> mutaHeuristica(ArrayList<Individuo> genAnt,int nB){\n ArrayList<Individuo> aux = genAnt;\n ArrayList<Integer> genesS = new ArrayList<>();\n int nM = (int) (genAnt.size()*0.2); //determina cuantos individuos van a ser mutados\n int iS,gS,i=0,n,c;\n byte gaux[],baux;\n Random r = new Random();\n while(i<nM){\n gS = r.nextInt(nB+1);//selecciona el numero de genes aleatoriamente\n iS = r.nextInt(genAnt.size());//selecciona un individuo aleatoriamente\n gaux = aux.get(iS).getGenotipo();//obtenemos genotipo de ind seleccionado\n c=0;\n System.out.println(gS);\n //seleccionamos genes a ser permutados\n while(c != gS){\n n = r.nextInt(nB);\n if(!genesS.contains(n)){\n genesS.add(n);\n System.out.print(genesS.get(c)+\" \");\n c++;\n }\n }\n System.out.println(\"\");\n //aux.remove(iS);//quitamos elemento\n //aux.add(iS, new Individuo(gaux,genAnt.get(0).getTipoRepre()));//añadimos elemento mutado\n i++;\n }\n return aux;\n }", "public void insertOneKeyPointer(byte[] new_key, int pointer_id){\n int total_number = prior_key_number + key_number + next_key_number;\n\n if (total_number == key_number){\n\n //node in one block\n if(total_number == M){\n //split\n byte[] old_biggest = getBiggestKey();\n int mid = (int) Math.ceil((double)M/2) - 1;\n BTreeInternalNode split_node;\n //add split node to parent node\n if(M % 2 == 1){\n if(compare2key(keys.get(mid),new_key) == Util.G)\n split_node = splitAt(mid-1);\n else\n split_node = splitAt(mid);\n }else{\n split_node = splitAt(mid);\n }\n if(parent_id != 0){\n //insert to left node\n BTreeInternalNode parent_node = (BTreeInternalNode)buffer.getNode(parent_id,DB_name,table_name,index_attrs);\n parent_node.insertOneKeyPointer(split_node.getBiggestKey(),split_node.node_id);\n }\n if(compare2key(keys.get(mid),new_key) == Util.G){\n insertOneKeyPointer(new_key,pointer_id);\n }else{\n split_node.insertOneKeyPointer(new_key,pointer_id);\n }\n for (int i = 0; i < split_node.key_number; i ++){\n buffer.getNode(split_node.getPointer(i),DB_name,table_name,index_attrs).updateParent(split_node.node_id);\n }\n }else{\n if(key_number == 0){\n insertKeyPointer(0,new_key,pointer_id);\n return;\n }\n int insert_index = BinarySearch(new_key,0,key_number - 1);\n if (free_space >= 2 + key_length){\n insertKeyPointer(insert_index,new_key,pointer_id);\n }else{\n BTreeInternalNode new_node = new BTreeInternalNode(M,buffer.getFreeId(DB_name,table_name,index_attrs),parent_id,left_bro_id,right_bro_id,\n node_id,0,prior_key_number + key_number,0,buffer,index_attrs,DB_name,table_name);\n byte[] biggest_key = keys.get(key_number - 1);\n short pt = getPointer(key_number - 1);\n updateNextBro(new_node.node_id);\n buffer.addNewNode(new_node);\n deleteKeyPointer(key_number - 1);\n new_node.insertOneKeyPointer(biggest_key,pt);\n insertOneKeyPointer(new_key,pointer_id);\n }\n }\n }else{\n //node in many blocks\n if (total_number == M){\n int mid = (int) Math.ceil((double)M/2) - 1;\n BTreeInternalNode split_node;\n if (mid >= key_number + prior_key_number){\n //this node do not split\n BTreeInternalNode next_node = (BTreeInternalNode) buffer.getNode(next_id,DB_name,table_name,index_attrs);\n next_node.insertOneKeyPointer(new_key,pointer_id);\n return;\n }else if (mid < prior_key_number) {\n BTreeInternalNode prior_node = (BTreeInternalNode) buffer.getNode(prior_id,DB_name,table_name,index_attrs);\n prior_node.insertOneKeyPointer(new_key,pointer_id);\n }else{\n byte[] old_biggest = getBiggestKey();\n int old_next_id = next_id;\n if(M % 2 == 1){\n if(compare2key(keys.get(mid),new_key) == Util.G){\n if (mid == prior_key_number){\n //special case - split\n BTreeInternalNode prior_node = (BTreeInternalNode) buffer.getNode(prior_id,DB_name,table_name,index_attrs);\n prior_node.updateNextBro(0);\n prior_node.updateNextKeyNumber(0);\n prior_node.updateNumberToLeft();\n //bro\n BTreeInternalNode head_node = (BTreeInternalNode) prior_node.getHeadNode();\n BTreeInternalNode origin_right_node = (BTreeInternalNode) buffer.getNode(prior_node.right_bro_id,DB_name,table_name,index_attrs);\n origin_right_node.updateLeftBro(node_id);\n prior_node.updateRightBro(node_id);\n\n updatePriorBro(0);\n updatePriorKeyNumber(0);\n updateNumberToRight();\n updateLeftBro(head_node.node_id);\n\n prior_node.insertOneKeyPointer(new_key,pointer_id);\n if(parent_id !=0) {\n BTreeInternalNode parent_node = (BTreeInternalNode)buffer.getNode(parent_id,DB_name,table_name,index_attrs);\n parent_node.insertOneKeyPointer(prior_node.getBiggestKey(), head_node.node_id);\n parent_node.updateKeyPointer(getBiggestKey(), null, node_id);\n }else{\n createRootNode(prior_node,this);\n }\n return;\n }\n split_node = splitAt(mid- prior_key_number - 1);\n }\n else\n split_node = splitAt(mid - prior_key_number);\n }else{\n split_node = splitAt(mid - prior_key_number);\n }\n if(parent_id != 0){\n BTreeInternalNode parent_node = (BTreeInternalNode)buffer.getNode(parent_id,DB_name,table_name,index_attrs);\n if(old_next_id != 0)\n parent_node.updateKeyPointer(old_biggest,getBiggestKey(),getHeadNode().node_id);\n parent_node.insertOneKeyPointer(split_node.getBiggestKey(),split_node.node_id);\n }\n if(compare2key(keys.get(mid - prior_key_number),new_key) == Util.G){\n insertOneKeyPointer(new_key,pointer_id);\n }else{\n split_node.insertOneKeyPointer(new_key,pointer_id);\n }\n for (int i = 0; i < split_node.key_number; i ++){\n buffer.getNode(split_node.getPointer(i),DB_name,table_name,index_attrs).updateParent(split_node.node_id);\n }\n }\n }else{\n if(next_id != 0){\n BTreeInternalNode next_node = (BTreeInternalNode) buffer.getNode(next_id,DB_name,table_name,index_attrs);\n if(compare2key(next_node.keys.get(0),new_key) != Util.G) {\n next_node.insertOneKeyPointer(new_key, pointer_id);\n return;\n }\n }\n if(prior_id != 0){\n BTreeInternalNode prior_node = (BTreeInternalNode) buffer.getNode(prior_id,DB_name,table_name,index_attrs);\n if(compare2key(prior_node.keys.get(prior_node.key_number - 1),new_key) != Util.L){\n prior_node.insertOneKeyPointer(new_key,pointer_id);\n return;\n }\n }\n int insert_index = BinarySearch(new_key,0,key_number - 1);\n if (free_space >= 2 + key_length){\n insertKeyPointer(insert_index,new_key,pointer_id);\n }else{\n BTreeInternalNode new_node;\n Boolean create_new_node = false;\n if(next_id != 0){\n new_node =(BTreeInternalNode) buffer.getNode(next_id,DB_name,table_name,index_attrs);\n if(new_node.free_space < key_length + 2){\n new_node = new BTreeInternalNode(M,buffer.getFreeId(DB_name,table_name,index_attrs),parent_id,left_bro_id,right_bro_id, node_id,0,prior_key_number + key_number,0,buffer,index_attrs,DB_name,table_name);\n buffer.addNewNode(new_node);\n create_new_node = true;\n }\n }else{\n new_node = new BTreeInternalNode(M,buffer.getFreeId(DB_name,table_name,index_attrs),parent_id,left_bro_id,right_bro_id, node_id,0,prior_key_number + key_number,0,buffer,index_attrs,DB_name,table_name);\n buffer.addNewNode(new_node);\n create_new_node = true;\n }\n if(create_new_node && next_id != 0){\n BTreeNode origin_next_node = buffer.getNode(next_id,DB_name,table_name,index_attrs);\n origin_next_node.updatePriorBro(new_node.node_id);\n new_node.updateNextBro(origin_next_node.node_id);\n new_node.updateNextKeyNumber(origin_next_node.key_number + origin_next_node.next_key_number);\n }\n updateNextBro(new_node.node_id);\n byte[] biggest_key = keys.get(key_number - 1);\n short pt = getPointer(key_number - 1);\n deleteKeyPointer(key_number - 1);\n new_node.insertOneKeyPointer(biggest_key,pt);\n insertOneKeyPointer(new_key,pointer_id);\n }\n }\n }\n }", "protected void _setMedium(int index, int value)\r\n/* 459: */ {\r\n/* 460:473 */ HeapByteBufUtil.setMedium(this.array, index, value);\r\n/* 461: */ }", "private int getIndex2(int val){\n return val/bucket;\n }", "public static void adjustHeap(int []arr,int i,int length){\n int temp=arr[i];//first get current value/item\n for(int k=i*2+1;k<length;k=k*2+1){//from the left child of current item,in other word,the 2i+1 item\n if(k+1<length&&arr[k]<arr[k+1]){//if the left child is less than the right child ,let k point to right child\n k++;\n }\n if(arr[k]>temp){//if k item-the max of left-right child is more than i item ,swap it ,and maybe k item and his child need to change\n arr[i]=arr[k];\n i=k;\n }else{\n break;\n }\n }\n arr[i]=temp;//place the temp=arr[i] at right position\n }", "private void swapElement ( int p1, int p2 )\n\t{\n\t}", "private void swim(int index)\r\n\t{\n\t\twhile (index > 1)\r\n\t\t{\r\n\t\t\tint parentIndex = index / 2;\r\n\t\t\t\r\n\t\t\tif (data[index].compareTo(data[parentIndex]) < 0)\r\n\t\t\t{\r\n\t\t\t\tswap(index, parentIndex);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tindex = parentIndex;\r\n\t\t}\r\n\t}", "void setGivenByOrder(int[] gbo);", "public void insertToBucket()\n {\n int value = 0;\n value = valueCheck(value);\n \n //inserts value in the array to the buckets\n if(value == 0)\n {\n zero.add(a[k]);\n a[k] = 0;\n }\n if(value == 1)\n {\n one.add(a[k]);\n a[k] = 0;\n }\n if(value == 2)\n {\n two.add(a[k]);\n a[k] = 0;\n }\n if(value == 3)\n {\n three.add(a[k]);\n a[k] = 0;\n }\n if(value == 4)\n {\n four.add(a[k]);\n a[k] = 0;\n }\n if(value == 5)\n {\n five.add(a[k]);\n a[k] = 0;\n }\n if(value == 6)\n {\n six.add(a[k]);\n a[k] = 0;\n }\n if(value == 7)\n {\n seven.add(a[k]);\n a[k] = 0;\n }\n if(value == 8)\n {\n eight.add(a[k]);\n a[k] = 0;\n }\n if(value == 9)\n {\n nine.add(a[k]);\n a[k] = 0;\n }\n \n k++;\n }", "void insert(int ele){\n if(heapLen>=A.length)\n {\n System.out.println(\"Heap is full\");\n }\n else\n {\n A[heapLen] = 1<< 31;\n heapLen++;\n increaseKey(heapLen, ele);\n \n \n }\n }", "@Override public void run() {\n\t\t\t// Handle the base case:\n\t\t\tif(len - start < 2) {\n\t\t\t\t// Arrive at the base-case state & return:\n\t\t\t\tph.arrive();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// TODO: Select an optimal pivot point:\n\t\t\tint pivot = start;\n\n\t\t\t// Perform the necessary swap operations:\n\t\t\tfor(int i = start; i < len; ++i) {\n\t\t\t\tif(data[i] < data[pivot]) {\n\t\t\t\t\tint tmp = data[pivot];\n\t\t\t\t\tdata[pivot] = data[i];\n\t\t\t\t\tdata[i] = data[pivot + 1];\n\t\t\t\t\tdata[pivot + 1] = tmp;\n\t\t\t\t\t++pivot;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Handle the single-threaded case:\n\t\t\tif(this.pool == null) {\n\t\t\t\t// Store local variables temporarily:\n\t\t\t\tint start = this.start;\n\t\t\t\tint len = this.len;\n\n\t\t\t\t// Do the first half:\n\t\t\t\tthis.len = pivot;\n\t\t\t\trun();\n\n\t\t\t\t// Prepare for the second half of the array:\n\t\t\t\tthis.len = len;\n\t\t\t} else {\n\t\t\t\t\t// Register a task to process the first half of the array:\n\t\t\t\t\t// TODO: Don't do this if that thread's base-case is met\n\t\t\t\t\tpool.submit(new Sorter(this.pool, this.ph, data, start, pivot));\n\t\t\t}\n\n\t\t\t// Recursively process the second half of the array:\n\t\t\tstart = pivot + 1;\n\t\t\trun();\n\t\t}", "private void mutateArray(Building building){\n\t\t// randomly choose to either\n\t\t// 0 = add a random possible piece to the building\n\t\t// 1 = change a piece in the sequence randomly\n\t\tint randChoice = randomGenerator.nextInt(2);\n\t\t\n\t\tint randSeqIndex = randomGenerator.nextInt(building.getList().length);\n\t\t\n\t\t// if choice is to add a random possible piece to the sequence\n\t\tif(randChoice == 0){\n\t\t\t// get a random possible number\n\t\t\t// add the possible number to the sequence\n\t\t\tBuildingPiece randPossiblePiece = possiblePieces[randomGenerator.nextInt(possiblePieces.length)];\n\t\t\tbuilding.addToList(randSeqIndex, randPossiblePiece);\n\t\t}\n\t\t\n\t\t// if the choice is to change a number in the sequence\n\t\telse{\n\t\t\t// get a random sequence index and a random possible number\n\t\t\t// change the number at the sequence index to the possible number\n\t\t\tBuildingPiece randPossiblePiece = possiblePieces[randomGenerator.nextInt(possiblePieces.length)];\n\t\t\tbuilding.changeInList(randSeqIndex, randPossiblePiece);\n\t\t}\n\t}", "@Override\n\t public Node apply(Node gen) {\n\t\t gen = gen.clone(null);\n\t\t int n = gen.weight();\n\t\t int m = (int)(Math.random()*n);\n\t\t Node mutate_node = gen.get(m);\n\t\t int x = (int)(Math.random()*codes.length);\n\t\t mutate_node.oper = codes[x];\n\t\t return gen;\n\t }", "static void bucket_partition(int b_size, LikenessBuckets bk){\n\t\tint parts = b_size/partition_size; //#partitions per bucket\n\t\tdouble ratio; int offsetB; int offsetP;\n\t\tint chunk_size; int partSA;\n\t\tshort[][] tmpBucket;\n\t\tint[] loaded;\n\n\t\tif(parts == 0){\n\t\t\tparts = 1;\n\t\t\tchunk_sizes.add(b_size);\n\t\t}else{\n\t\t\tfor(int i=0; i<parts-1; i++){\n\t\t\t\tchunk_sizes.add(partition_size);\n\t\t\t}\n\t\t\tif ((b_size % partition_size) <= (partition_size/2)){\n\t\t\t\tchunk_sizes.addFirst(partition_size + (b_size % partition_size));\n\t\t\t}else{\n\t\t\t\tparts++;\n\t\t\t\tchunk_sizes.add(partition_size);\n\t\t\t\tchunk_sizes.addLast(b_size % partition_size);\n\t\t\t}\n\t\t}\n\t\tloaded = new int[parts];\n\n\t\tfor(int b=0; b<buckNum; b++){//for every bucket\n\t\t\ttmpBucket = new short[bucket_size][dims];\n\t\t\tArrayList<Integer> chg = bk.changeSA.get(b);\n\t\t\tint first = 0; int last;\n\t\t\tfor(int i=0; i<parts; i++){\n\t\t\t\tloaded[i] = 0;\n\t\t\t}\n\t\t\tfor(int i=0; i<chg.size(); i++){//for every SA\n\t\t\t\tlast = chg.get(i);\n\t\t\t\tif((last-first) > 1){\n\t\t\t\t\t//System.out.println(\"sorting bucket[\"+b+\"][\"\n\t\t\t\t\t//\t\t\t\t +first+\"--\"+last+\"]\");\n\t\t\t\t\tquickSortBucket(first, last, b);\n\t\t\t\t}\n\t\t\t\toffsetB = first;\n\t\t\t\toffsetP = 0;\n\t\t\t\tfor(int jj=0; jj<parts; jj++){//for every partition\n\t\t\t\t\tchunk_size = chunk_sizes.get(jj);\n\t\t\t\t\t//ratio = ((double)chunk_size) / ((double)bucket_size);\n\t\t\t\t\t//partSA = (int)(Math.ceil(ratio * ((float)(last-offsetB+1))));\n\t\t\t\t\tpartSA = (int)Math.ceil(((double)(last-offsetB+1)) / ((double)(parts-jj)));\n\t\t\t\t\tif (partSA > (chunk_size - loaded[jj]))\n\t\t\t\t\t\tpartSA = chunk_size - loaded[jj];\n\t\t\t\t\tfor(int j=0; j<partSA; j++){\n\t\t\t\t\t\ttmpBucket[offsetP + loaded[jj] + j] = buckets[b][offsetB + j];\n\t\t\t\t\t}\n\t\t\t\t\tloaded[jj] += partSA;\n\t\t\t\t\toffsetB += partSA;\n\t\t\t\t\toffsetP += chunk_size;\n\t\t\t\t}\n\t\t\t\tfirst = last+1;\n\t\t\t}\n\t\t\tbuckets[b] = tmpBucket;\n\t\t}\n\t}", "public void insertElement(int element) {\n // if within min and max and doesnt haveElement then add the int\n if (element < MAXSETVALUE && element > MINSETVALUE && hasElement(element) != true && get != null) {\n // replacement array\n int[] arr = new int[get.length + 1];\n // copying values up to last\n for (int j = 0; j < get.length; j++)\n arr[j] = get[j];\n // inserts element\n arr[get.length] = element;\n get = arr;\n // avoiding errors\n } else if (get == null) {\n get = new int[1];\n get[0] = element;\n }\n\n }", "public void defaultMutate() {\n int mutationIndex = RNG.randomInt(0, this.m_GenotypeLength);\n //if (mutationIndex > 28) System.out.println(\"Mutate: \" + this.getSolutionRepresentationFor());\n if (this.m_Genotype.get(mutationIndex)) this.m_Genotype.clear(mutationIndex);\n else this.m_Genotype.set(mutationIndex);\n //if (mutationIndex > 28) System.out.println(this.getSolutionRepresentationFor());\n }", "@Override\n public void add(Integer element) {\n if (this.contains(element) != -1) {\n return;\n }\n // when already in use\n int index = this.getIndex(element);\n if(this.data[index] != null && this.data[index] != this.thumbstone){\n int i = index + 1;\n boolean foundFreePlace = false;\n while(!foundFreePlace && i != index){\n if(this.data[i] == null && this.data[i] == this.thumbstone){\n foundFreePlace = true;\n }else{\n if(i == this.data.length - 1){\n // start at beginning.\n i = 0;\n }else{\n i++;\n }\n }\n }\n if(foundFreePlace){\n this.data[i] = element;\n }else{\n throw new IllegalStateException(\"Data Structre Full\");\n }\n }\n }", "private void percolateUp(int index) {\n\n\t\twhile (compare(array[index], array[parentIndex(index)]) < 0) {\n\t\t\tAnyType temp = array[parentIndex(index)];\n\t\t\tarray[parentIndex(index)] = array[index];\n\t\t\tarray[index] = temp;\n\t\t\tindex = parentIndex(index);\n\t\t}\n\n\t}", "public void lowerHalf() {\n\t\t// TODO: Implement\n\t\tint sumOfSlotCounts = getSumOfSlotCount()-1;\n\t\tif(sumOfSlotCounts < 0) return;\n\t\t//if(getSlotCount() == 1 && getSumOfSlotCount() == 1) return;\n\t\tint slot = getSlotCount()-1;\n\t\tint beanNumber = getSlotBeanCount(slot)-1;\n\t\tint deleted=0;\n\t\t//System.out.println(\"sumOfCounts: \" + sumOfSlotCounts);\n\t\twhile(deleted < Math.floor(sumOfSlotCounts / 2) ){\n\t\t\t/*if (slotBean.get(slot).isEmpty()) {\n\t\t\t\tslot++;\n\t\t\t\tbeanNumber = 0;\n\t\t\t\tSystem.out.println(\"slot empty: slot: \" + slot + \" beanN: \" + beanNumber);\n\t\t\t}*/\n\t\t\t\n\t\t\t//System.out.println(\"i: \" + deleted + \" count: \" + getSlotBeanCount(slot)+\" beanNumber: \" + beanNumber);\n\t\t\tif(beanNumber < getSlotBeanCount(slot) && beanNumber >= 0 && getSlotBeanCount(slot) > 0 ) {\n\t\t\t\t//System.out.println(\"slot not empty: slot: \" + slot + \" beanN: \" + beanNumber);\n\t\t\t\tslotBean.get(slot).remove(beanNumber--);\n\t\t\t\tdeleted++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t//System.out.println(\"slot empty: slot: \" + slot + \" beanN: \" + beanNumber);\n\t\t\t\tif(slot >= 0) slot--;\n\t\t\t\tif(getSlotBeanCount(slot) > 0) beanNumber = getSlotBeanCount(slot)-1;\n\t\t\t\telse beanNumber = 0;\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t}", "public fuseMultiply1(int[] sortedSnapshot) {\n\t\tthis.sortedSnapshot = sortedSnapshot;\n\t}", "public void assign(int indice, T element) {\r\n\t\tif (theHeap.size() == 0 || indice > theHeap.size()) {\r\n\t\t\ttheHeap.add(element);\r\n\t\t} else {\r\n\t\t\ttheHeap.add(indice, element);\r\n\t\t}\r\n\t}", "void Union( int x, int y){\n\n int i = root(x);\n int j = root(y);\n if (i == j) return;\n if (rank[i] > rank[j]) { id[j] = i; rank[i] += rank[j]; }\n else { id[i] = j; rank[j] += rank[i]; }\n }", "public void pushColumnInMarket(int chosenColumn) throws NotEnoughSpaceInStorageException, WhiteMarbleException, IOException, InterruptedException {\n\n if (market.getRedInColumn(chosenColumn)){\n notifyToOneObserver(new FaithPathMessage(1));\n notifyAllObserverLessOneByNickname(new FaithPathOpponentMessage(currentPlayer.getNickName(), 1),currentPlayer.getNickName());\n }\n\n market.pushColumn(chosenColumn,currentPlayer);\n\n notifyObserver(new ChangeMarketMessageColumn(chosenColumn));\n }", "public void updateIndex() {\n int i = this.index;\n if (i == -1 || i > HashBiMap.this.size || !Objects.equal(HashBiMap.this.keys[this.index], this.key)) {\n this.index = HashBiMap.this.findEntryByKey(this.key);\n }\n }", "protected void _setMediumLE(int index, int value)\r\n/* 471: */ {\r\n/* 472:485 */ HeapByteBufUtil.setMediumLE(this.array, index, value);\r\n/* 473: */ }", "private static int partion(int[] arr, int lo, int hi) {\n int pivot = arr[hi];\n int i = lo;\n for (int j = lo; j <= hi; j++) {\n if (arr[j] < pivot) {\n int tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n i++;\n }\n }\n int tmp = arr[i];\n arr[i] = arr[hi];\n arr[hi] = tmp;\n return i;\n }", "@SuppressWarnings(\"unchecked\")\n void expand()\n {\n // Remember the old table.\n Object[] old = this.buckets;\n\n // Figure out the capacity of the new table, making it somewhat\n // unpredictable.\n int newCapacity = 2 * this.buckets.length + rand.nextInt(10);\n\n // Create a new table of that capacity.\n this.buckets = new Object[newCapacity];\n\n // Reset the size since we'll be adding elements in a moment.\n this.size = 0;\n\n // Move all the values from the old table to their appropriate\n // location in the new table.\n for (int i = 0; i < old.length; i++)\n {\n AssociationList<K, V> bucket = (AssociationList<K, V>) old[i];\n if (bucket != null)\n {\n AssociationList<K, V>.Node current = bucket.front.next;\n while (current != null)\n {\n this.set(current.key, current.value);\n current = current.next;\n } // while\n } // if (bucket != null)\n } // for\n }", "private void subDivideNode() {\n setOriginNode();\n _subdivided = true;\n _northWest = new QuadTree<Point>(getView(), _transitionSize);\n _northEast = new QuadTree<Point>(getView(), _transitionSize);\n _southWest = new QuadTree<Point>(getView(), _transitionSize);\n _southEast = new QuadTree<Point>(getView(), _transitionSize);\n Iterator<Point> it = _elements.iterator();\n while (it.hasNext()) {\n Point p = it.next();\n QuadTree<Point> qt = quadrant(p);\n qt.add(p);\n }\n _elements = null;\n _elementsSize = 0;\n }", "private int partition(int[] arr, int start, int end) {\n\t\tint bounary = arr[start];\r\n\t\twhile(start<end) {\r\n\t\t\twhile(start<end&&arr[end]>=bounary) {\r\n\t\t\t\tend--;\r\n\t\t\t}\r\n\t\t\tarr[start] = arr[end];\r\n\t\t\twhile(start<end&&arr[start]<=bounary) {\r\n\t\t\t\tstart++;\r\n\t\t\t}\r\n\t\t\tarr[end] = arr[start];\r\n\t\t}\r\n\t\tarr[start] = bounary;\r\n\t\treturn start;\r\n\t}", "private void coins_a2B(){\n\t\tthis.cube[22] = this.cube[15]; \n\t\tthis.cube[15] = this.cube[51];\n\t\tthis.cube[51] = this.cube[42];\n\t\tthis.cube[42] = this.cube[6];\n\t\tthis.cube[6] = this.cube[22];\n\t}", "private int getIndex(int val){\n return val%bucket;\n }", "public static void checkMutations(int arr1[], int arr2[]){\n\t\tint childrenMutation = 0;\n\t\tfor(int i=0; i<arr1.length; i++){\n\t\t\tif (arr1[i]==1){\n\t\t\t\tchildrenMutation++;\n\t\t\t}\n\t\t}\n\t\t\tif(childrenMutation > 0){\n\t\t\t\tchildrenMutation = childrenMutation*2;\n\t\t\t}\n\t\tfor(int i=0; i<childrenMutation; i++){\n\t\t\tarr2[i] = 1;\n\t\t}\n\t\t\n\t}", "protected void update(byte[] b, int off, int len) {\n/* 56 */ for (int i = off; i < off + len; i++) {\n/* 57 */ update(b[i]);\n/* */ }\n/* */ }", "public void _increaseTableSize(){\n\t\tNode[] largerBuckets = new Node[_numBuckets * 2 + 1];\r\n\t\tNode[] oldBuckets = _buckets;\r\n\t\t_buckets = largerBuckets;\r\n\t\t_numBuckets = _numBuckets * 2 + 1;\r\n\t\t_count = 0;\r\n\t\t_loadFactor = 0.0;\r\n\t\tint i = 0;\r\n\t\tfor(Node eachNode : oldBuckets){\r\n\t\t\t_buckets[i] = eachNode;\r\n\t\t\ti++;\r\n\t\t}\r\n\t}", "int partition(int arr[], int low, int high, SequentialTransition sq,ArrayList<StackPane> list,double speed) \n\t {\n\t\t\tint step;\n//\t\t\tint n = arr.length;\n\t int pivot = arr[high]; \n\t int i = (low-1);\n\t for (int j=low; j<high; j++) \n\t { \n\t if (arr[j] <= pivot) \n\t { \n\t i++; \n\t int temp = arr[i]; \n\t arr[i] = arr[j]; \n\t arr[j] = temp; \n\t step = j - i;\n\t sq.getChildren().add(FillBeforeSwap(list.get(i), list.get(j),speed));\n\t sq.getChildren().add(swapMe(list.get(i), list.get(j), step, list, speed));\n\t sq.getChildren().add(FillAfterSwap(list.get(j), list.get(i), speed));\n\t } \n\t } \n\t int temp = arr[i+1]; \n\t arr[i+1] = arr[high]; \n\t arr[high] = temp; \n\t step = (high) - (i+1);\n\t sq.getChildren().add(FillBeforeSwap(list.get(i+1), list.get(high), speed));\n\t sq.getChildren().add(swapMe(list.get(i+1), list.get(high), step, list, speed));\n\t sq.getChildren().add(FillAfterSwap(list.get(i+1), list.get(high), speed));\n\t \n\t return i+1; \n\t }", "public DocumentMutation append(String path, byte[] value, int offset, int len);", "@Test\n public void testSubList_SubList_Item_Update_Overflow() {\n SegmentedOasisList<StringBuilder> instance = new SegmentedOasisList<>(2, 2);\n\n instance.add(new StringBuilder(\"1\"));\n instance.add(new StringBuilder(\"1\"));\n instance.add(new StringBuilder(\"7\"));\n instance.add(new StringBuilder(\"7\"));\n instance.add(new StringBuilder(\"1\"));\n instance.add(new StringBuilder(\"1\"));\n\n List<StringBuilder> expResult = Arrays.asList(new StringBuilder(\"17\"), new StringBuilder(\"7\"),\n new StringBuilder(\"7\"));\n List<StringBuilder> result = instance.subList(1, 4);\n\n instance.get(1).append(\"7\");\n assertTrue(isEqual(expResult, result));\n\n }", "public E set(int index, E element);", "@Override\n public void write(int b) throws IOException {\n byte ib = (byte) b;\n long p = df.position();\n // If not at the end yet,\n if (p < df.size()) {\n // Get the current value,\n byte cur_b = df.get();\n // If the value we are inserting is different,\n if (cur_b != ib) {\n // Reposition and put the new value,\n df.position(p);\n df.put(ib);\n// ++change_count;\n }\n }\n // At the end so write the byte,\n else {\n df.put(ib);\n }\n }", "private int setFirstFree(final T element) {\r\n\t\tfinal int idx = firstFree;\r\n\t\tserializer.setRandomAccess(idx, element);\r\n\t\tfirstFree = getNextPointer(idx);\r\n\t\t// the pointer will be 0 if it was not unlinked before\r\n\t\tif (firstFree == 0) {\r\n\t\t\tfirstFree = idx + 1;\r\n\t\t}\r\n\t\treturn idx;\r\n\t}", "@Override\n public IABTNode updateNode(String substring, String word, int index) {\n int descendNode = this.descend(substring.charAt(index));\n IABTNode newNode;\n if(descendNode == 1){\n newNode = new ABTNode(substring.charAt(index+1));\n } else {\n newNode = new ABTNode(substring.charAt(index));\n }\n newNode.setKey(word, -1);\n this.sons.set(descendNode, newNode);\n return this.sons.get(descendNode);\n }", "private void rehash() {\r\n\t\tSystem.out.println( \"rehashing : buckets \" + numBuckets + \" size \" + size );\r\n\t\tArrayList<MapNode<K, V>> temp = buckets;\r\n\t\tbuckets = new ArrayList();\r\n\t\tfor( int i = 0; i < 2*numBuckets; i++ ) {\r\n\t\t\tbuckets.add( null );\r\n\t\t}\r\n\t\tsize = 0; //size 0 means abi ek b element nhi h\r\n\t\tnumBuckets *= 2; //ab number of buckets double ho gya h\r\n\t\t//now we will trvrs old arraylist and linkedlist and\r\n\t\t//copy is elemenet one by one\r\n\t\tfor( int i = 0; i < temp.size(); i++ ) {\r\n\t\t\tMapNode< K, V > head = temp.get(i);\r\n\t\t\twhile( head != null ) {\r\n\t\t\t\t\r\n\t\t\t\tK key = head.key;\r\n\t\t\t\tV value = head.value;\r\n\t\t\t\tinsert( key, value );\r\n\t\t\t\thead = head.next;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void doMutation(double probability, Solution solution) throws JMException {\n try {\n //Gene part\n int length = ((Binary) solution.getDecisionVariables()[0]).getNumberOfBits();\n for (int j = 0; j < length - 12; j++) {\n if (PseudoRandom.randDouble() < probability) {\n ((Binary) solution.getDecisionVariables()[0]).bits_.flip(j);\n }\n }\n //Condition Part\n if (PseudoRandom.randDouble() < 0.1) {\n for (int j = length - 12; j < length; j++) {\n int c = 0;\n for (int i = length - 12; i < length; i++) {\n if (((Binary) solution.getDecisionVariables()[0]).bits_.get(i) ) {\n c++;\n }\n }\n if (c > 1)\n ((Binary) solution.getDecisionVariables()[0]).bits_.flip(j);\n }\n }\n\n for (int i = 0; i < solution.getDecisionVariables().length; i++) {\n ((Binary) solution.getDecisionVariables()[i]).decode();\n }\n } catch (ClassCastException e1) {\n Configuration.logger_.severe(\"BitFlipMutation.doMutation: \" +\n \"ClassCastException error\" + e1.getMessage());\n Class cls = java.lang.String.class;\n String name = cls.getName();\n throw new JMException(\"Exception in \" + name + \".doMutation()\");\n }\n }", "@SuppressWarnings(\"unused\")\n\tpublic void shift() {\n\t\tint totalItems = 0;\n\t\tint highestSlot = 0;\n\t\tfor (int i = 0; i < summonedFamiliar.storeCapacity; i++) {\n\t\t\tif (burdenedItems[i] != 0) {\n\t\t\t\ttotalItems++;\n\t\t\t\tif (highestSlot <= i) {\n\t\t\t\t\thighestSlot = i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i <= highestSlot; i++) {\n\t\t\tif (burdenedItems[i] == 0) {\n\t\t\t\tboolean stop = false;\n\t\t\t\tfor (int k = i; k <= highestSlot; k++) {\n\t\t\t\t\tif (burdenedItems[k] != 0 && !stop) {\n\t\t\t\t\t\tint spots = k - i;\n\t\t\t\t\t\tfor (int j = k; j <= highestSlot; j++) {\n\t\t\t\t\t\t\tburdenedItems[j - spots] = burdenedItems[j];\n\t\t\t\t\t\t\tstop = true;\n\t\t\t\t\t\t\tburdenedItems[j] = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private void union(int[] parent, int x, int y){\n int xParent = find(parent, x);\n int yParent = find(parent, y);\n parent[xParent] = yParent;\n }", "private void split(TFNode node) {\r\n // Move item at index 2 up to the parent\r\n TFNode parent = node.getParent();\r\n int childIndex;\r\n\r\n // Make new right node\r\n TFNode newNode = new TFNode();\r\n Item rightItem = node.getItem(3);\r\n newNode.addItem(0, rightItem);\r\n\r\n // If node is root, create new parent (new root)\r\n if (node.getParent() == null) {\r\n parent = new TFNode();\r\n setRoot(parent);\r\n parent.setChild(0, node);\r\n childIndex = 0;\r\n node.setParent(parent);\r\n } else {\r\n childIndex = WCIT(node);\r\n }\r\n\r\n // Move up item at index 2\r\n Item moveUp = node.getItem(2);\r\n parent.insertItem(childIndex, moveUp);\r\n\r\n // Hookup new right node's pointers\r\n newNode.setParent(parent);\r\n parent.setChild(childIndex + 1, newNode);\r\n\r\n // Save new right node's children\r\n TFNode child3 = node.getChild(3);\r\n TFNode child4 = node.getChild(4);\r\n\r\n // Hookup new right node's children pointers\r\n if (child3 != null) {\r\n child3.setParent(newNode);\r\n }\r\n if (child4 != null) {\r\n child4.setParent(newNode);\r\n }\r\n newNode.setChild(0, child3);\r\n newNode.setChild(1, child4);\r\n node.setChild(3, null);\r\n node.setChild(4, null);\r\n\r\n // Remove items from original node\r\n node.deleteItem(3);\r\n node.deleteItem(2);\r\n\r\n // Fix any more overflow\r\n overflow(parent);\r\n }", "@Override\r\n\tpublic void entferneBeobachter(Beobachter b) {\n\t\tint i = beobachter.indexOf(b);\r\n\t\tif(i >= 0)\r\n\t\t\tbeobachter.remove(i);\r\n\t}", "public interface Partition\n extends Set\n{\n Set find (int item);\n void join (Set set1, Set set2);\n}", "@Override\n\tpublic E set(int index, E element) {\n\t\tNode<E> node = node(index);\n\t\tE old = node.elementE;\n\t\tnode.elementE = element;\n\t\treturn old;\n\t}", "private void insert(int pos, T elem) {\n for (int i = size; i >= pos + 1; i--) {\n arr[i] = arr[i-1];\n }\n arr[pos] = elem;\n }", "@Override\n protected void onLimitOffsetNode(Node parent, LimitOffsetNode child, int index) {\n replaceChild(parent, index, new EmptyNode(), false);\n if(child.getLimit() > 0) {\n int limit = child.getLimit() + child.getOffset();\n // we have root actually as input for processor, but it's better to keep processor stateless\n // root shouldn't be far from limit's parent (likely it will be parent itself)\n Node root = getRoot(parent);\n int idx = 0;\n if(root.getChild(0).getType() == NodeType.DISTINCT) {\n idx = 1;\n }\n root.addChild(idx, new TopNode(limit));\n }\n }", "private static int[] greedyAssign(double[][] array, int[] assignment, int chunk_size) {\n\n\t\tint[] jToi = new int[chunk_size];\n\t\tArrays.fill(assignment, -1);\n\t\tArrays.fill(jToi, -1);\n\t\tfor (int i=0; i<edge_size; i++){\n\t\t\tHeapNode node = (HeapNode) edges[i];\n\t\t\tif (assignment[node.getI()]==-1 && jToi[node.getJ()]==-1){\n\t\t\t\tassignment[node.getI()]=node.getJ();\n\t\t\t\tjToi[node.getJ()]=node.getI();\n\t\t\t}\n\t\t}\n\t\t//long backtrace_start = System.currentTimeMillis();\n\t\tfor (int index = 0; index<chunk_size; index++){\n\t\t\tboolean swap_done = false;\n\t\t\tif (assignment[index]==-1){\n\t\t\t\tSystem.out.println(index);\n\t\t\t\tfor (int step=1; step<chunk_size/2; step++){\n\t\t\t\t\tint possible_i = (chunk_size+index-step)%chunk_size;\n\t\t\t\t\tint possible_j = assignment[possible_i];\n\t\t\t\t\tif (possible_j != -1){\n\t\t\t\t\t\tif (array[index][possible_j]!=BIG){\n\t\t\t\t\t\t\tfor (int l=0; l<chunk_size; l++){\n\t\t\t\t\t\t\t\tif (jToi[l]==-1 && array[possible_i][l]!=BIG){\n\t\t\t\t\t\t\t\t\tassignment[index]=possible_j;\n\t\t\t\t\t\t\t\t\tassignment[possible_i]=l;\n\t\t\t\t\t\t\t\t\tjToi[l]=possible_i;\n\t\t\t\t\t\t\t\t\tjToi[possible_j]=index;\n\t\t\t\t\t\t\t\t\tswap_done = true;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/*for (int step2 = 1; step2<chunk_size/2; step2++){\n\t\t\t\t\t\t\t int l = (chunk_size+possible_j-step2)%chunk_size;\n\n\t\t\t\t\t\t\t if (jToi[l]==-1 && array[possible_i][l]!=BIG){\n\t\t\t\t\t\t\t assignment[index]=possible_j;\n\t\t\t\t\t\t\t assignment[possible_i]=l;\n\t\t\t\t\t\t\t jToi[l]=possible_i;\n\t\t\t\t\t\t\t jToi[possible_j]=index;\n\t\t\t\t\t\t\t swap_done = true;\n\t\t\t\t\t\t\t break;\n\t\t\t\t\t\t\t }\n\n\t\t\t\t\t\t\t l=(possible_j+step2)%chunk_size;\n\t\t\t\t\t\t\t if (jToi[l]==-1 && array[possible_i][l]!=BIG){\n\t\t\t\t\t\t\t assignment[index]=possible_j;\n\t\t\t\t\t\t\t assignment[possible_i]=l;\n\t\t\t\t\t\t\t jToi[l]=possible_i;\n\t\t\t\t\t\t\t jToi[possible_j]=index;\n\t\t\t\t\t\t\t swap_done = true;\n\t\t\t\t\t\t\t break;\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t }\t*/\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (swap_done)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\telse {\n\t\t\t\t\t\tpossible_i = (index+step)%chunk_size;\n\t\t\t\t\t\tpossible_j = assignment[possible_i];\n\t\t\t\t\t\tif (possible_j != -1){\n\t\t\t\t\t\t\tif (array[index][possible_j]!=BIG){\n\t\t\t\t\t\t\t\tfor (int l=0; l<chunk_size; l++){\n\t\t\t\t\t\t\t\t\tif (jToi[l]==-1 && array[possible_i][l]!=BIG){\n\t\t\t\t\t\t\t\t\t\tassignment[index]=possible_j;\n\t\t\t\t\t\t\t\t\t\tassignment[possible_i]=l;\n\t\t\t\t\t\t\t\t\t\tjToi[l]=possible_i;\n\t\t\t\t\t\t\t\t\t\tjToi[possible_j]=index;\n\t\t\t\t\t\t\t\t\t\tswap_done = true;\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/*for (int step2 = 1; step2<chunk_size/2; step2++){\n\t\t\t\t\t\t\t\t int l = (chunk_size+possible_j-step2)%chunk_size;\n\n\t\t\t\t\t\t\t\t if (jToi[l]==-1 && array[possible_i][l]!=BIG){\n\t\t\t\t\t\t\t\t assignment[index]=possible_j;\n\t\t\t\t\t\t\t\t assignment[possible_i]=l;\n\t\t\t\t\t\t\t\t jToi[l]=possible_i;\n\t\t\t\t\t\t\t\t jToi[possible_j]=index;\n\t\t\t\t\t\t\t\t swap_done = true;\n\t\t\t\t\t\t\t\t break;\n\t\t\t\t\t\t\t\t }\n\n\t\t\t\t\t\t\t\t l=(possible_j+step2)%chunk_size;\n\t\t\t\t\t\t\t\t if (jToi[l]==-1 && array[possible_i][l]!=BIG){\n\t\t\t\t\t\t\t\t assignment[index]=possible_j;\n\t\t\t\t\t\t\t\t assignment[possible_i]=l;\n\t\t\t\t\t\t\t\t jToi[l]=possible_i;\n\t\t\t\t\t\t\t\t jToi[possible_j]=index;\n\t\t\t\t\t\t\t\t swap_done = true;\n\t\t\t\t\t\t\t\t break;\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t }*/\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (swap_done)\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn assignment;\n\t}" ]
[ "0.5984555", "0.58412445", "0.58206475", "0.5630941", "0.5622716", "0.55133855", "0.5476594", "0.5436747", "0.5363655", "0.5354628", "0.5237948", "0.5232342", "0.5230871", "0.5215839", "0.507533", "0.50684327", "0.50395083", "0.50097716", "0.4984164", "0.49729285", "0.4965819", "0.49187943", "0.49175358", "0.49159575", "0.48775172", "0.48706946", "0.48680162", "0.48678753", "0.48547286", "0.4850344", "0.48474297", "0.48341015", "0.48340774", "0.48121485", "0.48102698", "0.48054686", "0.48054445", "0.48048446", "0.47887012", "0.47884178", "0.47730312", "0.47700962", "0.47657818", "0.47623214", "0.47577175", "0.47560978", "0.47553504", "0.47424382", "0.47396338", "0.47285038", "0.47263753", "0.4726299", "0.47191647", "0.47124696", "0.46986187", "0.4695357", "0.46894932", "0.46845236", "0.4677548", "0.46726465", "0.46625873", "0.4659536", "0.46591437", "0.46561226", "0.4655803", "0.46535084", "0.46500957", "0.46440113", "0.46423253", "0.46420243", "0.46398917", "0.46380097", "0.4628743", "0.46260414", "0.46226954", "0.46226227", "0.4620156", "0.46129304", "0.46051398", "0.45991", "0.45937613", "0.45913953", "0.4589184", "0.45869458", "0.45866606", "0.45803204", "0.45631954", "0.4562041", "0.45588607", "0.4555782", "0.45477378", "0.45439348", "0.45436138", "0.45433316", "0.45430988", "0.45375583", "0.45374045", "0.45352605", "0.45259616", "0.4522955" ]
0.6917091
0
/ GA HELPER FUNCTIONS See top comment on chromosome structure, this tries to honor packing order if possible. If bin is full, bestfirst packing gets used. This method also contains a mutation operation bin dumping.
private int[] bestFitModified(int[] chromosome) { int[] bins = new int[binCount]; ArrayList<Integer> cannotPackList = new ArrayList<Integer>(); //honor chromosome listing when possible for (int i = 0; i < chromosome.length; i++) { //if this bin isnt full & won't be after placement & this chrom hasnt gone off the end //(VERY RARE, only happens when binCount is reduced w/ elitism) if (chromosome[i] < bins.length && bins[chromosome[i]] + packageWeights[i] <= binSize) { bins[chromosome[i]] += packageWeights[i]; //put package into bin } else { //store those we can't honor chromosome[i] = -1; cannotPackList.add(new Integer(i)); //save all those packages whos original bins were full } } //best fit on all the rest whos bins were full up int tries = 0; for (int j = 0; j < cannotPackList.size(); j++) { int i = cannotPackList.get(j); int bestBinIndex = -1; while (bestBinIndex < 0 && tries < bins.length * 2) { //while we still havent found a bin to put this in and time isn't up int bestBinLeftOverSpace = binSize * 100; //how much space is left in the bin when the packages is placed in it (ideally 0 = full bin) for (int bin = 0; bin < bins.length; bin++) { //if this bin is closer to full than the best bin and not overfilled save it if ((binSize - (bins[bin] + packageWeights[i])) >= 0 && (binSize - (bins[bin] + packageWeights[i])) < bestBinLeftOverSpace) { bestBinIndex = bin; bestBinLeftOverSpace = binSize - (bins[bin] + packageWeights[i]); } } if (bestBinIndex < 0) { //if could not pack, dump out a bin (mutation) j = 0; int dumpBin = rand.nextInt(binCount); for (int binIndex = dumpBin; binIndex < binCount; binIndex++) { bins[binIndex] = 0; for (int chromIndex = 0; chromIndex < chromosome.length; chromIndex++) { if (chromosome[chromIndex] == binIndex) { chromosome[chromIndex] = -1; cannotPackList.add(new Integer(chromIndex)); } } } } tries++; } if (tries >= bins.length * 2) { return null; //this chromosome is unsalvageable because it is impossible to fit the packages in the bins } bins[bestBinIndex] += packageWeights[i]; chromosome[i] = bestBinIndex; cannotPackList.remove(j); j--; } return chromosome; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void testChromosome() {\n\n Assert.assertTrue(this.chromB1.getGenes().length == 4);\n Assert.assertTrue(this.chromB1.getSize() == 4);\n Assert.assertTrue(this.chromB1.getGenes()[0] == 1);\n Assert.assertTrue(this.chromB1.getGenes()[1] == 2);\n Assert.assertTrue(this.chromB1.getGenes()[2] == 3);\n Assert.assertTrue(this.chromB1.getGenes()[3] == 4);\n }", "public void doPack() {\n }", "public void doPack() {\n }", "public void doPack() {\n }", "public void doPack() {\n }", "public void doPack() {\n }", "public void doPack() {\n }", "public void buildInitialBand()\r\n\t{\n\t\r\n\tint bl = boundary.size();\r\n\tfor(int i=0; i<bl; i++) \r\n\t\t{\r\n\t\tInt2d bCur = boundary.get(i);\r\n\t\t//System.out.println(bCur.x + \", \" + bCur.y + \": size = \" + heap.size());\r\n\t\t\r\n\t\ttestPointsAround(bCur.x,bCur.y);\r\n\t\t}\r\n\t\r\n\t}", "public void writeSmall(byte[] b) {\n if (b.length<12)\n try {\n throw new IOException();\n } catch (IOException e) {\n e.printStackTrace();\n }\n //Write compressed array//\n int i=0;\n for (; i< 12 ; i++) //maze dimensions + start/goal\n write(b[i]);\n while (i<b.length){\n byte cell=b[i++];\n for (int j =0 ; j<7; j++){\n if (i<b.length)\n cell=(byte)((cell<<1)|b[i++]);\n else\n cell=(byte)((cell << 1));\n }\n write(cell);\n }\n }", "@Override\n\tpublic String pack() {\n\t\treturn \"Bpxx packingg somjkjhha\";\n\t}", "private void checkSurroundingChunks()\n\t{\n\t\tcalculateChunkBounds();\n\n\t\tif (chunkBounds[BOUND_RIGHT] > prevChunkBounds[BOUND_RIGHT]) // +X load\n\t\t{\n\t\t\tfor (int c = prevChunkBounds[BOUND_RIGHT] + 1; c <= chunkBounds[BOUND_RIGHT]; c++)\n\t\t\t{\n\t\t\t\tproject.loadChunkColumn(c, chunkBounds[BOUND_BOTTOM], chunkBounds[BOUND_TOP], true);\n\t\t\t}\n\t\t}\n\t\telse if (chunkBounds[BOUND_RIGHT] < prevChunkBounds[BOUND_RIGHT]) // -X unload\n\t\t{\n\t\t\tfor (int c = prevChunkBounds[BOUND_RIGHT]; c > chunkBounds[BOUND_RIGHT]; c--)\n\t\t\t{\n\t\t\t\tproject.saveChunkColumn(c, chunkBounds[BOUND_BOTTOM], chunkBounds[BOUND_TOP], true, true);\n\t\t\t}\n\t\t}\n\n\t\tif (chunkBounds[BOUND_LEFT] < prevChunkBounds[BOUND_LEFT]) // -X load\n\t\t{\n\t\t\tfor (int c = prevChunkBounds[BOUND_LEFT] - 1; c >= chunkBounds[BOUND_LEFT]; c--)\n\t\t\t{\n\t\t\t\tproject.loadChunkColumn(c, chunkBounds[BOUND_BOTTOM], chunkBounds[BOUND_TOP], true);\n\t\t\t}\n\t\t}\n\t\telse if (chunkBounds[BOUND_LEFT] > prevChunkBounds[BOUND_LEFT]) // +X unload\n\t\t{\n\t\t\tfor (int c = prevChunkBounds[BOUND_LEFT]; c < chunkBounds[BOUND_LEFT]; c++)\n\t\t\t{\n\t\t\t\tproject.saveChunkColumn(c, chunkBounds[BOUND_BOTTOM], chunkBounds[BOUND_TOP], true, true);\n\t\t\t}\n\t\t}\n\n\t\tif (chunkBounds[BOUND_TOP] > prevChunkBounds[BOUND_TOP]) // +Y load\n\t\t{\n\t\t\tfor (int c = prevChunkBounds[BOUND_TOP] + 1; c <= chunkBounds[BOUND_TOP]; c++)\n\t\t\t{\n\t\t\t\tproject.loadChunkRow(c, chunkBounds[BOUND_LEFT], chunkBounds[BOUND_RIGHT], true);\n\t\t\t}\n\t\t}\n\t\telse if (chunkBounds[BOUND_TOP] < prevChunkBounds[BOUND_TOP]) // -Y unload\n\t\t{\n\t\t\tfor (int c = prevChunkBounds[BOUND_TOP]; c > chunkBounds[BOUND_TOP]; c--)\n\t\t\t{\n\t\t\t\tproject.saveChunkRow(c, chunkBounds[BOUND_LEFT], chunkBounds[BOUND_RIGHT], true, true);\n\t\t\t}\n\t\t}\n\n\t\tif (chunkBounds[BOUND_BOTTOM] < prevChunkBounds[BOUND_BOTTOM]) // -Y load\n\t\t{\n\t\t\tfor (int c = prevChunkBounds[BOUND_BOTTOM] - 1; c >= chunkBounds[BOUND_BOTTOM]; c--)\n\t\t\t{\n\t\t\t\tproject.loadChunkRow(c, chunkBounds[BOUND_LEFT], chunkBounds[BOUND_RIGHT], true);\n\t\t\t}\n\t\t}\n\t\telse if (chunkBounds[BOUND_BOTTOM] > prevChunkBounds[BOUND_BOTTOM]) // +Y unload\n\t\t{\n\t\t\tfor (int c = prevChunkBounds[BOUND_BOTTOM]; c < chunkBounds[BOUND_BOTTOM]; c++)\n\t\t\t{\n\t\t\t\tproject.saveChunkRow(c, chunkBounds[BOUND_LEFT], chunkBounds[BOUND_RIGHT], true, true);\n\t\t\t}\n\t\t}\n\n\t\tpersistChunkBounds();\n\t}", "@Override\n public void workOnOOB(OutOfBandMessage message) {\n if (message.getBuffers() == null) {\n ExecProtos.HashJoinSpill joinSpill = message.getPayload(ExecProtos.HashJoinSpill.parser());\n Preconditions.checkState(joinSpill.getMessageType().equals(OOM_SPILL));\n\n if (message.getSendingMinorFragmentId() == context.getFragmentHandle().getMinorFragmentId()) {\n oobDropLocal++;\n logger.debug(\"Ignoring the OOB spill trigger self notification\");\n return;\n }\n\n if (internalState != InternalState.BUILD) {\n oobDropWrongState++;\n logger.debug(\"Ignoring OOB spill trigger as fragment is outputting data.\");\n return;\n }\n\n // check to see if we're at the point where we want to spill.\n final ExecProtos.HashJoinSpill spill = message.getPayload(ExecProtos.HashJoinSpill.parser());\n final long allocatedMemoryBeforeSpilling = context.getAllocator().getAllocatedMemory();\n final double triggerFactor = context.getOptions().getOption(OOB_SPILL_TRIGGER_FACTOR);\n final double headroomRemaining = context.getAllocator().getHeadroom() * 1.0d / (context.getAllocator().getHeadroom() + context.getAllocator().getAllocatedMemory());\n if (allocatedMemoryBeforeSpilling < (spill.getMemoryUse() * triggerFactor) &&\n headroomRemaining > context.getOptions().getOption(OOB_SPILL_TRIGGER_HEADROOM_FACTOR)) {\n logger.debug(\"Skipping OOB spill trigger, current allocation is {}, which is not within the current factor of \" +\n \"the spilling operator ({}) which has memory use of {}. Headroom is at {} which is greater than trigger headroom of {}\",\n allocatedMemoryBeforeSpilling, triggerFactor, spill.getMemoryUse(), headroomRemaining,\n context.getOptions().getOption(OOB_SPILL_TRIGGER_HEADROOM_FACTOR));\n oobDropUnderThreshold++;\n return;\n }\n\n final CanSwitchToSpilling.SwitchResult switchResult = ((CanSwitchToSpilling) partition).switchToSpilling(false);\n if (!switchResult.isSwitchDone()) {\n ++oobDropNoVictim;\n logger.debug(\"Ignoring OOB spill trigger as no victim partitions found.\");\n return;\n }\n ++oobSpills;\n } else if (runtimeFilterEnabled && !runtimeFiltersDropped()) {\n RuntimeFilterUtil.workOnOOB(message, filterManager, context, config);\n }\n }", "public ByteArray getBin() {\n return bin;\n }", "private Spatial getBin(Location loc)\r\n {\r\n return loc.getX()<mid.getX() \r\n ? (loc.getY()<mid.getY() ? bins[BL] : bins[TL])\r\n : (loc.getY()<mid.getY() ? bins[BR] : bins[TR]);\r\n }", "@Override\n\tpublic void buildBVH() {\n\t\tif(this.bvhObjList.size()<=4) {\n\t\t}else {\n\t\t BVH nebt1 = new BVH(this.bvHi);\n\t\t BVH nebt2 = new BVH(this.bvHi);\n\t\tint tmp = this.calculateSplitDimension(this.bvhBox.getMax().sub(this.bvhBox.getMin()));\n\t\tfloat splitpos;\n\t\tif(tmp==0) {\n\t\t\tsplitpos = this.calculateMinMax().b.avg(this.calculateMinMax().a).x();\n\t\t}else if(tmp==1) {\n\t\t\tsplitpos = this.calculateMinMax().b.avg(this.calculateMinMax().a).y();\n\t\t}else {\n\t\t\tsplitpos = this.calculateMinMax().b.avg(this.calculateMinMax().a).z();\n\t\t\t\n\t\t}\n\t\tthis.distributeObjects(nebt1, nebt2, tmp, splitpos);\n\t\tthis.bvHi.add(nebt1);\n\t\tthis.neb1 = bvHi.indexOf(nebt1);\n\t\tthis.bvHi.add(nebt2);\n\t\tthis.neb2 = bvHi.indexOf(nebt2);\n\t\tnebt2.buildBVH();\n\t\tnebt1.buildBVH();\n\n\t\t}\n\t}", "public void binMasses()\n\t{\n\t\t//Create arrays\n\t\tcreateBins(calcArraySize(massBinSize,minMass, maxMass));\n\n\t\t//Check if any spectra from each polarity has been created\n\t\tif (librarySpectra.size()>0)\n\t\t{\n\t\t\t//Populate count array to correctly initialize array size for positive library spectra\n\t\t\tfor (int i=0; i<librarySpectra.size(); i++)\n\t\t\t{\n\t\t\t\tcountBin[findBinIndex(librarySpectra.get(i).precursor,massBinSize,minMass)] ++;\n\t\t\t}\n\t\t\tupdateProgress(17,\"% - Creating Composite Library\",true);\n\n\t\t\t//Use count bin to initialize new arrays to place positive spectra into hash table\n\t\t\tfor (int i=0; i<countBin.length; i++)\n\t\t\t{\n\t\t\t\tmassBin[i] = new LibrarySpectrum[countBin[i]];\n\t\t\t}\n\t\t\tupdateProgress(33,\"% - Creating Composite Library\",true);\n\n\n\t\t\t//Populate spectrum arrays for positive spectra\n\t\t\tfor (int i=0; i<librarySpectra.size(); i++)\n\t\t\t{\n\t\t\t\tmassBin[findBinIndex(librarySpectra.get(i).precursor,massBinSize,minMass)]\n\t\t\t\t\t\t[addedBin[findBinIndex(librarySpectra.get(i).precursor,massBinSize,minMass)]] = librarySpectra.get(i);\n\t\t\t\taddedBin[findBinIndex(librarySpectra.get(i).precursor,massBinSize,minMass)]++;\n\t\t\t}\n\t\t\tupdateProgress(50,\"% - Creating Composite Library\",true);\n\t\t}\n\t}", "public void b(bq nbttagcompound)\r\n/* 250: */ {\r\n/* 251:204 */ super.b(nbttagcompound);\r\n/* 252: */ \r\n/* 253:206 */ nbttagcompound.a(\"cvm\", this.CoverSides);\r\n/* 254:207 */ byte[] cov = new byte[Integer.bitCount(this.CoverSides) * 2];\r\n/* 255:208 */ int dp = 0;\r\n/* 256:209 */ for (int i = 0; i < 6; i++) {\r\n/* 257:210 */ if ((this.CoverSides & 1 << i) != 0)\r\n/* 258: */ {\r\n/* 259:211 */ cov[dp] = ((byte)(this.Covers[i] & 0xFF));\r\n/* 260:212 */ cov[(dp + 1)] = ((byte)(this.Covers[i] >> 8));\r\n/* 261:213 */ dp += 2;\r\n/* 262: */ }\r\n/* 263: */ }\r\n/* 264:215 */ nbttagcompound.a(\"cvs\", cov);\r\n/* 265: */ }", "public static ArrayList < ArrayList < Double >> binPack(double weight[], int n, double bin_cap) { \r\n int binCount = 0;\r\n int k = 0;\r\n double[] bin_space = new double[n];\r\n\r\n ArrayList < Integer > bin = new ArrayList < Integer > ();\r\n ArrayList < Double > val = new ArrayList < Double > ();\r\n ArrayList < ArrayList < Double >> binVal = new ArrayList < ArrayList < Double >> ();\r\n binVal.add(k, new ArrayList < Double > ());\r\n System.out.println(\".......Commencing Calculation...........\\n\");\r\n startTime = System.nanoTime();\r\n for (int i = 0; i < n; i++) {\r\n int j;\r\n for (j = 0; j < binCount; j++) {\r\n \r\n if (bin_space[j] >= weight[i]) {\r\n bin_space[j] = bin_space[j] - weight[i];\r\n //val.add(weight[i]);\r\n (binVal.get(j)).add((weight[i]));\r\n k=j+1;\r\n System.out.println(\"---Bin \" + j + \" took in weight \" + weight[i]);\r\n break;\r\n }\r\n \r\n }\r\n System.out.println(\"*Bad fit for next weight size \"+ weight[i]+ \r\n \"\\n\\n ***NEW BIN CREATED***\\n\");\r\n if (j == binCount) {\r\n \r\n bin_space[binCount] = bin_cap - weight[i];\r\n //val.add(weight[i]);\r\n binCount++;\r\n //k++;\r\n bin.add(j);\r\n binVal.add(j, new ArrayList < Double > ());\r\n (binVal.get(j)).add((weight[i]));\r\n k=j+1;\r\n System.out.println(\"---Bin \" + k + \" took in weight **\" + weight[i]);\r\n }\r\n } \r\n endTime = System.nanoTime();\r\n elapsedTime = (endTime- startTime);\r\n System.out.println(\"\\nBIN PACKING ALGORITHM COMPLETE\\n\");\r\n \r\n return binVal;\r\n }", "public void writeBig (byte[] b) {\n if (b.length<12)\n try {\n throw new IOException();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n Map<String,Integer> codes = new LinkedHashMap<>();\n ArrayList<Pair<Integer,Integer>> array = new ArrayList<>();\n int arrIndex=0;\n array.add(arrIndex++,new Pair<>(0,0));\n int k=12;\n codes.put(String.valueOf(b[k]),arrIndex);\n array.add(arrIndex++,new Pair((int)b[k++],0));\n\n for (; k<b.length; k++){\n int pointer=0;\n String current = String.valueOf(b[k]);\n while (codes.containsKey(current) && k<b.length-1){\n pointer=codes.get(current);\n k++;\n current+=String.valueOf(b[k]);\n }\n if (codes.containsKey(current) && k==b.length-1) {\n array.add(arrIndex, new Pair(2, codes.get(current)));\n codes.put(current,arrIndex);\n }\n else{\n array.add(arrIndex,new Pair((int)b[k],pointer));\n codes.put(current,arrIndex++);\n }\n }\n\n //Write compressed array//\n for (int i=0; i< 12 ; i++) //maze dimensions + start/goal\n write(b[i]);\n int pointerSize= array.size()>128 ? (array.size()>32768 ? 3 : 2) : 1; // how many bytes to represent the pointer\n write(pointerSize);\n// System.out.println(\"DEBUG : array size:\" + array.size()+\" unit size: \"+(pointerSize+1)); //DEBUGGING\n for (Pair<Integer, Integer> Pair : array) { //send array\n byte cell = (byte) (Pair.getKey()<<7);\n cell = (byte) (cell | (Pair.getValue()>>(8*(pointerSize-1))));\n write(cell);\n for (int j = pointerSize - 2; j >= 0; j--) {\n cell=(byte) (Pair.getValue() >> 8 * j);\n write(cell);\n }\n }\n write(array.get(array.size()-1).getKey()); //last cell key (0/1/2)\n //Finish writing compressed array//\n }", "public static void compress(ByteBuffer bbInput, ByteBuffer bbOutput, StringBuilder information, long[] time) throws IOException\r\n {\r\n long startTime = System.currentTimeMillis(); \r\n \r\n Arithmetic arithmetic = new Arithmetic();\r\n \r\n while(bbInput.remaining() > 0)\r\n {\r\n byte b = bbInput.get();\r\n arithmetic.add(b);\r\n }\r\n \r\n TreeMap<Byte, Range> rangeTable = arithmetic.set();\r\n \r\n //System.out.println(rangeTable.size());\r\n \r\n bbOutput.putInt(rangeTable.size());\r\n for (Entry<Byte, Range> e : rangeTable.entrySet())\r\n {\r\n bbOutput.put(e.getKey().byteValue());\r\n bbOutput.putLong(e.getValue().count);\r\n //System.out.println((char) e.getKey().byteValue() + \":\" + e.getValue().count + \" \" + (int) e.getValue().high + \" \" + (int) e.getValue().low);\r\n }\r\n \r\n int rangeTableCount = bbInput.position();\r\n bbOutput.putInt(rangeTableCount);\r\n \r\n if (rangeTableCount > (Math.pow(2,16)))\r\n {\r\n information.append(\"FATAL ERROR: Cannot compress block larger than 2^16 - 1\");\r\n return;\r\n }\r\n \r\n bbInput.position(0);\r\n \r\n //System.out.println(rangeTableCount);\r\n\r\n char low = 0;\r\n char high = 0xFFFF;\r\n short underflow_bits = 0;\r\n\r\n BitWriter bitWriter = new BitWriter(bbOutput);\r\n\r\n //Range testRange = arithmetic.rangeTable.get((byte)'B');\r\n //System.out.println((char)'B' + \" \" + testRange.count + \" \" + (int) testRange.high + \" \" + (int) testRange.low);\r\n \r\n while(bbInput.remaining() > 0)\r\n {\r\n byte b = bbInput.get();\r\n Range range = rangeTable.get(b);\r\n \r\n long diff;\r\n diff = (long) (high - low) + 1;\r\n char temphigh = (char) ((diff * range.high) / rangeTableCount - 1);\r\n high = (char) (low + temphigh);\r\n char templow = (char) ((diff * range.low) / rangeTableCount);\r\n low = (char) (low + templow);\r\n \r\n boolean shiftingComplete = false;\r\n while (!shiftingComplete)\r\n {\r\n // TEST1: Test if most significant bit match, shift them out.\r\n if ((high & 0x8000) == (low & 0x8000))\r\n {\r\n bitWriter.put((high & 0x8000) != 0);//!=\r\n while (underflow_bits > 0)\r\n {\r\n bitWriter.put((~high & 0x8000) != 0);\r\n underflow_bits--;\r\n }\r\n low <<= 1;\r\n high <<= 1;\r\n high |= 1;\r\n }\r\n // TEST2: Test for potential underflow if most significant digits don't match and\r\n // second most significant digits are one apart.\r\n else if ((low & 0x4000) != 0 && (!((high & 0x4000) != 0)))\r\n {\r\n underflow_bits += 1;\r\n low &= 0x3fff;\r\n high |= 0x4000;\r\n \r\n low <<= 1;\r\n high <<= 1;\r\n high |= 1;\r\n }\r\n // ELSE: COMPLETE\r\n else\r\n {\r\n shiftingComplete = true;\r\n }\r\n }\r\n }\r\n \r\n bitWriter.put((low & 0x4000) != 0);\r\n underflow_bits++;\r\n while (underflow_bits-- > 0)\r\n {\r\n bitWriter.put((~low & 0x4000) != 0);\r\n }\r\n\r\n bitWriter.finish();\r\n \r\n long endTime = System.currentTimeMillis();\r\n time[0] += (endTime - startTime);\r\n }", "public void doPack() {\n this._sendData = new byte[2];\n this._sendData[0] = 1;\n this._sendData[1] = (byte) (this.iOIndex & 15);\n }", "private Move produceHeuristicMove(Board board){\n\n\t\tint numRows = board.getNumberOfRows();\n\t\tint[][] bins = new int[numRows][BINARY_LENGTH];\n\t\tint[] binarySum = new int[BINARY_LENGTH];\n\t\tint bitIndex,higherThenOne=0,totalOnes=0,lastRow=0,lastLeft=0,lastSize=0,lastOneRow=0,lastOneLeft=0;\n\t\t\n\t\tfor(bitIndex = 0;bitIndex<BINARY_LENGTH;bitIndex++){\n\t\t\tbinarySum[bitIndex] = 0;\n\t\t}\n\t\t\n\t\tfor(int k=0;k<numRows;k++){\n\t\t\t\n\t\t\tint curRowLength = board.getRowLength(k+1);\n\t\t\tint i = 0;\n\t\t\tint numOnes = 0;\n\t\t\t\n\t\t\tfor(bitIndex = 0;bitIndex<BINARY_LENGTH;bitIndex++){\n\t\t\t\tbins[k][bitIndex] = 0;\n\t\t\t}\n\t\t\t\n\t\t\tdo {\n\t\t\t\tif(i<curRowLength && board.isStickUnmarked(k+1,i+1) ){\n\t\t\t\t\tnumOnes++;\n\t\t\t\t} else {\n\t\t\t\t\t\n\t\t\t\t\tif(numOnes>0){\n\t\t\t\t\t\t\n\t\t\t\t\t\tString curNum = Integer.toBinaryString(numOnes);\n\t\t\t\t\t\twhile(curNum.length()<BINARY_LENGTH){\n\t\t\t\t\t\t\tcurNum = \"0\" + curNum;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor(bitIndex = 0;bitIndex<BINARY_LENGTH;bitIndex++){\n\t\t\t\t\t\t\tbins[k][bitIndex] += curNum.charAt(bitIndex)-'0'; //Convert from char to int\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(numOnes>1){\n\t\t\t\t\t\t\thigherThenOne++;\n\t\t\t\t\t\t\tlastRow = k +1;\n\t\t\t\t\t\t\tlastLeft = i - numOnes + 1;\n\t\t\t\t\t\t\tlastSize = numOnes;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttotalOnes++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlastOneRow = k+1;\n\t\t\t\t\t\tlastOneLeft = i;\n\t\t\t\t\t\t\n\t\t\t\t\t\tnumOnes = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ti++;\n\t\t\t}while(i<=curRowLength);\n\t\t\t\n\t\t\tfor(bitIndex = 0;bitIndex<BINARY_LENGTH;bitIndex++){\n\t\t\t\tbinarySum[bitIndex] = (binarySum[bitIndex]+bins[k][bitIndex])%2;\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\t//We only have single sticks\n\t\tif(higherThenOne==0){\n\t\t\treturn new Move(lastOneRow,lastOneLeft,lastOneLeft);\n\t\t}\n\t\t\n\t\t//We are at a finishing state\t\t\t\t\n\t\tif(higherThenOne<=1){\n\t\t\t\n\t\t\tif(totalOnes == 0){\n\t\t\t\treturn new Move(lastRow,lastLeft,lastLeft+(lastSize-1) - 1);\n\t\t\t} else {\n\t\t\t\treturn new Move(lastRow,lastLeft,lastLeft+(lastSize-1)-(1-totalOnes%2));\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tfor(bitIndex = 0;bitIndex<BINARY_LENGTH-1;bitIndex++){\n\t\t\t\n\t\t\tif(binarySum[bitIndex]>0){\n\t\t\t\t\n\t\t\t\tint finalSum = 0,eraseRow = 0,eraseSize = 0,numRemove = 0;\n\t\t\t\tfor(int k=0;k<numRows;k++){\n\t\t\t\t\t\n\t\t\t\t\tif(bins[k][bitIndex]>0){\n\t\t\t\t\t\teraseRow = k+1;\n\t\t\t\t\t\teraseSize = (int)Math.pow(2,BINARY_LENGTH-bitIndex-1);\n\t\t\t\t\t\t\n\t\t\t\t\t\tfor(int b2 = bitIndex+1;b2<BINARY_LENGTH;b2++){\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(binarySum[b2]>0){\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif(bins[k][b2]==0){\n\t\t\t\t\t\t\t\t\tfinalSum = finalSum + (int)Math.pow(2,BINARY_LENGTH-b2-1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tfinalSum = finalSum - (int)Math.pow(2,BINARY_LENGTH-b2-1);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tnumRemove = eraseSize - finalSum;\n\t\t\t\t\n\t\t\t\t//Now we find that part and remove from it the required piece\n\t\t\t\tint numOnes=0,i=0;\n\t\t\t\twhile(numOnes<eraseSize){\n\n\t\t\t\t\tif(board.isStickUnmarked(eraseRow,i+1)){\n\t\t\t\t\t\tnumOnes++;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnumOnes=0;\n\t\t\t\t\t}\n\t\t\t\t\ti++;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\treturn new Move(eraseRow,i-numOnes+1,i-numOnes+numRemove);\n\t\t\t}\n\t\t}\n\t\t\n\t\t//If we reached here, and the board is not symmetric, then we only need to erase a single stick\n\t\tif(binarySum[BINARY_LENGTH-1]>0){\n\t\t\treturn new Move(lastOneRow,lastOneLeft,lastOneLeft);\n\t\t}\n\t\t\n\t\t//If we reached here, it means that the board is already symmetric, and then we simply mark one stick from the last sequence we saw:\n\t\treturn new Move(lastRow,lastLeft,lastLeft);\t\t\n\t}", "@Override\n void pack() {\n }", "public static void neighborhoodMaxLowMem(String szinputsegmentation,String szanchorpositions,\n int nbinsize, int numleft, int numright, int nspacing, \n\t\t\t\t\tboolean busestrand, boolean busesignal, String szcolfields,\n\t\t\t\t\tint noffsetanchor, String szoutfile,Color theColor, \n\t\t\t\t\t String sztitle,String szlabelmapping, boolean bprintimage, \n boolean bstringlabels, boolean bbrowser) throws IOException\n {\n\n\n\tboolean bchrommatch = false;//added in 1.23 to check for chromosome matches\n\t//an array of chromosome names\n\tArrayList alchromindex = new ArrayList();\n\n\tString szLine;\n\n\t//stores the largest index value for each chromosome\n\tHashMap hmchromMax = new HashMap();\n\n\t//maps chromosome names to index values\n\tHashMap hmchromToIndex = new HashMap();\n\tHashMap hmLabelToIndex = new HashMap(); //maps label to an index\n\tHashMap hmIndexToLabel = new HashMap(); //maps index string to label\n\t//stores the maximum integer label value\n\tint nmaxlabel=0;\n\tString szlabel =\"\";\n\tBufferedReader brinputsegment = Util.getBufferedReader(szinputsegmentation);\n\n\tboolean busedunderscore = false;\n //the number of additional intervals to the left and right to include\n \n \t//the center anchor position\n\tint numintervals = 1+numleft+numright;\n\n\n\t//this loops reads in the segmentation \n\twhile ((szLine = brinputsegment.readLine())!=null)\n\t{\n\t //added v1.24\n\t if (bbrowser)\n\t {\n\t\tif ((szLine.toLowerCase(Locale.ENGLISH).startsWith(\"browser\"))||(szLine.toLowerCase(Locale.ENGLISH).startsWith(\"track\")))\n\t\t{\n\t\t continue;\n\t\t}\n\t }\n\n\t StringTokenizer st;\n\t if (bstringlabels)\n\t {\n\t st = new StringTokenizer(szLine,\"\\t\");\n\t }\n\t else\n\t {\n\t st = new StringTokenizer(szLine,\"\\t \");\n\t }\n\n\t //added in v1.24\n\t int numtokens = st.countTokens();\n\t if (numtokens == 0)\n\t { \n\t //skip blank lines\n\t continue;\n\t }\n\t else if (numtokens < 4)\n\t {\n\t throw new IllegalArgumentException(\"Line \"+szLine+\" in \"+szinputsegmentation+\" only had \"+numtokens+\" token(s). Expecting at least 4\");\n\t }\n\n\t String szchrom = st.nextToken().trim();\n //assumes segments are in standard bed format which to get to \n\t //0-based inclusive requires substract 1 from the end\n\t //int nbegin = Integer.parseInt(st.nextToken().trim())/nbinsize; \n\t st.nextToken().trim();\n\t int nend = (Integer.parseInt(st.nextToken().trim())-1)/nbinsize; \n\t szlabel = st.nextToken().trim();\n\t short slabel;\n\n\t if (bstringlabels)\n\t {\n\t int nunderscoreindex = szlabel.indexOf(\"_\");\n\n\t if (nunderscoreindex >=0)\n\t {\n\t String szprefix = szlabel.substring(0,nunderscoreindex);\n\n try\n\t\t {\n\t slabel = (short) (Short.parseShort(szprefix));\n\t\t if (slabel > nmaxlabel)\n\t\t {\n\t nmaxlabel = slabel;\n\t\t }\n\t\t busedunderscore = true;\n\t\t hmLabelToIndex.put(szlabel, Short.valueOf(slabel));\n\t\t hmIndexToLabel.put(\"\"+slabel, szlabel);\n\t\t }\n catch (NumberFormatException ex)\n\t\t {\n try\n\t\t {\n\t\t slabel = (short) (Short.parseShort(szprefix.substring(1)));\n\t\t if (slabel > nmaxlabel)\n\t\t {\n\t\t nmaxlabel = slabel;\n\t\t }\n\t\t busedunderscore = true;\n\t\t hmLabelToIndex.put(szlabel, Short.valueOf(slabel));\n\t\t hmIndexToLabel.put(\"\"+slabel, szlabel);\n\t\t }\n\t\t catch (NumberFormatException ex2)\n\t\t {\n\t\t if (busedunderscore)\n\t\t {\n\t\t throw new IllegalArgumentException(\"Not a valid ID before '_' in \"+szlabel+\", while valid ID found for other entries\");\n\t\t }\n\t\t }\n\t\t }\n\t }\n\n\t if (!busedunderscore)\n\t {\n\t //handle string labels\n\t Short objshort = (Short) hmLabelToIndex.get(szlabel);\n\n\t if (objshort == null)\n\t {\n\t\t nmaxlabel = hmLabelToIndex.size()+1;\n\t\t slabel = (short) nmaxlabel;\n\t\t hmLabelToIndex.put(szlabel, Short.valueOf(slabel));\n\t\t hmIndexToLabel.put(\"\"+nmaxlabel, szlabel);\n\t\t }\n\t }\n\t }\n\t else\n\t {\n try\n\t {\n\t slabel = (short) (Short.parseShort(szlabel));\n\t }\n\t catch (NumberFormatException ex)\n\t {\n try\n\t {\n slabel = (short) (Short.parseShort(szlabel.substring(1)));\n\t }\n\t catch (NumberFormatException ex2)\n\t {\n\t throw new IllegalArgumentException(\"In fourth column neither state number or ID found in segmentation file. Use '-labels' option to run overlap enrichment treating fourth column as labels\");\n\t }\n\t }\n\t \n\t //alsegments.add(new SegmentRec(szchrom,nbegin,nend,slabel));\n\n\t if (slabel > nmaxlabel)\n\t {\n\t nmaxlabel = slabel;\n\t }\n\t }\n\n\t Integer objMax = (Integer) hmchromMax.get(szchrom);\n\t if (objMax == null)\n\t {\n\t\t//System.out.println(\"on chrom \"+szchrom);\n\t\thmchromMax.put(szchrom,Integer.valueOf(nend));\n\t\thmchromToIndex.put(szchrom, Integer.valueOf(hmchromToIndex.size()));\n\t\talchromindex.add(szchrom);\n\t }\n\t else\n\t {\n\t\tint ncurrmax = objMax.intValue();\n\t\tif (ncurrmax < nend)\n\t\t{\n\t\t hmchromMax.put(szchrom, Integer.valueOf(nend));\t\t \n\t\t}\n\t }\n\t}\n\tbrinputsegment.close();\n\n\t//stores a tally for each position relative to an anchor how frequently the label was observed\n\tdouble[][] tallyoverlaplabel = new double[numintervals][nmaxlabel+1]; \n\n\t//stores a tally for the total signal associated with each anchor position\n\tdouble[] dsumoverlaplabel = new double[numintervals];\n\n //a tally on how frequently each label occurs\n double[] tallylabel = new double[nmaxlabel+1];\n\n\n\tint numchroms = alchromindex.size();\n\n //short[][] labels = new short[numchroms][];\n\n\t//allocates space store all the segment labels for each chromosome\n\tfor (int nchrom = 0; nchrom < numchroms; nchrom++)\n\t{\n \t //stores all the segments in the data\n\t //ArrayList alsegments = new ArrayList();\n\t brinputsegment = Util.getBufferedReader(szinputsegmentation);\n\t String szchromwant = (String) alchromindex.get(nchrom);\n\t //System.out.println(\"processing \"+szchromwant);\n\t int nsize = ((Integer) hmchromMax.get(alchromindex.get(nchrom))).intValue()+1;\n\t short[] labels = new short[nsize];\n\t //this loops reads in the segmentation \n\n\n\t //short[] labels_nchrom = labels[nchrom];\n\t for (int npos = 0; npos < nsize; npos++)\n {\n labels[npos] = -1;\n }\n\t\t\n\t while ((szLine = brinputsegment.readLine())!=null)\n\t {\n\t //int numlines = alsegments.size();\n\t StringTokenizer st;\n\t if (bstringlabels)\n\t {\n\t st = new StringTokenizer(szLine,\"\\t\");\n\t }\n\t else\n\t {\n\t st = new StringTokenizer(szLine,\"\\t \");\n\t }\n\n\t String szchrom = st.nextToken().trim();\n\t if (!szchromwant.equals(szchrom))\n\t\t continue;\n\n\t bchrommatch = true;\n //assumes segments are in standard bed format which to get to \n\t //0-based inclusive requires substract 1 from the end\n\t int nbegin = Integer.parseInt(st.nextToken().trim())/nbinsize;\n\t int nend = (Integer.parseInt(st.nextToken().trim())-1)/nbinsize; \n\t szlabel = st.nextToken().trim();\n\t short slabel = -1;\n\n\t if (bstringlabels)\n\t {\n\t int nunderscoreindex = szlabel.indexOf(\"_\");\n\n\t\t if (nunderscoreindex >=0)\n\t\t {\n\t\t String szprefix = szlabel.substring(0,nunderscoreindex);\n\n try\n\t\t {\n\t\t slabel = (short) (Short.parseShort(szprefix));\n\t\t busedunderscore = true;\n\t\t }\n catch (NumberFormatException ex)\n\t\t {\n try\n\t\t {\n\t\t slabel = (short) (Short.parseShort(szprefix.substring(1)));\n\t\t\t busedunderscore = true;\n\t\t }\n\t\t catch (NumberFormatException ex2)\n\t\t {\n\t\t\t if (busedunderscore)\n\t\t\t {\n\t\t\t throw new IllegalArgumentException(\"Not a valid ID before '_' in \"+szlabel+\", while valid ID found for other entries\");\n\t\t\t }\n\t\t }\n\t\t }\n\t\t }\n\n\t\t if (!busedunderscore)\n\t\t {\n\t //handle string labels\n\t\t Short objshort = (Short) hmLabelToIndex.get(szlabel);\n\t\t slabel = ((Short) objshort).shortValue();\n\t }\n\t }\n\t else\n\t {\n try\n\t {\n\t\t slabel = (short) (Short.parseShort(szlabel));\n\t }\n\t catch (NumberFormatException ex)\n\t {\n try\n\t\t {\n slabel = (short) (Short.parseShort(szlabel.substring(1)));\n\t\t }\n\t\t catch (NumberFormatException ex2)\n\t\t {\n\t\t throw new IllegalArgumentException(\"In fourth column neither state number or ID found in segmentation file. Use '-labels' option to run overlap enrichment treating fourth column as labels\");\n\t\t }\n\t }\n\t }\n\n\t //this loop stores into labels the full segmentation\n\t //and a count of how often each label occurs\n\t //for (int nindex = 0; nindex < numlines; nindex++)\n\t //{\n\t //SegmentRec theSegmentRec = (SegmentRec) alsegments.get(nindex);\n\t //int nchrom = ((Integer) hmchromToIndex.get(theSegmentRec.szchrom)).intValue();\n\t //short[] labels_nchrom = labels[nchrom];\n\t //int nbegin = theSegmentRec.nbegin;\n\t //int nend = theSegmentRec.nend;\n\t //short slabel = theSegmentRec.slabel;\n\t for (int npos = nbegin; npos <= nend; npos++)\n\t {\n\t labels[npos] = slabel;\n\t }\n\n\t if (slabel >= 0)\n\t {\n\t tallylabel[slabel]+=(nend-nbegin)+1; \n\t }\t \n\t }\n\t brinputsegment.close();\n\n\n\t RecAnchorIndex theAnchorIndex = getAnchorIndex(szcolfields, busestrand, busesignal);\n\n \t //reads in the anchor position \n BufferedReader brcoords = Util.getBufferedReader(szanchorpositions);\n\t while ((szLine = brcoords.readLine())!=null)\n {\n\t if (szLine.trim().equals(\"\")) continue;\n\t String[] szLineA = szLine.split(\"\\\\s+\");\n\n String szchrom = szLineA[theAnchorIndex.nchromindex]; \n\t if (!szchrom.equals(szchromwant)) \n continue;\n\n\t int nanchor = (Integer.parseInt(szLineA[theAnchorIndex.npositionindex])-noffsetanchor);\n\t boolean bposstrand = true;\n\t if (busestrand)\n\t {\n\t String szstrand = szLineA[theAnchorIndex.nstrandindex];\t \n\t if (szstrand.equals(\"+\"))\n\t {\n\t bposstrand = true;\n\t }\n else if (szstrand.equals(\"-\"))\n {\n \t bposstrand = false;\n\t }\n\t else\n\t {\n \t throw new IllegalArgumentException(szstrand +\" is an invalid strand. Strand should be '+' or '-'\");\n\t\t }\t \n\t }\n\n\t double damount;\n\n\t if ((busesignal)&&(theAnchorIndex.nsignalindex< szLineA.length))\n\t {\n\t damount = Double.parseDouble(szLineA[theAnchorIndex.nsignalindex]);\n\t }\n\t else\n {\n\t damount = 1;\n\t }\n\n\t //updates the tallys for the given anchor position\n\t //Integer objChrom = (Integer) hmchromToIndex.get(szchrom);\n //if (objChrom != null)\n\t //{\n\t // int nchrom = objChrom.intValue();\n\t\t //short[] labels_nchrom = labels[nchrom];\n\n\t if (bposstrand)\n\t {\n\t int ntallyindex = 0;\n\t for(int noffset= -numleft; noffset <= numright; noffset++)\n\t {\n\t\t int nposindex = (nanchor + nspacing*noffset)/nbinsize;\n\n\t\t if ((nposindex >=0)&&(nposindex < labels.length)&&(labels[nposindex]>=0))\n\t\t {\n\t tallyoverlaplabel[ntallyindex][labels[nposindex]] += damount;\t\t \n\t\t }\n\t\t ntallyindex++;\n\t\t }\n\t\t }\n\t else\n\t {\n\t int ntallyindex = 0;\n\t for(int noffset= numright; noffset >= -numleft; noffset--)\n\t {\n\t\t int nposindex = (nanchor + nspacing*noffset)/nbinsize;\n\n\t\t if ((nposindex >=0)&&(nposindex < labels.length)&&(labels[nposindex]>=0))\n\t\t {\n\t tallyoverlaplabel[ntallyindex][labels[nposindex]]+=damount;\t\t \n\t\t }\n\t\t ntallyindex++;\n\t\t }\n\t\t //}\n\t\t }\n\t }\n brcoords.close(); \t \n\t}\n\n\tif (!bchrommatch)\n\t{\n\t throw new IllegalArgumentException(\"No chromosome name matches found between \"+szanchorpositions+\n \" and those in the segmentation file.\");\n\t}\n\n\toutputneighborhood(tallyoverlaplabel,tallylabel,dsumoverlaplabel,szoutfile,nspacing,numright,\n numleft,theColor,ChromHMM.convertCharOrderToStringOrder(szlabel.charAt(0)),sztitle,0,\n szlabelmapping,szlabel.charAt(0), bprintimage, bstringlabels, hmIndexToLabel);\n }", "com.google.protobuf.ByteString\n getBunhoBytes();", "com.google.protobuf.ByteString\n getBunhoBytes();", "public int getBinCapacityLeft() {\n return binCapacityHeight - getBinCapicityFilled();\n }", "private void repairGenome() {\n if (checkGenome(this.code)) {\n return;\n }\n int[] counters = new int[8];\n for (int c : code) { counters[c]++; }\n for (int i = 0; i < 8; ++i) {\n if (counters[i] == 0) {\n while (true) {\n int newPos = r.nextInt(GENOME_SIZE);\n if (counters[this.code[newPos]] > 1) {\n counters[this.code[newPos]]--;\n this.code[newPos] = i;\n break;\n }\n }\n }\n }\n }", "public int getPack() {\r\n\t\treturn pack;\r\n\t}", "public java.lang.String getBin() {\r\n return bin;\r\n }", "private Integer getFitness(int[] chromosome) {\n\t\tint[] bins = new int[binCount]; //list of found bins\n\t\tfor (int binIndex = 0; binIndex < bins.length; binIndex++) { //initialize list of bins to unfound\n\t\t\tbins[binIndex] = -1;\n\t\t}\n\t\tint[] newChrom = bestFitModified(chromosome.clone()); //fix if infeasible\n\t\tif (newChrom == null) { //this is an unfixable chromosome, inform caller\n\t\t\treturn binCount * 2 + totalInfeasibility(chromosome);\n\t\t}\n\n\t\tfor (int i = 0; i < newChrom.length; i++) {\n\t\t\tchromosome[i] = newChrom[i]; //copy over to take advantage of side-effects\n\t\t}\n\t\tint uniqueBins = 0;\n\n\t\tfor (int i = 0; i < chromosome.length; i++) {\n\t\t\tif (bins[chromosome[i]] == -1) { //if we haven't seen this bin before track it and increment bin counter\n\t\t\t\tbins[chromosome[i]] = chromosome[i];\n\t\t\t\tuniqueBins++;\n\t\t\t} else\n\t\t\t\tcontinue;\n\t\t}\n\n\t\treturn uniqueBins;\n\t}", "public static void mergeSortedArrays(final int MEM_SIZE, ArrayList<Integer []> inputChunks, HeapTuple[] minHeap, String outfile, final boolean ENABLE_DEBUG){\n\n FileOutputStream out;\n try{\n out = new FileOutputStream(outfile);\n }\n catch (FileNotFoundException e){\n System.err.println(e);\n return;\n }\n PrintWriter sortedFiles = new PrintWriter(out, true);\n\n int tempLength = 0;\n FHbinHeap<Integer> heap = new FHbinHeap<>();\n for (int i = 0; i < inputChunks.size(); i++) {\n Integer[] temp = inputChunks.get(i).clone();\n for(int j = 0; j < temp.length; j++){\n //Integer[] temp = inputChunks.get(i).clone();\n //System.out.print(temp[j] + \",\");\n int hi = temp[j];\n heap.insert(hi);\n }\n tempLength += temp.length;\n }\n System.out.println();\n for(int i = 0; i < tempLength; i++){\n int removal = heap.remove();\n System.out.print(removal + \",\");\n sortedFiles.print(removal + \",\");\n }\n sortedFiles.close();\n\n\n\n\n\n/* FAILED CODE\n\n Due to our sorting of the arrays, the minimum of the entire set must be the minimum of the set of the first element for all chunks\n By adding an offset to the array whose\n\n\n FHbinHeap<HeapTuple> metaHeap = null;\n HeapTuple[] heapElement = null;\n // Probably should just be a FHbinheap\n for (int i = 0; i < inputChunks.size(); i++) {\n for (int j = 0; j < MEM_SIZE; i++) {\n heapElement[i] = new HeapTuple(inputChunks.get(i)[j], i, j);\n metaHeap.insert(heapElement[i]);\n System.out.println(metaHeap.remove());\n //sortedFiles.println(metaHeap.remove());\n }\n }\n\n*/\n\n\n //First MEM_SIZE minima, no order\n /*/*\n int removed = 0;\n int [] arrayShift = new int[MEM_SIZE];\n //int innerIndex = 0;\n\n int tempLength = 0;\n\n int tempMin = 0;\n int tempMinIndex = 0;\n FHbinHeap<Integer> heap = new FHbinHeap<>();\n for (int j = 0; j < 5; j++) {\n //System.out.println(arrayShift[0] + \"ARRAYSHIFT\");\n for (int i = 0; i < inputChunks.size(); i++) {\n //FHbinHeap<Integer> heap = new FHbinHeap<>();\n Integer[] temp = inputChunks.get(i).clone();\n //System.out.println(temp[arrayShift[i]] + \",\");\n if (temp[arrayShift[i]] < tempMin) {\n tempMin = temp[arrayShift[i]];\n tempMinIndex = i;\n }\n\n\n for(int j = arrayShift[i]; j < temp.length; j++){\n //Integer[] temp = inputChunks.get(i).clone();\n System.out.print(temp[j] + \",\");\n //int hi = temp[j];\n //heap.insert(hi);\n }\n\n tempLength += temp.length;\n heap.insert(temp[arrayShift[i]]);\n //System.out.print(temp[arrayShift[i]]+ \",\");\n\n\n //int heapRemove = heap.remove();\n if (i == inputChunks.size() - 1) {\n removed = heap.remove();\n System.out.println();\n System.out.println(removed + \",MINIMUM\");\n arrayShift[tempMinIndex] = (arrayShift[tempMinIndex] + 1);\n }\n\n }\n }\n */\n\n\n\n\n }", "private void mutation() {\n\t\tfor (int i = 0; i < 4; i++) {\n\t\t\tint num = (int) (Math.random() * GENE * ChrNum + 1);\n\t\t\tint chromosomeNum = (int) (num / GENE) + 1;\n\n\t\t\tint mutationNum = num - (chromosomeNum - 1) * GENE; \n\t\t\tif (mutationNum == 0) \n\t\t\t\tmutationNum = 1;\n\t\t\tchromosomeNum = chromosomeNum - 1;\n\t\t\tif (chromosomeNum >= ChrNum)\n\t\t\t\tchromosomeNum = 9;\n\t\t\tString temp;\n\t\t\tString a; \n\t\t\tif (ipop[chromosomeNum].charAt(mutationNum - 1) == '0') { \n a = \"1\";\n\t\t\t} else { \n\t\t\t\ta = \"0\";\n\t\t\t}\n\t\t\t\n\t\t\tif (mutationNum == 1) {\n\t\t\t\ttemp = a + ipop[chromosomeNum].substring(mutationNum);\n\t\t\t} else {\n\t\t\t\tif (mutationNum != GENE) {\n\t\t\t\t\ttemp = ipop[chromosomeNum].substring(0, mutationNum -1) + a \n\t\t\t\t\t\t\t+ ipop[chromosomeNum].substring(mutationNum);\n\t\t\t\t} else {\n\t\t\t\t\ttemp = ipop[chromosomeNum].substring(0, mutationNum - 1) + a;\n\t\t\t\t}\n\t\t\t}\n \tipop[chromosomeNum] = temp;\n\t\t}\n\t}", "private int[] mutationSingleMove(int[] mutant) {\n\t\tint pairPoint1 = rand.nextInt(mutant.length);\n\t\tint newBin = mutant[pairPoint1];\n\t\twhile (newBin == mutant[pairPoint1]) {\n\t\t\tnewBin = rand.nextInt(binCount);\n\t\t}\n\t\tmutant[pairPoint1] = newBin; //swap to a different bucket\n\t\treturn mutant;\n\t}", "public boolean addComponentParts(World world, Random random, StructureBoundingBox boundingBox)\n {\n if (this.field_143015_k < 0)\n {\n this.field_143015_k = this.getAverageGroundLevel(world, boundingBox);\n\n if (this.field_143015_k < 0)\n {\n return true;\n }\n\n this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 5 - 1, 0);\n }\n\n this.fillWithBlocks(world, boundingBox, 1, 1, 1, 10, 4, 10, Blocks.air, Blocks.air, false);\n this.fillWithBlocks(world, boundingBox, 0, 0, 0, 10, 0, 10, Blocks.cobblestone, Blocks.cobblestone, false);\n /*this.fillWithBlocks(world, boundingBox, 0, 0, 0, 10, 0, 0, Blocks.cobblestone, Blocks.cobblestone, false);\n this.fillWithBlocks(world, boundingBox, 10, 0, 0, 10, 0, 10, Blocks.cobblestone, Blocks.cobblestone, false);\n this.fillWithBlocks(world, boundingBox, 10, 0, 10, 0, 0, 10, Blocks.cobblestone, Blocks.cobblestone, false);\n this.fillWithBlocks(world, boundingBox, 0, 0, 10, 0, 0, 0, Blocks.cobblestone, Blocks.cobblestone, false);*/\n this.fillWithBlocks(world, boundingBox, 1, 0, 1, 9, 0, 9, plankBlock, plankBlock, false);\n this.fillWithBlocks(world, boundingBox, 0, 4, 0, 10, 4, 10, Blocks.cobblestone, Blocks.cobblestone, false);\n \n //RIGHT WALL\n this.fillWithBlocks(world, boundingBox, 0, 1, 0, 0, 1, 10, plankBlock, plankBlock, false);\n this.fillWithBlocks(world, boundingBox, 0, 3, 0, 0, 3, 10, plankBlock, plankBlock, false);\n this.placeBlockAtCurrentPosition(world, plankBlock, 0, 0, 2, 0, boundingBox);\n this.placeBlockAtCurrentPosition(world, logBlock, 0, 0, 2, 1, boundingBox);\n this.fillWithBlocks(world, boundingBox, 0, 2, 2, 0, 2, 4, Blocks.glass, Blocks.glass, false);\n this.placeBlockAtCurrentPosition(world, logBlock, 0, 0, 2, 5, boundingBox);\n this.fillWithBlocks(world, boundingBox, 0, 2, 6, 0, 2, 8, Blocks.glass, Blocks.glass, false);\n this.placeBlockAtCurrentPosition(world, logBlock, 0, 0, 2, 9, boundingBox);\n this.placeBlockAtCurrentPosition(world, plankBlock, 0, 0, 2, 10, boundingBox);\n \n //LEFT WALL\n this.fillWithBlocks(world, boundingBox, 10, 1, 0, 10, 1, 10, plankBlock, plankBlock, false);\n this.fillWithBlocks(world, boundingBox, 10, 3, 0, 10, 3, 10, plankBlock, plankBlock, false);\n this.placeBlockAtCurrentPosition(world, plankBlock, 0, 10, 2, 0, boundingBox);\n this.placeBlockAtCurrentPosition(world, logBlock, 0, 10, 2, 1, boundingBox);\n this.fillWithBlocks(world, boundingBox, 10, 2, 2, 10, 2, 4, Blocks.glass, Blocks.glass, false);\n this.placeBlockAtCurrentPosition(world, logBlock, 0, 10, 2, 5, boundingBox);\n this.fillWithBlocks(world, boundingBox, 10, 2, 6, 10, 2, 8, Blocks.glass, Blocks.glass, false);\n this.placeBlockAtCurrentPosition(world, logBlock, 0, 10, 2, 9, boundingBox);\n this.placeBlockAtCurrentPosition(world, plankBlock, 0, 10, 2, 10, boundingBox);\n \n //FRONT WALL\n this.fillWithBlocks(world, boundingBox, 0, 1, 0, 5, 1, 0, plankBlock, plankBlock, false);\n this.fillWithBlocks(world, boundingBox, 7, 1, 0, 10, 1, 0, plankBlock, plankBlock, false);\n this.fillWithBlocks(world, boundingBox, 0, 3, 0, 10, 3, 0, plankBlock, plankBlock, false);\n this.placeBlockAtCurrentPosition(world, plankBlock, 0, 0, 2, 0, boundingBox);\n this.placeBlockAtCurrentPosition(world, logBlock, 0, 1, 2, 0, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.glass, 0, 2, 2, 0, boundingBox);\n this.placeBlockAtCurrentPosition(world, logBlock, 0, 3, 2, 0, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.glass, 0, 4, 2, 0, boundingBox);\n this.placeBlockAtCurrentPosition(world, logBlock, 0, 5, 2, 0, boundingBox);\n this.placeBlockAtCurrentPosition(world, logBlock, 0, 7, 2, 0, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.glass, 0, 8, 2, 0, boundingBox);\n this.placeBlockAtCurrentPosition(world, logBlock, 0, 9, 2, 0, boundingBox);\n this.placeBlockAtCurrentPosition(world, plankBlock, 0, 10, 2, 0, boundingBox);\n \n //BACK WALL\n this.fillWithBlocks(world, boundingBox, 0, 1, 10, 10, 1, 10, plankBlock, plankBlock, false);\n this.fillWithBlocks(world, boundingBox, 0, 3, 10, 10, 3, 10, plankBlock, plankBlock, false);\n this.placeBlockAtCurrentPosition(world, plankBlock, 0, 0, 2, 10, boundingBox);\n this.placeBlockAtCurrentPosition(world, logBlock, 0, 1, 2, 10, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.glass, 0, 2, 2, 10, boundingBox);\n this.placeBlockAtCurrentPosition(world, logBlock, 0, 3, 2, 10, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.glass, 0, 4, 2, 10, boundingBox);\n this.placeBlockAtCurrentPosition(world, logBlock, 0, 5, 2, 10, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.glass, 0, 6, 2, 10, boundingBox);\n this.placeBlockAtCurrentPosition(world, logBlock, 0, 7, 2, 10, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.glass, 0, 8, 2, 10, boundingBox);\n this.placeBlockAtCurrentPosition(world, logBlock, 0, 9, 2, 10, boundingBox);\n this.placeBlockAtCurrentPosition(world, plankBlock, 0, 10, 2, 10, boundingBox);\n \n \n //DECO\n this.placeBlockAtCurrentPosition(world, Blocks.carpet, ((carpetMeta == -1) ? random.nextInt(15) : carpetMeta), 3, 1, 4, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.carpet, ((carpetMeta == -1) ? random.nextInt(15) : carpetMeta), 3, 1, 5, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.carpet, ((carpetMeta == -1) ? random.nextInt(15) : carpetMeta), 3, 1, 6, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.carpet, ((carpetMeta == -1) ? random.nextInt(15) : carpetMeta), 3, 1, 7, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.carpet, ((carpetMeta == -1) ? random.nextInt(15) : carpetMeta), 4, 1, 4, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.carpet, ((carpetMeta == -1) ? random.nextInt(15) : carpetMeta), 4, 1, 5, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.carpet, ((carpetMeta == -1) ? random.nextInt(15) : carpetMeta), 4, 1, 6, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.carpet, ((carpetMeta == -1) ? random.nextInt(15) : carpetMeta), 4, 1, 7, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.carpet, ((carpetMeta == -1) ? random.nextInt(15) : carpetMeta), 5, 1, 4, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.carpet, ((carpetMeta == -1) ? random.nextInt(15) : carpetMeta), 5, 1, 5, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.carpet, ((carpetMeta == -1) ? random.nextInt(15) : carpetMeta), 5, 1, 6, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.carpet, ((carpetMeta == -1) ? random.nextInt(15) : carpetMeta), 5, 1, 7, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.carpet, ((carpetMeta == -1) ? random.nextInt(15) : carpetMeta), 6, 1, 4, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.carpet, ((carpetMeta == -1) ? random.nextInt(15) : carpetMeta), 6, 1, 5, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.carpet, ((carpetMeta == -1) ? random.nextInt(15) : carpetMeta), 6, 1, 6, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.carpet, ((carpetMeta == -1) ? random.nextInt(15) : carpetMeta), 6, 1, 7, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.carpet, ((carpetMeta == -1) ? random.nextInt(15) : carpetMeta), 7, 1, 4, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.carpet, ((carpetMeta == -1) ? random.nextInt(15) : carpetMeta), 7, 1, 5, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.carpet, ((carpetMeta == -1) ? random.nextInt(15) : carpetMeta), 7, 1, 6, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.carpet, ((carpetMeta == -1) ? random.nextInt(15) : carpetMeta), 7, 1, 7, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.crafting_table, 0, 9, 1, 9, boundingBox);\n this.placeBlockAtCurrentPosition(world, logBlock, 0, 9, 1, 8, boundingBox);\n this.placeBlockAtCurrentPosition(world, logBlock, 0, 9, 1, 7, boundingBox);\n this.placeBlockAtCurrentPosition(world, logBlock, 0, 8, 1, 9, boundingBox);\n this.placeBlockAtCurrentPosition(world, Blocks.furnace, this.getMetadataWithOffset(Blocks.furnace, 1), 8, 1, 9, boundingBox);\n this.generateStructureChestContents(world, boundingBox, random, 7, 1, 9, workshopChestContents, getCount(random, 5, 7));\n this.generateStructureChestContents(world, boundingBox, random, 6, 1, 9, workshopChestContents, getCount(random, 5, 7));\n this.placeDoorAtCurrentPosition(world, boundingBox, random, 6, 1, 0, this.getMetadataWithOffset(Blocks.wooden_door, 1));\n //this.placeBlockAtCurrentPosition(world, Blocks.torch, this.getMetadataWithOffset(Blocks.torch, 1), 5, 3, 9, boundingBox);\n\n if (this.getBlockAtCurrentPosition(world, 6, 0, -1, boundingBox).getMaterial() == Material.air && this.getBlockAtCurrentPosition(world, 6, -1, -1, boundingBox).getMaterial() != Material.air)\n {\n this.placeBlockAtCurrentPosition(world, Blocks.stone_stairs, this.getMetadataWithOffset(Blocks.stone_stairs, 3), 6, 0, -1, boundingBox);\n }\n\n /* for (l = 0; l < 6; ++l)\n {\n for (int i1 = 0; i1 < 9; ++i1)\n {\n this.clearCurrentPositionBlocksUpwards(p_74875_1_, i1, 9, l, p_74875_3_);\n this.func_151554_b(p_74875_1_, Blocks.cobblestone, 0, i1, -1, l, p_74875_3_);\n }\n }*/\n\n this.spawnVillagers(world, boundingBox, 2, 1, 2, 1);\n return true;\n }", "public Chromosome doBitFlipMutation(){\n for(int i = 0; i < PopulationConfiguration.MUTATION_ATTEMPTS; i++){\n ArrayList<Boolean> newSelection = copyBoolArrayList(this.knapsackSelection);\n int itemToMutate = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n newSelection.set(itemToMutate, !newSelection.get(itemToMutate));\n\n Chromosome mutatedKnapsack = new Chromosome(newSelection).withFitnessCalculated();\n if(mutatedKnapsack.isValid())\n return mutatedKnapsack;\n }\n return this;\n }", "public void doPack() {\n this._sendData = new byte[1];\n this._sendData[0] = 1;\n }", "@Override\n public void postPopulate(MetropolisGenerator generator, Chunk chunk) {\n SchematicConfig.RoadCutout[] cuts = clipboard.getSettings().getCutouts();\n \n Cartesian base = new Cartesian(this.chunkX << 4, Constants.BUILD_HEIGHT - 1, this.chunkZ << 4);\n \n for (SchematicConfig.RoadCutout cut : cuts) {\n Cartesian offset, size;\n ContextType roadCheck;\n Parcel parcel;\n \n switch (direction) {\n case NORTH:\n offset = new Cartesian(clipboard.getSizeX(direction) - cut.startPoint, 0, -1);\n size = new Cartesian(-cut.length, cutoutHeight, -cutoutDepth);\n parcel = grid.getParcel(chunkX, chunkZ - 1);\n roadCheck = parcel.getContextType();\n if (roadCheck.equals(ContextType.STREET) || roadCheck.equals(ContextType.HIGHWAY)) {\n cutoutBlocks(generator, base.add(offset), size, Material.STONE);\n }\n break;\n case EAST:\n offset = new Cartesian(clipboard.getSizeX(direction), 0, clipboard.getSizeZ(direction) - cut.startPoint);\n size = new Cartesian(cutoutDepth, cutoutHeight, -cut.length);\n parcel = grid.getParcel(chunkX + (clipboard.getSizeX(direction) >> 4), chunkZ);\n roadCheck = parcel.getContextType();\n if (roadCheck.equals(ContextType.STREET) || roadCheck.equals(ContextType.HIGHWAY)) {\n cutoutBlocks(generator, base.add(offset), size, Material.STONE);\n }\n break;\n case SOUTH:\n offset = new Cartesian(cut.startPoint + 1, 0, clipboard.getSizeZ(direction));\n size = new Cartesian(cut.length, cutoutHeight, cutoutDepth);\n roadCheck = grid.getParcel(chunkX, chunkZ + (clipboard.getSizeZ(direction) >> 4)).getContextType();\n if (roadCheck.equals(ContextType.STREET) || roadCheck.equals(ContextType.HIGHWAY)) {\n cutoutBlocks(generator, base.add(offset), size, Material.STONE);\n }\n break;\n case WEST:\n offset = new Cartesian(-1, 0, cut.startPoint + 1);\n size = new Cartesian(-cutoutDepth, cutoutHeight, cut.length);\n parcel = grid.getParcel(chunkX - 1, chunkZ);\n roadCheck = parcel.getContextType();\n if (roadCheck.equals(ContextType.STREET) || roadCheck.equals(ContextType.HIGHWAY)) {\n cutoutBlocks(generator, base.add(offset), size, Material.STONE);\n }\n break;\n }\n }\n }", "ICpPack getPack();", "public void getPackByte(DataPacket packet) {\n\t\t\tint limit = 10;\r\n\t\t\tint newFrameSep = 0x3c;\r\n\t\t\t// bytes avail = packet.getDataSize() - limit;\r\n\t\t\t// write(lbuf, limit, 32)\r\n\t\t\t// write(newFrame)\r\n\t\t\t// limit += 32;\r\n\t\t\t// check packet.getDataSize() - limit > 31\r\n\t\t\tbyte[] lbuf = new byte[packet.getDataSize()];\r\n\t\t\ttry {\r\n\t\t\tif ( packet.getDataSize() > 0)\r\n\r\n\t\t\t\tlbuf = packet.getDataAsArray();\r\n\t\t\t//first frame includes the 1 byte frame header whose value should be used \r\n\t\t\t// to write subsequent frame separators \r\n\r\n\r\n\t\t\t\t\tobuff.write(lbuf, limit, 32);\r\n\r\n\t\t\t\tlimit += 32;\r\n\t\t\t\r\n\t\t do {\r\n\r\n\t\t \t\t obuff.write(newFrameSep); \r\n\t\t\t\t\tobuff.write(lbuf, limit, 31);\r\n\t\t\t\t\tlimit += 31;\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\r\n\t\t \t \r\n\t\t } while (packet.getDataSize() - limit > 31);\t\t\t\t\t\t\t\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}", "void genPush(Collection ret, int from, int to, int bits) {\n\tif ((bits & 16) != 0) {\n\tif (side == LIGHT) {\n\tif (to <= H8) {\n\tgenPromote(ret, from, to, bits);\n\treturn;\n\t}\n\t} else {\n\tif (to >= A1) {\n\tgenPromote(ret, from, to, bits);\n\treturn;\n\t}\n\t}\n\t}\n\n\tBouger g = new Bouger(from, to, 0, bits, pieceChar[piece[from]]);\n\n\tif (color[to] != EMPTY)\n\tg.setScore(1000000 + (piece[to] * 10) - piece[from]);\n\telse\n\tg.setScore(history[from][to]);\n\tret.add(g);\n\t}", "private static boolean canPack(int bigCount, int smallCount, int goal) {\n\n//Check if all parameters are in valid range\n if (bigCount < 0 || smallCount < 0 || goal < 0)\n return false;\n\n int pack = 0;\n\n //While we haven't created a pack\n while (pack < goal) {\n //see if a big flour bag can fit in the package\n if (bigCount > 0 && (pack + 5) <= goal) {\n bigCount--;\n pack += 5;\n\n }\n //see there is a small flour bag left, to add to the package\n else if (smallCount > 0) {\n smallCount--;\n pack += 1;\n }\n //if a big bag won't fit (or doesnt exist) and we dont have enough small bags\n else\n return false;\n }\n return (pack == goal);\n }", "public void packBags() {\r\n GroceryBag[] packedBags = new GroceryBag[numItems];\r\n int bagCount = 0;\r\n\r\n GroceryBag currentBag = new GroceryBag();\r\n for (int i=0; i<numItems; i++) {\r\n GroceryItem item = (GroceryItem) cart[i];\r\n if (item.getWeight() <= GroceryBag.MAX_WEIGHT) {\r\n if (!currentBag.canHold(item)) {\r\n packedBags[bagCount++] = currentBag;\r\n currentBag = new GroceryBag();\r\n }\r\n currentBag.addItem(item);\r\n removeItem(item);\r\n i--;\r\n }\r\n }\r\n // Check this in case there were no bagged items\r\n if (currentBag.getWeight() > 0)\r\n packedBags[bagCount++] = currentBag;\r\n\r\n // Now create a new bag array which is just the right size\r\n pBags = new GroceryBag[bagCount];\r\n for (int i=0; i<bagCount; i++) {\r\n pBags[i] = packedBags[i];\r\n }\r\n\r\n // Add all grocery bags bag into cart\r\n for (int i = 0; i < bagCount; i++) {\r\n addItem(pBags[i]);\r\n }\r\n }", "protected abstract void splitBAMs();", "public boolean isFull() {\n return this.chromosomes.size() >= Defines.popSize;\n }", "public Chromosome doInsertionMutation(){\n for(int i = 0; i < PopulationConfiguration.MUTATION_ATTEMPTS; i++){\n ArrayList<Boolean> newSelection = copyBoolArrayList(this.knapsackSelection);\n\n int allele1 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n int allele2 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n boolean value = newSelection.get(allele2);\n\n newSelection.remove(allele2);\n try{\n newSelection.add(allele1 + 1, value);\n }\n catch(IndexOutOfBoundsException e){\n newSelection.add(value);\n }\n \n Chromosome mutatedKnapsack = new Chromosome(newSelection).withFitnessCalculated();\n if(mutatedKnapsack.isValid())\n return mutatedKnapsack;\n }\n return this;\n }", "private boolean canReduceBins() {\n\t\tint oldBinCount = binCount;\n\t\tboolean canReduce = false;\n\t\tbinCount = binCount / 2;\n\t\tint[] chromosome = eliteChromosome.clone();\n\n\t\tif (getFitness(chromosome) <= binCount)\n\t\t\tcanReduce = true;\n\t\telse\n\t\t\tcanReduce = false;\n\t\tbinCount = oldBinCount; //no side effects\n\t\treturn canReduce;\n\t}", "public void update(Tuple2<Integer, Float> input){\n totalFrequencies += input.f1;\n double maxSize = (MAXCOEF * totalFrequencies) / maxNumBars; // maximum value a bar can have before it should split\n float binFrequency;\n int next = input.f0;\n if (bars.isEmpty()){\n bars.put(next, input.f1);\n rightBoundary = next;\n\n }else {\n int key;\n if (bars.floorKey(next) != null) {\n key = bars.floorKey(next);\n if (key == bars.lastKey() && next > rightBoundary){ // if key greater than current right boundary it becomes the new boundary\n rightBoundary = next;\n }\n binFrequency = bars.get(key) + input.f1;\n bars.replace(key, binFrequency);\n }else{ // element is new leftmost boundary\n key = bars.ceilingKey(next);\n binFrequency = bars.get(key) + input.f1;\n bars.remove(key); // remove old bin\n key = next;\n bars.put(key, binFrequency); // create new bin with new left boundary\n }\n\n\n if (binFrequency > maxSize){ // split bins while\n /**\n * Split Bin\n */\n splitBin(key, maxSize); // split this bin until all bins within the original bin's bounds are below maxSize\n\n\n /**\n * Merge the two smallest adjacent bars\n */\n while (bars.size() > maxNumBars){\n // Find Bars to Merge\n float currentMin = Float.MAX_VALUE;\n int lowKey = 0;\n\n int currentKey = bars.firstKey();\n while (bars.higherKey(currentKey) != null){\n if (bars.get(currentKey) + bars.get(bars.higherKey(currentKey)) < currentMin){\n lowKey = currentKey;\n currentMin = bars.get(currentKey) + bars.get(bars.higherKey(currentKey));\n }\n currentKey = bars.higherKey(currentKey);\n }\n bars.remove(bars.higherKey(lowKey));\n bars.replace(lowKey, currentMin);\n }\n }\n\n }\n\n }", "private interface BinVisitor {\n /** @return true if something has been removed from the bin. */\n abstract boolean visit(TIntList bin, long mapKey);\n }", "void genPromote(Collection ret, int from, int to, int bits) {\n\tfor (char i = KNIGHT; i <= QUEEN; ++i) {\n\tBouger g = new Bouger(from, to, i, (bits | 32), 'P');\n\tg.setScore(1000000 + (i * 10));\n\tret.add(g);\n\t}\n\t}", "private int writeBytes(ChannelOutboundBuffer in, ByteBuf buf) throws Exception {\n/* 267 */ int readableBytes = buf.readableBytes();\n/* 268 */ if (readableBytes == 0) {\n/* 269 */ in.remove();\n/* 270 */ return 0;\n/* */ } \n/* */ \n/* 273 */ if (buf.hasMemoryAddress() || buf.nioBufferCount() == 1) {\n/* 274 */ return doWriteBytes(in, buf);\n/* */ }\n/* 276 */ ByteBuffer[] nioBuffers = buf.nioBuffers();\n/* 277 */ return writeBytesMultiple(in, nioBuffers, nioBuffers.length, readableBytes, \n/* 278 */ config().getMaxBytesPerGatheringWrite());\n/* */ }", "public SmartBin() {\n items = new ItemType[7];\n curWeight = 0;\n curArrayIndex = 0;\n binNumber = \"SM\" + generateBinNumber();\n }", "@Override\n public void mutate(Chromosome c) {\n if (c.getFitness() == 0) return;\n\n boolean[] genes = c.getGenes();\n int weight = c.getWeight();\n\n for (int i = 0; i < genes.length; i++) {\n if (weight == Config.CAPACITY) break;\n\n if (!genes[i]) {\n if (weight + Config.ITEMS[i].getWeight() <= Config.CAPACITY) {\n c.flipGene(i);\n }\n }\n }\n \n }", "private void writeColumnsFromBag(ByteBuffer key, DataBag bag) throws IOException\n {\n List<Mutation> mutationList = new ArrayList<Mutation>();\n for (Tuple pair : bag)\n {\n Mutation mutation = new Mutation();\n if (DataType.findType(pair.get(1)) == DataType.BAG) // supercolumn\n {\n SuperColumn sc = new SuperColumn();\n sc.setName(objToBB(pair.get(0)));\n List<org.apache.cassandra.thrift.Column> columns = new ArrayList<org.apache.cassandra.thrift.Column>();\n for (Tuple subcol : (DataBag) pair.get(1))\n {\n org.apache.cassandra.thrift.Column column = new org.apache.cassandra.thrift.Column();\n column.setName(objToBB(subcol.get(0)));\n column.setValue(objToBB(subcol.get(1)));\n column.setTimestamp(FBUtilities.timestampMicros());\n columns.add(column);\n }\n if (columns.isEmpty())\n {\n if (allow_deletes)\n {\n mutation.deletion = new Deletion();\n mutation.deletion.super_column = objToBB(pair.get(0));\n mutation.deletion.setTimestamp(FBUtilities.timestampMicros());\n }\n else\n throw new IOException(\"SuperColumn deletion attempted with empty bag, but deletes are disabled, set \" +\n PIG_ALLOW_DELETES + \"=true in environment or allow_deletes=true in URL to enable\");\n }\n else\n {\n sc.columns = columns;\n mutation.column_or_supercolumn = new ColumnOrSuperColumn();\n mutation.column_or_supercolumn.super_column = sc;\n }\n }\n else\n mutation = mutationFromTuple(pair);\n mutationList.add(mutation);\n // for wide rows, we need to limit the amount of mutations we write at once\n if (mutationList.size() >= 10) // arbitrary, CFOF will re-batch this up, and BOF won't care\n {\n writeMutations(key, mutationList);\n mutationList.clear();\n }\n }\n // write the last batch\n if (mutationList.size() > 0)\n writeMutations(key, mutationList);\n }", "protected void DoGibbsSampling(){\n\t\twhile (gibbs_sample_num <= num_gibbs_total_iterations){\t\t\t\n\t\t\tDoOneGibbsSample();\n\t\t\t//now flush the previous previous gibbs sample to not leak memory\n\t\t\tFlushDataForSample(gibbs_samples_of_bart_trees[gibbs_sample_num - 1]);\n\t\t\t//keep one previous for interaction constraints\n//\t\t\tif (gibbs_sample_num > 1) {\n//\t\t\t\tFlushDataForSample(gibbs_samples_of_bart_trees[gibbs_sample_num - 2]);\n//\t\t\t}\t\t\t\n\t\t\tDeleteBurnInsOnPreviousSamples();\n\t\t\tgibbs_sample_num++;\n\t\t}\n\t}", "public interface BPTreeNode {\n\n /*\n * Method returns the node index in the B+ tree organization.\n *\n * Returns:\n * node index in B+ tree\n * */\n public long getNodeIndex();\n\n\n /*\n * Method identifies the node as a leaf node or a child (non-leaf) node.\n *\n * Returns:\n * true, if leaf node; false if child node\n * */\n public boolean isLeaf();\n\n /*\n * Method inserts the node item appropriate to the item's key value.\n *\n * Returns:\n * Node item inserted successfully.\n * */\n public boolean insertItem(BPTreeNodeItem item);\n\n /*\n * Method deletes the node item appropriate to the item's index.\n *\n * Returns:\n * Node item deleted successfully.\n * */\n public boolean deleteItem(int index);\n\n /*\n * Method returns the number of items assigned to the node.\n *\n * Returns:\n * Count of node items contained in the node\n * */\n public int getItemCount();\n\n /*\n * Method returns the indexed node item.\n *\n * Returns:\n * Indexed node item.\n * */\n public BPTreeNodeItem getItem(int index);\n\n /*\n * Method returns the lowest chromosome name key belonging to the node.\n *\n * Returns:\n * Lowest contig/chromosome name key; or null for no node items.\n * */\n public String getLowestChromKey();\n\n /*\n * Method returns the highest chromosome name key belonging to the node.\n *\n * Returns:\n * Highest contig/chromosome name key; or null for no node items.\n * */\n public String getHighestChromKey();\n\n /*\n * Method returns the lowest chromosome ID belonging to the node.\n *\n * Returns:\n * Lowest contig/chromosome ID; or -1 for no node items.\n * */\n public int getLowestChromID();\n\n /*\n * Method returns the highest chromosome ID belonging to the node.\n *\n * Returns:\n * Highest contig/chromosome ID; or -1 for no node items.\n * */\n public int getHighestChromID();\n\n /*\n * Method prints the nodes items and sub-node items.\n * Node item deleted successfully.\n * */\n public void printItems();\n\n}", "public boolean hasBackpack() {\n return ((bitField0_ & 0x00000100) == 0x00000100);\n }", "public void doPack() {\n if (this._sendData == null) {\n this._sendData = new byte[26];\n }\n System.arraycopy(BytesUtil.getBytes(this.mLongtitue), 0, this._sendData, 0, 8);\n System.arraycopy(BytesUtil.getBytes(this.mLantitue), 0, this._sendData, 8, 8);\n System.arraycopy(BytesUtil.getBytes(this.mNorthSpeed), 0, this._sendData, 16, 4);\n System.arraycopy(BytesUtil.getBytes(this.mEastSpeed), 0, this._sendData, 20, 4);\n System.arraycopy(BytesUtil.getBytes(this.mAccuracy), 0, this._sendData, 24, 2);\n }", "Pack(Bouquet bouquet)\n {\n this.bouquet = bouquet;\n }", "public void mutation(Graph_GA obj, float mutation_index)\r\n\t{\r\n\t\t\r\n\t\tList<Integer> list_num = new ArrayList<Integer>();\r\n\t\tInteger[] shuffled_list = null;\r\n\t\tList<Integer> mutation_vertex = new ArrayList<Integer>();\r\n\t\t\r\n\t\tfor(int i=0;i<chromosome_size;i++)\r\n\t\t{\r\n\t\t\tlist_num.add(i+1);\r\n\t\t}\r\n\t\tjava.util.Collections.shuffle(list_num);\r\n\t\tshuffled_list = list_num.toArray(new Integer[list_num.size()]);\r\n\t\t\r\n\t\tfor(int i=0;i<(chromosome_size*mutation_index);i++)\r\n\t\t{\r\n\t\t\tmutation_vertex.add(shuffled_list[i]);\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\tRandom random_generator = new Random();\r\n\t\t\r\n\t\tGA_Graph_Node vertex_container[] = obj.getNodes();\r\n\t\t\r\n\t\tfor(int i=0;i<obj.num_vertex;i++)\r\n\t\t{\r\n\t\t\tInteger[] valid_colors = null;\r\n\t\t\tList<Integer> adjacent_vertex_color = new LinkedList<Integer>();\r\n\t\t\tSet<DefaultEdge> adjacent_edges = obj.graph_inp.edgesOf(vertex_container[i]);\r\n\t\t\tIterator<DefaultEdge> adj_edge_list = adjacent_edges.iterator();\r\n\t\t\t\r\n\t\t\twhile(adj_edge_list.hasNext())\r\n\t\t\t{\r\n\t\t\t\tDefaultEdge adj_edge = adj_edge_list.next();\r\n\t\t\t\tGA_Graph_Node adj_node = null;\r\n\t\t\t\tadj_node = obj.graph_inp.getEdgeSource(adj_edge);\r\n\t\t\t\tif(adj_node==null||adj_node==vertex_container[i])\r\n\t\t\t\t{\r\n\t\t\t\t\tadj_node = obj.graph_inp.getEdgeTarget(adj_edge);\r\n\t\t\t\t}\r\n\t\t\t\tadjacent_vertex_color.add(chromosome[adj_node.numID-1]);\r\n\t\t\t}\r\n\t\t\tif(adjacent_vertex_color.contains(chromosome[i])&&mutation_vertex.contains(i+1))\r\n \t{\r\n\t\t\t\tList<Integer> valid_color_list = new LinkedList<Integer>();\r\n \t\tfor(int j=0;j<num_colors;j++)\r\n \t\t{\r\n \t\t\tif(adjacent_vertex_color.contains(j+1) == false)\r\n \t\t\t\tvalid_color_list.add(j+1);\t\r\n \t}\r\n \t\t\r\n \t\tvalid_colors = valid_color_list.toArray(new Integer[valid_color_list.size()]);\r\n \t\t\r\n// \t\tSystem.out.println(valid_colors.toString());\r\n \t\tif(valid_colors.length> 0)\r\n \t\t{\r\n\t \t\tint rand_num = random_generator.nextInt(valid_colors.length);\r\n\t \t\t\tint new_color = valid_colors[rand_num];\r\n\t \t\t\t\r\n\t \t\t\tchromosome[i] = new_color;\r\n \t\t}\r\n \t}\r\n\t\t\t\r\n }\r\n\t}", "public abstract String toString(String bin);", "static void insertion(BufferedImage img, BufferedImage waterImg, int width, int height, StringBuilder binary, int[] Estimator_pos) {\n int block_num = 0;\r\n int msg_counter = 0;\r\n\r\n for (int x = 0; x < width; x++) {\r\n for (int y = 0; y < height; y++) {\r\n\r\n int b1 = img.getRGB(x, y);\r\n int p1 = (b1 >> 16) & 0xff;\r\n int b2 = img.getRGB(x, y + 1);\r\n int p2 = (b2 >> 16) & 0xff;\r\n int b3 = img.getRGB(x + 1, y);\r\n int p3 = (b3 >> 16) & 0xff;\r\n int b4 = img.getRGB(x + 1, y + 1);\r\n int p4 = (b4 >> 16) & 0xff;\r\n\r\n //geting a random 1-4 for estimator\r\n Random rn = new Random();\r\n int estimator = rn.nextInt(4) + 1;\r\n //System.out.println(estimator);\r\n Estimator_pos[block_num] = estimator;\r\n// System.out.println(\" p1 : \"+p1 + \"| p2 : \" + p2 + \"| p3 : \" + p3 + \"| p4 : \" + p4);\r\n //-----------comparing estimator with pixels ------------------\r\n if ((p1 < 255) && (p2 < 255) && (p3 < 255) && (p4 < 255)) {\r\n\r\n // System.out.println(estimator);\r\n switch (estimator) {\r\n\r\n case 1: //------------------------------------------------------------------------------------- case 1\r\n //System.out.println(\"case 1\");\r\n estimator = p1;\r\n ////writing back estimator \r\n p1 = (p1 << 16) | (p1 << 8) | p1;\r\n waterImg.setRGB(x, y, p1);\r\n //compare with pixel a\r\n //System.out.println(\"comparing with a\");\r\n if (Math.abs(estimator - p2) < 2) {\r\n if (msg_counter < binary.length()) {\r\n if (Character.getNumericValue(binary.charAt(msg_counter)) == 1) {\r\n p2 = p2 + 2;\r\n } else if (Character.getNumericValue(binary.charAt(msg_counter)) == 0) {\r\n p2 = p2 - 2;\r\n }\r\n msg_counter++;\r\n }\r\n } else if (estimator - p2 > 0) {\r\n\r\n p2 = p2 - 2;\r\n } else if (estimator - p2 < 0) {\r\n p2 = p2 + 2;\r\n }\r\n //System.out.println(p1 + \" \" + p2 + \" \" + p3 + \" \" + p4);\r\n p2 = (p2 << 16) | (p2 << 8) | p2;\r\n\r\n waterImg.setRGB(x, y + 1, p2);\r\n\r\n //compare with pixel b\r\n //System.out.println(\"comparing with b\");\r\n if (Math.abs(estimator - p3) < 2) {\r\n if (msg_counter < binary.length()) {\r\n if (Character.getNumericValue(binary.charAt(msg_counter)) == 1) {\r\n p3 = p3 + 2;\r\n } else if (Character.getNumericValue(binary.charAt(msg_counter)) == 0) {\r\n p3 = p3 - 2;\r\n }\r\n msg_counter++;\r\n }\r\n } else if (estimator - p3 > 0) {\r\n\r\n p3 = p3 - 2;\r\n } else if (estimator - p3 < 0) {\r\n p3 = p3 + 2;\r\n }\r\n //System.out.println(p1 + \" \" + p2 + \" \" + p3 + \" \" + p4);\r\n p3 = (p3 << 16) | (p3 << 8) | p3;\r\n waterImg.setRGB(x + 1, y, p3);\r\n\r\n //compare with pixel c\r\n //System.out.println(\"comparing with c\");\r\n if (Math.abs(estimator - p4) < 2) {\r\n if (msg_counter < binary.length()) {\r\n if (Character.getNumericValue(binary.charAt(msg_counter)) == 1) {\r\n p4 = p4 + 2;\r\n } else if (Character.getNumericValue(binary.charAt(msg_counter)) == 0) {\r\n p4 = p4 - 2;\r\n }\r\n msg_counter++;\r\n }\r\n } else if (estimator - p4 > 0) {\r\n\r\n p4 = p4 - 2;\r\n } else if (estimator - p4 < 0) {\r\n p4 = p4 + 2;\r\n }\r\n //System.out.println(p1 + \" \" + p2 + \" \" + p3 + \" \" + p4);\r\n p4 = (p4 << 16) | (p4 << 8) | p4;\r\n waterImg.setRGB(x + 1, y + 1, p4);\r\n\r\n break;\r\n case 2: //------------------------------------------------------------------------------------- case 2\r\n //System.out.println(\"case 2\");\r\n estimator = p2;\r\n ////writing back estimator \r\n p2 = (p2 << 16) | (p2 << 8) | p2;\r\n waterImg.setRGB(x, y + 1, p2);\r\n //compare with pixel a\r\n //System.out.println(\"comparing with a\");\r\n\r\n if (Math.abs(estimator - p1) < 2) {\r\n if (msg_counter < binary.length()) {\r\n if (Character.getNumericValue(binary.charAt(msg_counter)) == 1) {\r\n p1 = p1 + 2;\r\n } else if (Character.getNumericValue(binary.charAt(msg_counter)) == 0) {\r\n p1 = p1 - 2;\r\n }\r\n msg_counter++;\r\n }\r\n } else if (estimator - p1 > 0) {\r\n\r\n p1 = p1 - 2;\r\n } else if (estimator - p1 < 0) {\r\n p1 = p1 + 2;\r\n }\r\n //System.out.println(p1 + \" \" + p2 + \" \" + p3 + \" \" + p4);\r\n p1 = (p1 << 16) | (p1 << 8) | p1;\r\n waterImg.setRGB(x, y, p1);\r\n\r\n //compare with pixel b\r\n //System.out.println(\"comparing with b\");\r\n if (Math.abs(estimator - p3) < 2) {\r\n if (msg_counter < binary.length()) {\r\n if (Character.getNumericValue(binary.charAt(msg_counter)) == 1) {\r\n p3 = p3 + 2;\r\n } else if (Character.getNumericValue(binary.charAt(msg_counter)) == 0) {\r\n p3 = p3 - 2;\r\n }\r\n msg_counter++;\r\n }\r\n } else if (estimator - p3 > 0) {\r\n\r\n p3 = p3 - 2;\r\n } else if (estimator - p3 < 0) {\r\n p3 = p3 + 2;\r\n }\r\n //System.out.println(p1 + \" \" + p2 + \" \" + p3 + \" \" + p4);\r\n p3 = (p3 << 16) | (p3 << 8) | p3;\r\n waterImg.setRGB(x + 1, y, p3);\r\n\r\n //compare with pixel c\r\n //System.out.println(\"comparing with c\");\r\n if (Math.abs(estimator - p4) < 2) {\r\n if (msg_counter < binary.length()) {\r\n if (Character.getNumericValue(binary.charAt(msg_counter)) == 1) {\r\n p4 = p4 + 2;\r\n } else if (Character.getNumericValue(binary.charAt(msg_counter)) == 0) {\r\n p4 = p4 - 2;\r\n }\r\n msg_counter++;\r\n }\r\n } else if (estimator - p4 > 0) {\r\n\r\n p4 = p4 - 2;\r\n } else if (estimator - p4 < 0) {\r\n p4 = p4 + 2;\r\n }\r\n //System.out.println(p1 + \" \" + p2 + \" \" + p3 + \" \" + p4);\r\n p4 = (p4 << 16) | (p4 << 8) | p4;\r\n waterImg.setRGB(x + 1, y + 1, p4);\r\n\r\n break;\r\n case 3: //------------------------------------------------------------------------------------- case 3\r\n //System.out.println(\"case 3\");\r\n estimator = p3;\r\n ////writing back estimator\r\n\r\n p3 = (p3 << 16) | (p3 << 8) | p3;\r\n waterImg.setRGB(x + 1, y, p3);\r\n //compare with pixel a\r\n //System.out.println(\"comparing with a\");\r\n\r\n if (Math.abs(estimator - p1) < 2) {\r\n if (msg_counter < binary.length()) {\r\n if (Character.getNumericValue(binary.charAt(msg_counter)) == 1) {\r\n p1 = p1 + 2;\r\n } else if (Character.getNumericValue(binary.charAt(msg_counter)) == 0) {\r\n p1 = p1 - 2;\r\n }\r\n msg_counter++;\r\n }\r\n } else if (estimator - p1 > 0) {\r\n\r\n p1 = p1 - 2;\r\n } else if (estimator - p1 < 0) {\r\n p1 = p1 + 2;\r\n }\r\n //System.out.println(p1 + \" \" + p2 + \" \" + p3 + \" \" + p4);\r\n p1 = (p1 << 16) | (p1 << 8) | p1;\r\n waterImg.setRGB(x, y, p1);\r\n\r\n //compare with pixel b\r\n //System.out.println(\"comparing with b\");\r\n if (Math.abs(estimator - p2) < 2) {\r\n if (msg_counter < binary.length()) {\r\n if (Character.getNumericValue(binary.charAt(msg_counter)) == 1) {\r\n p2 = p2 + 2;\r\n } else if (Character.getNumericValue(binary.charAt(msg_counter)) == 0) {\r\n p2 = p2 - 2;\r\n }\r\n msg_counter++;\r\n }\r\n } else if (estimator - p2 > 0) {\r\n\r\n p2 = p2 - 2;\r\n } else if (estimator - p2 < 0) {\r\n p2 = p2 + 2;\r\n }\r\n //System.out.println(p1 + \" \" + p2 + \" \" + p3 + \" \" + p4);\r\n p2 = (p2 << 16) | (p2 << 8) | p2;\r\n waterImg.setRGB(x, y + 1, p2);\r\n\r\n //compare with pixel c\r\n //System.out.println(\"comparing with c\");\r\n if (Math.abs(estimator - p4) < 2) {\r\n if (msg_counter < binary.length()) {\r\n if (Character.getNumericValue(binary.charAt(msg_counter)) == 1) {\r\n p4 = p4 + 2;\r\n } else if (Character.getNumericValue(binary.charAt(msg_counter)) == 0) {\r\n p4 = p4 - 2;\r\n }\r\n msg_counter++;\r\n }\r\n } else if (estimator - p4 > 0) {\r\n\r\n p4 = p4 - 2;\r\n } else if (estimator - p4 < 0) {\r\n p4 = p4 + 2;\r\n }\r\n //System.out.println(p1 + \" \" + p2 + \" \" + p3 + \" \" + p4);\r\n p4 = (p4 << 16) | (p4 << 8) | p4;\r\n waterImg.setRGB(x + 1, y + 1, p4);\r\n\r\n break;\r\n case 4: //------------------------------------------------------------------------------------- case 4\r\n estimator = p4;\r\n //wrinting back estimator pixel\r\n p4 = (p4 << 16) | (p4 << 8) | p4;\r\n waterImg.setRGB(x + 1, y + 1, p4);\r\n\r\n //System.out.println(\"case 4\");\r\n //compare with pixel a\r\n //System.out.println(\"comparing with a\");\r\n if (Math.abs(estimator - p1) < 2) {\r\n if (msg_counter < binary.length()) {\r\n if (Character.getNumericValue(binary.charAt(msg_counter)) == 1) {\r\n p1 = p1 + 2;\r\n } else if (Character.getNumericValue(binary.charAt(msg_counter)) == 0) {\r\n p1 = p1 - 2;\r\n }\r\n msg_counter++;\r\n }\r\n } else if (estimator - p1 > 0) {\r\n\r\n p1 = p1 - 2;\r\n } else if (estimator - p1 < 0) {\r\n p1 = p1 + 2;\r\n }\r\n //System.out.println(p1 + \" \" + p2 + \" \" + p3 + \" \" + p4);\r\n p1 = (p1 << 16) | (p1 << 8) | p1;\r\n waterImg.setRGB(x, y, p1);\r\n\r\n //compare with pixel b\r\n //System.out.println(\"comparing with b\");\r\n if (Math.abs(estimator - p2) < 2) {\r\n if (msg_counter < binary.length()) {\r\n if (Character.getNumericValue(binary.charAt(msg_counter)) == 1) {\r\n p2 = p2 + 2;\r\n } else if (Character.getNumericValue(binary.charAt(msg_counter)) == 0) {\r\n p2 = p2 - 2;\r\n }\r\n msg_counter++;\r\n }\r\n } else if (estimator - p2 > 0) {\r\n\r\n p2 = p2 - 2;\r\n } else if (estimator - p2 < 0) {\r\n p2 = p2 + 2;\r\n }\r\n //System.out.println(p1 + \" \" + p2 + \" \" + p3 + \" \" + p4);\r\n p2 = (p2 << 16) | (p2 << 8) | p2;\r\n waterImg.setRGB(x, y + 1, p2);\r\n\r\n //compare with pixel c\r\n //System.out.println(\"comparing with c\");\r\n if (Math.abs(estimator - p3) < 2) {\r\n if (msg_counter < binary.length()) {\r\n if (Character.getNumericValue(binary.charAt(msg_counter)) == 1) {\r\n p3 = p3 + 2;\r\n } else if (Character.getNumericValue(binary.charAt(msg_counter)) == 0) {\r\n p3 = p3 - 2;\r\n }\r\n msg_counter++;\r\n\r\n }\r\n } else if (estimator - p3 > 0) {\r\n\r\n p3 = p3 - 2;\r\n } else if (estimator - p3 < 0) {\r\n p3 = p3 + 2;\r\n }\r\n //System.out.println(p1 + \" \" + p2 + \" \" + p3 + \" \" + p4);\r\n p3 = (p3 << 16) | (p3 << 8) | p3;\r\n waterImg.setRGB(x + 1, y, p3);\r\n\r\n break;\r\n }\r\n// p1 = (p1 >> 16) & 0xff;\r\n// p2 = (p2 >> 16) & 0xff;\r\n// p3 = (p3 >> 16) & 0xff;\r\n// p4 = (p4 >> 16) & 0xff;\r\n// System.out.println(\" p1 : \"+p1 + \"| p2 : \" + p2 + \"| p3 : \" + p3 + \"| p4 : \" + p4);\r\n\r\n } else {\r\n p1 = (p1 << 16) | (p1 << 8) | p1;\r\n waterImg.setRGB(x, y, p1);\r\n p2 = (p2 << 16) | (p2 << 8) | p2;\r\n waterImg.setRGB(x + 1, y, p2);\r\n p3 = (p3 << 16) | (p3 << 8) | p3;\r\n waterImg.setRGB(x, y + 1, p3);\r\n p4 = (p4 << 16) | (p4 << 8) | p4;\r\n waterImg.setRGB(x + 1, y + 1, p4);\r\n\r\n }\r\n block_num = block_num + 1;\r\n\r\n y++;\r\n\r\n }\r\n x++;\r\n }\r\n\r\n }", "public void addPack(NBpack pack) throws ListFullException {\n synchronized (control) {\n if (write_point - read_point == COUNT_MAXPACKS) {\n throw new ListFullException();\n }\n if (write_point >= COUNT_MAXPACKS) {\n packs[write_point - COUNT_MAXPACKS] = pack;\n } else {\n packs[write_point] = pack;\n }\n write_point++;\n if (write_point + 1 == COUNT_MAXPACKS * 2) {\n write_point = 0;\n }\n control.notifyAll();\n }\n }", "Chromosome fittestChromosome();", "private void detectBombs(int row, int col){\r\n int bombCount = 0; //Amount of bombs nearby\r\n //Check up\r\n if((row-1 >= 0) && row<map.length && col<map[0].length && col>=0 && map[row-1][col].getSafe() == false){\r\n bombCount++;\r\n }\r\n //Check down\r\n if((row+1 < map.length) && row>=0&& col<map[0].length && col>=0 && map[row+1][col].getSafe() == false){\r\n bombCount++;\r\n }\r\n //Check right\r\n if((col+1 < map[0].length) && col>=0 && row<map.length && row>=0 && map[row][col+1].getSafe() == false){\r\n bombCount++;\r\n }\r\n //Check left\r\n if((col-1 >= 0) && col<map[0].length && row<map.length && row>=0 && map[row][col-1].getSafe() == false){\r\n bombCount++;\r\n }\r\n //Check up right\r\n if((row-1 >= 0) && row<map.length && (col+1 < map[0].length) && col>=0 && map[row-1][col+1].getSafe() == false){\r\n bombCount++;\r\n }\r\n //Check up left\r\n if((row-1 >= 0) && row<map.length && (col-1 >= 0) && col<map[0].length&& map[row-1][col-1].getSafe() == false){\r\n bombCount++;\r\n }\r\n //Check down left\r\n if((row+1 < map.length) && row>=0 && (col-1 >= 0)&& col<map[0].length && map[row+1][col-1].getSafe() == false){\r\n bombCount++;\r\n }\r\n //check down right\r\n if((row+1 < map.length) && row>=0 && (col+1 < map[0].length)&& col>=0 && map[row+1][col+1].getSafe() == false){\r\n bombCount++;\r\n }\r\n if(row>=0 && col>=0 && row<map.length && col<map[0].length && !map[row][col].getVisual().equals(\"F\") && map[row][col].getSafe() == true){\r\n if(bombCount==0){\r\n map[row][col].setVisual(zero);\r\n }\r\n if(bombCount==1){\r\n map[row][col].setVisual(one);\r\n }\r\n if(bombCount==2){\r\n map[row][col].setVisual(two);\r\n }\r\n if(bombCount==3){\r\n map[row][col].setVisual(three);\r\n }\r\n if(bombCount==4){\r\n map[row][col].setVisual(four);\r\n }\r\n if(bombCount==5){\r\n map[row][col].setVisual(five);\r\n }\r\n if(bombCount==6){\r\n map[row][col].setVisual(six);\r\n }\r\n if(bombCount==7){\r\n map[row][col].setVisual(seven);\r\n }\r\n if(bombCount==8){\r\n map[row][col].setVisual(eight);\r\n }\r\n map[row][col].setRevealed(true);\r\n }\r\n\r\n\r\n //return bombCount;\r\n\r\n\r\n }", "public void a(bq nbttagcompound)\r\n/* 226: */ {\r\n/* 227:184 */ super.a(nbttagcompound);\r\n/* 228: */ \r\n/* 229: */ \r\n/* 230: */ \r\n/* 231:188 */ int cs2 = nbttagcompound.e(\"cvm\") & 0x3F;\r\n/* 232:189 */ this.CoverSides |= cs2;\r\n/* 233:190 */ byte[] cov = nbttagcompound.j(\"cvs\");\r\n/* 234:191 */ if ((cov != null) && (cs2 > 0))\r\n/* 235: */ {\r\n/* 236:192 */ int sp = 0;\r\n/* 237:193 */ for (int i = 0; i < 6; i++) {\r\n/* 238:194 */ if ((cs2 & 1 << i) != 0)\r\n/* 239: */ {\r\n/* 240:195 */ this.Covers[i] = ((short)((cov[sp] & 0xFF) + ((cov[(sp + 1)] & 0xFF) << 8)));\r\n/* 241: */ \r\n/* 242:197 */ sp += 2;\r\n/* 243: */ }\r\n/* 244: */ }\r\n/* 245: */ }\r\n/* 246:200 */ rebuildSticky();\r\n/* 247: */ }", "void writeTo(ByteBuffer buffer) {\n/* 526 */ Preconditions.checkNotNull(buffer);\n/* 527 */ Preconditions.checkArgument(\n/* 528 */ (buffer.remaining() >= 40), \"Expected at least Stats.BYTES = %s remaining , got %s\", 40, buffer\n/* */ \n/* */ \n/* 531 */ .remaining());\n/* 532 */ buffer\n/* 533 */ .putLong(this.count)\n/* 534 */ .putDouble(this.mean)\n/* 535 */ .putDouble(this.sumOfSquaresOfDeltas)\n/* 536 */ .putDouble(this.min)\n/* 537 */ .putDouble(this.max);\n/* */ }", "public boolean hasBackpack() {\n return ((bitField0_ & 0x00000100) == 0x00000100);\n }", "private static int getBit(int pack, int pos) {\n\t\treturn (pack & (1 << pos)) != 0 ? 1 : 0;\n\t}", "public int getBinCapicityFilled() {\n int binCapicity = 0;\n for( Packet p: packets) {\n binCapicity += p.getPacketHeight();\n }\n return binCapicity;\n\n }", "public void insertToArray()\n {\n //if the bucket size is not empty, empty out the bucket\n if(zero.size() != 0)\n {\n a[c] = zero.get(0);\n zero.remove(0);\n c++; s++;\n return;\n }\n if(one.size() != 0)\n {\n a[c] = one.get(0);\n one.remove(0);\n c++; s++;\n return;\n }\n if(two.size() != 0)\n {\n a[c] = two.get(0);\n two.remove(0);\n c++; s++;\n return;\n }\n if(three.size() != 0)\n {\n a[c] = three.get(0);\n three.remove(0);\n c++; s++;\n return;\n }\n if(four.size() != 0)\n {\n a[c] = four.get(0);\n four.remove(0);\n c++; s++;\n return;\n }\n if(five.size() != 0)\n {\n a[c] = five.get(0);\n five.remove(0);\n c++; s++;\n return;\n }\n if(six.size() != 0)\n {\n a[c] = six.get(0);\n six.remove(0);\n c++; s++;\n return;\n }\n if(seven.size() != 0)\n {\n a[c] = seven.get(0);\n seven.remove(0);\n c++; s++;\n return;\n }\n if(eight.size() != 0)\n {\n a[c] = eight.get(0);\n eight.remove(0);\n c++; s++;\n return;\n }\n if(nine.size() != 0)\n {\n a[c] = nine.get(0);\n nine.remove(0);\n c++; s++;\n return;\n }\n }", "public void dump()\n\t{\n\n\t\tSystem.out.println(\"--- min-max heap dump --- \");\n\t\tSystem.out.println(\" Size = \" + size);\n\t\tSystem.out.println(\" Minimum = \" + getMin());\n\t\tSystem.out.println(\" Maximum = \" + getMax());\n\t\tif(getLevel(size)% 2 == 0 )\n\t\t{\n\t\t\tSystem.out.println(\"Last Level is Even\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tSystem.out.println(\"Last Level is Odd\");\n\t\t}\n\t\tSystem.out.println(\"--- heap data items --- \");\n\t\tfor(int i = 0; i < array.length; i++)\n\t\t{\n\t\t\tif(array[i] == null)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tSystem.out.println(\"H[\" + (i+1) + \"] = \" + array[i]);\n\t\t}\n\n\t}", "public byte[] toByteArray(){\n int bound=numOfBits*2/*The Start Position*/+numOfBits*2/*The Goal Position*/+numOfBits/*Num of Rows*/+numOfBits/*Num of Columns*/+(maze.length*maze[0].length);\n byte[] arrayByte=new byte[bound];\n\n fillArrayByte(arrayByte,0,toBinary(start.getRowIndex()));\n fillArrayByte(arrayByte,numOfBits,toBinary(start.getColumnIndex()));\n fillArrayByte(arrayByte,numOfBits*2,toBinary(goal.getRowIndex()));\n fillArrayByte(arrayByte,numOfBits*3,toBinary(goal.getColumnIndex()));\n fillArrayByte(arrayByte,numOfBits*4,toBinary(maze.length));\n fillArrayByte(arrayByte,numOfBits*5,toBinary(maze[0].length));\n int counter=numOfBits*6;\n for(int i=0;i<maze.length;i++){\n for(int j=0;j<maze[0].length;j++){\n arrayByte[counter]=(byte)maze[i][j];\n counter++;\n }\n }\n return arrayByte;\n\n\n }", "protected void optimizeBushes() {\r\n\t\tfor (int i = 0; i < execBushes.size(); i++) {\r\n\t\t\tLog.info(String.format(\r\n\t\t\t\t\t\"Performing POR Analysis on Bush Sequence %d of %d\", i + 1,\r\n\t\t\t\t\texecBushes.size()));\r\n\r\n\t\t\t// optimization only works for sequence lengths >= 3\r\n\t\t\tList<EventType> sequence = execBushes.get(i);\r\n\t\t\tif (sequence.size() < 3)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t// is bush already redundant?\r\n\t\t\tif (redundantExecBushes.contains(sequence)) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\t// is bush PO-reducible?\r\n\t\t\tif (isPOReducible(sequence)) {\r\n\t\t\t\t// create redundant sequence (for later checking)\r\n\t\t\t\tList<EventType> redundantSequence = new ArrayList<EventType>();\r\n\t\t\t\tredundantSequence.add(sequence.get(1));\r\n\t\t\t\tredundantSequence.add(sequence.get(0));\r\n\t\t\t\tredundantSequence.add(sequence.get(2));\r\n\t\t\t\tredundantExecBushes.add(redundantSequence);\r\n\t\t\t}\r\n\r\n\t\t\trequiredExecBushes.add(sequence);\r\n\t\t}\r\n\t}", "public boolean applyMove(int bin) \n {\n \tint stones = state[bin];\n \t//clear the original bin\n \tstate[bin] = 0;\n \t\n \tfor (int i = 0; i < stones; ++i) \n \t{\n \t\tint nextBin = (bin+i+1)%14;\n \t\tif (!(nextBin == 6 && bin > 6) && !(nextBin == 13 && bin < 7))\n \t\t\t++state[nextBin];\n \t\telse\n \t\t\t++stones;\n \t}\n \tint lastBin = (bin+stones)%14;\n \tboolean lastBinEmpty = state[lastBin] == 1;\n \tboolean lastBinOnYourSide = bin/7 == lastBin/7;\n \tif ((lastBin == 6 || lastBin == 13) && !gameOver()) \n \t{\n \t\treturn true;\n }\n \tif (lastBinEmpty && lastBinOnYourSide && lastBin != 6 && lastBin != 13) \n \t{\n \t\tint mancalaBin = mancalaOf(bin);\n \t\tint neighborBin = neighborOf(lastBin);\n \t\tstate[mancalaBin] += state[neighborBin] + 1;\n \t\tstate[neighborBin] = 0;\n \t\tstate[lastBin] = 0;\n \t}\n if (gameOver())\n stonesToMancalas();\n return false;\n }", "public static void pruning(StringBuilder binaryGenome, GEMapper mapper, double pruningProbability) {\n\t\t\n\t\tGenotype<String> genotype = new Genotype<String>(binaryGenome.toString());\n\t\t\n\t\tif (MathUtil.flip(pruningProbability)) {\t\n\t\t\t\n\t\t\ttry {\n\t\t\t\t\n\t\t\t\tmapper.getPhenotype(genotype);\n\t\t\t\t\n\t\t\t\tString usable = null;\n\t\t\t\tint codonSize = mapper.getCodonSize();\n\t\t\t\tint lastRunCodonIndex = mapper.lastRunCodonIndex();\n\t\t\t\tint lastRunWraps = mapper.lastRunWraps();\t\t\t\n\t\t\t\t// Calculate the number of codons in the genotype string\n\t\t\t\t// Note: It is possible the last codon to have less than codonSize bits\n\t\t\t\tint codonsNum = (int) Math.ceil((double) binaryGenome.length() / (double) codonSize);\n\t\t\t\t\n\t\t\t\tif (lastRunWraps > 0) // Genotype Wrapping occured which means that all codons where used\n\t\t\t\t\treturn;\n\t\t\t\tif (lastRunCodonIndex == codonsNum - 1) // Last codon of the genome was used\n\t\t\t\t\treturn;\n\t\t\t\t\n\t\t\t\t// Keep only the used codons\n\t\t\t\tusable = binaryGenome.substring(0, (lastRunCodonIndex + 1) * codonSize);\n\t\t\t\t\n\t\t\t\tbinaryGenome.delete(0, binaryGenome.length());\n\t\t\t\tbinaryGenome.append(usable);\n\t\t\t\t\n\t\t\t}\n\t\t\tcatch(InvalidPhenotypeException ipe) {\n\t\t\t\t//System.out.println(ipe.getMessage());\t\t\t\t\n\t\t\t}\t\t\t\t\t\t\t\t\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t}", "public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n List<Shape> shapes = new ArrayList<>();\n //System.out.println(\"Please enter the bin capacity\");\n Shape container = new Shape();\n container.containerPrompt();\n container.containerVolume();\n int binCapacity = container.containerVolume();\n //insert three items here\n System.out.println(\"How many cubes do want to store: 1, 2 or 3 \");\n int choice = scanner.nextInt();\n while (choice-- >0){\n Shape object = new Shape();\n object.objectPrompt();\n shapes.add(object);\n\n /*\n object.objectVolume();\n int one = object.containerVolume();*/\n }\n\n /*switch (choice){\n case 1:\n Shape shape1 = new Shape();\n shape1.objectPrompt();\n shape1.objectVolume();\n int one = shape1.containerVolume();\n break;\n case 2:\n Shape shape2 = new Shape();\n shape2.objectPrompt();\n shape2.objectVolume();\n int two = shape2.containerVolume();\n\n Shape shape3 = new Shape();\n shape3.objectPrompt();\n shape3.objectVolume();\n int one = shape1.containerVolume();\n break;\n\n case 3:\n Shape shape1 = new Shape();\n shape1.objectPrompt();\n shape1.objectVolume();\n int one = shape1.containerVolume();\n break;\n default:\n }*/\n List<Integer> items=new ArrayList<>();\n\n for (Shape shape: shapes){\n items.add(shape.containerVolume());\n System.out.println(shape.containerVolume());\n }\n\n\n\n //List<Integer> items = Arrays.asList(shapes.get(0).containerVolume());\n //insert the bin capacity\n // int binCapacity = 5;\n CheckBin algorithm = new CheckBin(items, binCapacity);\n algorithm.solvingBinPackingProblem();\n algorithm.showResults();\n // System.out.println(\"This is after committing\");\n\n\n }", "public static HashMap<String, HashMap<Integer, Integer>> binHiggsData(HashMap<String, ArrayList<Double>> energyMap){\r\n\r\n\t\t//hashmap. Keys: detector name. Value: the hashmap above\r\n\t\tHashMap<String, HashMap<Integer, Integer>> bothDetectorsBinnedData = new HashMap<String, HashMap<Integer, Integer>>();\r\n\r\n\t\t//arraylist of the detector in the map so we can loop through all of them \r\n\t\tArrayList<String> detectorList = new ArrayList<String>();\r\n\t\tdetectorList.addAll(energyMap.keySet());\r\n\r\n\t\t//loop through all of the detectors (in this case, just GG and ZZ)\r\n\t\tfor (String detector : detectorList){\r\n\r\n\t\t\t//initialise values - this needs to be done in this for loop to reset for each detector\r\n\t\t\tint currentValueBin;\r\n\t\t\tint currentFreq;\t\r\n\t\t\tint newFreq;\r\n\t\t\tdouble currentValueBinD;\r\n\r\n\t\t\t//hashmap. Keys: each bin minimum. Value: number of readings in that bin\r\n\t\t\tHashMap<Integer, Integer> numberOfReadingsInEachBin = new HashMap<Integer, Integer>();\r\n\r\n\t\t\t//find the current list of data for this detector\r\n\t\t\tArrayList<Double> currentData = energyMap.get(detector);\r\n\r\n\t\t\tArrayList<Integer> flooredValues = new ArrayList<Integer>();\r\n\r\n\t\t\t//loop through all of the data in the set for this detector\r\n\t\t\tfor (double currentE : currentData){\r\n\r\n\t\t\t\t//round the value down, this is what the bin will be\r\n\t\t\t\tcurrentValueBinD = Math.floor(currentE);\r\n\t\t\t\tcurrentValueBin = (int) currentValueBinD;\r\n\r\n\t\t\t\tflooredValues.add(currentValueBin);\r\n\r\n\r\n\t\t\t\t//look for this value in the hashmap of bins and frequency\r\n\t\t\t\tInteger frequency = numberOfReadingsInEachBin.get(currentValueBin);\r\n\r\n\r\n\r\n\t\t\t\t//if this bin hasn't been put into the hashmap yet, put it in\r\n\t\t\t\tif (frequency == null){\r\n\t\t\t\t\tnumberOfReadingsInEachBin.put(currentValueBin, 1);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//if it has, add one to the frequency\r\n\t\t\t\telse{\r\n\t\t\t\t\tcurrentFreq = numberOfReadingsInEachBin.get(currentValueBin);\r\n\t\t\t\t\tnewFreq = currentFreq +1;\r\n\t\t\t\t\tnumberOfReadingsInEachBin.put(currentValueBin, newFreq);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//System.out.println(Collections.min(currentData));\r\n\r\n\t\t\t//if there have been frequencies of zero, they won't have been added, add them now\r\n\t\t\tfor (int i = Collections.min(flooredValues); i < Collections.max(flooredValues); i++){\r\n\t\t\t\tInteger currentReadings = numberOfReadingsInEachBin.get(i);\r\n\r\n\t\t\t\tif (currentReadings == null){\r\n\r\n\t\t\t\t\tnumberOfReadingsInEachBin.put(i, 0);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//put the detector and the corresponding frequency data into the hashmap\r\n\t\t\tbothDetectorsBinnedData.put(detector, numberOfReadingsInEachBin);\r\n\r\n\t\t}\r\n\t\treturn bothDetectorsBinnedData;\r\n\t}", "@Test\n\tvoid testPositionInformationAdjustmentForIncompleteVersionstamp() throws Exception {\n\t\tTuple t3 = Tuple.from(Versionstamp.incomplete(1));\n\t\tAssertions.assertEquals(1 + Versionstamp.LENGTH + Integer.BYTES, t3.getPackedSize(),\n\t\t \"incomplete versionstamp has incorrect packed size: \" + t3.getPackedSize());\n\n\t\tbyte[] bytes3 = t3.packWithVersionstamp();\n\t\tAssertions.assertEquals(1,\n\t\t ByteBuffer.wrap(bytes3, bytes3.length - Integer.BYTES, Integer.BYTES)\n\t\t .order(ByteOrder.LITTLE_ENDIAN)\n\t\t .getInt(),\n\t\t \"incomplete versionstamp has incorrect position\");\n\t\tAssertions.assertEquals(Tuple.from(Versionstamp.incomplete(1)),\n\t\t Tuple.fromBytes(bytes3, 0, bytes3.length - Integer.BYTES),\n\t\t \"unpacked bytes did not match\");\n\n\t\tSubspace subspace = new Subspace(Tuple.from(\"prefix\"));\n\t\tbyte[] bytes4 = subspace.packWithVersionstamp(t3);\n\t\tAssertions.assertEquals(1 + subspace.getKey().length,\n\t\t ByteBuffer.wrap(bytes4, bytes4.length - Integer.BYTES, Integer.BYTES)\n\t\t .order(ByteOrder.LITTLE_ENDIAN)\n\t\t .getInt(),\n\t\t \"incomplete versionstamp has incorrect position with prefix\");\n\t\tAssertions.assertEquals(Tuple.from(\"prefix\", Versionstamp.incomplete(1)),\n\t\t Tuple.fromBytes(bytes4, 0, bytes4.length - Integer.BYTES),\n\t\t \"unpacked bytes with subspace did not match\");\n\n\t\ttry {\n\t\t\t// At this point, the representation is cached, so an easy bug would be to have\n\t\t\t// it return the already serialized value\n\t\t\tt3.pack();\n\t\t\tAssertions.fail(\"was able to pack versionstamp with incomplete versionstamp\");\n\t\t} catch (IllegalArgumentException eexpected) {\n\t\t\t// eat\n\t\t}\n\t}", "private void buildOutput()\n\t{\n\t\tif(outIndex >= output.length)\n\t\t{\n\t\t\tbyte[] temp = output;\n\t\t\toutput = new byte[temp.length * 2];\n\t\t\tSystem.arraycopy(temp, 0, output, 0, temp.length);\n\t\t}\n\t\t\n\t\tif(sb.length() < 16 && aryIndex < fileArray.length)\n\t\t{\n\t\t\tbyte[] b = new byte[1];\n\t\t\tb[0] = fileArray[aryIndex++];\n\t\t\tsb.append(toBinary(b));\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < prioQ.size(); i++)\n\t\t{\n\t\t\tif(sb.toString().startsWith(prioQ.get(i).getCode()))\n\t\t\t{\n\t\t\t\toutput[outIndex++] = (byte)prioQ.get(i).getByteData();\n\t\t\t\tsb = new StringBuilder(\n\t\t\t\t\t\tsb.substring(prioQ.get(i).getCode().length()));\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"Can't find Huffman code.\");\n\t\tSystem.exit(1);\n\t\texit = true;\n\t}", "public int[] popBubbles(int[][] darts) {\n\n int[] ret = new int[darts.length];\n int ptr = 0;\n for (int[] d: darts) {\n ret[ptr++] = grid[d[0]][d[1]];\n }\n\n int row = grid.length;\n int col = grid[0].length;\n WeightedQuickUnionUF wuf = new WeightedQuickUnionUF(row*col + 1);\n System.out.println(Arrays.deepToString(grid));\n for (int[] d: darts) {\n grid[d[0]][d[1]] = 0;\n }\n System.out.println(Arrays.deepToString(grid));\n System.out.println(wuf.count());\n build(wuf);\n System.out.println(wuf.count());\n int count = wuf.count();\n for (int i=darts.length-1; i>=0; i--) {\n int[] d = darts[i];\n if (ret[i] == 1) {\n System.out.println(Arrays.deepToString(grid));\n grid[d[0]][d[1]] = 1;\n System.out.println(Arrays.deepToString(grid));\n System.out.println(wuf.count());\n build(wuf);\n System.out.println(wuf.count());\n ret[i] = count - wuf.count() - 1;\n count = wuf.count();\n }\n }\n return ret;\n }", "private void BScreate() {\n\n\t\tint sum=0;//全枝数のカウント\n\t\tfor(int i=0;i<banknode;i++) sum+=Bank.get(i).deg;\n\n\t\t//e,d,nの決定\n\t\tif(NW==\"BA\"){\n\t\tfor(int i=0;i<banknode;i++) {\n\t\t\tBank.get(i).totalassets=E*((double)Bank.get(i).deg/(double)sum);\n\t\t\tBank.get(i).n=Bank.get(i).totalassets*Bank.get(i).CAR;\n\t\t\tBank.get(i).d=Bank.get(i).totalassets-Bank.get(i).n;\n\t\t\tBank.get(i).buffer=Bank.get(i).totalassets;\n\t\t}\n\t\t}\n\n\t\tif(NW==\"CM\"){\n\t\t\tfor(int i=0;i<banknode;i++){\n\t\t\t\tBank.get(i).totalassets=E/banknode;\n\t\t\t\tBank.get(i).n=Bank.get(i).totalassets*asyCAR;\n\t\t\t\tBank.get(i).forcelev=megaCAR;\n\t\t\t\tBank.get(i).d=Bank.get(i).totalassets-Bank.get(i).n;\n\t\t\t\tBank.get(i).buffer=Bank.get(i).totalassets;\n\t\t\t}\n\n\t\t}\n\n\t}", "public abstract Chromosome mutation(Chromosome child);", "void merge_hi(int pa, int na, int pb, int nb) {\n getmem(nb);\n int dest = pb + nb - 1;\n int basea = pa;\n System.arraycopy(this.data, pb, this.a, 0, nb);\n \n pb = nb - 1;\n pa += na - 1;\n \n this.data[dest--] = this.data[pa--];\n --na;\n if (na == 0)\n return;\n if (nb == 1) {\n // CopyA;\n dest -= na;\n pa -= na;\n System.arraycopy(this.data, pa+1, this.data, dest+1, na);\n this.data[dest] = this.a[pb];\n nb = 0;\n return;\n }\n \n try {\n for (;;) {\n int acount = 0; /* # of time A won in a row */\n int bcount = 0; /* # of time B won in a row */\n \n /* Do the straightforward thing until (if ever) one run\n * appears to win consistently.\n */\n for (;;) {\n boolean k = iflt(this.a[pb], this.data[pa]);\n if (k) {\n this.data[dest--] = this.data[pa--];\n ++acount;\n bcount = 0;\n --na;\n if (na == 0)\n return;\n if (acount >= MIN_GALLOP)\n break;\n } else {\n this.data[dest--] = this.a[pb--];\n ++bcount;\n acount = 0;\n --nb;\n if (nb == 1) {\n // CopyA\n dest -= na;\n pa -= na;\n System.arraycopy(this.data, pa+1, this.data, dest+1, na);\n this.data[dest] = this.a[pb];\n nb = 0;\n return;\n }\n if (bcount >= MIN_GALLOP)\n break;\n }\n }\n \n /* One run is winning so consistently that galloping may\n * be a huge win. So try that, and continue galloping until\n * (if ever) neither run appears to be winning consistently\n * anymore.\n */\n do {\n int k = gallop_right(this.a[pb], this.data, basea, na, na-1);\n acount = k = na - k;\n if (k != 0) {\n dest -= k;\n pa -= k;\n System.arraycopy(this.data, pa+1, this.data, dest+1, k);\n na -= k;\n if (na == 0)\n return;\n }\n \n this.data[dest--] = this.a[pb--];\n --nb;\n if (nb == 1) {\n // CopyA\n dest -= na;\n pa -= na;\n System.arraycopy(this.data, pa+1, this.data, dest+1, na);\n this.data[dest] = this.a[pb];\n nb = 0;\n return;\n }\n \n k = gallop_left(this.data[pa], this.a, 0, nb, nb-1);\n bcount = k = nb - k;\n if (k != 0) {\n dest -= k;\n pb -= k;\n System.arraycopy(this.a, pb+1, this.data, dest+1, k);\n nb -= k;\n if (nb == 1) {\n // CopyA\n dest -= na;\n pa -= na;\n System.arraycopy(this.data, pa+1, this.data, dest+1, na);\n this.data[dest] = this.a[pb];\n nb = 0;\n return;\n }\n /* nb==0 is impossible now if the comparison\n * function is consistent, but we can't assume\n * that it is.\n */\n if (nb == 0)\n return;\n }\n this.data[dest--] = this.data[pa--];\n --na;\n if (na == 0)\n return;\n } while (acount >= MIN_GALLOP || bcount >= MIN_GALLOP);\n }\n } finally {\n if (nb != 0)\n System.arraycopy(this.a, 0, this.data, dest-(nb-1), nb);\n \n //dump_data(\"result\", origpa, cnt);\n }\n }", "@Test\n public void testGenome() {\n\n this.genomeBList.add(this.chromB1);\n this.genomeBList.add(this.chromB2);\n this.genomeBList.add(this.chromB3);\n this.genomeBList.add(this.chromB4);\n\n this.genomeB = new Genome(this.genomeBList);\n this.addHPDataB = new AdditionalDataHPDistance(this.genomeB);\n\n Assert.assertTrue(this.genomeB.getGenome().size() == 4);\n Assert.assertTrue(this.genomeB.getNumberOfChromosomes() == 4);\n Assert.assertTrue(this.genomeB.getNumberOfGenes() == 9);\n Assert.assertTrue(this.genomeB.getChromosome(1).getGenes()[1] == 6);\n Assert.assertTrue(this.genomeB.getChromosome(0).getSize() == 4);\n Assert.assertTrue(this.genomeB.getGenome().get(1).getGenes()[1] == 6);\n\n // Assert.assertTrue(this.addHPDataB.getGenomeAsArray().length == 17);\n // Assert.assertTrue(this.addHPDataB.getGenomeAsArray()[0] == 1);\n // Assert.assertTrue(this.addHPDataB.getGenomeAsArray()[8] == 9);\n\n Assert.assertTrue(this.addHPDataB.getGenomeCappedPlusArray().length == 17);\n Assert.assertTrue(this.addHPDataB.getGenomeCappedPlusArray()[0] == 0);\n Assert.assertTrue(this.addHPDataB.getGenomeCappedPlusArray()[8] == 6);\n\n Assert.assertTrue(this.addHPDataB.getGenomeCappedMinusArray().length == 17);\n Assert.assertTrue(this.addHPDataB.getGenomeCappedMinusArray()[0] == -10);\n Assert.assertTrue(this.addHPDataB.getGenomeCappedMinusArray()[8] == 6);\n\n }", "@Override\r\n\t\t\tpublic void populationUpdate(PopulationData<? extends Solution> data) {\n//\t\t\t\tbuffer.append(data.getPopulationSize());\r\n//\t\t\t\tbuffer.append(\"\\n\");\r\n\t\t\t\t\r\n\t\t\t\tdouble fit = data.getBestCandidateFitness();\r\n//\t\t\t\tSystem.out.println(fit);\r\n\t\t\t\tbuffer.delete(0, buffer.length());\r\n\t\t\t\tbuffer.append(fit);\r\n//\t\t\t\tbuffer.append(\"\\n\");\r\n\t\t\t\t\r\n\t\t\t\tif (Run10FastExternalizer.initialFitness.getDbl() == -1.0) {\r\n\t\t\t\t\tRun10FastExternalizer.initialFitness.setDbl(fit);\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif (fit == 0.0){\r\n\t\t\t\t\tArrayList<Student> studentsCopy = new ArrayList<>();\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor (Student student: students){\r\n\t\t\t\t\t\tstudentsCopy.add(student.clone());\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tStringBuilder sb = new StringBuilder();\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor (Student student: studentsCopy){\r\n\t\t\t\t\t\tstudent.register(data.getBestCandidate().getBlocks());\r\n//\t\t\t\t\t\tSystem.out.println(student.getSchedule());\r\n//\t\t\t\t\t\tbuffer.append(student.getSchedule().toString());\r\n//\t\t\t\t\t\tbuffer.append(\"\\n\");\r\n\t\t\t\t\t\tsb.append(student.getSchedule().toString());\r\n\t\t\t\t\t\tsb.append(\"\\n\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tsuperValue = sb.toString();\r\n\t\t\t\t}\r\n\t\t\t}", "private void persistChunkBounds()\n\t{\n\t\tprevChunkBounds[BOUND_LEFT] = chunkBounds[BOUND_LEFT];\n\t\tprevChunkBounds[BOUND_RIGHT] = chunkBounds[BOUND_RIGHT];\n\t\tprevChunkBounds[BOUND_BOTTOM] = chunkBounds[BOUND_BOTTOM];\n\t\tprevChunkBounds[BOUND_TOP] = chunkBounds[BOUND_TOP];\n\t}", "private void addBucketToInternalTank()\n {\n if (this.getStackInSlotByType(SlotContainerTypeEnum.INPUT_FILLEDBUCKET) == null)\n {\n return;\n }\n\n // Output 1 - Empty bucket returns from full one in input slot 1\n ItemStack bucketEmpty = new ItemStack(Item.bucketEmpty);\n ItemStack bucketWater = new ItemStack(Item.bucketWater);\n\n // Check if input slot 1 is a water bucket.\n if (!this.getStackInSlotByType(SlotContainerTypeEnum.INPUT_FILLEDBUCKET).isItemEqual(bucketWater))\n {\n return;\n }\n\n // Check if output slot 1 (for empty buckets) is above item stack limit.\n if (this.getStackInSlotByType(SlotContainerTypeEnum.OUTPUT_EMPTYBUCKET) != null)\n {\n int slot1Result = this.getStackInSlotByType(SlotContainerTypeEnum.OUTPUT_EMPTYBUCKET).stackSize + bucketEmpty.stackSize;\n boolean underStackLimit = (slot1Result <= getInventoryStackLimit() && slot1Result <= bucketEmpty.getMaxStackSize());\n if (!underStackLimit)\n {\n // If we are not under the minecraft or item stack limit for output slot 2 then stop here.\n return;\n }\n }\n\n // Check if the internal water tank has reached it\n if (this.getFluidAmount() >= this.getFluidCapacity())\n {\n return;\n }\n\n // Add empty water bucket to output slot 2.\n if (this.getStackInSlotByType(SlotContainerTypeEnum.OUTPUT_EMPTYBUCKET) == null)\n {\n this.setInventorySlotContentsByType(SlotContainerTypeEnum.OUTPUT_EMPTYBUCKET, bucketEmpty.copy());\n }\n else if (this.getStackInSlotByType(SlotContainerTypeEnum.OUTPUT_EMPTYBUCKET).isItemEqual(bucketEmpty))\n {\n this.getStackInSlotByType(SlotContainerTypeEnum.OUTPUT_EMPTYBUCKET).stackSize += bucketEmpty.stackSize;\n }\n\n // Add a bucket's worth of water into the internal tank.\n this.addFluidAmountByBucket(1);\n\n // Remove a filled bucket of water from input stack 1.\n this.decrStackSize(this.getSlotIDByType(SlotContainerTypeEnum.INPUT_FILLEDBUCKET), 1);\n }", "private static boolean generateCHGraphWorkloadFile(Cluster cluster, WorkloadBatch wb) {\r\n\t\t\r\n\t\t// Compressing workload hypergraph\r\n\t\twb.compression(false);\r\n\r\n\t\t// Only selecting compressed hyperedges having at least two compressed vertices\r\n\t\tGlobal.LOGGER.info(\"Only selecting the compressed hyperedges having at least two compressed vertices ...\");\r\n\t\t\r\n\t\tMap<CompressedHEdge, Set<CompressedVertex>> cHESet = new HashMap<CompressedHEdge, Set<CompressedVertex>>();\r\n\t\tSet<CompressedVertex> cVSet = new TreeSet<CompressedVertex>();\r\n\t\t\t\t\t\t\r\n\t\tfor(Entry<CompressedHEdge, Set<CompressedVertex>> entry : wb.hgr.getCHEdgeMap().entrySet()) {\r\n\t\t\tif(entry.getValue().size() >= 2) {\r\n\t\t\t\tcHESet.put(entry.getKey(), entry.getValue());\r\n\t\t\t\tcVSet.addAll(entry.getValue());\r\n\t\t\t} else {\t\t\t\t\r\n\t\t\t\tGlobal.LOGGER.info(\"Omitting compressed hyperedge with only 1 compressed vertex !!!\");\r\n\t\t\t}\r\n\t\t}\t\t\t\t\r\n\t\t\r\n\t\tGlobal.LOGGER.info(\"Total \"+cHESet.size()+\" compressed hyperedges spanning \"+cVSet.size()+\" compressed vertices are selected.\");\r\n\t\t\r\n\t\tcvertex_id_map = new HashMap<Integer, Integer>();\r\n\t\tint temp_cv_id = 0;\r\n\t\tfor(CompressedVertex cv : cVSet){\t\t\t\r\n\t\t\tcvertex_id_map.put(cv.getId(), ++temp_cv_id);\r\n\t\t\t\r\n\t\t\tfor(Entry<Integer, SimpleVertex> cv_entry : cv.getVSet().entrySet()) {\t\t\t\t\t\t\t\r\n\t\t\t\tData data = cluster.getData(cv_entry.getValue().getId());\r\n\t\t\t\tdata.setData_inUse(true);\r\n\t\t\t}\r\n\t\t}\t\r\n\t\t\r\n\t\t// Creating Compressed Hyper-graph Workload File\r\n\t\tGlobal.LOGGER.info(\"Generating workload file for compressed hypergraph based repartitioning ...\");\r\n\t\t\t\r\n\t\tint edges = cHESet.size();\r\n\t\tint vertices = cVSet.size();\r\n\t\tint hasCHEdgeWeight = 1;\r\n\t\tint hasCVertexWeight = 1;\r\n\t\t\t\t\r\n\t\t// Write in a file\t\t\r\n\t\tif(edges <= 1) { \r\n\t\t\tGlobal.LOGGER.info(\"Only \"+edges+\" compressed hyperedges present in the workload hypergraph network.\");\r\n\t\t\tGlobal.LOGGER.info(\"Repartitioning will be aborted for this run ...\");\t\r\n\t\t\t\r\n\t\t\treturn true;\r\n\t\t\t\r\n\t\t} else {\t\t\r\n\t\t\ttry {\r\n\t\t\t\twb.getWrl_file().getParentFile().mkdirs();\r\n\t\t\t\t\r\n\t\t\t\tif(wb.getWrl_file().exists())\r\n\t\t\t\t\twb.getWrl_file().delete();\r\n\t\t\t\t\r\n\t\t\t\twb.getWrl_file().createNewFile();\r\n\t\t\t\t\r\n\t\t\t\tWriter writer = null;\r\n\t\t\t\t\r\n\t\t\t\ttry {\r\n\t\t\t\t\twriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(wb.getWrl_file()), \"utf-8\"));\r\n\t\t\t\t\twriter.write(edges+\" \"+vertices+\" \"+hasCHEdgeWeight+\"\"+hasCVertexWeight+\"\\n\");\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor(Entry<CompressedHEdge, Set<CompressedVertex>> entry : cHESet.entrySet()) {\t\t\t\t\t\t\r\n\t\t\t\t\t\t// Writing ch's weight\r\n\t\t\t\t\t\twriter.write(Integer.toString(entry.getKey().getWeight())+\" \");\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t// Writing compressed vertices incident on ch\r\n\t\t\t\t\t\tIterator<CompressedVertex> cv_itr = entry.getValue().iterator();\r\n\t\t\t\t\t\twhile(cv_itr.hasNext()) {\t\t\t\t\t\t\r\n\t\t\t\t\t\t\twriter.write(Integer.toString(cvertex_id_map.get(cv_itr.next().getId())));\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif(cv_itr.hasNext())\r\n\t\t\t\t\t\t\t\twriter.write(\" \"); \r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\twriter.write(\"\\n\");\t\t\r\n\t\t\t\t\t}\r\n\t\r\n\t\t\t\t\t// Writing compressed vertices' weight\t\t\t\t\t\r\n\t\t\t\t\tIterator<CompressedVertex> cv_itr = cVSet.iterator();\r\n\t\t\t\t\twhile(cv_itr.hasNext()) {\r\n\t\t\t\t\t\tString cv_weight = Integer.toString(cv_itr.next().getWeight());\r\n\t\t\t\t\t\twriter.write(cv_weight);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif(cv_itr.hasNext())\r\n\t\t\t\t\t\t\twriter.write(\"\\n\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t} catch(IOException e) {\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t}finally {\r\n\t\t\t\t\twriter.close();\r\n\t\t\t\t}\r\n\t\t\t} catch (IOException e) {\t\t\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\t\r\n\t\t\t\r\n\t\t\tGlobal.LOGGER.info(\"Workload file generation for compressed hypergraph based repartitioning has completed.\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "@Test public void hpackUseCase() {\n BitArray b = new BitArray.FixedCapacity();\n for (int i = 0; i < 64; i++) {\n b.set(i);\n }\n assertTrue(b.get(0));\n assertTrue(b.get(1));\n assertTrue(b.get(63));\n try {\n b.get(64);\n fail();\n } catch (IllegalArgumentException expected) {\n }\n b = ((BitArray.FixedCapacity) b).toVariableCapacity();\n assertTrue(b.get(0));\n assertTrue(b.get(1));\n assertTrue(b.get(63));\n assertFalse(b.get(64));\n b.set(64);\n assertTrue(b.get(64));\n }", "public StructureVillagePieces.Village buildComponent(StructureVillagePieces.PieceWeight parPieceWeight, StructureVillagePieces.Start parStart, List<StructureComponent> parPiecesList, Random parRand, int parMinX, int parMinY, int parMinZ, EnumFacing parFacing, int parType) {\n/* 50 */ System.out.println(\"TekHouse6 buildComponent() at \" + parMinX + \", \" + parMinY + \", \" + parMinZ);\n/* */ \n/* 52 */ StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(parMinX, parMinY, parMinZ, 0, 0, 0, 9, 7, 12, parFacing);\n/* 53 */ return (canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(parPiecesList, structureboundingbox) == null) ? (StructureVillagePieces.Village)new TekHouse6(parStart, parType, parRand, structureboundingbox, parFacing) : null;\n/* */ }", "public static byte[] genPackage(Protocol proto){\r\n\r\n\t\t// 2 soh/stx + 48 ids + 1 pers+ 1 cmd + 2nchar + N data+ 1 Etx + 1 bcc + 1 eot\r\n\t\tint pkgSize = 57 + proto.getData().length; \r\n\r\n\t\tbyte[] pkg = new byte[pkgSize];\r\n\r\n\t\tpkg[0] = (byte) Dictionary.SOH;\r\n\t\tpkg[1] = (byte) Dictionary.STX;\r\n\r\n\t\tbyte[] idFrom = proto.getIDFrom().getBytes();\t\t\t\r\n\t\tfor(int i=0;i<16;i++)\r\n\t\t{\r\n\t\t\tpkg[i+2] = idFrom[i];\r\n\t\t}\r\n\r\n\t\tbyte[] idTo = proto.getIDTo().getBytes();\r\n\t\tfor(int i=0;i<16;i++)\r\n\t\t{\r\n\t\t\tpkg[i+18] = idTo[i];\r\n\t\t}\r\n\r\n\t\tbyte[] idApp = proto.getIDApp().getBytes();\r\n\t\tfor(int i=0;i<16;i++)\r\n\t\t{\r\n\t\t\tpkg[i+34] = idApp[i];\r\n\t\t}\r\n\r\n\t\tint ndata = proto.getData().length;\r\n\r\n\t\tpkg[50] = (byte)(proto.isPersisted()?1:0);\r\n\t\tpkg[51] = (byte) proto.getCommand();\r\n\t\tpkg[52] = (byte) (ndata/256);\r\n\t\tpkg[53] = (byte) (ndata%256);\r\n\r\n\t\tfor(int i=0;i<ndata;i++)\r\n\t\t{\r\n\t\t\tpkg[i+54] = proto.getData()[i];\r\n\t\t}\r\n\r\n\t\tpkg[ndata+54] = 0x03; \t//ETX\r\n\t\tpkg[ndata+55] = 0;\t\t//BCC\r\n\t\tpkg[ndata+56] = 0x04; \t//EOT\r\n\r\n\t\treturn pkg;\r\n\t}", "@Before\n public void setUpBinaryMinHeaps() {\n empty = new BinaryMinHeap<>();\n emptyArr = new ArrayList<>();\n \n multipleElements = new BinaryMinHeap<>();\n multipleElements.insert(7);\n multipleElements.insert(8);\n multipleElements.insert(5);\n multipleElements.insert(3);\n multipleElements.insert(2);\n multipleElements.insert(6);\n \n multiArr = new ArrayList<>();\n multiArr.add(2);\n multiArr.add(3);\n multiArr.add(6);\n multiArr.add(8);\n multiArr.add(5);\n multiArr.add(7);\n \n }", "public void plantBombsInEmptyCells() {\n\t\tfor (int i = 0; i < r; i++) {\n\t\t\tfor (int j = 0; j < c; j++) {\n\t\t\t\tgrid[i][j] = ( grid[i][j] < 0 ? 0 : grid[i][j] );\n\t\t\t}\n\t\t}\n\t}", "private com.google.protobuf.SingleFieldBuilderV3<\n io.envoyproxy.envoy.type.v3.FractionalPercent, io.envoyproxy.envoy.type.v3.FractionalPercent.Builder, io.envoyproxy.envoy.type.v3.FractionalPercentOrBuilder> \n getOverallSamplingFieldBuilder() {\n if (overallSamplingBuilder_ == null) {\n overallSamplingBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<\n io.envoyproxy.envoy.type.v3.FractionalPercent, io.envoyproxy.envoy.type.v3.FractionalPercent.Builder, io.envoyproxy.envoy.type.v3.FractionalPercentOrBuilder>(\n getOverallSampling(),\n getParentForChildren(),\n isClean());\n overallSampling_ = null;\n }\n return overallSamplingBuilder_;\n }", "private NodoBin<T> clonarAS(NodoBin<T> r){\t\t\t\t\n if(r==null)\n return r;\n else\n {\n NodoBin<T> aux=new NodoBin<T>(r.getInfo(), clonarAS(r.getIzq()), clonarAS(r.getDer()));\n return aux;\n }\n }", "private int getBinI(Location l)\r\n {\r\n return (int)((l.getX()-bl.getX())/di);\r\n }", "abstract int binSearch(int[] array, int num, int left, int right);", "private String getBWT(){\n Character[] alphabet = wt.root.alphabetMap.keySet().toArray(new Character[0]);\n String bwt = \"\";\n \n for (int i = 0; i < wt.root.bitVector.length+1; i++) {\n for (int j = 0; j < alphabet.length; j++) {\n int rank1 = wt.rank(alphabet[j].charValue(), i);\n int rank2 = wt.rank(alphabet[j].charValue(), i-1);\n if(rank1 != rank2){\n bwt += alphabet[j];\n }\n }\n }\n return bwt;\n }", "void ompleBlocsHoritzontals() {\r\n\r\n for (int i = 0; i < N; i = i + SRN) // for diagonal box, start coordinates->i==j \r\n {\r\n ompleBloc(i, i);\r\n }\r\n }" ]
[ "0.50017667", "0.4864148", "0.4864148", "0.4864148", "0.4864148", "0.4864148", "0.4864148", "0.4836785", "0.48315436", "0.48188946", "0.4776412", "0.47135487", "0.46944556", "0.4693256", "0.4680497", "0.46632528", "0.46562842", "0.46428186", "0.46224427", "0.46117812", "0.4598492", "0.45886105", "0.45833415", "0.45814538", "0.45769486", "0.45769486", "0.4573526", "0.455635", "0.45542052", "0.4549419", "0.4524764", "0.4502805", "0.4502546", "0.4495189", "0.44951108", "0.44870648", "0.44783202", "0.4476032", "0.4468008", "0.44628438", "0.44603106", "0.4442912", "0.4432413", "0.4429798", "0.44152296", "0.44124466", "0.44027007", "0.43966216", "0.4382398", "0.4377584", "0.43754032", "0.43611103", "0.43527597", "0.43504736", "0.43479645", "0.43449047", "0.43381095", "0.43336236", "0.4328778", "0.43255794", "0.43182275", "0.43170768", "0.43099093", "0.43079704", "0.43048662", "0.43045285", "0.42982364", "0.4283962", "0.42818728", "0.42817995", "0.42776564", "0.427434", "0.42702618", "0.42680776", "0.4266873", "0.42587662", "0.42505607", "0.42473817", "0.4247355", "0.4243868", "0.42404255", "0.42347345", "0.42320904", "0.4231382", "0.42225686", "0.42211533", "0.4219628", "0.42064595", "0.41948768", "0.41940922", "0.41913792", "0.41893414", "0.4188806", "0.4185152", "0.41760442", "0.41727048", "0.41724315", "0.41680446", "0.41665253", "0.41642886" ]
0.64455414
0
Inserts a set of chromosomes into a given population by removing the worst members and replacing them with children.
private int[][] replaceLowestFitness(int[][] population, ArrayList<int[]> replacers) { float[] fitnesses = new float[population.length]; for (int i = 0; i < population.length; i++) { fitnesses[i] = getFitness(population[i]); } //find worst chromosomes around ArrayList<Integer> worstFitnessesIndexes = new ArrayList<Integer>(); float[] fitnessesSorted = fitnesses.clone(); Arrays.sort(fitnessesSorted); for (int i = 0; i < population.length; i++) { for (int j = 0; j < replacers.size() + 1; j++) { if (fitnesses[i] <= fitnessesSorted[j]) { worstFitnessesIndexes.add(new Integer(i)); break; } } if (worstFitnessesIndexes.size() > replacers.size() + 1) //only find as many bad chromosomes as we have replacements break; } for (int i = 0; i < replacers.size(); i++) { int[] replacer = replacers.get(i); population[worstFitnessesIndexes.get(i)] = replacer; //replace worst fitnesses with replacements } population[worstFitnessesIndexes.get(replacers.size())] = eliteChromosome; //make sure elite stays return population; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static Set<Chromosome> mutatePopulation(Set<Chromosome> population, double mutationRate) {\n Set<Chromosome> mutatedChromosomes = new HashSet<>(population);\n\n for (Chromosome path : mutatedChromosomes) {\n double mutationProbability = ThreadLocalRandom.current().nextDouble();\n if (mutationProbability > (1-mutationRate)) {\n // mutate the path using the RSM mutation operator\n mutateRoute(path);\n // indicate that the fitness of this path needs to be recalculated\n path.fitness = -1;\n }\n }\n\n // The set will most probably include certain chromosomes which are already present in the set of children\n // however, given that both are sets, any duplicates will be discarded\n return mutatedChromosomes;\n }", "public void genPopulation(int howMany)\r\n/* 30: */ {\r\n/* 31:54 */ this.pop.removeAllElements();\r\n/* 32:55 */ for (int i = 0; i < howMany; i++)\r\n/* 33: */ {\r\n/* 34:61 */ int[] clusterV = g.genRandomClusterSize();\r\n/* 35:62 */ Cluster c = new Cluster(g, clusterV);\r\n/* 36:63 */ this.pop.addElement(c);\r\n/* 37: */ }\r\n/* 38: */ }", "private static void fixPopulation() {\r\n \t//get a copy of the population hash map\r\n \tHashMap<String, ArrayList<Critter>> copy = new HashMap<String, ArrayList<Critter>>(population);\r\n \tIterator<String> populationIterator = copy.keySet().iterator();\r\n \twhile (populationIterator.hasNext()) { \r\n String pos = populationIterator.next();\r\n ArrayList<Critter> critterList = copy.get(pos);\r\n //clear the key if there is no more critters in that space\r\n if(critterList.size() == 0 || critterList == null) {\r\n \tpopulation.remove(pos);\r\n }\r\n \t}\r\n }", "public void reproduce(int generation, IPopulation pop, List<ISpecies> sorted_species) {\n\t\tfor(ISpecies specie : sorted_species){\r\n\r\n\t\t\tList<IOrganism> organisms = specie.getOrganisms();\r\n\r\n\t\t\t// outside the species\r\n\t\t\tint orgnum = 0;\r\n\r\n\t\t\tIOrganism mom = null;\r\n\t\t\tIOrganism baby = null;\r\n\t\t\tIGenome new_genome = null;\r\n\t\t\tIOrganism _organism = null;\r\n\t\t\tIOrganism _dad = null;\r\n\r\n\t\t\tif (specie.getExpectedOffspring() > 0 && organisms.size() == 0)\r\n\t\t\t\treturn;\r\n\r\n\t\t\t// elements for this species\r\n\t\t\tint poolsize = organisms.size() - 1;\r\n\r\n\t\t\t// the champion of the 'this' species is the first element of the species;\r\n\t\t\tIOrganism thechamp = organisms.get(0);\r\n\t\t\tboolean champ_done = false; // Flag the preservation of the champion\r\n\r\n\t\t\t// Create the designated number of offspring for the Species one at a time.\r\n\t\t\tfor (int count = 0; count < specie.getExpectedOffspring(); count++) {\r\n\r\n\t\t\t\t// If we have a super_champ (Population champion), finish off some special clones.\r\n\t\t\t\tif (thechamp.getSuperChampOffspring() > 0) {\r\n\r\n\t\t\t\t\t// save in mom current champ;\r\n\t\t\t\t\tmom = thechamp;\r\n\t\t\t\t\t// create a new genome from this copy\r\n\t\t\t\t\tnew_genome = mom.getGenome().duplicate(count);\r\n\t\t\t\t\tif ((thechamp.getSuperChampOffspring()) > 1) {\r\n\t\t\t\t\t\tif (RandomUtils.randomDouble() < .8 || evolutionParameters.getDoubleParameter(MUTATE_ADD_LINK_PROB) == 0.0)\r\n\t\t\t\t\t\t\tevolutionStrategy.getMutationStrategy().mutateLinkWeight(new_genome, evolutionParameters.getDoubleParameter(WEIGHT_MUT_POWER), 1.0, MutationType.GAUSSIAN);\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t// Sometimes we add a link to a superchamp\r\n\t\t\t\t\t\t\tnew_genome.generatePhenotype(generation);\r\n\t\t\t\t\t\t\tevolutionStrategy.getMutationStrategy().mutateAddLink(new_genome,pop);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation);\r\n\t\t\t\t\tthechamp.incrementSuperChampOffspring();\r\n\t\t\t\t} // end population champ\r\n\r\n\t\t\t\t// If we have a Species champion, just clone it\r\n\t\t\t\telse if ((!champ_done) && (specie.getExpectedOffspring() > 5)) {\r\n\t\t\t\t\tmom = thechamp; // Mom is the champ\r\n\t\t\t\t\tnew_genome = mom.getGenome().duplicate(count);\r\n\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation); // Baby is\r\n\t\t\t\t\t// just like mommy\r\n\t\t\t\t\tchamp_done = true;\r\n\r\n\t\t\t\t} else if (RandomUtils.randomDouble() < evolutionParameters.getDoubleParameter(MUTATE_ONLY_PROB) || poolsize == 1) {\r\n\r\n\t\t\t\t\t// Choose the random parent\r\n\t\t\t\t\torgnum = RandomUtils.randomInt(0, poolsize);\r\n\t\t\t\t\t_organism = organisms.get(orgnum);\r\n\t\t\t\t\tmom = _organism;\r\n\t\t\t\t\tnew_genome = mom.getGenome().duplicate(count);\r\n\r\n\t\t\t\t\t// Do the mutation depending on probabilities of various mutations\r\n\t\t\t\t\tevolutionStrategy.getMutationStrategy().mutate(new_genome,pop,generation);\r\n\r\n\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation);\r\n\t\t\t\t}\r\n\t\t\t\t// Otherwise we should mate\r\n\t\t\t\telse {\r\n\t\t\t\t\t// Choose the random mom\r\n\t\t\t\t\torgnum = RandomUtils.randomInt(0, poolsize);\r\n\t\t\t\t\t_organism = organisms.get(orgnum);\r\n\r\n\t\t\t\t\t// save in mom\r\n\t\t\t\t\tmom = _organism;\r\n\t\t\t\t\t// Choose random dad...\r\n\t\t\t\t\t// Mate within Species\r\n\t\t\t\t\tif (RandomUtils.randomDouble() > evolutionParameters.getDoubleParameter(INTERSPECIES_MATE_RATE)) {\r\n\t\t\t\t\t\torgnum = RandomUtils.randomInt(0, poolsize);\r\n\t\t\t\t\t\t_organism = organisms.get(orgnum);\r\n\t\t\t\t\t\t_dad = _organism;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// Mate outside Species\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\t// save current species\r\n\t\t\t\t\t\tISpecies randspecies = specie;\r\n\t\t\t\t\t\t// Select a random species\r\n\t\t\t\t\t\tint giveup = 0;\r\n\t\t\t\t\t\t// Give up if you can't find a different Species\r\n\t\t\t\t\t\twhile ((randspecies == specie) && (giveup < 5)) {\r\n\r\n\t\t\t\t\t\t\t// Choose a random species tending towards better species\r\n\t\t\t\t\t\t\tdouble randmult = Math.min(1.0, RandomUtils.randomGaussian() / 4);\r\n\r\n\t\t\t\t\t\t\t// This tends to select better species\r\n\t\t\t\t\t\t\tint sp_ext = Math.max(0, (int) Math.floor((randmult * (sorted_species.size() - 1.0)) + 0.5));\r\n\t\t\t\t\t\t\trandspecies = sorted_species.get(sp_ext);\r\n\t\t\t\t\t\t\t++giveup;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t_dad = randspecies.getOrganisms().get(0);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tnew_genome = evolutionStrategy.getCrossoverStrategy().performCrossover(mom,_dad,count);\r\n\r\n\t\t\t\t\t// Determine whether to mutate the baby's Genome\r\n\t\t\t\t\t// This is done randomly or if the mom and dad are the same organism\r\n\t\t\t\t\tif (RandomUtils.randomDouble() > evolutionParameters.getDoubleParameter(MATE_ONLY_PROB) || \r\n\t\t\t\t\t\t\t_dad.getGenome().getId() == mom.getGenome().getId() || \r\n\t\t\t\t\t\t\t_dad.getGenome().compatibility(mom.getGenome()) == 0.0) {\r\n\r\n\t\t\t\t\t\tevolutionStrategy.getMutationStrategy().mutate(new_genome,pop,generation);\r\n\t\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation);\r\n\t\t\t\t\t} \r\n\t\t\t\t\t// end block of prob\r\n\t\t\t\t\t// Determine whether to mutate the baby's Genome\r\n\t\t\t\t\t// This is done randomly or if the mom and dad are the same organism\r\n\r\n\t\t\t\t\t// Create the baby without mutating first\r\n\t\t\t\t\telse \r\n\t\t\t\t\t\tbaby = FeatFactory.newOrganism(0.0, new_genome, generation);\r\n\t\t\t\t}\r\n\t\t\t\tevolutionStrategy.getSpeciationStrategy().addOrganismToSpecies(pop, baby);\r\n\t\t\t} // end offspring cycle\r\n\t\t}\r\n\t}", "private int insertForciblyIntoPopulation(Individual new_child) {\n int position = insertIntoPopulation(new_child);\n if( position == population_size) {\n population[population_size - 1] = new_child;\n position = population_size - 1;\n }\n return position;\n }", "public EvPopulation<T> apply(EvPopulation<T> population) {\n\n int population_size = population.size();\n\n combine_parent_selector.init(population, 2, population_size);\n\n EvPopulation<T> result = new EvPopulation<T>(population_size + 3);\n\n // Generate children since population is not filled\n while (result.size() < population_size)\n combine(combine_parent_selector.getNextParents(), result);\n\n // Remove overfull\n while (result.size() > population_size)\n result.remove(result.size() - 1);\n\n return result;\n }", "void TruncPopulation(double percent){\n\t\t\tint i,j,t, numIndiviadual;\n\t\t\tnode[] _nm;\n\t\t \tint[] Sort=new int[poplen];\t \t\n\t\t \n\t\t \tfor(i=0; i<poplen; i++)\t{\n\t\t \t\tSort[i]=i;\t \t\t\n\t\t \t}\n\t\t \t\t \n\t\t \t// Sort giam dam\n\t\t \tfor(i=0; i<poplen-1; i++)\t{\n\t\t \t\tfor(j=i+1; j<poplen; j++){\t \t\t\n\t\t \t\t\tif(oldpop[Sort[i]].size<oldpop[Sort[j]].size){\n\t\t \t\t\t\tt=Sort[i];\n\t\t \t\t\t\tSort[i]=Sort[j];\n\t\t \t\t\t\tSort[j]=t;\n\t\t \t\t\t}\n\t\t \t\t}\n\t\t \t\t\n\t\t \t}\n\t\t\t\n\t\t \tnumIndiviadual=(int)(poplen*percent);\n\t\t \t\n//\t\t \tSystem.out.println(numIndiviadual);\n\t\t \t\n\t\t\tfor(i = 0; i < numIndiviadual; i++){\n\t\t\t\tindividual[] m_individual=new individual[1];\n\t\t\t\tint[] _mt=new int[1];\n\t\t\t\t_nm=new node[1];\n//\t\t\t\tSystem.out.println(\"Trước+\"+oldpop[i].size);\n\t\t\t\tif(this.TruncateTreeGrow(oldpop[Sort[i]], m_individual,_mt,_nm)==TRUE){\t\n\t\t\t\t\t\n\t\t\t\toldpop[Sort[i]]=new individual();\n\t\t\t\toldpop[Sort[i]].CopyIndividual(m_individual[0], TRUE);\t\t\t\n\t\t\t\toldpop[Sort[i]].evaluated=FALSE;\n//\t\t\t\tSystem.out.println(\"Sau+\"+oldpop[i].size);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}", "private static void mergePopulationMoved(HashMap<String, ArrayList<Critter>> changed) {\r\n \t//iterator through the critters that have moved\r\n \tIterator<String> populationMovedIterator = changed.keySet().iterator();\r\n \twhile (populationMovedIterator.hasNext()) { \r\n \t\t//get the position of a moved critter\r\n String pos = populationMovedIterator.next();\r\n ArrayList<Critter> critterList = population.get(pos);\r\n \r\n //if there are critters in that grid position\r\n if(!(critterList == null)) {\r\n \tIterator<Critter> positionChanged = changed.get(pos).iterator();\r\n \twhile(positionChanged.hasNext()) {\r\n \t\tcritterList.add(positionChanged.next());\r\n \t}\r\n \tpopulation.replace(pos, critterList);\r\n \r\n //if there are critters already keyed onto that position\r\n } else {\r\n \tArrayList<Critter> newCritterList = new ArrayList<Critter>();\r\n \tIterator<Critter> positionChanged = changed.get(pos).iterator();\r\n \twhile(positionChanged.hasNext()) {\r\n \t\tnewCritterList.add(positionChanged.next());\r\n \t}\r\n \t//put the critter in the population hash map in its new position\r\n \tpopulation.put(pos, newCritterList);\r\n }\r\n \r\n }\r\n \t//clear the moved population hash map to get ready for the new moved critters\r\n \tchanged.clear();\r\n }", "public static void GA(ArrayList<City> cities){\n int pathLength = cities.size();\n // the number of chromosomes which will be generated\n int populationSize = 100;\n // the number of chromosomes that will be generated from crossover as a percentage of the population\n double crossoverRate = 0.8;\n // the number of chromosomes that will be generated from crossover\n int crossoverSize = (int) (populationSize * crossoverRate);\n // the probability that a chromosome can have a random mutation\n double mutationRate = 0.05;\n // the number of generations\n int generations = 5000;\n\n // Initialising the distance matrix using the initialiseDistanceMatrix method\n initialiseDistanceMatrix(cities);\n\n // Generating the Initial Population\n ArrayList<Chromosome> population = generatePopulation(cities, pathLength, populationSize);\n\n // The following is done for each generation of the population\n for (int i = 0; i < generations; i++) {\n // calculating the fitness of every chromosome in the current generation\n calculateFitnessOfPopulation(population);\n // sort the population so that the chromosomes with the highest fitness are at the start of the list\n Collections.sort(population);\n // call the method which performs crossover on the population\n Set<Chromosome> children = crossoverPopulation(population, populationSize, crossoverSize);\n // carry out mutation on the children of the current population\n children.addAll( mutatePopulation(children, mutationRate) );\n\n // evolve the population\n population.addAll(children);\n ArrayList<Chromosome> currentGeneration = new ArrayList<>(population);\n ArrayList<Chromosome> nextGeneration = evolvePopulation(currentGeneration, populationSize, cities, pathLength);\n population = new ArrayList<>(nextGeneration);\n }\n\n // find the fittest chromosome\n Chromosome fittestChromosome = population.get(0);\n double maxFitness = population.get(0).fitness;\n for (Chromosome c : population) {\n if (c.fitness > maxFitness) {\n maxFitness = c.fitness;\n fittestChromosome = c;\n }\n }\n // display the path and distance of the fittest chromosome\n System.out.println(fittestChromosome.getPath());\n System.out.println(\"Total Route Distance: \" + routeDistance(fittestChromosome));\n\n //printPopulation(population);\n }", "public static Population evolvePopulation(Population pop) {\n Population newPopulation = new Population(pop.populationSize(), false);\n\n // Keep our best individual if elitism is enabled\n int elitismOffset = 0;\n if (elitism) {\n newPopulation.saveTour(0, pop.getFittest());\n elitismOffset = 1;\n }\n\n // Crossover population\n // Loop over the new population's size and create individuals from\n // Current population\n for (int i = elitismOffset; i < newPopulation.populationSize(); i++) {\n // Select parents\n // Tour parent1 = tournamentSelection(pop);\n //Tour parent2 = tournamentSelection(pop);\n\n\n\n\n Tour[] temp_a = roullet( newPopulation);\n if( temp_a == null )\n {\n System.out.println(\"no a\");\n //r//eturn temp;\n }\n // Tour parent1 = tournamentSelection(pop);\n //Tour parent2 = tournamentSelection(pop);\n Tour parent1 = temp_a[0];\n Tour parent2 = temp_a[1];\n\n\n\n\n\n\n\n\n // Crossover parents\n Tour child = crossover(parent1, parent2);\n // Add child to new population\n newPopulation.saveTour(i, child);\n }\n\n // Mutate the new population a bit to add some new genetic material\n for (int i = elitismOffset; i < newPopulation.populationSize(); i++) {\n mutate(newPopulation.getTour(i));\n }\n\n return newPopulation;\n }", "public void grow(Grid[][] map) {\n\t\tBranchNode parent = root;\r\n\t\twhile (parent.children.size() > 0) {\r\n\t\t\tif (parent.children.size() >= max_branch_per_node) {\r\n\t\t\t\t// if no more room at this branch\r\n\t\t\t\tparent = parent.children\r\n\t\t\t\t\t\t.get((int) (Math.random() * parent.children.size()));\r\n\t\t\t} else if (Math.random() < 0.5) {\r\n\t\t\t\t// if there is still room, picks randomly\r\n\t\t\t\tparent = parent.children\r\n\t\t\t\t\t\t.get((int) (Math.random() * parent.children.size()));\r\n\t\t\t} else {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tint newX, newY; // X and Y coordinates for the new node.\r\n\t\tint r = (int) (Math.random() * GENE_TOTAL);\r\n\t\tint gene_count = width_gene[0];\r\n\t\tint width_select = 0;\r\n\t\twhile (r > gene_count) {\r\n\t\t\twidth_select += 1;\r\n\t\t\tgene_count += width_gene[width_select];\r\n\t\t}\r\n\t\tr = (int) (Math.random() * WIDTH_VARIATION);\r\n\t\tnewX = parent.x - WIDTH_VARIATION / 2 + (width_select - 2)\r\n\t\t\t\t* WIDTH_VARIATION + r;\r\n\t\tif (newX < 0) {// if goes off the grid, push back.\r\n\t\t\tnewX = 0;\r\n\t\t} else if (newX >= World.WORLD_WIDTH) {\r\n\t\t\tnewX = World.WORLD_WIDTH - 1;\r\n\t\t}\r\n\r\n\t\tr = (int) (Math.random() * GENE_TOTAL);\r\n\t\tgene_count = height_gene[0];\r\n\t\tint height_select = 0;\r\n\t\twhile (r > gene_count) {\r\n\t\t\theight_select += 1;\r\n\t\t\tgene_count += height_gene[height_select];\r\n\t\t}\r\n\t\tr = (int) (Math.random() * HEIGHT_VARIATION);\r\n\t\tnewY = parent.y + height_select * HEIGHT_VARIATION + r;\r\n\t\tif (newY >= World.WORLD_HEIGHT) {\r\n\t\t\tnewY = World.WORLD_HEIGHT - 1;\r\n\t\t}\r\n\r\n\t\t// add the branch to the total body.\r\n\t\tamount_of_tree += (int) Math.sqrt((newX - parent.x) * (newX - parent.x)\r\n\t\t\t\t+ (newY - parent.y) * (newY - parent.y));\r\n\t\tBranchNode child = new BranchNode(parent, newX, newY);\r\n\t\tparent.children.add(child);\r\n\r\n\t\tif (parent.leaf_alive) {\r\n\t\t\t// kill leaf, because branch is growing off of it\r\n\t\t\tparent.killLeaf(this, map);\r\n\t\t}\r\n\r\n\t\t// make new leaf on new branch\r\n\t\tchild.addLeaf(this, map);\r\n\t}", "public Population evolve()\r\n {\r\n\tArrayList<Chromosome> tempPop = \r\n\t new ArrayList<Chromosome>(chromos.size());\r\n\tChromosome u;\r\n\tChromosome v;\r\n\r\n\tfor(int i = 0; i < chromos.size()/2; i++)\r\n\t {\r\n\t\tu = selectParent();\r\n\t\tv = selectParent();\r\n\t\t\r\n\t\t//System.out.println(\"*****Parent 1 : \\n\" + v);\r\n\t\t\r\n Chromosome c1 = u.child(v);\r\n Chromosome c2 = v.child(u);\r\n\t\ttempPop.add(c1);\r\n\t\ttempPop.add(c2);\r\n\t\t\r\n //System.out.println(\"****Generated new child: \\n\" + c1);\r\n\t }\t \r\n\t\r\n\t// if needed, add in the code for keeping the best chromosome\r\n\tPopulation pop = new Population(tempPop, selMethod, selPara, \r\n\t\t\t\t\tcrossMethod, crossPara, mutMethod, mutPara, \r\n\t\t\t\t\treplaceMethod, replacePara, powerStep, tourStep, ff);\r\n\r\n\tif(replaceMethod == ELITISM)\r\n\t {\r\n\t\tpop.remove(worstChromoIndex);\r\n\t\tpop.add(bestChromo.clone());\r\n\t\tpop.initialize();\r\n\t }\r\n\r\n\tgeneration++;\r\n\treturn pop;\r\n }", "Chromosome from(List<Chromosome> population);", "void insertPopulation(RowWrapper row) throws SQLException {\n if (row.hasNoText(4)) return;\n\n String author = row.getNullableText(getAuthorIdx());\n String pubYear = row.getNullableText(getPubYearIdx(), true);\n String externalId = row.getNullableText(getPmidIdx(), true);\n Integer publicationId = this.publicationCatalog.lookupId(externalId, pubYear, author);\n\n this.insertPopulation.setString(1, row.getNullableText(getEthIdx()));\n this.insertPopulation.setString(2, row.getNullableText(getPopIdx()));\n this.insertPopulation.setString(3, row.getNullableText(getPopInfoIdx()));\n this.insertPopulation.setString(4, row.getNullableText(getSubjTypeIdx()));\n Long nSubjects = 0L;\n try {\n nSubjects = row.getNullableLong(getNIdx());\n } catch (NumberFormatException ex) {\n sf_logger.warn(ex.getMessage());\n }\n this.insertPopulation.setLong(5, nSubjects);\n if (publicationId != null) {\n this.insertPopulation.setInt(6, publicationId);\n } else {\n this.insertPopulation.setNull(6, Types.INTEGER);\n }\n ResultSet rs = this.insertPopulation.executeQuery();\n if (!rs.next()) {\n throw new RuntimeException(\"Insert failed\");\n }\n Long popId = rs.getLong(1);\n \n for (Integer colIdx : colIdxAlleleIdMap.keySet()) {\n insertFrequency(row, colIdx, popId);\n }\n this.insertPopulation.clearParameters();\n }", "private static Set<Chromosome> generateRandomPopulation(int pathLength, int randomPopulationSize) {\n Set<Chromosome> population = new HashSet<>();\n\n // create an arraylist of CityIDs, and initialise it with the cities in order of their ID\n ArrayList<Integer> basePath = new ArrayList<>();\n for (int i = 0; i < pathLength; i++) {\n basePath.add(i);\n }\n\n // repeat the following for as many chromosomes as are required (populationSize)\n while (population.size() < randomPopulationSize) {\n Chromosome chromosome = new Chromosome(pathLength);\n // randomise the order of the arraylist of cities\n Collections.shuffle(basePath);\n for (int j = 0; j < pathLength; j++) {\n chromosome.path[j] = basePath.get(j);\n }\n population.add(chromosome);\n }\n\n return population;\n }", "public void reproduce(){\n\t\t// sort the population from strongest to weakest\n\t\tCollections.sort(population);\n\t\tCollections.reverse(population);\n\t\t\n\t\tfor(int i = 0; i < (int)(POPULATION_SIZE*POPULATION_ACTION_PERCENT); i+=2){\n\t\t\t\n\t\t\t// get two random indexes for reproduction based on the exponential function\n\t\t\t// (1/1000) * (randInt)^2 = index\n\t\t\t// this function favors sequences with higher fitness scores\n\t\t\tint randIndex1 = randomGenerator.nextInt((int)Math.sqrt(1000*POPULATION_SIZE*(1-POPULATION_ACTION_PERCENT)));\n\t\t\tint randIndex2 = randomGenerator.nextInt((int)Math.sqrt(1000*POPULATION_SIZE*(1-POPULATION_ACTION_PERCENT)));\n\t\t\t\n\t\t\trandIndex1 = (int) (Math.pow(randIndex1, 2) / 1000);\n\t\t\trandIndex2 = (int) (Math.pow(randIndex2, 2) / 1000);\n\t\t\t\n\t\t\t// get two pieces\n\t\t\tBuildingPiece[] array1 = population.get(randIndex1).getList();\n\t\t\tBuildingPiece[] array2 = population.get(randIndex2).getList();\n\t\t\t\n\t\t\t// find a splicing point\n\t\t\tint splicePoint = findSplicingPoint(array1, array2);\n\t\t\t\n\t\t\t// generate two new arrays based on the splicing point\n\t\t\tBuildingPiece[] newArray1 = generateNewArray(array1, array2, splicePoint);\n\t\t\tBuildingPiece[] newArray2 = generateNewArray(array2, array1, splicePoint);\n\t\t\t\n\t\t\t// make new buildings with the new arrays\n\t\t\tBuilding bp1 = new Building(newArray1, generation, possiblePieces);\n\t\t\tBuilding bp2 = new Building(newArray2, generation, possiblePieces);\n\t\t\t\n\t\t\t// mutate the new building sequences\n\t\t\tmutateArray(bp1);\n\t\t\tmutateArray(bp2);\n\t\t\t\n\t\t\t// add them into the population\n\t\t\tpopulation.add(randIndex1, bp1);\n\t\t\tpopulation.add(randIndex2, bp2);\n\t\t}\n\t}", "private <T> List<Chromosome<T>> breedNewGeneration(List<Chromosome<T>> chromosomes){\n\t\tList<Chromosome<T>> selected = selection.apply(chromosomes);\n\t\tCollections.shuffle(selected);\n\n\t\tList<Chromosome<T>> crossedOver = Lists.newArrayList();\n\t\tfor(int i = 0; i < selected.size(); i+=2){\n\t\t\tChromosome<T>[] bred = crossover.apply(selected.get(i), selected.get(i+1));\n\t\t\tcrossedOver.add(bred[0]);\n\t\t\tcrossedOver.add(bred[1]);\n\t\t}\n\n\t\treturn crossedOver.stream().map(mutation::apply).collect(Collectors.toList());\n\t}", "public void reproduce() {\n\t\tOrganism newOrg;\n\t\t\n\t\tfor (int i=0; i < Utils.between(_nChildren,1,8); i++) {\n\t\t\tnewOrg = new Organism(_world);\n\t\t\tif (newOrg.inherit(this, i==0)) {\n\t\t\t\t// It can be created\n\t\t\t\t_nTotalChildren++;\n\t\t\t\t_world.addOrganism(newOrg,this);\n\t\t\t\t_infectedGeneticCode = null;\n\t\t\t}\n\t\t\t_timeToReproduce = 20;\n\t\t}\n\t}", "private static void mating() {\n\t\tint getRand = 0;\n\t\tint parentA = 0;\n\t\tint parentB = 0;\n\t\tint newIndex1 = 0;\n\t\tint newIndex2 = 0;\n\t\tChromosome newChromo1 = null;\n\t\tChromosome newChromo2 = null;\n\n\t\tfor (int i = 0; i < OFFSPRING_PER_GENERATION; i++) {\n\t\t\tparentA = chooseParent();\n\t\t\t// Test probability of mating.\n\t\t\tgetRand = getRandomNumber(0, 100);\n\t\t\tif (getRand <= MATING_PROBABILITY * 100) {\n\t\t\t\tparentB = chooseParent(parentA);\n\t\t\t\tnewChromo1 = new Chromosome();\n\t\t\t\tnewChromo2 = new Chromosome();\n\t\t\t\tpopulation.add(newChromo1);\n\t\t\t\tnewIndex1 = population.indexOf(newChromo1);\n\t\t\t\tpopulation.add(newChromo2);\n\t\t\t\tnewIndex2 = population.indexOf(newChromo2);\n\n\t\t\t\t// Choose either, or both of these:\n\t\t\t\tpartiallyMappedCrossover(parentA, parentB, newIndex1, newIndex2);\n\t\t\t\t// positionBasedCrossover(parentA, parentB, newIndex1, newIndex2);\n\n\t\t\t\tif (childCount - 1 == nextMutation) {\n\t\t\t\t\texchangeMutation(newIndex1, 1);\n\t\t\t\t} else if (childCount == nextMutation) {\n\t\t\t\t\texchangeMutation(newIndex2, 1);\n\t\t\t\t}\n\n\t\t\t\tpopulation.get(newIndex1).computeConflicts();\n\t\t\t\tpopulation.get(newIndex2).computeConflicts();\n\n\t\t\t\tchildCount += 2;\n\n\t\t\t\t// Schedule next mutation.\n\t\t\t\tif (childCount % (int) Math.round(1.0 / MUTATION_RATE) == 0) {\n\t\t\t\t\tnextMutation = childCount + getRandomNumber(0, (int) Math.round(1.0 / MUTATION_RATE));\n\t\t\t\t}\n\t\t\t}\n\t\t} // i\n\t\treturn;\n\t}", "public void initializePopulation(){\n\t\t// create the population\n\t\tfor(int i = 0; i < POPULATION_SIZE; i++){\n\t\t\t// get a random length for the building sequence\n\t\t\tint randArraySize = randomGenerator.nextInt(possiblePieces.length-1)+1;\n\t\t\t\n\t\t\tBuildingPiece[] pieceSequence = new BuildingPiece[randArraySize];\n\t\t\tfor(int j = 0; j < randArraySize; j++){\n\t\t\t\t// get a random possible piece and insert it into the sequence\n\t\t\t\tint randIndex = randomGenerator.nextInt(possiblePieces.length);\n\t\t\t\tpieceSequence[j] = possiblePieces[randIndex];\n\t\t\t}\n\t\t\t\n\t\t\t/* add a new number sequence with the newly created \n\t\t\t * sequence from the input */\n\t\t\tpopulation.add(new Building(pieceSequence, generation, possiblePieces));\n\t\t}\n\t}", "private void crossover() {\r\n\r\n individual[] temp_pop = new individual[this.pop_size];\r\n\r\n for (int i = 0; i < pop_size; i++) { // go through population\r\n\r\n int a = new Random().nextInt(this.pop_size);\r\n int b = new Random().nextInt(this.pop_size);\r\n\r\n int split_point = new Random().nextInt(this.gene_size);\r\n\r\n float[] p1_genes = this.parent_population.getPopulation()[a].getGenes();\r\n float[] p2_genes = this.parent_population.getPopulation()[b].getGenes();\r\n\r\n float[] c1_genes = new float[gene_size];\r\n float[] c2_genes = new float[gene_size];\r\n\r\n for (int j = 0; j < gene_size; j++) {\r\n\r\n if (j < split_point) {\r\n c1_genes[j] = p1_genes[j];\r\n c2_genes[j] = p2_genes[j];\r\n } else {\r\n c2_genes[j] = p1_genes[j];\r\n c1_genes[j] = p2_genes[j];\r\n }\r\n }\r\n individual child1 = new individual(c1_genes, solutions, output);\r\n individual child2 = new individual(c2_genes, solutions, output);\r\n\r\n if (child1.getFitness() > child2.getFitness()) {\r\n temp_pop[i] = child1;\r\n } else {\r\n temp_pop[i] = child2;\r\n }\r\n }\r\n this.offspring_population.setPopulation(temp_pop);\r\n this.offspring_population.update_population();\r\n }", "public static void breedAll() {\n int a, b; //Pointers to select parents\n\n //While loop to ensure full carrying capacity of population\n while (Population.size() <= maxPop) {\n //Sorts by Fitness level first\n sortByFitlvl();\n\n //Selects Two Random Parents\n a = (int) (Math.abs(Utilities.sharpGauss(4)) * Population.size());\n b = (int) (Math.abs(Utilities.sharpGauss(4)) * Population.size());\n //System.out.println(a+\"\\t\"+b+\"\\t\"+Population.size());\n\n // Between 1-2 children\n int children = rand.nextInt(2)+1;\n for (int i = 0; i < children; i++) {\n Population.add(Breeder.breed(Population.get(a), Population.get(b), 0.1));\n }\n\n //sortByFitlvl();\n }\n\n if (debug)\n printPopulation(true);\n }", "private static ArrayList<Chromosome> evolvePopulation(ArrayList<Chromosome> currentGeneration, int populationSize,\n ArrayList<City> cities, int pathLength) {\n // declare a Set of Chromosomes which will store the Chromosomes that will be present in the next generation\n // ( i.e.the fittest )\n Set<Chromosome> nextGeneration = new HashSet<>();\n\n // add another set of nearest neighbour + randomly generated chromosomes to re-introduce diversity\n // and thus avoiding getting caught on local maxima\n currentGeneration.addAll(generatePopulation(cities, pathLength, populationSize));\n // calculate the fitness of all the Chromosomes in the population\n calculateFitnessOfPopulation(currentGeneration);\n // sort the population so that the chromosomes with the highest fitness are at the start of the list\n Collections.sort(currentGeneration);\n\n // keep adding chromosomes from the fittest of the currentGeneration until either the required population size is reached\n // or before an out of bounds occurs (i.e. not enough non-duplicate chromosomes\n int i = 0;\n while (nextGeneration.size() < populationSize && i < currentGeneration.size()) {\n nextGeneration.add(currentGeneration.get(i));\n i++;\n }\n\n // if the population size of the next generation is less than what it should be\n while (nextGeneration.size() < populationSize) {\n // keep adding an 'initial' population until it is of the required size\n nextGeneration.addAll(generatePopulation(cities, pathLength, populationSize-nextGeneration.size()));\n }\n\n return new ArrayList<>(nextGeneration);\n }", "public void cullPopulation(){\n\t\t// sort the population by the fitness function from low to high\n\t\tCollections.sort(population);\n\t\t\n\t\t// remove 10% of the weakest part of the population\n\t\tfor(int i = 0; i < (int)(POPULATION_SIZE*POPULATION_ACTION_PERCENT); i++){\n\t\t\tpopulation.remove(0);\n\t\t}\n\n\t}", "public Chromosome doInsertionMutation(){\n for(int i = 0; i < PopulationConfiguration.MUTATION_ATTEMPTS; i++){\n ArrayList<Boolean> newSelection = copyBoolArrayList(this.knapsackSelection);\n\n int allele1 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n int allele2 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n boolean value = newSelection.get(allele2);\n\n newSelection.remove(allele2);\n try{\n newSelection.add(allele1 + 1, value);\n }\n catch(IndexOutOfBoundsException e){\n newSelection.add(value);\n }\n \n Chromosome mutatedKnapsack = new Chromosome(newSelection).withFitnessCalculated();\n if(mutatedKnapsack.isValid())\n return mutatedKnapsack;\n }\n return this;\n }", "@Override\r\n\tpublic Population<BinaryStringChromosome> operate(\r\n\t\t\tPopulation<BinaryStringChromosome> population) {\n\t\tIterator<BinaryStringChromosome> iterator = population\r\n\t\t\t\t.getAllChromosomes().iterator();\r\n\t\tPopulation<BinaryStringChromosome> output = new Population<BinaryStringChromosome>();\r\n\t\tBinaryStringChromosome chromosome;\r\n\t\tRandom random = new Random(System.nanoTime());\r\n\t\twhile (iterator.hasNext()) {\r\n\t\t\tchromosome = iterator.next();\r\n\t\t\tif (random.nextDouble() < probability) {\r\n\t\t\t\tCommonGA.logger.info(\"Mutating chromosome \" + chromosome.toString());\r\n\t\t\t\tchromosome.mutateGene(random.nextInt(chromosome.getSize() - 1));\r\n\t\t\t\tCommonGA.logger.info(\"Mutated chromosome to \" + chromosome.toString());\r\n\t\t\t}\r\n\t\t\toutput.addChromosome(chromosome);\r\n\t\t}\r\n\t\treturn output;\r\n\t}", "public abstract Chromosome mutation(Chromosome child);", "private void mutate(float probability) {\r\n\r\n individual[] temp_pop = new individual[this.pop_size];\r\n\r\n for (int i = 0; i < this.pop_size; i++) {\r\n\r\n float temp_genes[] = this.offspring_population.getPopulation()[i].getGenes();\r\n\r\n // mutation can now mutate wild cards\r\n for (int j = 0; j < temp_genes.length; j++) {\r\n float k = new Random().nextFloat();\r\n\r\n if (k <= probability) {\r\n float temp = new Random().nextFloat();\r\n temp_genes[j] = temp; // add a float between 0-1 // just mutate a new float\r\n }\r\n }\r\n individual child = new individual(temp_genes, solutions, output);\r\n temp_pop[i] = child;\r\n }\r\n this.main_population.setPopulation(temp_pop);\r\n this.main_population.update_population();\r\n }", "public static void genocide() {\n //Assigns fitness levels\n evaluateFitnesses();\n\n //Sorts by fitness\n sortByFitlvl();\n\n //Simple genocide, kills off all until population size.\n for (int i = Population.size() - 1; i >= populationSize; i--) {\n Population.remove(i);\n }\n\n /*\n //Different kind of Genocide, selects organisms based on gaussian distribution\n\n while(Population.size() > populationSize){\n int randomOrganism = (int)(Population.size() - (Population.size()*Utilities.sharpGauss(2)));\n Population.remove(randomOrganism);\n }\n */\n }", "public void createSelectedPopulation(Population previousPopulation, int populationSize, double perc) {\n\t\t\n\t\tint intendedSize = (int)(populationSize * perc/100);\n\t\tSystem.out.println(\"intended size: \" + intendedSize ) ;\n\t\tint currentSize = 0;\n\t\tint randomPopulationSize;\n\t\tSolution mutant;\n\t\tList<ArrayList<String>> added = new ArrayList<ArrayList<String>>();\n\n\t\t\n\t\t//copy solutions from the previous population until the cloning factor is bigger than 1\n\t\tfor(Solution solution : previousPopulation.getPopulation()) {\n\t\t\tif(solution.getCloningFactor() < 1.0) break;\n\t\t\t\n\t\t\t//add as many clones of the current solution\n\t\t\t//as indicates the cloning factor\n\t\t\t//eg. if cloning factor is 2 -> 3 copies of this solution will go to the next population\n\t\t\tfor(int i = 0; i <= (int) solution.getCloningFactor(); i++) {\n\t\t\t\t//if we get a complete population by cloning the solution from the previous population\n\t\t\t\t//leave the method\n\t\t\t\tif(currentSize == intendedSize) break;\n\t\t\t\t\n\t\t\t\t//we create a mutation of each clone\n\t\t\t\t//if mutation is less efficient or already exists in the population we discard it\n\t\t\t\tmutant = new Solution(solution.getFrequencyRelations(), solution.getCabinets());\n\t\t\t\tArrayList<String> mutantSol = solution.mutate();\n\t\t\t\tmutant.setPossibleSolution(mutantSol);\n\t\t\t\tmutant.setPath(mutant.countPath(mutant.getPossibleSolution()));\n\t\t\t\t\n\t\t\t\t//System.out.println(\"M: \" + mutantSol + \" \" + mutant.getPath() );\n\t\t\t//\tSystem.out.println(\"S: \" + solution.getPossibleSolution() + \" \" + solution.getPath() );\n\n\n\t\t\t\tif(mutant.getPath() >= solution.getPath() || added.contains(mutant.getPossibleSolution()) ) {\n\t\t\t\t\tpopulation.add(solution);\n\t\t\t\t\tadded.add(solution.getPossibleSolution());\n\t\t\t\t\t//System.out.println(\"original\");\n\t\t\t\t}else {\n\t\t\t\t\tpopulation.add(mutant);\n\t\t\t\t\tadded.add(mutant.getPossibleSolution());\n\t\t\t\t\t//System.out.println(\"mutant\");\n\t\t\t\t}\n\t\t\t\n\t\t\t\tcurrentSize++;\n\t\t\t}\n\t\t}\n\t\t\n\t\t//count the number of random solutions that should be added\n\t\tif(currentSize <= populationSize) {\n\t\t\t randomPopulationSize = populationSize - currentSize;\n\t\t}else return;\n\t\t\n\t\t//create random solutions and add them to the population \n\t\t//until the wished size is reached\n\t\tcreateRandomPopulation(previousPopulation.getCabinetArrangement(), randomPopulationSize);\n\t\t\t\n\t}", "@Override\n public void migrate(OccupiedLocations ols) {\n for (Population pop:ols.copyList()) {\n setCoordinate(pop.getCoordinate());\n\n Population migrating_pop = pop.collectMigrants(getRate());\n if (migrating_pop.getSize() > 0) {\n migrating_pop.setCoordinate(getPicker().pick());\n migrating_pop.setResource(0.0);\n\n // alter *actual* populations\n ols.addOrMix(migrating_pop);\n }\n }\n }", "private static Set<Chromosome> crossoverPopulation(ArrayList<Chromosome> population, int populationSize, int crossoverSize) {\n\n // declare a set of chromosomes which will store all thr chromosomes generated by the crossover operation\n Set<Chromosome> crossoverChromosomes = new HashSet<>();\n\n while (crossoverChromosomes.size() < crossoverSize) {\n // retrieve a set of chromosomes (of size 2) on which crossover will occur\n // using the Rank-Based Roulette Wheel Selection method\n Set<Chromosome> selectedChromosomes = rankBasedRouletteWheelSelection(population, populationSize);\n\n // store the 2 Chromosomes in parent 1 and parent 2\n Chromosome parent1 = selectedChromosomes.iterator().next();\n selectedChromosomes.remove(parent1);\n Chromosome parent2 = selectedChromosomes.iterator().next();\n\n // perform crossover using the crossoverChromosomes method\n // the method is called twice, switching the order of the parents for the second time, since SCX produces only\n // one child, however produces a different child when the parents are switched\n crossoverChromosomes.add(crossover(parent1, parent2));\n crossoverChromosomes.add(crossover(parent2, parent1));\n }\n\n return crossoverChromosomes;\n }", "private void mutation() {\n\t\tfor (int i = 0; i < 4; i++) {\n\t\t\tint num = (int) (Math.random() * GENE * ChrNum + 1);\n\t\t\tint chromosomeNum = (int) (num / GENE) + 1;\n\n\t\t\tint mutationNum = num - (chromosomeNum - 1) * GENE; \n\t\t\tif (mutationNum == 0) \n\t\t\t\tmutationNum = 1;\n\t\t\tchromosomeNum = chromosomeNum - 1;\n\t\t\tif (chromosomeNum >= ChrNum)\n\t\t\t\tchromosomeNum = 9;\n\t\t\tString temp;\n\t\t\tString a; \n\t\t\tif (ipop[chromosomeNum].charAt(mutationNum - 1) == '0') { \n a = \"1\";\n\t\t\t} else { \n\t\t\t\ta = \"0\";\n\t\t\t}\n\t\t\t\n\t\t\tif (mutationNum == 1) {\n\t\t\t\ttemp = a + ipop[chromosomeNum].substring(mutationNum);\n\t\t\t} else {\n\t\t\t\tif (mutationNum != GENE) {\n\t\t\t\t\ttemp = ipop[chromosomeNum].substring(0, mutationNum -1) + a \n\t\t\t\t\t\t\t+ ipop[chromosomeNum].substring(mutationNum);\n\t\t\t\t} else {\n\t\t\t\t\ttemp = ipop[chromosomeNum].substring(0, mutationNum - 1) + a;\n\t\t\t\t}\n\t\t\t}\n \tipop[chromosomeNum] = temp;\n\t\t}\n\t}", "private void sortPopulation() {\n println(\"sortPopulation()\", 1);\n //population_size = population.size();\n for(int i = 1; i < population_size; i++) {\n \n //current is the one we're going to put in the right place\n Individual current = population[i];\n double current_fitness = current.getFitness();\n \n //Test to see if current's fitness is better than the previous one; if so, then it's out of order\n double last_fitness = population[i - 1].getFitness();\n \n //if(current_fitness < last_fitness) {\n if(population[i].isLessThan(population[i - 1])) {\n \n println(population[i].getFitness() + \" < \" + population[i - 1].getFitness(), 5);\n //Now, search from the beginning to see where it goes\n int j = 0;\n //System.out.print(\"j = \" + Integer.toString(j) + \" \");\n //while(current_fitness >= population[j].getFitness() && j < population_size - 1) {\n while(population[j].isLessThanOrEqual(population[i]) && j < population_size - 1) {\n j++;\n //System.out.print(\"j = \" + Integer.toString(j) + \" \");\n }\n //We've found the correct place\n Individual temp = new Individual();\n temp = population[i];\n for(int q = i; q > j; q--) {\n population[q] = population[q - 1];\n //System.out.print(\"q = \" + Integer.toString(q) + \" \");\n }\n population[j] = temp;\n }\n }\n }", "public static List<Heuristic> nextGeneration(List<Heuristic> parents, int populationSize, double mutationProb) {\n\t\tif(parents.size() % 2 != 0 || parents.size() < 2)\n\t\t\tthrow new IllegalArgumentException(\"Must be an even number of parents\");\n\t\t\t\t\n\t\tList<Heuristic> ret = new ArrayList<>();\n\t\t\n\t\tfor(Heuristic par : parents)\n\t\t\tret.add(par.copy());\n\t\t\n\t\tfor(int i=0; i<parents.size(); i+=2) {\n\t\t\tList<Heuristic> children = parents.get(i).crossover(parents.get(i+1));\n\t\t\t\n\t\t\tfor(Heuristic child : children)\n\t\t\t\tret.add(child.copy());\n\t\t\t\n\t\t\twhile(ret.size() < (i+2)/parents.size() * populationSize)\n\t\t\t\tfor(Heuristic child : children) {\n\t\t\t\t\tret.add(child.copy().mutate(mutationProb));\n\t\t\t\t\tif(ret.size() == populationSize) return ret;\n\t\t\t\t}\n\t\t}\n\t\t\n\t\treturn ret;\n\t}", "private static ArrayList<Chromosome> generatePopulation(ArrayList<City> cities, int pathLength, int populationSize) {\n // generating part of the initial population using a Nearest Neighbour Algorithm\n int nnPopulationSize = (int) (0.1*populationSize);\n // if the required number of chromosomes to be generated by the NN Algorithm is greater then the number of cities\n // then set the required number of chromosomes to the number of cities\n if (nnPopulationSize > cities.size()) {\n nnPopulationSize = cities.size();\n }\n ArrayList<Chromosome> nnPopulation = generateNearestNeighbourPopulation(pathLength, nnPopulationSize);\n\n // generating the rest of the initial population randomly\n int randomPopulationSize = populationSize - nnPopulationSize;\n ArrayList<Chromosome> randomPopulation = new ArrayList<>();\n randomPopulation.addAll( generateRandomPopulation(pathLength, randomPopulationSize) );\n\n // Combining the 2 parts of the population into one initial population\n ArrayList<Chromosome> population = new ArrayList<>();\n population.addAll(nnPopulation);\n population.addAll(randomPopulation);\n\n return population;\n }", "@Override\n\tpublic Population evolvePopulation(Population pop) {\n\t\tSortingIndividual baseIndiv = (SortingIndividual) pop.individuals[0];\n\t\tPopulation newPopulation = new SortingPopulation(pop.size(), baseIndiv.getBase(), false);\n\t\n\t\t// Keep our best individual\n\t\tif (elitism) {\n\t\t\tnewPopulation.saveIndividual(0, pop.getFittest());\n\t\t}\n\n\t\t// Crossover population\n\t\tint elitismOffset;\n\t\tif (elitism) {\n\t\t\telitismOffset = 1;\n\t\t} else {\n\t\t\telitismOffset = 0;\n\t\t}\n\t\t// Loop over the population size and create new individuals with\n\t\t// crossover\n\t\tfor (int i = elitismOffset; i < pop.size(); i++) {\n\t\t\tIndividual indiv1 = tournamentSelection(pop);\n\t\t\tIndividual indiv2 = tournamentSelection(pop);\n\t\t\tIndividual newIndiv = crossover(indiv1, indiv2);\n\t\t\tnewPopulation.saveIndividual(i, newIndiv);\n\t\t}\n\n\t\t// Mutate population\n\t\tfor (int i = elitismOffset; i < newPopulation.size(); i++) {\n\t\t\tmutate(newPopulation.getIndividual(i));\n\t\t}\n\n\t\treturn newPopulation;\n\t}", "private Vector step(){\n// System.out.println();\n// System.out.println(generationCount);\n// System.out.println(\"The Population is:\");\n// System.out.println(population);\n \n //DETERMINE WHO SURVIVES INTO NEXT GENERATION\n Vector nextGeneration = surviveType.run(population, fitnessArray);\n\n //DO THE CROSSOVER PROCESS\n //WHILE THE NEXT GENERATION ISN'T FULL\n while (nextGeneration.size() < (populationSize - randGenes)){\n //FIND PARENTS\n Gene parentOne, parentTwo;\n do {\n Gene[] parents = selectType.run(population, fitnessArray);\n parentOne = parents[0];\n parentTwo = parents[1];\n } while (selectPairs && (! closeEnough(parentOne, parentTwo)));\n //ADD CHILDREN\n Gene[] kids = crossType.children(parentOne, parentTwo);\n\n nextGeneration.add(kids[0]);\n if (nextGeneration.size() < (populationSize - randGenes)){\n nextGeneration.add(kids[1]);\n }\n }\n //ADD RANDOM GENES TO THE POPULATION\n while (nextGeneration.size() < populationSize){\n nextGeneration.add(initializer.createRandomGene(fitnessFunction, minRadius, maxRadius));\n }\n //MUTATE THE NEXT GENERATION\n for (int j = 0; j < populationSize; j++){\n if (Math.random() < mutationProb){\n nextGeneration.set(j, mutationType.run((Gene) nextGeneration.get(j)));\n }\n }\n\n //COMPUTE FITNESSES AND RELOCATE IF NECESSARY\n Gene bestGene = (Gene) nextGeneration.get(0);\n int bestX = 0;\n for (int x = 0; x < populationSize; x++){\n Gene next = (Gene) nextGeneration.get(x);\n while (relocationType.move(bannedList, next)){\n Gene newGene = initializer.createRandomGene(fitnessFunction, minRadius, maxRadius);\n next = newGene;\n nextGeneration.set(x, next);\n }\n fitnessArray[x] = next.getFitness();\n\n //FOR THE PURPOSES OF UPDATING THE BANNED LIST\n if (next.getFitness() > bestGene.getFitness()){\n bestGene = next;\n bestX = x;\n }\n } //End for (int x = 0;...\n\n Arrays.sort(fitnessArray);\n\n //UPDATE THE BANNED LIST BY ADDING THE BEST GENE IN THE NEXT GENERATION IF IT'S ABOVE minAccepted AND CONTAINS MORE THAN minPoints POINTS\n if (useList){\n if ((generationCount >= firstAdd) &&\n (solutionCounter >= countNum) &&\n (bestGene.getFitness() >= minAccepted) &&\n (bestGene.getCount() >= minPoints)){\n solutionCounter = 0;\n// System.out.println(bestGene);\n Gene bestClone = new Gene (bestGene.getMajorAxisRadius(), //THIS KLUDGE IS DONE B/C .clone() IS\n bestGene.getMinorAxisRadius(), //PROTECTED, AND I CAN'T UNPROTECT IT.\n bestGene.getX(), //I USE A CLONED GENE TO PREVENT A MUTATION\n bestGene.getY(), //IN THE NEXT GENERATION FROM ALTERING bannedList\n bestGene.getOrientation(),\n bestGene.getFunction());\n bannedList = relocationType.updateBannedList(bannedList, bestClone);\n\n\n //IF NECESSARY, UPDATE THE SOLUTION LIST BY ADDING ALL CLUSTERS WITH MORE THAN minPoints POINTS AND A FITNESS OF AT LEAST minAccepted\n if (returnAllSolutions){\n for (int i = 0; i < populationSize; i++){\n Gene next = (Gene) nextGeneration.get(i);\n if ((next.getFitness() >= minAccepted) && (next.getCount() >= minPoints)){\n solutionList.add(next);\n }\n }//End for (int i = 0...\n } else {\n solutionList = bannedList;\n } //End if (returnAllSolutions){...}else{\n } //End if (generationCount > 4...\n } //End if (useList){\n\n generationCount = generationCount + 1;\n solutionCounter = solutionCounter + 1;\n\n //IF AVOIDING CONVERGENCE, AND IT HAS CONVERGED, START OVER WITH RANDOM GENES\n\n double bestFitness = bestGene.getFitness();\n double medianFitness = roundToHundredths((double) fitnessArray[(int) Math.floor(populationSize / 2)]);\n\n// System.out.println(bestFitness);\n// System.out.println(medianFitness);\n\n if ((antiConvergence) &&\n ((bestFitness - medianFitness) < (0.01 * bestFitness)) &&\n (generationCount > firstAdd)){\n nextGeneration = initializer.getGenes(populationSize, fitnessFunction, minRadius, maxRadius);\n// System.out.println(\"EXPLODED CONVERGENCE!\");\n for (int x = 0; x < populationSize; x++){\n Gene next = (Gene) nextGeneration.get(x);\n fitnessArray[x] = next.getFitness();\n }\n Arrays.sort(fitnessArray);\n }\n\n return nextGeneration;\n }", "private static void remakeMap(HashMap<String, ArrayList<Critter>> population)\r\n {\r\n \t//get a copy of the hash map\r\n \tHashMap<String, ArrayList<Critter>> copy = new HashMap<String, ArrayList<Critter>>(population);\r\n \t//clear the original hash map\r\n \tpopulation.clear();\r\n \t\r\n \t//iterates through all of the critters in the copy of the hash map\r\n \tIterator<String> populationIter = copy.keySet().iterator();\r\n \t\r\n \twhile (populationIter.hasNext()) { \r\n \t\t\r\n \t\t//get the String position\r\n String pos = populationIter.next();\r\n \r\n //get the critter list in that position\r\n ArrayList<Critter> critterList = copy.get(pos);\r\n \r\n //Iterate through the critters ArrayList \r\n ListIterator<Critter> currCritter = critterList.listIterator();\r\n while(currCritter.hasNext()) {\r\n \tCritter thisCritter = currCritter.next();\r\n \t//get the new coordinates of the critter\r\n \tString critterKey = thisCritter.getCritterPosition();\r\n \t\r\n \t//if the position is already a key in the hash map\r\n \tif(population.containsKey(critterKey)) {\r\n \t\t//add the critter to the ArrayList at key of coordinates\r\n \t\tArrayList<Critter> list = population.get(critterKey);\r\n \t\tlist.add(thisCritter);\r\n \t\tpopulation.replace(critterKey, list);\r\n \t}\r\n \r\n \t//if position is not already a key in the hash map\r\n \telse {\r\n \t\tArrayList<Critter> newCritters = new ArrayList<Critter>();\r\n \t\tnewCritters.add(thisCritter);\r\n \t\tpopulation.put(critterKey, newCritters);\r\n \t}\r\n }\r\n \t}\r\n }", "private void initializePopulation() {\n // reset the population\n population = new ArrayList<Genotype>();\n\n // set the population to an array of random genotypes\n for (int i = 0; i < populationSize; i++) {\n population.add(new Genotype(chromosomeSize));\n }\n\n // evaluate the population\n // evaluatePopulation();\n }", "private void mutate() {\n\t\tfor (int i = 0; i < population; ++i) {\n\t\t\tpopulationArray.set(i, populationArray.get(i).generateNeighbor());\n\t\t}\n\t}", "public void setPopulation(int population) {\n this.population = population;\n }", "public static void makeGrid (Species map[][], int numSheepStart, int numWolfStart, int numPlantStart, int sheepHealth, int plantHealth, int wolfHealth, int plantSpawnRate) {\n \n // Declare coordinates to randomly spawn species\n int y = 0;\n int x = 0;\n \n // Initialise plants\n Plant plant;\n \n // Spawn plants\n for (int i = 0; i < numPlantStart; i++) {\n \n // Choose random coordinates to spawn\n y = (int)(Math.random() * map[0].length); \n x = (int)(Math.random() * map.length);\n \n // Checks for an empty space\n if (map[y][x] == null) { \n \n // Choose a random plant (50% chance healthy, 25% poisonous or energizing)\n int plantChoice = (int) Math.ceil(Math.random() * 100);\n \n // Create the new plants\n if ((plantChoice <= 100) && (plantChoice >= 50)) {\n plant = new HealthyPlant(plantHealth, x, y, plantSpawnRate);\n } else if ((plantChoice < 50) && (plantChoice >= 25)) {\n plant = new EnergizingPlant(plantHealth, x, y, plantSpawnRate);\n } else {\n plant = new PoisonousPlant(plantHealth, x, y, plantSpawnRate);\n }\n \n // Set plant coordinates\n plant.setX(x);\n plant.setY(y);\n map[y][x] = plant;\n \n // No space\n } else { \n i -= 1;\n }\n \n }\n \n // Spawn sheep\n for (int i = 0; i < numSheepStart; i++) { \n \n // Choose random coordinates to spawn\n y = (int)(Math.random() * map[0].length); \n x = (int)(Math.random() * map.length);\n \n // Checks for an empty space\n if (map[y][x] == null) {\n \n // Create new sheep\n Sheep sheep = new Sheep(sheepHealth, x, y, 5); \n \n // Set sheep coordinates\n sheep.setX(x);\n sheep.setY(y);\n map[y][x] = sheep;\n \n // No space\n } else { \n i -= 1; \n }\n \n }\n \n // Spawn wolves\n for (int i = 0; i < numWolfStart; i++) { \n \n // Choose random coordinates to spawn\n y = (int)(Math.random() * map[0].length); \n x = (int)(Math.random() * map.length);\n \n // Checks for an empty space\n if (map[y][x] == null) { \n \n // Create new wolf\n Wolf wolf = new Wolf(wolfHealth, x, y, 5); \n \n // Set wolf coordinates\n wolf.setX(x);\n wolf.setY(y);\n map[y][x] = wolf; \n \n // No space\n } else { \n i -= 1; \n }\n }\n \n }", "public void createRandomPopulation(List<String> cabinetArrangement, int populationSize){\n\t\t\n\t\tint size = 0;\n\t\t\n\t\t//list to check if the current solution\n\t\t//has been already added to the population \n\t\t\n\t\tList<ArrayList<String>> added = new ArrayList<ArrayList<String>>();\n\t\t\n\t\t//create a new solution object\n\t\tSolution solution = new Solution(relations, cabinetArrangement);\n\t\t//assign a cabinet arrangement to it, which is a possible solution\n\t\tsolution.cabinetArrangement(new ArrayList<>(solution.getCabinets()), new ArrayList<String>());\n\n\t\twhile(size < populationSize) {\n\t\t\t\t\n\t\t\t\t//continue, if the solution is already in the population\n\t\t\t\tif(added.contains(solution.getPossibleSolution())) {\n\t\t\t\t\tsolution = new Solution(relations, cabinetArrangement);\n\t\t\t\t\tsolution.cabinetArrangement(new ArrayList<>(solution.getCabinets()), new ArrayList<String>());\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tsize++;\n\t\t\t\n\t\t\t\t//add solution to the population\n\t\t\t\tpopulation.add(solution);\n\t\t\t\t//and to the control list\n\t\t\t\tadded.add(solution.getPossibleSolution());\n\t\t\t\t\n\t\t\t\tsolution = new Solution(relations, cabinetArrangement);\n\t\t\t\tsolution.cabinetArrangement(new ArrayList<>(solution.getCabinets()), new ArrayList<String>());\n\n\t\t}\n\t\t\n\t\tif(size == populationSize) {\n\t\t\t//count the average path when the population is already created\n\t\t\tcountAveragePath();\n\t\t\t\n\t\t\t//count and assign a cloning factor for all the solutions\n\t\t\tcloningFactor();\n\t\t}\n\t}", "private PMCGenotype[] advanceGeneration()\n\t{\n\t\tPMCGenotype[] newPop = new PMCGenotype[population.length];\n\t\tPMCGenotype[] parents = selectParents();\n\t\tArrayList<PMCGenotype> candidates = new ArrayList<PMCGenotype>();\n\n\t\t// Add the current population to the list of candidates.\n\t\tfor (PMCGenotype pmcg : population)\n\t\t{\n\t\t\tcandidates.add(pmcg);\n\t\t}\n\n\t\t// For each parent, generate a number of mutations (children), calculate their fitness\n\t\t// and add them to the list of candidates.\n\t\tint childrenPerParent = this.childrenPerGeneration / this.parentsToSelect;\n\t\tfor (PMCGenotype p : parents)\n\t\t{\n\t\t\tfor (int i = 0; i < childrenPerParent; i++)\n\t\t\t{\n\t\t\t\tPMCGenotype pmcg = PMCGenotype.mutate(p, r);\n\t\t\t\tpmcg.setFitness(fitness(pmcg, this.trials));\n\t\t\t\tcandidates.add(pmcg);\n\t\t\t}\n\t\t}\n\n\t\t// Find candidate with the best fitness and add it to the new population.\n\t\t// Repeat this until the new population size matches the previous population size.\n\t\tint candidatesChosen = 0;\n\t\twhile (candidatesChosen < this.population.length)\n\t\t{\n\t\t\tint numberOfRemainingCandidates = candidates.size();\n\t\t\tdouble currentBestFitnessScore = 0;\n\t\t\tint currentBestFitnessScoreIndex = 0;\n\n\t\t\tfor (int i = 0; i < numberOfRemainingCandidates; i++)\n\t\t\t{\n\t\t\t\tPMCGenotype pmcg = candidates.get(i);\n\t\t\t\tif (pmcg.getFitness() > currentBestFitnessScore)\n\t\t\t\t{\n\t\t\t\t\tcurrentBestFitnessScore = pmcg.getFitness();\n\t\t\t\t\tcurrentBestFitnessScoreIndex = i;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnewPop[candidatesChosen] = candidates.get(currentBestFitnessScoreIndex);\n\t\t\tcandidatesChosen++;\n\n\t\t\tcandidates.remove(currentBestFitnessScoreIndex);\n\t\t}\n\n\t\treturn newPop;\n\t}", "private static ArrayList<Chromosome> generateNearestNeighbourPopulation(int pathLength, int nnPopulationSize){\n // declaring the arraylist of chromosomes which will store the\n ArrayList<Chromosome> nnPopualtion = new ArrayList<>();\n\n // declaring a set which will contain all the starting cities that will be used for the population\n Set<Integer> startingCities = new HashSet<>();\n // initialising the set of startingCities with random cities. It being a set no duplicates are allowed\n while (startingCities.size() < nnPopulationSize) {\n startingCities.add(ThreadLocalRandom.current().nextInt(0, pathLength));\n }\n\n // An ArrayList with all the cityIDs which can be copied to keep track of visited/unvisited cities\n ArrayList<Integer> cities = new ArrayList<>();\n for (int i = 0; i < pathLength; i++) {\n cities.add(i);\n }\n\n // for every starting city\n for (Integer startingCity : startingCities) {\n // set the currentCity as the Starting City\n int currentCity = startingCity;\n // Declare a new chromosome to store this new path\n Chromosome chromosome = new Chromosome(pathLength);\n // Set the first city in the path as the startingCity\n chromosome.path[0] = startingCity;\n\n // Declare a new Set of unvisitedCities, and initialise it as a copy of the ArrayList of cityIDs\n Set<Integer> unvisitedCities = new HashSet<>(cities);\n // remove the startingCity from the set of unvisitedCities\n unvisitedCities.remove(startingCity);\n\n // for the length of the path\n for (int i = 1; i < pathLength; i++) {\n // initially set the closestCity to a random city from the set of unvisitedCities\n int closestCity = unvisitedCities.iterator().next();\n // loop through every unvisitedCity to find the closestCity\n for (Integer city : unvisitedCities) {\n // if the distance between the currentCity and the unvisitedCity is < the distance between\n // the currentCity and the closestCity\n if (distanceMatrix[currentCity][city] < distanceMatrix[currentCity][closestCity]) {\n // set thet unvisitedCity as the closestCity\n closestCity = city;\n }\n }\n // add the closestCity as the next city in the path\n chromosome.path[i] = closestCity;\n // make the currentCity for the next iteration the current closestCity\n currentCity = closestCity;\n // remove the closestCity from the set of unvisitedCities\n unvisitedCities.remove(closestCity);\n }\n\n // add the generated chromosome to the ArrayList of the initial nnPopulation\n nnPopualtion.add(chromosome);\n }\n\n return nnPopualtion;\n }", "public void setPopulation(int population) {\n\n this.population = population;\n }", "public void Populate(int bombs) {\n\t\tint row = 0,col = 0,randnumber = 0;\n\t\tRandom rnd = new Random();\n\t\t\n\t\t// array list of every position on grid\n\t\tcoordinate = new ArrayList<Integer>(height*width);\n\t\tfor(int i = 0;i<height*width;i++) {\n\t\t\tcoordinate.add(i);\n\t\t}\n\t\t\n\t\tfor(int i = 0;i<bombs;i++) {\n\t\t\t// randomly chooses a position to put a bomb in\n\t\t\trandnumber = rnd.nextInt(coordinate.size());\n\t\t\tbomblocate[i] = coordinate.get(randnumber);\n\t\t\trow = coordinate.get(randnumber)/width;\n\t\t\tcol = coordinate.get(randnumber)%width;\n\t\t\tgrid[row][col] = 9;\n\t\t\t\n\t\t\tUpdateSurround(row,col);\n\t\t\t\n\t\t\t// removes the possible position from array list\n\t\t\tcoordinate.remove(randnumber);\n\t\t}\n\t}", "public static void mutate(Chromosome chrome) {\n \n // Loop through tour cities\n for(int rosterNursePos1=0; rosterNursePos1 < chrome.ChromosomeRowSize(); rosterNursePos1++){\n for (int rosterDayPos1=0; rosterDayPos1<chrome.chromosomeColumnCount();rosterDayPos1++){\n if(RosterManager.isPreviousShift(chrome.getShift(rosterNursePos1, rosterDayPos1))==false || RosterManager.isNextShift(chrome.getShift(rosterNursePos1, rosterDayPos1))==false || chrome.getShift(rosterNursePos1, rosterDayPos1).getHours()!=0 ){\n if(Math.random() < mutationRate){\n // Get a second random position in the tour\n int rosterNursePos2= rosterNursePos1;\n int rosterDayPos2 = returnValidPos(rosterNursePos2, randomizeShiftGeneration(chrome), chrome );\n\n // Get the cities at target position in tour\n Gene gene1 = chrome.retrieveGene(rosterNursePos1, rosterDayPos1);\n Gene gene2 = chrome.retrieveGene(rosterNursePos2, rosterDayPos2);\n\n // Swap them around\n chrome.saveGene(rosterNursePos1, rosterDayPos1, gene2);\n chrome.saveGene(rosterNursePos2, rosterDayPos2, gene1);\n \n }\n \n \n } \n // Apply mutation rate\n \n }\n \n }\n \n \n }", "@Override\n\tpublic void setStartPopulation(List<BitString> seedPopulation) {\n\t\t\n\t}", "public void setpopulation(int population) {\n this.population = population;\n }", "private void createInitialPopulation() throws InterruptedException, TimeoutException {\n\n\t\tProteinDatabase ident = new ProteinDatabase();\n\t\tident.parseInput(\"proteins.fasta\");\n\t\tList<Protein> database = ident.getDatabase();\n\n\t\tfor (Protein data : database) {\n\t\t\tdata.setExperimental(es);\n\t\t}\n\n\t\tList<Protein> candidates = new ArrayList<Protein>();\n\t\tfor (Protein p : database)\n\t\t{\n\t\t\tTheoreticalSpectrum theoreticalSpectrum = new TheoreticalSpectrum(p.getAminoAcidsequence());\n\t\t\tif (Math.abs(parentMass - theoreticalSpectrum.getParentMass()) <= parentMassThreshold) {\n\t\t\t\tcandidates.add(p);\n\t\t\t}\n\t\t}\n\n\t\trunInitialFitnessCalculations(candidates);\n\n\t\tCollections.sort(candidates, new ProteinFitnessComparator());\n\t\tdebug(candidates, 0);\n\n\n\t\tpopulation = new ArrayList<Protein>(populationSize);\n\n\t\tpopulationActualSize = 0;\n\t\tfor (Protein p : candidates)\n\t\t{\n\t\t\tpopulation.add(p);\n\t\t\tpopulationActualSize++;\n\t\t\tif (populationActualSize == populationSize)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "public static void generatePopulation() {\n population = setupArray(POP_SIZE, NUM_RULES, GENE_SIZE, COND_LEN);\n\n for (Individual individual : population) {\n for (int i = 0; i < individual.getGene().length; i++) {\n individual.gene[i] = bits.get(new Random().nextInt(2));\n }\n individual.generateRulebase();\n }\n }", "public void setPop(ArrayList<Bacteria> newPop){\n inds = newPop;\n }", "@SuppressWarnings(\"unchecked\")\r\n\t@Override\r\n\tpublic void mutation() {\r\n\t\tfinal double MUTATION_PROB = 0.1;\r\n\t\tfor (int i=0; i<this.nChromosomes; i++) {\r\n\t\t\tArrayList<Integer> chr = (ArrayList<Integer>) this.chromosomes.get(i);\r\n\t\t\tfor (int j=0; j<this.nViaPoints; j++) {\r\n\t\t\t\tdouble rand = Math.random();\r\n\t\t\t\tif (rand < MUTATION_PROB) {\r\n\t\t\t\t\t// change the sign\r\n\t\t\t\t\tInteger vPoint = chr.get(j);\r\n\t\t\t\t\tchr.remove(j);\r\n\t\t\t\t\tchr.add(j, new Integer(- (vPoint.intValue()%100)));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.printChromosomes(\"After Mutation\");\r\n\t}", "private void removeInvalidFromPool()\r\n\t{\r\n\t\tint i;\r\n\t\tint size_mature_pool;\r\n\t\tint idx_1st_oldest;//index of the oldest individual\r\n\t\tint idx_2nd_oldest;//index of the 2nd oldest individual\r\n\t\tint idx_to_remove;//index of an chromosome which has to be removed\r\n\t\tint idx_current;//index of currently checked genotype\r\n\t\tint num_errors;//number of errors of the current chromosome\r\n\t\tint max_num_errors;//maximum numbers of stored errors among checked chromosomes\r\n\t\tdouble error_1st_oldest;//average error of the oldest individual\r\n\t\tdouble error_2nd_oldest;//average error of the 2nd oldest individual\r\n\t\tdouble max_error;//largest error among the oldest individuals\r\n\t\tVector<Integer> idx_oldest;//indices of all chromosomes with a life span larger than a predefined threshold\r\n\t\t\r\n\t\tsize_mature_pool = _pool_of_bests.size();\r\n\t\t\r\n\t\t//if the maturity pool is full and none of the genotypes could be removed above because of module outputs\r\n\t\t//then remove one of the oldest individuals according to the errors\r\n\t\tif(_pool_of_bests.size()==_size_pool_of_bests)\r\n\t\t{\r\n\t\t\tidx_oldest = new Vector<Integer>(0, 1);\r\n\t\t\t\r\n\t\t\t//find all oldest genotypes\r\n\t\t\tfor(i=0; i<size_mature_pool; i++)\r\n\t\t\t{\r\n\t\t\t\tnum_errors = _pool_of_bests.get(i)._error.all_single_squares.size();\r\n\t\t\t\tif(num_errors>=_min_life_span)\r\n\t\t\t\t{\r\n\t\t\t\t\tidx_oldest.add(i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t//1) find the worst oldest gentypes with a span above a threshold\r\n\t\t\t//2) do not remove a single genotype without comparison;\r\n\t\t\t// it could have very high performance\r\n\t\t\tif(idx_oldest.size() > 1)\r\n\t\t\t{\r\n\t\t\t\tidx_to_remove = idx_oldest.get(0);\r\n\t\t\t\tmax_error = _pool_of_bests.get(idx_to_remove)._error.getAverageError();\r\n\t\t\t\tfor(i=idx_to_remove+1; i<idx_oldest.size(); i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tidx_current = idx_oldest.get(i);\r\n\t\t\t\t\tif(max_error < _pool_of_bests.get(idx_current)._error.getAverageError())\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tidx_to_remove = idx_current;\r\n\t\t\t\t\t\tmax_error = _pool_of_bests.get(idx_to_remove)._error.getAverageError();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse//remove the worst of two oldest genotypes if none of genotypes had span above the threshold\r\n\t\t\t{\r\n\t\t\t\t//find the oldest and 2nd oldest individuals\r\n\t\t\t\tidx_1st_oldest = -1;\r\n\t\t\t\tmax_num_errors = 0;\r\n\t\t\t\tfor(i=0; i<size_mature_pool; i++)\r\n\t\t\t\t{\r\n\t\t\t\t\t//\"[0]\" because the number of errors is equal for all sub-individuals of the same individual\r\n\t\t\t\t\tnum_errors = _pool_of_bests.get(i)._error.all_single_squares.size();\r\n\t\t\t\t\tif(max_num_errors < num_errors)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tmax_num_errors = num_errors;\r\n\t\t\t\t\t\tidx_1st_oldest = i;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t//find the 2nd oldest individuals\r\n\t\t\t\tidx_2nd_oldest = -1;\r\n\t\t\t\tif(size_mature_pool > 1)//the 2nd oldest individual exists if there are 2 or more individuals\r\n\t\t\t\t{\r\n\t\t\t\t\tmax_num_errors = 0;\r\n\t\t\t\t\tfor(i=0; i<size_mature_pool; i++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(i!=idx_1st_oldest)//the oldest individual should be ignored\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t//\"[0]\" because the number of errors is equal for all sub-individuals of the same individual\r\n\t\t\t\t\t\t\tnum_errors = _pool_of_bests.get(i)._error.all_single_squares.size();\r\n\t\t\t\t\t\t\tif(max_num_errors < num_errors)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tmax_num_errors = num_errors;\r\n\t\t\t\t\t\t\t\tidx_2nd_oldest = i;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//compare performances of both oldest genotypes using their average errors;\r\n\t\t\t\terror_1st_oldest = _pool_of_bests.get(idx_1st_oldest)._error.getAverageError();\r\n\t\t\t\tif(idx_2nd_oldest!=-1)\r\n\t\t\t\t{\r\n\t\t\t\t\terror_2nd_oldest = _pool_of_bests.get(idx_2nd_oldest)._error.getAverageError();\r\n\r\n\t\t\t\t\tif(error_1st_oldest < error_2nd_oldest)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tidx_to_remove = idx_2nd_oldest;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tidx_to_remove = idx_1st_oldest;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse//a single individual must always be replaced\r\n\t\t\t\t{\r\n\t\t\t\t\tidx_to_remove = idx_1st_oldest;\r\n\t\t\t\t}\r\n\t\t\t}//are there genotypes with life span above a threshold?\r\n\t\t\t\r\n\t\t\t_pool_of_bests.remove(idx_to_remove);\r\n\t\t}//is maturity pool full?\r\n\t}", "public void initPopulation() throws JMException, ClassNotFoundException {\n population_ = new SolutionSet[problemSet_.size()];\n for (int i = 0; i < problemSet_.size(); i++){\n population_[i] = new SolutionSet(populationSize_);\n }\n\n for (int j = 0; j < problemSet_.size(); j++){\n for (int i = 0; i < populationSize_; i++) {\n Solution newSolution = new Solution(problemSet_);\n problemSet_.get(j).evaluate(newSolution);\n problemSet_.get(j).evaluateConstraints(newSolution);\n population_[j].add(newSolution);\n } // for\n }\n\n }", "public void runTournament() {\n\t\t//ArrayList<Gene> tournament = new ArrayList<Gene>();\n\t\tPriorityQueue<Gene> tournament = new PriorityQueue<Gene>(Collections.reverseOrder());\n\t\tint numContenders = (int)(FRAC_IN_TOURNAMENT * geneNumber);\n\t\tSet<Integer> chosenOnes = new HashSet<Integer>();\n\t\t\n\t\twhile(chosenOnes.size() < numContenders) {\n\t\t\tint randIndex = (int) (Math.random() * geneNumber);\n\t\t\tchosenOnes.add(randIndex);\n\t\t}\n\t\tfor(int i : chosenOnes){\n\t\t\ttournament.add(genepool.get(i));\n\t\t}\n\t\t//int firstIndex = getMax(tournament, -1);\n\t\t//int secondIndex = getMax(tournament, firstIndex);\n\t\t//Gene parent1 = tournament.get(firstIndex);\n\t\t//Gene parent2 = tournament.get(secondIndex);\n\t\tGene parent1 = tournament.poll();\n\t\tGene parent2 = tournament.poll();\n\t\t// Create a new gene from the 2 fittest genes\n\t\tGene newGene = parent1.waCrossover(parent2);\n\t\t\n\t\t// Calculate fitness for the new gene\n\t\tPlayerSkeleton.runGames(numGames, newGene);\n\t\toffspringPool.add(newGene);\n\t}", "private void tournament_selection() {\r\n\r\n individual[] temp_pop = new individual[this.pop_size];\r\n\r\n for (int i = 0; i < this.pop_size; i++) {\r\n\r\n // pick 2 random ints to for indices of parents\r\n int parent1 = new Random().nextInt(this.pop_size);\r\n int parent2 = new Random().nextInt(this.pop_size);\r\n\r\n individual p1 = new individual(main_population.getPopulation()[parent1].getGenes(), solutions, output);\r\n individual p2 = new individual(main_population.getPopulation()[parent2].getGenes(), solutions, output);\r\n\r\n if (p1.getFitness() >= p2.getFitness()) {\r\n temp_pop[i] = p1;\r\n } else {\r\n temp_pop[i] = p2;\r\n }\r\n }\r\n this.main_population.setPopulation(temp_pop);\r\n this.main_population.update_population();\r\n }", "public Chromosome doDisplacementMutation(){\n for(int i = 0; i < PopulationConfiguration.MUTATION_ATTEMPTS; i++){\n ArrayList<Boolean> newSelection = copyBoolArrayList(this.knapsackSelection);\n\n int allele1 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n int allele2 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n\n int leftAllele = Math.min(allele1, allele2);\n int rightAllele = Math.max(allele1, allele2);\n\n var selectionSublist = new ArrayList<Boolean>(newSelection.subList(leftAllele, rightAllele));\n for(int j = leftAllele; j < rightAllele + 1; j++){\n newSelection.remove(leftAllele);\n }\n\n int index = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size()+1);\n newSelection.addAll(index, selectionSublist);\n\n Chromosome mutatedKnapsack = new Chromosome(newSelection).withFitnessCalculated();\n if(mutatedKnapsack.isValid())\n return mutatedKnapsack;\n }\n return this;\n }", "public void setPopulation(Integer population) {\n this.population = population;\n }", "private void repairGenome() {\n if (checkGenome(this.code)) {\n return;\n }\n int[] counters = new int[8];\n for (int c : code) { counters[c]++; }\n for (int i = 0; i < 8; ++i) {\n if (counters[i] == 0) {\n while (true) {\n int newPos = r.nextInt(GENOME_SIZE);\n if (counters[this.code[newPos]] > 1) {\n counters[this.code[newPos]]--;\n this.code[newPos] = i;\n break;\n }\n }\n }\n }\n }", "public static void mutation(Individual[] individuals) {\n for (int i = 0; i < POP_SIZE; i++) {\n for (int j = 0; j < GENE_SIZE; j++) {\n double randomNum = Math.random();\n if (randomNum < MUTATION_RATE) {\n randomNum = Math.random();\n ArrayList<String> bitsList = (ArrayList<String>) bits.clone();\n for (int g = 0; g < bitsList.size(); g++) {\n if (individuals[i].gene[j].equals(bitsList.get(g))) {\n String bit = bitsList.get(g);\n bitsList.remove(g);\n int index;\n if (randomNum < 0.5) {\n index = 0;\n } else {\n index = 1;\n }\n individuals[i].gene[j] = bitsList.get(new Random().nextInt(2));\n bitsList.add(bit);\n }\n }\n }\n }\n individuals[i].generateRulebase();\n }\n matingPool = Arrays.copyOf(individuals, individuals.length);\n }", "public void reproduceVirus() {\n\t\tOrganism newOrg;\n\t\t\n\t\tfor (int i=0; i < 1; i++) {\n\t\t\tnewOrg = new Organism(_world);\n\t\t\tif (newOrg.inherit(this, i==0)) {\n\t\t\t\t// It can be created\n\t\t\t\t_nTotalChildren++;\n\t\t\t\t_world.addOrganism(newOrg,this);\n\t\t\t\t_infectedGeneticCode = null;\n\t\t\t}\n\t\t\t_timeToReproduce = 20;\n\t\t}\n\t}", "private static void generateOutput(List<Cell> population, List<String>genome_data)\n {\n String newLine = System.getProperty(\"line.separator\");\n printString(\"===================\" + newLine + \"GENERATE OUTPUT\" + newLine + \"===================\");\n int generation = -1;\n int[][] chromosome_sizes = new int[haploid_number][2]; //The size of each chromosome (deploid) stored in a 2D array\n int diploid_genome_size = 0; //The sum of all chromosome sizes\n \n //Produce array of chromosome sizes, garbage clean genome_data\n //For each element in genome_data, split by comma and place into two elements of chromosome sizes array\n int current_chromosome = 0;\n for(Iterator<String> i = genome_data.iterator(); i.hasNext();current_chromosome++)\n {\n String item = i.next();\n String[] homologous_pair_sizes = item.split(\",\");\n chromosome_sizes[current_chromosome][0] = Integer.parseInt(homologous_pair_sizes[0]);\n chromosome_sizes[current_chromosome][1] = Integer.parseInt(homologous_pair_sizes[1]);\n diploid_genome_size += chromosome_sizes[current_chromosome][0];\n diploid_genome_size += chromosome_sizes[current_chromosome][1];\n System.out.println(item);\n }\n \n //Print chromosome sizes array\n /*for(int chromosome_count = 0; chromosome_count < chromosome_sizes.length; chromosome_count++)\n {\n for(int homologous_pair_count= 0; homologous_pair_count < chromosome_sizes[chromosome_count].length; homologous_pair_count++)\n {\n printString(Integer.toString(chromosome_sizes[chromosome_count][homologous_pair_count]));\n }\n }*/\n \n printString(\"Size of diploid genome in base pairs = \" + Integer.toString(diploid_genome_size));\n genome_data = null; // Garbage collection\n\n \n //new Cell(cell_id, cell_generation, last_div, CAN_DIVIDE, diploid_genome));\n //For each cell in population 1)Track each generation and push cells to 2D array\n //2)Track % new DNA of each cell and total % new DNA of each generation\n \n double [] generation_label_percentage = new double[newest_generation+1];\n int [] cells_in_each_generation = new int[newest_generation+1];\n for (int this_generation : cells_in_each_generation)\n {\n this_generation = 0;\n }\n //Gather information from each cell\n\n //Go through each cell and obtain its generation number and update the corresponding % new DNA\n for(int cell_count = 0; cell_count < population.size(); cell_count++)\n {\n Cell current_cell = population.get(cell_count);\n int [][][] this_cells_genome = current_cell.getGenome();\n int generation_of_this_cell = current_cell.getGeneration();\n double cell_percentage_labelled = 0.0;\n \n for(int chromosome_count = 0; chromosome_count < this_cells_genome.length; chromosome_count++)\n {\n double chromo_percentage_labelled = 0;// Label status of each chromosome\n for(int homologous_pair_count= 0; homologous_pair_count < this_cells_genome[chromosome_count].length; homologous_pair_count++)\n {\n int homolog_size = chromosome_sizes[chromosome_count][homologous_pair_count]; //Chromosome size in base pairs\n double chromosome_proportion_of_genome = (double)homolog_size/diploid_genome_size; // The size of the chromosome relative to the diploid genome\n double strand_percentage_labelled = 0;\n for(int dna_strand_count = 0; dna_strand_count < this_cells_genome[chromosome_count][homologous_pair_count].length; dna_strand_count++)\n {\n int label_status = this_cells_genome[chromosome_count][homologous_pair_count][dna_strand_count];\n switch (label_status)\n {\n case STRAND_UNLABELLED:\n //double percentage_calc =\n //strand_percentage_labelled =\n\n \n break;\n case STRAND_LABELLED:\n strand_percentage_labelled = 1.0;\n chromo_percentage_labelled = (chromo_percentage_labelled + strand_percentage_labelled) / 2;\n strand_percentage_labelled = 0.0;\n //printString(Double.toString(chromo_percentage_labelled));\n\n break;\n }\n }\n cell_percentage_labelled += chromo_percentage_labelled * chromosome_proportion_of_genome;\n }\n }\n generation_label_percentage[generation_of_this_cell] += (generation_label_percentage[generation_of_this_cell] + cell_percentage_labelled) / 2;\n \n int temp_number_cells = cells_in_each_generation[generation_of_this_cell] + 1;\n cells_in_each_generation[generation_of_this_cell] = temp_number_cells;\n //printString(generation_of_this_cell + \" \" + cell_percentage_labelled);\n \n //population_by_generations.add(new Cell(current_generation),null);\n }// for\n \n //Go through the population and sort cells into the 2D array by their generation number\n //for(int current_cell = 0; current_cell < cells_in_each_generation.length; current_cell++)\n //{\n // printString(current_cell + \" \" + cells_in_each_generation[current_cell]);\n\n //}// for\n \n for(int current_generation = 0; current_generation < generation_label_percentage.length; current_generation++)\n {\n printString(\"Generation: \" + current_generation + \" % labelled: \" + generation_label_percentage[current_generation]);\n \n }// for\n \n //printLabelDistribOfPopulation(population);\n \n }", "private void tileSetSurroundingBombs() {\r\n for (int r = 0; r < gridSize; r++) {\r\n for (int c = 0; c < gridSize; c++) {\r\n int neighborBombs = neighborBombCount(grid[r][c]);\r\n grid[r][c].setSurroundingBombs(neighborBombs);\r\n }\r\n } \r\n }", "private static void calculateFitnessOfPopulation(ArrayList<Chromosome> population) {\n for (Chromosome chromosome : population) {\n // if the fitness of the chromosome has not yet been calculated (i.e. is still -1)\n fitnessFunction(chromosome);\n }\n }", "void addChromosome(@NotNull final Chromosome chromosome);", "private static List<Cell> initiatePopulation(int required_population_size)\n {\n List<Cell> population = new ArrayList<Cell>(); //Define an arraylist to hold the initial population of cells\n int[][][] diploid_genome = newEmptyDeploidGenome();\n int cell_generation = newest_generation + 1, last_div = -1;\n \n //Set the label status of all DNA strands in the genome to unlabelled\n for(int chromosome_count = 0; chromosome_count < diploid_genome.length; chromosome_count++)\n {\n for(int homologous_pair_count= 0; homologous_pair_count < diploid_genome[chromosome_count].length; homologous_pair_count++)\n {\n for(int dna_strand_count = 0; dna_strand_count < diploid_genome[chromosome_count][homologous_pair_count].length; dna_strand_count++)\n {\n diploid_genome[chromosome_count][homologous_pair_count][dna_strand_count] = STRAND_UNLABELLED; //Set each DNA strand to unlabelled\n }\n }\n }\n \n // !****!Create the starting population of cells, all as generation 0!****!\n for (int counter = 0; counter < required_population_size; counter++)\n {\n int cell_id = counter;\n population.add(new Cell(cell_id, cell_generation, last_div, CAN_DIVIDE, diploid_genome)); // Create a new Cell object with the following values.\n id_of_last_created_cell = cell_id; // Track the id of the last created cell\n }// for\n newest_generation++;\n return population;\n }", "private void modifyIndividuals(){\n for(AbstractBehaviour behaviour: entityBehaviours){\n JSONObject jsonPop = null;\n GeneticInterface gi = interfaceMap.get(behaviour);\n try {\n jsonPop = gi.receiveNewPopulation();\n } catch (IOException e) {\n e.printStackTrace();\n }\n for(String key: jsonPop.keySet()){\n JSONArray funArray = jsonPop.getJSONObject(key).getJSONArray(\"functions\");\n List<Function> functions = new LinkedList<>();\n for(int a = 0; a <funArray.length(); a++){\n String tree = funArray.getString(a);\n Function functionTree = Node.treeFromString(tree, behaviour.getNumberOfInputs());\n functions.add(functionTree);\n }\n behaviour.setEntityByName(key, functions);\n }\n behaviour.resetEntities();\n }\n }", "private Vector crossover(Individual mother, Individual father) {\n \n //don't want to do crossover on two chromosomes that are equal\n if(mother.equals(father)) {\n Vector to_return = new Vector();\n to_return.add(mother);\n to_return.add(father);\n return to_return;\n }\n \n println(\"crossover\", 1);\n int[] mom = mother.getChromosome();\n int[] dad = father.getChromosome();\n int[] child1 = new int[num_shipping_points]; \n int[] child2 = new int[num_shipping_points]; \n \n println(\"mother is\", 1);\n displayChromosome(mother, 1);\n println(\"father is\", 1);\n displayChromosome(father, 1);\n \n int breakpoint = (int)(Math.random() * num_shipping_points) + 3;\n println(\"breakpoint = \" + breakpoint, 1);\n \n int comparisons = 0;\n \n for(int i = 0; i < num_shipping_points; i++) {\n if(i < breakpoint) {\n child1[i] = mom[i];\n child2[i] = dad[i];\n }\n else {\n child1[i] = -1;\n child2[i] = -1;\n }\n } \n \n int j = breakpoint; //index on other chromosome\n\n for(int i = breakpoint; i < num_shipping_points; i++) {\n\n while(containsGene(child2, mom[j])) {\n j++;\n comparisons++;\n if(comparisons > 30) {\n println(\"leaving\", 1);\n System.exit(0);\n }\n \n if(j == num_shipping_points) {\n j = 0;\n }\n if(j == breakpoint) //not supposed to happen, but it does\n break;\n }\n child2[i] = mom[j];\n j++;\n if(j == num_shipping_points) {\n j = 0;\n }\n\n }\n \n j = breakpoint;\n comparisons = 0; \n for(int i = breakpoint; i < num_shipping_points; i++) {\n\n while(containsGene(child1, dad[j])) {\n j++;\n comparisons++;\n if(comparisons > 30) {\n println(\"leaving\", 1);\n System.exit(0);\n }\n if(j == num_shipping_points) {\n j = 0;\n }\n if(j == breakpoint)\n break;\n }\n child1[i] = dad[j];\n j++;\n if(j == num_shipping_points) {\n j = 0;\n }\n }\n \n Vector v = new Vector();\n Individual i1 = new Individual(child1, this);\n Individual i2 = new Individual(child2, this);\n //i1.setFitness(evaluateFitness(i1));\n //i2.setFitness(evaluateFitness(i1));\n v.add(i1);\n v.add(i2);\n println(\"kid1:\",1);\n displayChromosome(i1, 1);\n println(\"kid2:\", 1);\n displayChromosome(i2, 1);\n println(\"returning from crossover\",1);\n return v;\n }", "protected void loadPopulationIntoDatabase(IPopulation<? extends ADemoEntity, Attribute<? extends IValue>> pop) {\n\t\tassert this.connection != null;\n\t\tassert pop != null;\n\t\t\n\t\t// create the attributes \n\t\t// we don't know the entity type for this population\n\t\tString entityType = DEFAULT_ENTITY_TYPE;\n\t\tthis.entityType2attributes.put(entityType, new HashSet<>(pop.getPopulationAttributes()));\n\t\t\n\t\t// create internal structure\n\t\ttry {\n\t\t\tcreateInitialTables();\n\t\t} catch (SQLException e) {\n\t\t\te.printStackTrace();\n\t\t\tthrow new RuntimeException(\"error creating the tables to store the population in database: \"+e.getMessage(), e);\n\t\t}\n\t\t\n\t\ttry {\n\t\t\tstoreEntities(entityType, pop);\n\t\t} catch (SQLException e) {\n\t\t\te.printStackTrace();\n\t\t\tthrow new RuntimeException(\"error while inserting the population in database: \"+e.getMessage(), e);\n\t\t\t\n\t\t}\n\t}", "public void printAll() {\n // Sort them by parent for ease of analysis\n // copy it so that we don't mess with the actual pop\n ArrayList<Bacteria> temp = (ArrayList<Bacteria>) inds.clone();\n Collections.sort(temp, new Comparator<Bacteria>() {\n @Override\n public int compare(Bacteria o1, Bacteria o2) {\n if (o1.getParentID() > o2.getParentID()) return 1;\n else if (o1.getParentID() == o2.getParentID()) return 0;\n else return -1;\n }\n });\n\t\tSystem.out.println(\"Bacteria population:\");\n for (int i=0; i < getPopSize(); i++) {\n temp.get(i).print();\n }\n System.out.println();\n\t}", "public void moveInPopulation()\n\t{\n\t\tsynchronized (this) {\n\t\tcurrentState.moveInPopulation();\n\t\t}\n\t}", "public static void reproduce (Species [][] map, int sheepHealth, int wolfHealth, int plantHealth) {\n \n // Place the baby\n int babyY, babyX;\n \n // Check if the baby has been placed\n int spawned = 0;\n \n for (int y = 0; y < map[0].length; y++){\n for (int x = 0; x < map.length; x++){\n \n boolean [][] breeding = breedChoice (map, x, y, plantHealth);\n \n // Sheep upwards to breed with\n if (breeding[0][0]) {\n ((Sheep)map[y][x]).reproduceHealthLost(10);\n ((Sheep)map[y-1][x]).reproduceHealthLost(10);\n \n // Make baby sheep\n Sheep sheep = new Sheep(sheepHealth, x, y);\n \n // Place the baby sheep\n do {\n babyY = (int)(Math.random() * map.length);\n babyX = (int)(Math.random() * map.length);\n if (map[babyY][babyX] == null) {\n map[babyY][babyX] = sheep;\n spawned = 1;\n }\n } while (spawned == 0);\n \n // Sheep downwards to breed with\n } else if (breeding[1][0]) {\n ((Sheep)map[y][x]).reproduceHealthLost(10);\n ((Sheep)map[y+1][x]).reproduceHealthLost(10);\n \n // Make baby sheep\n Sheep sheep = new Sheep(sheepHealth, x, y);\n \n // Place the baby sheep\n do {\n babyY = (int)(Math.random() * map.length);\n babyX = (int)(Math.random() * map.length);\n if (map[babyY][babyX] == null) {\n map[babyY][babyX] = sheep;\n spawned = 1;\n }\n } while (spawned == 0);\n \n // Sheep to the left to breed with\n } else if (breeding[2][0]) {\n ((Sheep)map[y][x]).reproduceHealthLost(10);\n ((Sheep)map[y][x-1]).reproduceHealthLost(10);\n \n // Make baby sheep\n Sheep sheep = new Sheep(sheepHealth, x, y);\n \n // Place the baby sheep\n do {\n babyY = (int)(Math.random() * map.length);\n babyX = (int)(Math.random() * map.length);\n if (map[babyY][babyX] == null) {\n map[babyY][babyX] = sheep;\n spawned = 1;\n }\n } while (spawned == 0);\n \n // Sheep to the right to breed with\n } else if (breeding[3][0]) {\n ((Sheep)map[y][x]).reproduceHealthLost(10);\n ((Sheep)map[y][x+1]).reproduceHealthLost(10);\n \n // Make baby sheep\n Sheep sheep = new Sheep(sheepHealth, x, y);\n \n // Place the baby sheep\n do {\n babyY = (int)(Math.random() * map.length);\n babyX = (int)(Math.random() * map.length);\n if (map[babyY][babyX] == null) {\n map[babyY][babyX] = sheep;\n spawned = 1;\n }\n } while (spawned == 0);\n \n // Wolf upwards to breed with\n } else if (breeding[0][1]) {\n ((Wolf)map[y][x]).reproduceHealthLost(10);\n ((Wolf)map[y-1][x]).reproduceHealthLost(10);\n \n // Make baby wolf\n Wolf wolf = new Wolf(wolfHealth, x, y);\n \n // Place the baby wolf\n do { \n babyY = (int)(Math.random() * map.length);\n babyX = (int)(Math.random() * map.length);\n if (map[babyY][babyX] == null) {\n map[babyY][babyX] = wolf;\n spawned = 1; \n }\n } while (spawned == 0);\n \n // Wolf downwards to breed with\n } else if (breeding[1][1]) {\n ((Wolf)map[y][x]).reproduceHealthLost(10);\n ((Wolf)map[y+1][x]).reproduceHealthLost(10);\n \n // Make baby wolf\n Wolf wolf = new Wolf(wolfHealth, x, y);\n \n // Place the baby wolf\n do { \n babyY = (int)(Math.random() * map.length);\n babyX = (int)(Math.random() * map.length);\n if (map[babyY][babyX] == null) {\n map[babyY][babyX] = wolf;\n spawned = 1; \n }\n } while (spawned == 0);\n \n // Wolf to the left to breed with\n } else if (breeding[2][1]) {\n ((Wolf)map[y][x]).reproduceHealthLost(10);\n ((Wolf)map[y][x-1]).reproduceHealthLost(10);\n \n // Make baby wolf\n Wolf wolf = new Wolf(wolfHealth, x, y);\n \n // Place the baby wolf\n do { \n babyY = (int)(Math.random() * map.length);\n babyX = (int)(Math.random() * map.length);\n if (map[babyY][babyX] == null) {\n map[babyY][babyX] = wolf;\n spawned = 1; \n }\n } while (spawned == 0);\n \n // Wolf to the right to breed with\n } else if (breeding[3][1]) {\n ((Wolf)map[y][x]).reproduceHealthLost(10);\n ((Wolf)map[y][x+1]).reproduceHealthLost(10);\n \n // Make baby wolf\n Wolf wolf = new Wolf(wolfHealth, x, y);\n \n // Place the baby wolf\n do { \n babyY = (int)(Math.random() * map.length);\n babyX = (int)(Math.random() * map.length);\n if (map[babyY][babyX] == null) {\n map[babyY][babyX] = wolf;\n spawned = 1; \n }\n } while (spawned == 0);\n \n }\n \n }\n }\n \n }", "private void placeBombs() {\n\t\tfor (int i = 0; i < NUM_BOMBS; i++) {\n\t\t\tplaceBomb();\n\t\t}\n\t}", "public TSPChromosome(int size) {\t\n\t\tfor(int g=0; g<size; g++){\n\t\t\tgenes.add(new Integer(-1));\n\t\t}\n\t\tinit();\n\t}", "public void generatePopulation() {\n\t\t\n\t\tif (SCType.getScLayers() <= 2)\n\t\t\tLogger.logError(\"To few supply chain layers, minimum of 3 required:\" + SCType.getScLayers());\n\t\t\n\t\tArrayList<CountryAgent> countryAgents = SU.getObjectsAll(CountryAgent.class);\t\t\n\t\tfor (CountryAgent country : countryAgents) {\n\t\t\t\n\t\t\tif (country.containsSCType(SCType.PRODUCER)) {\n\t\t\t\tfor (int i = 0; i < Constants.N_PRODUCERS; i++) {\n\t\t\t\t\tcountry.spawnAgent(SCType.PRODUCER);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (country.containsSCType(SCType.INTERNATIONAL)) {\n\t\t\t\tfor (int i = 0; i < Constants.N_INTERNATIONALS; i++) {\n\t\t\t\t\tcountry.spawnAgent(SCType.INTERNATIONAL);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (country.containsSCType(SCType.WHOLESALER)) {\n\t\t\t\tfor (int i = 0; i < Constants.N_WHOLESALERS; i++) {\n\t\t\t\t\tcountry.spawnAgent(SCType.WHOLESALER);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (country.containsSCType(SCType.RETAIL)) {\n\t\t\t\tfor (int i = 0; i < Constants.N_RETAILERS; i++) {\n\t\t\t\t\tcountry.spawnAgent(SCType.RETAIL);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (country.containsSCType(SCType.CONSUMER)) {\n\t\t\t\tfor (int i = 0; i < Constants.N_CONSUMERS; i++) {\n\t\t\t\t\tcountry.spawnAgent(SCType.CONSUMER);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Set possible new suppliers and clients\n\t\tfor (BaseAgent agent : SU.getObjectsAll(BaseAgent.class)) {\n\t\t\tagent.setPossibleNewSuppliersAndClients();\n\t\t}\n\t\t\n\t\tSU.getDataCollector().addAllCurrentStock();\n\t}", "public Population(int popSize, String[] studet_ids, int groupSize, \r\n\t\t int initPop, int selMethod, int selPara, \r\n\t\t int crossMethod, double crossPara, int mutMethod,\r\n\t\t double mutPara, int replaceMethod, int replacePara,\r\n\t\t double powerStep, double tourStep, FitnessFunction fitnessFunction)\r\n {\r\n\tthis(selMethod, selPara, crossMethod, crossPara, mutMethod, mutPara, \r\n\t replaceMethod, replacePara, powerStep, tourStep, fitnessFunction);\r\n\r\n\tchromos = new ArrayList<Chromosome>();\r\n\tfor(int i = 0; i < popSize; i++)\r\n\t chromos.add(new Chromosome(studet_ids, groupSize, crossMethod,\r\n\t\t\t\t crossPara, mutMethod, mutPara, initPop, ff));\r\n\tinitialize();\r\n }", "public void populateGrid(int grid_size,int [][] mine_positions,int tot_mines){\n\t\tfor(int row=0;row<grid_size;row++){\n\t\t\tfor(int col=0;col<grid_size;col++){\n\t\t\t\n\t\t\t\tfor(int k=0;k<tot_mines;k++){\n\t\t\t\t\tif(row==mine_positions[k][0]&&col==mine_positions[k][1]){\n\t\t\t\t\t\tgrid[row][col].content='M';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tint mine_ctr=0;\n\t\t//Populating all cells\n\t\tfor(int row=0;row<grid_size;row++){\n\t\t\tfor(int col=0;col<grid_size;col++){\n\t\t\t\t\n\t\t\t\tmine_ctr=0;\n\t\t\t\t//Checking number of mines surrounding each cell\n\t\t\t\tif(grid[row][col].content=='M'){\n\t\t\t\t\tgrid[row][col].no_of_mines=0;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t\n\t\t\t\t\t//Top left\n\t\t\t\t\tif(grid[row][col].top_left==1&&grid[row-1][col-1].content=='M')\n\t\t\t\t\t\tmine_ctr++;\n\t\t\t\t\t\n\t\t\t\t\t//Top \n\t\t\t\t\tif(grid[row][col].top==1&&grid[row-1][col].content=='M')\n\t\t\t\t\t\tmine_ctr++;\n\t\t\t\t\t\n\t\t\t\t\t//Top right\n\t\t\t\t\tif(grid[row][col].top_right==1&&grid[row-1][col+1].content=='M')\n\t\t\t\t\t\tmine_ctr++;\n\t\t\t\t\t\n\t\t\t\t\t//Left\n\t\t\t\t\tif(grid[row][col].left==1&&grid[row][col-1].content=='M')\n\t\t\t\t\t\tmine_ctr++;\n\t\t\t\t\t\n\t\t\t\t\t//Right\n\t\t\t\t\tif(grid[row][col].right==1&&grid[row][col+1].content=='M')\n\t\t\t\t\t\tmine_ctr++;\n\t\t\t\t\t\n\t\t\t\t\t//Bottom left\n\t\t\t\t\tif(grid[row][col].bottom_left==1&&grid[row+1][col-1].content=='M')\n\t\t\t\t\t\tmine_ctr++;\n\t\t\t\t\t\t\n\t\t\t\t\t//Bottom\n\t\t\t\t\tif(grid[row][col].bottom==1&&grid[row+1][col].content=='M')\n\t\t\t\t\t\tmine_ctr++;\t\n\t\t\t\t\t\n\t\t\t\t\t//Bottom right\n\t\t\t\t\tif(grid[row][col].bottom_right==1&&grid[row+1][col+1].content=='M')\n\t\t\t\t\t\tmine_ctr++;\n\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tgrid[row][col].no_of_mines=mine_ctr;\n\t\t\t}\n\t\t}\n\t}", "private void cull() {\n\t\tArrayList<NQueenBoard> temp = new ArrayList<NQueenBoard>();\n\t\ttemp.add(populationArray.get(0));\n\t\tfor (int i = 1; i < population; ++i) {\n\t\t\tfor (int j = 0; j < temp.size(); ++j) {\n\t\t\t\tif (populationArray.get(i).getFitness() > temp.get(j).getFitness()) {\n\t\t\t\t\ttemp.add(j, populationArray.get(i));\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (populationArray.get(i).getFitness() <= temp.get(temp.size()-1).getFitness()) {\n\t\t\t\ttemp.add(populationArray.get(i));\n\t\t\t}\n\t\t}\n\t\t//replace the worst half with newly generated random boards\n\t\tfor (int i = temp.size()/2; i < temp.size(); ++i) {\n\t\t\ttemp.set(i, new NQueenBoard(n));\n\t\t}\n\t\tpopulationArray = temp;\n\t}", "protected void initializePopulation () {\n\t\tfor (int i = 0; i < this.speciesSize; i++) {\n\t\t\tthis.detectors.add(DetectorFactory.makeDetector(this.featuresLength, this.typeBias, this.generalityBias));\n\t\t}\n\t}", "private void insertMidwest(State state)\r\n\t{\r\n\t\tif (midwestElem == 0)\r\n\t\t{\r\n\t\t\tmidwestQueue[midwestElem++] = state;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n int i;\r\n\t\t\tfor (i = midwestElem - 1; i >= 0; i--)\r\n\t\t\t{\r\n\t\t\t\tif (state.getPopulation() > midwestQueue[i].getPopulation())\r\n\t\t\t\t\tmidwestQueue[i+1] = midwestQueue[i];\r\n\t\t\t\telse\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tmidwestQueue[i+1] = state;\r\n midwestElem++;\r\n\t\t}\r\n\t}", "private void spawnTrees() {\n int spawnNum = this.random.nextInt(10) + 20;\n if (this.treeTiles.size() >= 30) { // max 30 trees\n spawnNum = 0;\n }\n for (int i = 0; i < spawnNum; i++) {\n String tree = trees[this.random.nextInt(trees.length)];\n int y = this.random.nextInt(this.getMap().length);\n Tile spawnTile = this.getMapAt(this.random.nextInt(this.getMap()[y].length), y);\n Tile centerTile;\n if ((spawnTile != null) && this.inMap(spawnTile.getX()-2, spawnTile.getY()-1)) {\n centerTile = this.getMapAt(spawnTile.getX()-2, spawnTile.getY()-1);\n } else {\n centerTile = null;\n }\n if ((spawnTile != null) && (spawnTile instanceof GroundTile)\n && (centerTile != null) && (centerTile instanceof GroundTile)\n && (spawnTile.getContent() == null)) {\n ExtrinsicTree newTree = new ExtrinsicTree(tree);\n newTree.setStage(17);\n spawnTile.setContent(newTree);\n this.treeTiles.add(spawnTile);\n }\n }\n }", "public static void populateTree(BinarySearchTree tree)\n {\n for(int i = 0; i < 20; i++)\n {\n tree.add(i);\n }\n }", "public static void runGeneticAlgorithm(ArrayList<City> cities) throws IOException {\n\n\t\t//select our strategies for our genetic algorithm\n\t\tPopulationInitialiser initialiser = new RandomGeneration();//random generation of initial population as initialisation strategy\n\t\tPopulationCrossover breeder = new TwoPointCrossOver();//two-point crossover as crossover strategy\n\t\tPopulationMutator mutator = new SwapTwoCities();//swap of two elements as mutation strategy\n\t\tPopulationReplacement selector = new ElitistSelection();//elitism as selection strategy\n\n\t\t//create a generation history object to track all generations\n\t\tArrayList<GAPopulationGeneration> generationHistory = new ArrayList<>();\n\n\t\t//create our first generation and randomly generate its initial solutions\n\t\tGAPopulationGeneration generation = new GAPopulationGeneration(initialiser.initialise(cities, 8));\n\n\t\t// create our output table\n\t\tAsciiTable outputTable = new AsciiTable();\n\t\toutputTable.addHeavyRule();\n\n\t\t// create our incumbent and stopping criterion tracker\n\t\tCandidateSolution incumbent = generation.getParentPopulation().getBestSolution();\n\t\tint generationSinceImprovedIncumbent = 0;\n\n\t\t//loop until 10 iterations without improved incumbent\n\t\twhile (generationSinceImprovedIncumbent <= 10) {\n\n\t\t\t//take parents and crossover to create 6 offspring. record the results for displaying later\n\t\t\tgeneration.setOffspringPopulation(breeder.breed(generation.getParentPopulation(), 6));\n\t\t\tgeneration.setFamilyRecords(breeder.getFamilies());\n\n\t\t\t//take offspring and perform mutation. record the results for displaying later\n\t\t\tgeneration.setMutatedPopulation(mutator.mutatePopulation(generation.getOffspringPopulation()));\n\t\t\tgeneration.setMutantRecords(mutator.getMutations());\n\n\t\t\t//take mutated offspring and perform selection.\n\t\t\tgeneration.setNextPopulation(selector.replace(generation.getParentPopulation(), generation.getMutatedPopulation()));\n\n\t\t\t//if this solution is greater than the incumbent reset stopping criterion and we have new incumbent, else increment stopping criterion\n\t\t\tif (generation.getBestSolutionThisGeneration().compareTo(incumbent) < 0) {\n\t\t\t\tgenerationSinceImprovedIncumbent = 0;\n\t\t\t\tincumbent = generation.getBestSolutionThisGeneration();\n\t\t\t} else\n\t\t\t\tgenerationSinceImprovedIncumbent++;\n\n\t\t\t//record the current generation, and create the new generation from the current one\n\t\t\tgeneration.addToTable(outputTable, incumbent);\n\t\t\tgenerationHistory.add(generation);\n\t\t\tgeneration = generation.initialiseNextGeneration();\n\n\t\t}\n\n\t\t//print out the incumbent at the end\n\t\toutputTable.addRow(\"\", \"\", \"TSP final best solution & fitness : \", incumbent + \" (\" + incumbent.getFitness() + \")\", \"\", \"\", \"\", \"\");\n\t\toutputTable.addHeavyRule();\n\n\n\t\t//format the table, and print to console and output.txt\n\t\tTA_Grid grid = TA_Grid.create(\"an ascii compliant grid\")\n\t\t\t\t.addCharacterMap(TA_GridConfig.RULESET_HEAVY, ' ', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#')\n\t\t\t\t.addCharacterMap(TA_GridConfig.RULESET_NORMAL, ' ', '~', ' ', '~', '~', '~', '~', '~', '~', '~', '~', '~')\n\t\t\t\t.addCharacterMap(TA_GridConfig.RULESET_LIGHT, ' ', '-', ' ', '-', '-', '-', '-', '-', '-', '-', '-', '-');\n\t\toutputTable.getContext().setGrid(grid);\n\t\toutputTable.setTextAlignment(TextAlignment.CENTER);\n\t\toutputTable.getRenderer().setCWC(new CWC_LongestLine());\n\t\tFileWriter output = new FileWriter(\"output.txt\", true);\n\t\toutput.append(outputTable.render()).append(\"\\n\\n\").close();\n\t\tSystem.out.println(outputTable.render() + \"\\n\\n\");\n\t}", "public void sortByPopulation()\r\n {\r\n PrintWriter output;\r\n int max, t0;\r\n String t1;\r\n \r\n //Selection sort\r\n for(int i = 0; i<population.length;i++) //loops through\r\n {\r\n max = i; //Assume first element is max\r\n for(int x = i + 1;x<population.length;x++) //loops through the rest\r\n {\r\n if(population[x] >population[max]) //sets new max if a subsequent element is bigger\r\n { \r\n max = x;\r\n }\r\n }\r\n //change the positions\r\n t0 = population[i];\r\n population[i] = population[max];\r\n population[max] = t0;\r\n t1 = countries[i];\r\n countries[i] = countries[max];\r\n countries[max] = t1;\r\n }\r\n \r\n try\r\n {\r\n output = new PrintWriter (new FileWriter (\"sortedByPopulation.txt\")); //saves\r\n \r\n //prints to the file\r\n for (int x = 0 ; x <population.length ; x++)\r\n output.printf(\"%-1s \\t\\t\\t\\t %,d %n\", countries[x], population[x]);\r\n output.close (); //closes stream\r\n }\r\n catch (IOException e)\r\n {\r\n JOptionPane.showMessageDialog (null, \"Something went wrong with the input or output operations!\"); //error message\r\n }\r\n }", "public boolean InsertOmegas() {\r\n //Attributes used for assessing boundedness of the net\r\n boolean allElementsGreaterOrEqual = true;\r\n boolean insertedOmega = false;\r\n myNode ancestorNode; //one of the ancestors of this node\r\n \r\n //Set up array used for checking boundedness\r\n boolean [] elementIsStrictlyGreater = new boolean[tree.placeCount];\r\n \r\n //Initialise this array to false\r\n for (int i = 0; i < tree.placeCount; i++) {\r\n elementIsStrictlyGreater[i] = false;\r\n }\r\n \r\n ancestorNode = this;\r\n \r\n //For each ancestor node until root\r\n while (ancestorNode != tree.root && !insertedOmega) {\r\n //Update ancestor node to look at an earlier ancestor\r\n ancestorNode = ancestorNode.parent;\r\n \r\n allElementsGreaterOrEqual = true;\r\n \r\n //compare markup of this node with that of each ancestor node\r\n //for each place in the markup\r\n loop: for (int i = 0; i < tree.placeCount; i++) {\r\n if (markup[i] != -1) {\r\n //If M(p) for new node less than M(p) for ancestor\r\n if (markup[i] < ancestorNode.markup[i]) {\r\n allElementsGreaterOrEqual = false;\r\n break loop;\r\n }\r\n \r\n //If M(p) for new node strictly greater than M(p) for ancestor\r\n elementIsStrictlyGreater[i] = (markup[i] > ancestorNode.markup[i]);\r\n }\r\n }\r\n \r\n //Now assess the information obtained for this node\r\n if (allElementsGreaterOrEqual == true) {\r\n //for each place p in the markup of this node\r\n for (int p = 0; p < tree.placeCount; p++) {\r\n // Check if there is an inhibition\r\n boolean inhibition = false;\r\n for (int t = 0; t < tree.transitionCount; t++) {\r\n if ((tree.inhibition.get(p, t) > 0) &&\r\n (markup[p] <= tree.inhibition.get(p, t))) {\r\n inhibition = true;\r\n break;\r\n }\r\n }\r\n \r\n if (!inhibition) { \r\n if (markup[p] != -1 &&\r\n elementIsStrictlyGreater[p] &&\r\n tree.capacity[p] == 0) {\r\n //Set M(p) in this new markup to be omega\r\n markup[p] = -1;\r\n insertedOmega = true;\r\n //print(\"\\n Omega added\", markup); //debug\r\n \r\n //Set variable in tree to true - net unbound\r\n tree.foundAnOmega = true;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n for (int i = 0; i < tree.placeCount; i++) {\r\n if (markup[i] != -1) {\r\n return false;\r\n }\r\n }\r\n \r\n return true; // All places have omegas\r\n }", "public static void main(String[] args) {\n City city = new City(60, 200);\n\n City city2 = new City(180, 200);\n\n City city3 = new City(80, 180);\n City city4 = new City(140, 180);\n\n City city5 = new City(20, 160);\n\n City city6 = new City(100, 160);\n\n City city7 = new City(200, 160);\n\n City city8 = new City(140, 140);\n\n City city9 = new City(40, 120);\n\n City city10 = new City(100, 120);\n\n City city11 = new City(180, 100);\n\n City city12 = new City(60, 80);\n\n City city13 = new City(120, 80);\n City city14 = new City(180, 60);\n City city15 = new City(20, 40);\n\n City city16 = new City(100, 40);\n\n City city17 = new City(200, 40);\n City city18 = new City(20, 20);\n\n City city19 = new City(60, 20);\n City city20 = new City(160, 20);\n List<City> list=new ArrayList<City>();\n list.add(city);list.add(city2);\n list.add(city3);\n list.add(city4);\n list.add(city5);\n list.add(city6);\n list.add(city7);\n list.add(city8);\n list.add(city9);\n list.add(city10);\n list.add(city11);\n list.add(city12);\n list.add(city13);\n list.add(city14);\n list.add(city15);\n list.add(city16);\n list.add(city17);\n list.add(city18);\n list.add(city19);\n list.add(city20);\n\n // Initialize population\n Population pop = new Population(100, true,list);\n System.out.println(\"Initial distance: \" + pop.getBestTour().getDistance());\n\n // Evolve population for 100 generations\n pop = Ga.evolvePopulation(pop);\n for (int i = 0; i < 500; i++) {\n pop = Ga.evolvePopulation(pop);\n System.out.println(\"第\"+i+\"代\"+pop.getBestTour().getDistance());\n }\n\n // Print final results\n System.out.println(\"Finished\");\n System.out.println(\"Final distance: \" + pop.getBestTour().getDistance());\n System.out.println(\"Solution:\");\n System.out.println(pop.getBestTour());\n }", "Population<T> operate(Population<T> population);", "private void addCities() {\n int random2 = 0;\n for (int i = 1; i < MAP_LENGTH-1; i++) {\n for (int j = 1; j < MAP_LENGTH-1; j++) {\n if (tileMap[i][j].getTerrain() instanceof Grass) { //Make cities on grass tiles only\n random2 = (int)(Math.round(Math.random()*18));\n if (!adjacentCity(i, j) && (random2 < 3)) {\n tileMap[i][j].setCity(new City(i, j, false)); //If randomly chosen and not in proximity of another city, create a city there (right now set as not a capital)\n }\n }\n }\n }\n }", "public Vector choose(Population population, int x) {\n Vector v = new Vector();\n if( x >= 0 && x < population.size() ){\n v.add( population.get(x) );\n }else{\n int m = population.size();\n // The parent is the first individual in the population\n Individual p = population.get( 0 );\n // determining the closest offspring to the parent\n Individual c = population.get(1);\n double d = metric.distance(p,c);\n for( int i=2; i<m; i++ ){\n double d2 = metric.distance(p, population.get(i));\n if( d2 < d ){\n d = d2;\n c = population.get(i);\n }\n }\n // determining if the parent can be replaced with the child\n if( can_replace( c, p ) ){ v.add( c ); }\n else{ v.add( p ); }\n }\n return v;\n }", "public void generateOffspringPopulation() throws JMException{\n\n offspringPopulation_ = new SolutionSet[problemSet_.size()];\n\n for (int task = 0; task < problemSet_.size(); task++){\n offspringPopulation_[task] = new SolutionSet(populationSize_);\n if (crossover_.getClass() == SBXCrossover.class){\n Solution[] parents = new Solution[2];\n for (int i = 0; i < (populationSize_); i++) {\n // obtain parents\n parents = (Solution[]) selection_.execute(population_[task]);\n\n Solution[] offSpring = (Solution[]) crossover_\n .execute(parents);\n mutation_.execute(offSpring[0]);\n problemSet_.get(task).evaluate(offSpring[0]);\n problemSet_.get(task).evaluateConstraints(offSpring[0]);\n offspringPopulation_[task].add(offSpring[0]);\n } // for\n }\n else if (crossover_.getClass() == EGG.class){\n\n int[] permutation = new int[populationSize_];\n Utils.randomPermutation(permutation, populationSize_);\n etmo.util.Ranking ranking = new etmo.util.Ranking(population_[task]);\n SolutionSet front = ranking.getSubfront(0);\n\n front.Suppress();\n SolutionSet KP = null;\n if(front.size()> problemSet_.get(task).getNumberOfObjectives())\n KP = findingKneePoint(front, task);\n if(KP == null){\n KP = population_[task];\n }\n\n for (int i = 0; i < (populationSize_); i++) {\n // obtain parents\n int n = permutation[i];\n // STEP 2.1. Mating selection\n int r1,r2;\n r1 = PseudoRandom.randInt(0, KP.size() - 1);\n do {\n r2 = PseudoRandom.randInt(0, KP.size() - 1);\n } while (r2==r1);\n // STEP 2.2. Reproduction\n Solution child;\n Solution[] parents = new Solution[3];\n\n// 加入迁移:\n double tranRand = PseudoRandom.randDouble();\n if (tranRand <= 0.1){\n parents[1] = population_[PseudoRandom.randInt(0, problemSet_.size() - 1)].get(PseudoRandom.randInt(0, populationSize_ - 1));\n parents[2] = population_[PseudoRandom.randInt(0, problemSet_.size() - 1)].get(PseudoRandom.randInt(0, populationSize_ - 1));\n parents[0] = population_[task].get(n);\n child = (Solution) crossover_.execute(parents);\n\n mutation_.execute(child);\n\n problemSet_.get(task).evaluate(child);\n problemSet_.get(task).evaluateConstraints(child);\n offspringPopulation_[task].add(child);\n }\n\n\n\n else {\n parents[1] = KP.get(r1);\n parents[2] = KP.get(r2);\n parents[0] = population_[task].get(n);\n child = (Solution) crossover_.execute(parents);\n\n mutation_.execute(child);\n\n problemSet_.get(task).evaluate(child);\n problemSet_.get(task).evaluateConstraints(child);\n offspringPopulation_[task].add(child);\n }\n\n\n } // for\n }\n\n }\n\n\n\n\n }", "private void growMap() {\n\t\tshort chunkId;\n\n\t\t// Fill until full\n\t\twhile (end % STORED_CHUNKS != currChunk % STORED_CHUNKS || end == 0) {\n\t\t\tchunkId = (short) random.nextInt(chunks.length);\n\t\t\tmap[end % STORED_CHUNKS] = chunkId;\n\t\t\tchunks[chunkId].setupToStage(stage, end * MapChunk.WIDTH * tileSize, 0);\n\t\t\tend++;\n\t\t}\n\t}", "public void placeNPCsInRooms(List<Suspect> NPCs) {\n int amountOfRooms = rooms.size();\n\n List<Integer> roomsLeft = new ArrayList<>();\n\n for (int i = 0; i < amountOfRooms; i++) {\n roomsLeft.add(i);\n }\n\n for (Suspect loopNpc : NPCs) {\n /*\n Refill the rooms left list if there are more NPCs than Rooms. This will put AT LEAST one NPC per room if so.\n */\n if (roomsLeft.isEmpty()) {\n for (int i = 0; i < amountOfRooms; i++) {\n roomsLeft.add(i);\n }\n }\n\n /*\n Pick a random room and put that NPC in it\n */\n int toTake = new Random().nextInt(roomsLeft.size());\n int selectedRoom = roomsLeft.get(toTake);\n roomsLeft.remove(toTake);\n\n loopNpc.setRoom(rooms.get(selectedRoom));\n Vector2Int position = loopNpc.getRoom().getRandomLocation();\n loopNpc.setTileCoordinates(position.x, position.y);\n\n System.out.println(loopNpc.getName() + \" has been placed in room \" + selectedRoom + \" at \" + position);\n }\n }", "private void addPowerUps() {\n\t\tfor (int i = 0; i < 4; i++) {\n\n\t\t\tint x = (int) (Math.random() * 10);\n\t\t\tint y = (int) (Math.random() * 10);\n\n\t\t\twhile (pgrid[x][y] != 0) { // prevents overlaps\n\t\t\t\tx = (int) (Math.random() * 10);\n\t\t\t\ty = (int) (Math.random() * 10);\n\t\t\t}\n\n\t\t\tpgrid[x][y] = 2;\n\t\t}\n\t}", "@Test\n public void testChromosome() {\n\n Assert.assertTrue(this.chromB1.getGenes().length == 4);\n Assert.assertTrue(this.chromB1.getSize() == 4);\n Assert.assertTrue(this.chromB1.getGenes()[0] == 1);\n Assert.assertTrue(this.chromB1.getGenes()[1] == 2);\n Assert.assertTrue(this.chromB1.getGenes()[2] == 3);\n Assert.assertTrue(this.chromB1.getGenes()[3] == 4);\n }", "public Population breedPopulation(EvolutionState state)\r\n {\n if( previousPopulation != null )\r\n {\r\n if( previousPopulation.subpops.length != state.population.subpops.length )\r\n state.output.fatal( \"The current population should have the same number of subpopulations as the previous population.\" );\r\n for( int i = 0 ; i < previousPopulation.subpops.length ; i++ )\r\n {\r\n if( state.population.subpops[i].individuals.length != previousPopulation.subpops[i].individuals.length )\r\n state.output.fatal( \"Subpopulation \" + i + \" should have the same number of individuals in all generations.\" );\r\n for( int j = 0 ; j < state.population.subpops[i].individuals.length ; j++ )\r\n if( previousPopulation.subpops[i].individuals[j].fitness.betterThan( state.population.subpops[i].individuals[j].fitness ) )\r\n state.population.subpops[i].individuals[j] = previousPopulation.subpops[i].individuals[j];\r\n }\r\n previousPopulation = null;\r\n }\r\n\r\n // prepare the breeder (some global statistics might need to be computed here)\r\n prepareDEBreeder(state);\r\n\r\n // create the new population\r\n Population newpop = (Population) state.population.emptyClone();\r\n\r\n // breed the children\r\n for( int subpop = 0 ; subpop < state.population.subpops.length ; subpop++ )\r\n {\r\n if (state.population.subpops[subpop].individuals.length < 4) // Magic number, sorry. createIndividual() requires at least 4 individuals in the pop\r\n state.output.fatal(\"Subpopulation \" + subpop + \" has fewer than four individuals, and so cannot be used with DEBreeder.\");\r\n \r\n Individual[] inds = state.population.subpops[subpop].individuals;\r\n for( int i = 0 ; i < inds.length ; i++ )\r\n {\r\n newpop.subpops[subpop].individuals[i] = createIndividual( state, subpop, inds, i, 0); // unthreaded for now\r\n }\r\n }\r\n\r\n // store the current population for competition with the new children\r\n previousPopulation = state.population;\r\n return newpop;\r\n }", "private static <T> void siftUp (HeapSet<T> heap, int start) {\r\n\t\tint child = start;\r\n\t\twhile (child > 0) {\r\n\t\t\tint remainder = (child - 1) % 2;\r\n\t\t\tint root = ((child - 1) - remainder) / 2;\r\n\t\t\tif (((Comparable<? super T>) heap._list.get (root)).compareTo (heap._list.get (child)) < 0) {\r\n\t\t\t\tCollections.swap (heap._list, root, child);\r\n\t\t\t\tHeapSet.fireEvent (heap, root, child);\r\n\t\t\t\tchild = root;\r\n\t\t\t} else {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "protected void siftUp() {\r\n\t\tint child = theHeap.size() - 1, parent;\r\n\r\n\t\twhile (child > 0) {\r\n\t\t\tparent = (child - 1) >> 1;\t// >> 1 is slightly faster than / 2\r\n\t\t\t\t\t\t\t\t\t\t// => parent = (child - 1) / 2\r\n\t\t\tif (compare(theHeap.get(child), theHeap.get(parent)) >= 0)\r\n\t\t\t\tbreak;\r\n\t\t\tswap(parent, child);\r\n\t\t\tchild = parent;\r\n\t\t}\r\n\t}" ]
[ "0.6146999", "0.58816326", "0.58127826", "0.5765926", "0.56164277", "0.55463684", "0.5544384", "0.553412", "0.55154556", "0.54993886", "0.5432507", "0.5423959", "0.5408188", "0.54073375", "0.53935874", "0.53804004", "0.5363637", "0.535167", "0.5338305", "0.5335754", "0.5287573", "0.52857596", "0.5272122", "0.5267903", "0.52677345", "0.5261974", "0.5240956", "0.52182543", "0.5203854", "0.51880956", "0.5146235", "0.5119872", "0.51005036", "0.50795054", "0.5059959", "0.50163686", "0.50116706", "0.50081795", "0.5006126", "0.5003037", "0.5000631", "0.4994605", "0.49775872", "0.4977267", "0.4976695", "0.49744955", "0.4966261", "0.49474505", "0.49444848", "0.49402067", "0.49399853", "0.49385297", "0.4933797", "0.49211374", "0.49100095", "0.48853502", "0.48562035", "0.48527166", "0.48488566", "0.4845971", "0.48443648", "0.48267296", "0.4826306", "0.47829324", "0.47808218", "0.47777778", "0.47698465", "0.47650987", "0.4723013", "0.47089556", "0.4701295", "0.4699676", "0.46865198", "0.4686514", "0.4660846", "0.4658375", "0.46569923", "0.46457016", "0.4636766", "0.4623549", "0.4620176", "0.46161532", "0.45995295", "0.4599523", "0.45903635", "0.4582551", "0.45754826", "0.45716834", "0.4569596", "0.4558142", "0.4551019", "0.4545113", "0.4543313", "0.45349807", "0.45269537", "0.45205858", "0.45081952", "0.45071796", "0.45051113", "0.45048228" ]
0.54173964
12
Checks population for elite chromosome, or returns old elite if there are no challengers.
private int[] getElite(int[][] population) { float[] fitnesses = new float[population.length]; for (int i = 0; i < population.length; i++) { fitnesses[i] = getFitness(population[i]); if (fitnesses[i] < eliteFitness) { System.out.println(getFitness(eliteChromosome) + " old" + getFitness(population[i]) + " new"); eliteFitness = fitnesses[i]; eliteChromosome = population[i]; } } return eliteChromosome; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public ArrayList<Chromosome> getEliteChromosomes() {\n // SortedMap instead of HashMap? Duplicate key values? \n ArrayList<Chromosome> elites = new ArrayList<Chromosome>();\n// ArrayList<Chromosome> sortedList = this.getChromosomesSorted();\n boolean firstRun = true;\n\n //this.sort();\n Collections.sort(this.chromosomes);\n\n while (elites.size() < Defines.eliteCt) {\n for (Chromosome chromosome : this.chromosomes) {\n if (elites.size() < Defines.eliteCt) {\n if (firstRun && chromosome.isValid()) {\n elites.add(chromosome);\n } else {\n elites.add(chromosome);\n }\n }\n }\n firstRun = false;\n }\n return elites;\n }", "private void addElite(ArrayList<Chromosome> cOld, ArrayList<Chromosome> cNew){\n int index = cOld.size()-1;\n for(int i=0;i<numElite;i++){\n //Add eliteCopies copies of each elite\n for(int c=0;c<eliteCopies;c++){\n //If first, just add the original\n if(c==0){\n cNew.add(cOld.get(index));\n }\n //Else duplicate the original\n else{\n try {\n cNew.add(cOld.get(index).clone());\n } catch (CloneNotSupportedException ex) {\n Logger.getLogger(GeneFactory.class.getName()).log(Level.SEVERE, null, ex);\n }\n }\n }\n index--;\n //Add a failsafe in case it has been asked to get more elite than\n //there are chromosomes\n if(index<0){\n break;\n }\n }\n }", "public static Population evolvePopulation(Population pop) {\n Population newPopulation = new Population(pop.populationSize(), false);\n\n // Keep our best individual if elitism is enabled\n int elitismOffset = 0;\n if (elitism) {\n newPopulation.saveTour(0, pop.getFittest());\n elitismOffset = 1;\n }\n\n // Crossover population\n // Loop over the new population's size and create individuals from\n // Current population\n for (int i = elitismOffset; i < newPopulation.populationSize(); i++) {\n // Select parents\n // Tour parent1 = tournamentSelection(pop);\n //Tour parent2 = tournamentSelection(pop);\n\n\n\n\n Tour[] temp_a = roullet( newPopulation);\n if( temp_a == null )\n {\n System.out.println(\"no a\");\n //r//eturn temp;\n }\n // Tour parent1 = tournamentSelection(pop);\n //Tour parent2 = tournamentSelection(pop);\n Tour parent1 = temp_a[0];\n Tour parent2 = temp_a[1];\n\n\n\n\n\n\n\n\n // Crossover parents\n Tour child = crossover(parent1, parent2);\n // Add child to new population\n newPopulation.saveTour(i, child);\n }\n\n // Mutate the new population a bit to add some new genetic material\n for (int i = elitismOffset; i < newPopulation.populationSize(); i++) {\n mutate(newPopulation.getTour(i));\n }\n\n return newPopulation;\n }", "private boolean isOccupied(int col, int row) {\n if (_board[col][row] != EMP) {\n return true;\n }\n return false;\n }", "@Override\r\n\tpublic boolean getEtat(Population<T> population) {\r\n\t\tint current_generation = population.getCurrent_generation();\r\n\t\tif(current_generation>= critere) return false;\r\n\t\telse return true;\r\n\t}", "boolean isEelPosition(int bp) {\n\t\t\treturn EelsRepository.containsKey(bp);\n\t\t}", "public Population evolve()\r\n {\r\n\tArrayList<Chromosome> tempPop = \r\n\t new ArrayList<Chromosome>(chromos.size());\r\n\tChromosome u;\r\n\tChromosome v;\r\n\r\n\tfor(int i = 0; i < chromos.size()/2; i++)\r\n\t {\r\n\t\tu = selectParent();\r\n\t\tv = selectParent();\r\n\t\t\r\n\t\t//System.out.println(\"*****Parent 1 : \\n\" + v);\r\n\t\t\r\n Chromosome c1 = u.child(v);\r\n Chromosome c2 = v.child(u);\r\n\t\ttempPop.add(c1);\r\n\t\ttempPop.add(c2);\r\n\t\t\r\n //System.out.println(\"****Generated new child: \\n\" + c1);\r\n\t }\t \r\n\t\r\n\t// if needed, add in the code for keeping the best chromosome\r\n\tPopulation pop = new Population(tempPop, selMethod, selPara, \r\n\t\t\t\t\tcrossMethod, crossPara, mutMethod, mutPara, \r\n\t\t\t\t\treplaceMethod, replacePara, powerStep, tourStep, ff);\r\n\r\n\tif(replaceMethod == ELITISM)\r\n\t {\r\n\t\tpop.remove(worstChromoIndex);\r\n\t\tpop.add(bestChromo.clone());\r\n\t\tpop.initialize();\r\n\t }\r\n\r\n\tgeneration++;\r\n\treturn pop;\r\n }", "public Chromosome worstChromosome()\r\n {\r\n\treturn worstChromo.clone();\r\n }", "public static Predicate<BiomeSelectionContext> foundInOverworld() {\n\t\treturn context -> context.canGenerateIn(DimensionOptions.OVERWORLD);\n\t}", "private static int maximum() {\n\t\tint popSize = 0;\n\t\tChromosome thisChromo = null;\n\t\tChromosome thatChromo = null;\n\t\tint winner = 0;\n\t\tboolean foundNewWinner = false;\n\t\tboolean done = false;\n\n\t\twhile (!done) {\n\t\t\tfoundNewWinner = false;\n\t\t\tpopSize = population.size();\n\t\t\tfor (int i = 0; i < popSize; i++) {\n\t\t\t\tif (i != winner) { // Avoid self-comparison.\n\t\t\t\t\tthisChromo = population.get(i);\n\t\t\t\t\tthatChromo = population.get(winner);\n\t\t\t\t\tif (thisChromo.conflicts() > thatChromo.conflicts()) {\n\t\t\t\t\t\twinner = i;\n\t\t\t\t\t\tfoundNewWinner = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (foundNewWinner == false) {\n\t\t\t\tdone = true;\n\t\t\t}\n\t\t}\n\t\treturn winner;\n\t}", "public Pile getExhaustPile(){\n return piles.getExhaustPile();\n }", "public static Population evolve(Population p){\n Population evolvedPop = p;\n currentFittest = evolvedPop.getFittest();\n \n if(RunGA.elitism){\n // Preserve fittest x individuals in first indeces (elitism)\n elitismOffset = (int)Math.round(RunGA.elitismProportion*p.getSize());\n ArrayList<Tour> preserved = p.getXFittest(elitismOffset);\n for(int i=0; i<preserved.size(); i++){\n evolvedPop.setTour(i, preserved.get(i));\n }\n } else{\n elitismOffset = 0;\n }\n for(int i=elitismOffset; i<p.getSize(); i++){\n // Evaluation and Selection\n Tour parent1 = select(p);\n Tour parent2 = select(p);\n // Crossover\n Tour[] children = cross(parent1, parent2);\n for(int j=0; j<children.length; j++){\n evolvedPop.setTour(i, children[0]);\n // Adds both offspring if two are produced, otherwise adds the sole offspring\n if(children.length == 2){\n i++;\n if(i < evolvedPop.getSize()){\n evolvedPop.setTour(i, children[1]);\n } else{\n break;\n }\n }\n }\n }\n // Mutation\n mutation(evolvedPop);\n // Increment generation count\n evolvedPop.incrementGeneration();\n cumulativeFitness = null;\n return evolvedPop;\n }", "@Override\n public boolean equipped() {\n\treturn this.equipped;\n }", "private boolean checkSolutions() {\n\t\tfor (int i = 0; i < population; ++i) {\n\t\t\tif (populationArray.get(i).getFitness() == 0) {\n\t\t\t\tsolution = populationArray.get(i);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "public boolean isFull() {\n return this.chromosomes.size() >= Defines.popSize;\n }", "public void einde(){\n if(veld[speler.getY()][speler.getX()] == 6){\n System.exit(0);\n }\n }", "boolean hasE();", "boolean hasE();", "boolean setEyeColor(Gene gene){ \n\t\tif( gene.left.dominance && gene.right.dominance){ //RB\n\t\t\tthis.eyeColor = EyeColor.RED;\n\t\t\treturn true;\n\t\t} else if( gene.left.dominance ^ gene.right.dominance ){//hetero --> yellow\n\t\t\tthis.eyeColor = EyeColor.YELLOW; //needs to account for the two different kinds of Yellow\n\t\t\treturn true;\n\t\t} else if( !gene.left.dominance && !gene.right.dominance){ //rb --> blue\n\t\t\tthis.eyeColor = EyeColor.BLUE;\n\t\t\treturn true;\n\t\t} else{\n\t\t\tSystem.err.println(\"Error: Ugh, I can't believe you've done this.\");\n\t\t\treturn false;\n\t\t}\n\t\t\n\t}", "public Cave getUnoccupiedOpenLocation() {\n\t\tCave tempCave = null;\n\t\tboolean tempBool = true;\n\t\twhile(tempBool) {\n\t\t\tdouble i = Math.random() * row;\n\t\t\tdouble j = Math.random() * columns;\n\t\t\t\ttempCave = caveArray[(int) i][(int) j];\n\t\t\t\tif((int)i == row-1 && (int)j == columns-1) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (tempCave.isOccupied() == false && tempCave.isOpen())\n\t\t\t\t\treturn tempCave;\n\t\t\t}\n\t\t\n\t\treturn tempCave;\n\t\t\n\t}", "@Override\n public boolean hasHipCrit() {\n for (int loc = 0; loc < NUM_MECH_LOCATIONS; loc++) {\n if (legHasHipCrit(loc)) {\n return true;\n }\n }\n return false;\n }", "protected boolean hasGene(int innovation) {\n\t\treturn genes.containsKey(innovation);\n\t}", "public boolean e() {\n this.j.lock();\n try {\n if (this.h == null) {\n this.j.unlock();\n return false;\n }\n boolean z = !this.h.isEmpty();\n this.j.unlock();\n return z;\n } catch (Throwable th) {\n this.j.unlock();\n throw th;\n }\n }", "private boolean tryOverpopulation(int x, int y, Assignment assignment){\n\n\t\tif(getNeighborCount(x, y, assignment) >= 4)\n\t\t\treturn true;\n\n\t\treturn false;\n\t}", "@Override\n public boolean evaluate(CacheEntryEvent<? extends BinaryObject, ? extends BinaryObject> e) {\n if (!e.getOldValue().<Integer>field(\"population\").equals(\n e.getValue().<Integer>field(\"population\")))\n return true;\n\n // Don't send a notification in all other cases\n return false;\n }", "private boolean checkGreedyEnergy() {\r\n return myTotal.get(2) < 10 || (myTotal.get(2) < 13 && myTotal.get(2) <= enTotal.get(2));\r\n }", "private String buildEnergy() {\r\n List<Integer> emptyCellsPos0 = new ArrayList<Integer>();\r\n List<Integer> emptyCellsPos1 = new ArrayList<Integer>();\r\n for(int i = 0; i < gameHeight; i++) {\r\n if (myLaneInfo.get(i).get(4).isEmpty()) {\r\n if (myLaneInfo.get(i).get(3).contains(0)) {\r\n emptyCellsPos0.add(i);\r\n }\r\n if (myLaneInfo.get(i).get(3).contains(1)) {\r\n emptyCellsPos1.add(i);\r\n }\r\n }\r\n }\r\n if (!emptyCellsPos0.isEmpty()) {\r\n return ENERGY.buildCommand(0,getRandomElementOfList(emptyCellsPos0));\r\n } else if (!emptyCellsPos1.isEmpty()) {\r\n return ENERGY.buildCommand(1,getRandomElementOfList(emptyCellsPos1));\r\n } else if (canBuy(ATTACK)) {\r\n return buildTurret();\r\n } else {\r\n return doNothingCommand();\r\n }\r\n }", "private void calculerChemin() {\n suiteDeDeplacement.clear();\n int[][] empreinte = lab.getEmpreinte();\n lee(empreinte, x / Case.TAILLE, y / Case.TAILLE, cibleX, cibleY);\n }", "public StateEbo getOffCampusState() {\n if ( StringUtils.isBlank(KFSConstants.COUNTRY_CODE_UNITED_STATES ) || StringUtils.isBlank(offCampusStateCode) ) {\n offCampusState = null;\n } else {\n if ( offCampusState == null || !StringUtils.equals( offCampusState.getCountryCode(), KFSConstants.COUNTRY_CODE_UNITED_STATES)|| !StringUtils.equals( offCampusState.getCode(), offCampusStateCode)) {\n ModuleService moduleService = SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(StateEbo.class);\n if ( moduleService != null ) {\n Map<String,Object> keys = new HashMap<String, Object>(2);\n keys.put(LocationConstants.PrimaryKeyConstants.COUNTRY_CODE, offCampusCountryCode);\n keys.put(LocationConstants.PrimaryKeyConstants.CODE, offCampusStateCode);\n offCampusState = moduleService.getExternalizableBusinessObject(StateEbo.class, keys);\n } else {\n throw new RuntimeException( \"CONFIGURATION ERROR: No responsible module found for EBO class. Unable to proceed.\" );\n }\n }\n }\n \n return offCampusState;\n }", "@Test\n\tpublic void testGehituErabiltzaile() {\n\t\tErabiltzaileLista.getErabiltzaileLista().erreseteatuErabiltzaileLista();\t\t\n\t\tErabiltzaileLista.getErabiltzaileLista().gehituErabiltzaile(\"Martin\", \"123456\",\"123456\");\n\t\tassertEquals(1, ErabiltzaileLista.getErabiltzaileLista().erabiltzaileKop());\n\t\tErabiltzaileLista.getErabiltzaileLista().gehituErabiltzaile(\"Mikel\", \"123456\",\"123456\");\n\t\tassertEquals(2,ErabiltzaileLista.getErabiltzaileLista().erabiltzaileKop());\n\t\tErabiltzaileLista.getErabiltzaileLista().gehituErabiltzaile(\"Martin\", \"123456\",\"123456\");\n\t\tassertEquals(2, ErabiltzaileLista.getErabiltzaileLista().erabiltzaileKop());\n\t}", "private void nourrireLePeuple() {\n\t\t\tint totalDepense = (int)((population * 1) + (populationColoniale * 0.8) + ((armee + armeeDeployee()) * nourritureParArmee));\r\n\t\t\tnourriture -= totalDepense;\r\n\t\t\tenFamine = (nourriture > 0) ? false : true;\r\n\t\t}", "public boolean isOpen(int row, int col) {\n check(row, col);\n return sites[row - 1][col - 1];\n }", "public boolean live(int row, int col) {\n boolean life = false; //set initial life to false\r\n int neighbours = numberAround(row, col); //find the number of neighbours around cell\r\n if (neighbours < 2 || neighbours > 3) { //if the neighbours are less than two or greater than three the cell dies\r\n life = false;\r\n } else if (neighbours == 2) { //if neighbours is true than conditions remain the same\r\n life = grid[row][col];\r\n } else if (neighbours == 3) { //if the neighbours are three then a dead cell would become alive\r\n life = true;\r\n }\r\n\r\n return life; // life death status\r\n }", "public void findExpressedGenes(){\n\t\tHashMap exp = new HashMap();\n\t\t//instantiate Bar parser\n\t\tScoreParsedBars barParser = new ScoreParsedBars (barDirectory, bpPositionOffSetBar, bpPositionOffSetRegion);\n\t\t//for each chromosome in select\n\t\tIterator it = genesSelect.keySet().iterator();\n\t\twhile (it.hasNext()){\n\t\t\t//get genes\n\t\t\tString chrom = (String)it.next();\n\t\t\tUCSCGeneLine[] chrGenes = (UCSCGeneLine[])genesSelect.get(chrom);\n\t\t\tSystem.out.println(\"\\tTotal \"+chrom+\"\\t\"+ chrGenes.length);\n\t\t\t//calculate medians\n\t\t\tbarParser.calculateMedians(chrGenes);\n\t\t\tArrayList expressedGenes = new ArrayList();\n\t\t\t//for each gene look for intersection after expanding\n\t\t\tfor (int i=0; i< chrGenes.length; i++){\n\t\t\t\tif (chrGenes[i].getScores()[0] >= threshold ) {\n\t\t\t\t\texpressedGenes.add(chrGenes[i]);\n\t\t\t\t\t//System.out.println(chrGenes[i].simpleToString()+ chrGenes[i].getScore());\n\t\t\t\t}\n\t\t\t}\n\t\t\t//convert ArrayList to array and replace in hash\n\t\t\tchrGenes = new UCSCGeneLine[expressedGenes.size()];\n\t\t\texpressedGenes.toArray(chrGenes);\n\t\t\tSystem.out.println(\"\\tExpressed \"+chrom+\"\\t\"+ chrGenes.length);\n\t\t\texp.put(chrom, chrGenes);\n\t\t}\n\t\tgenesSelect = exp;\n\t}", "private void findChest() {\n\t\tchar[][] location = game.getPlayingmap().getLocation();\n//\t\tFighter fighter = (Fighter)game.getPlayingmap().getCellsinthemap()[character.xOfFighter][character.yOfFighter].getContent();\n\n\t\tif(character.xOfFighter-1>=0&&location[character.xOfFighter-1][character.yOfFighter]=='c'){\n\t\t\tChest chest = (Chest)game.getPlayingmap().getCellsinthemap()[character.xOfFighter-1][character.yOfFighter].getContent();\n\t\t\tcharacter.openChest(chest);\n\t\t\tif(chest.isEmpty()){\n\t\t\t\tgame.getPlayingmap().changeLocation(character.xOfFighter-1, character.yOfFighter, 'e');\n\t\t\t}\n\t\t}\n\t\telse if(character.xOfFighter+1<game.getPlayingmap().getRow()&&location[character.xOfFighter+1][character.yOfFighter]=='c'){\n\t\t\tChest chest = (Chest)game.getPlayingmap().getCellsinthemap()[character.xOfFighter+1][character.yOfFighter].getContent();\n\t\t\tcharacter.openChest(chest);\n\t\t\tif(chest.isEmpty()){\n\t\t\t\tgame.getPlayingmap().changeLocation(character.xOfFighter+1, character.yOfFighter, 'e');\n\t\t\t}\n\t\t}\n\t\telse if(character.yOfFighter-1>=0&&location[character.xOfFighter][character.yOfFighter-1]=='c'){\n\t\t\tChest chest = (Chest)game.getPlayingmap().getCellsinthemap()[character.xOfFighter][character.yOfFighter-1].getContent();\n\t\t\tcharacter.openChest(chest);\n\t\t\tif(chest.isEmpty()){\n\t\t\t\tgame.getPlayingmap().changeLocation(character.xOfFighter, character.yOfFighter-1, 'e');\n\t\t\t}\n\t\t}\n\t\telse if(character.yOfFighter+1<game.getPlayingmap().getColumn()&&location[character.xOfFighter][character.yOfFighter+1]=='c'){\n\t\t\tChest chest = (Chest)game.getPlayingmap().getCellsinthemap()[character.xOfFighter][character.yOfFighter+1].getContent();\n\t\t\tcharacter.openChest(chest);\n\t\t\tif(chest.isEmpty()){\n\t\t\t\tgame.getPlayingmap().changeLocation(character.xOfFighter, character.yOfFighter+1, 'e');\n\t\t\t}\n\t\t}\n\t}", "public boolean isOpen(int row, int col){\n\t\tif (row <= 0 || col <= 0 || row > storeVar || col > storeVar)\n\t\t\tthrow new IllegalArgumentException(\"row index i out of bounds\");\n\n\t\treturn grid[(row-1)*storeVar + (col)];\n\t}", "public Chromosome bestChromosome()\r\n {\r\n\treturn bestChromo.clone();\r\n }", "public void evolve_enviroment() {\r\n\r\n // this.main_population.update_population();\r\n // get the indices of the best individual in the main population\r\n int main_pop_best = this.main_population.getBest_indices();\r\n\r\n // create a new individua with the genes of the best individual\r\n this.pop_best = new individual(this.main_population.getPopulation()[main_pop_best].getGenes(), solutions, output); // best individual in population\r\n\r\n // perform selection, crossover and mutation\r\n this.roulette_selection();\r\n this.crossover();\r\n this.mutate(this.prob);\r\n this.tournament_selection(); // survivor selection\r\n\r\n // find the indices of the worst individual and replace it with the best from the last generation\r\n this.main_population.setIndividual(pop_best, this.main_population.find_Worst_indicies());\r\n this.main_population.update_population();\r\n\r\n }", "private void enemyMove() {\n\n\t\tboolean goAgain = false;\n\n\t\tint x = (int) (Math.random() * 10);\n\t\tint y = (int) (Math.random() * 10);\n\n\t\t// Make sure the enemy hits in a checkerboard pattern.\n\t\tif (x % 2 == 0) { // if x is even, y should be odd\n\t\t\tif (y % 2 == 0) {\n\t\t\t\tif (y + 1 < 10)\n\t\t\t\t\ty++;\n\t\t\t\telse\n\t\t\t\t\ty--;\n\t\t\t}\n\t\t} else { // if x is odd, y should be even\n\t\t\tif (y % 2 == 1)\n\t\t\t\tif (y + 1 < 10)\n\t\t\t\t\ty++;\n\t\t\t\telse\n\t\t\t\t\ty--;\n\t\t}\n\n\t\tif (enemyLastShotHit && getDifficulty() > 0) { // /if last shot was a\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// hit, enemy\n\t\t\t// will try to\n\t\t\t// check around it only run if difficulty is\n\t\t\t// normal or above\n\t\t\tx = enemyLastHitX;\n\t\t\ty = enemyLastHitY;\n\n\t\t\tif (getDifficulty() != 2) {\n\n\t\t\t\tif (conflictX == 4) {\n\t\t\t\t\tconflictX = 0;\n\t\t\t\t} else if (conflictY == 4) {\n\t\t\t\t\tconflictY = 0;\n\t\t\t\t\t// System.out.println(\"conflict has been reset \");\n\t\t\t\t}\n\n\t\t\t\tif (conflictX != 0) {\n\t\t\t\t\tif (conflictX == 1)\n\t\t\t\t\t\tx++;\n\t\t\t\t\telse {\n\t\t\t\t\t\tx--;\n\t\t\t\t\t}\n\t\t\t\t\tenemyLastHitX = x;\n\t\t\t\t\tenemyLastHitY = y;\n\t\t\t\t\tconflictX = 4;\n\t\t\t\t} else if (conflictY == 1) {\n\t\t\t\t\t// System.out.println(\"checking down\");\n\t\t\t\t\tconflictY = 4;\n\t\t\t\t\ty++;\n\t\t\t\t}\n\n\t\t\t\tif (x + 1 < 10 && x - 1 >= 0) {// branch for multiple hits\n\t\t\t\t\tif (egrid[x + 1][y] == 1 && egrid[x - 1][y] == 1) {\n\t\t\t\t\t\t// System.out.println(\"conflict at \"+ex+\",\"+ey);\n\t\t\t\t\t\tenemyLastHitX = x;\n\t\t\t\t\t\tenemyLastHitY = y;\n\t\t\t\t\t\tif (x + 2 < 10) {\n\t\t\t\t\t\t\tif (egrid[x + 2][y] == 1) {\n\t\t\t\t\t\t\t\tconflictX = 1;\n\t\t\t\t\t\t\t\tx--;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tconflictX = 2;\n\t\t\t\t\t\t\t\tx++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconflictX = 2;\n\t\t\t\t\t\t\tx++;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (y + 1 < 10 && y - 1 >= 0) {// branch for multiple vertical\n\t\t\t\t\t\t\t\t\t\t\t\t// hits\n\t\t\t\t\tif (egrid[x][y + 1] == 1 && egrid[x][y - 1] == 1) {\n\t\t\t\t\t\t// System.out.println(\"conflict at \"+ex+\",\"+ey);\n\t\t\t\t\t\tenemyLastHitX = x;\n\t\t\t\t\t\tenemyLastHitY = y;\n\t\t\t\t\t\tconflictY = 1;\n\t\t\t\t\t\ty--;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (conflictX == 0 && conflictY == 0) {\n\n\t\t\t\t\tif (checkDirection == 0) // checks in each direction\n\t\t\t\t\t\tx++;\n\t\t\t\t\telse if (checkDirection == 1)\n\t\t\t\t\t\tx--;\n\t\t\t\t\telse if (checkDirection == 2)\n\t\t\t\t\t\ty++;\n\t\t\t\t\telse if (checkDirection == 3) {\n\t\t\t\t\t\ty--;\n\t\t\t\t\t\tenemyLastShotHit = false;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (x < 0) // making sure coordinates stay within bounds\n\t\t\t\t\t\tx = 0;\n\t\t\t\t\telse if (x > 9)\n\t\t\t\t\t\tx = 9;\n\t\t\t\t\tif (y < 0)\n\t\t\t\t\t\ty = 0;\n\t\t\t\t\telse if (y > 9)\n\t\t\t\t\t\ty = 9;\n\t\t\t\t}\n\t\t\t} // medium diff\n\n\t\t\telse if (getDifficulty() == 2) {// hard difficulty\n\t\t\t\t// gives enemy unfair advantage\n\n\t\t\t\tif (conflictX == 4)\n\t\t\t\t\tconflictX = 0;\n\t\t\t\tif (conflictY == 4)\n\t\t\t\t\tconflictY = 0;\n\n\t\t\t\tif (conflictX != 0) {\n\t\t\t\t\tif (conflictX == 1)\n\t\t\t\t\t\tx++;\n\t\t\t\t\telse {\n\t\t\t\t\t\tx--;\n\t\t\t\t\t}\n\t\t\t\t\tenemyLastHitX = x;\n\t\t\t\t\tenemyLastHitY = y;\n\t\t\t\t\tconflictX = 4;\n\t\t\t\t} else if (conflictY == 1) {\n\t\t\t\t\tconflictY = 4;\n\t\t\t\t\ty++;\n\t\t\t\t}\n\n\t\t\t\tif (x + 1 < 10 && x - 1 >= 0) {// branch for multiple hits\n\t\t\t\t\tif (egrid[x + 1][y] == 1 && egrid[x - 1][y] == 1) {\n\t\t\t\t\t\t// System.out.println(\"conflict at \"+ex+\",\"+ey);\n\t\t\t\t\t\tenemyLastHitX = x;\n\t\t\t\t\t\tenemyLastHitY = y;\n\t\t\t\t\t\tif (x + 2 < 10) {\n\t\t\t\t\t\t\tif (egrid[x + 2][y] == 1) {\n\t\t\t\t\t\t\t\tconflictX = 1;\n\t\t\t\t\t\t\t\tx--;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tconflictX = 2;\n\t\t\t\t\t\t\t\tx++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconflictX = 2;\n\t\t\t\t\t\t\tx++;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (y + 1 < 10 && y - 1 >= 0) {// branch for multiple vertical\n\t\t\t\t\t\t\t\t\t\t\t\t// hits\n\t\t\t\t\tif (egrid[x][y + 1] == 1 && egrid[x][y - 1] == 1) {\n\t\t\t\t\t\t// System.out.println(\"conflict at \"+ex+\",\"+ey);\n\t\t\t\t\t\tenemyLastHitX = x;\n\t\t\t\t\t\tenemyLastHitY = y;\n\t\t\t\t\t\tconflictY = 1;\n\t\t\t\t\t\ty--;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (conflictX == 0 && conflictY == 0) {\n\t\t\t\t\tif (y + 1 < 10) {\n\t\t\t\t\t\tif (egrid[x][y + 1] == 1)// if y+1 is a hit and it is\n\t\t\t\t\t\t\t\t\t\t\t\t\t// within bounds, it will go\n\t\t\t\t\t\t\t\t\t\t\t\t\t// there\n\t\t\t\t\t\t\ty++;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (y - 1 >= 0) {\n\t\t\t\t\t\tif (egrid[x][y - 1] == 1)\n\t\t\t\t\t\t\ty--;\n\t\t\t\t\t}\n\t\t\t\t\tif (x + 1 < 10) {\n\t\t\t\t\t\tif (egrid[x + 1][y] == 1)\n\t\t\t\t\t\t\tx++;\n\t\t\t\t\t}\n\t\t\t\t\tif (x - 1 >= 0) {\n\t\t\t\t\t\tif (egrid[x - 1][y] == 1) {\n\t\t\t\t\t\t\tx--;\n\t\t\t\t\t\t\tenemyLastShotHit = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t} // hard diff\n\t\t\tcheckDirection++;\n\t\t} // lasthit\n\n\t\tint tryCount = 0;\n\t\twhile (egrid[x][y] == 3) { // makes sure enemy doesn't hit same spot\n\t\t\t\t\t\t\t\t\t// twice\n\t\t\tx = (int) (Math.random() * 10);\n\t\t\ty = (int) (Math.random() * 10);\n\t\t\tif (tryCount < 20 && getDifficulty() > 0) {\n\t\t\t\tif (x % 2 == 0) { // if x is even, y should be odd\n\t\t\t\t\tif (y % 2 == 0) { // for checkerboard pattern\n\t\t\t\t\t\tif (y + 1 < 10)\n\t\t\t\t\t\t\ty++;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\ty--;\n\t\t\t\t\t}\n\t\t\t\t} else { // if x is odd, y should be even\n\t\t\t\t\tif (y % 2 == 1)\n\t\t\t\t\t\tif (y + 1 < 10)\n\t\t\t\t\t\t\ty++;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\ty--;\n\t\t\t\t}\n\t\t\t}\n\t\t\ttryCount++;\n\t\t}\n\n\t\tif (egrid[x][y] == 1) { // hit branch\n\t\t\tenemyBoard[x][y].setIcon(createImageIcon(\"tilehit.jpg\"));\n\t\t\tstatus.setText(\" Enemy got a hit\");\n\t\t\tenemyLastShotHit = true; // starts ai\n\t\t\tcheckDirection = 0;\n\t\t\tif (conflictX == 0 && conflictY == 0) {\n\t\t\t\tenemyLastHitX = x; // stores x and y values\n\t\t\t\tenemyLastHitY = y;\n\t\t\t}\n\t\t\tehits--; // keeps score\n\t\t}\n\n\t\telse if (egrid[x][y] == 2) { // poweup branch\n\t\t\tenemyBoard[x][y].setIcon(createImageIcon(\"tilepower.jpg\"));\n\t\t\tstatus.setText(\" Enemy got a PowerUp\");\n\t\t\tgoAgain = true;\n\t\t}\n\n\t\telse\n\t\t\t// miss branch\n\t\t\tenemyBoard[x][y].setIcon(createImageIcon(\"tilemiss.jpg\"));\n\n\t\tegrid[x][y] = 3;\n\n\t\tcheckEnemyWin();\n\n\t\tif (goAgain)\n\t\t\tenemyMove();\n\n\t}", "public boolean hasE() {\n return fieldSetFlags()[4];\n }", "public boolean encountered(){\n boolean encounter = false;\n\n int stepsNeeded = player.getDestination().getStepsNeeded();\n\n float percent = (chance * 1.0f / stepsNeeded * 1.0f) * 100;\n float result = r.nextFloat() * 100;\n\n if(result <= percent && percent >= 20) {\n encounter = true;\n }\n\n return encounter;\n }", "private void consumeEnergyIfExist() {\n\n\t\tif (newPlayerCell.isHasEnergy()) {\n\t\t\tGame.getPlayer().getExperience().addStars(1);\n\t\t\tnewPlayerCell.setHasEnergy(false);\n\t\t\tnewPlayerCell.setType(RealmCellType.EMPTY);\n\t\t}\n\t}", "public void findIsolatedGenes(){\n\t\tHashMap isolated = new HashMap();\n\t\t//for each chromosome\n\t\tIterator it = genesSelect.keySet().iterator();\n\t\twhile (it.hasNext()){\n\t\t\tString chrom = (String)it.next();\n\t\t\tUCSCGeneLine[] chrGenesAll = (UCSCGeneLine[])genesAll.get(chrom);\n\t\t\tUCSCGeneLine[] chrGenesSelect = (UCSCGeneLine[])genesSelect.get(chrom);\n\t\t\tSystem.out.println(\"\\tTotal \"+chrom+\"\\t\"+ chrGenesSelect.length);\n\t\t\tArrayList isolatedGenes = new ArrayList();\n\t\t\t//for each gene look for intersection after expanding\n\t\t\tfor (int i=0; i< chrGenesSelect.length; i++){\n\t\t\t\t//expand size of gene\n\t\t\t\tint start = chrGenesSelect[i].getTxStart() - extension;\n\t\t\t\tint end = chrGenesSelect[i].getTxEnd() + extension;\n\t\t\t\t//scan all, allow one hit\n\t\t\t\tint hits = 0;\n\t\t\t\tfor (int j =0; j< chrGenesAll.length; j++){\n\t\t\t\t\tif (intersects (chrGenesAll[j], start, end)) {\n\t\t\t\t\t\thits++; \n\t\t\t\t\t\tif (hits >1) break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//save?\n\t\t\t\tif (hits < 2){\n\t\t\t\t\tisolatedGenes.add(chrGenesSelect[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t//convert ArrayList to array and replace in hash\n\t\t\tchrGenesSelect = new UCSCGeneLine[isolatedGenes.size()];\n\t\t\tisolatedGenes.toArray(chrGenesSelect);\n\t\t\tSystem.out.println(\"\\tIsolated \"+chrom+\"\\t\"+ chrGenesSelect.length);\n\t\t\tisolated.put(chrom, chrGenesSelect);\n\t\t}\n\t\tgenesSelect = isolated;\n\t\t//clean up\n\t\tgenesAll = null;\n\t\tSystem.gc();\n\t}", "public void checkEnemy() {\n\t\tif (enemy != null)\n\t\tif (Integer.parseInt(getCurrentPositionX()) == enemy.getCurrentPositionX() && Integer.parseInt(getCurrentPositionY()) == enemy.getCurrentPositionY()) {\n\t\t\tx = spawnX;\n\t\t\ty = spawnY;\n\t\t}\n\t}", "private static void checkForEnemies() throws GameActionException {\n //No need to hijack code for structure\n if (rc.isWeaponReady()) {\n // basicAttack(enemies);\n HQPriorityAttack(enemies, attackPriorities);\n }\n \n //Old splash damage code\n //Preserve because can use to improve current splash damage code\n //But not so simple like just checking directions, since there are many more \n //locations to consider hitting.\n /*if (numberOfTowers > 4) {\n //can do splash damage\n RobotInfo[] enemiesInSplashRange = rc.senseNearbyRobots(37, enemyTeam);\n if (enemiesInSplashRange.length > 0) {\n int[] enemiesInDir = new int[8];\n for (RobotInfo info: enemiesInSplashRange) {\n enemiesInDir[myLocation.directionTo(info.location).ordinal()]++;\n }\n int maxDirScore = 0;\n int maxIndex = 0;\n for (int i = 0; i < 8; i++) {\n if (enemiesInDir[i] >= maxDirScore) {\n maxDirScore = enemiesInDir[i];\n maxIndex = i;\n }\n }\n MapLocation attackLoc = myLocation.add(directions[maxIndex],5);\n if (rc.isWeaponReady() && rc.canAttackLocation(attackLoc)) {\n rc.attackLocation(attackLoc);\n }\n }\n }//*/\n \n }", "private static void calculateFitnessOfPopulation(ArrayList<Chromosome> population) {\n for (Chromosome chromosome : population) {\n // if the fitness of the chromosome has not yet been calculated (i.e. is still -1)\n fitnessFunction(chromosome);\n }\n }", "public boolean checkTie() {\n if (winner == null) {\n int counter = 0;\n for (int col = 0; col < _board.length; col += 1) {\n for (int row = 0; row < _board.length; row += 1) {\n if (_board[col][row] == EMP) {\n counter += 1;\n }\n }\n }\n if (counter == 0) {\n tie = true;\n return true;\n }\n }\n return false;\n }", "protected boolean isOccupied(int row, int column){\n return (!ships[row][column].getShipType().equals(\"empty\"));\n }", "public PiecePenguin layEgg(){\n // if this piece hasn't laid max eggs yet - allow it create new piece\n if( this.numEggs < MAX_EGGS){\n this.incrementNumEggs();\n // this creates a new piece that has not laid any eggs\n // and has not attacked any pieces yet it will belong to this team so pass in Color\n return new PiecePenguin(this.symbol, this.color,0,0);\n }\n else{\n return null;\n }\n }", "public boolean is_full(){\n return this.habitant.size() >= Constantes.HOUSE_FULL;\n }", "public boolean isFull(int row, int col){\n\t\tif (row <= 0 || col <= 0 || row > storeVar || col > storeVar) \n\t\t\tthrow new IllegalArgumentException(\"row index i out of bounds\");\n\n\t\tint currIndex = ((row-1)*storeVar) + (col);\n\n\t\tif(backwash.connected(virtualTop, currIndex)){\n\t\t\tSystem.out.println(\"Filled in new \" + row + \"\\t\" + col);\n\t\t\tfullgrid[currIndex] = true;\n\t\t}\n\n\t\treturn fullgrid[currIndex];\n\t}", "private static void getFitness() {\n\t\tint popSize = population.size();\n\t\tChromosome thisChromo = null;\n\t\tdouble bestScore = 0;\n\t\tdouble worstScore = 0;\n\n\t\t// The worst score would be the one with the highest energy, best would be\n\t\t// lowest.\n\t\tworstScore = population.get(maximum()).conflicts();\n\n\t\t// Convert to a weighted percentage.\n\t\tbestScore = worstScore - population.get(minimum()).conflicts();\n\n\t\tfor (int i = 0; i < popSize; i++) {\n\t\t\tthisChromo = population.get(i);\n\t\t\tthisChromo.fitness((worstScore - thisChromo.conflicts()) * 100.0 / bestScore);\n\t\t}\n\n\t\treturn;\n\t}", "private boolean isEnemyOccupied(int x, int y) {\n for (int i = 0; i < player.own.length; i++) {\n if (player.enemy[i].x == x && player.enemy[i].y == y) {\n System.out.println(\"enemy occupied:\" + i);\n return true;\n }\n }\n return false;\n }", "private static int minimum() {\n\t\tint popSize = 0;\n\t\tChromosome thisChromo = null;\n\t\tChromosome thatChromo = null;\n\t\tint winner = 0;\n\t\tboolean foundNewWinner = false;\n\t\tboolean done = false;\n\n\t\twhile (!done) {\n\t\t\tfoundNewWinner = false;\n\t\t\tpopSize = population.size();\n\t\t\tfor (int i = 0; i < popSize; i++) {\n\t\t\t\tif (i != winner) { // Avoid self-comparison.\n\t\t\t\t\tthisChromo = population.get(i);\n\t\t\t\t\tthatChromo = population.get(winner);\n\t\t\t\t\tif (thisChromo.conflicts() < thatChromo.conflicts()) {\n\t\t\t\t\t\twinner = i;\n\t\t\t\t\t\tfoundNewWinner = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (foundNewWinner == false) {\n\t\t\t\tdone = true;\n\t\t\t}\n\t\t}\n\t\treturn winner;\n\t}", "private void enemyEncounter()\n {\n currentEnemies = currentRoom.getEnemies();\n \n if(currentEnemies.size() > 0)\n {\n for(Enemy e : currentEnemies)\n {\n System.out.println(\"\\n\" + \"A \" + e.getName() + \" stares menacingly!\" + \"\\n\");\n enemyName = e.getName();\n \n }\n enemyPresent = true;\n clearExits();\n }\n else{\n setExits(); \n }\n }", "private Cell searchPowerUp() {\n for (Cell[] row : gameState.map) {\n for (Cell column : row) {\n if (column.powerUp != null)\n return column;\n }\n }\n\n return null;\n }", "public void placerEauSurVue() {\n\t\tif (partie.getJoueur().getIndiceBateauEnCours() != -1) {\n\t\t\tfor (int i : partie.getJoueur().getBateau()[partie.getJoueur().getIndiceBateauEnCours()].getCaseOnId()) {\n\t\t\t\tif (i != -1)\n\t\t\t\t\tvue.setWater(i);\n\t\t\t}\n\t\t}\n\t}", "private static ArrayList<Chromosome> evolvePopulation(ArrayList<Chromosome> currentGeneration, int populationSize,\n ArrayList<City> cities, int pathLength) {\n // declare a Set of Chromosomes which will store the Chromosomes that will be present in the next generation\n // ( i.e.the fittest )\n Set<Chromosome> nextGeneration = new HashSet<>();\n\n // add another set of nearest neighbour + randomly generated chromosomes to re-introduce diversity\n // and thus avoiding getting caught on local maxima\n currentGeneration.addAll(generatePopulation(cities, pathLength, populationSize));\n // calculate the fitness of all the Chromosomes in the population\n calculateFitnessOfPopulation(currentGeneration);\n // sort the population so that the chromosomes with the highest fitness are at the start of the list\n Collections.sort(currentGeneration);\n\n // keep adding chromosomes from the fittest of the currentGeneration until either the required population size is reached\n // or before an out of bounds occurs (i.e. not enough non-duplicate chromosomes\n int i = 0;\n while (nextGeneration.size() < populationSize && i < currentGeneration.size()) {\n nextGeneration.add(currentGeneration.get(i));\n i++;\n }\n\n // if the population size of the next generation is less than what it should be\n while (nextGeneration.size() < populationSize) {\n // keep adding an 'initial' population until it is of the required size\n nextGeneration.addAll(generatePopulation(cities, pathLength, populationSize-nextGeneration.size()));\n }\n\n return new ArrayList<>(nextGeneration);\n }", "public boolean needsRepair() {\n if (id == 5509) {\n return false;\n }\n return inventory.contains(id + 1);\n }", "private int[][] replaceLowestFitness(int[][] population, ArrayList<int[]> replacers) {\n\t\tfloat[] fitnesses = new float[population.length];\n\t\tfor (int i = 0; i < population.length; i++) {\n\t\t\tfitnesses[i] = getFitness(population[i]);\n\t\t}\n\n\t\t//find worst chromosomes around\n\t\tArrayList<Integer> worstFitnessesIndexes = new ArrayList<Integer>();\n\t\tfloat[] fitnessesSorted = fitnesses.clone();\n\t\tArrays.sort(fitnessesSorted);\n\t\tfor (int i = 0; i < population.length; i++) {\n\t\t\tfor (int j = 0; j < replacers.size() + 1; j++) {\n\t\t\t\tif (fitnesses[i] <= fitnessesSorted[j]) {\n\t\t\t\t\tworstFitnessesIndexes.add(new Integer(i));\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (worstFitnessesIndexes.size() > replacers.size() + 1) //only find as many bad chromosomes as we have replacements\n\t\t\t\tbreak;\n\t\t}\n\n\t\tfor (int i = 0; i < replacers.size(); i++) {\n\t\t\tint[] replacer = replacers.get(i);\n\t\t\tpopulation[worstFitnessesIndexes.get(i)] = replacer; //replace worst fitnesses with replacements\n\t\t}\n\n\t\tpopulation[worstFitnessesIndexes.get(replacers.size())] = eliteChromosome; //make sure elite stays\n\t\treturn population;\n\t}", "private int checkColumna(int column, Gene[] gene) {\n // System.out.print(\"col \" + column + \":\");\n // System.out.print(row + \":\");\n list.clear();\n int v;\n for (int i = 0; i < nn; i++) {\n v = (Integer) gene[c.campo(i, column)].getAllele();\n list.set(v - 1);//tengo v en la fila\n }\n int zeros = 0;//a quien no tengo\n for (int i = 0; i < nn; i++) {\n if (!list.get(i)) {\n zeros++;\n }\n }\n return zeros;\n }", "public boolean checkForLotus(){\n Object obj=charactersOccupiedTheLocation[2];\n if(obj!=null){return true;}\n return false;\n }", "public boolean isOpen(int row, int col) {\n if (row - 1 >= grid.length || col - 1 >= grid.length || row - 1 < 0 || col - 1 < 0) {\n throw new IllegalArgumentException(\"index is out of boundary.\");\n }\n return grid[row - 1][col - 1];\n }", "public static Predicate<BiomeSelectionContext> foundInTheEnd() {\n\t\treturn context -> context.canGenerateIn(DimensionOptions.END);\n\t}", "boolean gameOver() {\n return piecesContiguous(BP) || piecesContiguous(WP);\n }", "private Pair decideMovement(Entity e) {\n Pair pos = gameMap.getCoordinatesFor(e.getId());\n Movable movable = mm.get(e);\n Array<Pair> reachableCells = gameMap.pathFinder.getReachableCells(pos.x, pos.y, movable);\n ImmutableBag<Integer> enemies = groupAI.getEnemies(e);\n if (enemies.size() == 0) return reachableCells.get(MathUtils.random(reachableCells.size-1));\n\n // The best enemy you are considering chasing and its score\n int targetEnemy = -1;\n float bestScore = 0f;\n\n // The current enemy you are checking out and its score\n int id;\n float score;\n\n // How far away is the enemy? How many enemies are within a small radius of it?\n int distance, count;\n\n for (int i = 0; i < enemies.size(); i++) {\n count = 1;\n Pair target = gameMap.getCoordinatesFor(enemies.get(i));\n distance = MapTools.distance(pos.x, pos.y, target.x, target.y);\n for (Pair cell : MapTools.getNeighbors(target.x, target.y, 6)) {\n id = gameMap.getEntityAt(cell.x, cell.y);\n if (!enemies.contains(id)) continue;\n count++;\n }\n\n score = groupAI.entityScores.get(enemies.get(i)) * count / (1 + distance / 5);\n if (score > bestScore) {\n bestScore = score;\n targetEnemy = enemies.get(i);\n }\n }\n\n if (targetEnemy > -1) {\n Pair target = gameMap.getCoordinatesFor(targetEnemy);\n Path path = gameMap.pathFinder.findPath(pos.x, pos.y, target.x, target.y, movable, true);\n for (int i = 0; i < path.getLength(); i++) {\n Step step = path.getStep(i);\n Pair p = new Pair(step.getX(),step.getY());\n if (reachableCells.contains(p, false)) return p;\n }\n }\n return reachableCells.get(MathUtils.random(reachableCells.size-1));\n }", "public boolean isFull(int row, int col){\n\t\tint index= transformInput(row,col);\n\t\treturn (grid.connected(0, index) && openSites[index]);\n\t}", "@Test(expected = IllegalArgumentException.class)\n public void buildAgainFalse() {\n nextWorkerCell.setLevel(0);\n workerHephaestus.setCurrentWorkerCell(baseWorkerCell);\n workerHephaestus.build(nextWorkerCell);\n //provo a fagli costruire su una cella diversa da nextWorkerCell (non puo!)\n workerHephaestus.specialPower(otherCell);\n assertEquals(1, nextWorkerCell.getLevel());\n assertEquals(0, otherCell.getLevel());\n }", "private void coverExistingValues() \n {\n for(int i = 1; i <= gDim; i++)\n {\n for(int j = 1; j <= gDim; j++)\n {\n //If the board has a value at the current position, cover the satisfied rows and columns\n if(board[i - 1][j - 1] != null)\n {\n int rowIndex = rcvToMatrixRow(i, j, board[i - 1][j - 1]);\n coverSatisfiedColumns(ecmCoveredCols, rowIndex);\n coverSatisfiedRows(ecmCoveredRows, rowIndex);\n }\n }\n }\n }", "boolean FindUnassignedLocation(int grid[][], Point p)\n {\n int row=p.x,col=p.y;\n for (row = 0; row < N; row++)\n for (col = 0; col < N; col++)\n if (grid[row][col] == UNASSIGNED)\n {\n p.x=row;p.y=col;\n return true;\n }\n return false;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }", "public boolean isSetE() {\n return this.e != null;\n }" ]
[ "0.643496", "0.55074614", "0.5360035", "0.53068745", "0.5282502", "0.52750117", "0.5155774", "0.5133127", "0.5069936", "0.5012994", "0.49698284", "0.49678403", "0.4962225", "0.49604166", "0.49377468", "0.4937097", "0.492494", "0.492494", "0.4905841", "0.4886825", "0.48792914", "0.48746282", "0.48279542", "0.481968", "0.48152", "0.4814717", "0.4809775", "0.4809413", "0.48054644", "0.47892043", "0.47771502", "0.47718465", "0.47651488", "0.47649106", "0.47645998", "0.47581723", "0.47557274", "0.4755255", "0.4755129", "0.47528514", "0.47468928", "0.47346643", "0.47318235", "0.47211885", "0.4712613", "0.47052476", "0.46805477", "0.4673162", "0.46665704", "0.46614185", "0.4657501", "0.4650725", "0.46451554", "0.46394953", "0.46257356", "0.4624998", "0.4622419", "0.46210542", "0.46155322", "0.46130008", "0.46101537", "0.46067542", "0.4599263", "0.459819", "0.45945954", "0.45842746", "0.4569701", "0.4565205", "0.45618695", "0.45551884", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742", "0.4547742" ]
0.74799204
0
Finds fitness of a chromosome the number of bins (minimization). All chromosomes are fixed if infeasible using sideeffects.
private Integer getFitness(int[] chromosome) { int[] bins = new int[binCount]; //list of found bins for (int binIndex = 0; binIndex < bins.length; binIndex++) { //initialize list of bins to unfound bins[binIndex] = -1; } int[] newChrom = bestFitModified(chromosome.clone()); //fix if infeasible if (newChrom == null) { //this is an unfixable chromosome, inform caller return binCount * 2 + totalInfeasibility(chromosome); } for (int i = 0; i < newChrom.length; i++) { chromosome[i] = newChrom[i]; //copy over to take advantage of side-effects } int uniqueBins = 0; for (int i = 0; i < chromosome.length; i++) { if (bins[chromosome[i]] == -1) { //if we haven't seen this bin before track it and increment bin counter bins[chromosome[i]] = chromosome[i]; uniqueBins++; } else continue; } return uniqueBins; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static void getFitness() {\n\t\tint popSize = population.size();\n\t\tChromosome thisChromo = null;\n\t\tdouble bestScore = 0;\n\t\tdouble worstScore = 0;\n\n\t\t// The worst score would be the one with the highest energy, best would be\n\t\t// lowest.\n\t\tworstScore = population.get(maximum()).conflicts();\n\n\t\t// Convert to a weighted percentage.\n\t\tbestScore = worstScore - population.get(minimum()).conflicts();\n\n\t\tfor (int i = 0; i < popSize; i++) {\n\t\t\tthisChromo = population.get(i);\n\t\t\tthisChromo.fitness((worstScore - thisChromo.conflicts()) * 100.0 / bestScore);\n\t\t}\n\n\t\treturn;\n\t}", "private int totalInfeasibility(int[] chromosome) {\n\t\tint infeasibility = 0;\n\t\tint[] bins = new int[binCount];\n\t\tfor (int i = 0; i < chromosome.length; i++) {\n\t\t\tif (chromosome[i] >= bins.length) {\n\t\t\t\tinfeasibility += 10;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tbins[chromosome[i]] += packageWeights[i]; //put package into bin\n\t\t\t} catch (Exception e) {\n\t\t\t\tSystem.out.println(\"noooo\");\n\t\t\t}\n\n\t\t}\n\n\t\tfor (int i = 0; i < bins.length; i++) {\n\t\t\tif (bins[i] > binSize)\n\t\t\t\tinfeasibility += bins[i] - binSize;\n\t\t}\n\t\treturn infeasibility;\n\t}", "private static void calculateFitnessOfPopulation(ArrayList<Chromosome> population) {\n for (Chromosome chromosome : population) {\n // if the fitness of the chromosome has not yet been calculated (i.e. is still -1)\n fitnessFunction(chromosome);\n }\n }", "Chromosome fittestChromosome();", "static int getFitness(double[][] matrix, Chromosome ch){\n int fitness = 0,\n tmpInd = 0;\n\n for (int i = 0; i < ch.size(); i++) {\n if (ch.getGene(i) == 1){\n fitness += matrix[tmpInd][i];\n tmpInd = i;\n }\n }\n return fitness;\n }", "private int[] bestFitModified(int[] chromosome) {\n\t\tint[] bins = new int[binCount];\n\t\tArrayList<Integer> cannotPackList = new ArrayList<Integer>();\n\n\t\t//honor chromosome listing when possible\n\t\tfor (int i = 0; i < chromosome.length; i++) {\n\t\t\t//if this bin isnt full & won't be after placement & this chrom hasnt gone off the end \n\t\t\t//(VERY RARE, only happens when binCount is reduced w/ elitism)\n\t\t\tif (chromosome[i] < bins.length && bins[chromosome[i]] + packageWeights[i] <= binSize) {\n\t\t\t\tbins[chromosome[i]] += packageWeights[i]; //put package into bin\n\t\t\t} else { //store those we can't honor\n\t\t\t\tchromosome[i] = -1;\n\t\t\t\tcannotPackList.add(new Integer(i)); //save all those packages whos original bins were full\n\t\t\t}\n\t\t}\n\n\t\t//best fit on all the rest whos bins were full up\n\t\tint tries = 0;\n\t\tfor (int j = 0; j < cannotPackList.size(); j++) {\n\t\t\tint i = cannotPackList.get(j);\n\t\t\tint bestBinIndex = -1;\n\n\t\t\twhile (bestBinIndex < 0 && tries < bins.length * 2) { //while we still havent found a bin to put this in and time isn't up\n\n\t\t\t\tint bestBinLeftOverSpace = binSize * 100; //how much space is left in the bin when the packages is placed in it (ideally 0 = full bin)\n\n\t\t\t\tfor (int bin = 0; bin < bins.length; bin++) {\n\t\t\t\t\t//if this bin is closer to full than the best bin and not overfilled save it\n\t\t\t\t\tif ((binSize - (bins[bin] + packageWeights[i])) >= 0 && (binSize - (bins[bin] + packageWeights[i])) < bestBinLeftOverSpace) {\n\t\t\t\t\t\tbestBinIndex = bin;\n\t\t\t\t\t\tbestBinLeftOverSpace = binSize - (bins[bin] + packageWeights[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (bestBinIndex < 0) { //if could not pack, dump out a bin (mutation)\n\t\t\t\t\tj = 0;\n\t\t\t\t\tint dumpBin = rand.nextInt(binCount);\n\t\t\t\t\tfor (int binIndex = dumpBin; binIndex < binCount; binIndex++) {\n\t\t\t\t\t\tbins[binIndex] = 0;\n\t\t\t\t\t\tfor (int chromIndex = 0; chromIndex < chromosome.length; chromIndex++) {\n\t\t\t\t\t\t\tif (chromosome[chromIndex] == binIndex) {\n\t\t\t\t\t\t\t\tchromosome[chromIndex] = -1;\n\t\t\t\t\t\t\t\tcannotPackList.add(new Integer(chromIndex));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\ttries++;\n\t\t\t}\n\n\t\t\tif (tries >= bins.length * 2) {\n\t\t\t\treturn null; //this chromosome is unsalvageable because it is impossible to fit the packages in the bins\n\t\t\t}\n\n\n\t\t\tbins[bestBinIndex] += packageWeights[i];\n\t\t\tchromosome[i] = bestBinIndex;\n\t\t\tcannotPackList.remove(j);\n\t\t\tj--;\n\t\t}\n\n\t\treturn chromosome;\n\t}", "public int getNumChromosomes();", "public int fitness() {\n\t\t//System.out.println(\"/!\\\\ WARNING: Full fitness() called!\");\n\t\tint fitness = 0;\n\t\tint fitnessCases = (int) Math.pow(2, circuit.order);\n\t\tfor (int i=0; i<fitnessCases; i++) {\n\t\t\tValuation v = new Valuation(i, circuit.order);\n\t\t\tboolean actualOutput = tree.evaluate(v);\n\t\t\tboolean correctOutput = v.correctOutput();\n\t\t\t\n\t\t\tif (actualOutput == correctOutput) fitness++;\n\t\t}\n\t\t\n\t\tthis.fitness = fitness;\n\t\tthis.fitnessCases = null;\n\t\t\n\t\treturn fitness;\n\t}", "private <T> GeneticResult<T> maxFitness(List<Chromosome<T>> chromosomes, int totalBreedings){\n\t\tChromosome<T> bestFit = fittestChromosome(chromosomes);\n\t\treturn new GeneticResult<T>(bestFit, bestFit.getFitness(), totalBreedings);\n\t}", "public void calcularFitness() {\n double fit = 0;\r\n for (int x=0; x < this.genotipo.length;x++){\r\n if (x!=this.genotipo.length-1){\r\n fit+=distancias[this.genotipo[x]][this.genotipo[x+1]];\r\n }else{\r\n fit+=distancias[this.genotipo[x]][this.genotipo[0]];\r\n }\r\n }\r\n this.fitness = fit;\r\n }", "private Chromosome getRouletteChromosome(ArrayList<Chromosome> chroms, double totalFitness){\n double slice = (Math.random()*totalFitness);\n double fitnessSum = 0;\n for(Chromosome c:chroms){\n fitnessSum += c.getFitness();\n if(fitnessSum >= slice){\n return c;\n }\n }\n \n //The total fitness supplied must have been incorrect\n return null;\n }", "double fitness(int gene) {\r\n \tint sum = 0;\r\n \tint prod= 1;\r\n \tfor (int j=0; j<LEN; j++) {\r\n \t\tif (oldpop[gene][j]==0) {\r\n \t\t\tsum += (j+1);\r\n \t\t} else {\r\n \t\t\tprod *= (j+1);\r\n \t\t}\r\n \t}\r\n \treturn Math.abs(sum - SUMTARG)/SUMTARG \r\n \t + Math.abs(prod - PRODTARG)/PRODTARG;\r\n }", "public double fitness()\n/* */ {\n/* 40 */ return 1.0D / (1.0D + this.distance);\n/* */ }", "public double calcFitness(int[] genes) {\n\t\treturn 0;\n\t}", "public void modifyFitness(Population population) {\n // prepare the calculation\n double[][] data = new double[population.size()][];\n for (int i = 0; i < data.length; i++) {\n data[i] = ((AbstractEAIndividual)population.get(i)).getFitness();\n }\n double min = Double.POSITIVE_INFINITY, fitnessSharing;\n double[] result = new double[data.length];\n AbstractEAIndividual tmpIndy;\n\n for (int x = 0; x < data[0].length; x++) {\n for (int i = 0; i < data.length; i++) data[i][x] = -data[i][x];\n for (int i = 0; i < data.length; i++) {\n if (data[i][x] < min) min = data[i][x];\n }\n\n for (int i = 0; i < data.length; i++) {\n // This will cause the worst individual to have no chance of being selected\n // also note that if all individual achieve equal fitness the sum will be zero\n result[i] = data[i][x] -min + 0.1;\n }\n\n for (int i = 0; i < population.size(); i++) {\n tmpIndy = (AbstractEAIndividual)population.get(i);\n fitnessSharing = 0;\n for (int j = 0; j < population.size(); j++) {\n if (this.m_SharingDistance < this.m_Metric.distance(tmpIndy, (AbstractEAIndividual)population.get(j))) {\n fitnessSharing += 1 - (this.m_Metric.distance(tmpIndy, (AbstractEAIndividual)population.get(j))/this.m_SharingDistance);\n }\n }\n result[i] = result[i]/fitnessSharing;\n }\n\n for (int i = 0; i < population.size(); i++) {\n ((AbstractEAIndividual)population.get(i)).SetFitness(x, result[i]);\n }\n }\n }", "public interface Population {\n\n /**\n * Add the specified chromosome to the population.\n * If the size of the population has reached to maxSize, eviction is done\n * removing chromosomes with the worst fitness\n * @param chromosome\n */\n void addChromosome(@NotNull final Chromosome chromosome);\n\n /**\n * Return a random chromosome\n * @return\n */\n Chromosome getRandom();\n\n\n /**\n * Return a random chromosome among the first limit fittest chromosomes\n * @param limit Nth fittest chromosome\n * @return\n */\n Chromosome getRandomAmongFittest(int limit);\n\n /**\n * Remove the specified chromosome from the population\n * @param chromosome\n */\n boolean removeChromosome(@NotNull final Chromosome chromosome);\n\n /**\n * Return the fittest chromosome\n * @return\n */\n Chromosome fittestChromosome();\n\n /**\n * Number of chromosome in the population\n * @return\n */\n int size();\n\n /**\n * Return the hits of each chromosomes\n * @return\n */\n Map<String, Long> hits();\n}", "public int getFitness(Graph_GA obj)\r\n\t{\r\n\t\tint fitness_score = 0;\r\n\t\tSet<DefaultEdge> edges= obj.graph_inp.edgeSet();\r\n Iterator<DefaultEdge> edges_list = edges.iterator();\r\n \r\n while(edges_list.hasNext())\r\n {\r\n \tDefaultEdge new_edge = edges_list.next();\r\n \tGA_Graph_Node source = obj.graph_inp.getEdgeSource(new_edge);\r\n \tGA_Graph_Node target = obj.graph_inp.getEdgeTarget(new_edge);\r\n \tif(chromosome[source.numID-1] == chromosome[target.numID-1])\r\n \t{\r\n \t\tfitness_score = fitness_score-1;\r\n \t}\r\n }\r\n\t\treturn fitness_score;\r\n\t}", "void calculateFitness() {\n if (reachedGoal) {\n fitness = 1d / 16d + 8192d / (genome.step * genome.step);\n } else {\n double d = position.distance(Game.Setup.goal);\n fitness = 1d / (d * d);\n }\n }", "<T> GeneticResult<T> train(List<Chromosome<T>> chromosomes){\n\t\tGeneticResult<T> bestFit = maxFitness(chromosomes, 0);\n\t\tfor(int i = 0; i < totalBreedings; i++){\n\t\t\tif(bestFit.getFitness() > sufficientFitness){ break ;}\n\t\t\tchromosomes = breedNewGeneration(chromosomes);\n\t\t\tbestFit = maxFitness(chromosomes, i);\n\t\t}\n\t\treturn bestFit;\n\t}", "@Override\n\tpublic int compareTo(Chromosome o) {\n\n\t\treturn this.fitness - o.fitness;\n\t}", "public abstract double getFitness(Genotype genotype);", "public void fitnessFunction()\n\t{\n\t\t\n\t}", "public int getNumDataPointsInChrom(int chromosome);", "Chromosome getRandomAmongFittest(int limit);", "public static void GA(ArrayList<City> cities){\n int pathLength = cities.size();\n // the number of chromosomes which will be generated\n int populationSize = 100;\n // the number of chromosomes that will be generated from crossover as a percentage of the population\n double crossoverRate = 0.8;\n // the number of chromosomes that will be generated from crossover\n int crossoverSize = (int) (populationSize * crossoverRate);\n // the probability that a chromosome can have a random mutation\n double mutationRate = 0.05;\n // the number of generations\n int generations = 5000;\n\n // Initialising the distance matrix using the initialiseDistanceMatrix method\n initialiseDistanceMatrix(cities);\n\n // Generating the Initial Population\n ArrayList<Chromosome> population = generatePopulation(cities, pathLength, populationSize);\n\n // The following is done for each generation of the population\n for (int i = 0; i < generations; i++) {\n // calculating the fitness of every chromosome in the current generation\n calculateFitnessOfPopulation(population);\n // sort the population so that the chromosomes with the highest fitness are at the start of the list\n Collections.sort(population);\n // call the method which performs crossover on the population\n Set<Chromosome> children = crossoverPopulation(population, populationSize, crossoverSize);\n // carry out mutation on the children of the current population\n children.addAll( mutatePopulation(children, mutationRate) );\n\n // evolve the population\n population.addAll(children);\n ArrayList<Chromosome> currentGeneration = new ArrayList<>(population);\n ArrayList<Chromosome> nextGeneration = evolvePopulation(currentGeneration, populationSize, cities, pathLength);\n population = new ArrayList<>(nextGeneration);\n }\n\n // find the fittest chromosome\n Chromosome fittestChromosome = population.get(0);\n double maxFitness = population.get(0).fitness;\n for (Chromosome c : population) {\n if (c.fitness > maxFitness) {\n maxFitness = c.fitness;\n fittestChromosome = c;\n }\n }\n // display the path and distance of the fittest chromosome\n System.out.println(fittestChromosome.getPath());\n System.out.println(\"Total Route Distance: \" + routeDistance(fittestChromosome));\n\n //printPopulation(population);\n }", "private int intGetRandomGenomeBiasedAdjustedFitness(Species selectFrom, Random random) {\r\n\t\tdouble completeWeight = 0.0;\r\n\t\tfor (integerFitnessGenome fg : selectFrom.fitnessInt) {\r\n\t\t\tcompleteWeight += fg.fitness;\r\n\t\t}\r\n\t\tdouble r = Math.random() * completeWeight;\r\n\t\tdouble countWeight = 0.0;\r\n\t\tfor (integerFitnessGenome fg : selectFrom.fitnessInt) {\r\n\t\t\tcountWeight += fg.fitness;\r\n\t\t\tif (countWeight >= r) {\r\n\t\t\t\treturn fg.id;\r\n\t\t\t}\r\n\t\t}\r\n\t\tthrow new RuntimeException(\"Couldn't find a genome... Number is genomes in selected species is \");\r\n\t}", "public int getFeaturesSize(int chromosome);", "public static void main(String[] args) throws IOException {\n\t\tint p = 8;\n\t\t// r is the fraction of the population to be replaced by Crossover at\n\t\t// each step\n//\t\tdouble r = Double.valueOf(8).doubleValue();\n\t\tdouble r = 8;\n\t\t// m is the rate of mutation\n//\t\tdouble m = Double.valueOf(8).doubleValue();\n\t\tdouble m = 8;\n\n\t\t// Write into files...\n\t\tFile outputFile = new File(\"testGA.txt\");\n\t\tFileWriter out = new FileWriter(outputFile);\n\n\t\t////////////////////////\n\t\tp = 33;\n\t\tr = 0.6;\n\t\tm = 0.1;\n\n\t\t// Report the population size, crossover rate and mutation rate\n\t\tSystem.out.println();\n\t\tSystem.out.println(\"Learning the 8-queens problem with a Genetic Algorithm\");\n\t\tSystem.out.println(\"Population Size: \" + p);\n\t\tSystem.out.println(\"Crossover Rate: \" + r);\n\t\tSystem.out.println(\"Mutation Rate: \" + m);\n\t\tSystem.out.println();\n\t\tout.write(\"Parameters are p=\" + p + \", \" + \"r=\" + r + \" and m=\" + m + \"\\r\");\n\n\t\t// The genetic algorithm\n\t\tint iterationNum = 0;\n\t\tHypothesis bestIndividual;\n\t\tint bestFitness;\n\t\tdouble aveFitness;\n\t\t// Randomly generate initial population\n\t\tGA algorithm = new GA(p, r, m);\n\t\t// For each individual compute fitness\n\t\talgorithm.computeFitness();\n\t\t// Get the best individual\n\t\tbestIndividual = (algorithm.getPopulation())[0];\n\t\tbestFitness = bestIndividual.getFitness();\n\t\taveFitness = algorithm.computeAveFitness();\n\t\t// Iterate till we get the very best individual\n\t\twhile (bestFitness != 0) {\n\t\t\t// Select the very best members of the population to survive\n\t\t\talgorithm.select();\n\t\t\t// Make the best members reproduce themselves\n\t\t\talgorithm.crossover();\n\t\t\t// Add some mutations to new population\n\t\t\talgorithm.mutate();\n\t\t\t// The successor population becomes the current population\n\t\t\talgorithm.setNextGeneration();\n\t\t\t// For each individual compute fitness\n\t\t\talgorithm.computeFitness();\n\t\t\t// Get the best individual\n\t\t\tbestIndividual = (algorithm.getPopulation())[0];\n\t\t\tbestFitness = bestIndividual.getFitness();\n\t\t\taveFitness = algorithm.computeAveFitness();\n\t\t\t// Report best results to the user at every five iterations\n\t\t\tif (iterationNum % 5 == 0) {\n\t\t\t\tSystem.out.println(\"Iteration: \" + iterationNum + \" Best Fitness: \" + bestFitness\n\t\t\t\t\t\t+ \" Average Fitness \" + aveFitness);\n\t\t\t\tSystem.out.println(\"Best solution: \" + bestIndividual.toString());\n\t\t\t\tSystem.out.println();\n\t\t\t\tout.write(\"\\n\" + iterationNum + \",\" + bestFitness + \",\" + aveFitness + \"\\r\");\n\t\t\t}\n\t\t\titerationNum++;\n\t\t}\n\t\tSystem.out.println(\n\t\t\t\t\"Iteration: \" + iterationNum + \" Best Fitness: \" + bestFitness + \" Average Fitness \" + aveFitness);\n\t\tSystem.out.println(\"Solution is \" + bestIndividual.toString());\n\t\tout.write(\"\\n\" + iterationNum + \",\" + bestFitness + \",\" + aveFitness + \"\\r\");\n\t\tout.close();\n\t}", "void ComputeFitness(){\n\t\tint i, pos;\n\t\t// individual t;\n\t\tdouble min, sum = 0, sumSize = 0, tm;\n\t\t// First Compute Raw fitness\n\t\tfor(i = 0; i < poplen; i++)\n\t\t{\n\t\t\tif(oldpop[i].evaluated==FALSE)\n\t\t\t{ tm=ComputeRF(oldpop[i]);\n\t\t\t\toldpop[i].fitness = tm;\n\t\t\t\toldpop[i].oldfitness = tm;\n\t\t\t\toldpop[i].evaluated=TRUE;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\toldpop[i].fitness=oldpop[i].oldfitness;\n\t\t\t}\n\t\t\t\n\t\t\t//oldpop[i].DisplayIndividual();\n\t\t\t//System.out.println(oldpop[i].fitness);\n\t\t}\n\t\t//tim individual co fitness be nhat\n\t\tmin = oldpop[0].fitness;\n\t\tpos = 0;\n\t\tsum = oldpop[0].fitness;\n\t\tsumSize = oldpop[0].size;\n\t\t\n\t\tfor(i = 1; i < poplen; i++) {\n\t\t\tif(oldpop[i].fitness < min) {\n\t\t\t\tmin = oldpop[i].fitness;\n\t\t\t\tpos = i;\n\t\t\t}\n\t\t\tsum += oldpop[i].fitness;\n\t\t\tsumSize += oldpop[i].size;\n//\t\t\tpopSize[gen][i]= oldpop[i].size;\n\t\t}\n\t\t// copy the best and average\n\t\tbestcurrent[gen] = new individual();\n\t\tbestcurrent[gen].CopyIndividual(oldpop[pos], TRUE);\n\t\taverage[gen] = sum /poplen;\n\t\taverageSize[gen] = sumSize /poplen;\n\t\t// Third Compute Adjusted fitness\n\t\tAdjustFitness();\n\t\t// Finally Compute nomarlized fitness\n \t\tNormalizeFitness();\n\t}", "protected double evaluate(IChromosome chromosome) {\n\t double score = 0;\n\t \t \n\t List dups = new ArrayList();\n\t int badSolution = 1;\n\n\t for (int i = 0; i < chromosome.size(); i++) {\n\n\t //IntegerGene agene = (IntegerGene) chromosome.getGene(i);\n\t //System.out.println(agene);\n\t int index = (Integer) chromosome.getGene(i).getAllele();\n\t \n\t if (dups.contains(index)) {\n\t badSolution = 0;\n\t } else {\n\t dups.add(index);\n\t }\n\n\t Equipo equipo = (Equipo) equipos.get(index);\n\t double genreScore = getGenreScore(equipo);\n\t if (genreScore == 0) {\n\t badSolution = 0;\n\t }\n\t score = (score+genreScore);\n\n\t }\n\t \n\t return (score * badSolution);\n\t }", "private static double fitness(PMCGenotype gene, int trials)\n\t{\n\t\tController<MOVE> btc = new PacManBTController(decode(gene));\n\t\treturn runExperiment(btc, ghostController, trials);\n\t}", "static double[] evolveWeights() throws Exception {\n\t\t// Create a random initial population\n\t\tRandom r = new Random();\n\t\t// Matrix is a two dimensional array, populationSize are rows, Genes are columns\n\t\tMatrix population = new Matrix(populationSize, numberofGenes);\n\t\tfor (int i = 0; i < 100; i++) {\n\t\t\t// returns elements(genes) of every row\n\t\t\t// Think of every row as a seperate chromosome of parent\n\t\t\tdouble[] chromosome = population.row(i);\n\t\t\t// create every gene for each chrosome in the population\n\t\t\tfor (int j = 0; j < chromosome.length; j++) {\n\t\t\t\tdouble gene = 0.03 * r.nextGaussian();\n\t\t\t\tchromosome[j] = gene;\n\t\t\t}\n\t\t}\n\n\t\tint generationNum = 0;\n\t\t// do battle with chromosomes until winning condition is found\n\t\t// Controller.doBattleNoGui(new ReflexAgent(), new\n\t\t// NeuralAgent(population.row(0)))\n\t\twhile (Controller.doBattleNoGui(new ReflexAgent(), new NeuralAgent(population.row(0))) != -1) {\n\n\t\t\tSystem.out.println(\"Generation \" + (generationNum));\n\n\t\t\tint mightLive = r.nextInt(100);\n\n\t\t\tif (generationNum == 10)\n\t\t\t\tmutationRate -= 0.01;\n\t\t\tif (generationNum == 20)\n\t\t\t\tmutationRate -= 0.02;\n\t\t\tif (generationNum == 30)\n\t\t\t\tmutationRate -= 0.02;\n\n\t\t\t// Mutate the genes of the current population\n\t\t\tfor (int y = 0; y < populationSize; y++) {\n\t\t\t\tfor (int x = 0; x < numberofGenes; x++) {\n\t\t\t\t\tif (Math.random() <= mutationRate) {\n\t\t\t\t\t\tpopulation.changeGene(x, y, r.nextGaussian());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Make random number of battles\n\t\t\tfor (int i = 0; i < 40; i++) {\n\t\t\t\t// Create two teams with two random chromosomes from the population\n\t\t\t\tint soldier_a = r.nextInt(population.rows());\n\t\t\t\tint soldier_b = r.nextInt(population.rows());\n\n\t\t\t\t// Ensure that both teams don't have the same chromosome\n\t\t\t\tif (soldier_a == soldier_b)\n\t\t\t\t\tsoldier_b = r.nextInt(population.rows());\n\n\t\t\t\t// Do Battle between teams and select winner\n\t\t\t\tif (Controller.doBattleNoGui(new NeuralAgent(population.row(soldier_a)),\n\t\t\t\t\t\tnew NeuralAgent(population.row(soldier_b))) == 1) {\n\t\t\t\t\t// Chooses if the winner survives\n\t\t\t\t\tif (mightLive < winnerSurvivalRate)\n\t\t\t\t\t\tpopulation.removeRow(soldier_b);\n\t\t\t\t\telse\n\t\t\t\t\t\tpopulation.removeRow(soldier_a);\n\t\t\t\t}\n\n\t\t\t\telse if (Controller.doBattleNoGui(new NeuralAgent(population.row(soldier_a)),\n\t\t\t\t\t\tnew NeuralAgent(population.row(soldier_b))) == -1) {\n\t\t\t\t\t// Chooses if the winner survives\n\t\t\t\t\tif (mightLive < winnerSurvivalRate)\n\t\t\t\t\t\tpopulation.removeRow(soldier_a);\n\t\t\t\t\telse\n\t\t\t\t\t\tpopulation.removeRow(soldier_b);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Reproduce for the population (This is where the magic happens)\n\t\t\t// int currentPopulation = population.rows();\n\t\t\twhile (population.rows() < 100) {\n\t\t\t\t// Retrieve random parent\n\t\t\t\tint parentID = r.nextInt(population.rows());\n\t\t\t\tdouble[] parent = population.row(parentID);\n\t\t\t\tint[] potentialPartners = new int[10];\n\t\t\t\tint abs_min_value = Integer.MIN_VALUE;\n\t\t\t\tBoolean foundpartner = false;\n\t\t\t\tint partner = 0;\n\n\t\t\t\tfor (int i = 0; i < potentialPartners.length; i++) {\n\t\t\t\t\tint potentialPartnerID = r.nextInt(population.rows());\n\t\t\t\t\tif (parentID == potentialPartnerID)\n\t\t\t\t\t\tpotentialPartnerID = r.nextInt(population.rows());\n\t\t\t\t\tpotentialPartners[i] = potentialPartnerID;\n\t\t\t\t}\n\n\t\t\t\tfor (int i = 0; i < potentialPartners.length; i++) // Finding most compatiable parent #2.\n\t\t\t\t{\n\t\t\t\t\tint compatiablity = similarities(parent, population.row(potentialPartners[i]));\n\t\t\t\t\tif (compatiablity > abs_min_value) {\n\t\t\t\t\t\tpartner = potentialPartners[i];\n\t\t\t\t\t\tfoundpartner = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (foundpartner == false)\n\t\t\t\t\tpartner = r.nextInt(population.rows());\n\n\t\t\t\tdouble[] secondParent = population.row(partner);\n\t\t\t\tdouble[] newChild = population.newRow();\n\t\t\t\tint splitpoint = r.nextInt((int) numberofGenes / 4);\n\n\t\t\t\tfor (int i = 0; i < splitpoint; i++) // logic to a for loop and two if statements\n\t\t\t\t\tnewChild[i] = parent[i];\n\t\t\t\tfor (int i = splitpoint; i < numberofGenes; i++)\n\t\t\t\t\tnewChild[i] = secondParent[i];\n\n\t\t\t\t// for (int i = 0; i < population.rows(); i++) {\n\t\t\t\t// if (Controller.doBattleNoGui(new ReflexAgent(), new\n\t\t\t\t// NeuralAgent(population.row(i))) == -1) {\n\t\t\t\t// population.row(i) = population.newRow();\n\t\t\t\t// numOfWins++;\n\t\t\t\t// } else { }\n\n\t\t\t\t// Test for the best in the given population\n\t\t\t\t// win_Collection.add(numOfWins);\n\t\t\t\t// printWeights(population.row(0));\n\n\t\t\t}\n\t\t\tgenerationNum++;\n\t\t\tfor (int i = 0; i < population.rows(); i++) {\n\t\t\t\tif (Controller.doBattleNoGui(new ReflexAgent(), new NeuralAgent(population.row(i))) == -1) {\n\t\t\t\t\tnumOfWins++;\n\t\t\t\t\t// population.row(i) = population.newRow();\n\t\t\t\t} else {\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(\"Number of Winners: \" + numOfWins);\n\t\t\tnumOfWins = 0;\n\n\t\t}\n\t\tprintWeights(population.row(0));\n\t\treturn population.row(0);\n\t}", "public Chromosome withFitnessCalculated() {\n this.fitness = calculateFitness();\n return this;\n }", "public Chromosome bestChromosome()\r\n {\r\n\treturn bestChromo.clone();\r\n }", "public int fitness(ArrayList<Integer> fitnessCases) {\n\t\tif (this.fitnessCases == fitnessCases) return fitness; // cache hit\n\n\t\tint fitness = 0;\n\t\tfor (int c : fitnessCases) {\n\t\t\tValuation v = new Valuation(c, circuit.order);\n\t\t\tboolean actualOutput = tree.evaluate(v);\n\t\t\tboolean correctOutput = v.correctOutput();\n\t\t\t\n\t\t\tif (actualOutput == correctOutput) fitness++;\n\t\t}\n\t\t// cache these values:\n\t\tthis.fitness = fitness;\n\t\tthis.fitnessCases = fitnessCases;\n\t\treturn fitness;\n\t}", "public void evaluate() {\n for (Chromosome chromo : chromosomes) {\n double chromoGH = chromo.getTotalGH();\n if (chromo.isValid()) {\n this.validChromosomes++;\n if (chromoGH > this.getBestScore()) {\n this.bestScore = chromoGH;\n this.setBestChromo(chromo);\n }\n }\n //Log.debugMsg(chromo.getTotalGH().toString());\n// this.map.put(chromoGH, chromo);\n }\n }", "private static Set<Chromosome> rankBasedRouletteWheelSelection(ArrayList<Chromosome> population, int populationSize) {\n Set<Chromosome> selectedChromosomes = new HashSet<>();\n\n // calculate the sum of all ranks, which will be used as a denominator for all probabilities\n int sumOfRanks = (populationSize + 1) * populationSize / 2;\n\n // declare an array of cumulative probabilities for all the chromosomes in the population\n double[] cumulativeProbability = new double[populationSize];\n // calculate the cumulative probability of the first chromosome as its probability\n cumulativeProbability[0] = (double) populationSize / sumOfRanks;\n // calculate the cumulative probabilities of all successive chromosomes:\n for (int i = 1; i < populationSize; i++) {\n // as the probability of this chromosomes based on its rank\n double probability = (double) (populationSize-i) / sumOfRanks;\n // plus the cumulative proability of the preceeding chromosome\n cumulativeProbability[i] = cumulativeProbability[i-1] + probability;\n }\n\n while (selectedChromosomes.size() < 2) {\n // choose a chromosome randomly based on its cumulative probability (the lower the better)\n double random = ThreadLocalRandom.current().nextDouble();\n int choice = 0;\n while (random > cumulativeProbability[choice]) {\n choice++;\n }\n\n // add the chosen chromosome to the set of selectedChromosomes\n selectedChromosomes.add(population.get(choice));\n }\n\n return selectedChromosomes;\n }", "public abstract double getConstraintFitness();", "public Chromosome worstChromosome()\r\n {\r\n\treturn worstChromo.clone();\r\n }", "private boolean canReduceBins() {\n\t\tint oldBinCount = binCount;\n\t\tboolean canReduce = false;\n\t\tbinCount = binCount / 2;\n\t\tint[] chromosome = eliteChromosome.clone();\n\n\t\tif (getFitness(chromosome) <= binCount)\n\t\t\tcanReduce = true;\n\t\telse\n\t\t\tcanReduce = false;\n\t\tbinCount = oldBinCount; //no side effects\n\t\treturn canReduce;\n\t}", "@Override\n public void mutate(Chromosome c) {\n if (c.getFitness() == 0) return;\n\n boolean[] genes = c.getGenes();\n int weight = c.getWeight();\n\n for (int i = 0; i < genes.length; i++) {\n if (weight == Config.CAPACITY) break;\n\n if (!genes[i]) {\n if (weight + Config.ITEMS[i].getWeight() <= Config.CAPACITY) {\n c.flipGene(i);\n }\n }\n }\n \n }", "private double evaluateFaultCovFitness(String phenotype) {\n int faults = 38; // Again, should be injected\n boolean[] faultsHit = new boolean[faults];\n for (int i = 0; i < faults; i++)\n faultsHit[i] = false;\n for (int i = 0; i < phenotype.length(); i++) {\n if (phenotype.charAt(i) == '1') {\n// mark the faults found by the test\n for (int j = 0; j < faults; j++) {\n if (faultMatrix[i][j] == 1)\n faultsHit[j] = true;\n }\n }\n }\n// total collection of faults found\n int count = 0;\n for (int i = 0; i < faults; i++) {\n if (faultsHit[i])\n count++;\n }\n return count;\n }", "static double fitness(vmnode[] vms, jobnode[] jobs, int[] assigned, HashMap<Integer, Integer> map, double[][] ect) {\n double libd = LIBD(vms, jobs, assigned);\n double makesp = calcmakespan(map, ect);\n return libd * makesp;\n }", "@Test\n public void testGetChromosome() throws Exception {\n Stats stat = sf.ofChromosome(chromosome);\n\n // Check that the chromosome was added to the stats object\n assertEquals(chromosome, stat.getChromosome());\n }", "private static int maximum() {\n\t\tint popSize = 0;\n\t\tChromosome thisChromo = null;\n\t\tChromosome thatChromo = null;\n\t\tint winner = 0;\n\t\tboolean foundNewWinner = false;\n\t\tboolean done = false;\n\n\t\twhile (!done) {\n\t\t\tfoundNewWinner = false;\n\t\t\tpopSize = population.size();\n\t\t\tfor (int i = 0; i < popSize; i++) {\n\t\t\t\tif (i != winner) { // Avoid self-comparison.\n\t\t\t\t\tthisChromo = population.get(i);\n\t\t\t\t\tthatChromo = population.get(winner);\n\t\t\t\t\tif (thisChromo.conflicts() > thatChromo.conflicts()) {\n\t\t\t\t\t\twinner = i;\n\t\t\t\t\t\tfoundNewWinner = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (foundNewWinner == false) {\n\t\t\t\tdone = true;\n\t\t\t}\n\t\t}\n\t\treturn winner;\n\t}", "@Override\n\tpublic double valuta_figli() {\n\t\treturn simple_fitness();\n\t}", "public int getFitness(){\n return fitness;\n }", "public void evaluate()\r\n {\r\n\tdouble max = ff.evaluate(chromos.get(0),generation());\r\n\tdouble min = max;\r\n\tdouble sum = 0;\r\n\tint max_i = 0;\r\n\tint min_i = 0;\r\n\r\n\tdouble temp = 0;\r\n\r\n\tfor(int i = 0; i < chromos.size(); i++)\r\n\t {\r\n\t\ttemp = ff.evaluate(chromos.get(i),generation());\r\n\t\tif(temp > max)\r\n\t\t {\r\n\t\t\tmax = temp;\r\n\t\t\tmax_i = i;\r\n\t\t }\r\n\r\n\t\tif(temp < min)\r\n\t\t {\r\n\t\t\tmin = temp;\r\n\t\t\tmin_i = i;\r\n\t\t }\r\n\t\tsum += temp;\r\n\t }\r\n\r\n\tbestFitness = max;\r\n\taverageFitness = sum/chromos.size();\r\n\tworstFitness = min;\r\n\tbestChromoIndex = max_i;;\r\n\tworstChromoIndex = min_i;\r\n\tbestChromo = chromos.get(max_i);\r\n\tworstChromo = chromos.get(min_i);\r\n\t\r\n\tevaluated = true;\r\n }", "public static double calculateFitness(Allele[] geneticCode) {\n return minMaxNormalization(decodeGeneticCode(geneticCode));\n }", "public int getFitness()\n {\n return this.fitness;\n }", "public Chromosome doDisplacementMutation(){\n for(int i = 0; i < PopulationConfiguration.MUTATION_ATTEMPTS; i++){\n ArrayList<Boolean> newSelection = copyBoolArrayList(this.knapsackSelection);\n\n int allele1 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n int allele2 = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size());\n\n int leftAllele = Math.min(allele1, allele2);\n int rightAllele = Math.max(allele1, allele2);\n\n var selectionSublist = new ArrayList<Boolean>(newSelection.subList(leftAllele, rightAllele));\n for(int j = leftAllele; j < rightAllele + 1; j++){\n newSelection.remove(leftAllele);\n }\n\n int index = Configuration.RANDOM_GENERATOR.nextInt(newSelection.size()+1);\n newSelection.addAll(index, selectionSublist);\n\n Chromosome mutatedKnapsack = new Chromosome(newSelection).withFitnessCalculated();\n if(mutatedKnapsack.isValid())\n return mutatedKnapsack;\n }\n return this;\n }", "@Override\n\tpublic int compareTo(Chromosome o) {\n\t\tif(this.getFitness()<o.getFitness())\n\t\t\treturn -1;\n\t\telse if(this.getFitness()>o.getFitness())\n\t\t\treturn 1;\n\t\telse\n\t\t\treturn 0;\n\t}", "int countPowertypeRanges();", "public Bounds getProbabilityBounds();", "void CalculateProbabilities()\n\t{\n\t int i;\n\t double maxfit;\n\t maxfit=fitness[0];\n\t for (i=1;i<FoodNumber;i++)\n\t {\n\t if (fitness[i]>maxfit)\n\t maxfit=fitness[i];\n\t }\n\n\t for (i=0;i<FoodNumber;i++)\n\t {\n\t prob[i]=(0.9*(fitness[i]/maxfit))+0.1;\n\t }\n\n\t}", "public void computeConflicts() { //compute the number of conflicts to calculate fitness\r\n String board[][] = new String[MAX_LENGTH][MAX_LENGTH]; //initialize board\r\n int x = 0; //row\r\n int y = 0; //column\r\n int tempx = 0; //temprow\r\n int tempy = 0; //temcolumn\r\n\r\n int dx[] = new int[] {-1, 1, -1, 1}; //to check for diagonal\r\n int dy[] = new int[] {-1, 1, 1, -1}; //paired with dx to check for diagonal\r\n\r\n boolean done = false; //used to check is checking fo diagonal is out of bounds\r\n int conflicts = 0; //number of conflicts found\r\n\r\n clearBoard(board); //clears the board into empty strings\r\n plotQueens(board); // plots the Q in the board\r\n\r\n // Walk through each of the Queens and compute the number of conflicts.\r\n for(int i = 0; i < MAX_LENGTH; i++) {\r\n x = i;\r\n y = pos[i];\r\n\r\n // Check diagonals.\r\n for(int j = 0; j < 4; j++) { // because of dx and dy where there are 4 directions for diagonal searching for conflicts\r\n tempx = x;\r\n tempy = y; // store coordinate in temp\r\n done = false;\r\n\r\n while(!done) {//traverse the diagonals\r\n tempx += dx[j];\r\n tempy += dy[j];\r\n\r\n if((tempx < 0 || tempx >= MAX_LENGTH) || (tempy < 0 || tempy >= MAX_LENGTH)) { //if exceeds board\r\n done = true;\r\n } else {\r\n if(board[tempx][tempy].equals(\"Q\")) {\r\n conflicts++;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n this.conflicts = conflicts; //set conflicts of this particle\r\n }", "private ArrayList<int[]> selectionRank(int[][] chromosomes, float percentToSelect) {\n\n\t\tArrayList<int[]> selectedChromosomes = new ArrayList<int[]>();\n\n\t\t//get fitnesses and ranks of chromosomes, save in array to avoid recalculating\n\t\tint[] fitnesses = new int[chromosomes.length];\n\t\tArrayList<Integer> ranks = new ArrayList<Integer>(); //holds indices of chromosomes, position in arraylist indicates rank\n\n\t\tfor (int i = 0; i < chromosomes.length; i++) { //set up list of fitnesses and ranks\n\t\t\tfitnesses[i] = getFitness(chromosomes[i]);\n\n\n\t\t\tboolean added = false;\n\t\t\tfor (int keyIndex = 0; keyIndex < ranks.size(); keyIndex++) { //only search the second half\n\t\t\t\tif (fitnesses[ranks.get(keyIndex)] > fitnesses[i]) { //if this one is worse\n\t\t\t\t\tranks.add(keyIndex, i); //inverted rank\n\t\t\t\t\tadded = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!added) {\n\t\t\t\tranks.add(i);\n\t\t\t}\n\n\t\t}// end fitness ranking (low fitness is best, last index is worst)\n\n\n\t\t//spin the roulette wheel\n\t\tfor (int i = 0; i < chromosomes.length * percentToSelect; i++) {\n\t\t\tint currentFitnessTotal = 0;\n\t\t\tint fitSelector = rand.nextInt(chromosomes.length); //where the wheel stops\n\t\t\tint fitnessCutoff = (fitSelector * (fitSelector + 1)) / 2;\n\n\t\t\tfor (int j = 0; j < ranks.size(); j++) { //go through all ranks to see who is selected this spin\n\t\t\t\tif (currentFitnessTotal < fitnessCutoff)\n\t\t\t\t\tcurrentFitnessTotal += chromosomes.length - ranks.get(j); //reorder fitness properly\n\n\t\t\t\tif (currentFitnessTotal >= fitnessCutoff) { //if this rank pushed us over the edge, save it\n\t\t\t\t\tselectedChromosomes.add(chromosomes[ranks.get(j)]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}//end roulette spinning\n\n\t\treturn selectedChromosomes;\n\t}", "public int getFitnessValue(int[] solution) {\n\n int fitness = 0;\n \n\n for (int i = 0; i < MATRIX_TAM; i++) {\n for (int j = i ; j < MATRIX_TAM; j++) {\n fitness += loc[i][j] * flow[solution[i]][solution[j]];\n \n }\n }\n\n return fitness;\n }", "private void calculateFitness() {\n\t\tint day1=this.getNumberOfHours()*this.getNumberOfClasses();\n\t\tint day2=2*day1;\n\t\tint day3=3*day1;\n\t\tint day4=4*day1;\n\t\tint day5=5*day1;\n\t\tTeacher_lesson temp=null;\n\t\t//day 1//\n\t\tHashSet<Integer> closedSet=new HashSet<Integer>();\n\t\t\n\t\t\n\t\t\n\t\tfor(int i=0;i<day1;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day1;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t}\n\t\t\t\n\t\t}\n\t\n\t\t\n\t\t\n\t\t\n\t\t//day2//\n\t\tclosedSet.clear();;\n\t\t\n\t\tfor(int i=day1;i<day2;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day2;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t}\n\t\t\t\n\t\t}\n\t\t//day3//\n\t\tclosedSet.clear();;\n\t\tfor(int i=day2;i<day3;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day3;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\t//day4//\n\t\tclosedSet.clear();;\n\t\tfor(int i=day3;i<day4;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day4;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\t\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t}\n\t\t\t\n\t\t}\n\t\t//day5//\n\t\tclosedSet.clear();;\n\t\tfor(int i=day4;i<day5;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day5;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t\t\t\n\t\t}\n\t\t\t/*if(temp.get_td_hour()<0){this.fitness=this.fitness-100;}//adunato na ginei giati o ka8igitis exei parapanw wres apo oti mporei na kanei//\n\t\t\t\telse if (temp.get_td_hour()==0){this.fitness=this.fitness-2;}//meiwnoume giati o ka8igitis 8a epivarin8ei oles tou tis wres thn idia mera//\n\t\t\t\telse{++this.fitness;}//kalh prosegisi*/\n\t\t}\n\t\t//*********************END OF DAILY EVALUATION*****************************//\n\t\t\n\t\t//**********************START OF WEEKLY EVALUATION************************//\n\t\t\n\t\tclosedSet.clear();\n\t\t\n\t int \t_weeklyhours = 1;\n\t \n\t\tfor(int i=0;i<day5;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp!=null){\n\t\t\tif(!closedSet.contains(this.genes[i])){\n\t\t\t\t\n\t\t\t\n\t\t\tfor(int j=i+1;j<day5;j++){\n\t\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\t\t++_weeklyhours; }\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t/*if(_weeklyhours>temp.get_tw_hour()){\n\t\t\t\tthis.fitness=this.fitness-100 ; //adunato na kanei parapanw wres ma8hma//\n\t\t\t}else\n\t\t\t\t{++this.fitness;}*/\n\t\t\tif(_weeklyhours<temp.get_tw_hour()){++this.fitness;}\n\t\t\tclosedSet.add(this.genes[i]);}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//*************END OF WEEKLY EVALUATION**********//\n\t\n\t\t//**START OF LESSON EVALUATION***//\n\t\tArraylistLesson set=new ArraylistLesson();\n\t\tclass_lid templ=null;\n\t\tTeacher_lesson tempj=null;\n\t\tint lid=0;\n\t\tString _class;\n\t\tint _classhours=1;\n\t\tfor(int i=0;i<day5;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp!=null){\n\t\t\tlid=temp.get_lid();\n\t\t\t_class=temp.get_class();\n\t\t\ttempl=new class_lid(lid,_class);\n\t\t\tif(!set.contains(templ)){\n\t\t\t\t\n\t\t\t\tfor(int j=i+1;j<day5;j++){\n\t\t\t\t\ttempj=getdata(this.genes[j]);{\n\t\t\t\t\t\tif(tempj!=null){\n\t\t\t\t\t\t\tif(temp.get_tid()==tempj.get_tid()){\n\t\t\t\t\t\t\t\tif(temp.get_lid()==tempj.get_lid()&&temp.get_class().equalsIgnoreCase(tempj.get_class())){\n\t\t\t\t\t\t\t\t\t++_classhours;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\tint hours;\n\t\t\t\thours=temp.get_lhours();\n\t\t\t\n\t\tif(_classhours==hours){\n\t\t\t++this.fitness;\n\t\t}\n\t\tset.add(templ);\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t}", "protected float getFitness()\t\t\t{\treturn fitness;\t\t}", "public double calculateFitness(DNA dna);", "public Object eval(Individual ind)\r\n {\r\n BinaryIndividual bi = (BinaryIndividual)ind;\r\n int partialFitness = 0;\r\n int distance = 0;\r\n double fitness = 0.0;\r\n\r\n\t for (int i=0; i<100; i++){\r\n\r\n\t distance = 0;\r\n\r\n\t for (int j=0; j<100; j++){\r\n\t if (!((BinaryIndividual)target[i]).getBooleanAllele(j)^bi.getBooleanAllele(j)) { \r\n\t\t distance++;\r\n\t }\r\n \r\n\t if (distance > partialFitness) {\r\n\t partialFitness = distance;\r\n\t }\r\n\t }\r\n }\r\n\r\n fitness = (double)partialFitness/100.0;\r\n return new Double(fitness);\r\n \r\n\r\n }", "@Test\n\tpublic void testGA() {\n\t\tGenetic ga = new Genetic(100, 500, 10, SelectionType.TOURNAMENT , 0.6, 0.1);\n\t\tOptimumSolution os = ga.run();\n\t\tSystem.out.println(os.getSolution());\n\t}", "public double getFitness() {\n if (fitness == 0) {\n fitness = 1/(double)getDistance();\n }\n return fitness;\n }", "@Test\n public void testChromosome() {\n\n Assert.assertTrue(this.chromB1.getGenes().length == 4);\n Assert.assertTrue(this.chromB1.getSize() == 4);\n Assert.assertTrue(this.chromB1.getGenes()[0] == 1);\n Assert.assertTrue(this.chromB1.getGenes()[1] == 2);\n Assert.assertTrue(this.chromB1.getGenes()[2] == 3);\n Assert.assertTrue(this.chromB1.getGenes()[3] == 4);\n }", "private static int minimum() {\n\t\tint popSize = 0;\n\t\tChromosome thisChromo = null;\n\t\tChromosome thatChromo = null;\n\t\tint winner = 0;\n\t\tboolean foundNewWinner = false;\n\t\tboolean done = false;\n\n\t\twhile (!done) {\n\t\t\tfoundNewWinner = false;\n\t\t\tpopSize = population.size();\n\t\t\tfor (int i = 0; i < popSize; i++) {\n\t\t\t\tif (i != winner) { // Avoid self-comparison.\n\t\t\t\t\tthisChromo = population.get(i);\n\t\t\t\t\tthatChromo = population.get(winner);\n\t\t\t\t\tif (thisChromo.conflicts() < thatChromo.conflicts()) {\n\t\t\t\t\t\twinner = i;\n\t\t\t\t\t\tfoundNewWinner = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (foundNewWinner == false) {\n\t\t\t\tdone = true;\n\t\t\t}\n\t\t}\n\t\treturn winner;\n\t}", "private double getUnadjustedFitness(Computer computer){\n double score = 0;\n score += 6 * getMatchPercent(computer);\n if(computer.compatible() && sizeCompatability(computer))\n score += 9.5;\n int ramAmount =computer.ramAmount();\n if(ramAmount < 8)\n score -= (8 - ramAmount) * 2;\n else if(ramAmount > 8 && ramAmount < 17)\n score += .06 * (ramAmount - 8);\n else if(ramAmount > 17)\n score += .03 * (ramAmount - 8);\n\n if(computer.cpu.name.contains(\"Intel\") && computer.cpu.name.endsWith(\"K\")){\n if (!computer.motherboard.overclock()){\n score -= 6;\n }\n }\n\n if(computer.cpu.name.contains(\"Intel\") && !(computer.cpu.shortname.contains(\"-5\") || computer.cpu.shortname.contains(\"-6\"))){\n score -= 2;\n }\n if(computer.cpu.name.contains(\"GeForce\") && !(computer.gpu.name.contains(\"GTX 9\") || computer.gpu.name.contains(\"GTX 1\"))){\n score -= 2;\n }\n if(computer.bootDrive.size < 240)\n score -= settings.diskSize * 0.33;\n if(computer.bootDrive.size > 700)\n score += settings.diskSize * 5;\n else\n score += settings.diskSize * computer.bootDrive.size / 140;\n if(computer.secondaryDrive != null)\n score += settings.diskSize * computer.secondaryDrive.size / 1000;\n\n //Now ensure there's enough power, and give a bonus for there being ~300 watts more than needed;\n //there are 4.5 points to gain in powersupply, 10 points to lose\n int basePower = computer.powerConsumption();\n int ideal = basePower + 65;\n if(computer.power.watts < basePower)\n score -= 10;\n else if(computer.power.watts < ideal)\n score += (basePower - computer.power.watts) / 100;\n else\n score += 2.5 - (computer.power.watts - basePower) / 250;\n score += (3 - computer.power.tier) * .6;\n\n // Now motherboard, one point to gain, one to lose\n score += 2 - computer.motherboard.getQuality();\n\n double driveScore = ((computer.bootDrive.reads + computer.bootDrive.writes) / 2) / 88;\n driveScore -= 2;\n if(driveScore > 7.5){\n driveScore = 7.5;\n }\n score += driveScore;\n double rawCpu = ((1 - settings.multicore) / 3) * computer.cpu.singlecore + ((settings.multicore / 3) * (computer.cpu.multicore));\n double adjustedCpu = 26 + 40* ((settings.cpuIntensity / (settings.cpuIntensity + settings.gpuIntensity))* rawCpu - lowCpuScore()) / (maxCpuScore() - lowCpuScore());\n double rawGpu = computer.gpu.fps + (computer.gpu.threedmark / 100);\n double adjustedGpu = 17 + 40 * ((settings.gpuIntensity / (settings.cpuIntensity + settings.gpuIntensity)) * rawGpu - lowGpuScore()) / (maxGpuScore() - lowGpuScore());\n //Inflate the GPU score slightly\n // adjustedGpu * ((35 - adjustedGpu) / 35);\n score += adjustedGpu;\n score += adjustedCpu;\n\n return score;\n }", "public int computeRangedDamageTo(Combatant opponent) { return 0; }", "void addChromosome(@NotNull final Chromosome chromosome);", "float getFitnessScore(MapLocation l) {\n\t\ttry{\n\t\t\tif(rc.canSenseLocation(l) && !rc.onTheMap(l)) {\n\t\t\t\t//System.out.println(\"dead square\");\n\t\t\t\treturn -999999.0f;\n\t\t\t}\n\t\t} catch(Exception e){e.printStackTrace();}\n\t\t\n\t\tfloat fitness = 0.0f;\n\t\t\n\t\tfor(RobotInfo ri : allRobots) {\n\t\t\tfitness -= 1f/l.distanceSquaredTo(ri.location);\n\t\t}\n\t\tif(type.equals(RobotType.GARDENER)) {\n\t\t\tfor(TreeInfo ti : allTrees) {\n\t\t\t\tif(ti.team.equals(Team.NEUTRAL)) {\n\t\t\t\t\tfitness -= 1f/l.distanceSquaredTo(ti.location);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\tfitness -= 10f/l.distanceSquaredTo(lastLocation);\n\t\t\n\t\treturn fitness;\n\t}", "public static void genocide() {\n //Assigns fitness levels\n evaluateFitnesses();\n\n //Sorts by fitness\n sortByFitlvl();\n\n //Simple genocide, kills off all until population size.\n for (int i = Population.size() - 1; i >= populationSize; i--) {\n Population.remove(i);\n }\n\n /*\n //Different kind of Genocide, selects organisms based on gaussian distribution\n\n while(Population.size() > populationSize){\n int randomOrganism = (int)(Population.size() - (Population.size()*Utilities.sharpGauss(2)));\n Population.remove(randomOrganism);\n }\n */\n }", "private Double calculateTotalFitness() {\n double totalFitnessScore = 0;\n\n IgniteCache<Long, Chromosome> cache = ignite.cache(GAGridConstants.POPULATION_CACHE);\n\n SqlFieldsQuery sql = new SqlFieldsQuery(\"select SUM(FITNESSSCORE) from Chromosome\");\n\n // Iterate over the result set.\n try (QueryCursor<List<?>> cursor = cache.query(sql)) {\n for (List<?> row : cursor)\n totalFitnessScore = (Double)row.get(0);\n }\n\n return totalFitnessScore;\n }", "public static void calculateFitness(Individual[] individuals) {\n for (Individual individual : individuals) {\n individual.fitness = 0;\n for (int i = 0; i < dataSet.size(); i++) {\n for (Rule rule : individual.rulebase) {\n boolean match = true;\n int[] data = dataSet.get(i).getVariables();\n\n for (int j = 0; j < data.length; j++) {\n\n String variable = String.valueOf(data[j]);\n //String variable = \"\" + data[j];\n String[] rulebase = rule.cond;\n\n if ((rulebase[j].equals(variable) != true) && (rulebase[j].equals(\"#\") != true)) {\n match = false;\n }\n }\n\n if (match) {\n String output = String.valueOf(dataSet.get(i).getOutput());\n if (rule.output.equals(output)) {\n individual.fitness++;\n }\n break;\n }\n }\n }\n }\n }", "public static int getObstacleProbabilityRange() {\n\t\treturn RANDOM_OBSTACLE_PROBABILITY_RANGE;\n\t}", "private ArrayList<int[]> selectionRoulette(int[][] chromosomes, float percentToSelect) {\n\n\t\tArrayList<int[]> selectedChromosomes = new ArrayList<int[]>();\n\n\t\t//sum up fitnesses for population\n\t\tint fitnessSum = 0;\n\t\tfor (int[] chromosome : chromosomes) {\n\t\t\tfitnessSum += getFitness(chromosome);\n\t\t}\n\n\t\t//minimization problem - invert fitness\n\t\tint invertFitnessSum = 0;\n\t\tfor (int[] chromosome : chromosomes) {\n\t\t\tinvertFitnessSum += Math.round((fitnessSum * 1.0) / getFitness(chromosome)); //small fitness values (few bins) are favored\n\t\t}\n\n\t\t//get fitnesses of chromosomes, save in array to avoid recalculating\n\t\tint[] fitnesses = new int[chromosomes.length];\n\t\tfor (int i = 0; i < chromosomes.length; i++) {\n\t\t\tfitnesses[i] = (int) Math.round((fitnessSum * 1.0) / getFitness(chromosomes[i]));\n\t\t}\n\n\t\t//spin the roulette wheel\n\t\tfor (int i = 0; i < chromosomes.length * percentToSelect; i++) {\n\t\t\tint currentFitnessTotal = 0;\n\t\t\tint fitnessCutoff = rand.nextInt(invertFitnessSum); //where the wheel stops\n\n\t\t\tfor (int j = 0; j < chromosomes.length; j++) { //go through all chromosomes to see who is selected this spin\n\t\t\t\tif (currentFitnessTotal < fitnessCutoff)\n\t\t\t\t\tcurrentFitnessTotal += fitnesses[j];\n\n\t\t\t\tif (currentFitnessTotal >= fitnessCutoff) { //if this chromosome pushed us over the edge, save it\n\t\t\t\t\tselectedChromosomes.add(chromosomes[j]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}//end roulette spinning\n\t\treturn selectedChromosomes;\n\t}", "void ComputeFitnessBefore(){\n\t\t\t\tint i, pos;\n\t\t\t\t// individual t;\n\t\t\t\tdouble min, sum = 0, tm;\n\t\t\t\t// First Compute Raw fitness\n\t\t\t\tfor(i = 0; i < poplen; i++)\n\t\t\t\t{\n\t\t\t\t\tif(oldpop[i].evaluated==FALSE)\n\t\t\t\t\t{ tm=ComputeRF(oldpop[i]);\n\t\t\t\t\t\toldpop[i].fitness = tm;\n\t\t\t\t\t\toldpop[i].oldfitness = tm;\n\t\t\t\t\t\toldpop[i].evaluated=TRUE;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\toldpop[i].fitness=oldpop[i].oldfitness;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t//oldpop[i].DisplayIndividual();\n\t\t\t\t\t//System.out.println(oldpop[i].fitness);\n\t\t\t\t}\n\t\t\t\t//tim individual co fitness be nhat\n\t\t\t\tmin = oldpop[0].fitness;\t\t\t\n\t\t\t\tsum = oldpop[0].fitness;\t\t\t\n\t\t\t\t\n\t\t\t\tfor(i = 1; i < poplen; i++) {\n\t\t\t\t\tif(oldpop[i].fitness < min) {\n\t\t\t\t\t\tmin = oldpop[i].fitness;\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\tsum += oldpop[i].fitness;\t\t\t\t\n\t\t\t\t}\n\t\t\t\t// copy the best and average\n//\t\t\t\tbestBeforeFitness[gen]=min;\n//\t\t\t\tavgBeforeFitness[gen]=sum/poplen;\n//\t\t\t\tbestcurrent[gen] = new individual();\n//\t\t\t\tbestcurrent[gen].CopyIndividual(oldpop[pos], TRUE);\n//\t\t\t\taverage[gen] = sum /poplen;\t\t\t\n\t\t\t\t\n\t\t\t}", "public static int createnumOfMutationss(){\n\t\tint totalMut = 0;\n\t\t\n\t\tint[] gen0 = new int[(int) Math.pow(2,0)]; //size of numOfMutations is based on exponential growth by generation number\n\t\t\tmutate(gen0); //function to mutate\n\t\t\ttotalMut = totalMut + totalMutations(gen0);\n\t\tint[] gen1 = new int[(int) Math.pow(2,1)];\n\t\t\tcheckMutations(gen0, gen1); //checks for previous generation mutations\n\t\t\tmutate(gen1);\n\t\t\ttotalMut = totalMut + totalMutations(gen1);\n\t\tint[] gen2 = new int[(int) Math.pow(2,2)];\n\t\t\tcheckMutations(gen1, gen2);\n\t\t\tmutate(gen2);\n\t\t\ttotalMut = totalMut + totalMutations(gen2);\n\t\tint[] gen3 = new int[(int) Math.pow(2,3)];\n\t\t\tcheckMutations(gen2, gen3);\n\t\t\tmutate(gen3);\n\t\t\ttotalMut = totalMut + totalMutations(gen3);\n\t\tint[] gen4 = new int[(int) Math.pow(2,4)];\n\t\t\tcheckMutations(gen3, gen4);\n\t\t\tmutate(gen4);\n\t\t\ttotalMut = totalMut + totalMutations(gen4);\n\t\tint[] gen5 = new int[(int) Math.pow(2,5)];\n\t\t\tcheckMutations(gen4, gen5);\n\t\t\tmutate(gen5);\n\t\t\ttotalMut = totalMut + totalMutations(gen5);\n\t\tint[] gen6 = new int[(int) Math.pow(2,6)];\n\t\t\tcheckMutations(gen5, gen6);\n\t\t\tmutate(gen6);\n\t\t\ttotalMut = totalMut + totalMutations(gen6);\n\t\tint[] gen7 = new int[(int) Math.pow(2,7)];\n\t\t\tcheckMutations(gen6, gen7);\n\t\t\tmutate(gen7);\n\t\t\ttotalMut = totalMut + totalMutations(gen7);\n\t\tint[] gen8 = new int[(int) Math.pow(2,8)];\n\t\t\tcheckMutations(gen7, gen8);\n\t\t\tmutate(gen8);\n\t\t\ttotalMut = totalMut + totalMutations(gen8);\n\t\tint[] gen9 = new int[(int) Math.pow(2,9)];\n\t\t\tcheckMutations(gen8, gen9);\n\t\t\tmutate(gen9);\n\t\t\ttotalMut = totalMut + totalMutations(gen9);\n\t\tint[] gen10 = new int[(int) Math.pow(2,10)];\n\t\t\tcheckMutations(gen9, gen10);\n\t\t\tmutate(gen10);\n\t\t\ttotalMut = totalMut + totalMutations(gen10);\n\t\t\t\n\t\t\treturn totalMut;\n\t\n\t}", "public float getFitness()\r\n\t{\r\n\t\treturn fitness;\r\n\t}", "public abstract Chromosome mutation(Chromosome child);", "private Species getRandomSpeciesBaisedAdjustedFitness(Random random) {\r\n\t\tdouble completeWeight = 0.0;\r\n\t\tfor (Species s : species) {\r\n\t\t\tcompleteWeight += s.totalAdjustedFitness;\r\n\t\t}\r\n\t\tdouble r = Math.random() * completeWeight;\r\n\t\tdouble countWeight = 0.0;\r\n\t\tfor (Species s : species) {\r\n\t\t\tcountWeight += s.totalAdjustedFitness;\r\n\t\t\tif (countWeight >= r) {\r\n\t\t\t\treturn s;\r\n\t\t\t}\r\n\t\t}\r\n\t\tthrow new RuntimeException(\"Couldn't find a species... Number is species in total is \" + species.size()\r\n\t\t\t\t+ \", and the toatl adjusted fitness is \" + completeWeight);\r\n\t}", "public int getFitness(){\n\t\treturn getEnergy()*-1; \n\t}", "public void findTotalFit() {\n\tfor (int i=0;i<popSize;i++) {\n\t totalFitness+=this.getFitness(i);\n\t}\n }", "public int getIndex(BitChromosome bitChromosome) {\n return (int)(bitChromosome.genes & mask);\n }", "public Chromosome(ArrayList<Teacher_lesson> list){\n\t\tthis.genes=new int[array_size];\n\t\tRandom r= new Random();\n\t\tfor(int i=0;i<genes.length;i++){\n\t\t\t\n\t\t\tthis.genes[i]=r.nextInt(number_of_professors);\n\t\t}\n\t\tthis.DataList=list;\n\t\tthis.calculateFitness();\n\t}", "public double[] calculatefitnessvalue(String str) {\t\n\t\tint a = Integer.parseInt(str.substring(0, 5), 2); \n\t\tint b = Integer.parseInt(str.substring(6, 11), 2);\n\t\tint c = Integer.parseInt(str.substring(12, 17), 2);\n\t\tint d = Integer.parseInt(str.substring(18, 23), 2);\n\t\tint e = Integer.parseInt(str.substring(24, 29), 2);\n\t\tint f = Integer.parseInt(str.substring(30, 35), 2);\n\t\tint g = Integer.parseInt(str.substring(36, 41), 2);\n\t\tint h = Integer.parseInt(str.substring(42, 47), 2);\n\t\tint i = Integer.parseInt(str.substring(48, 53), 2);\n\t\tint j = Integer.parseInt(str.substring(54, 59), 2);\n\n\t\tdouble x1 = a * (6.0 - 0) / (Math.pow(2, 6) - 1); //gene of x\n\t\tdouble x2 = b * (6.0 - 0) / (Math.pow(2, 6) - 1); //gene of y\n\t\tdouble x3 = c * (6.0 - 0) / (Math.pow(2, 6) - 1);\n\t\tdouble x4 = d * (6.0 - 0) / (Math.pow(2, 6) - 1);\n\t\tdouble x5 = e * (6.0 - 0) / (Math.pow(2, 6) - 1);\n\t\tdouble x6 = f * (6.0 - 0) / (Math.pow(2, 6) - 1);\n\t\tdouble x7 = g * (6.0 - 0) / (Math.pow(2, 6) - 1);\n\t\tdouble x8 = h * (6.0 - 0) / (Math.pow(2, 6) - 1);\n\t\tdouble x9 = i * (6.0 - 0) / (Math.pow(2, 6) - 1);\n\t\tdouble x10 = j * (6.0 - 0) / (Math.pow(2, 6) - 1);\n\t\t\n\t\t//the Objective function\n\t\tdouble fitness = 3 - Math.sin(2 * x1) * Math.sin(2 * x1) \n\t\t\t\t+ Math.sin(2 * x2) * Math.sin(2 * x2)\n\t\t\t\t- Math.sin(2 * x3) * Math.sin(2 * x3)\n\t\t\t\t+ Math.sin(2 * x4) * Math.sin(2 * x4)\n\t\t\t\t- Math.sin(2 * x5) * Math.sin(2 * x5)\n\t\t\t\t+ Math.sin(2 * x6) * Math.sin(2 * x6)\n\t\t\t\t- Math.sin(2 * x7) * Math.sin(2 * x7)\n\t\t\t\t+ Math.sin(2 * x8) * Math.sin(2 * x8)\n\t\t\t\t- Math.sin(2 * x9) * Math.sin(2 * x9)\n\t\t\t\t+ Math.sin(2 * x10) * Math.sin(2 * x10);\n\t\t\n\t\tdouble[] returns = { x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, fitness };\n\t\treturn returns;\n\t}", "Chromosome getRandom();", "public int getChromosomeAt(int pos)\r\n\t{\r\n\t\tif(pos>chromosome_size||pos<1)\r\n\t\t\treturn 0;\r\n\t\telse\r\n\t\t\treturn chromosome[pos-1];\r\n\t}", "public static List<Double> selection(PolyPopulation pop, double cutoff) {\n\t\tint lastGenerationNum = pop.getGroupCapacity();\n\t\tList<PolyIndividual> nextGeneration = new ArrayList<>();\n\t\tList<Double> fitList = new ArrayList<>();\n\t\tList<Double> valueList = new ArrayList<>();\n\t\tList<Double> actValueList = new ArrayList<>();\n\t\tdouble max = 0.0;\n\t\tdouble totalFit = 0.0;\n\t\t//calculate the value of each individual in the population\n\t\tfor(int i = 0; i < pop.getGroupCapacity(); i++) {\n\t\t\tdouble val = f(pop.getIndis().get(i).getGenotype());\n\t\t\tvalueList.add(val);\n\t\t\t//get the Max value, use it\n\t\t\tif(i == 0) max = val;\n\t\t\telse if(val > max) max = val;\n\t\t}\n\t\t//based on the value insists now, calculate the fitness of each individual and their total fitness\n\t\tfor(int i = 0; i < pop.getGroupCapacity(); i++) {\n\t\t\tdouble fit = 1/(max - valueList.get(i) + 10);\n\t\t\tfitList.add(fit);\n\t\t\ttotalFit+=fit;\n\t\t}\n\t\t\n\t\twhile(nextGeneration.size() < lastGenerationNum*cutoff) {\t\t\t\n\t\t\tdouble selectionVal = Math.random();\n\t\t\tdouble accumulateVal = 0.0;\n\t\t\tfor(int i = 0; i < pop.getGroupCapacity(); i++) {\n\t\t\t\tif(selectionVal >= accumulateVal && selectionVal < (accumulateVal+fitList.get(i)/totalFit)) {\n\t\t\t\t\tnextGeneration.add(pop.getIndis().get(i));\n\t\t\t\t\tactValueList.add(valueList.get(i));\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\taccumulateVal+=(fitList.get(i)/totalFit);\n\t\t\t}\n\t\t}\n\t\tpop.setIndis(nextGeneration);\n\t\tpop.setGroupCapacity(nextGeneration.size());\n\t\treturn actValueList;\n\t}", "private int tournament()\r\n {\r\n\tint out = spinTheWheel();\r\n\tdouble max = ff.evaluate(chromos.get(out),generation());\r\n\tdouble temp_fitness = 0;\r\n\tint temp_index = 0;\r\n\r\n\tfor(int i = 0; i < selPara - 1 + tourStep*generation(); i++)\r\n\t {\r\n\t\ttemp_index = spinTheWheel();\r\n\t\ttemp_fitness = ff.evaluate(chromos.get(temp_index),generation());\r\n\t\tif(temp_fitness > max)\r\n\t\t {\r\n\t\t\tmax = temp_fitness;\r\n\t\t\tout = temp_index;\r\n\t\t }\r\n\t }\r\n\treturn out;\r\n }", "private void EvalFitness(){\r\n _FitVal=0;\r\n for(int i=0; i<7;i++)\r\n for(int j=i+1;j<8;j++){\r\n if( _Data[i]==_Data[j]) _FitVal++;\r\n if(j-i==Math.abs(_Data[i]-_Data[j])) _FitVal++;\r\n }\r\n }", "public int getHeuristic(){\n\t\tint count = 0;\n\t\tfor (int i = 0; i < getRows(); i++) {\n\t\t\tfor (int j = 0; j < getColumns(); j++) {\n\t\t\t\tif (cells[i][j].getSand() != getK()) \n\t\t\t\t\tcount++;\n\t\t\t}\n\t\t} \n\t\treturn count;\n\t}", "public int getFitness() {\n\t\treturn getEnergy() * -1;\n\t}", "public Population evolve()\r\n {\r\n\tArrayList<Chromosome> tempPop = \r\n\t new ArrayList<Chromosome>(chromos.size());\r\n\tChromosome u;\r\n\tChromosome v;\r\n\r\n\tfor(int i = 0; i < chromos.size()/2; i++)\r\n\t {\r\n\t\tu = selectParent();\r\n\t\tv = selectParent();\r\n\t\t\r\n\t\t//System.out.println(\"*****Parent 1 : \\n\" + v);\r\n\t\t\r\n Chromosome c1 = u.child(v);\r\n Chromosome c2 = v.child(u);\r\n\t\ttempPop.add(c1);\r\n\t\ttempPop.add(c2);\r\n\t\t\r\n //System.out.println(\"****Generated new child: \\n\" + c1);\r\n\t }\t \r\n\t\r\n\t// if needed, add in the code for keeping the best chromosome\r\n\tPopulation pop = new Population(tempPop, selMethod, selPara, \r\n\t\t\t\t\tcrossMethod, crossPara, mutMethod, mutPara, \r\n\t\t\t\t\treplaceMethod, replacePara, powerStep, tourStep, ff);\r\n\r\n\tif(replaceMethod == ELITISM)\r\n\t {\r\n\t\tpop.remove(worstChromoIndex);\r\n\t\tpop.add(bestChromo.clone());\r\n\t\tpop.initialize();\r\n\t }\r\n\r\n\tgeneration++;\r\n\treturn pop;\r\n }", "public abstract double evaluateFitness();", "@Override\n\tprotected double[] calculateNeighbourhoodBest(int i) {\n\t\t\t//System.out.println(\"Gbest particle from local typology!\");\n\t\t\tint indexBestParticle = i;\n\t\t\tint indexLeftNeighbour = (i > 0) ? i - 1 : swarmSize - 1;\n\t\t\tint indexRightNeighbour = (i < swarmSize - 1) ? i + 1 : 0;\t\t\n\t\t\t\t\t\n\t\t\tdouble nBestFitness = swarm.get(i).getPBestFitness();\n\t\t\tdouble leftNeighborParticlePBestFitness = swarm.get(indexLeftNeighbour).getPBestFitness();\n\t\t\tdouble rightNeighborParticlePBestFitness = swarm.get(indexRightNeighbour).getPBestFitness();\n\t\t\t\t\t\n\t\t\tif (leftNeighborParticlePBestFitness < nBestFitness) {\n\t\t\t\tindexBestParticle = indexLeftNeighbour;\n\t\t\t\tnBestFitness = leftNeighborParticlePBestFitness;\n\t\t\t}\n\t\t\tif (rightNeighborParticlePBestFitness < nBestFitness) {\n\t\t\t\tindexBestParticle = indexRightNeighbour;\n\t\t\t\tnBestFitness = rightNeighborParticlePBestFitness;\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\treturn swarm.get(indexBestParticle).getPBest();\n\t\t\t//return swarm.get(indexBestParticle);\n\t\t\t\n\t}", "public abstract int getPopulation(int west, int south, int east, int north);", "protected float calcFitness(Individual ind) {\n\t\t\tdouble w = (double) ind.getWait();\n\t\t\tdouble g = (double) ind.getMove();\n\t\t\treturn (float) (g/(w+g));\n\t\t}", "public static void mutate(Chromosome chrome) {\n \n // Loop through tour cities\n for(int rosterNursePos1=0; rosterNursePos1 < chrome.ChromosomeRowSize(); rosterNursePos1++){\n for (int rosterDayPos1=0; rosterDayPos1<chrome.chromosomeColumnCount();rosterDayPos1++){\n if(RosterManager.isPreviousShift(chrome.getShift(rosterNursePos1, rosterDayPos1))==false || RosterManager.isNextShift(chrome.getShift(rosterNursePos1, rosterDayPos1))==false || chrome.getShift(rosterNursePos1, rosterDayPos1).getHours()!=0 ){\n if(Math.random() < mutationRate){\n // Get a second random position in the tour\n int rosterNursePos2= rosterNursePos1;\n int rosterDayPos2 = returnValidPos(rosterNursePos2, randomizeShiftGeneration(chrome), chrome );\n\n // Get the cities at target position in tour\n Gene gene1 = chrome.retrieveGene(rosterNursePos1, rosterDayPos1);\n Gene gene2 = chrome.retrieveGene(rosterNursePos2, rosterDayPos2);\n\n // Swap them around\n chrome.saveGene(rosterNursePos1, rosterDayPos1, gene2);\n chrome.saveGene(rosterNursePos2, rosterDayPos2, gene1);\n \n }\n \n \n } \n // Apply mutation rate\n \n }\n \n }\n \n \n }", "@Override\r\n\tpublic int[] getSample(Random rng) {\r\n\t\tif (!ready)\r\n\t\t\tthrow new RuntimeException(\"must normalize first\");\r\n\t\t\r\n\t\tint bins[] = new int[no_goods];\r\n\t\t\r\n\t\tfor (int i = 0; i<no_goods; i++) {\r\n\t\t\tdouble[] pmf = prob[i].get(r_tmp[i]);\r\n\t\r\n\t\t\t// choose a random spot on the cdf\r\n\t\t\tdouble random = rng.nextDouble();\r\n\t\t\t\r\n\t\t\t// compute cdf. todo: maybe we should precompute inverse of cdf in normalize() so that\r\n\t\t\t// we can avoid a loop here?\r\n\t\t\tdouble cdf = 0.0;\r\n\t\t\tfor (int j = 0; j<pmf.length; j++) {\r\n\t\t\t\tcdf += pmf[j];\r\n\t\t\t\t\r\n\t\t\t\tif (cdf >= random) {\r\n\t\t\t\t\tbins[i] = j;\r\n\t\t\t\t\t\r\n\t\t\t\t\t// add index to realized so that in next round we get the pmf conditional\r\n\t\t\t\t\t// on our result for this round\r\n\t\t\t\t\tfor (int k = 0; k<=i; k++)\r\n\t\t\t\t\t\tr_tmp[i+1].d[k] = bins[k];\r\n\t\t\t\t\t\r\n\t\t\t\t\t// go onto next good\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// sanity check: make sure we picked something. \r\n\t\t}\r\n\t\t\r\n\t\treturn bins;\r\n\t}", "private <T> List<Chromosome<T>> breedNewGeneration(List<Chromosome<T>> chromosomes){\n\t\tList<Chromosome<T>> selected = selection.apply(chromosomes);\n\t\tCollections.shuffle(selected);\n\n\t\tList<Chromosome<T>> crossedOver = Lists.newArrayList();\n\t\tfor(int i = 0; i < selected.size(); i+=2){\n\t\t\tChromosome<T>[] bred = crossover.apply(selected.get(i), selected.get(i+1));\n\t\t\tcrossedOver.add(bred[0]);\n\t\t\tcrossedOver.add(bred[1]);\n\t\t}\n\n\t\treturn crossedOver.stream().map(mutation::apply).collect(Collectors.toList());\n\t}" ]
[ "0.69694364", "0.6445921", "0.64193285", "0.6317899", "0.6306063", "0.62477994", "0.61055976", "0.60199857", "0.59864867", "0.5945905", "0.5935981", "0.59241927", "0.5892739", "0.58763194", "0.5864268", "0.5852424", "0.57979894", "0.578097", "0.5682565", "0.5674979", "0.560202", "0.559643", "0.55933714", "0.55854774", "0.5576352", "0.55479556", "0.5528595", "0.5521446", "0.55092055", "0.5495291", "0.5483041", "0.5443393", "0.53637606", "0.53175104", "0.53170055", "0.53094774", "0.5292605", "0.5290473", "0.52798504", "0.52730733", "0.5271143", "0.52651614", "0.5258407", "0.52352244", "0.5231406", "0.5192463", "0.5164311", "0.5157023", "0.51551425", "0.5147157", "0.5143136", "0.5142718", "0.5134012", "0.5131426", "0.51302934", "0.5119912", "0.51174384", "0.507918", "0.5069528", "0.5056227", "0.5043556", "0.5040968", "0.5039235", "0.5033403", "0.5015685", "0.5008302", "0.4996941", "0.49957123", "0.49841753", "0.4971962", "0.49686104", "0.4956146", "0.49481502", "0.49439058", "0.4940455", "0.4937802", "0.49360618", "0.4933536", "0.49332505", "0.493056", "0.4915472", "0.49142155", "0.49133015", "0.49099892", "0.49016154", "0.4882794", "0.4865302", "0.4864248", "0.48480493", "0.48455563", "0.4835571", "0.48300204", "0.48277906", "0.48174256", "0.47970796", "0.47924396", "0.47903633", "0.4783173", "0.47820532", "0.47730693" ]
0.7771416
0
If a chromosome cannot be fixed in a reasonable time we mark it as unfit by finding how much it overfills each bin.
private int totalInfeasibility(int[] chromosome) { int infeasibility = 0; int[] bins = new int[binCount]; for (int i = 0; i < chromosome.length; i++) { if (chromosome[i] >= bins.length) { infeasibility += 10; continue; } try { bins[chromosome[i]] += packageWeights[i]; //put package into bin } catch (Exception e) { System.out.println("noooo"); } } for (int i = 0; i < bins.length; i++) { if (bins[i] > binSize) infeasibility += bins[i] - binSize; } return infeasibility; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private int[] bestFitModified(int[] chromosome) {\n\t\tint[] bins = new int[binCount];\n\t\tArrayList<Integer> cannotPackList = new ArrayList<Integer>();\n\n\t\t//honor chromosome listing when possible\n\t\tfor (int i = 0; i < chromosome.length; i++) {\n\t\t\t//if this bin isnt full & won't be after placement & this chrom hasnt gone off the end \n\t\t\t//(VERY RARE, only happens when binCount is reduced w/ elitism)\n\t\t\tif (chromosome[i] < bins.length && bins[chromosome[i]] + packageWeights[i] <= binSize) {\n\t\t\t\tbins[chromosome[i]] += packageWeights[i]; //put package into bin\n\t\t\t} else { //store those we can't honor\n\t\t\t\tchromosome[i] = -1;\n\t\t\t\tcannotPackList.add(new Integer(i)); //save all those packages whos original bins were full\n\t\t\t}\n\t\t}\n\n\t\t//best fit on all the rest whos bins were full up\n\t\tint tries = 0;\n\t\tfor (int j = 0; j < cannotPackList.size(); j++) {\n\t\t\tint i = cannotPackList.get(j);\n\t\t\tint bestBinIndex = -1;\n\n\t\t\twhile (bestBinIndex < 0 && tries < bins.length * 2) { //while we still havent found a bin to put this in and time isn't up\n\n\t\t\t\tint bestBinLeftOverSpace = binSize * 100; //how much space is left in the bin when the packages is placed in it (ideally 0 = full bin)\n\n\t\t\t\tfor (int bin = 0; bin < bins.length; bin++) {\n\t\t\t\t\t//if this bin is closer to full than the best bin and not overfilled save it\n\t\t\t\t\tif ((binSize - (bins[bin] + packageWeights[i])) >= 0 && (binSize - (bins[bin] + packageWeights[i])) < bestBinLeftOverSpace) {\n\t\t\t\t\t\tbestBinIndex = bin;\n\t\t\t\t\t\tbestBinLeftOverSpace = binSize - (bins[bin] + packageWeights[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (bestBinIndex < 0) { //if could not pack, dump out a bin (mutation)\n\t\t\t\t\tj = 0;\n\t\t\t\t\tint dumpBin = rand.nextInt(binCount);\n\t\t\t\t\tfor (int binIndex = dumpBin; binIndex < binCount; binIndex++) {\n\t\t\t\t\t\tbins[binIndex] = 0;\n\t\t\t\t\t\tfor (int chromIndex = 0; chromIndex < chromosome.length; chromIndex++) {\n\t\t\t\t\t\t\tif (chromosome[chromIndex] == binIndex) {\n\t\t\t\t\t\t\t\tchromosome[chromIndex] = -1;\n\t\t\t\t\t\t\t\tcannotPackList.add(new Integer(chromIndex));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\ttries++;\n\t\t\t}\n\n\t\t\tif (tries >= bins.length * 2) {\n\t\t\t\treturn null; //this chromosome is unsalvageable because it is impossible to fit the packages in the bins\n\t\t\t}\n\n\n\t\t\tbins[bestBinIndex] += packageWeights[i];\n\t\t\tchromosome[i] = bestBinIndex;\n\t\t\tcannotPackList.remove(j);\n\t\t\tj--;\n\t\t}\n\n\t\treturn chromosome;\n\t}", "private boolean canReduceBins() {\n\t\tint oldBinCount = binCount;\n\t\tboolean canReduce = false;\n\t\tbinCount = binCount / 2;\n\t\tint[] chromosome = eliteChromosome.clone();\n\n\t\tif (getFitness(chromosome) <= binCount)\n\t\t\tcanReduce = true;\n\t\telse\n\t\t\tcanReduce = false;\n\t\tbinCount = oldBinCount; //no side effects\n\t\treturn canReduce;\n\t}", "private Integer getFitness(int[] chromosome) {\n\t\tint[] bins = new int[binCount]; //list of found bins\n\t\tfor (int binIndex = 0; binIndex < bins.length; binIndex++) { //initialize list of bins to unfound\n\t\t\tbins[binIndex] = -1;\n\t\t}\n\t\tint[] newChrom = bestFitModified(chromosome.clone()); //fix if infeasible\n\t\tif (newChrom == null) { //this is an unfixable chromosome, inform caller\n\t\t\treturn binCount * 2 + totalInfeasibility(chromosome);\n\t\t}\n\n\t\tfor (int i = 0; i < newChrom.length; i++) {\n\t\t\tchromosome[i] = newChrom[i]; //copy over to take advantage of side-effects\n\t\t}\n\t\tint uniqueBins = 0;\n\n\t\tfor (int i = 0; i < chromosome.length; i++) {\n\t\t\tif (bins[chromosome[i]] == -1) { //if we haven't seen this bin before track it and increment bin counter\n\t\t\t\tbins[chromosome[i]] = chromosome[i];\n\t\t\t\tuniqueBins++;\n\t\t\t} else\n\t\t\t\tcontinue;\n\t\t}\n\n\t\treturn uniqueBins;\n\t}", "Chromosome fittestChromosome();", "public void guess(){\n\t\tfor(int i=0;i<size;i++){\n\t\t\tfor(int j=0;j<size;j++){\n\t\t\t\tif(!boundary[i][j]){\n\t\t\t\t\tvalues[i][j]=100/(.05*i+1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t}", "public void clamp() //TODO: implement\n {\n System.out.println(\"clamp was called!\"); //DEBUGG: check if called, delete if i know when\n /*\n IntegerVectorSpecies _species = (IntegerVectorSpecies)species;\n for (int i = 0; i < genomeLength(); i++)\n {\n int minGene = (int)_species.minGene(i);\n if (genome[i].getValue() < minGene)\n genome[i].setValue(minGene); //what do do for the TraceID?\n else\n {\n int maxGene = (int)_species.maxGene(i);\n if (genome[i].getValue() > maxGene)\n genome[i] = maxGene;\n }\n }\n\n */\n }", "private void repairGenome() {\n if (checkGenome(this.code)) {\n return;\n }\n int[] counters = new int[8];\n for (int c : code) { counters[c]++; }\n for (int i = 0; i < 8; ++i) {\n if (counters[i] == 0) {\n while (true) {\n int newPos = r.nextInt(GENOME_SIZE);\n if (counters[this.code[newPos]] > 1) {\n counters[this.code[newPos]]--;\n this.code[newPos] = i;\n break;\n }\n }\n }\n }\n }", "private void layMineField ( int n , int pct)\n { \n Random generator = new Random( n );\n \n for ( int r = 0 ; r < rows ; r++ )\n {\n for ( int c = 0; c < cols ; c++ ) \n {\n if ( generator.nextInt( 100 ) < pct )\n theMines[ r ][ c ] = 1; \n else\n theMines[ r ][ c ] = 0;\n }\n }\n }", "public void removeMissiles(){\n nunMissiles--;\n }", "public void repair(){\n if(health < 9) {\n this.health++;\n }\n }", "private void\n\tcheck99PercentBug()\n\t{\n\n\t\tif ( mainloop_loop_count % MAINLOOP_SIXTY_SECOND_INTERVAL == 0 ) {\n\n\t\t\tlong\tnow = SystemTime.getCurrentTime();\n\n\t\t\tfor ( int i=0;i<pePieces.length;i++){\n\n\t\t\t\tPEPiece\tpe_piece = pePieces[ i ];\n\n\t\t\t\tif ( pe_piece != null ){\n\n\t\t\t\t\tDiskManagerPiece\tdm_piece = dm_pieces[i];\n\n\t\t\t\t\tif ( !dm_piece.isDone()){\n\n\t\t\t\t\t\tif ( pe_piece.isDownloaded()){\n\n\t\t\t\t\t\t\tif ( now - pe_piece.getLastDownloadTime(now) > stalled_piece_timeout ){\n\n\t\t\t\t\t\t\t\t// people with *very* slow disk writes can trigger this (I've been talking to a user\n\t\t\t\t\t\t\t\t// with a SAN that has .5 second write latencies when checking a file at the same time\n\t\t\t\t\t\t\t\t// this means that when dowloading > 32K/sec things start backing up). Eventually the\n\t\t\t\t\t\t\t\t// write controller will start blocking the network thread to prevent unlimited\n\t\t\t\t\t\t\t\t// queueing but until that time we need to handle this situation slightly better)\n\n\t\t\t\t\t\t\t\t// if there are any outstanding requests for this piece then leave it alone\n\n\t\t\t\t\t\t\t\tif ( !( disk_mgr.hasOutstandingWriteRequestForPiece( i ) || \n\t\t\t\t\t\t\t\t\t\tdisk_mgr.hasOutstandingReadRequestForPiece( i ) ||\n\t\t\t\t\t\t\t\t\t\tdisk_mgr.hasOutstandingCheckRequestForPiece( i ) )){\n\n\t\t\t\t\t\t\t\t\tDebug.out( \"Fully downloaded piece stalled pending write, resetting p_piece \" + i );\n\n\t\t\t\t\t\t\t\t\tpe_piece.reset();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t}", "public final void setUnbounded() {_occ.setUnbounded();}", "Chromosome getRandomAmongFittest(int limit);", "private void condenseSteam() {\n if (getPressure()> Constants.ATMOSPHERIC_PRESSURE) {\n double boilingPoint = Water.getBoilingTemperature(getPressure());\n if (boilingPoint > steam.getTemperature()) { // remove steam such that it equalizes to the boiling point\n double newSteamPressure = Math.max(Water.getBoilingPressure(steam.getTemperature()), Constants.ATMOSPHERIC_PRESSURE);\n \n\n int newQuantity = steam.getParticlesAtState(newSteamPressure, getCompressibleVolume());\n int deltaQuantity = steam.getParticleNr() - newQuantity;\n if (deltaQuantity < 0) {\n System.out.println(\"BAD\");\n }\n steam.remove(deltaQuantity);\n getWater().add(new Water(steam.getTemperature(), deltaQuantity));\n }\n } \n }", "public short fitsAtTheEnd(Tile tile);", "public void ruleOutPos(){\n for(int i=0;i<scores.length;i++) {\n for(int j=0;j<scores[i].length;j++) {\n scores[i][j][13] = 0;//0=pass, >0 is fail, set to pass initially\n\n //check Ns - bit crude - what to discount regions with high N\n double ns = (double) scores[i][j][14] / (double) pLens[j];\n if (ns >= minPb | ns >= minPm)//\n scores[i][j][13] += 4;\n\n //probe\n if (hasProbe){\n if (j == 1 | j == 4) {\n double perc = (double) scores[i][j][0] / (double) primers[j].length();\n if (perc >= minPb) {\n scores[i][j][12] = 1;//flag for failed % test\n scores[i][j][13] += 2;\n }\n }\n }\n //primer\n else {\n //if more than 2 mismatches in 1-4nt at 3'\n if(scores[i][j][11]>max14nt) {\n scores[i][j][13]+=1;\n }\n //use mLen (combined F and R length) initially to find initial candidates - filter later\n double perc=(double)scores[i][j][0]/(double)mLen;\n double percI=(double)scores[i][j][0]/(double)pLens[j];\n\n if(perc>=minPm | percI>=minPmI) {\n scores[i][j][12]=1;//flag for failed % test\n scores[i][j][13]+=2;\n }\n }\n }\n }//end of finding positions that prime loop\n }", "protected void timeIsOver(){\n //Gets all the boats that are not placed\n for(BoatDrawing myBoat : boatMap.values()){\n while(!myBoat.isPlaced()){\n //Sets a non placed boat with a random position with a random rotation\n activeBoat=myBoat;\n Random rn = new Random(); \n draw(activeBoat, rn.nextInt(NB_CASES_GRID), rn.nextInt(NB_CASES_GRID));\n if(rn.nextInt(RANDOM_ROTATION)==1){\n drawRotation(activeBoat);\n } \n if(positionCorrect(myBoat)){\n //If the position is corrrect, draws the boat\n this.placeBoat(myBoat);\n }\n }\n }\n onValidate();\n }", "protected abstract void thresholdReached() throws IOException;", "private void tooHigh() {\n if (this.hitPoints > 255) {\n System.out.println(\"You set the value too high! Setting it to 255\");\n this.hitPoints = 255;\n }\n }", "private void updateFromHit(int x, int y, boolean hit) {\n\t\tfloat[][] old = board.getBoardCopy();\n\t\tint fromX = Math.max(x - TOWER_RANGE, 0);\n\t\tint toX = Math.min(old.length, x + TOWER_RANGE);\n\t\tint fromY = Math.max(y - TOWER_RANGE, 0);\n\t\tint toY = Math.min(old[0].length, y + TOWER_RANGE);\n\t\tfor (int r = fromX; r < toX; r++) {\n\t\t\tfor (int c = fromY; c < toY; c++) {\n\t\t\t\tif (board.getSeen(r, c) // Only need to update out-of-view cells.\n\t\t\t\t\t\t|| distance(x, y, r, c) <= TOWER_RANGE) { // tower has circular range\n\t\t\t\t\tcontinue; \n\t\t\t\t}\n\n\t\t\t\tfloat phn, pht;\n\t\t\t\tif (hit) {\n\t\t\t\t\t// P(H|N) = 1 - P(S|N)\n\t\t\t\t\tphn = 1;\n\t\t\t\t\tfor (int rr = fromX; rr < toX; rr++) {\n\t\t\t\t\t\tfor (int cc = fromY; cc < toY; cc++) {\n\t\t\t\t\t\t\tif (rr == r && cc == c) continue;\n\t\t\t\t\t\t\t// P(S) = P(N)+(P(T)*(1-P(H)))\n\t\t\t\t\t\t\tphn *= (1f - old[rr][cc]) + (old[rr][cc] * (1f - TOWER_ACCURACY));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tphn = 1f - phn;\n\n\t\t\t\t\t// P(H|T): same as above, but without skipping r, c\n\t\t\t\t\t// Simplifies to 1-((1-P(H|N))*P(M)) since tower existing is given.\n\t\t\t\t\tpht = 1f - ((1f - phn) * (1f - TOWER_ACCURACY));\n\t\t\t\t} else {\n\t\t\t\t\t// P(S|N) = P(S)\n\t\t\t\t\tphn = 1;\n\t\t\t\t\tfor (int rr = fromX; rr < toX; rr++) {\n\t\t\t\t\t\tfor (int cc = fromY; cc < toY; cc++) {\n\t\t\t\t\t\t\tif (rr == r && cc == c) continue;\n\t\t\t\t\t\t\t// P(S) = P(N)+(P(T)*(1-P(H)))\n\t\t\t\t\t\t\tphn *= (1f - old[rr][cc]) + (old[rr][cc] * (1f - TOWER_ACCURACY));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// P(S|T): same as above, but without skipping r, c\n\t\t\t\t\t// Simplifies to P(H|N))*P(M) since tower existing is given.\n\t\t\t\t\tpht = phn * (1f - TOWER_ACCURACY);\n\t\t\t\t}\n\n\t\t\t\t// P(T|H) = P(H|T)*P(T)/(P(H|T)*P(T)+P(H|N)*P(N))\n\t\t\t\tboard.setTowerProbability(r, c, pht * old[r][c] / (pht * old[r][c] + phn * (1 - old[r][c])));\n\t\t\t}\n\t\t}\n\t}", "public boolean outOfBounds()\n {\n if((lastpowerUp.equals(\"BLUE\") || lastpowerUp.equals(\"RAINBOW\")) && powerupTimer > 0)\n {\n return false;\n }\n \n if(head.getA() < 150 || head.getA() >= 1260)\n return true;\n else if(head.getB() <150 || head.getB() >=630)\n return true;\n else \n return false;\n \n \n }", "public int adjustForCrowding() {\n int deadGuppyCount = 0;\n\n Collections.sort(this.guppiesInPool, new Comparator<Guppy>() {\n @Override\n public int compare(Guppy g1, Guppy g2) {\n return Double.compare(g1.getHealthCoefficient(), g2.getHealthCoefficient());\n }\n });\n\n Guppy weakestGuppy;\n Iterator<Guppy> it = guppiesInPool.iterator();\n double volumeNeeded = this.getGuppyVolumeRequirementInLitres();\n\n while (it.hasNext() && volumeNeeded > this.getVolumeLitres()) {\n weakestGuppy = it.next();\n volumeNeeded -= (weakestGuppy.getVolumeNeeded() / ML_TO_L_CONVERSION);\n\n weakestGuppy.setIsAlive(false);\n\n\n deadGuppyCount++;\n\n }\n return deadGuppyCount;\n }", "public void modifyFitness(Population population) {\n // prepare the calculation\n double[][] data = new double[population.size()][];\n for (int i = 0; i < data.length; i++) {\n data[i] = ((AbstractEAIndividual)population.get(i)).getFitness();\n }\n double min = Double.POSITIVE_INFINITY, fitnessSharing;\n double[] result = new double[data.length];\n AbstractEAIndividual tmpIndy;\n\n for (int x = 0; x < data[0].length; x++) {\n for (int i = 0; i < data.length; i++) data[i][x] = -data[i][x];\n for (int i = 0; i < data.length; i++) {\n if (data[i][x] < min) min = data[i][x];\n }\n\n for (int i = 0; i < data.length; i++) {\n // This will cause the worst individual to have no chance of being selected\n // also note that if all individual achieve equal fitness the sum will be zero\n result[i] = data[i][x] -min + 0.1;\n }\n\n for (int i = 0; i < population.size(); i++) {\n tmpIndy = (AbstractEAIndividual)population.get(i);\n fitnessSharing = 0;\n for (int j = 0; j < population.size(); j++) {\n if (this.m_SharingDistance < this.m_Metric.distance(tmpIndy, (AbstractEAIndividual)population.get(j))) {\n fitnessSharing += 1 - (this.m_Metric.distance(tmpIndy, (AbstractEAIndividual)population.get(j))/this.m_SharingDistance);\n }\n }\n result[i] = result[i]/fitnessSharing;\n }\n\n for (int i = 0; i < population.size(); i++) {\n ((AbstractEAIndividual)population.get(i)).SetFitness(x, result[i]);\n }\n }\n }", "public void hardMode(Boolean hitResult) throws LocationHitException{\r\n\t\tint x = 0, y = 0;\r\n\t\tint mostProbable;\r\n\r\n\t\tif (minMax == 0) {\r\n\t\t\tmostProbable = 1;\r\n\t\t\tfor (int i = 0; i < 9; i++) {\r\n\t\t\t\tfor (int j = 0; j < 11; j++) {\r\n\t\t\t\t\tif (probabilityGrid[i][j] > mostProbable) {\r\n\t\t\t\t\t\tmostProbable = probabilityGrid[i][j];\r\n\t\t\t\t\t\tx = i;\r\n\t\t\t\t\t\ty = j;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tminMax = 1;\r\n\t\t} else {\r\n\t\t\tmostProbable = 1000;\r\n\t\t\tfor (int i = 0; i < 9; i++) {\r\n\t\t\t\tfor (int j = 0; j < 11; j++) {\r\n\t\t\t\t\tif (probabilityGrid[i][j] < mostProbable && probabilityGrid[i][j] > 0) {\r\n\t\t\t\t\t\tmostProbable = probabilityGrid[i][j];\r\n\t\t\t\t\t\tx = i;\r\n\t\t\t\t\t\ty = j;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tminMax = 0;\r\n\t\t}\r\n\r\n\t\tif (!hitResult && direction.isEmpty()) {\r\n\t\t\tboolean newHit = false;\r\n\t\t\twhile (!newHit) {\r\n\t\t\t\tif (Player.userGrid[x][y] == 2 || Player.userGrid[x][y] == 3) {\r\n\t\t\t\t\tprobabilityGrid[x][y] = -1;\r\n\t\t\t\t\tif (minMax == 0) {\r\n\t\t\t\t\t\tfor (int i = 0; i < 9; i++) {\r\n\t\t\t\t\t\t\tfor (int j = 0; j < 11; j++) {\r\n\t\t\t\t\t\t\t\tif (probabilityGrid[i][j] > mostProbable) {\r\n\t\t\t\t\t\t\t\t\tmostProbable = probabilityGrid[i][j];\r\n\t\t\t\t\t\t\t\t\tx = i;\r\n\t\t\t\t\t\t\t\t\ty = j;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tminMax = 1;\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tfor (int i = 0; i < 9; i++) {\r\n\t\t\t\t\t\t\tfor (int j = 0; j < 11; j++) {\r\n\t\t\t\t\t\t\t\tif (probabilityGrid[i][j] < mostProbable && probabilityGrid[i][j] > 0) {\r\n\t\t\t\t\t\t\t\t\tmostProbable = probabilityGrid[i][j];\r\n\t\t\t\t\t\t\t\t\tx = i;\r\n\t\t\t\t\t\t\t\t\ty = j;\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tminMax = 0;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else\r\n\t\t\t\t\tnewHit = true;\r\n\t\t\t}\r\n\t\t} else if (direction.isEmpty()) {\r\n\t\t\thitFound.add(hitX + \";\" + hitY);\r\n\t\t\tcounter++;\r\n\t\t\tif ((hitX + 1) < 9) {\r\n\t\t\t\tx = hitX + 1;\r\n\t\t\t\ty = hitY;\r\n\t\t\t\tdirection = \"HorizontalFront\";\r\n\t\t\t} else {\r\n\t\t\t\tx = hitX - 1;\r\n\t\t\t\ty = hitY;\r\n\t\t\t\tdirection = \"HorizontalBack\";\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (direction.equals(\"HorizontalFront\")) {\r\n\t\t\t\tint tempX = Integer.parseInt(hitFound.get(0).split(\";\")[0]);\r\n\t\t\t\tint tempY = Integer.parseInt(hitFound.get(0).split(\";\")[1]);\r\n\t\t\t\tif (hitResult && (hitX + 1 < 9)) {\r\n\t\t\t\t\tcounter++;\r\n\t\t\t\t\tx = hitX + 1;\r\n\t\t\t\t\ty = hitY;\r\n\t\t\t\t} else if (tempX > 0) {\r\n\t\t\t\t\tx = tempX - 1;\r\n\t\t\t\t\ty = tempY;\r\n\t\t\t\t\tdirection = \"HorizontalBack\";\r\n\t\t\t\t} else if ((Integer.parseInt(hitFound.get(0).split(\";\")[1]) + 1 < 11)) {\r\n\t\t\t\t\tx = Integer.parseInt(hitFound.get(0).split(\";\")[0]);\r\n\t\t\t\t\ty = Integer.parseInt(hitFound.get(0).split(\";\")[1]) + 1;\r\n\t\t\t\t\tdirection = \"VerticalFront\";\r\n\t\t\t\t} else {\r\n\t\t\t\t\tx = Integer.parseInt(hitFound.get(0).split(\";\")[0]);\r\n\t\t\t\t\ty = Integer.parseInt(hitFound.get(0).split(\";\")[1]) - 1;\r\n\t\t\t\t\tdirection = \"VerticalBack\";\r\n\t\t\t\t}\r\n\t\t\t} else if (direction.equals(\"HorizontalBack\")) {\r\n\t\t\t\tif (hitResult && (hitX > 0)) {\r\n\t\t\t\t\tcounter++;\r\n\t\t\t\t\tx = hitX - 1;\r\n\t\t\t\t\ty = hitY;\r\n\t\t\t\t} else if (Integer.parseInt(hitFound.get(0).split(\";\")[1]) + 1 < 11 && counter < 2) {\r\n\t\t\t\t\tx = Integer.parseInt(hitFound.get(0).split(\";\")[0]);\r\n\t\t\t\t\ty = Integer.parseInt(hitFound.get(0).split(\";\")[1]) + 1;\r\n\t\t\t\t\tdirection = \"VerticalFront\";\r\n\t\t\t\t} else if (counter < 2) {\r\n\t\t\t\t\tx = Integer.parseInt(hitFound.get(0).split(\";\")[0]);\r\n\t\t\t\t\ty = Integer.parseInt(hitFound.get(0).split(\";\")[1]) - 1;\r\n\t\t\t\t\tdirection = \"VerticalBack\";\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (minMax == 0) {\r\n\t\t\t\t\t\tfor (int i = 0; i < 9; i++) {\r\n\t\t\t\t\t\t\tfor (int j = 0; j < 11; j++) {\r\n\t\t\t\t\t\t\t\tif (probabilityGrid[i][j] > mostProbable) {\r\n\t\t\t\t\t\t\t\t\tmostProbable = probabilityGrid[i][j];\r\n\t\t\t\t\t\t\t\t\tx = i;\r\n\t\t\t\t\t\t\t\t\ty = j;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tminMax = 1;\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tfor (int i = 0; i < 9; i++) {\r\n\t\t\t\t\t\t\tfor (int j = 0; j < 11; j++) {\r\n\t\t\t\t\t\t\t\tif (probabilityGrid[i][j] < mostProbable && probabilityGrid[i][j] > 0) {\r\n\t\t\t\t\t\t\t\t\tmostProbable = probabilityGrid[i][j];\r\n\t\t\t\t\t\t\t\t\tx = i;\r\n\t\t\t\t\t\t\t\t\ty = j;\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tminMax = 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdirection = \"\";\r\n\t\t\t\t\thitFound.clear();\r\n\t\t\t\t\tcounter = 0;\r\n\t\t\t\t}\r\n\t\t\t} else if (direction.equals(\"VerticalFront\") && counter < 2) {\r\n\t\t\t\tif (hitResult && (hitY + 1 < 11)) {\r\n\t\t\t\t\tx = hitX;\r\n\t\t\t\t\ty = hitY + 1;\r\n\t\t\t\t} else if (Integer.parseInt(hitFound.get(0).split(\";\")[1]) > 0) {\r\n\t\t\t\t\tx = Integer.parseInt(hitFound.get(0).split(\";\")[0]);\r\n\t\t\t\t\ty = Integer.parseInt(hitFound.get(0).split(\";\")[1]) - 1;\r\n\t\t\t\t\tdirection = \"VerticalBack\";\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (minMax == 0) {\r\n\t\t\t\t\t\tfor (int i = 0; i < 9; i++) {\r\n\t\t\t\t\t\t\tfor (int j = 0; j < 11; j++) {\r\n\t\t\t\t\t\t\t\tif (probabilityGrid[i][j] > mostProbable) {\r\n\t\t\t\t\t\t\t\t\tmostProbable = probabilityGrid[i][j];\r\n\t\t\t\t\t\t\t\t\tx = i;\r\n\t\t\t\t\t\t\t\t\ty = j;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tminMax = 1;\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tfor (int i = 0; i < 9; i++) {\r\n\t\t\t\t\t\t\tfor (int j = 0; j < 11; j++) {\r\n\t\t\t\t\t\t\t\tif (probabilityGrid[i][j] < mostProbable && probabilityGrid[i][j] > 0) {\r\n\t\t\t\t\t\t\t\t\tmostProbable = probabilityGrid[i][j];\r\n\t\t\t\t\t\t\t\t\tx = i;\r\n\t\t\t\t\t\t\t\t\ty = j;\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tminMax = 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdirection = \"\";\r\n\t\t\t\t\thitFound.clear();\r\n\t\t\t\t\tcounter = 0;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif (hitResult && (hitY > 0) && counter < 2) {\r\n\t\t\t\t\tx = hitX;\r\n\t\t\t\t\ty = hitY - 1;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (minMax == 0) {\r\n\t\t\t\t\t\tfor (int i = 0; i < 9; i++) {\r\n\t\t\t\t\t\t\tfor (int j = 0; j < 11; j++) {\r\n\t\t\t\t\t\t\t\tif (probabilityGrid[i][j] > mostProbable) {\r\n\t\t\t\t\t\t\t\t\tmostProbable = probabilityGrid[i][j];\r\n\t\t\t\t\t\t\t\t\tx = i;\r\n\t\t\t\t\t\t\t\t\ty = j;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tminMax = 1;\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tfor (int i = 0; i < 9; i++) {\r\n\t\t\t\t\t\t\tfor (int j = 0; j < 11; j++) {\r\n\t\t\t\t\t\t\t\tif (probabilityGrid[i][j] < mostProbable && probabilityGrid[i][j] > 0) {\r\n\t\t\t\t\t\t\t\t\tmostProbable = probabilityGrid[i][j];\r\n\t\t\t\t\t\t\t\t\tx = i;\r\n\t\t\t\t\t\t\t\t\ty = j;\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tminMax = 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdirection = \"\";\r\n\t\t\t\t\thitFound.clear();\r\n\t\t\t\t\tcounter = 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tprobabilityGrid[x][y] = -1;\r\n\t\thitX = x;\r\n\t\thitY = y;\r\n\r\n\t\tint hitCoord[] = { x, y };\r\n\t\tsetCoords(hitCoord);\r\n\r\n\t\tif (Player.userGrid[x][y] == 1) {\r\n\t\t\t// change the grid value from 1 to 2 to signify hit\r\n\t\t\tPlayer.userGrid[x][y] = 2;\r\n\t\t\tString coordx = Integer.toString(x);\r\n\t\t\tString coordy = Integer.toString(y);\r\n\t\t\tif(!time1) {\r\n\t\t\t\ttimea=java.lang.System.currentTimeMillis();\r\n\t\t\t\ttime1=!time1;\r\n\t\t\t}else if(!time2) {\r\n\t\t\t\ttimeb=java.lang.System.currentTimeMillis();\r\n\t\t\t\t\ttime2=!time2;\r\n\t\t\t}else {\r\n\t\t\t\tdouble t=timeb-timea;\r\n\t\t\t\tif(t<3000) {\r\n\t\t\t\t\tsetScore(20);\r\n\t\t\t\t}\r\n\t\t\t\ttime1=false;\r\n\t\t\t\ttime2=false;\r\n\t\t\t\ttimea=0;\r\n\t\t\t\ttimeb=0;\r\n\t\t\t\t\r\n\t\t\t}//if time between consecutive hit is less than 3 seconds ,then bonus score\r\n\t\t\tsetScore(10);\r\n\t\t\tPlayer.coordinatesHit.add(coordx + \",\" + coordy);\r\n\t\t\tsetReply(\"It's a Hit!!!!!\");\r\n\t\t} else if (Player.userGrid[x][y] == 0) {\r\n\t\t\tPlayer.userGrid[x][y] = 3;\r\n\t\t\tsetScore(-1);\r\n\t\t\tsetReply(\"It's a miss!!!!!\");\r\n\t\t} else if (Player.userGrid[x][y] == 2 || Player.userGrid[x][y] == 3) {\r\n\t\t\tsetReply(\"The location has been hit earlier\");\r\n\t\t\t//throw new LocationHitException(\"The location has been hit earlier\");\r\n\r\n\t\t}\r\n\r\n\t}", "private void bombDifficulty(int maxBombs) {\r\n int randomRow;\r\n int randomCol;\r\n for(int bombAmount = 0; bombAmount < maxBombs;){\r\n randomRow = rand.nextInt(map.length-1);\r\n randomCol = rand.nextInt(map[0].length-1);\r\n if(map[randomRow][randomCol].getSafe() == false){\r\n //Do nothing. Checks if same row col is not chosen again\r\n }\r\n else {\r\n map[randomRow][randomCol].setSafe(false);\r\n if (TESTING_MODE) {\r\n map[randomRow][randomCol].setVisual(bomb);\r\n\r\n }\r\n bombAmount++;\r\n }\r\n }\r\n }", "private void checkResetUnderflow(int register) {\r\n\t\t/* register values smaller than or equal to 0*/\r\n\t\tif(sim40.memory[register] <= 0) {\r\n\t\t\tsetRegToMin(register);\r\n\t\t\r\n\t\t}\r\n\t}", "private int calculateConsecutiveDuplicateMutationsThreshold(){\n \tint combinedSiteLength = region.getCombinedSitesLength();\n \tif(combinedSiteLength <= 10){\n \t\treturn 100; // around the order of magnitude of 1,000,000 if we assume each of the 10 positions could have any of the 4 nucleotides\n \t}else{\n \t\tint consecFactor = 400000 / (combinedSiteLength * combinedSiteLength * combinedSiteLength * iContext.strategy.nucleotides.length);\n \t\treturn Math.max(2, consecFactor);\n \t}\n }", "private void calculateBPRange() {\n\t\tbroadPhaseLength = 0.0f;\n\t\tfor (Vector2f p : points) {\n\t\t\tbroadPhaseLength = Math.max(broadPhaseLength, Math.abs(p.length()));\n\t\t}\n\t}", "private void removeInvalidFromPool()\r\n\t{\r\n\t\tint i;\r\n\t\tint size_mature_pool;\r\n\t\tint idx_1st_oldest;//index of the oldest individual\r\n\t\tint idx_2nd_oldest;//index of the 2nd oldest individual\r\n\t\tint idx_to_remove;//index of an chromosome which has to be removed\r\n\t\tint idx_current;//index of currently checked genotype\r\n\t\tint num_errors;//number of errors of the current chromosome\r\n\t\tint max_num_errors;//maximum numbers of stored errors among checked chromosomes\r\n\t\tdouble error_1st_oldest;//average error of the oldest individual\r\n\t\tdouble error_2nd_oldest;//average error of the 2nd oldest individual\r\n\t\tdouble max_error;//largest error among the oldest individuals\r\n\t\tVector<Integer> idx_oldest;//indices of all chromosomes with a life span larger than a predefined threshold\r\n\t\t\r\n\t\tsize_mature_pool = _pool_of_bests.size();\r\n\t\t\r\n\t\t//if the maturity pool is full and none of the genotypes could be removed above because of module outputs\r\n\t\t//then remove one of the oldest individuals according to the errors\r\n\t\tif(_pool_of_bests.size()==_size_pool_of_bests)\r\n\t\t{\r\n\t\t\tidx_oldest = new Vector<Integer>(0, 1);\r\n\t\t\t\r\n\t\t\t//find all oldest genotypes\r\n\t\t\tfor(i=0; i<size_mature_pool; i++)\r\n\t\t\t{\r\n\t\t\t\tnum_errors = _pool_of_bests.get(i)._error.all_single_squares.size();\r\n\t\t\t\tif(num_errors>=_min_life_span)\r\n\t\t\t\t{\r\n\t\t\t\t\tidx_oldest.add(i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t//1) find the worst oldest gentypes with a span above a threshold\r\n\t\t\t//2) do not remove a single genotype without comparison;\r\n\t\t\t// it could have very high performance\r\n\t\t\tif(idx_oldest.size() > 1)\r\n\t\t\t{\r\n\t\t\t\tidx_to_remove = idx_oldest.get(0);\r\n\t\t\t\tmax_error = _pool_of_bests.get(idx_to_remove)._error.getAverageError();\r\n\t\t\t\tfor(i=idx_to_remove+1; i<idx_oldest.size(); i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tidx_current = idx_oldest.get(i);\r\n\t\t\t\t\tif(max_error < _pool_of_bests.get(idx_current)._error.getAverageError())\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tidx_to_remove = idx_current;\r\n\t\t\t\t\t\tmax_error = _pool_of_bests.get(idx_to_remove)._error.getAverageError();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse//remove the worst of two oldest genotypes if none of genotypes had span above the threshold\r\n\t\t\t{\r\n\t\t\t\t//find the oldest and 2nd oldest individuals\r\n\t\t\t\tidx_1st_oldest = -1;\r\n\t\t\t\tmax_num_errors = 0;\r\n\t\t\t\tfor(i=0; i<size_mature_pool; i++)\r\n\t\t\t\t{\r\n\t\t\t\t\t//\"[0]\" because the number of errors is equal for all sub-individuals of the same individual\r\n\t\t\t\t\tnum_errors = _pool_of_bests.get(i)._error.all_single_squares.size();\r\n\t\t\t\t\tif(max_num_errors < num_errors)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tmax_num_errors = num_errors;\r\n\t\t\t\t\t\tidx_1st_oldest = i;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t//find the 2nd oldest individuals\r\n\t\t\t\tidx_2nd_oldest = -1;\r\n\t\t\t\tif(size_mature_pool > 1)//the 2nd oldest individual exists if there are 2 or more individuals\r\n\t\t\t\t{\r\n\t\t\t\t\tmax_num_errors = 0;\r\n\t\t\t\t\tfor(i=0; i<size_mature_pool; i++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(i!=idx_1st_oldest)//the oldest individual should be ignored\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t//\"[0]\" because the number of errors is equal for all sub-individuals of the same individual\r\n\t\t\t\t\t\t\tnum_errors = _pool_of_bests.get(i)._error.all_single_squares.size();\r\n\t\t\t\t\t\t\tif(max_num_errors < num_errors)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tmax_num_errors = num_errors;\r\n\t\t\t\t\t\t\t\tidx_2nd_oldest = i;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//compare performances of both oldest genotypes using their average errors;\r\n\t\t\t\terror_1st_oldest = _pool_of_bests.get(idx_1st_oldest)._error.getAverageError();\r\n\t\t\t\tif(idx_2nd_oldest!=-1)\r\n\t\t\t\t{\r\n\t\t\t\t\terror_2nd_oldest = _pool_of_bests.get(idx_2nd_oldest)._error.getAverageError();\r\n\r\n\t\t\t\t\tif(error_1st_oldest < error_2nd_oldest)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tidx_to_remove = idx_2nd_oldest;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tidx_to_remove = idx_1st_oldest;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse//a single individual must always be replaced\r\n\t\t\t\t{\r\n\t\t\t\t\tidx_to_remove = idx_1st_oldest;\r\n\t\t\t\t}\r\n\t\t\t}//are there genotypes with life span above a threshold?\r\n\t\t\t\r\n\t\t\t_pool_of_bests.remove(idx_to_remove);\r\n\t\t}//is maturity pool full?\r\n\t}", "public void updateOptimalCollisionArea();", "@Override\n public boolean hasSeenAtLeast(int numLiveCellsDesired) {\n return live() > numLiveCellsDesired;\n }", "@Override\n public boolean hasSeenAtLeast(int numLiveCellsDesired) {\n return live() > numLiveCellsDesired;\n }", "private void setMaxThreshold() {\n maxThreshold = value - value * postBoundChange / 100;\n }", "private void notEligibleForRealMin() {\n eligibleForRealMin = false;\n }", "public void findHighestPowerUnitAnySize() {\r\n\t\ttimer.startAlgorithm(\"ChronalCharger.findHighestPowerUnitAnySize()\");\r\n\t\tfor (int i=1; i<=300; i++) {\r\n//\t\t\tcurrentGrid = new ShrinkingPowerGrid(i, 300);\r\n\t\t\tfindHighestPowerUnit(i);\r\n//\t\t\tpreviousGrids.add(currentGrid);\r\n\t\t}\r\n\t\ttimer.stopAlgorithm();\r\n\t}", "private void coverExistingValues() \n {\n for(int i = 1; i <= gDim; i++)\n {\n for(int j = 1; j <= gDim; j++)\n {\n //If the board has a value at the current position, cover the satisfied rows and columns\n if(board[i - 1][j - 1] != null)\n {\n int rowIndex = rcvToMatrixRow(i, j, board[i - 1][j - 1]);\n coverSatisfiedColumns(ecmCoveredCols, rowIndex);\n coverSatisfiedRows(ecmCoveredRows, rowIndex);\n }\n }\n }\n }", "@Test\r\n\tpublic void testFillChargingNonlinear_HighInitialSoC_ExhaustiveDesiredCapacity() {\n\t\tSimulation.verbosity = 0;\r\n\t\tint startTimeSeconds = 0;\r\n\t\t\r\n\t\t// Charge until soc=0.9\r\n\t\tdouble initialSoC = 0.9;\r\n\t\twhile (car.carBattery.getSoC() < initialSoC) {\r\n\t\t\tcar.addChargedCapacity(1, 32);\r\n\t\t}\r\n\t\t\r\n\t\tdouble desiredCapacity = 0.1;\r\n\t\twhile (desiredCapacity <= car.getMissingCapacity()) {\r\n\t\t\t\r\n\t\t\tcar.setCurrentPlan(new double[96]);\r\n\t\t\tschedulerNonlinear.fillChargingPlan(car, chargingStation, desiredCapacity, \r\n\t\t\t\t\tTimeslotSorter.getSortedTimeslots(null, 0, 96, TimeslotSortingCriteria.INDEX), \r\n\t\t\t\t\tstartTimeSeconds);\r\n\t\t\t\r\n\r\n\t\t\tdouble plannedCapacity = schedulerNonlinear.getPlannedCapacity(chargingStation, car, startTimeSeconds);\r\n\t\t\t//System.out.println(\"desiredCapacity=\" + desiredCapacity + \"Ah, plannedCapacity=\" + plannedCapacity);\r\n\t\t\t\r\n\t\t\tassertEquals(desiredCapacity, plannedCapacity, 1e-2);\r\n\t\t\tdesiredCapacity+=0.1;\r\n\t\t}\r\n\t\t\r\n\t}", "void updateOccupancy() {\n\t\toccupied = !occupied;\n\t}", "private boolean shouldApply() {\n return nextRandomInt() >= unappliedJobCutoff;\n }", "@Override\n public int getRemainingMines() {\n int numPlacedFlags = cells.stream()\n .mapToInt(b -> (int) b.stream().filter(c -> c.getFlagState() == 1).count()).sum();\n return numMines - numPlacedFlags;\n }", "public void markDangerTiles() {\n List<Tile> dangerTiles = this.gb.nearByTiles(this.enemy_head_x, this.enemy_head_y);\n if (dangerTiles.contains(this.gb.get(this.us_head_x, this.us_head_y)))\n return; // Don't force fill if our head is there\n for (Tile t : dangerTiles)\n t.setForceFilled(true);\n }", "@Override\n public void mutate(Chromosome c) {\n if (c.getFitness() == 0) return;\n\n boolean[] genes = c.getGenes();\n int weight = c.getWeight();\n\n for (int i = 0; i < genes.length; i++) {\n if (weight == Config.CAPACITY) break;\n\n if (!genes[i]) {\n if (weight + Config.ITEMS[i].getWeight() <= Config.CAPACITY) {\n c.flipGene(i);\n }\n }\n }\n \n }", "private void reallocateIfOverfilled() {\r\n\t\tif ((size * 1.0 / table.length) > MAX_FULLNESS_PERCENTAGE) {\r\n\t\t\treallocateArray();\r\n\t\t}\r\n\t}", "public void resetDamagedRange() {\r\n fDamagedRange[0] = Integer.MAX_VALUE;\r\n fDamagedRange[1] = Integer.MIN_VALUE;\r\n }", "public boolean isFull() {\n return this.chromosomes.size() >= Defines.popSize;\n }", "protected void checkSize()\n {\n // check if pruning is required\n if (m_cCurUnits > m_cMaxUnits)\n {\n synchronized (this)\n {\n // recheck so that only one thread prunes\n if (m_cCurUnits > m_cMaxUnits)\n {\n prune();\n }\n }\n }\n }", "public int computeRangedDamageTo(Combatant opponent) { return 0; }", "public int getLastStuck ()\r\n {\r\n int stuck = 0;\r\n\r\n for (GlyphSection section : glyph.getMembers()) {\r\n Run sectionRun = section.getLastRun();\r\n\r\n for (GlyphSection sct : section.getTargets()) {\r\n if (!sct.isGlyphMember() || (sct.getGlyph() != glyph)) {\r\n stuck += sectionRun.getCommonLength(sct.getFirstRun());\r\n }\r\n }\r\n }\r\n\r\n return stuck;\r\n }", "public void sanityCheck() {\n if ( bucket >= mNumBins ) bucket = mNumBins - 1;\n\n // Sanity check, should not happen.\n if ( bucket < 0 ) bucket = 0;\n }", "public short fitsOnBeginning(Tile tile);", "private static void getFitness() {\n\t\tint popSize = population.size();\n\t\tChromosome thisChromo = null;\n\t\tdouble bestScore = 0;\n\t\tdouble worstScore = 0;\n\n\t\t// The worst score would be the one with the highest energy, best would be\n\t\t// lowest.\n\t\tworstScore = population.get(maximum()).conflicts();\n\n\t\t// Convert to a weighted percentage.\n\t\tbestScore = worstScore - population.get(minimum()).conflicts();\n\n\t\tfor (int i = 0; i < popSize; i++) {\n\t\t\tthisChromo = population.get(i);\n\t\t\tthisChromo.fitness((worstScore - thisChromo.conflicts()) * 100.0 / bestScore);\n\t\t}\n\n\t\treturn;\n\t}", "public void detectCollisions() {\r\n\r\n for (int pos = 0; pos < this.numberOfBees; pos++) {\r\n if (!beesArray[pos].isInCollisionRisk()) {\r\n int i = beesArray[pos].getI();\r\n int j = beesArray[pos].getJ();\r\n int k = beesArray[pos].getK();\r\n for (int x = (i - offset); x <= (i + offset); x++) {\r\n for (int y = (j - offset); y <= (j + offset); y++) {\r\n for (int z = (k - offset); z <= (k + offset); z++) {\r\n if (x == i && y == j && z == k || (Math.abs(i - j) == 0) || Math.abs(i - j) == 2 * offset) {\r\n continue;\r\n } else if (BeesCollision[x][y][z] != null) {\r\n beesArray[pos].setCollision(true);\r\n if (BeesCollision[x][y][z].size() == 1) {\r\n BeesCollision[x][y][z].getFirst().setCollision(true);\r\n break;\r\n }\r\n }\r\n }\r\n if (beesArray[pos].isInCollisionRisk()) {\r\n break;\r\n }\r\n }\r\n if (beesArray[pos].isInCollisionRisk()) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }", "public float onAbsorbHeat(float rfAbsorbed) {\n\t\tif(getFluidAmount(COLD) <= 0 || rfAbsorbed <= 0) { return rfAbsorbed; }\n\n\t\tFluid coolantType = getCoolantType();\n\t\tint coolantAmt = getFluidAmount(COLD);\n\n\t\tfloat heatOfVaporization = getHeatOfVaporization(coolantType);\n\t\t\n\t\tint mbVaporized = Math.min(coolantAmt, (int)(rfAbsorbed / heatOfVaporization));\n\n\t\t// Cap by the available space in the vapor chamber\n\t\tmbVaporized = Math.min(mbVaporized, getRemainingSpaceForFluid(HOT));\n\t\t\n\t\t// We don't do partial vaporization. Just return all the heat.\n\t\tif(mbVaporized < 1) { return rfAbsorbed; }\n\n\t\t// Make sure we either have an empty vapor chamber or the vapor types match\n\t\tFluid newVaporType = getVaporizedCoolantFluid(coolantType);\n\t\tif(newVaporType == null) {\n\t\t\tBRLog.warning(\"Coolant in tank (%s) has no registered vapor type!\", coolantType.getName());\n\t\t\treturn rfAbsorbed;\n\t\t}\n\t\t\n\t\tFluid existingVaporType = getVaporType();\n\t\tif(existingVaporType != null && !newVaporType.getName().equals(existingVaporType.getName())) {\n\t\t\t// Can't vaporize anything with incompatible vapor in the vapor tank\n\t\t\treturn rfAbsorbed;\n\t\t}\n\t\t\n\t\t// Vaporize! -- POINT OF NO RETURN\n\t\tfluidVaporizedLastTick = mbVaporized;\n\t\tthis.drainCoolant(mbVaporized);\n\t\t\n\t\tif(existingVaporType != null) {\n\t\t\taddFluidToStack(HOT, mbVaporized);\n\t\t}\n\t\telse {\n\t\t\tfill(HOT, new FluidStack(newVaporType, mbVaporized), true);\n\t\t}\n\t\t\n\t\t// Calculate how much we actually absorbed via vaporization\n\t\tfloat energyConsumed = (float)mbVaporized * heatOfVaporization;\n\t\t\n\t\t// And return energy remaining after absorption\n\t\treturn Math.max(0f, rfAbsorbed - energyConsumed);\n\t}", "public void revealArea(int row, int col) {\r\n if(this.isExplode(row, col) == true){\r\n System.out.println(\"BOOOOM!\\nYOU LOSE!\");\r\n EndBox.end(\"Lose\", \"BOOOOM! YOU LOSE!!!\");\r\n System.exit(0);\r\n }\r\n this.detectBombs(row, col);\r\n for(int i = 0; i<100; i++){//Searches for 0 over and over again to make sure no more 0's are unchecked.\r\n for (int r = 0; r<map.length; r++) {\r\n for (int c = 0; c<map[0].length; c++) {\r\n if(map[r][c].getVisual().equals(zero)){\r\n this.detectBombs(r - 1, c);\r\n this.detectBombs(r + 1, c);\r\n this.detectBombs(r, c + 1);\r\n this.detectBombs(r, c - 1);\r\n this.detectBombs(r - 1, c + 1);\r\n this.detectBombs(r - 1, c - 1);\r\n this.detectBombs(r + 1, c - 1);\r\n this.detectBombs(r + 1, c + 1);\r\n }\r\n }\r\n\r\n }\r\n }\r\n\r\n }", "private void tileSetSurroundingBombs() {\r\n for (int r = 0; r < gridSize; r++) {\r\n for (int c = 0; c < gridSize; c++) {\r\n int neighborBombs = neighborBombCount(grid[r][c]);\r\n grid[r][c].setSurroundingBombs(neighborBombs);\r\n }\r\n } \r\n }", "public void tensionRangeCheck(){\n if(motor.get() < 0){\n if(Bottom_Limit_Switch.get() | tenPot.pidGet()> tenPotMAX ){\n motor.set(0.0);\n }\n }else if(motor.get() > 0){\n if(Top_Limit_Switch.get() | tenPot.pidGet()< tenPotMIN){\n motor.set(0.0);\n }\n }\n }", "public void resetFeasible() {\r\n \tstillFeasible = true;\r\n }", "protected void clearRangeTest() {\n\tneedRangeTest = false;\n }", "private static void findMaxKi67(){\n int cellNum=0;//total cells in region\n Ki67=0;//total Ki67 in region\n float maxdivR=0;//tracks maximum Ki67 over all regions\n int[] inds = {0,0};//tracks indexes of maximum ki67\n for(int i=0;i<Data.aMX;i++){//loop over regions and find max activity\n for (int j = 0; j < Data.aMY; j++) {\n if(Data.activityMesh[i][j]>maxdivR){\n maxdivR=1.f*Data.activityMesh[i][j];\n inds[0]=i;\n inds[1]=j;\n }\n }\n }\n //redefine histology section based on maximum activity area\n Pars.histX=inds[0]*Pars.histSizeX;\n Pars.histY=inds[1]*Pars.histSizeY;\n for (int i = 0; i <cells.size(); i++) {//find %ki67 within max region\n Cell cell = (Cell) cells.get(i);\n //only count mass cells within the region of interest\n if(cell.mass && cell.x>=Pars.histX && cell.x<=Pars.histX+Pars.histSizeX && cell.y>=Pars.histY && cell.y<=Pars.histY+Pars.histSizeY) {\n Ki67+=cell.ki67;//add Ki67 val in area\n cellNum+=1;//add total cells in area\n }\n }\n Functions.writeFloat(Pars.outFile+\"data/Ki.txt\",Ki67/cellNum);//write to file\n }", "private boolean isTileFixed(int row, int col) {\n if (board[row][col].isFixed()) {\n return true;\n } else return activeEffects.get(new Position(row, col)) != null &&\n activeEffects.get(new Position(row, col)).getEffectType() == EffectType.ICE;\n }", "protected void mapValueToWithinBounds() {\n if (getAllele() != null) {\n \tFloat d_value = ( (Float) getAllele());\n if (d_value.isInfinite()) {\n // Here we have to break to avoid a stack overflow.\n // ------------------------------------------------\n return;\n }\n // If the value exceeds either the upper or lower bounds, then\n // map the value to within the legal range. To do this, we basically\n // calculate the distance between the value and the float min,\n // then multiply it with a random number and then care that the lower\n // boundary is added.\n // ------------------------------------------------------------------\n if (d_value.floatValue() > m_upperBound ||\n d_value.floatValue() < m_lowerBound) {\n RandomGenerator rn;\n if (getConfiguration() != null) {\n rn = getConfiguration().getRandomGenerator();\n }\n else {\n rn = new StockRandomGenerator();\n }\n setAllele(new Float((rn.nextFloat()\n * ((m_upperBound - m_lowerBound))) + m_lowerBound));\n }\n }\n }", "public int hamming() {\n int wrong = 0;\n for (int row = 0; row < N; ++row) {\n for (int col = 0; col < N; ++col) {\n int goalValue = N * row + col + 1;\n if (tiles[row][col] != 0 && tiles[row][col] != goalValue) {\n wrong++;\n }\n }\n }\n\n return wrong;\n }", "private static void calculateFitnessOfPopulation(ArrayList<Chromosome> population) {\n for (Chromosome chromosome : population) {\n // if the fitness of the chromosome has not yet been calculated (i.e. is still -1)\n fitnessFunction(chromosome);\n }\n }", "boolean updateValue() {\n boolean ret;\n\n if (Math.abs(curUtilityValue - nextUtilityValue) < Math.abs(curUtilityValue) * MAX_ERR_PERCENT / 100)\n ret = true;\n else {\n ret = false;\n // System.out.println(\" no match cell: x: \"+x+\" y: \"+y);\n }\n curUtilityValue = nextUtilityValue;\n return ret;\n\n }", "private void detectBombs(int row, int col){\r\n int bombCount = 0; //Amount of bombs nearby\r\n //Check up\r\n if((row-1 >= 0) && row<map.length && col<map[0].length && col>=0 && map[row-1][col].getSafe() == false){\r\n bombCount++;\r\n }\r\n //Check down\r\n if((row+1 < map.length) && row>=0&& col<map[0].length && col>=0 && map[row+1][col].getSafe() == false){\r\n bombCount++;\r\n }\r\n //Check right\r\n if((col+1 < map[0].length) && col>=0 && row<map.length && row>=0 && map[row][col+1].getSafe() == false){\r\n bombCount++;\r\n }\r\n //Check left\r\n if((col-1 >= 0) && col<map[0].length && row<map.length && row>=0 && map[row][col-1].getSafe() == false){\r\n bombCount++;\r\n }\r\n //Check up right\r\n if((row-1 >= 0) && row<map.length && (col+1 < map[0].length) && col>=0 && map[row-1][col+1].getSafe() == false){\r\n bombCount++;\r\n }\r\n //Check up left\r\n if((row-1 >= 0) && row<map.length && (col-1 >= 0) && col<map[0].length&& map[row-1][col-1].getSafe() == false){\r\n bombCount++;\r\n }\r\n //Check down left\r\n if((row+1 < map.length) && row>=0 && (col-1 >= 0)&& col<map[0].length && map[row+1][col-1].getSafe() == false){\r\n bombCount++;\r\n }\r\n //check down right\r\n if((row+1 < map.length) && row>=0 && (col+1 < map[0].length)&& col>=0 && map[row+1][col+1].getSafe() == false){\r\n bombCount++;\r\n }\r\n if(row>=0 && col>=0 && row<map.length && col<map[0].length && !map[row][col].getVisual().equals(\"F\") && map[row][col].getSafe() == true){\r\n if(bombCount==0){\r\n map[row][col].setVisual(zero);\r\n }\r\n if(bombCount==1){\r\n map[row][col].setVisual(one);\r\n }\r\n if(bombCount==2){\r\n map[row][col].setVisual(two);\r\n }\r\n if(bombCount==3){\r\n map[row][col].setVisual(three);\r\n }\r\n if(bombCount==4){\r\n map[row][col].setVisual(four);\r\n }\r\n if(bombCount==5){\r\n map[row][col].setVisual(five);\r\n }\r\n if(bombCount==6){\r\n map[row][col].setVisual(six);\r\n }\r\n if(bombCount==7){\r\n map[row][col].setVisual(seven);\r\n }\r\n if(bombCount==8){\r\n map[row][col].setVisual(eight);\r\n }\r\n map[row][col].setRevealed(true);\r\n }\r\n\r\n\r\n //return bombCount;\r\n\r\n\r\n }", "@Test(timeout = 4000)\n public void test075() throws Throwable {\n Range range0 = Range.of((-2147483660L));\n assertFalse(range0.isEmpty());\n }", "private void checkResetOverflow(int register) {\r\n\t\t/* register values greater than 1024*/\r\n\t\tif(sim40.memory[register] >= 1024) \r\n\t\t\tsetRegToMax(register);\r\n\t}", "public void baptism() {\n for (Card targetCard : Battle.getInstance().getActiveAccount().getActiveCardsOnGround().values()) {\n if (targetCard instanceof Minion) {\n targetCard.setHolyBuff(2, 1);\n }\n }\n }", "private boolean isSelectedArmyForceBigEnough() {\n return selectedArmyForce.getTotalPower() >= selectedTerritoryByPlayer.getArmyThreshold();\n }", "private double fillPercent() {\n\t\tdouble percent = 0;\n\t\t\n\t\tfor (LinkedList<WordCode<K, V>> ll : myBuckets) {\n\t\t\tif (ll.size() != 0) percent++;\n\t\t}\n\t\treturn (percent / myBuckets.size()) * 100;\n\t}", "public int isFull(){\n\t\tfor(i = 0; i < blocksPerSet; i++){\n\t\t\tif(blocks[i].getValid() == false)\n\t\t\t\treturn i;\n\t\t}\n\t\treturn -1;\n\t}", "protected void setFitness(float fit)\t{\tfitness = fit;\t\t}", "public boolean checkReached(float xTile, float yTile)\r\n/* 134: */ {\r\n/* 135:149 */ if ((this.mission) && (tileReachObjectives(xTile, yTile)))\r\n/* 136: */ {\r\n/* 137:152 */ this.reach[((int)xTile)][((int)yTile)] = 0;\r\n/* 138:153 */ this.reachablePlaces -= 1;\r\n/* 139:154 */ if (this.reachablePlaces == 0) {\r\n/* 140:156 */ return true;\r\n/* 141: */ }\r\n/* 142: */ }\r\n/* 143:160 */ return false;\r\n/* 144: */ }", "private boolean tryOverpopulation(int x, int y, Assignment assignment){\n\n\t\tif(getNeighborCount(x, y, assignment) >= 4)\n\t\t\treturn true;\n\n\t\treturn false;\n\t}", "private void EvalFitness(){\r\n _FitVal=0;\r\n for(int i=0; i<7;i++)\r\n for(int j=i+1;j<8;j++){\r\n if( _Data[i]==_Data[j]) _FitVal++;\r\n if(j-i==Math.abs(_Data[i]-_Data[j])) _FitVal++;\r\n }\r\n }", "private static void fixSpikes(int[] array){\r\n\t\t\r\n\t\tfor(int i=1; i<array.length-1; i++){\r\n\t\t\tlong a=Tools.max(1, array[i-1]);\r\n\t\t\tint b=array[i];\r\n\t\t\tlong c=Tools.max(1, array[i+1]);\r\n\t\t\tif(b>1 && b>a && b>c){\r\n\t\t\t\t//peak\r\n\t\t\t\tif((b>=2*a || b>a+2) && (b>=2*c || b>c+2)){\r\n\t\t\t\t\t//spike\r\n\t\t\t\t\tarray[i]=(int)Tools.max(a, c);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private void countChange() {\n /* To make 0.00, we use 0 coins. */\n myIndices[0] = 0;\n \n /* \n * Work from subproblem $0.01 to target. \n * Because subproblems overlap, we will\n * store them and use them dynamically.\n */\n for (int curr = 1; curr <= myTarget; curr++) {\n /* \n * Adds one coin (current-next used) to\n * the preemptive minimum coins needed.\n */\n myIndices[curr] = getMinPrior(curr) + 1;\n }\n \n myMinCoins = myIndices[myTarget];\n }", "public boolean isFull() {\n\t\treturn markCount == 9;\n\t}", "public void updateFeasiblePOIs() {\n PlaceOfInterest currPOI = tour.getCurrentVisit().getPlaceOfInterest();\n double currTime = tour.getCurrentVisit().getDepartTime();\n\n for (int i = feasiblePOIs.size()-1; i >= 0; i--) {\n PlaceOfInterest poi = feasiblePOIs.get(i);\n\n double timeToArrive = instance.travelTimeDepartAt(currPOI, poi, currTime);\n poi.setTimeToArrive(timeToArrive);\n\n double visitStartTime = currTime + timeToArrive;\n\n if (visitStartTime > poi.getCloseTime()) {\n feasiblePOIs.remove(i); // cannot meet the time window, infeasible\n continue;\n }\n\n if (visitStartTime < poi.getOpenTime())\n visitStartTime = poi.getOpenTime();\n\n poi.setTimeToStartVisit(visitStartTime - currTime);\n\n double visitFinishTime = visitStartTime + poi.getDuration();\n poi.setTimeToFinishVisit(visitFinishTime - currTime);\n\n double timeToReturn = instance.travelTimeDepartAt(poi, instance.getEndPOI(), visitFinishTime);\n poi.setTimeToReturn(timeToReturn);\n\n if (visitFinishTime + timeToReturn > instance.getEndTime()) {\n feasiblePOIs.remove(i); // cannot return in time, infeasible\n continue;\n }\n }\n }", "public void dropItLikeItsHot(){\n\t\tint score_increment = 0;\n\t\tPoint test_location = new Point(pieceOrigin);\n\t\twhile(true){\n\t\t\ttest_location.y += 1;\n\t\t\tif(!collides(test_location, currentPiece)){\n\t\t\t\tpieceOrigin.y += 1;\n\t\t\t\tscore_increment += 1;\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tscore += score_increment*100;\n\t\tgossipGirl();\n\t\trepaint();\n\t}", "protected void optimize() {\n int[][] cutMemo = new int[dimX + 1][dimY + 1];\n Tuple[][] tupleMemo = new Tuple[dimX + 1][dimY + 1];\n Memo memo = new Memo(cutMemo,tupleMemo);\n\n //array is filled with -1 because -1 is used as a flag in the memo\n fillMemo(0, dimX, 0, dimY, cutMemo);\n\n //Calculates optimal value of cloth\n ArrayList<FittedPattern> answer = computeOptimal(dimX, dimY, pattern, memo, new ArrayList<>(), 0);\n coordinates = answer;\n finalValue = memo.getFittedPatternMemo()[dimX][dimY].getOptimalValue();\n\n }", "public void computeConflicts() { //compute the number of conflicts to calculate fitness\r\n String board[][] = new String[MAX_LENGTH][MAX_LENGTH]; //initialize board\r\n int x = 0; //row\r\n int y = 0; //column\r\n int tempx = 0; //temprow\r\n int tempy = 0; //temcolumn\r\n\r\n int dx[] = new int[] {-1, 1, -1, 1}; //to check for diagonal\r\n int dy[] = new int[] {-1, 1, 1, -1}; //paired with dx to check for diagonal\r\n\r\n boolean done = false; //used to check is checking fo diagonal is out of bounds\r\n int conflicts = 0; //number of conflicts found\r\n\r\n clearBoard(board); //clears the board into empty strings\r\n plotQueens(board); // plots the Q in the board\r\n\r\n // Walk through each of the Queens and compute the number of conflicts.\r\n for(int i = 0; i < MAX_LENGTH; i++) {\r\n x = i;\r\n y = pos[i];\r\n\r\n // Check diagonals.\r\n for(int j = 0; j < 4; j++) { // because of dx and dy where there are 4 directions for diagonal searching for conflicts\r\n tempx = x;\r\n tempy = y; // store coordinate in temp\r\n done = false;\r\n\r\n while(!done) {//traverse the diagonals\r\n tempx += dx[j];\r\n tempy += dy[j];\r\n\r\n if((tempx < 0 || tempx >= MAX_LENGTH) || (tempy < 0 || tempy >= MAX_LENGTH)) { //if exceeds board\r\n done = true;\r\n } else {\r\n if(board[tempx][tempy].equals(\"Q\")) {\r\n conflicts++;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n this.conflicts = conflicts; //set conflicts of this particle\r\n }", "public void resetCompletionThreshold();", "public void setExhaustion ( float value ) {\n\t\texecute ( handle -> handle.setExhaustion ( value ) );\n\t}", "private void setMinThreshold() {\n minThreshold = value + value * postBoundChange / 100;\n }", "private boolean needsToRecalcStats() {\n\n return this.equipsChanged;\n }", "public void plantBombsInEmptyCells() {\n\t\tfor (int i = 0; i < r; i++) {\n\t\t\tfor (int j = 0; j < c; j++) {\n\t\t\t\tgrid[i][j] = ( grid[i][j] < 0 ? 0 : grid[i][j] );\n\t\t\t}\n\t\t}\n\t}", "private void applyMask(int lin,int col){\n double pos1 = data[lin-1][col-1];\r\n double pos2 = data[lin][col-1]*2;\r\n double pos3 = data[lin+1][col+1];\r\n //POS 2 4 2\r\n double pos4 = data[lin-1][col]*2;\r\n double pos5 = data[lin][col]*4;\r\n double pos6 = data[lin+1][col]*2;\r\n //POS 1 2 1\r\n double pos7 = data[lin+1][col-1]*1;\r\n double pos8 = data[lin+1][col]*2;\r\n double pos9 = data[lin+1][col+1]*1;\r\n double resultMatriz = (pos1+pos2+pos3+pos4+pos5+pos6+pos7+pos8+pos9);\r\n data[lin][col]=data[lin][col]/resultMatriz;\r\n if(data[lin][col]> max)\r\n max = data[lin][col];\r\n if(data[lin][col]< min)\r\n min = data[lin][col];\r\n }", "private void tryARender() {\n \t\tif (Minecraft.theMinecraft.thePlayer == null)\n \t\t\treturn;\n \t\ttry {\n \t\t\tif (MinimapConfig.getInstance().isEnabled() && map.isDirty(Minecraft.theMinecraft.thePlayer.posX, Minecraft.theMinecraft.thePlayer.posZ)) {\n \t\t\t\tmapCalc();\n \t\t\t\tmap.timer = 1;\n \t\t\t}\n \t\t} catch (RuntimeException e) {\n \t\t\tthrow e;\n \t\t} finally {\n \t\t\tmap.timer++;\n \t\t}\n \t}", "public void checkBombs(final Integer tile){\n if(bombs_location.contains(tile)){\n if(invulnerable){\n showTimedAlertDialog(\"PHEW!\", \"Your GODMODE saved your life\", 5);\n invulnerable = false;\n return;\n }\n invulnerable = false;\n Lejos.makeSound_Boom();\n hp = hp-1;\n DrawHP();\n bombs_location.remove(tile);\n final Handler handler = new Handler();\n handler.postDelayed(new Runnable() {\n @Override\n public void run() {\n MultiplayerManager.getInstance().SendMessage(\"bomb_remove \" + revertTile(tile).toString());\n }\n }, 1000);\n if(hp==0){\n onLose();\n }\n showTimedAlertDialog(\"PWNED!\", \"You just stepped on a mine\", 3);\n }\n }", "private void updateHammingScore(int i, int j) {\n // if not free cell\n if (!(i == dimension() - 1 && j == dimension() - 1)) {\n // calculate goal value for this cell\n int goal = i * dimension() + j + 1;\n if (blocks[i][j] != goal) {\n hamming_score ++;\n }\n\n if (verbose) {\n // System.out.println(i + \",\" + j + \" \" + block + \" is \" + goal + \"?\" );\n }\n }\n }", "void checkAndUpdateBoundary(Integer requiredChange);", "private void rehashing(boolean increase){\r\n int newLength;\r\n // if loadFactor is too big. //\r\n if (increase){\r\n newLength = capacity()*CAPACITY_CHANGE;\r\n }\r\n // if loadFactor is too small. //\r\n else{newLength = capacity()/CAPACITY_CHANGE;}\r\n // builds the new hashSet with the new capacity. //\r\n ClosedHashCell[] newHashSet = new ClosedHashCell[newLength];\r\n buildHashSet(newLength, newHashSet);\r\n for (ClosedHashCell cell : hashSet){\r\n if (cell.getValue() != null) {\r\n int j = 0;\r\n int clamping = (cell.getValue().hashCode() + (j+j*j) / 2) & (newLength - 1);\r\n while (!newHashSet[clamping].addMe(cell.getValue())) {\r\n j++;\r\n clamping = (cell.getValue().hashCode() + (j+j*j) / 2) & (newLength - 1);\r\n }\r\n }\r\n }\r\n hashSet = newHashSet;\r\n }", "@Override\r\n\t\t\tpublic void populationUpdate(PopulationData<? extends Solution> data) {\n//\t\t\t\tbuffer.append(data.getPopulationSize());\r\n//\t\t\t\tbuffer.append(\"\\n\");\r\n\t\t\t\t\r\n\t\t\t\tdouble fit = data.getBestCandidateFitness();\r\n//\t\t\t\tSystem.out.println(fit);\r\n\t\t\t\tbuffer.delete(0, buffer.length());\r\n\t\t\t\tbuffer.append(fit);\r\n//\t\t\t\tbuffer.append(\"\\n\");\r\n\t\t\t\t\r\n\t\t\t\tif (Run10FastExternalizer.initialFitness.getDbl() == -1.0) {\r\n\t\t\t\t\tRun10FastExternalizer.initialFitness.setDbl(fit);\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif (fit == 0.0){\r\n\t\t\t\t\tArrayList<Student> studentsCopy = new ArrayList<>();\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor (Student student: students){\r\n\t\t\t\t\t\tstudentsCopy.add(student.clone());\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tStringBuilder sb = new StringBuilder();\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor (Student student: studentsCopy){\r\n\t\t\t\t\t\tstudent.register(data.getBestCandidate().getBlocks());\r\n//\t\t\t\t\t\tSystem.out.println(student.getSchedule());\r\n//\t\t\t\t\t\tbuffer.append(student.getSchedule().toString());\r\n//\t\t\t\t\t\tbuffer.append(\"\\n\");\r\n\t\t\t\t\t\tsb.append(student.getSchedule().toString());\r\n\t\t\t\t\t\tsb.append(\"\\n\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tsuperValue = sb.toString();\r\n\t\t\t\t}\r\n\t\t\t}", "public Position trouverHeros(Position pos, int range);", "@Override\n\tprotected boolean checkFeasible(int r, int c, int v, int k, int dept) {\n\t\tboolean ok = super.checkFeasible(r, c, v, k, dept);\n\t\tif(!ok) return false;\n\t\t\n\t\tJuryInfo J = jury.get(r);\n\t\t\n\t\tfor(int rid = 1; rid <= rooms.size(); rid++) if(rid != v){\n\t\t\tint[] p = J.getJuryMemberIDs();\n\t\t\tfor(int j = 0; j < p.length; j++){\n\t\t\t\t\n\t\t\t\tif(p[j] > 0){\n\t\t\t\t\t//System.out.println(\"PartitionJuriesToRoomsTeacherNotMove::checkFeasible(\" + r + \",\" + c + \n\t\t\t\t\t\t\t\t//\",\" + v + \", occTeacherRoom[\" + rid + \"].get(\" + p[j] + \") = \" + occTeacherRoom[rid].get(p[j]));\n\t\t\t\t\tif(occTeacherRoom[rid].get(p[j]) > 0) return false;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\t// check if the number of hust, nonHust assigned to room v exceed the upperbound\n\t\tint var_idx = 7*r+c;\n\t\tint nbHust = 0;\n\t\tint nbNonHust = 0;\n\t\tfor(int p = 0; p < 5; p++){\n\t\t\tif(x[r*7+p] > 0){\n\t\t\t\tint tid = x[r*7+p];\n\t\t\t\tif(p == 0 || p == 4){\n\t\t\t\t\tif(!nonHustOfRoom[v].contains(tid)) nbNonHust++;\n\t\t\t\t}else{\n\t\t\t\t\tif(!hustOfRoom[v].contains(tid)) nbHust++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(hustOfRoom[v].size() + nbHust > maxHustOfRoom.get(v)) ok = false;\n\t\t//if(!ok && k >= dept) System.out.println(\"TRY(\" + k + \"), var_idx = \" + var_idx + \", r = \" + r + \", c = \" + c + \", v = \" + v + \n\t\t\t\t//\", FALSE hustOfRoom[\" + v + \"].sz = \" + hustOfRoom[v].size() + \", nbHust = \" + nbHust);\n\t\tif(nonHustOfRoom[v].size() + nbNonHust > maxNonHustOfRoom.get(v)) ok = false;\n\t\t//if(!ok && k >= dept) System.out.println(\"TRY(\" + k + \"), var_idx = \" + var_idx + \", r = \" + r + \", c = \" + c + \", v = \" + v + \n\t\t\t\t//\", FALSE nonHustOfRoom[\" + v + \"].sz = \" + nonHustOfRoom[v].size() + \", nbNonHust = \" + nbNonHust);\n\t\t\n\t\treturn ok;\n\t}", "@Override\n public void detectAndSendChanges() {\n super.detectAndSendChanges();\n\n final int newStoredFuel = this.tileAdvancedFurnace.getStoredFuel();\n final int newSmeltTime = this.tileAdvancedFurnace.getRemainingSmeltTime();\n if ((lastStoredFuel != newStoredFuel) || (lastSmeltTime != newSmeltTime)) {\n this.lastStoredFuel = newStoredFuel;\n this.lastSmeltTime = newSmeltTime;\n for (int i = 0; i < this.crafters.size(); ++i) {\n final ICrafting icrafting = (ICrafting) this.crafters.get(i);\n icrafting.sendProgressBarUpdate(this, UPDATEID_STORED_OPERATIONS, newStoredFuel);\n icrafting.sendProgressBarUpdate(this, UPDATEID_SMELTTIME_REMAINING, newSmeltTime);\n }\n }\n }", "private void compactIfNeeded() {\n\n // if the scan point is more than 25% into the buffer, compact...\n if( buffer.position() >= (buffer.capacity() >> 2 ) ) {\n int newLimit = buffer.limit() - buffer.position();\n buffer.compact();\n buffer.position( 0 );\n buffer.limit( newLimit );\n }\n }", "public void setMismatchOverhang(int s){\n for(int i=0;i<scores.length;i++) {//i=position\n for(int j=0;j<scores[i].length;j++) {//j=primer\n if(j<(primerNum /2)) {\n //Matching Forward Direction Primers to 3'-5' stand so empty vals at left 3' end\n if(i<pLens[j]-1) {\n scores[i][j][0]=pLens[j];\n }\n }\n else {\n //Matching Reverse Direction Primers to 5'-3' stand so empty vals at right 3' end\n if(i>compSeqs[s].length()-pLens[j]) {\n scores[i][j][0]=pLens[j];\n }\n }\n }\n }\n }", "private void flagSolver(int x, int y) {\n\t\tint flagsNear = 0;\n\t\tint tempX, tempY;\n\t\tTile tempTile;\n\t\tfor(int i = -1; i <= 1; i++) {\n\t\t\ttempY = y + i;\n\t\t\tfor(int j = -1; j <= 1; j++) {\n\t\t\t\ttempX = x + j;\n\t\t\t\tif(!(tempX == x && tempY == y)) {\n\t\t\t\t\ttempTile = game.getTile(tempX, tempY);\n\t\t\t\t\tif(!(tempTile == null) && tempTile.getMarker() == 1) {\n\t\t\t\t\t\tflagsNear++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(flagsNear == game.getTile(x, y).getAdjBombs()) {\n\t\t\tfor(int i = -1; i <= 1; i++) {\n\t\t\t\ttempY = y + i;\n\t\t\t\tfor(int j = -1; j <= 1; j++) {\n\t\t\t\t\ttempX = x + j;\n\t\t\t\t\tif(!(tempX == x && tempY == y)) {\n\t\t\t\t\t\ttempTile = game.getTile(tempX, tempY);\n\t\t\t\t\t\tif(!(tempTile == null) && !(tempTile.getMarker() == 1)) {\n\t\t\t\t\t\t\tunmarkedTile(tempX, tempY, false);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}" ]
[ "0.6506064", "0.61831903", "0.6037479", "0.56342876", "0.5477375", "0.54755956", "0.5368789", "0.5271853", "0.5189321", "0.5141475", "0.5099168", "0.5077445", "0.50527555", "0.50152594", "0.5008631", "0.4996084", "0.49922457", "0.49851114", "0.49623653", "0.49560118", "0.4955053", "0.49434555", "0.4937632", "0.49260217", "0.4924951", "0.48954338", "0.4891113", "0.4876863", "0.4860216", "0.48561904", "0.48540017", "0.48540017", "0.48516777", "0.48471916", "0.48384246", "0.4834593", "0.4832999", "0.4820745", "0.48189023", "0.48187396", "0.48177823", "0.48116755", "0.47984675", "0.47954392", "0.4781843", "0.47780237", "0.47763374", "0.4773909", "0.47625887", "0.47622404", "0.47620562", "0.47521633", "0.47496763", "0.47483876", "0.47446492", "0.4740561", "0.47380036", "0.47223595", "0.47216332", "0.47099718", "0.4709648", "0.47087204", "0.47042865", "0.47005937", "0.46964368", "0.46941197", "0.46926713", "0.46861687", "0.46772274", "0.46770215", "0.46769714", "0.46749833", "0.46717897", "0.46699765", "0.46691552", "0.46669576", "0.46623355", "0.46603444", "0.46573567", "0.46555024", "0.46541443", "0.4647059", "0.4638475", "0.46377236", "0.46363214", "0.46212745", "0.46145388", "0.461392", "0.46079654", "0.46078414", "0.4607721", "0.46015477", "0.46003377", "0.45999488", "0.45998788", "0.4596265", "0.45846915", "0.45828828", "0.4582067", "0.45807257" ]
0.56882006
3
Tests to see if problem can be solved with half as many bins
private boolean canReduceBins() { int oldBinCount = binCount; boolean canReduce = false; binCount = binCount / 2; int[] chromosome = eliteChromosome.clone(); if (getFitness(chromosome) <= binCount) canReduce = true; else canReduce = false; binCount = oldBinCount; //no side effects return canReduce; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private boolean subGridCheck() {\n\t\tint sqRt = (int)Math.sqrt(dimension);\n\t\tfor(int i = 0; i < sqRt; i++) {\n\t\t\tint increment = i * sqRt;\n\t\t\tfor(int val = 1; val <= dimension; val++) {\n\t\t\t\tint valCounter = 0;\n\t\t\t\tfor(int row = 0 + increment; row < sqRt + increment; row++) {\n\t\t\t\t\tfor(int col = 0 + increment; col < sqRt + increment; col++) {\n\t\t\t\t\t\tif(puzzle[row][col] == val)\n\t\t\t\t\t\t\tvalCounter++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(valCounter >= 2)\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "public boolean isManySolution() {\n\n boolean all_zero_brs = false;\n\n for(int i = 0; i < this.NBrsEff; i++){\n if(this.isAllZeroBrs(i)) {\n all_zero_brs = true;\n }\n }\n\n return all_zero_brs;\n }", "private boolean isFeasible(double[][] poly) {\n\t\tfor (double[] p : poly) {\n\t\t\tif (p[0] < 0 || p[0] > binWidth || p[1] < 0 || p[1] > binHeight) {\n\t\t\t\t// out of bounds -- infeasible!\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tfinal double[] bb = MathUtil.boundBox(poly);\n\n\t\tfor (PackedPoly fixed : packedPolys) {\n\t\t\tif (overlapFast(poly, bb, fixed)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "private boolean checkBoxSituation(int secondI, int secondJ) {\n int max = 0;\n if (secondI + 1 < 8) {\n if (checkBlueBox(secondI + 1, secondJ)) {\n max++;\n }\n }\n if (secondI - 1 > -1) {\n if (checkBlueBox(secondI - 1, secondJ)) {\n max++;\n }\n }\n if (secondJ + 1 < 8) {\n if (checkBlueBox(secondI, secondJ + 1)) {\n max++;\n }\n }\n if (secondJ - 1 > -1) {\n if (checkBlueBox(secondI, secondJ - 1)) {\n max++;\n }\n }\n if (max >= 3) {\n return true;\n }\n return false;\n }", "private boolean feasible() {\n\t\tint weight = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tassert x[i] == 0 || x[i] == 1;\n\t\t\tweight += w[i] * x[i];\n\t\t}\n\t\treturn weight <= k;\n\t}", "private boolean validationPhase(Secret secretA, Secret secretB, int smallestSize, double[] optimalBox) {\n\n\t\t// number of all possible subsets with a size of smallestSize\n\t\tint numberSubsets; \n\t\tif((secretA.getTimes().size() / smallestSize) <= (secretB.getTimes().size() / smallestSize)) {\n\t\t\tnumberSubsets = (secretA.getTimes().size() / smallestSize);\n\t\t} else {\n\t\t\tnumberSubsets = (secretB.getTimes().size() / smallestSize);\n\t\t}\n\n\t\t// rest of the size modulo all subsets\n\t\tint restA = secretA.getTimes().size() % (numberSubsets * smallestSize);\n\t\tint restB = secretB.getTimes().size() % (numberSubsets * smallestSize);\n\n\t\tArrayList<Time> subsetA; \n\t\tArrayList<Time> subsetB;\n\n\t\tint countWrongResults = 0;\n\n\t\tArrayList<String> validateSubsetSignificantDifferent = new ArrayList<String>();\n\t\tArrayList<String> validateSubsetOverlapA = new ArrayList<String>();\n\t\tArrayList<String> validateSubsetOverlapB = new ArrayList<String>();\n\t\tArrayList<Time> prevSubsetA = new ArrayList<Time>();\n\t\tArrayList<Time> prevSubsetB = new ArrayList<Time>();\n\n\n\t\tfor (int i = 0; i < numberSubsets; ++i) {\n\n\t\t\tint countInvalid = 0;\n\t\t\t// the rest will be deducted at the beginning\n\t\t\tsubsetA = secretA.getBisectedTimes(restA + (smallestSize * i), smallestSize);\n\t\t\tsubsetB = secretB.getBisectedTimes(restB + (smallestSize * i), smallestSize);\n\n\t\t\tCollections.sort(subsetA);\n\t\t\tCollections.sort(subsetB);\n\n\t\t\tif (BoxTest.boxTestSmaller(subsetA, subsetB, optimalBox)) {\n\t\t\t\tvalidateSubsetSignificantDifferent.add(\"o\");\n\n\t\t\t} else {\n\t\t\t\tvalidateSubsetSignificantDifferent.add(\"x\");\n\t\t\t\t//logger.info(\"subset \" + i + \": wrong result\");\n\t\t\t\t++countInvalid;\n\t\t\t}\n\t\t\t\n\t\t\tif(i != 0) {\n\t\t\t\tif (BoxTest.boxTestOverlap(prevSubsetA, subsetA, optimalBox)) {\n\t\t\t\t\tvalidateSubsetOverlapA.add(\"o\");\n\n\t\t\t\t} else {\n\t\t\t\t\tvalidateSubsetOverlapA.add(\"x\");\n\t\t\t\t\t//logger.info(\"subset \" + i + \": only significant different\");\n\t\t\t\t\t++countInvalid;\n\t\t\t\t} \n\n\t\t\t\tif (BoxTest.boxTestOverlap(prevSubsetB, subsetB, optimalBox)) {\n\t\t\t\t\tvalidateSubsetOverlapB.add(\"o\");\n\t\t\t\t\t//logger.info(\"subset \" + i + \": right result\");\n\n\t\t\t\t} else {\n\t\t\t\t\tvalidateSubsetOverlapB.add(\"x\");\n\t\t\t\t\t//logger.info(\"subset \" + i + \": only significant different, subset A overlaps\");\n\t\t\t\t\t++countInvalid;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(countInvalid > 0) {\n\t\t\t\t++countWrongResults;\n\t\t\t}\n\n\t\t\tprevSubsetA = new ArrayList<Time>();\n\t\t\tprevSubsetB = new ArrayList<Time>();\n\n\t\t\tprevSubsetA = subsetA;\n\t\t\tprevSubsetB = subsetB;\n\t\t}\n\n\t\tdouble confidenceInterval = 100 - (countWrongResults * 100 / numberSubsets);\n\n\t\tthis.boxTestResults.get(this.boxTestResults.size() - 1).saveValidation(smallestSize, confidenceInterval, validateSubsetOverlapA, validateSubsetOverlapB, validateSubsetSignificantDifferent);\n\t\tlogger.finest(\"\\n\\\"o\\\" = successful box test \\n\\\"x\\\" = unsuccesful box test\\n\");\n\t\tlogger.finest(secretA.getName() + \" overlaps: \" + Folder.convertArrayListToString(validateSubsetOverlapA));\n\t\tlogger.finest(secretB.getName() + \" overlaps: \" + Folder.convertArrayListToString(validateSubsetOverlapB));\n\t\tlogger.finest(secretA.getName() + \" < \" + secretB.getName() + \": \" + Folder.convertArrayListToString(validateSubsetSignificantDifferent));\n\n\t\tlogger.info(secretA.getName() + \" < \" + secretB.getName() + \": validate smallest size \" + smallestSize + \": \" + countWrongResults + \" out of \" + numberSubsets + \" comparisons returned wrong results.\");\n\n\t\tif(countWrongResults != 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}", "public boolean solvable() {\n // TODO: Your code here\n // TODO: NICK\n\n\n int parity = 0;\n int blankRow = 0; // the row with the blank tile\n\n\n for (int i = 0; i < n*n; i++){\n if(tiles[i/n][i%n] == 0){\n blankRow = i/3;\n continue;\n }\n for (int j = i + 1; j < n*n; j++) {\n if (tiles[i/n][i%n] > tiles[j/n][j%n] && tiles[j/n][j%n] != 0) {\n parity++;\n }\n }\n }\n\n\n\n // solvability conditions:\n if (n % 2 == 0) { // even grid\n if (blankRow % 2 == 0) { // blank on odd row; counting from bottom\n return parity % 2 == 0;\n } else { // blank on even row; counting from bottom\n return parity % 2 != 0;\n }\n } else { // odd grid\n return parity % 2 == 0;\n }\n }", "private void checkIsBetterSolution() {\n if (solution == null) {\n solution = generateSolution();\n //Si la solucion que propone esta iteracion es mejor que las anteriores la guardamos como mejor solucion\n } else if (getHealthFromAvailableWorkers(availableWorkersHours, errorPoints.size()) < solution.getHealth()) {\n solution = generateSolution();\n }\n }", "private int totalInfeasibility(int[] chromosome) {\n\t\tint infeasibility = 0;\n\t\tint[] bins = new int[binCount];\n\t\tfor (int i = 0; i < chromosome.length; i++) {\n\t\t\tif (chromosome[i] >= bins.length) {\n\t\t\t\tinfeasibility += 10;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tbins[chromosome[i]] += packageWeights[i]; //put package into bin\n\t\t\t} catch (Exception e) {\n\t\t\t\tSystem.out.println(\"noooo\");\n\t\t\t}\n\n\t\t}\n\n\t\tfor (int i = 0; i < bins.length; i++) {\n\t\t\tif (bins[i] > binSize)\n\t\t\t\tinfeasibility += bins[i] - binSize;\n\t\t}\n\t\treturn infeasibility;\n\t}", "public boolean solve() {\r\n\r\n\tint nextBox = findLeast();\r\n\t//coors for the least box\r\n\tint c = nextBox % 10;\r\n\tint r = nextbox/10;\r\n\t\r\n\r\n\t//look for least\r\n\t//for the numbers in the least box\r\n\t//assignT == true \r\n\t//check the max; if max is 100; well done! return true\r\n\t//if its not then if (solve() == true) again\r\n\t//if \r\n }", "public boolean canPartition_backtrack(int[] nums) {\n\t\tif (nums == null || nums.length == 0)\n\t\t\treturn false;\n\t\tint total = 0;\n\t\tfor (int i = 0; i < nums.length; i++)\n\t\t\ttotal += nums[i];\n\t\tif (total % 2 != 0)\n\t\t\treturn false;\n\t\tList<Integer> list = new ArrayList<Integer>();\n\t\treturn helper(nums, list, 0, 0, total);\n\t}", "public boolean checkSubGrids(int[][] solutiongrid){ \n //Number of subgrids\n final int numgrids = solutiongrid.length;\n final int squareroot = (int)Math.sqrt(numgrids);\n \n for (int i = 0; i < solutiongrid.length; i += squareroot){ \n for (int j = 0; j < solutiongrid[i].length; j += squareroot){\n // creating N subgrids \n int[][] newArray = new int[squareroot][squareroot];\n int newRow = 0;\n for (int k = i; k < (i + squareroot); k++){\n int newColumn = 0;\n for (int l = j; l < (j + squareroot); l++){ \n newArray[newRow][newColumn] = solutiongrid[k][l];\n newColumn++; \n }\n newRow++;\n }\n if(!containsDuplicate(newArray))\n return true;\n }\n }\n \n return false;\n }", "private int[] bestFitModified(int[] chromosome) {\n\t\tint[] bins = new int[binCount];\n\t\tArrayList<Integer> cannotPackList = new ArrayList<Integer>();\n\n\t\t//honor chromosome listing when possible\n\t\tfor (int i = 0; i < chromosome.length; i++) {\n\t\t\t//if this bin isnt full & won't be after placement & this chrom hasnt gone off the end \n\t\t\t//(VERY RARE, only happens when binCount is reduced w/ elitism)\n\t\t\tif (chromosome[i] < bins.length && bins[chromosome[i]] + packageWeights[i] <= binSize) {\n\t\t\t\tbins[chromosome[i]] += packageWeights[i]; //put package into bin\n\t\t\t} else { //store those we can't honor\n\t\t\t\tchromosome[i] = -1;\n\t\t\t\tcannotPackList.add(new Integer(i)); //save all those packages whos original bins were full\n\t\t\t}\n\t\t}\n\n\t\t//best fit on all the rest whos bins were full up\n\t\tint tries = 0;\n\t\tfor (int j = 0; j < cannotPackList.size(); j++) {\n\t\t\tint i = cannotPackList.get(j);\n\t\t\tint bestBinIndex = -1;\n\n\t\t\twhile (bestBinIndex < 0 && tries < bins.length * 2) { //while we still havent found a bin to put this in and time isn't up\n\n\t\t\t\tint bestBinLeftOverSpace = binSize * 100; //how much space is left in the bin when the packages is placed in it (ideally 0 = full bin)\n\n\t\t\t\tfor (int bin = 0; bin < bins.length; bin++) {\n\t\t\t\t\t//if this bin is closer to full than the best bin and not overfilled save it\n\t\t\t\t\tif ((binSize - (bins[bin] + packageWeights[i])) >= 0 && (binSize - (bins[bin] + packageWeights[i])) < bestBinLeftOverSpace) {\n\t\t\t\t\t\tbestBinIndex = bin;\n\t\t\t\t\t\tbestBinLeftOverSpace = binSize - (bins[bin] + packageWeights[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (bestBinIndex < 0) { //if could not pack, dump out a bin (mutation)\n\t\t\t\t\tj = 0;\n\t\t\t\t\tint dumpBin = rand.nextInt(binCount);\n\t\t\t\t\tfor (int binIndex = dumpBin; binIndex < binCount; binIndex++) {\n\t\t\t\t\t\tbins[binIndex] = 0;\n\t\t\t\t\t\tfor (int chromIndex = 0; chromIndex < chromosome.length; chromIndex++) {\n\t\t\t\t\t\t\tif (chromosome[chromIndex] == binIndex) {\n\t\t\t\t\t\t\t\tchromosome[chromIndex] = -1;\n\t\t\t\t\t\t\t\tcannotPackList.add(new Integer(chromIndex));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\ttries++;\n\t\t\t}\n\n\t\t\tif (tries >= bins.length * 2) {\n\t\t\t\treturn null; //this chromosome is unsalvageable because it is impossible to fit the packages in the bins\n\t\t\t}\n\n\n\t\t\tbins[bestBinIndex] += packageWeights[i];\n\t\t\tchromosome[i] = bestBinIndex;\n\t\t\tcannotPackList.remove(j);\n\t\t\tj--;\n\t\t}\n\n\t\treturn chromosome;\n\t}", "private boolean calculateMaximumLengthBitonicSubarray() {\n\n boolean found = false; // does any BSA found\n\n boolean directionChange = false; //does direction numberOfWays increase to decrease\n\n int countOfChange = 0;\n\n int i = 0;\n directionChange = false;\n int start = i;\n i++;\n for (; i < input.length; i++) {\n if (countOfChange != 0 && countOfChange % 2 == 0) {\n if (this.length < (i - 2 - start + 1)) {\n this.i = start;\n this.j = i - 2;\n this.length = this.j - this.i + 1;\n }\n start = i - 2;\n countOfChange = 0;\n }\n\n if (input[i] > input[i - 1]) {\n if (directionChange == true) {\n countOfChange++;\n }\n directionChange = false;\n }\n if (input[i] < input[i - 1]) {\n if (directionChange == false) {\n countOfChange++;\n }\n directionChange = true;\n }\n\n\n }\n\n if (directionChange == true) {\n if (this.length < (i - 1 - start + 1)) {\n this.i = start;\n this.j = i - 1;\n this.length = this.j - this.i + 1;\n }\n }\n return directionChange;\n }", "public boolean isGoal() {\n boolean result = false; \n for (int i = 0; i < this.N; i++) {\n for (int j = 0; j < this.N; j++) {\n int idx = (i * this.N) + (j + 1);\n if (idx != N * N - 1 && tiles[i][j] != idx) {\n return false;\n } \n if (idx == N * N - 1) {\n if (tiles[N - 1][N - 1] == 0) return true;\n return false;\n }\n }\n }\n return result;\n }", "static void check(int arr[],int sum)\r\n {\r\n boolean binmap[] = new boolean[max]; /* by default this is array of false as {false,false,false,false,......,false} */\r\n for(int i=0;i<arr.length;i++)\r\n {\r\n int temp=sum-arr[i];\r\n if(temp>0 && binmap[temp]){ /* in condition , we can use binmap[temp] which means binmap[temp]==true */\r\n System.out.println(\"two numbers in given array whose sum is equal to given sum are :\"+temp+ \" and \" +arr[i]);\r\n }\r\n binmap[arr[i]]=true;\r\n }\r\n }", "public boolean isWinnable() {\n Solver<ArrayList<Integer>> mySolver =\n new Solver<ArrayList<Integer>>();\n ArrayList<ArrayList<Integer>> Solution =\n mySolver.SolveBFS(this);\n\n //Reset 'tried' to none\n tried = new HashSet<ArrayList<Integer>>();\n\n if(Solution.size() == 0) {\n //No Solution\n return false;\n }\n return true;\n }", "static boolean isSafe(int x, int y, int sol[][]) {\n return (x >= 0 && x < N && y >= 0 &&\n y < N && sol[x][y] == -1);\n }", "private boolean isExplodedGraphTooBig(ProgramState programState) {\n return steps + workList.size() > MAX_STEPS / 2 && programState.constraintsSize() > 75;\n }", "public boolean outOfBounds()\n {\n if((lastpowerUp.equals(\"BLUE\") || lastpowerUp.equals(\"RAINBOW\")) && powerupTimer > 0)\n {\n return false;\n }\n \n if(head.getA() < 150 || head.getA() >= 1260)\n return true;\n else if(head.getB() <150 || head.getB() >=630)\n return true;\n else \n return false;\n \n \n }", "private static boolean checkHalfway(int[] arr, int searchValue, int begin, int end) {\r\n\t\treturn searchValue < arr[(begin+end+1)/2];\r\n\t}", "private boolean outOfBounds(long n) {\n return n < 0 || n >= getSize();\n }", "public boolean isXsolution() {\n\t\tfor (int k=1; k<size*size; k++) {\n\t\t\tint count1 = 0;\n\t\t\tint count2 = 0;\n\t\t\tfor (int l=0; l<size*size; l++) {\n\t\t\t\tif (board[l][l]==k) count1++;\n\t\t\t\tif (board[l][size*size-l-1]==k) count2++;\n\t\t\t}\n\t\t\tif (count1!=1 || count2!=1) return false;\n\t\t}\n\t\treturn true;\n\t}", "private static boolean findEqualSumSubsetBottomUp(int[] arr, int n) {\n\t\tint sum=0;\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tsum+=arr[i];\n\t\t}\n\t\tif(sum%2==1) {\n\t\t\treturn false;\n\t\t}\n \t\treturn findEqualSumBottomUp(arr,n,sum/2);\n\t}", "public boolean canPartition(int[] nums) {\n int sum = 0;\n int n = nums.length;\n for (int num : nums) sum += num;\n // sum cannot be splitted evenly\n if ((sum & 1) == 1) return false;\n int target = sum / 2;\n \n // dp[i][j] represents whether 0~i-1 numbers can reach\n // weight capacity j\n boolean[][] dp = new boolean[n+1][target+1];\n \n for (int i = 1; i <= n; i++) dp[i][0] = true;\n for (int j = 1; j <= target; j++) dp[0][j] = false;\n dp[0][0] = true;\n \n for (int i = 1; i <= n; i++) {\n for (int j = 1; j <= target; j++) {\n // if don't pick current number\n dp[i][j] = dp[i-1][j];\n if (j >= nums[i-1]) {\n dp[i][j] = dp[i][j] || dp[i-1][j-nums[i-1]];\n }\n }\n }\n return dp[n][target];\n \n \n // Solution2: optimizing to save space\n // https://leetcode.com/problems/partition-equal-subset-sum/discuss/90592/01-knapsack-detailed-explanation/94996\n int sum = 0;\n int n = nums.length;\n for (int num : nums) sum += num;\n if ((sum & 1) == 1) return false;\n int target = sum / 2;\n boolean[] dp = new boolean[target+1];\n dp[0] = true;\n for (int num : nums) {\n // here is the trick to save space\n // because we have to update dp[j] based on \n // previous dp[j-num] and dp[j] from previous loop.\n // if we update dp from left to right\n // we first update smaller dp which is dp[j-num]\n // then we won't be able to get original dp[j-num] and dp[j]\n // from previous loop, and eventually we get the wrong\n // answer. But if we update dp from right to left\n // we can assure everything is based on previous state\n for (int j = target; j >= num; j--) {\n // if (j >= num) {\n dp[j] = dp[j] || dp[j-num];\n // }\n }\n }\n return dp[target];\n }", "private static boolean canPack(int bigCount, int smallCount, int goal) {\n\n//Check if all parameters are in valid range\n if (bigCount < 0 || smallCount < 0 || goal < 0)\n return false;\n\n int pack = 0;\n\n //While we haven't created a pack\n while (pack < goal) {\n //see if a big flour bag can fit in the package\n if (bigCount > 0 && (pack + 5) <= goal) {\n bigCount--;\n pack += 5;\n\n }\n //see there is a small flour bag left, to add to the package\n else if (smallCount > 0) {\n smallCount--;\n pack += 1;\n }\n //if a big bag won't fit (or doesnt exist) and we dont have enough small bags\n else\n return false;\n }\n return (pack == goal);\n }", "public static void main(String[] args) {\n\t\tint array0[] = new int[0];\r\n\t\tint array3[] = new int[3];\r\n\t\tint array5[] = new int[5];\r\n\t\tint array15[] = new int[15];\r\n\t\tint array16[] = new int[16];\r\n\t\tint array17[] = new int[17];\r\n\t\tint array19[] = new int[19];\r\n\t\tint array20[] = new int[20];\r\n\t\tint array200[] = new int[200];\r\n\t\tint array1000[] = new int[1000];\r\n\r\n\t\t// iX => integer with value X\r\n\t\tint i0 = 0;\r\n\t\tint i20 = 20;\r\n\t\tint i1 = 1;\r\n\t\tint i2 = 2;\r\n\t\tint i3 = 3;\r\n\t\tint i4 = 4;\r\n\t\tint i_5 = -5;\r\n\t\tint p = i2 * i_5; // p is [-10,-10]\r\n\r\n\t\tarray0[0] = 5; // Illegal upper bound\r\n\r\n\t\tarray0[1] = 5; // Illegal upper bound\r\n\r\n\t\tarray5[p] = 5; // Illegal lower bound\r\n\r\n\t\tp = 2 * i2; // p is [4,4]\r\n\r\n\t\tarray5[p] = 5; // Good\r\n\r\n\t\tp *= p; // p is [16,16]\r\n\r\n\t\tarray16[p] = 5; // Illegal upper bound (legal index range is 0-15)\r\n\r\n\t\tarray17[p] = 5; // Good\r\n\r\n\t\tp = i2 * i3; // p is [6,6]\r\n\r\n\t\tboolean b = args.length == 0;\r\n\r\n\t\tif (b) {\r\n\t\t\tp = p * i3; // p is [18,18]\r\n\t\t}\r\n\r\n\t\t// now p is [6,18]\r\n\r\n\t\tarray17[p] = 5; // Potentially illegal upper bound\r\n\t\tarray19[p] = 5; // Good\r\n\r\n\t\tp = 2; // p is [2,2]\r\n\r\n\t\tfor (int i = 0; i < 5; i++) {\r\n\t\t\tp *= 2;\r\n\t\t}\r\n\r\n\t\t// now p is [2,INF]\r\n\r\n\t\tarray19[p] = 5; // Potentially illegal upper bound // TODO problem\r\n\r\n\t\tp = p - 4; // p is [-2,INF]\r\n\r\n\t\tarray1000[p] = 5; // Potentially illegal lower and upper bounds\r\n\r\n\t\tp = 2; // p is [2,2]\r\n\r\n\t\tfor (int i = 0; i < 5; i++) {\r\n\t\t\tarray3[i] = 5; // Potentially illegal upper bound\r\n\t\t\tarray16[i] = 5; // Good\r\n\t\t\tp *= -2;\r\n\t\t}\r\n\r\n\t\tint i = 5, j = 10;\r\n\r\n\t\tif (b) {\r\n\t\t\ti = 15;\r\n\t\t\tj = 20;\r\n\t\t}\r\n\r\n\t\t// now i is [5,15], j is [10,20]\r\n\r\n\t\tif (i != j) {\r\n\t\t\tarray16[j] = 5; // Potentially illegal upper bound\r\n\t\t} else {\r\n\t\t\tarray16[j] = 5; // Good\r\n\t\t}\r\n\r\n\t\t// p is [-INF,INF]\r\n\r\n\t\tarray1000[p] = 5; // Potentially illegal lower and upper bounds\r\n\r\n\t}", "public static boolean has271(int[] nums) {\n if(nums.length<3)\n return false; \n \n for (int i = 0; i < nums.length-2; i++) {\n if(nums[i]+ 5 == nums[i+1])\n if(Math.abs(nums[i+2]-(nums[i]-1))<=2)\n return true; \n }\n \n return false; \n }", "public static void main(String[] args) {\n\t\tScanner s=new Scanner(System.in);\n\t\tlong min=s.nextLong(),max=s.nextLong(),sum=0;\n\t\tboolean[] arr=new boolean[(int)(max-min+1)];\n\t\tfor(int i=2;;i++) {\n\t\t\tlong p=(long) Math.pow(i, 2),add=p;\n\t\t\tif((p-min)>=arr.length) break;\n\t\t\t//\t\t\tif((p-min)<0) continue;\n\t\t\t//\t\t\tif(p==1) continue;\n\t\t\twhile((p-min)<arr.length) {\n\t\t\t\t//\t\t\t\tSystem.out.println(p);\n\t\t\t\tif(!((p-min)<0)) arr[(int)(p-min)]=true;\n\t\t\t\tp+=add;\n\t\t\t}\n\t\t}\n\t\t//\t\tSystem.out.println(Arrays.toString(arr));\n\t\tfor(int i=0;i<arr.length;i++) if(!arr[i]) sum++;\n\t\tSystem.out.println(sum);\n\t}", "public boolean isSolvable() {\n int inversions = 0;\n int zrow = 0;\n int beg;\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n if (tiles[i][j] == 0)\n zrow = i;\n else {\n for (int k = i; k < n; k++) {\n beg = (k == i)? j+1 : 0;\n for (int l = beg; l < n; l++) {\n if (tiles[i][j] != 0 && tiles[k][l] != 0 && tiles[i][j] > tiles[k][l])\n inversions++;\n }\n }\n }\n }\n }\n if (n%2 == 1)\n return (inversions%2 == 0);\n return ((inversions+zrow)%2 == 1);\n }", "public boolean isFull() {\r\n return solutions().size() == maxSize;\r\n }", "public void sanityCheck() {\n if ( bucket >= mNumBins ) bucket = mNumBins - 1;\n\n // Sanity check, should not happen.\n if ( bucket < 0 ) bucket = 0;\n }", "public boolean isPuzzleSolved() {\n\t\t// check rows/col/block )\n\t\tfor (int i = 1; i <= N; i++) {\n\t\t\tif ((this.constraints[i][0].nextClearBit(1) < N + 1) || (this.constraints[0][i].nextClearBit(1) < N + 1)\n\t\t\t\t\t|| (this.constraints[N + 1][i].nextClearBit(1) < N + 1))\n\t\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "public static boolean isValidCube(Cube cube){\n\t\tint[] bins = new int[6];\n\t\tfor(int f = 0; f<6; f++){\n\t\t\tfor(int i = 0; i<3; i++){\n\t\t\t\tfor(int j = 0 ; j<3; j++){\n\t\t\t\t\tbins[cube.getSquare(f, i, j)]++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < bins.length; i++){\n\t\t\tif(bins[i] != 9) return false;\n\t\t}\n\t\treturn true;\n\t\t\n\t}", "private boolean checkSolutions() {\n\t\tfor (int i = 0; i < population; ++i) {\n\t\t\tif (populationArray.get(i).getFitness() == 0) {\n\t\t\t\tsolution = populationArray.get(i);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "public void testOutputIsVaild()\n {\n Collection<Puzzle> puzzles = new ArrayList<Puzzle>();\n\n puzzles = (Collection<Puzzle>) Config.get(\"Puzzles\", puzzles);\n\n for (Puzzle puzzle : puzzles)\n {\n byte[] grid = puzzle.getData();\n GridSolver cs = new GridSolver(grid);\n cs.solveGrid();\n assertTrue(new GridChecker(cs.getDataSolution()).checkGrid());\n }\n }", "private static boolean checkTaskBounds(int task) {\r\n\t\t\tboolean isInBound;\r\n\t\t\t\r\n\t\t\tif ((task < 0) || (task > 7)) {\r\n\t\t\t\t//isInBound = false;\r\n\t\t\t\tif (task == -1) {\r\n\t\t\t\t\tisInBound = true;\r\n\t\t\t\t}else {\r\n\t\t\t\t\tisInBound = false;\r\n\t\t\t\t}\t\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tisInBound = true;\r\n\t\t\t}\r\n\t\t\treturn isInBound;\r\n\t\t}", "@Override\n protected boolean stoppingCriteriaSatisfied(KPMPSolution generatedSolution, RandomStepFunction stepFunction) {\n numberOfIterations++;\n numberOfIterationsWithoutImprovement++;\n KPMPSolutionChecker solutionChecker = new KPMPSolutionChecker();\n int crossingsOnOriginalPage = solutionChecker.getCrossingNumberOfEdge(bestSolution.getSpineOrder(), bestSolution.getEdgePartition(), originalPageIndex, edge);\n int crossingsOnNewPage = solutionChecker.getCrossingNumberOfEdge(generatedSolution.getSpineOrder(), generatedSolution.getEdgePartition(), newPageIndex, edge);\n if (crossingsOnNewPage < crossingsOnOriginalPage) {\n bestSolution = generatedSolution;\n numberOfIterationsWithoutImprovement = 0;\n\n crossingNumber = crossingNumber - (crossingsOnOriginalPage - crossingsOnNewPage);\n }\n return numberOfIterations >= Main.localSearchIterationLimit || numberOfIterations >= bestSolution.getEdgePartition().size() * bestSolution.getNumberOfPages() || numberOfIterationsWithoutImprovement >= Main.iterationMultiplier || ((System.nanoTime() - Main.START) / 1000000) >= (Main.secondsBeforeStop * 1000) || numberOfIterations >= Main.localSearchIterationLimit;\n }", "public static void main(String[] args) {\n int maxSolutions = 0;\r\n int bestPerimeter = 0;\r\n int[] perimeters = new int[1000];\r\n for (int a = 1; a <= 1000; a++) {\r\n for (int b = 1; b <= a; b++) {\r\n double c = Math.sqrt(a*a + b*b);\r\n if (c != (int)c) continue;\r\n int perimeter = a + b + (int)c;\r\n if (perimeter > 1000) break;\r\n perimeters[perimeter - 1]++;\r\n if (perimeters[perimeter - 1] > maxSolutions) {\r\n maxSolutions++;\r\n bestPerimeter = perimeter;\r\n }\r\n }\r\n }\r\n System.out.println(\"Best perimeter: \" + bestPerimeter);\r\n System.out.println(\"Solutions: \" + maxSolutions);\r\n }", "public static void main(String[] args) {\n\t\tnotprime[0]=true;\n\t\tnotprime[1]=true;\n\t\tfor(int i=2;i<MAXN;i++){\n\t\t\tif(!notprime[i]){\n\t\t\t\tif(i>MAXN/i){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tfor(int j=i*i;j<MAXN;j++){\n\t\t\t\t\tnotprime[j]=true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//查找出小于等于MAXN的素数 生成连续素数表\n\t\tgetPrime();\n\t}", "private boolean checkFinalPuzzle() throws Exception {\n for(int i = 0; i < puzzle.getColumns(); ++i) {\n var clues = puzzle.getColumnClue(i);\n var solver_col = searchBoard.getFilledGroups(i, TraversalType.COLUMN);\n if(clues.size() != solver_col.size()) {\n return false;\n }\n for(int j = 0; j < clues.size(); ++j) {\n if(!clues.get(j).equals(solver_col.get(j))) {\n return false;\n }\n }\n }\n for(int i = 0; i < puzzle.getRows(); ++i) {\n var clues = puzzle.getRowClue(i);\n var solver_row = searchBoard.getFilledGroups(i, TraversalType.ROW);\n if(clues.size() != solver_row.size()) {\n return false;\n }\n for(int j = 0; j < clues.size(); ++j) {\n if(!clues.get(j).equals(solver_row.get(j))) {\n return false;\n }\n }\n }\n return true;\n }", "private boolean checkOverlap(int row, int col, int length){\n \tif(!inBounds(row,col)){\n \t\treturn false;\n \t}\n \tfor(int i = row; i < row + length; i++ ){\n\t\t\tfor(int j = col; j < col + length; j++){\n\t\t\t\tif(grid[i][col] == 1 || row + length >= 10)\n\t\t\t\t\treturn false;\n\t\t\t\tif(grid[row][j] == 1 || col + length >= 10)\n\t\t\t\t\treturn false;\n\t\t\t}\n \t\t\n \t}\n \treturn true;\n }", "private boolean isFeasibleState(int[] state){\n if((state[0] <= totalMissionaries && state[0] >= 0)&&(state[1] <= totalCannibals && state[1] >= 0)) {\n return true;\n }\n return false;\n }", "boolean hasBasis();", "public static void main(String[] args) {\n\t\tArrayList<Integer> primelist = sieve(7071);\n\t\tArrayList<Double> second = new ArrayList<Double>();\n\t\tfor(int one : primelist) \n\t\t\tsecond.add(Math.pow(one, 2));\n\t\tArrayList<Double> third = new ArrayList<Double>();\n\t\tprimelist = sieve(368);\n\t\tfor(int one : primelist)\n\t\t\tthird.add(Math.pow(one, 3));\n\t\tArrayList<Double> fourth = new ArrayList<Double>();\n\t\tprimelist = sieve(84);\n\t\tfor(int one : primelist)\n\t\t\tfourth.add(Math.pow(one, 4));\n\n\t\tArrayList<Double> possibilities = new ArrayList<Double>();\n\t\tfor (int k = fourth.size() - 1; k >=0 ; k--) {\n\t\t\tfor (int j = 0; j < third.size(); j++) {\n\t\t\t\tdouble sum = fourth.get(k) + third.get(j);\n\t\t\t\tif (sum > 50000000)\n\t\t\t\t\tbreak;\n\t\t\t\telse {\n\t\t\t\t\tfor (int i = 0; i < second.size(); i++) {\n\t\t\t\t\t\tdouble nextsum = sum + second.get(i);\n\t\t\t\t\t\tif (nextsum > 50000000)\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t// I am not sure whether it can be proved that the sum is unique.\n\t\t\t\t\t\t\tif (!possibilities.contains(nextsum))\n\t\t\t\t\t\t\t\tpossibilities.add(nextsum);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint totalcount = possibilities.size();\n\t\tSystem.out.println(totalcount);\n\t}", "public boolean judgePoint241(int[] nums) {\n double n1 = nums[0];\n double n2 = nums[1];\n double n3 = nums[2];\n double n4 = nums[3];\n //case1:\n if(Math.abs(n1-8)<=0.01&&Math.abs(n2-4)<=0.01){\n int a = 1;\n }\n if(combine(combine(n1,n2),combine(n3,n4)))return true;\n //case2:\n for(double d:combine(n2,n3)){\n if(contains(combine(n1,d,n4),24.0)){\n return true;\n };\n }\n //case3:\n for(double d:combine(n1,n2,n3)){\n if(contains(combine(d,n4),24.0))return true;\n }\n //case4:\n for(double d:combine(n2,n3,n4)){\n if(contains(combine(n1,d),24.0))return true;\n }\n return false;\n }", "public boolean checkGrid(Set<Integer> numeros, Set<Integer> n_chances) {\n\t\t\n\t\t// The set structure assures there are no doublons\n\t\t\n\t\t// Checks the allowed combinaisons\n\t\tInteger nb_numeros = numeros.size();\n\t\tInteger nb_chances = n_chances.size();\n\t\t\n\t\tif ((nb_numeros > 9) || (nb_numeros < 5)) {\n\t\t\treturn false;\n\t\t}\n\t\telse if ((nb_chances > 10) || (nb_chances < 1)) {\n\t\t\treturn false;\n\t\t}\n\t\telse if (nb_numeros == 9) {\n\t\t\tif (nb_chances > 1) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\telse if (nb_numeros == 8) {\n\t\t\tif (nb_chances > 3) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\telse if (nb_numeros == 7) {\n\t\t\tif (nb_chances > 8) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t\n\t\t//Checks if numeros are between 1 and 49 and n_chances are between 1 and 10\n\t\tIterator<Integer> iterator1 = numeros.iterator();\n\t\tIterator<Integer> iterator2 = n_chances.iterator();\n\t\t\n\t\tInteger setElement = null;\n\t\twhile(iterator1.hasNext()) {\n\t \tsetElement = iterator1.next();\n\t \tif((setElement < 1) || (setElement > 49)) {\n\t \t\treturn false;\n\t \t}\n\t }\n\t\t\n\t\tsetElement = null;\n\t while(iterator2.hasNext()) {\n\t \tsetElement = iterator2.next();\n\t \tif((setElement < 1) || (setElement > 10)) {\n\t \t\treturn false;\n\t \t}\n\t }\n\t\t\n\t\treturn true;\n\t}", "private boolean isFound(int remaingingMarbles) {\n\n return (Math.log(remaingingMarbles) / Math.log(2)) % 1 == 0 ;\n\n }", "public boolean solve() {\n Cell openCell = getOpenCell();\n if (openCell == END) {\n return true;\n }\n for (int n = 1; n < 10; n++) {\n if (isSafe(openCell.row, openCell.col, n)) {\n add(openCell, n);\n if (solve()) {\n return true;\n }\n add(openCell, 0); // reset\n }\n }\n\n return false;\n }", "public boolean canPartition(int[] nums) {\n\t\tint sum = 0;\n\t\tfor (int num : nums) {\n\t\t\tsum += num;\n\t\t}\n\n\t\tif ((sum & 1) == 1) {\n\t\t\treturn false;\n\t\t}\n\t\tsum /= 2;\n\n\t\tint n = nums.length;\n\t\tboolean[][] dp = new boolean[n + 1][sum + 1];\n\t\tfor (int i = 0; i < dp.length; i++) {\n\t\t\tArrays.fill(dp[i], false);\n\t\t}\n\n\t\tdp[0][0] = true;\n\n\t\tfor (int i = 1; i < n + 1; i++) {\n\t\t\tdp[i][0] = true;\n\t\t}\n\t\tfor (int j = 1; j < sum + 1; j++) {\n\t\t\tdp[0][j] = false;\n\t\t}\n\n\t\tfor (int i = 1; i < n + 1; i++) {\n\t\t\tfor (int j = 1; j < sum + 1; j++) {\n\t\t\t\tif (j >= nums[i - 1]) {\n\t\t\t\t\tdp[i][j] = (dp[i - 1][j] || dp[i - 1][j - nums[i - 1]]);\n\t\t\t\t} else {\n\t\t\t\t\tdp[i][j] = dp[i - 1][j];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn dp[n][sum];\n\t}", "public static boolean checkPath(int[][] bs, int i) {\n\t\tArrayList<Integer> temp_cP = new ArrayList<Integer>();\n\t\tSet<Integer> temp_setcP = new HashSet<Integer>();\n\t\tboolean denoter = true;\n\t\twhile (i == 3) {\n\t\t\tfor (int k = 0; k < i; k++) {\n\t\t\t\tfor (int e = 0; e < 3; e++) {\n\t\t\t\t\ttemp_cP.add(e, bs[k][e]);\n\t\t\t\t}\n\t\t\t}\n\t\t\ttemp_setcP = new HashSet<Integer>(temp_cP);\n\t\t\tif (temp_cP.size() > temp_setcP.size()) {\n\t\t\t\tdenoter = false;\n\t\t\t\tbreak;\n\n\t\t\t} else {\n\t\t\t\ttemp_cP.clear();\n\t\t\t\ttemp_setcP.clear();\n\n\t\t\t\tfor (int k = 0; k < i; k++) {\n\t\t\t\t\tfor (int e = 3; e < 6; e++) {\n\t\t\t\t\t\ttemp_cP.add(bs[k][e]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttemp_setcP = new HashSet<Integer>(temp_cP);\n\t\t\t\tif (temp_cP.size() > temp_setcP.size()) {\n\t\t\t\t\tdenoter = false;\n\t\t\t\t\tbreak;\n\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\twhile (i == 6) {\n\n\t\t\tfor (int k = 3; k < i; k++) {\n\t\t\t\tfor (int e = 0; e < 3; e++) {\n\t\t\t\t\ttemp_cP.add(e, bs[k][e]);\n\t\t\t\t}\n\t\t\t}\n\t\t\ttemp_setcP = new HashSet<Integer>(temp_cP);\n\t\t\tif (temp_cP.size() > temp_setcP.size()) {\n\t\t\t\tdenoter = false;\n\t\t\t\tbreak;\n\n\t\t\t} else {\n\t\t\t\ttemp_cP.clear();\n\t\t\t\ttemp_setcP.clear();\n\n\t\t\t\tfor (int k = 3; k < i; k++) {\n\t\t\t\t\tfor (int e = 3; e < 6; e++) {\n\t\t\t\t\t\ttemp_cP.add(bs[k][e]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttemp_setcP = new HashSet<Integer>(temp_cP);\n\t\t\t\tif (temp_cP.size() > temp_setcP.size()) {\n\t\t\t\t\tdenoter = false;\n\t\t\t\t\tbreak;\n\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\treturn denoter;\n\t}", "public static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\n\t\tint a[] = {2,1,3,-4,-2};\n\t\t//int a[] = {1 ,2, 3, 7, 5};\n\t\tboolean found = false;\n\t\t\n\t\t//this will solve in o n^2\n\t\tfor(int i = 0 ; i < a.length ; i++){\n\t\t\tint sum = 0;\n\t\t\tfor(int j = i ; j< a.length ; j++){\n\t\t\t\tsum += a[j] ;\n\t\t\t\tif(sum == 0){\n\t\t\t\t\tfound = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\tif(found)\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\t\n\t\t// link : https://www.youtube.com/watch?v=PSpuM9cimxA&list=PLKKfKV1b9e8ps6dD3QA5KFfHdiWj9cB1s&index=49\n\t\tSystem.out.println(found + \" found\");\n\t\tfound = false;\n\t\t//solving with O of N with the help sets\n\t\t// x + 0 = y\n\t\tSet<Integer> set = new HashSet<>();\n\t\tint sum = 0;\n\t\tfor(int element : a){\n\t\t\tset.add(sum);\n\t\t\tsum += element;\n\t\t\tif(set.contains(sum)){\n\t\t\t\tfound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println();\n\t\tSystem.out.println(set);\n\t\t\n\t\tSystem.out.println(found + \" found\");\n\t\t\n\t\t\n\t\tfound = false;\n\t\t// when the sum of subarray is K\n\t\t\n\t\t//solving with O of N with the help sets\n\t\t//x + k = y >>>\n\t\tSet<Integer> set1 = new HashSet<>();\n\t\tint k = 12;\n\t\tint summ = 0;\n\t\tfor(int element : a){\n\t\t\tset1.add(summ);\n\t\t\tsumm += element;\n\t\t\tif(set1.contains(summ - k)){ // y - k = x(alredy presnt or not)\n\t\t\t\tfound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(set1);\n\t\tSystem.out.println();\n\t\tSystem.out.println(found + \" found\");\n\t\t\n\t\t\n\t}", "@Override\n public String solve() {\n int LIMIT = 50 * NumericHelper.ONE_MILLION_INT;\n int[] nCount = new int[LIMIT+1];\n for(long y = 1; y<= LIMIT; y++) {\n for(long d= (y+3)/4; d<y; d++) { // +3 is to make d atleast 1\n long xSq = (y+d) * (y+d);\n long ySq = y * y;\n long zSq = (y-d) * (y-d);\n\n long n = xSq - ySq - zSq;\n\n if(n<0) {\n continue;\n }\n\n if(n>=LIMIT) {\n break;\n }\n\n\n nCount[(int)n]++;\n\n }\n }\n\n int ans = 0;\n for(int i = 1; i<LIMIT; i++) {\n if(nCount[i] == 1) {\n //System.out.print(i +\",\");\n ans++;\n }\n }\n\n return Integer.toString(ans);\n }", "public int h(int[] solution) {\n\t\tint[] bins = new int[binCount];\n\t\tint nonEmptyBins = 0;\n\t\tint overFilledBins = 0;\n\t\tint overFillWeight = 0;\n\n\t\tfor (int i = 0; i < solution.length; i++) {\n\t\t\tint bin = solution[i];\n\t\t\tint weight = packageWeights[i];\n\t\t\tbins[bin] += weight;\n\t\t}\n\n\t\tfor (int i = 0; i < bins.length; i++) {\n\t\t\tif (bins[i] != 0) {\n\t\t\t\tnonEmptyBins++;\n\t\t\t}\n\t\t\tif (bins[i] > binSize) {\n\t\t\t\toverFilledBins++;\n\t\t\t\toverFillWeight += (bins[i] - binSize);\n\t\t\t}\n\t\t}\n\t\tif (overFilledBins > 0)\n\t\t\treturn (nonEmptyBins + binSize * (overFillWeight));\n\t\telse\n\t\t\treturn nonEmptyBins;\n\t}", "private Integer getFitness(int[] chromosome) {\n\t\tint[] bins = new int[binCount]; //list of found bins\n\t\tfor (int binIndex = 0; binIndex < bins.length; binIndex++) { //initialize list of bins to unfound\n\t\t\tbins[binIndex] = -1;\n\t\t}\n\t\tint[] newChrom = bestFitModified(chromosome.clone()); //fix if infeasible\n\t\tif (newChrom == null) { //this is an unfixable chromosome, inform caller\n\t\t\treturn binCount * 2 + totalInfeasibility(chromosome);\n\t\t}\n\n\t\tfor (int i = 0; i < newChrom.length; i++) {\n\t\t\tchromosome[i] = newChrom[i]; //copy over to take advantage of side-effects\n\t\t}\n\t\tint uniqueBins = 0;\n\n\t\tfor (int i = 0; i < chromosome.length; i++) {\n\t\t\tif (bins[chromosome[i]] == -1) { //if we haven't seen this bin before track it and increment bin counter\n\t\t\t\tbins[chromosome[i]] = chromosome[i];\n\t\t\t\tuniqueBins++;\n\t\t\t} else\n\t\t\t\tcontinue;\n\t\t}\n\n\t\treturn uniqueBins;\n\t}", "boolean isBoundVariable(Formula f);", "int tryScale(){\n int numAccepted = 0;\n \n for(int c=0; c<numCandScaleTuning; c++){\n DoubleMatrix1D y = nextCandidate();\n if(checkCandidate(y))//accept\n numAccepted++;\n }\n \n return numAccepted;\n }", "public static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n\t\tn=sc.nextInt();\n\t\tm=sc.nextInt();\n\t\tmap=new int[m][n];\n\t\tflag=new boolean[m][n];\n\t\t\n\t\tfor(int i=0;i<m;i++)\n\t\t\tfor(int j=0;j<n;j++){\n\t\t\t\tmap[i][j]=sc.nextInt();\n\t\t\t\tsum+=map[i][j];\n\t\t\t}\n\t\t\n\t\tif(sum%2!=0)\n\t\t\tSystem.out.println(0);\n\t\telse{\n\t\t\thalf=sum/2;\n\t\t\tdfs(0,0,1,0);\n\t\t\tSystem.out.println(count==100?0:count);\n\t\t}\n\t\t\n\t}", "private boolean isInBounds(int i, int j)\n {\n if (i < 0 || i > size-1 || j < 0 || j > size-1)\n {\n return false;\n }\n return true;\n }", "@Override\n public void evaluate(SudokuGrid grid) {\n for (int l = 0; l < 3; l++) {//subgrid row index\n for (int m = 0; m < 3; m++) { // subgrid column index\n Set<Integer> fixed = new HashSet<Integer>();\n populateFixed(grid, l, m, fixed);\n updateFlags(grid, l, m, fixed);\n //System.out.println(\"Checking for subgrid:\"+ System.currentTimeMillis());\n findUniqueInSubgrid(grid, l, m);\n //System.out.println(\"Cheecked in subgrid: \"+System.currentTimeMillis());\n checkForFinal(grid, l, m, fixed);\n }\n }\n\n }", "public boolean percolates(){\n\t\tif(isPathological)\n\t\t\treturn isOpen(1,1);\n\t\t//System.out.println(\"Root top: \"+ quickUnion.find(N+2));\n\t\t\n\t\treturn (quickUnion.find(N*N+1) == quickUnion.find(0)); \t\n\t}", "@Test(timeout = 4000)\n public void test13() throws Throwable {\n Discretize discretize0 = new Discretize(\"\\tInvert matching sense of column indexes.\");\n discretize0.setOutputFormat();\n discretize0.listOptions();\n Discretize discretize1 = new Discretize();\n discretize1.setIgnoreClass(false);\n String[] stringArray0 = new String[2];\n stringArray0[0] = \"\\tInvert matching sense of column indexes.\";\n stringArray0[1] = \"\";\n Discretize.main(stringArray0);\n String string0 = discretize1.findNumBinsTipText();\n assertEquals(\"Optimize number of equal-width bins using leave-one-out. Doesn't work for equal-frequency binning\", string0);\n \n discretize1.setInvertSelection(false);\n discretize0.getBinRangesString(511);\n assertEquals((-1.0), discretize0.getDesiredWeightOfInstancesPerInterval(), 0.01);\n assertFalse(discretize0.getUseBinNumbers());\n assertEquals(10, discretize0.getBins());\n assertFalse(discretize0.getMakeBinary());\n assertFalse(discretize0.getFindNumBins());\n assertFalse(discretize0.getUseEqualFrequency());\n \n discretize1.getFindNumBins();\n assertEquals(10, discretize1.getBins());\n }", "private boolean hasValidBounds() {\n\n\n\n return false;\n }", "public static boolean solved(BaseBoard x)\r\n\t\t{\r\n\t\t//get the board\r\n\t\tint [][] board = x.getBoard();\r\n\t\t\t//row\r\n\t\t\tfor (int i = 0; i <board.length;i++)\r\n\t\t\t{\r\n\t\t\t\t//column\r\n\t\t\t\tfor (int j= 0; j< board[0].length ; j++)\r\n\t\t\t\t{\r\n\t\t\t\t\t//if the value in the slot is a zero then try to find the right value for it\r\n\t\t\t\t\tif(x.getBoard()[i][j] == 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t//valid values k 1-9\r\n\t\t\t\t\t\tfor(int k = 1; k <10; k++)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t//check if constraints are met\r\n\t\t\t\t\t\t\tif(good(board, i, j, k))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tx.fillSpot(k, i, j);\r\n\t\t\t\t\t\t\t\t//if the value k does not mess up the contraints then put it into the slot [i][j]\r\n\t\t\t\t\t\t\t\tif(solved(x))\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tx.fillSpot(0, i, j);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\t\r\n\t\t\t\t\t\t}return false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}return true;\r\n\t\t}", "static boolean isSubsetPossible(int[] nums, int sum) {\t\n\t\tboolean[][] dp = new boolean[nums.length][sum + 1];\n\t\tfor(int row = 0; row < dp.length; row++) {\n\t\t\tdp[row][0] = true;\n\t\t}\n \n\t\tfor(int row = 0; row < dp.length; row++) {\n\t\t\tint num = nums[row];\n\t\t\tfor(int col = 1; col < dp[0].length; col++) {\n\t\t\t\tif( col < num ) {\n\t\t\t\t\tdp[row][col] = (row == 0) ? false : dp[row - 1][col];\n\t\t\t\t}else if(num == col) {\n\t\t\t\t\tdp[row][col] = true;\n\t\t\t\t}else {\n\t\t\t\t\tdp[row][col] = dp[row - 1][col] || dp[row - 1][col - num];\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(dp[row][sum]){\n\t\t\t\tSystem.out.println(\"breaked at row \" + row);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"all the way end\");\n\t\treturn dp[nums.length - 1][sum];\n\t}", "public boolean isGoal() {\r\n\t\tint n = this.dimension();\r\n\t\tint k = 1;\r\n\t\tfor (int i = 0; i < n; i++) {\r\n\t\t\tfor (int j = 0; j < n; j++) {\r\n\t\t\t\tif (this.blocks[i][j] != k) {\r\n\t\t\t\t\tif (!(i == n - 1 && j == n - 1 && this.blocks[i][j] == 0)) {\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tk++;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "int xBins();", "private boolean routine1(Graph<V, E> g, Set<V> X)\n {\n return containsCleanShortestOddHole(g) || containsShortestOddHole(g, X);\n }", "private static boolean hasSolution(AlgoFunction algo, GridGraph gridGraph, StartGoalPoints p) {\n int[][] path = Utility.generatePath(algo, gridGraph, p.sx, p.sy, p.ex, p.ey);\n return path.length > 1;\n }", "static boolean checkSplits (double[] splits) { throw new RuntimeException(); }", "private boolean isSolvable() {\n\t\tshort permutations = 0; // the number of incorrect orderings of tiles\n\t\tshort currentTileViewLocationScore;\n\t\tshort subsequentTileViewLocationScore;\n\n\t\t// Start at the first tile\n\t\tfor (int i = 0; i < tiles.size() - 2; i++) {\n\t\t\tTile tile = tiles.get(i);\n\n\t\t\t// Determine the tile's location value\n\t\t\tcurrentTileViewLocationScore = computeLocationValue(tile\n\t\t\t\t\t.getCorrectLocation());\n\n\t\t\t// Compare the tile's location score to all of the tiles that\n\t\t\t// follow it\n\t\t\tfor (int j = i + 1; j < tiles.size() - 1; j++) {\n\t\t\t\tTile tSub = tiles.get(j);\n\n\t\t\t\tsubsequentTileViewLocationScore = computeLocationValue(tSub\n\t\t\t\t\t\t.getCorrectLocation());\n\n\t\t\t\t// If a tile is found to be out of order, increment the number\n\t\t\t\t// of permutations.\n\t\t\t\tif (currentTileViewLocationScore > subsequentTileViewLocationScore) {\n\t\t\t\t\tpermutations++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// return whether number of permutations is even\n\t\treturn permutations % 2 == 0;\n\t}", "@SuppressWarnings(\"unlikely-arg-type\")\n\tpublic boolean verify(ArrayList<Integer[]> answer, ArrayList<Integer[]> allSubsets, int bound) {\n\t\t//Contains\n\t\tfor (int i = 0; i < answer.size(); i++) {\n\t\t\tif(!allSubsets.contains(answer.get(i))) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t//Size\n\t\tif(answer.size()>bound) {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tint[] people= new int[answer.get(0).length];\n\t\t//Universe\n\t\tfor (int i = 0; i <answer.size(); i++) {\n\t\t\tInteger[] subset = answer.get(i);\n\t\t\tfor (int j = 0; j < subset.length; j++) {\n\t\t\t\tif(subset[j]==1) {\n\t\t\t\t\tpeople[j]=1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "static int workbook(int n, int k, int[] arr) {\n int specialProblems = 0;\n int page = 1;\n for (int i = 0; i < n; i++) {\n for (int j = 1; j <= arr[i]; j++) {\n if (j == page)\n specialProblems++;\n if (j % k == 0)\n page++;\n }\n if (arr[i] % k != 0) page++;\n }\n return specialProblems;\n }", "static boolean equalSumPartition(int[] arr){\n int sum = 0;\n for (int i = 0;i<arr.length;i++){\n sum+=arr[i];\n }\n if (sum%2==0){\n return subSetSumProblem(arr,sum/2);\n }\n return false;\n }", "public boolean underfull() {\n\t\treturn lastindex < minkeys(); // ptrs number: Math.ceil(degree / 2.0) ~ n\n\t}", "boolean isOverflow() {\r\n\r\n if (values.size() > branchingFactor - 1) {\r\n return true;\r\n }\r\n return false;\r\n }", "private static int computeNumberOfBandsForThreshold(int nHashes, double jaccardThreshold) {\n int bands = nHashes;\n while (bands > 1) {\n if ((nHashes % bands) == 0) {\n double threshold = Math.pow((double) 1.0 / bands, (double) bands / nHashes);\n if (threshold > jaccardThreshold) {\n break;\n }\n }\n bands--;\n }\n return bands;\n }", "public boolean isPerfectlyBalanced() {\n\t\t// TODO\n\t\tint ans = isPerfectlyBalanced(root);\n if(ans == -1)\n return false;\n return true;\n }", "public static int solve() {\n FactorizationSieve sieve = new FactorizationSieve(LIMIT + 1);\n int[] abundants = new int[LIMIT + 1];\n int k = 0;\n\n for (int n = 1; n <= LIMIT; n++)\n if (sieve.sigma(1, n) > n + n)\n abundants[k++] = n;\n\n // Sum pair of abundant numbers\n BitSet absums = new BitSet(LIMIT + 1);\n for (int i = 0; i < k; i++) {\n for (int j = i; j < k; j++) {\n int n = abundants[i] + abundants[j];\n if (n > LIMIT)\n break;\n absums.set(n);\n }\n }\n\n // Find all numbers that cannot be written as the sum of two abundant numbers\n int res = 0;\n for (int n = 1; n <= LIMIT; n++)\n if (!absums.get(n))\n res += n;\n return res;\n }", "public boolean isFarmBig() {\r\n if(usedPopulation / maxPopulation > 0.8) {\r\n return false;\r\n } else {\r\n return true;\r\n }\r\n }", "public static boolean canPartition(int[] nums) {\n if (nums == null) {\n return false;\n }\n int sum = computeArraySum(nums);\n if (sum % 2 != 0) {\n return false;\n }\n int W = sum / 2;\n boolean[] dp = new boolean[W + 1];\n dp[0] = true;\n\n for (int num : nums) {\n for (int i = W; i >= num; i--) {\n dp[i] = dp[i] || dp[i - num];\n }\n }\n return dp[W];\n }", "public boolean isSolved(){\n\t\t// if any of row, col, and block contains 1,2,...,size*size,\n\t\t// then the sudoku is solved\n\t\tList<Integer> correctArray = new ArrayList<Integer>(size*size);\n\t\tfor (int i = 0; i < size*size; i++){\n\t\t\tcorrectArray.add(i+1);\n\t\t}\n\t\tfor (int n = 0; n < size*size; n++){\n\t\t\tif (!(this.getRowAsList(n).containsAll(correctArray)))\n\t\t\t\treturn false;\n\t\t\tif (!(this.getColAsList(n).containsAll(correctArray)))\n\t\t\t\treturn false;\n\t\t\tif (!(this.getBlockAsList(n).containsAll(correctArray)))\n\t\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "public boolean percolates()\r\n { return uf.find(0) == uf.find(dimension*dimension + 1); }", "public boolean canPartition(int startIndex, int currentSum, int currentBucket) {\n\t\tif (currentBucket == 1) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (currentSum > target)\n\t\t\treturn false;\n\n\t\tif (currentSum == target) {\n\t\t\treturn canPartition(0, 0, currentBucket - 1);\n\t\t} else {\n\t\t\tfor (int index = startIndex; index < arr.length; index++) {\n\t\t\t\tif (!visited[index]) {\n\t\t\t\t\tvisited[index] = true;\n\t\t\t\t\tif (canPartition(index + 1, currentSum + arr[index], currentBucket)) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tvisited[index] = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "public boolean CheckBoom(int[] i,int[] j){\r\n try {\r\n if (((i[0] == i[1] - 1 && j[0] == j[1]) || (i[0] == i[1] + 1 && j[0] == j[1]) ||\r\n (i[0] == i[1] && j[0] == j[1] - 1) || (i[0] == i[1] && j[0] == j[1] + 1))) {\r\n return true;\r\n }\r\n }catch (ArrayIndexOutOfBoundsException e) {\r\n return false;\r\n }\r\n return false;\r\n }", "public boolean isFull(int i, int j){\n\t\t\n\t\tif (i <= 0 || i > N) throw new java.lang.IndexOutOfBoundsException(\"row index i out of bounds\");\n\t\tif (j <= 0 || j > N) throw new java.lang.IndexOutOfBoundsException(\"row index j out of bounds\");\n\t\t\n\t\tif(isPathological)\n\t\t\treturn isOpen(i, j);\n\t\t\n\t\treturn (quickUnion.find((i-1)*N+j) == quickUnion.find(0) && (quickUnionBackwash.find((i-1)*N+j) == quickUnionBackwash.find(0))); \t\n\t}", "public boolean find132pattern(int[] nums) {\n int i = 0, j=0, k=0;\n int n = nums.length;\n while (i<n){\n while (i<n-1&&nums[i]>=nums[i+1]) i++;\n j=i+1;\n while (j<n-1&&nums[j]<=nums[j+1]) j++;\n k=j+1;\n while (k<n){\n if(nums[i]<nums[j]&&nums[i]<nums[k]&&nums[k]<nums[j]){\n return true;\n }\n k++;\n }\n i=j+1;\n }\n return false;\n }", "private static boolean checkLikelyEqual(EquationSystem system, Map<Sort, List<Term>> smallTerms) {\n //int searchDepth = 0;\n //Term convergence = null;\n\n return true;\n /*\n\n for (int i = 0; i < 2; i++) {\n Set<Term> leftTerms = new HashSet<>();\n Set<Term> rightTerms = new HashSet<>();\n\n Term left = system.getGoal().getLeft();\n Term right = system.getGoal().getRight();\n\n for (Variable var : left.getVariables()) {\n left = left.substitute(var, smallTerms.get(var.getSort()).get(i));\n right = right.substitute(var, smallTerms.get(var.getSort()).get(i));\n }\n\n leftTerms.add(left);\n rightTerms.add(right);\n\n Logger.d(\"Checking convergence of \" + left.toString() + \" to \" + right.toString());\n\n while (convergence == null && searchDepth < 5) {\n leftTerms.addAll(Prover.rewriteAll(leftTerms, system.getEquations(), null, true, true));\n rightTerms.addAll(Prover.rewriteAll(rightTerms, system.getEquations(), null, true, true));\n\n searchDepth++;\n convergence = checkConvergence(leftTerms, rightTerms);\n }\n\n if (convergence == null) {\n return false;\n }\n }\n\n return true;*/\n }", "private boolean checkSolveSudoku() {\n\n // Check Rows\n for (int i = 0; i < rows.size(); i++) {\n ArrayList<Cell> row = rows.get(i);\n int[] temp = new int[getSize()];\n\n for (int j = 0; j < row.size(); j++) {\n if (row.get(j).getNumber() == -1)\n return false;\n temp[row.get(j).getNumber() - 1]++;\n }\n\n for (int j : temp)\n if (j == 0)\n return false;\n }\n\n // Check Columns\n for (int i = 0; i < columns.size(); i++) {\n ArrayList<Cell> column = columns.get(i);\n int[] temp = new int[getSize()];\n\n for (int j = 0; j < column.size(); j++)\n temp[column.get(j).getNumber() - 1]++;\n\n for (int j : temp)\n if (j == 0)\n return false;\n }\n\n // Check Boxes\n for (int i = 0; i < boxes.size(); i++) {\n ArrayList<Cell> box = rows.get(i);\n int[] temp = new int[getSize()];\n\n for (int j = 0; j < box.size(); j++)\n temp[box.get(j).getNumber() - 1]++;\n\n for (int j : temp)\n if (j == 0)\n return false;\n }\n\n return true;\n }", "@Override\n\tpublic boolean checkBoundary(float x) {\n\t\tif (!(x >= MINRANGE && x <= MAXRANGE)) {\n\t\t\treturn false;\n\t\t}\n\t\t// if in the range [-512.03, 511.97]\n\t\treturn true;\n\t}", "public boolean divisorGame(int N) {\n return (N & 1) == 0;\n }", "protected abstract boolean nbrToursMax();", "public static void main(String[] args) {\n\t\tint[] nums = {-1, -1};\r\n\t\tNearbyAlmostDuplicate nad = new NearbyAlmostDuplicate();\r\n\t\tSystem.out.println(nad.containsNearbyAlmostDuplicate(nums, 1, 0));\r\n\t}", "public boolean canReproduce() {\r\n ArrayList<Cell> neighbours = getNeighbours(FIRSTLAYER);\r\n\r\n int numOfSameT = 0;\r\n int numOfEmpty = 0;\r\n int numOfFoodC = 0;\r\n\r\n for (Cell cell : neighbours) {\r\n if (isSameType(cell.getInhabit())) {\r\n numOfSameT++;\r\n } else if (cell.getInhabit() == null && isTerrainAccessiable(cell)) {\r\n numOfEmpty++;\r\n } else if (isEdible(cell.getInhabit())) {\r\n numOfFoodC++;\r\n }\r\n }\r\n\r\n return (numOfSameT >= numOfSameTypeNeighbourToReproduce() \r\n && numOfEmpty >= numOfEmptyToReproduce()\r\n && numOfFoodC >= numOfFoodCellToReproduce());\r\n }", "public boolean containsNearbyAlmostDuplicate(int[] nums, int k, int t) {\n\t\tif (k<1 || t<0) return false;\n Map<Long, Long> map = new HashMap<Long, Long>();\n for (int i=0;i<nums.length;i++) {\n \tif (i>k) {\n \t\tlong tmp = (long)nums[i-k-1]-Integer.MIN_VALUE;\n \t\ttmp /= (long)t+1;\n \t\tmap.remove(tmp);\n \t}\n \tlong val = (long)nums[i]-Integer.MIN_VALUE;\n \tlong bucket = val/((long)t+1);\n \tSystem.out.println(\"val=\"+val+\",bucket=\"+bucket);\n \tSystem.out.println(\"same bucket:\"+map.containsKey(bucket));\n \tif (map.containsKey(bucket) || (map.containsKey(bucket-1) && val-map.get(bucket-1)<=t) \n \t\t\t|| (map.containsKey(bucket+1) && map.get(bucket+1)-val<=t)) {\n \t\treturn true;\n \t}\n \tmap.put(bucket, val);\n }\n return false;\n }", "public boolean check() {\n BigInteger t1 = y.modPow(int2, c.p);\n BigInteger t2 = x.modPow(int3, c.p);\n BigInteger t3 = ((t2.add(c.a.multiply(x))).add(c.b)).mod(c.p);\n return t1.compareTo(t3) == 0;\n }", "public boolean isSolutionExist() {\n // Mengecek apakah sebuah matriks SPL memiliki solusi\n boolean ada_solusi = true;\n\n int i = this.NBrsEff - 1;\n\n while(ada_solusi && i >= 0){\n int j = 0;\n boolean found = false;\n\n while(!found && j <= this.NKolEff) {\n if(this.M[i][j] != 0 && j != this.NKolEff - 1) {\n found = true;\n }\n j += 1;\n }\n\n if(!found) {\n boolean all_zero_brs = false;\n\n for(int k = 0; k < this.NBrsEff; k++){\n if(this.isAllZeroBrs(k)) {\n all_zero_brs = true;\n }\n }\n\n if(!all_zero_brs) {\n ada_solusi = false;\n }\n }\n\n i -= 1;\n }\n\n return ada_solusi;\n }", "public boolean isFull(int[][] grid) {\n for (int row = 0; row < 9; row++){\n for (int col = 0; col < 9; col++) {\n if (grid[row][col] == 0) return false;\n }\n }\n return true;\n }", "static double binarySearchForBuckets (double[] splits, double feature, boolean keepInvalid) { throw new RuntimeException(); }", "public boolean checkWin (int totalPieces){\n\t\treturn isFull();\n\t}" ]
[ "0.6409288", "0.6170014", "0.61052614", "0.59527546", "0.5917247", "0.58839005", "0.58246064", "0.57843906", "0.57798076", "0.57792246", "0.5757097", "0.5710262", "0.57077825", "0.5679809", "0.5658625", "0.5650042", "0.5649296", "0.563225", "0.56265694", "0.56140435", "0.558962", "0.5588577", "0.55884427", "0.5586151", "0.5573134", "0.5551762", "0.5548776", "0.55319554", "0.55289435", "0.55280143", "0.55214447", "0.5499917", "0.5489776", "0.54869246", "0.5482565", "0.54601973", "0.54581356", "0.544901", "0.544818", "0.54403573", "0.5436299", "0.54341924", "0.5423862", "0.5413186", "0.540955", "0.54059255", "0.5404761", "0.5403747", "0.5396427", "0.5392322", "0.5391385", "0.53725976", "0.53653", "0.5363709", "0.53408694", "0.53408504", "0.53384554", "0.5337674", "0.5333531", "0.5332856", "0.5327574", "0.53181934", "0.5312422", "0.531113", "0.5309918", "0.5305676", "0.53056", "0.52925944", "0.528943", "0.5284411", "0.52822167", "0.52812546", "0.5274144", "0.5266975", "0.52630436", "0.52496517", "0.5247729", "0.5245733", "0.52451664", "0.52393746", "0.52357996", "0.52346176", "0.5227882", "0.5223647", "0.522061", "0.52205163", "0.521444", "0.5213484", "0.5209365", "0.52073115", "0.5203514", "0.5202926", "0.5197136", "0.51945907", "0.5193145", "0.5190495", "0.51886016", "0.5188205", "0.51874584", "0.51863146" ]
0.66722697
0
/ SA HELPER FUNCTIONS SA Fitness. SA does not repair infeasibles, so we try to take infeasibility into account here.
public int h(int[] solution) { int[] bins = new int[binCount]; int nonEmptyBins = 0; int overFilledBins = 0; int overFillWeight = 0; for (int i = 0; i < solution.length; i++) { int bin = solution[i]; int weight = packageWeights[i]; bins[bin] += weight; } for (int i = 0; i < bins.length; i++) { if (bins[i] != 0) { nonEmptyBins++; } if (bins[i] > binSize) { overFilledBins++; overFillWeight += (bins[i] - binSize); } } if (overFilledBins > 0) return (nonEmptyBins + binSize * (overFillWeight)); else return nonEmptyBins; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void computeSatisfaction() {\n\n }", "private void findSmallestCost() {\n int best = 0;\n fx = funFitness[0];\n for (int i = 1; i < population; i++) {\n if (funFitness[i] < fx) {\n fx = funFitness[i];\n best = i;\n }\n }\n //System.arraycopy(currentPopulation[best], 0, bestSolution, 0, dimension);\n copy(bestSolution, currentPopulation[best]);\n }", "void findFeasible() {\n\n\t\tfor( int u = 0; u < neg.length; u++ ) {\t\n\t\t\tint i = neg[u];\n\t\t\tfor( int v = 0; v < pos.length; v++ ) {\t\n\t\t\t\tint j = pos[v];\n\t\t\t\tf[i][j] = -delta[i] < delta[j]? -delta[i]: delta[j];\n\t\t\t\tdelta[i] += f[i][j];\n\t\t\t\tdelta[j] -= f[i][j];\n\t\t\t}\n\t\t}\n\t}", "private boolean feasible() {\n\t\tint weight = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tassert x[i] == 0 || x[i] == 1;\n\t\t\tweight += w[i] * x[i];\n\t\t}\n\t\treturn weight <= k;\n\t}", "private void EvalFitness(){\r\n _FitVal=0;\r\n for(int i=0; i<7;i++)\r\n for(int j=i+1;j<8;j++){\r\n if( _Data[i]==_Data[j]) _FitVal++;\r\n if(j-i==Math.abs(_Data[i]-_Data[j])) _FitVal++;\r\n }\r\n }", "void calculateFitness() {\n if (reachedGoal) {\n fitness = 1d / 16d + 8192d / (genome.step * genome.step);\n } else {\n double d = position.distance(Game.Setup.goal);\n fitness = 1d / (d * d);\n }\n }", "void ComputeFitness(){\n\t\tint i, pos;\n\t\t// individual t;\n\t\tdouble min, sum = 0, sumSize = 0, tm;\n\t\t// First Compute Raw fitness\n\t\tfor(i = 0; i < poplen; i++)\n\t\t{\n\t\t\tif(oldpop[i].evaluated==FALSE)\n\t\t\t{ tm=ComputeRF(oldpop[i]);\n\t\t\t\toldpop[i].fitness = tm;\n\t\t\t\toldpop[i].oldfitness = tm;\n\t\t\t\toldpop[i].evaluated=TRUE;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\toldpop[i].fitness=oldpop[i].oldfitness;\n\t\t\t}\n\t\t\t\n\t\t\t//oldpop[i].DisplayIndividual();\n\t\t\t//System.out.println(oldpop[i].fitness);\n\t\t}\n\t\t//tim individual co fitness be nhat\n\t\tmin = oldpop[0].fitness;\n\t\tpos = 0;\n\t\tsum = oldpop[0].fitness;\n\t\tsumSize = oldpop[0].size;\n\t\t\n\t\tfor(i = 1; i < poplen; i++) {\n\t\t\tif(oldpop[i].fitness < min) {\n\t\t\t\tmin = oldpop[i].fitness;\n\t\t\t\tpos = i;\n\t\t\t}\n\t\t\tsum += oldpop[i].fitness;\n\t\t\tsumSize += oldpop[i].size;\n//\t\t\tpopSize[gen][i]= oldpop[i].size;\n\t\t}\n\t\t// copy the best and average\n\t\tbestcurrent[gen] = new individual();\n\t\tbestcurrent[gen].CopyIndividual(oldpop[pos], TRUE);\n\t\taverage[gen] = sum /poplen;\n\t\taverageSize[gen] = sumSize /poplen;\n\t\t// Third Compute Adjusted fitness\n\t\tAdjustFitness();\n\t\t// Finally Compute nomarlized fitness\n \t\tNormalizeFitness();\n\t}", "public void resetFeasible() {\r\n \tstillFeasible = true;\r\n }", "private void computeSat(){\n addVertexVisitConstraint();\n //add clause for each vertex must be visited only once/ all vertices must be on path\n addVertexPositionConstraint();\n //add clause for every edge in graph to satisfy constraint of vertices not belonging to edge not part of successive positions\n addVertexNonEdgeConstraint();\n }", "public void calcularFitness() {\n double fit = 0;\r\n for (int x=0; x < this.genotipo.length;x++){\r\n if (x!=this.genotipo.length-1){\r\n fit+=distancias[this.genotipo[x]][this.genotipo[x+1]];\r\n }else{\r\n fit+=distancias[this.genotipo[x]][this.genotipo[0]];\r\n }\r\n }\r\n this.fitness = fit;\r\n }", "private int optimize() {\n\t\t// items: Items sorted by value-to-weight ratio for linear relaxation\n\t\t// t: the decision vector being tested at each node\n\t\t// ws, vs, is, bs: stacks of weight, value, item id, whether bring item\n\t\t// p: stack pointer; i, b, weight, value: loop caches; best: max search\n\t\t// ss: stack size: Always <=2 children on stack for <=n-1 parents\n\t\tItem[] items = new Item[n];\n\t\tint ss = 2 * n;\n\t\tint[] itemsSorted = new int[n], t = new int[n], ws = new int[ss],\n\t\t\tvs = new int[ss], is = new int[ss], bs = new int[ss];\n\t\tint i, b, weight, value, best = 0, p = 0;\n\n\t\tfor (int j = 0; j < n; j++)\n\t\t\titems[j] = new Item(j);\n\t\tArrays.sort(items);\n\t\tfor (int j = 0; j < n; j++)\n\t\t\titemsSorted[j] = items[j].i();\n\t\titems = null; // For garbage collection.\n\n\t\t// Push item 0 onto the stack with and without bringing it.\n\t\tws[p] = 0; vs[p] = 0; is[p] = 0; bs[p] = 1; p++;\n\t\tws[p] = 0; vs[p] = 0; is[p] = 0; bs[p] = 0; p++;\n\n\t\twhile (p > 0) {\n\t\t\tp--; // Pop the latest item off the stack\n\t\t\ti = is[p]; b = bs[p];\n\t\t\tweight = ws[p] + w[i] * b;\n\t\t\tif (weight > k)\n\t\t\t\tcontinue;\n\t\t\tvalue = vs[p] + v[i] * b;\n\t\t\tif (bound(i, weight, value, itemsSorted) < best)\n\t\t\t\tcontinue;\n\t\t\tbest = Math.max(value, best);\n\t\t\tt[i] = b;\n\t\t\tif (i < n - 1) { // Push children onto stack w/ & w/o bringing item\n\t\t\t\tws[p] = weight; vs[p] = value; is[p] = i + 1; bs[p] = 1; p++;\n\t\t\t\tws[p] = weight; vs[p] = value; is[p] = i + 1; bs[p] = 0; p++;\n\t\t\t}\n\t\t\telse if (value >= best)\n\t\t\t\tSystem.arraycopy(t, 0, x, 0, n);\n\t\t}\n\t\treturn best;\n\t}", "public abstract double getConstraintFitness();", "private static void getFitness() {\n\t\tint popSize = population.size();\n\t\tChromosome thisChromo = null;\n\t\tdouble bestScore = 0;\n\t\tdouble worstScore = 0;\n\n\t\t// The worst score would be the one with the highest energy, best would be\n\t\t// lowest.\n\t\tworstScore = population.get(maximum()).conflicts();\n\n\t\t// Convert to a weighted percentage.\n\t\tbestScore = worstScore - population.get(minimum()).conflicts();\n\n\t\tfor (int i = 0; i < popSize; i++) {\n\t\t\tthisChromo = population.get(i);\n\t\t\tthisChromo.fitness((worstScore - thisChromo.conflicts()) * 100.0 / bestScore);\n\t\t}\n\n\t\treturn;\n\t}", "public void modifyFitness(Population population) {\n // prepare the calculation\n double[][] data = new double[population.size()][];\n for (int i = 0; i < data.length; i++) {\n data[i] = ((AbstractEAIndividual)population.get(i)).getFitness();\n }\n double min = Double.POSITIVE_INFINITY, fitnessSharing;\n double[] result = new double[data.length];\n AbstractEAIndividual tmpIndy;\n\n for (int x = 0; x < data[0].length; x++) {\n for (int i = 0; i < data.length; i++) data[i][x] = -data[i][x];\n for (int i = 0; i < data.length; i++) {\n if (data[i][x] < min) min = data[i][x];\n }\n\n for (int i = 0; i < data.length; i++) {\n // This will cause the worst individual to have no chance of being selected\n // also note that if all individual achieve equal fitness the sum will be zero\n result[i] = data[i][x] -min + 0.1;\n }\n\n for (int i = 0; i < population.size(); i++) {\n tmpIndy = (AbstractEAIndividual)population.get(i);\n fitnessSharing = 0;\n for (int j = 0; j < population.size(); j++) {\n if (this.m_SharingDistance < this.m_Metric.distance(tmpIndy, (AbstractEAIndividual)population.get(j))) {\n fitnessSharing += 1 - (this.m_Metric.distance(tmpIndy, (AbstractEAIndividual)population.get(j))/this.m_SharingDistance);\n }\n }\n result[i] = result[i]/fitnessSharing;\n }\n\n for (int i = 0; i < population.size(); i++) {\n ((AbstractEAIndividual)population.get(i)).SetFitness(x, result[i]);\n }\n }\n }", "private boolean checkSolutions() {\n\t\tfor (int i = 0; i < population; ++i) {\n\t\t\tif (populationArray.get(i).getFitness() == 0) {\n\t\t\t\tsolution = populationArray.get(i);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "@Override\r\n\t\t\tpublic void populationUpdate(PopulationData<? extends Solution> data) {\n//\t\t\t\tbuffer.append(data.getPopulationSize());\r\n//\t\t\t\tbuffer.append(\"\\n\");\r\n\t\t\t\t\r\n\t\t\t\tdouble fit = data.getBestCandidateFitness();\r\n//\t\t\t\tSystem.out.println(fit);\r\n\t\t\t\tbuffer.delete(0, buffer.length());\r\n\t\t\t\tbuffer.append(fit);\r\n//\t\t\t\tbuffer.append(\"\\n\");\r\n\t\t\t\t\r\n\t\t\t\tif (Run10FastExternalizer.initialFitness.getDbl() == -1.0) {\r\n\t\t\t\t\tRun10FastExternalizer.initialFitness.setDbl(fit);\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif (fit == 0.0){\r\n\t\t\t\t\tArrayList<Student> studentsCopy = new ArrayList<>();\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor (Student student: students){\r\n\t\t\t\t\t\tstudentsCopy.add(student.clone());\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tStringBuilder sb = new StringBuilder();\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor (Student student: studentsCopy){\r\n\t\t\t\t\t\tstudent.register(data.getBestCandidate().getBlocks());\r\n//\t\t\t\t\t\tSystem.out.println(student.getSchedule());\r\n//\t\t\t\t\t\tbuffer.append(student.getSchedule().toString());\r\n//\t\t\t\t\t\tbuffer.append(\"\\n\");\r\n\t\t\t\t\t\tsb.append(student.getSchedule().toString());\r\n\t\t\t\t\t\tsb.append(\"\\n\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tsuperValue = sb.toString();\r\n\t\t\t\t}\r\n\t\t\t}", "@Override\n\tpublic double valuta_figli() {\n\t\treturn simple_fitness();\n\t}", "void CalculateProbabilities()\n\t{\n\t int i;\n\t double maxfit;\n\t maxfit=fitness[0];\n\t for (i=1;i<FoodNumber;i++)\n\t {\n\t if (fitness[i]>maxfit)\n\t maxfit=fitness[i];\n\t }\n\n\t for (i=0;i<FoodNumber;i++)\n\t {\n\t prob[i]=(0.9*(fitness[i]/maxfit))+0.1;\n\t }\n\n\t}", "private void applyBestRepairPlan(){\n\t\t\n\t\tSet<OWLAxiom> best_repair=null;\n\t\t\t\t\n\t\tdouble min_conf = 10000;\n\t\tdouble conf;\n\t\t\n\t\tmappingVisitor.setDeleteAxiom(false);//used in confidence\n\t\t\n\t\tfor (Set<OWLAxiom> repair : repair_plans){\n\t\t\t\n\t\t\tconf = getConfidence4Plan(repair);\n\t\t\t\n\t\t\tif (min_conf > conf){\n\t\t\t\tmin_conf = conf;\n\t\t\t\tbest_repair = repair;\n\t\t\t}\n\t\t}\n\t\t\n\t\tmappingVisitor.setDeleteAxiom(true);\n\t\t\n\t\tfor (OWLAxiom ax : best_repair){\t\t\t\n\t\t\tax.accept(mappingVisitor);\n\t\t\t//It also deletes axiom from structures\n\t\t\t//TODO add to conflicts\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t}", "public void calculerSatisfaction(AgentState etat) {\n\n int nb = this.getConstraints().size();\n if (GeographicAgentGeneralisation.logger.isDebugEnabled()) {\n GeographicAgentGeneralisation.logger\n .debug(\"calcul de satisfaction de l'agent \" + this\n + \" (nb contraintes=\" + nb + \")\");\n }\n\n // si l'agent n'a pas de contrainte ou qu'il est supprime, il est\n // parfaitement satisfait\n if (nb == 0 || this instanceof GeographicObjectAgent\n && ((GeographicObjectAgentGeneralisation) this).isDeleted()) {\n if (GeographicAgentGeneralisation.logger.isDebugEnabled()) {\n GeographicAgentGeneralisation.logger.debug(\" S=100\");\n }\n\n this.setSatisfaction(100.0);\n etat.setSatisfaction(100);\n\n // stocke les valeurs de satisfaction des contraintes\n for (Constraint cont : this.getConstraints()) {\n etat.getValeursMesures().put(cont.getClass().getSimpleName(),\n new Double(100));\n }\n return;\n }\n\n // calcul de la moyenne des satisfactions des contrainte ponderee par leur\n // importance\n double sommeSatisfactions = 0.0;\n double sommeImportances = 0.0;\n for (Constraint cont : this.getConstraints()) {\n // calcul de satisfaction de la contrainte\n GeographicConstraint cont_ = (GeographicConstraint) cont;\n cont_.computeSatisfaction();\n\n // stocke la valeur de satisfaction\n etat.getValeursMesures().put(cont.getClass().getSimpleName(),\n new Double(cont_.getSatisfaction()));\n\n sommeSatisfactions += cont_.getImportance() * cont_.getSatisfaction();\n sommeImportances += cont_.getImportance();\n\n if (GeographicAgentGeneralisation.logger.isTraceEnabled()) {\n GeographicAgentGeneralisation.logger\n .trace(\" Cont: \" + cont_.getClass().getSimpleName() + \" imp=\"\n + cont_.getImportance() + \" s=\" + cont_.getSatisfaction());\n }\n }\n if (sommeImportances == 0) {\n this.setSatisfaction(100.0);\n } else {\n this.setSatisfaction(sommeSatisfactions / sommeImportances);\n }\n etat.setSatisfaction(this.getSatisfaction());\n if (GeographicAgentGeneralisation.logger.isDebugEnabled()) {\n GeographicAgentGeneralisation.logger\n .debug(\" S=\" + this.getSatisfaction());\n }\n }", "void calcFittest(){\n System.out.println(\"Wall hugs\");\n System.out.println(this.wallHugs);\n\n System.out.println(\"Freedom points\");\n System.out.println(this.freedomPoints);\n\n System.out.println(\"Visited points\");\n System.out.println(this.vistedPoints);\n\n this.fitnessScore = freedomPoints - wallHugs - vistedPoints;\n System.out.println(\"Individual fit score: \" + fitnessScore);\n }", "protected abstract void attemptFeasibleInitialization(Solution solution);", "public abstract double evaluateFitness();", "private static Population getBestPossibleParettoOfAGS(){\n int numberOfRounds = 10;\n Population allFrontsMembers = new Population();\n\n NSGAII nsgaii = new NSGAII();\n SPEA2 spea2 = new SPEA2();\n AEMMT aemmt = new AEMMT();\n AEMMD aemmd = new AEMMD();\n MOEAD moead = new MOEAD();\n\n ProblemKnapsackFromFile problem = new ProblemKnapsackFromFile(macPathGetProblemFrom);\n progressBar = new ProgressBar((double) numberOfRounds);\n\n for (int i = 0; i < numberOfRounds; i++) {\n\n Parameters.NUMBER_OF_GENERATIONS = problem.items.size() < 100? 100 : 200;\n\n System.out.println(\"NSGAII\");\n nsgaii.runAlgorithm(problem);\n allFrontsMembers.population.addAll(nsgaii.paretto.membersAtThisFront);\n\n System.out.println(\"SPEA2\");\n spea2.runAlgorithm(problem);\n allFrontsMembers.population.addAll(spea2.paretto.membersAtThisFront);\n\n //moead.runAlgorithm(problem);\n //allFrontsMembers.population.addAll( moead.pareto.membersAtThisFront);\n\n Parameters.NUMBER_OF_GENERATIONS = 15000;\n System.out.println(\"AEMMT\");\n aemmt.runAlgorithm(problem);\n allFrontsMembers.population.addAll(aemmt.paretto.membersAtThisFront);\n\n System.out.println(\"AEMMD\");\n aemmd.runAlgorithm(problem);\n allFrontsMembers.population.addAll(aemmd.paretto.membersAtThisFront);\n\n progressBar.addJobDone();\n\n allFrontsMembers.fastNonDominatedSort();\n Problem.removeSimilar(allFrontsMembers.fronts.allFronts.get(0),problem);\n allFrontsMembers.population = allFrontsMembers.fronts.allFronts.get(0).membersAtThisFront;\n }\n\n problem.printResolutionMessage();\n //Printer.printBinaryMembers(allFrontsMembers);\n System.out.println(\"ALL FRONTS SIZE: \"+allFrontsMembers.population.size());\n\n return allFrontsMembers;\n }", "public void isSatisfiable() throws SolverException, InterruptedException {\n final BooleanFormulaManager bmgr = context.getFormulaManager().getBooleanFormulaManager();\n if (bmgr.isFalse(formulaUnderTest)) {\n failWithoutActual(\n Fact.fact(\"expected to be\", \"satisfiable\"),\n Fact.fact(\"but was\", \"trivially unsatisfiable\"));\n return;\n }\n\n try (ProverEnvironment prover = context.newProverEnvironment()) {\n prover.push(formulaUnderTest);\n if (!prover.isUnsat()) {\n return; // success\n }\n }\n\n reportUnsatCoreForUnexpectedUnsatisfiableFormula();\n }", "public ArrayDeque<Resource> isFeasible(ElementInstance fe) {\r\n \tif (!stillFeasible)\r\n \t\treturn null;\r\n Iterator<ActivityWorkGroup> iter = workGroupTable.randomIterator();\r\n while (iter.hasNext()) {\r\n \tActivityWorkGroup wg = iter.next();\r\n \tfinal ArrayDeque<Resource> solution = new ArrayDeque<Resource>(); \r\n if (engine.checkWorkGroup(solution, wg, fe)) {\r\n fe.setExecutionWG(wg);\r\n \t\tfe.getElement().debug(\"Can carry out \\t\" + this + \"\\t\" + wg);\r\n return solution;\r\n } \r\n }\r\n // No valid WG was found\r\n stillFeasible = false;\r\n return null;\r\n\t}", "void ComputeFitnessBefore(){\n\t\t\t\tint i, pos;\n\t\t\t\t// individual t;\n\t\t\t\tdouble min, sum = 0, tm;\n\t\t\t\t// First Compute Raw fitness\n\t\t\t\tfor(i = 0; i < poplen; i++)\n\t\t\t\t{\n\t\t\t\t\tif(oldpop[i].evaluated==FALSE)\n\t\t\t\t\t{ tm=ComputeRF(oldpop[i]);\n\t\t\t\t\t\toldpop[i].fitness = tm;\n\t\t\t\t\t\toldpop[i].oldfitness = tm;\n\t\t\t\t\t\toldpop[i].evaluated=TRUE;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\toldpop[i].fitness=oldpop[i].oldfitness;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t//oldpop[i].DisplayIndividual();\n\t\t\t\t\t//System.out.println(oldpop[i].fitness);\n\t\t\t\t}\n\t\t\t\t//tim individual co fitness be nhat\n\t\t\t\tmin = oldpop[0].fitness;\t\t\t\n\t\t\t\tsum = oldpop[0].fitness;\t\t\t\n\t\t\t\t\n\t\t\t\tfor(i = 1; i < poplen; i++) {\n\t\t\t\t\tif(oldpop[i].fitness < min) {\n\t\t\t\t\t\tmin = oldpop[i].fitness;\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\tsum += oldpop[i].fitness;\t\t\t\t\n\t\t\t\t}\n\t\t\t\t// copy the best and average\n//\t\t\t\tbestBeforeFitness[gen]=min;\n//\t\t\t\tavgBeforeFitness[gen]=sum/poplen;\n//\t\t\t\tbestcurrent[gen] = new individual();\n//\t\t\t\tbestcurrent[gen].CopyIndividual(oldpop[pos], TRUE);\n//\t\t\t\taverage[gen] = sum /poplen;\t\t\t\n\t\t\t\t\n\t\t\t}", "double CalculateFitness(double fun) \n\t {\n\t\t double result=0;\n\t\t if(fun>=0)\n\t\t {\n\t\t\t result=1/(fun+1);\n\t\t }\n\t\t else\n\t\t {\n\t\t\t \n\t\t\t result=0;\n\t\t }\n\t\t return result;\n\t }", "@Override\r\n public void computeDensityEstimator() {\r\n // Compute scalarization values\r\n this.scalWrapper.execute(solutions());\r\n scaleToPositive();\r\n\r\n // Distance matrix\r\n double[][] distanceMatrix;\r\n if (normalizeObjectives) {\r\n FrontNormalizer normalizer = new FrontNormalizer(solutions());\r\n distanceMatrix = SolutionListUtils.distanceMatrix(normalizer.normalize(solutions()));\r\n } else\r\n distanceMatrix = SolutionListUtils.distanceMatrix(solutions());\r\n\r\n // Set fitness based on replacement strategy\r\n double[] energyVector = energyVector(distanceMatrix);\r\n double[] replacementVector = replacementVector(distanceMatrix);\r\n // Flag for memorizing whether solution can improve archive\r\n boolean eligible = false;\r\n for (int i = 0; i < replacementVector.length; i++) {\r\n // New solution is better than incumbent\r\n if (replacementVector[i] < energyVector[i]) {\r\n eligible = true;\r\n switch (replacementStrategy) {\r\n case BEST_FEASIBLE_POSITION:\r\n // Energy decrease is maximal if replacement energy is\r\n // minimized. This is why the the negated entry in\r\n // replacementVector is the corresponding fitness.\r\n fitness.setAttribute(archive.get(i), -replacementVector[i]);\r\n break;\r\n case LARGEST_DIFFERENCE:\r\n fitness.setAttribute(archive.get(i), energyVector[i]);\r\n break;\r\n case WORST_IN_ARCHIVE:\r\n fitness.setAttribute(archive.get(i), energyVector[i] - replacementVector[i]);\r\n break;\r\n }\r\n } else {\r\n // If archive member is not eligible for replacement, make sure\r\n // it is retained in any case.\r\n archive.get(i).attributes().put(fitness.getAttributeIdentifier(), -Double.MAX_VALUE);\r\n }\r\n if (eligible) {\r\n // New solution is always retained\r\n fitness.setAttribute(archive.get(maxSize), -Double.MAX_VALUE);\r\n } else {\r\n // New solution is rejected in any case\r\n fitness.setAttribute(archive.get(maxSize), Double.MAX_VALUE);\r\n }\r\n }\r\n }", "public void solution() {\n\t\t\n\t}", "public void testF() {\n\t\tfor (int k = 0; k < usedSS; k++) {\n\t\t\tList<Integer> subStr = vals.subList(k*compSize, (k+1)*compSize);\n\t\t\tint sum = (int) subStr.stream().filter(i -> i != BipartiteMatching.FREE).count();\n\t\t\tfData.add(sum);\t\t\t\n\t\t}\n\t}", "public void fitnessFunction()\n\t{\n\t\t\n\t}", "public boolean adjust_satisfy(int satisfy) {\n boolean flag = false;\n switch (satisfy) {\n case 0: {//none satisfied\n this.relax_cpu += 0.1;\n this.relax_memory += 0.1;\n this.relax_qpi += 0.1;\n this.relax_cores += 1;\n break;\n }\n case 1: {//only CPU satisfied\n this.relax_memory += 0.1;\n this.relax_qpi += 0.1;\n this.relax_cores += 1;\n break;\n }\n case 2: {//only memory satisfied\n this.relax_cpu += 0.1;\n this.relax_qpi += 0.1;\n this.relax_cores += 1;\n break;\n }\n case 4: {//only qpi satisfied\n this.relax_memory += 0.1;\n this.relax_cpu += 0.1;\n this.relax_cores += 1;\n break;\n }\n case 8: {//only cores satisfied\n this.relax_cpu += 0.1;\n this.relax_memory += 0.1;\n this.relax_qpi += 0.1;\n }\n case 3: {//cpu and memory satisfied\n this.relax_qpi += 0.1;\n this.relax_cores += 1;\n break;\n }\n case 5: {//cpu and qpi satisfied\n this.relax_memory += 0.1;\n this.relax_cores += 1;\n break;\n }\n case 6: {//memory and qpi satisfied\n this.relax_cpu += 0.1;\n this.relax_cores += 1;\n break;\n }\n case 7: {//all except cores\n this.relax_cores += 1;\n break;\n }\n case 9: {//cpu and cores satisfied\n this.relax_qpi += 0.1;\n this.relax_memory += 0.1;\n break;\n }\n case 10: {//memory and cores satisfied\n this.relax_cpu += 0.1;\n this.relax_qpi += 0.1;\n break;\n }\n case 11: {//all except qpi\n this.relax_qpi += 0.1;\n break;\n }\n case 12: {//qpi and cores satisfied\n this.relax_cpu += 0.1;\n this.relax_memory += 0.1;\n break;\n }\n case 13: {//all except memory\n this.relax_memory += 0.1;\n break;\n }\n case 14: {//all except cpu\n this.relax_cpu += 0.1;\n break;\n }\n }\n\n// if (this.relax_cpu > 1 || this.relax_memory > 1.5 || this.relax_qpi > 1.5) {\n// SOURCE_RATE = SOURCE_RATE * 0.9;\n// flag = true;\n// }\n\n// if (this.relax_cpu > 2) {\n// this.relax_cpu = 2;\n// }\n// if (this.relax_memory > 2) {\n// this.relax_memory = 2;\n// }\n// if (this.relax_qpi > 2) {\n// this.relax_qpi = 2;\n// }\n\n setRelax_cpu(this.relax_cpu);\n setRelax_memory(this.relax_memory);\n setRelax_qpi(this.relax_qpi);\n setRelax_cores(this.relax_cores);\n return flag;\n }", "@Override\r\n\tpublic void satisfy() {\n\t\t\r\n\t}", "public abstract OptimisationSolution getBestSolution();", "private void checkIsBetterSolution() {\n if (solution == null) {\n solution = generateSolution();\n //Si la solucion que propone esta iteracion es mejor que las anteriores la guardamos como mejor solucion\n } else if (getHealthFromAvailableWorkers(availableWorkersHours, errorPoints.size()) < solution.getHealth()) {\n solution = generateSolution();\n }\n }", "public double ComputeSatisfaction (LinkedList<Inhabitant> population) {\n\t\tint s = 0;\n\t\tfor(int i =0; i < population.size(); i++) {\n\t\t\ts = s + population.get(i).getSatisfaction();\n\t\t}\n\t\treturn s/(population.size());\n\t}", "public abstract void calculateSufficientStatistics();", "protected void setFitness(float fit)\t{\tfitness = fit;\t\t}", "double getSolutionCost();", "public int getFitnessValue(int[] solution) {\n\n int fitness = 0;\n \n\n for (int i = 0; i < MATRIX_TAM; i++) {\n for (int j = i ; j < MATRIX_TAM; j++) {\n fitness += loc[i][j] * flow[solution[i]][solution[j]];\n \n }\n }\n\n return fitness;\n }", "protected abstract void solve(Items items,Knapsack knapsack);", "static boolean promising(int problem, int weight, int profit, int i) {\r\n\t\tif(weight >= capacities.get(problem)) return false;\r\n\t\tdouble bound = KWF2(problem, i+1, weight, profit);\r\n\t\treturn (bound > maxProfit);\r\n\t}", "public Object eval(Individual ind)\r\n {\r\n BinaryIndividual bi = (BinaryIndividual)ind;\r\n int partialFitness = 0;\r\n int distance = 0;\r\n double fitness = 0.0;\r\n\r\n\t for (int i=0; i<100; i++){\r\n\r\n\t distance = 0;\r\n\r\n\t for (int j=0; j<100; j++){\r\n\t if (!((BinaryIndividual)target[i]).getBooleanAllele(j)^bi.getBooleanAllele(j)) { \r\n\t\t distance++;\r\n\t }\r\n \r\n\t if (distance > partialFitness) {\r\n\t partialFitness = distance;\r\n\t }\r\n\t }\r\n }\r\n\r\n fitness = (double)partialFitness/100.0;\r\n return new Double(fitness);\r\n \r\n\r\n }", "private void runAlgorithm(){\n fitness = new ArrayList<Double>(); \n \n int iter = 0;\n \n // While temperature higher than absolute temperature\n this.temperature = getCurrentTemperature(0);\n while(this.temperature > this.p_absoluteTemperature && iter < 100000){\n //while(!stopCriterionMet()){\n // Select next state\n //for(int i=0;i<20;i++){\n int count = 0;\n boolean selected = false;\n while(!selected){\n Problem.ProblemState next = nextState();\n if(isStateSelected(next)){\n selected = true;\n this.state = next;\n }\n \n count++;\n if(count == 10) break;\n }\n //}\n \n // Sample data\n double fvalue = this.state.getFitnessValue();\n this.fitness.add(new Double(fvalue));\n \n iter = iter + 1;\n \n // Lower temperature\n this.temperature = getCurrentTemperature(iter);\n }\n \n this.n_iter = iter;\n return;\n }", "private static void evaluateSingle(BitVectorSolution sol) {\r\n\t\tsol.fitness = function.valueAt(sol);\r\n\t}", "public void updateFitness() {\n Particle p;\n for (int i = 0; i < SWARM_SIZE; i++) {\n p = swarm.get(i);\n p.setFitnessValue(getFitnessValue(p.getVector().getPos()));\n p.setpBestFitness(getFitnessValue(p.getpBest().getPos()));\n }\n }", "public void setFitness(int f){\n this.fitness = f;\n }", "public void updateFeasiblePOIs() {\n PlaceOfInterest currPOI = tour.getCurrentVisit().getPlaceOfInterest();\n double currTime = tour.getCurrentVisit().getDepartTime();\n\n for (int i = feasiblePOIs.size()-1; i >= 0; i--) {\n PlaceOfInterest poi = feasiblePOIs.get(i);\n\n double timeToArrive = instance.travelTimeDepartAt(currPOI, poi, currTime);\n poi.setTimeToArrive(timeToArrive);\n\n double visitStartTime = currTime + timeToArrive;\n\n if (visitStartTime > poi.getCloseTime()) {\n feasiblePOIs.remove(i); // cannot meet the time window, infeasible\n continue;\n }\n\n if (visitStartTime < poi.getOpenTime())\n visitStartTime = poi.getOpenTime();\n\n poi.setTimeToStartVisit(visitStartTime - currTime);\n\n double visitFinishTime = visitStartTime + poi.getDuration();\n poi.setTimeToFinishVisit(visitFinishTime - currTime);\n\n double timeToReturn = instance.travelTimeDepartAt(poi, instance.getEndPOI(), visitFinishTime);\n poi.setTimeToReturn(timeToReturn);\n\n if (visitFinishTime + timeToReturn > instance.getEndTime()) {\n feasiblePOIs.remove(i); // cannot return in time, infeasible\n continue;\n }\n }\n }", "max_values OptimizeCargo(ArrayList<ore_excavation> oe, double wt,\n int index) {\n int i;\n double weight = 0.0;\n max_values mv;\n max_values new_mv = new max_values();\n /*\n \t\t * I am making a subset of the original vector because I\n \t\t * will be taking mined minerals out to test if adding\n \t\t * it to the cargo will maximize my value. I may need to\n \t\t * remove this mineral from the cargo and use another.\n \t\t *\n \t\t * But the beauty of recursion is that if the mineral does\n \t\t * not fit, unwinding the stack frames returns the\n \t\t * algorithm to a previous state to try other combinations of\n \t\t * minerals.\n \t\t *\n \t\t * Making a copy of the input vector allows this to happen.\n */\n ArrayList<ore_excavation> ro = new ArrayList<ore_excavation>(oe);\n\n /* Loop over all remaining minerals in subset */\n for (i = index; i < ro.size(); i++) {\n\n ore_excavation o = ro.get(i);\n\n weight = wt - o.ore_mass;\n\n if (weight >= 0.0) {\n /*\n \t\t\t\t * Weight will work. Now make the working\n \t\t\t\t * set smaller and try more minerals.\n \t\t\t\t * Pass the smaller set of remaining minerals\n \t\t\t\t * to try to add them to the cargo.\n */\n ro.remove(i); // Make set smaller.\n mv = OptimizeCargo(ro, weight, 0);\n mv.value += o.ore_value;\n\n if (mv.value > new_mv.value) {\n new_mv.value = mv.value;\n new_mv.weight = mv.weight + o.ore_mass;\n }\n continue;\n }\n }\n return new_mv;\n }", "public HardSoftScore calculateScore(MPSReadinessCheckSolution solution) {\n\t\tint hardScore = 0, softScore = 0;\n\t\tMap<ProductionPlant, Map<Date, List<FixedPlanEntry>>> fulfilled = solution.getFulfilledMPS();\n\t\tMap<PlanEntryIndex, MRPEntry> mrp = solution.getAccumulatedMRP();\n\t\tMap<ProductionPlant, Map<Date, Map<UUID, Integer>>> aggregatecDemands = aggregateDemands(fulfilled);\n\t\tfor (Map.Entry<ProductionPlant, Map<Date, Map<UUID, Integer>>> fulfilledByLocEntry: aggregatecDemands.entrySet()) {\n\t\t\tProductionPlant fulfilledLoc = fulfilledByLocEntry.getKey();\n\t\t\tMap<Date, Map<UUID, Integer>> fulfilledByLoc = fulfilledByLocEntry.getValue();\n\t\t\tfor (Map.Entry<Date, Map<UUID, Integer>> fulfilledByDateEntry: fulfilledByLoc.entrySet()) {\n\t\t\t\tDate fulfilledDate = fulfilledByDateEntry.getKey();\n\t\t\t\tMap<UUID, MRPEntry> mrpPlan = findMRPSupportByFulfilledDate(mrp, fulfilledLoc, fulfilledDate);\n\t\t\t\tif (mrpPlan == null) {\n\t\t\t\t\thardScore = -10;\n\t\t\t\t\t//System.out.println(\"no mrp plan, date=\" + fulfilledDate);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tMap<UUID, Integer> skuDemands = fulfilledByDateEntry.getValue();\n\t\t\t\tfor (Map.Entry<UUID, Integer> skuDemand: skuDemands.entrySet()) {\n\t\t\t\t\tSystem.out.println(\"skuDemand:\" + skuDemand);\n\t\t\t\t\tUUID skuNo = skuDemand.getKey();\n\t\t\t\t\tint mpsQty = skuDemand.getValue();\n\t\t\t\t\t//System.out.println(\"calculateScore Called, skuNo=\" + skuNo + \",mpsQty =\" + mpsQty);\n\t\t\t\t\tif (mpsQty == 0) {\n\t\t\t\t\t\thardScore++;\n\t\t\t\t\t\t//System.out.println(\"calculateScore no demand, hardscore:\" + hardScore);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tMRPEntry mrpEntry = mrpPlan.get(skuNo);\n\t\t\t\t\tif (mrpEntry == null) {\n\t\t\t\t\t\thardScore=-10;\n\t\t\t\t\t\t//System.out.println(\"calculateScore no mrp, hardscore:\" + hardScore + \",sku=\" + skuDemand.getKey());\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (mrpEntry.getPlanQty() >= mpsQty) {\n\t\t\t\t\t\thardScore++;\n\t\t\t\t\t\t//System.out.println(\"calculateScore mrp meet demand, hardscore:\" + hardScore + \",mrpEntry=\" + mrpEntry);\n\t\t\t\t\t} else { \n\t\t\t\t\t\thardScore = -1;\n\t\t\t\t\t\t//System.out.println(\"calculateScore mrp less than demand, hardscore:\" + hardScore + \",mrpEntry=\" + mrpEntry);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (hardScore < 0) break;\n\t\t\t}\n\t\t}\n\t\t//System.out.println(\"end calculateScore Called, hardScore=\" + hardScore + \",solution=\" + solution);\n\t\t//System.out.println(\"\");\n\t\treturn HardSoftScore.valueOf(hardScore, softScore);\n\t}", "public void solve() {\n// BruteForceSolver bfs = new BruteForceSolver(pointList);\n// bfs.solve(); // prints the best polygon, its area, and time needed\n// System.out.println(\"-------------\");\n\n// StarshapedSolver ss = new StarshapedSolver(pointList);\n// foundPolygons = ss.solve();\n// System.out.println(\"-------------\");\n\n// RandomAddPointHeuristic ra = new RandomAddPointHeuristic(pointList);\n// foundPolygons = ra.solve(750);\n// System.out.println(\"-------------\");\n\n// GreedyAddPointHeuristic ga = new GreedyAddPointHeuristic(pointList,false);\n// foundPolygons = ga.solve(750);\n// System.out.println(\"-------------\");\n\n// long time = 4000;\n// GreedyAddPointHeuristic gaInit = new GreedyAddPointHeuristic(pointList,false);\n// Polygon2D initSolution = gaInit.solve(time*1/4).get(0);\n// System.out.println(initSolution.area);\n// System.out.println(initSolution);\n//\n// SimulatedAnnealing sa = new SimulatedAnnealing(pointList,initSolution,3);\n// foundPolygons.addAll(sa.solve(time-gaInit.timeInit,2,0.005,0.95));\n// System.out.println(sa.maxPolygon);\n// System.out.println(\"-------------\");\n\n// foundPolygons.addAll(findMultiplePolygonsStarshaped(8,0.6));\n\n }", "public void updateFitness ( ) {\n\n KozaFitness f = ((KozaFitness)program.fitness);\n\n f.setStandardizedFitness(param.Parameters.STATE, this.fit);\n\n }", "public double getBestSolutionEvaluation();", "private boolean isFeasibleState(int[] state){\n if((state[0] <= totalMissionaries && state[0] >= 0)&&(state[1] <= totalCannibals && state[1] >= 0)) {\n return true;\n }\n return false;\n }", "public float AssignFitness() {\n\t\t\n\t\tfitness = 0;\n\t\tif(sample_map.size() == 0) {\n\t\t\treturn fitness;\n\t\t}\n\t\t\n\t\tLinkSample ptr = k_closest;\n\t\twhile(ptr != null) {\n\t\t\tfitness += ptr.s.weight;\n\t\t\tptr = ptr.next_ptr;\n\t\t}\n\t\t\n\t\tfitness /= sample_map.size();\n\t\treturn fitness;\n\t}", "public Solution solve(KnapsackData data);", "public double calculateFitness(DNA dna);", "public void setFitness(int fit)\n {\n this.fitness=fit;\n }", "public static void calculateFitness(Individual individual) {\n individual.fitness = 0;\n for (int i = 0; i < dataSet.size(); i++) {\n\n for (Rule rule : individual.rulebase) {\n boolean match = true;\n int[] data = dataSet.get(i).getVariables();\n\n for (int j = 0; j < data.length; j++) {\n\n String variable = String.valueOf(data[j]);\n //String variable = \"\" + data[j];\n String[] rulebase = rule.cond;\n\n if ((rulebase[j].equals(variable) != true) && (rulebase[j].equals(\"#\") != true)) {\n match = false;\n }\n }\n\n if (match) {\n String output = String.valueOf(dataSet.get(i).getOutput());\n if (rule.output.equals(output)) {\n individual.fitness++;\n }\n break;\n }\n }\n }\n }", "@Test\n public void testSubsequentRunsWithUnsatisfiablePenalizingConstraint() {\n System.out.println(\" - test subsequent runs with unsatisfiable penalizing constraint\");\n // set constraint\n final double penalty = 7.8;\n problem.addPenalizingConstraint(new NeverSatisfiedPenalizingConstraintStub(penalty));\n // perform multiple runs (maximizing objective)\n // perform multiple runs (maximizing objective)\n System.out.format(\" - low temperature (T = %.7f)\\n\", LOW_TEMP);\n multiRunWithMaximumRuntime(searchLowTemp, MULTI_RUN_RUNTIME, MAX_RUNTIME_TIME_UNIT, NUM_RUNS, true, true);\n System.out.format(\" - medium temperature (T = %.7f)\\n\", MED_TEMP);\n multiRunWithMaximumRuntime(searchMedTemp, MULTI_RUN_RUNTIME, MAX_RUNTIME_TIME_UNIT, NUM_RUNS, true, true);\n System.out.format(\" - high temperature (T = %.7f)\\n\", HIGH_TEMP);\n multiRunWithMaximumRuntime(searchHighTemp, MULTI_RUN_RUNTIME, MAX_RUNTIME_TIME_UNIT, NUM_RUNS, true, true);\n // verify\n PenalizedEvaluation penEval;\n penEval = (PenalizedEvaluation) searchLowTemp.getBestSolutionEvaluation();\n assertEquals(penalty, penEval.getEvaluation().getValue() - penEval.getValue(), TestConstants.DOUBLE_COMPARISON_PRECISION);\n penEval = (PenalizedEvaluation) searchMedTemp.getBestSolutionEvaluation();\n assertEquals(penalty, penEval.getEvaluation().getValue() - penEval.getValue(), TestConstants.DOUBLE_COMPARISON_PRECISION);\n penEval = (PenalizedEvaluation) searchHighTemp.getBestSolutionEvaluation();\n assertEquals(penalty, penEval.getEvaluation().getValue() - penEval.getValue(), TestConstants.DOUBLE_COMPARISON_PRECISION);\n }", "public static int dynamic_p(int objects,int capacity){\r\n // Array to accommodate dynamic programming solutions\r\n int dp_array[][] = new int[objects+1][capacity+1];\r\n // filling the 2D array\r\n for(int i=0; i<= objects;i++){\r\n for(int j=0; j<= capacity;j++){\r\n if(i == 0)\r\n dp_array[i][j]=0; // base case(number of objects are zero)\r\n else if(j == 0)\r\n dp_array[i][j]=0; // base case(capacity is zero)\r\n else if(randvariables[i-1] <= j){ // checking if the wight of object is less than the current knapsack capacity\r\n int included = randvalues[i-1]+dp_array[i-1][j-randvariables[i-1]]; // object is included\r\n int not_included = dp_array[i-1][j]; // object is not included\r\n\r\n //taking the max of these two\r\n if(included > not_included)\r\n dp_array[i][j] = included;\r\n else\r\n dp_array[i][j]= not_included;\r\n }\r\n else // weight is more than capacity .. not including the object\r\n dp_array[i][j] = dp_array[i-1][j];\r\n }\r\n }\r\n\r\n //System.out.println(Arrays.deepToString(dp_array));\r\n int solution = dp_array[objects][capacity];\r\n boolean[] optimalset = solution_used(dp_array,objects,capacity);\r\n System.out.println(Arrays.toString(optimalset));\r\n dp_array = null;\r\n return solution; // return the final solution\r\n\r\n }", "public static TempResult max(int allowedWeight, Set<Item> items) {\n\t\tint[] values=new int[items.size()];\n\t\tint[] weights=new int[items.size()];\n\t\t\n\n\t\tArrayList<Item> items2=new ArrayList<Item>(items);\n\t\tfor (int i=0; i<items2.size(); i++) {\n\t\t\tvalues[i]=items2.get(i).value;\n\t\t\tweights[i]=items2.get(i).weight;\n\t\t}\n\t\t\n int[][] totalValue = new int[values.length+1][allowedWeight+1];\n boolean[][] includedorNot = new boolean[values.length+1][allowedWeight+1];\n \n //We introduce item one by one to the system.\n //For each introduced item, we consider the maximal profit\n //for weight=[0:allowedWeight]\n for (int i=0; i<values.length; i++) {\n \t//introduce item i into the system.\n \tint val=values[i];\n \tint weight=weights[i];\n \t\n \tint itemIndex=i+1;\n \t\n \tfor (int w=1; w<=allowedWeight; w++) {\n \t\t\n \t\t//Zero copy of ith item; i-1 is calculated already\n \t\tint profit1=totalValue[itemIndex-1][w];\n \t\t\n \t\t//one copy of ith item.\n \t\tint profit2=Integer.MIN_VALUE;\n \t\tif (w-weight>=0) {\n \t\t\t//for a particular targeted weight, add item i does not overflow the targeted weight.\n \t\t\tprofit2=totalValue[itemIndex-1][w-weight]+val;\n \t\t}\n \t\t\n \t\tif (profit1>profit2) {\n \t\t\tincludedorNot[itemIndex][w]=false;\n \t\t\ttotalValue[itemIndex][w]=profit1;\n \t\t} else {\n \t\t\tincludedorNot[itemIndex][w]=true;\n \t\t\ttotalValue[itemIndex][w]=profit2;\n \t\t}\n \t}\n }\n\t\t\n \n TempResult result=new TempResult(0, 0);\n result.value=totalValue[values.length][allowedWeight];\n result.items=new LinkedList<>();\n int w=allowedWeight;\n for (int itemIndex=values.length; itemIndex>0; itemIndex--) {\n \tif (includedorNot[itemIndex][w]) {\n \t\tresult.items.add(items2.get(itemIndex-1));\n \t\tw=w-weights[itemIndex-1];\n \t} \n }\n \n return result;\n \n\t}", "public double calcFitness(int[] genes) {\n\t\treturn 0;\n\t}", "private static void calculateFitnessOfPopulation(ArrayList<Chromosome> population) {\n for (Chromosome chromosome : population) {\n // if the fitness of the chromosome has not yet been calculated (i.e. is still -1)\n fitnessFunction(chromosome);\n }\n }", "static double addHeuristic1(GameState c, boolean isMaxNode) {\n\t\t// Value returned will be absolute. If its max node, this config is good\n\t\t// then value will be positive. If its min node,\n\t\t// and this config is good for min, then value will be negative\n\n\t\tint i, j, vacant_spaces;\n\t\t// Compute : Feasible Moves for self\n\t\tint self_feasible_moves = 0;\n\t\tint self_remaining_moves = 0;\n\t\tint opponent_feasible_moves = 0;\n\t\tint opponent_remaining_moves = 0;\n\n\t\t// Go through the board and figure out vacant spots\n\t\tvacant_spaces = 0;\n\t\tfor (i = -GameState.HALF_BOARD; i <= GameState.HALF_BOARD; i = i + 1) {\n\t\t\tif (c.getWeight(i) == 0) {\n\t\t\t\tvacant_spaces++;\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 1; i <= GameState.MAX_WEIGHT; i = i + 1) {\n\t\t\t// Check if self have the weight\n\t\t\tif (c.IHaveWeight(i)) {\n\t\t\t\tself_remaining_moves++;\n\t\t\t\t// Go through all the possible positions\n\t\t\t\tfor (j = -GameState.HALF_BOARD; j < GameState.HALF_BOARD; j++) {\n\t\t\t\t\tif (c.getWeight(j) == 0) {\n\t\t\t\t\t\t// Place it and see if you tip\n\t\t\t\t\t\tc.makeMove(i, j, PlayerName.none);\n\t\t\t\t\t\tif (!c.isTipping_old()) {\n\t\t\t\t\t\t\tself_feasible_moves++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Now remove the weight\n\t\t\t\t\t\tc.removeMove(j);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Check if opponent has this weight\n\t\t\tif (c.opponentHasWeight(i)) {\n\t\t\t\topponent_remaining_moves++;\n\t\t\t\t// Go through all the possible positions\n\t\t\t\tfor (j = -GameState.HALF_BOARD; j < GameState.HALF_BOARD; j++) {\n\t\t\t\t\t// Place the weight and see if you tip\n\t\t\t\t\tif (c.getWeight(j) == 0) {\n\t\t\t\t\t\tc.makeMove(i, j, PlayerName.none);\n\t\t\t\t\t\tif (!c.isTipping_old()) {\n\t\t\t\t\t\t\topponent_feasible_moves++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Now remove the weight\n\t\t\t\t\t\tc.removeMove(j);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Need to take the max because one of the players may have played one\n\t\t// chance less\n\t\tif (self_remaining_moves == 0 && opponent_remaining_moves == 0) {\n\t\t\treturn 0.0;\n\t\t} else if (self_remaining_moves > opponent_remaining_moves)\n\t\t\treturn (double) (self_feasible_moves - opponent_feasible_moves)\n\t\t\t\t\t/ (double) (self_remaining_moves * vacant_spaces);\n\t\telse\n\t\t\treturn (double) (self_feasible_moves - opponent_feasible_moves)\n\t\t\t\t\t/ (double) (opponent_remaining_moves * vacant_spaces);\n\t}", "@Test\n public void test_witness_basic() {\n CHPreparationGraph graph = CHPreparationGraph.edgeBased(6, 6, (in, via, out) -> in == out ? 10 : 0);\n int edge = 0;\n graph.addEdge(0, 1, edge++, 10, Double.POSITIVE_INFINITY);\n graph.addEdge(1, 2, edge++, 10, Double.POSITIVE_INFINITY);\n graph.addEdge(2, 3, edge++, 20, Double.POSITIVE_INFINITY);\n graph.addEdge(3, 4, edge++, 10, Double.POSITIVE_INFINITY);\n graph.addEdge(1, 5, edge++, 10, Double.POSITIVE_INFINITY);\n graph.addEdge(5, 3, edge++, 10, Double.POSITIVE_INFINITY);\n graph.prepareForContraction();\n EdgeBasedWitnessPathSearcher searcher = new EdgeBasedWitnessPathSearcher(graph);\n searcher.initSearch(0, 1, 2, new EdgeBasedWitnessPathSearcher.Stats());\n double weight = searcher.runSearch(3, 6, 30.0, 100);\n assertEquals(20, weight, 1.e-6);\n }", "protected float getFitness()\t\t\t{\treturn fitness;\t\t}", "public static void evaluateFitnesses() {\n for (Polynomial p : Population) {\n p.setRawFitness(getRawFitness(p, data));\n if (debug) {\n printPopulation(true);\n }\n }\n }", "@Override\n public void evaluate(Solution solution) throws JMException {\n\n int[] tour = new int[numberOfNodes + 1];\n int firstCity = ((Permutation) solution.getDecisionVariables()[0]).vector_[0];\n int lastCity = ((Permutation) solution.getDecisionVariables()[0]).vector_[numberOfNodes - 1];\n\n double fitness1_td = 0.0;\n\n // Calculate fitness 1 - total distance\n for (int i = 0; i < numberOfNodes - 1; i++) {\n int x = ((Permutation) solution.getDecisionVariables()[0]).vector_[i];\n int y = ((Permutation) solution.getDecisionVariables()[0]).vector_[i+1];\n\n tour[i] = x;\n tour[i+1] = y;\n\n fitness1_td += calDistances(x, y);\n }\n // generate tour with same start city and end city\n tour[numberOfNodes] = tour[0];\n\n fitness1_td += calDistances(firstCity, lastCity);\n\n\n // Correctness check: does the tour start and end in the same city\n if(tour[0] != tour[tour.length - 1]) {\n System.err.println(\"ERROR: The last city must be the same as the first city\");\n System.exit(1);\n }\n\n /*for (int i = 0; i < tour.length; i++) {\n System.out.print(tour[i] + \" \");\n }*/\n //System.out.println(\"\\n\" + tour.length);\n\n // Calculate fitness 2 - objective value of a given tour\n ArrayInt z = (ArrayInt) solution.getDecisionVariables()[1];\n //System.out.println(z.getLength());\n\n double fitness2_ob;\n double wc = 0.0;\n double ft = 0.0;\n double fp = 0.0;\n\n //the following is used for a different interpretation of \"packingPlan\"\n int itemsPerCity = z.getLength() / (tour.length - 2);\n //System.out.println(itemsPerCity);\n\n for (int i = 0; i < tour.length - 1; i++) {\n\n int currentCityTEMP = tour[i];\n // what's the current city? --> but the items start at city 2 in the TTP file, so I have to take another 1 off!\n int currentCity = currentCityTEMP - 1;\n\n if (i > 0) {\n\n if (currentCity == -1) {\n // No items in city 1\n wc += 0.0;\n fp += 0.0;\n\n } else {\n\n for (int itemNumber = 0; itemNumber < itemsPerCity; itemNumber++) {\n\n int indexOfPackingPlan = (i-1) * itemsPerCity + itemNumber;\n // what is the next item's index in items-array?\n int itemIndex = currentCity + itemNumber * (numberOfNodes - 1);\n //System.out.println(\"i: \" + i);\n\n if (z.getValue(indexOfPackingPlan) == 1) {\n // pack item\n //System.out.println(itemIndex);\n int currentWC = items[itemIndex][2];\n wc += currentWC;\n\n int currentFP = items[itemIndex][1];\n fp += currentFP;\n }\n }\n\n }\n\n int h = (i+1) % (tour.length-1); //h: next tour city index\n //System.out.println(\"h: \" + h);\n long distance = calDistances(i, h);\n // compute the adjusted (effective) distance\n ft += (distance / (1 - wc * (maxSpeed - minSpeed) / capacityOfKnapsack));\n }\n }\n\n wendUsed = wc;\n wend = capacityOfKnapsack - wc;\n fitness2_ob = fp - ft * rentingRatio;\n\n solution.setObjective(0, fitness1_td);\n solution.setObjective(1, -fitness2_ob); // Convert from maximum objective value to minimum objective value\n }", "@Override\n\tprotected double[] calculateNeighbourhoodBest(int i) {\n\t\t\t//System.out.println(\"Gbest particle from local typology!\");\n\t\t\tint indexBestParticle = i;\n\t\t\tint indexLeftNeighbour = (i > 0) ? i - 1 : swarmSize - 1;\n\t\t\tint indexRightNeighbour = (i < swarmSize - 1) ? i + 1 : 0;\t\t\n\t\t\t\t\t\n\t\t\tdouble nBestFitness = swarm.get(i).getPBestFitness();\n\t\t\tdouble leftNeighborParticlePBestFitness = swarm.get(indexLeftNeighbour).getPBestFitness();\n\t\t\tdouble rightNeighborParticlePBestFitness = swarm.get(indexRightNeighbour).getPBestFitness();\n\t\t\t\t\t\n\t\t\tif (leftNeighborParticlePBestFitness < nBestFitness) {\n\t\t\t\tindexBestParticle = indexLeftNeighbour;\n\t\t\t\tnBestFitness = leftNeighborParticlePBestFitness;\n\t\t\t}\n\t\t\tif (rightNeighborParticlePBestFitness < nBestFitness) {\n\t\t\t\tindexBestParticle = indexRightNeighbour;\n\t\t\t\tnBestFitness = rightNeighborParticlePBestFitness;\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\treturn swarm.get(indexBestParticle).getPBest();\n\t\t\t//return swarm.get(indexBestParticle);\n\t\t\t\n\t}", "protected float calcFitness(Individual ind) {\n\t\t\tdouble w = (double) ind.getWait();\n\t\t\tdouble g = (double) ind.getMove();\n\t\t\treturn (float) (g/(w+g));\n\t\t}", "public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(new FileReader(\"talent.in\"));// new InputStreamReader(System.in)); //\n PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(\"talent.out\")));\n int N = sc.nextInt();\n int minWeight = sc.nextInt();\n int[] weight = new int[N];\n int[] value = new int[N];\n int totalTalent = 0;\n for (int i = 0; i < N; i++) {\n int wt = sc.nextInt();\n int val = sc.nextInt();\n weight[i] = wt;\n value[i] = val;\n totalTalent += val;\n }\n\n // Store, for a given talent, what is the smallest weight used to achieve it?\n int[] dp = new int[totalTalent + 1];\n Arrays.fill(dp, (int) 1e9);\n dp[0] = 0;\n // the min weight to produce 0 talent is 0. However,\n // it is necessary to make everything else big because we can only BUILD\n // from 0\n double bestRatio = 0;\n for (int cow = 0; cow < N; cow++) {\n // look at each cow, and go DOWN THROUGH THE dp array, updating the\n // best weight achievable BEHIND US. This countercurrent motion ensures no repeated\n // counting of a single cow's talents\n int contribution = value[cow];\n int wt = weight[cow];\n for (int talent = totalTalent; talent >= 0; talent--) {\n int boostedTalent = contribution + talent;\n int boostedWeight = dp[talent] + wt;\n // with the min weight of a certain talent,\n // is it possible to get a smaller boostedWeight for a boostedTalent\n if (boostedTalent <= totalTalent) {\n // If we are in bounds,\n if (boostedWeight < dp[boostedTalent]) {\n // and the attempted team has a better weight value\n // then update it!\n // Initially, when everything is 1 billion, this cannot\n // happen except for from the base cases, building outward\n dp[boostedTalent] = boostedWeight;\n\n // At the same time, we can be more efficient by constantly\n // checking if we had enough weight first of all, and\n // second of all had a better talent/weight ratio!\n double ratio = (double) boostedTalent / boostedWeight;\n if (ratio > bestRatio && boostedWeight >= minWeight) {\n bestRatio = ratio;\n }\n }\n }\n }\n }\n\n out.println((int) (1000 * bestRatio));\n out.close();\n }", "private boolean isFeasible(FlowNetwork G, int s, int t) {\r\n\r\n // check that capacity constraints are satisfied\r\n for (int v = 0; v < G.V(); v++) {\r\n for (FlowEdge e : G.adj(v)) {\r\n if (e.flow() < -FLOATING_POINT_EPSILON\r\n || e.flow() > e.capacity() + FLOATING_POINT_EPSILON) {\r\n System.err\r\n .println(\"Edge does not satisfy capacity constraints: \" + e);\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n // check that net flow into a vertex equals zero, except at source and\r\n // sink\r\n if (Math.abs(value + excess(G, s)) > FLOATING_POINT_EPSILON) {\r\n System.err.println(\"Excess at source = \" + excess(G, s));\r\n System.err.println(\"Max flow = \" + value);\r\n return false;\r\n }\r\n if (Math.abs(value - excess(G, t)) > FLOATING_POINT_EPSILON) {\r\n System.err.println(\"Excess at sink = \" + excess(G, t));\r\n System.err.println(\"Max flow = \" + value);\r\n return false;\r\n }\r\n for (int v = 0; v < G.V(); v++) {\r\n if (v == s || v == t)\r\n continue;\r\n else if (Math.abs(excess(G, v)) > FLOATING_POINT_EPSILON) {\r\n System.err.println(\"Net flow out of \" + v + \" doesn't equal zero\");\r\n return false;\r\n }\r\n }\r\n return true;\r\n }", "public static void calculateFitness(Individual[] individuals) {\n for (Individual individual : individuals) {\n individual.fitness = 0;\n for (int i = 0; i < dataSet.size(); i++) {\n for (Rule rule : individual.rulebase) {\n boolean match = true;\n int[] data = dataSet.get(i).getVariables();\n\n for (int j = 0; j < data.length; j++) {\n\n String variable = String.valueOf(data[j]);\n //String variable = \"\" + data[j];\n String[] rulebase = rule.cond;\n\n if ((rulebase[j].equals(variable) != true) && (rulebase[j].equals(\"#\") != true)) {\n match = false;\n }\n }\n\n if (match) {\n String output = String.valueOf(dataSet.get(i).getOutput());\n if (rule.output.equals(output)) {\n individual.fitness++;\n }\n break;\n }\n }\n }\n }\n }", "public SolutionType getBestSolution();", "public void generateFIS(){\n List<int[]> lastFIS = oneDimensionFIS;\n int n = 2;\n while (true){\n\n List<int[]> candidates = buildNewCandidates(lastFIS);\n\n if (candidates.size() == 0){\n break;\n }\n List<int[]> FIS;\n if (useList(candidates.size(), n)){\n FIS = validateCandidatesWithList(candidates);\n } else{\n FIS = validateCandidatesWithSet(candidates);\n }\n if (FIS.size() == 0){\n break;\n }\n lastFIS = FIS;\n n++;\n }\n }", "private int[] bestFitModified(int[] chromosome) {\n\t\tint[] bins = new int[binCount];\n\t\tArrayList<Integer> cannotPackList = new ArrayList<Integer>();\n\n\t\t//honor chromosome listing when possible\n\t\tfor (int i = 0; i < chromosome.length; i++) {\n\t\t\t//if this bin isnt full & won't be after placement & this chrom hasnt gone off the end \n\t\t\t//(VERY RARE, only happens when binCount is reduced w/ elitism)\n\t\t\tif (chromosome[i] < bins.length && bins[chromosome[i]] + packageWeights[i] <= binSize) {\n\t\t\t\tbins[chromosome[i]] += packageWeights[i]; //put package into bin\n\t\t\t} else { //store those we can't honor\n\t\t\t\tchromosome[i] = -1;\n\t\t\t\tcannotPackList.add(new Integer(i)); //save all those packages whos original bins were full\n\t\t\t}\n\t\t}\n\n\t\t//best fit on all the rest whos bins were full up\n\t\tint tries = 0;\n\t\tfor (int j = 0; j < cannotPackList.size(); j++) {\n\t\t\tint i = cannotPackList.get(j);\n\t\t\tint bestBinIndex = -1;\n\n\t\t\twhile (bestBinIndex < 0 && tries < bins.length * 2) { //while we still havent found a bin to put this in and time isn't up\n\n\t\t\t\tint bestBinLeftOverSpace = binSize * 100; //how much space is left in the bin when the packages is placed in it (ideally 0 = full bin)\n\n\t\t\t\tfor (int bin = 0; bin < bins.length; bin++) {\n\t\t\t\t\t//if this bin is closer to full than the best bin and not overfilled save it\n\t\t\t\t\tif ((binSize - (bins[bin] + packageWeights[i])) >= 0 && (binSize - (bins[bin] + packageWeights[i])) < bestBinLeftOverSpace) {\n\t\t\t\t\t\tbestBinIndex = bin;\n\t\t\t\t\t\tbestBinLeftOverSpace = binSize - (bins[bin] + packageWeights[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (bestBinIndex < 0) { //if could not pack, dump out a bin (mutation)\n\t\t\t\t\tj = 0;\n\t\t\t\t\tint dumpBin = rand.nextInt(binCount);\n\t\t\t\t\tfor (int binIndex = dumpBin; binIndex < binCount; binIndex++) {\n\t\t\t\t\t\tbins[binIndex] = 0;\n\t\t\t\t\t\tfor (int chromIndex = 0; chromIndex < chromosome.length; chromIndex++) {\n\t\t\t\t\t\t\tif (chromosome[chromIndex] == binIndex) {\n\t\t\t\t\t\t\t\tchromosome[chromIndex] = -1;\n\t\t\t\t\t\t\t\tcannotPackList.add(new Integer(chromIndex));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\ttries++;\n\t\t\t}\n\n\t\t\tif (tries >= bins.length * 2) {\n\t\t\t\treturn null; //this chromosome is unsalvageable because it is impossible to fit the packages in the bins\n\t\t\t}\n\n\n\t\t\tbins[bestBinIndex] += packageWeights[i];\n\t\t\tchromosome[i] = bestBinIndex;\n\t\t\tcannotPackList.remove(j);\n\t\t\tj--;\n\t\t}\n\n\t\treturn chromosome;\n\t}", "private void calculateFitness() {\n\t\tint day1=this.getNumberOfHours()*this.getNumberOfClasses();\n\t\tint day2=2*day1;\n\t\tint day3=3*day1;\n\t\tint day4=4*day1;\n\t\tint day5=5*day1;\n\t\tTeacher_lesson temp=null;\n\t\t//day 1//\n\t\tHashSet<Integer> closedSet=new HashSet<Integer>();\n\t\t\n\t\t\n\t\t\n\t\tfor(int i=0;i<day1;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day1;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t}\n\t\t\t\n\t\t}\n\t\n\t\t\n\t\t\n\t\t\n\t\t//day2//\n\t\tclosedSet.clear();;\n\t\t\n\t\tfor(int i=day1;i<day2;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day2;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t}\n\t\t\t\n\t\t}\n\t\t//day3//\n\t\tclosedSet.clear();;\n\t\tfor(int i=day2;i<day3;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day3;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\t//day4//\n\t\tclosedSet.clear();;\n\t\tfor(int i=day3;i<day4;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day4;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\t\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t}\n\t\t\t\n\t\t}\n\t\t//day5//\n\t\tclosedSet.clear();;\n\t\tfor(int i=day4;i<day5;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp !=null){\n\t\t\t\tif(!(closedSet.contains(temp.get_tid()))){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\tfor(int j=i+1;j<day5;j++){\n\t\t\t\n\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\tclosedSet.add(temp.get_tid());\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\t\t//-1 giati den aferesame thn prwti wra otan to vriskei ston pinaka//\n\t\t\t\ttemp.set_d_hour(temp.get_td_hour()-1);\n\t\t\t\tif(temp.get_td_hour()>0){++this.fitness;}\n\t\t\t\t\n\t\t}\n\t\t\t/*if(temp.get_td_hour()<0){this.fitness=this.fitness-100;}//adunato na ginei giati o ka8igitis exei parapanw wres apo oti mporei na kanei//\n\t\t\t\telse if (temp.get_td_hour()==0){this.fitness=this.fitness-2;}//meiwnoume giati o ka8igitis 8a epivarin8ei oles tou tis wres thn idia mera//\n\t\t\t\telse{++this.fitness;}//kalh prosegisi*/\n\t\t}\n\t\t//*********************END OF DAILY EVALUATION*****************************//\n\t\t\n\t\t//**********************START OF WEEKLY EVALUATION************************//\n\t\t\n\t\tclosedSet.clear();\n\t\t\n\t int \t_weeklyhours = 1;\n\t \n\t\tfor(int i=0;i<day5;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp!=null){\n\t\t\tif(!closedSet.contains(this.genes[i])){\n\t\t\t\t\n\t\t\t\n\t\t\tfor(int j=i+1;j<day5;j++){\n\t\t\t\tif(temp.get_tid()==this.genes[j]){\n\t\t\t\t\t++_weeklyhours; }\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t/*if(_weeklyhours>temp.get_tw_hour()){\n\t\t\t\tthis.fitness=this.fitness-100 ; //adunato na kanei parapanw wres ma8hma//\n\t\t\t}else\n\t\t\t\t{++this.fitness;}*/\n\t\t\tif(_weeklyhours<temp.get_tw_hour()){++this.fitness;}\n\t\t\tclosedSet.add(this.genes[i]);}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//*************END OF WEEKLY EVALUATION**********//\n\t\n\t\t//**START OF LESSON EVALUATION***//\n\t\tArraylistLesson set=new ArraylistLesson();\n\t\tclass_lid templ=null;\n\t\tTeacher_lesson tempj=null;\n\t\tint lid=0;\n\t\tString _class;\n\t\tint _classhours=1;\n\t\tfor(int i=0;i<day5;i++){\n\t\t\ttemp=getdata(this.genes[i]);\n\t\t\tif(temp!=null){\n\t\t\tlid=temp.get_lid();\n\t\t\t_class=temp.get_class();\n\t\t\ttempl=new class_lid(lid,_class);\n\t\t\tif(!set.contains(templ)){\n\t\t\t\t\n\t\t\t\tfor(int j=i+1;j<day5;j++){\n\t\t\t\t\ttempj=getdata(this.genes[j]);{\n\t\t\t\t\t\tif(tempj!=null){\n\t\t\t\t\t\t\tif(temp.get_tid()==tempj.get_tid()){\n\t\t\t\t\t\t\t\tif(temp.get_lid()==tempj.get_lid()&&temp.get_class().equalsIgnoreCase(tempj.get_class())){\n\t\t\t\t\t\t\t\t\t++_classhours;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\tint hours;\n\t\t\t\thours=temp.get_lhours();\n\t\t\t\n\t\tif(_classhours==hours){\n\t\t\t++this.fitness;\n\t\t}\n\t\tset.add(templ);\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t}", "private boolean isFeasible(FlowNetwork G, int s, int t) {\n\t double EPSILON = 1E-11;\n\n\t // check that capacity constraints are satisfied\n\t for (int v = 0; v < G.V(); v++) {\n\t for (FlowEdge e : G.adj(v)) {\n\t if (e.flow() < -EPSILON || e.flow() > e.capacity() + EPSILON) {\n\t System.err.println(\"Edge does not satisfy capacity constraints: \" + e);\n\t return false;\n\t }\n\t }\n\t }\n\n\t // check that net flow into a vertex equals zero, except at source and sink\n\t if (Math.abs(value + excess(G, s)) > EPSILON) {\n\t System.err.println(\"Excess at source = \" + excess(G, s));\n\t System.err.println(\"Max flow = \" + value);\n\t return false;\n\t }\n\t if (Math.abs(value - excess(G, t)) > EPSILON) {\n\t System.err.println(\"Excess at sink = \" + excess(G, t));\n\t System.err.println(\"Max flow = \" + value);\n\t return false;\n\t }\n\t for (int v = 0; v < G.V(); v++) {\n\t if (v == s || v == t) continue;\n\t else if (Math.abs(excess(G, v)) > EPSILON) {\n\t System.err.println(\"Net flow out of \" + v + \" doesn't equal zero\");\n\t return false;\n\t }\n\t }\n\t return true;\n\t }", "public int run(Point xS, Point xE)\n throws OptimizerException, Exception\n {\n boolean terminate = false;\n boolean f1eqf2 = false;\n // Vector of points, used for parallel computation\n Point[] x = new Point[2];\n x[0] = new Point(xS.getDimensionContinuous(), xS.getDimensionDiscrete(), xS.getDimensionF());\n x[1] = (Point)x0.clone();\n \n x0 = (Point)xS.clone();\n x3 = (Point)xE.clone();\n \n dx = LinAlg.subtract(x3.getX(), x0.getX());\n double I = 1.; // interval length (in terms of alpha, which is normalized)\n nIntRed = 0; // zero-based step of interval division\n I *= getReductionFactor();\n x[1].setX( LinAlg.add(x0.getX(), LinAlg.multiply(I, dx)) );\n nIntRed++;\n I *= getReductionFactor();\n x[0].setX( LinAlg.add(x0.getX(), LinAlg.multiply(I, dx)) );\n // initial function evaluation\n\n x = getF(x);\n \tx1 = (Point)x[0].clone();\n x2 = (Point)x[1].clone();\n\n do\n {\n nIntRed++;\n I *=getReductionFactor();\n\n if (x2.getF(0) < x1.getF(0))\n { // data management\n fLowBor = x1.getF(0); // we need that for one of the stopping criteria\n x0 = (Point)x1.clone();\n x1 = (Point)x2.clone();\n // new point\n x2.setX( LinAlg.subtract(x3.getX(), LinAlg.multiply(I, dx)) );\n x2 = getF(x2);\n }\n else\n { // data management\n fLowBor = x2.getF(0); // we need that for one of the stopping criteria\n x3 = (Point)x2.clone();\n x2 = (Point)x1.clone();\n // new point\n x1.setX( LinAlg.add(x0.getX(), LinAlg.multiply(I, dx)) );\n x1 = getF(x1);\n }\n\n // check for null space of objective function, unless\n // stoCri is equal to one\n if (stoCri != 1 && x1.getF(0) == x2.getF(0))\n {\n if (f1eqf2) // the last two were also equal, so the\n terminate = true; // current three are equal\n f1eqf2 = true;\n }\n else // reset flag\n f1eqf2 = false;\n } while (iterate() && !terminate);\n\n // tolerance achieved or maximum number of iteration exceeded\n // store minimum value\n if (x1.getF(0) < x2.getF(0))\n {\n xLow = (Point)x0.clone();\n xMin = (Point)x1.clone();\n xUpp = (Point)x2.clone(); \n }\n else\n {\n xLow = (Point)x1.clone();\n xMin = (Point)x2.clone();\n xUpp = (Point)x3.clone(); \n }\n // if we got a null space\n if (terminate) return -2;\n // check whether the maximum number of iteration is exceeded\n if (stoCri == 1)\n if (!isDFltdFMin()) return -1;\n // if search has been successful\n return +1;\n }", "private double getUnadjustedFitness(Computer computer){\n double score = 0;\n score += 6 * getMatchPercent(computer);\n if(computer.compatible() && sizeCompatability(computer))\n score += 9.5;\n int ramAmount =computer.ramAmount();\n if(ramAmount < 8)\n score -= (8 - ramAmount) * 2;\n else if(ramAmount > 8 && ramAmount < 17)\n score += .06 * (ramAmount - 8);\n else if(ramAmount > 17)\n score += .03 * (ramAmount - 8);\n\n if(computer.cpu.name.contains(\"Intel\") && computer.cpu.name.endsWith(\"K\")){\n if (!computer.motherboard.overclock()){\n score -= 6;\n }\n }\n\n if(computer.cpu.name.contains(\"Intel\") && !(computer.cpu.shortname.contains(\"-5\") || computer.cpu.shortname.contains(\"-6\"))){\n score -= 2;\n }\n if(computer.cpu.name.contains(\"GeForce\") && !(computer.gpu.name.contains(\"GTX 9\") || computer.gpu.name.contains(\"GTX 1\"))){\n score -= 2;\n }\n if(computer.bootDrive.size < 240)\n score -= settings.diskSize * 0.33;\n if(computer.bootDrive.size > 700)\n score += settings.diskSize * 5;\n else\n score += settings.diskSize * computer.bootDrive.size / 140;\n if(computer.secondaryDrive != null)\n score += settings.diskSize * computer.secondaryDrive.size / 1000;\n\n //Now ensure there's enough power, and give a bonus for there being ~300 watts more than needed;\n //there are 4.5 points to gain in powersupply, 10 points to lose\n int basePower = computer.powerConsumption();\n int ideal = basePower + 65;\n if(computer.power.watts < basePower)\n score -= 10;\n else if(computer.power.watts < ideal)\n score += (basePower - computer.power.watts) / 100;\n else\n score += 2.5 - (computer.power.watts - basePower) / 250;\n score += (3 - computer.power.tier) * .6;\n\n // Now motherboard, one point to gain, one to lose\n score += 2 - computer.motherboard.getQuality();\n\n double driveScore = ((computer.bootDrive.reads + computer.bootDrive.writes) / 2) / 88;\n driveScore -= 2;\n if(driveScore > 7.5){\n driveScore = 7.5;\n }\n score += driveScore;\n double rawCpu = ((1 - settings.multicore) / 3) * computer.cpu.singlecore + ((settings.multicore / 3) * (computer.cpu.multicore));\n double adjustedCpu = 26 + 40* ((settings.cpuIntensity / (settings.cpuIntensity + settings.gpuIntensity))* rawCpu - lowCpuScore()) / (maxCpuScore() - lowCpuScore());\n double rawGpu = computer.gpu.fps + (computer.gpu.threedmark / 100);\n double adjustedGpu = 17 + 40 * ((settings.gpuIntensity / (settings.cpuIntensity + settings.gpuIntensity)) * rawGpu - lowGpuScore()) / (maxGpuScore() - lowGpuScore());\n //Inflate the GPU score slightly\n // adjustedGpu * ((35 - adjustedGpu) / 35);\n score += adjustedGpu;\n score += adjustedCpu;\n\n return score;\n }", "public void findTotalFit() {\n\tfor (int i=0;i<popSize;i++) {\n\t totalFitness+=this.getFitness(i);\n\t}\n }", "private int copyFitnessValuesToFitnessTable(IGANsgaPopulation pop,\r\n FitnessTable ft) {\r\n int size = pop.size();\r\n int numObj = pop.getNumObjectives();\r\n int numRankZero = 0;\r\n for (int j = 0; j < size; j++) {\r\n IGANsgaSolution sol = (IGANsgaSolution) pop.getMember(j);\r\n if (sol.getRank() == 0) {\r\n numRankZero++;\r\n }\r\n for (int k = 0; k < numObj; k++) {\r\n ft.setFitnessValue(sol.getObjective(k), j, k);\r\n }\r\n }\r\n return numRankZero;\r\n }", "public void classifyAndRepairUnsatisfiability() throws Exception{\n\t\n\t\t\n\t\tinit = Calendar.getInstance().getTimeInMillis();\n\t\t\n\n\t\t//Reason\n\t\tLogOutput.printAlways(\"\\nCLASSIFYING\");\n\t\t\n\t\t//Transform mappings 2 owl\n\t\tgetOWLAxioms4Mappings();\n\t\t\n\t\tsetUpReasoner(true);\t\t\n\t\tsetUpBlackBosExplanationManager();\n\t\t\n\t\t//Will be reused\n\t\tstrctReasoner = new StructuralReasonerExtended(reasoner_access.getOntology());\n\t\t\n\t\t//ONLY Statistics\n\t\t//LogOutput.printAlways(\"\\nSTATISTICS EXPLANATIONS (UNSAT: \" + reasoner_access.getUnsatisfiableClasses().size() + \").\");\n\t\t//repairUnsatisfiability(50);\n\t\t\n\t\t\n\t\tint it=0;\n\t\t\n\t\tLogOutput.printAlways(\"\\nREPAIR GREEDY ALGO:\");\n\t\t\n\t\twhile (reasoner_access.hasUnsatisfiableClasses()){\n\t\t\t\n\t\t\tLogOutput.printAlways(\"\\tUNSAT CLASSES iter \" + it + \": \" + reasoner_access.getUnsatisfiableClasses().size());\n\t\t\t\n\t\t\t//Split unsat and solve!!\n\t\t\tif (!repairUnsatisfiability())\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tapplyBestRepairPlan();\n\t\t\t\n\t\t\t//Clear previous structures\n\t\t\tclearStructures();\n\t\t\t\n\t\t\t//Trasnform mappings 2 owl\n\t\t\tgetOWLAxioms4Mappings();\n\t\t\t\n\t\t\t//Reason\n\t\t\t//setUpReasoner(false);\t\t\t\n\t\t\t//Any unsat\n\t\t\t//if (checkIfAnyUnsat()){ //classify and reinit blackbox\n\t\t\t//\treasoner_access.classifyOntology();\n\t\t\t//\tsetUpBlackBosExplanationManager();\n\t\t\t//}\n\t\t\t//else{ //We are done\n\t\t\t//\treasoner_access.getUnsatisfiableClasses().clear();\n\t\t\t//}\n\t\t\t\n\t\t\t//Reason\n\t\t\tLogOutput.printAlways(\"\\tCLASSIFYING\");\n\t\t\tsetUpReasoner(true);\n\t\t\tsetUpBlackBosExplanationManager();\n\t\t\t\n\t\t\tit++;\n\t\t\t\n\t\t}\n\t\t\n\t\tfin = Calendar.getInstance().getTimeInMillis();\n\t\t\n\t\tdouble time = (float)((double)fin-(double)init)/1000.0;\n\t\tLogOutput.printAlways(\"\\tTIME GREEDY Repair Algorithm (s): \" + time);\n\t\tLogOutput.printAlways(\"\\tUNSAT CLASSES after cleaning: \" + reasoner_access.getUnsatisfiableClasses().size());\n\t\t\n\t\t//We do not clean last reasoner\n\t\t//It is necessary for index\n\t\t\n\t}", "public double worstFitness()\r\n {\r\n\treturn worstFitness;\r\n }", "@Override\n\tpublic float desireability() {\n\t\tAgentSpace agentSpace = Blackboard.inst().getSpace(AgentSpace.class, _obj.getName());\n\t\tMap<String,FoodEntry> map = agentSpace.getScentMemories().getFirst();\n\t\tif (map == null || map.size() == 0) { \n\t\t\t// we don't smell anything\n\t\t\treturn 0;\n\t\t}\n\t\t\n\t\tAgentSpace space = Blackboard.inst().getSpace(AgentSpace.class, _obj.getName());\n\t\tBoundedEntry bounded = space.getBounded(Variable.energy);\n\t\tfloat pct = bounded.getValue() / bounded.getMax();\n\t\treturn 1 - (pct*pct);\n\t}", "@Override\r\n\tpublic double getObjectiveFunctionValue(SolutionRepresentationInterface oSolution) {\r\n\t\t\r\n\t\tint[] solutionArr = oSolution.getSolutionRepresentation();\t\r\n\t\tdouble cost = 0;\r\n\t\r\n\t\tfor(int i = 0; i < solutionArr.length - 1; i++) {\r\n\t\t\tcost += getCost(solutionArr[i], solutionArr[i + 1]);\r\n\t\t}\r\n\t\t\r\n\t\t// add the trips between the postal office and worker’s home locations with the start and end points\r\n\t\tcost += getCostBetweenDepotAnd(solutionArr[0]) + getCostBetweenHomeAnd(solutionArr[solutionArr.length - 1]);\r\n\t\t\r\n\t\treturn cost;\r\n\t}", "@Override\n public Matching stableMarriageGaleShapley_hospitaloptimal(Matching marriage) {\n int m = marriage.getHospitalCount();\n int n = marriage.getResidentCount();\n\n ArrayList<ArrayList<Integer>> hospital_preference = marriage.getHospitalPreference();\n ArrayList<ArrayList<Integer>> resident_preference = marriage.getResidentPreference();\n\n ArrayList<Integer> hospitalSlots = marriage.getHospitalSlots();\n\n ArrayList<Integer> residentMatching = new ArrayList<Integer>();\n arrlistInit(residentMatching, n, -1, false);\n\n /*list of residents that each hospital can propose to\n * Initially equals the hospital_preference list*/\n ArrayList<ArrayList<Integer>> residentsToProposeTo = new ArrayList<ArrayList<Integer>>();\n for (int i = 0; i < m; i++) //O(m)\n residentsToProposeTo.add(new ArrayList<Integer>(hospital_preference.get(i)));\n\n /*list of hospitals that still can propose(has free spots and hasn't proposed to every resident)*/\n ArrayList<Integer> proposing = new ArrayList<Integer>();\n arrlistInit(proposing, m, 0, true); //O(n)\n\n /*Keep track of each hospital matched residents*/\n ArrayList<ArrayList<Integer>> hospitalResidents = new ArrayList<ArrayList<Integer>>(0);\n for (int i = 0; i < m; i++) //O(m)\n hospitalResidents.add(new ArrayList<Integer>(0));\n\n /*Looping through each hospital in the proposing list\n * Even though some hospital may be added again in the proposing list, each hospital can propose at most once to each resident\n * So total running time of the loop will be O(m*n)*/\n while (!proposing.isEmpty()) {\n for (int hospitalIndex = 0; hospitalIndex < proposing.size(); hospitalIndex++) {\n /*Get the head of the proposing Arraylist*/\n int hospital = proposing.get(0);\n int residentIndex;\n int resident = 0;\n for (residentIndex = 0; residentIndex < residentsToProposeTo.get(hospital).size() && proposing.contains(hospital); hospitalIndex++) {\n /*Get the next resident the hospital hasn't proposed to yed*/\n resident = residentsToProposeTo.get(hospital).get(0);\n int hospitalRank = resident_preference.get(resident).indexOf(hospital);\n\n /*resident is matched, compare the hospitals rank*/\n if (residentMatching.get(resident) != -1) {\n int matchedHospital = residentMatching.get(resident);\n int matchedHospitalRank = resident_preference.get(resident).indexOf(matchedHospital);\n if (hospitalRank < matchedHospitalRank) {\n /*1.Add/remove to hospitalResidents\n * 2.Add in resident-matching\n * 3.Add matchedHospital to the proposing list if it's not in it\n */\n hospitalResidents.get(hospital).add(resident);\n hospitalResidents.get(matchedHospital).remove(hospitalResidents.get(matchedHospital).indexOf(resident));\n residentMatching.set(resident, hospital);\n if (!proposing.contains(matchedHospital))\n proposing.add(matchedHospital);\n\n }\n }\n /*resident is free, match with the hospital*/\n else {\n /*1.Add in hospitalResidents\n * 2.Add in resident-matching\n */\n hospitalResidents.get(hospital).add(resident);\n residentMatching.set(resident, hospital);\n }\n\n /*1.Remove resident from the hospital's list of residentsToProposeTo\n * 2.If hospital's slots are full, remove hospital from the proposing list\n */\n residentsToProposeTo.get(hospital).remove(residentsToProposeTo.get(hospital).indexOf(resident));\n if (hospitalResidents.get(hospital).size() >= hospitalSlots.get(hospital))\n proposing.remove(proposing.indexOf(hospital));\n }\n }\n }\n marriage.setResidentMatching(residentMatching);\n return marriage;\n }", "@Override\n\t\t\t\t\tpublic Iterator<Tuple2<FirstStageAresSolution, Tuple5<Integer,Double,Double,Double,Double>>> call(Tuple2<MobileApplication, MobileDataDistributionInfrastructure> inputValues)\n\t\t\t\t\t\t\tthrows Exception {\n\t\t\t\t\t\tArrayList<Tuple2<FirstStageAresSolution,Tuple5<Integer,Double,Double,Double,Double>>> output = \n\t\t\t\t\t\t\t\t\t\tnew ArrayList<Tuple2<FirstStageAresSolution,Tuple5<Integer,Double,Double,Double,Double>>>();\n\t\t\t\t\t\tOffloadScheduler singleSearch;\n\t\t\t\t\t\t\n\t\t\t\t\t\tArrayList<FirstStageAresSolution> solutions;\n\t\t\t\t\t\t/*switch(SimulationSetup.placementAlgorithm)\n\t\t\t\t\t\t{\n\t\t\t\t\t\tcase \"RANDOM\":\n\t\t\t\t\t\t\tRandomEdgePlanner.setupEdgeNodes(infrastructure);\n\t\t\t\t\t\t\tDefaultNetworkPlanner.setupNetworkConnections(infrastructure);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"ALL\":\n\t\t\t\t\t\t\tEdgeAllCellPlanner.setupEdgeNodes(infrastructure);\n\t\t\t\t\t\t\tDefaultNetworkPlanner.setupNetworkConnections(infrastructure);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"ares\":\n\t\t\t\t\t\t\tFirstStageAresPlanner planner = new FirstStageAresPlanner(inputValues);\n\t\t\t\t\t\t\tplanner.setupEdgeNodes(infrastructure);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tFirstStageAresPlanner aresP = new FirstStageAresPlanner(inputValues);\n\t\t\t\t\t\t\taresP.setupEdgeNodes(infrastructure);\n\t\t\t\t\t\t}*/\n\t\t\t\t\t\t\n\t\t\t\t\t\tSystem.out.println(\"Executing planner\");\n\t\t\t\t\t\t//FirstStageAresPlanner aresP = new FirstStageAresPlanner();\n\t\t\t\t\t\tFirstStageAresPlanner aresP = new FirstStageAresPlanner();\n\t\t\t\t\t\tSystem.out.println(\"Retrieving solutions\");\n\t\t\t\t\t\t//solutions = (ArrayList<FirstStageAresSolution>) aresP.getSolutionList();\n\t\t\t\t\t\tsolutions = (ArrayList<FirstStageAresSolution>) aresP.getSolutionList();\n\t\t\t\t\t\tSystem.out.println(\"Solutions retrieved!\");\n\t\t\t\t\t\t/*switch(algoritmName){\n\t\t\t\t\t\tcase \"weighted\":\n\t\t\t\t\t\t\tsingleSearch = new HeftEchoResearch(inputValues._1(), infrastructure);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"heft\":\n\t\t\t\t\t\t\tsingleSearch = new HEFTResearch(inputValues._1(), infrastructure);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"hbatt\":\n\t\t\t\t\t\t\tsingleSearch = new HEFTBattery(inputValues._1(), infrastructure);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"hcost\":\n\t\t\t\t\t\t\tsingleSearch = new HEFTCostResearch(inputValues._1(), infrastructure);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"bforce-rt\":\n\t\t\t\t\t\t\tsingleSearch = new BruteForceRuntimeOffloader(inputValues._1(), infrastructure);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"nsgaIII\":\n\t\t\t\t\t\t\tsingleSearch = new NSGAIIIResearch(inputValues._1(), infrastructure);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}*/\n\t\t\t\t\t\t//ArrayList<FirstStageAresSolution> temp = new ArrayList<FirstStageAresSolution>();\n\t\t\t\t\t\t//for(FirstStageAresSolution solution : solutions) {\n\t\t\t\t\t\tArrayList<FirstStageAresSolution> temp = new ArrayList<FirstStageAresSolution>();\n\t\t\t\t\t\tfor(FirstStageAresSolution solution : solutions) {\n\t\t\t\t\t\t\t//aresP.applySolutionToInfrastructure(solution, infrastructure);\n\t\t\t\t\t\t\t//ArrayList<InfrastructureProvisioningPlan> offloads = (ArrayList<InfrastructureProvisioningPlan>) singleSearch.findScheduling();\n\t\t\t\t\t\t\t//if(offloads != null)\n\t\t\t\t\t\t\t\t//for(InfrastructureProvisioningPlan os : offloads) \n\t\t\t\t\t\t\t\t//{\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t//System.out.println(solution);\n\t\t\t\t\t\t\t\t\t//plan.setInfEnergyConsumption(solution.getEnergyConsumption());\n\t\t\t\t\t\t\t\t\t//plan.setRunTime(solution.getAverageDistance());\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t/*if(!temp.contains(solution)) \n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttemp.add(solution);\n\t\t\t\t\t\t\t\toutput.add(\n\t\t\t\t\t\t\t\t\t\tnew Tuple2<FirstStageAresSolution,Tuple5<Integer,Double,Double,Double,Double>>\n\t\t\t\t\t\t\t\t\t\t(solution,\n\t\t\t\t\t\t\t\t\t\t\t\tnew Tuple5<Integer,Double,Double,Double,Double>(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsolution.getAverageDistance(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t0.0,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsolution.getEnergyConsumption(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t0.0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)));\n\t\t\t\t\t\t\t}*/\n\t\t\t\t\t\t\tif(!temp.contains(solution)) \n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttemp.add(solution);\n\t\t\t\t\t\t\t\toutput.add(\n\t\t\t\t\t\t\t\t\t\tnew Tuple2<FirstStageAresSolution,Tuple5<Integer,Double,Double,Double,Double>>\n\t\t\t\t\t\t\t\t\t\t(solution,\n\t\t\t\t\t\t\t\t\t\t\t\tnew Tuple5<Integer,Double,Double,Double,Double>(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsolution.getAverageDistance(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t0.0,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsolution.getEnergyConsumption(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t0.0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn output.iterator();\n\t\t\t\t\t}", "private static void normal(){\n ProblemKnapsackFromFile problem = new ProblemKnapsackFromFile(macPathGetProblemFrom);\n\n //NSGAII algorithm = new NSGAII();\n SPEA2 algorithm = new SPEA2();\n //SPEAHADKA algorithm = new SPEAHADKA();\n //AEMMT algorithm = new AEMMT();\n //AEMMD algorithm = new AEMMD();\n //MOEAD algorithm = new MOEAD();\n\n int x =1;\n int counter = 0;\n\n if (AEMMD.class.isInstance(algorithm) || AEMMT.class.isInstance(algorithm)){\n Parameters.NUMBER_OF_GENERATIONS = 15000;\n }\n else{\n Parameters.NUMBER_OF_GENERATIONS = problem.items.size() < 100? 100 : 200;\n }\n\n while (counter < x) {\n algorithm.runAlgorithm(problem);\n counter++;\n }\n }", "private void checkStability() {\n double maxDeviation = Double.NEGATIVE_INFINITY;\n\n DeviationIterator itr = new DeviationIterator(currentOutcome, nActs);\n while (itr.hasNext()) {\n int[] devOutcome = itr.next();\n\n // this shouldn't happen\n if (eGame.getNumSamples(devOutcome) <= 0) {\n System.out.println(\"BRD: checking equilibrium with unsampled deviations!\");\n System.out.println(\"Current: \" + Arrays.toString(currentOutcome));\n System.out.println(\"Unsampled: \" + Arrays.toString(devOutcome));\n return;\n }\n\n double devBenefit = eGame.getPayoff(devOutcome, itr.getDeviatingPlayer()) -\n eGame.getPayoff(currentOutcome, itr.getDeviatingPlayer());\n\n maxDeviation = Math.max(maxDeviation, devBenefit);\n\n // terminate early; not better than one we have already confirmed\n if (maxDeviation >= confirmedStability) return;\n }\n\n if (maxDeviation < confirmedStability) {\n confirmedStability = maxDeviation;\n mostStableConfirmed = currentOutcome.clone();\n if (samplesToConfirmEquilibrium < 0 &&\n confirmedStability <= 0) {\n samplesToConfirmEquilibrium = eGame.getTotalNumSamples();\n }\n }\n }", "public static void experiment(String name) {\n \tString probName = \"NQueensProblem\";\n \tList<OptimizationAlgorithm> algs = new ArrayList<>();\n int[] ranges = new int[N];\n Random random = new Random(N);\n for (int i = 0; i < N; i++) {\n \tranges[i] = random.nextInt();\n }\n NQueensFitnessFunction ef = new NQueensFitnessFunction();\n Distribution odd = new DiscretePermutationDistribution(N);\n NeighborFunction nf = new SwapNeighbor();\n MutationFunction mf = new SwapMutation();\n CrossoverFunction cf = new SingleCrossOver();\n Distribution df = new DiscreteDependencyTree(.1); \n \n HillClimbingProblem hcp = new GenericHillClimbingProblem(ef, odd, nf);\n GeneticAlgorithmProblem gap = new GenericGeneticAlgorithmProblem(ef, odd, mf, cf);\n ProbabilisticOptimizationProblem pop = new GenericProbabilisticOptimizationProblem(ef, odd, df);\n \n RandomizedHillClimbing rhc = new RandomizedHillClimbing(hcp); \n SimulatedAnnealing sa = new SimulatedAnnealing(1E1, .1, hcp);\n StandardGeneticAlgorithm ga = new StandardGeneticAlgorithm(200, 0, 10, gap);\n MIMIC mimic = new MIMIC(200, 10, pop);\n \n algs.add(rhc);\n algs.add(sa);\n algs.add(ga);\n algs.add(mimic);\n Experiment newExp = new Experiment();\n \n newExp.experiments(algs, ef, name);\n \n // test temperature for SA\n String paramName = \"Temperature\";\n String algName = \"SA\";\n List<Double> params2 = new ArrayList<>();\n List<OptimizationAlgorithm> algsTest = new ArrayList<>();\n for (double i = 1.0; i < 100.5; i+=1.0){\n \tparams2.add(i);\n \tsa = new SimulatedAnnealing(i, .1, hcp);\n \talgsTest.add(sa);\n }\n newExp.optParams(algsTest, ef, paramName, null, params2, algName, probName);\n \n // test cooling rate for SA\n paramName = \"CoolingRate\";\n params2 = new ArrayList<>();\n algsTest = new ArrayList<>();\n for (double i = 0.01; i < 0.51; i+=0.005){\n \tparams2.add(i);\n \tsa = new SimulatedAnnealing(1E1, i, hcp);\n \talgsTest.add(sa);\n }\n newExp.optParams(algsTest, ef, paramName, null, params2, algName, probName);\n \n // test populationSize for GA\n paramName = \"populationSize\";\n algName = \"GA\";\n List<Integer> params1 = new ArrayList<>();\n algsTest = new ArrayList<>();\n for (int i = 10; i < 1001; i+=10){\n \tparams1.add(i);\n \tga = new StandardGeneticAlgorithm(i, 0, 10, gap);\n \talgsTest.add(ga);\n }\n newExp.optParams(algsTest, ef, paramName, params1, null, algName, probName);\n \n // test toMate for GA\n paramName = \"toMate\";\n params1 = new ArrayList<>();\n algsTest = new ArrayList<>();\n for (int i = 0; i < 100; i+=1){\n \tparams1.add(i);\n \tga = new StandardGeneticAlgorithm(200, i, 10, gap);\n \talgsTest.add(ga);\n }\n newExp.optParams(algsTest, ef, paramName, params1, null, algName, probName);\n \n // test toMutate for GA\n paramName = \"toMutate\";\n params1 = new ArrayList<>();\n algsTest = new ArrayList<>();\n for (int i = 10; i < 1001; i+=10){\n \tparams1.add(i);\n \tga = new StandardGeneticAlgorithm(200, 0, i, gap);\n \talgsTest.add(ga);\n }\n newExp.optParams(algsTest, ef, paramName, params1, null, algName, probName);\n \n // test samples for MIMIC\n paramName = \"samples\";\n algName = \"MIMIC\";\n params1 = new ArrayList<>();\n algsTest = new ArrayList<>();\n for (int i = 100; i < 1101; i += 10){\n \tparams1.add(i);\n \tmimic = new MIMIC(i, 10, pop);\n \talgsTest.add(mimic);\n }\n newExp.optParams(algsTest, ef, paramName, params1, null, algName, probName);\n \n // test tokeep for MIMIC\n paramName = \"tokeeep\";\n params1 = new ArrayList<>();\n algsTest = new ArrayList<>();\n for (int i = 1; i < 101; i+=1){\n \tparams1.add(i);\n \tmimic = new MIMIC(200, i, pop);\n \talgsTest.add(mimic);\n }\n newExp.optParams(algsTest, ef, paramName, params1, null, algName, probName);\n \n \n // test different algorithms with various NQueensProblems\n // set up algorithms\n algs = new ArrayList<>();\n ga = new StandardGeneticAlgorithm(150, 98, 70, gap);\n algs.add(rhc);\n algs.add(sa);\n algs.add(ga);\n algs.add(mimic);\n // set up different efs\n List<EvaluationFunction> efs = new ArrayList<>();\n for (int i = 0; i < 50; i++){\n \tef = new NQueensFitnessFunction();\n \tefs.add(ef);\n }\n newExp.voteBest(algs, efs, 2000, probName);\n \n }", "public static int solve() {\n FactorizationSieve sieve = new FactorizationSieve(LIMIT + 1);\n int[] abundants = new int[LIMIT + 1];\n int k = 0;\n\n for (int n = 1; n <= LIMIT; n++)\n if (sieve.sigma(1, n) > n + n)\n abundants[k++] = n;\n\n // Sum pair of abundant numbers\n BitSet absums = new BitSet(LIMIT + 1);\n for (int i = 0; i < k; i++) {\n for (int j = i; j < k; j++) {\n int n = abundants[i] + abundants[j];\n if (n > LIMIT)\n break;\n absums.set(n);\n }\n }\n\n // Find all numbers that cannot be written as the sum of two abundant numbers\n int res = 0;\n for (int n = 1; n <= LIMIT; n++)\n if (!absums.get(n))\n res += n;\n return res;\n }", "private int totalInfeasibility(int[] chromosome) {\n\t\tint infeasibility = 0;\n\t\tint[] bins = new int[binCount];\n\t\tfor (int i = 0; i < chromosome.length; i++) {\n\t\t\tif (chromosome[i] >= bins.length) {\n\t\t\t\tinfeasibility += 10;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tbins[chromosome[i]] += packageWeights[i]; //put package into bin\n\t\t\t} catch (Exception e) {\n\t\t\t\tSystem.out.println(\"noooo\");\n\t\t\t}\n\n\t\t}\n\n\t\tfor (int i = 0; i < bins.length; i++) {\n\t\t\tif (bins[i] > binSize)\n\t\t\t\tinfeasibility += bins[i] - binSize;\n\t\t}\n\t\treturn infeasibility;\n\t}", "public static int zeroOneKnapsack(int[] weight, int[] value, int capacity) {\n\t\tint[][] dp = new int[weight.length + 1][capacity + 1];\n\n\t\tfor (int i = 0; i < weight.length + 1 ; i++) {\n\t\t\t for (int j = 0; j < capacity + 1; j++) {\n\t\t\t\t\n\t\t\t\t // base condition for memoization\n\t\t\t\t // first row and first column for 2d matrix is initialised to 0\n\t\t\t\t // profit = 0 when number of items = 0 or bag capacity = 0 \n\t\t\t\t if (i == 0 || j == 0) { \n\t\t\t\t\t dp[i][j] = 0;\n\t\t\t\t } \n\t\t\t\t \n\t\t\t\t // weight of item under consideration is less than capacity of bag\n\t\t\t\t // value of i in 2d matrix corresponds to (i-1)th element in weight and value arrays\n\t\t\t\t // hence, weight(i-1) is compared with the corresponding matrix cell capacity(i.e.column)\n\t\t\t\t \n\t\t\t\t else if (weight[i-1] <= j){\n\t\t\t\t\t \n\t\t\t\t\t // possibility 1: when item having weight(i-1) is added to bag\n\t\t\t\t\t // item having weight(i-1) has value(i-1)\n\t\t\t\t\t // this value added to array value for (i-1)th row and (j-weight[i-1])th column\n\t\t\t\t\t // because :\n\t\t\t\t\t // 1) the total capacity reduced by weight(i-1) after deciding item inclusion\n\t\t\t\t\t // 2) total no.of elements reduced by 1 after deciding item inclusion\n\t\t\t\t\t \n\t\t\t\t\t int a = value[i-1] + dp[i-1][j-weight[i-1]];\n\t\t\t\t\t \n\t\t\t\t\t// possibility 1: when item having weight(i-1) is not added to bag\n\t\t\t\t\t// 1) the total capacity remains as is after deciding item exclusion\n\t\t\t\t\t// 2) total no.of elements reduced by 1 after deciding item exclusion\n\t\t\t\t\t \n\t\t\t\t\t int b = dp[i-1][j];\n\t\t\t\t\t \n\t\t\t\t\t // max of a and b taken to find maximum profit value \n\t\t\t\t\t dp[i][j] = Math.max(a, b);\t \n\t\t\t\t\t \n\t\t\t\t }\n\t\t\t\t \n\t\t\t\t \n\t\t\t\t // weight of item under consideration is more than capacity of bag\n\t\t\t\t // hence item having weight(i-1) is not added to bag\n\t\t\t\t else {\n\t\t\t\t\t \n\t\t\t\t\t// 1) the total capacity remains as is after deciding item exclusion\n\t\t\t\t\t// 2) total no.of elements reduced by 1 after deciding item exclusion\n\t\t\t\t\t \n\t\t\t\t\t dp[i][j] = dp[i-1][j];\n\t\t\t\t\t \n\t\t\t\t }\n\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn dp[weight.length][capacity];\n\t\t\n\t}", "public void runGenerational() {\n\n\t\tSystem.out.println(\"Runing pure generational demo.\");\n\t\tFunction<BitSet, Double> knapsackFitnessFunction = new KnapsackFitness(capacity, parseElements());\n\t\tSpace<BitSet> space = new BitSetSpace(weights.length);\n\n\t\tGeneticSelector<BitSet, Double> rouletteSelector = new RouletteGeneticSelector<>(POP_SIZE);\n\t\tGeneticCrossover<BitSet, Double> crossover = new BinaryCrossover<>(0.9);\n\t\tGeneticOperator<BitSet, Double> geneticOperator = new CustomGeneticOperator<>(crossover);\n\t\tGeneticReplacement<BitSet, Double> replacement = new GenerationalReplacement<>();\n\t\tTracer.add(Population.class);\n\t\tTracer.start();\n\n\t\tSearch<BitSet, Double> search = new GeneticAlgorithm<>(POP_SIZE, NUM_ITER, rouletteSelector, geneticOperator,\n\t\t\t\treplacement);\n\t\tOptimizationProblem<BitSet, Double> problem = new OptimizationProblem<>(space, knapsackFitnessFunction,\n\t\t\t\tComparator.reverseOrder());\n\t\tSolution<BitSet, Double> foundSolution = search.solve(problem);\n\n\t\tSystem.out.println(String.format(\"Best found solution: %f, bitset: %s\",\n\t\t\t\tknapsackFitnessFunction.calculate(foundSolution.getSolution()), foundSolution.getSolution()));\n\n\t\tBitSet optimalBitSet = parseOptimalBitSet();\n\t\tSystem.out.println(String.format(\"Optimal solution: %f, bitset: %s\",\n\t\t\t\tknapsackFitnessFunction.calculate(optimalBitSet), optimalBitSet));\n\t\tKnapsackMetric metric = new KnapsackMetric();\n\t\tmetric.putDataOfBestInFile(1);\n\t}", "public double[] calcSolution() {\n\t\t\n\t// Call CostFunction object\n\t\tcostFunction.function(position);\n\t\t\n\t\treturn solution;\n\t\t\n\t}", "@Test\n public void applyFitness() {\n final List<TrainingListener> listeners = new ArrayList<>();\n final MockModel model = new MockModel() {\n @Override\n public void setListeners(Collection<TrainingListener> listenersToSet) {\n listeners.clear();\n listeners.addAll(listenersToSet);\n }\n\n @Override\n public void addListeners(TrainingListener... listener) {\n listeners.addAll(Stream.of(listener).collect(Collectors.toList()));\n }\n\n @Override\n public long numParams() {\n return (long)(5* 1e4);\n }\n\n @Override\n public double score() {\n return 1.23451234;\n }\n };\n final FitnessPolicy<ModelAdapter> policy = new FitnessPolicyTraining<>(3);\n final double[] measuredScore = {-1};\n\n policy.apply(new ModelAdapter() {\n @Override\n public void fit(DataSetIterator iter) {\n throw new UnsupportedOperationException(\"Not implemented!\");\n }\n\n @Override\n public <T extends IEvaluation> T[] eval(DataSetIterator iter, T... evals) {\n throw new UnsupportedOperationException(\"Not implemented!\");\n }\n\n @Override\n public Model asModel() {\n return model;\n }\n }, fitness -> measuredScore[0] = fitness);\n\n assertEquals(\"Incorrect number of training listeners\", 1, listeners.size());\n\n // Bleh! Hardcoded knowledge of TrainingListener implementation!\n listeners.forEach(listener -> listener.iterationDone(model, 0, 0));\n listeners.forEach(listener -> listener.onEpochEnd(model));\n assertEquals(\"No fitness shall have been reported!\", -1d, measuredScore[0], 1e-10);\n\n listeners.forEach(listener -> listener.iterationDone(model, 1, 0));\n listeners.forEach(listener -> listener.onEpochEnd(model));\n assertEquals(\"No fitness shall have been reported!\", -1d, measuredScore[0], 1e-10);\n\n listeners.forEach(listener -> listener.iterationDone(model, 2, 0));\n listeners.forEach(listener -> listener.onEpochEnd(model));\n assertEquals(\"Incorrect fitness!\", 1.235005, measuredScore[0], 1e-10);\n }", "public double calculateSatisfaction(){\n\n\t\tdouble satisfaction=0;\n\t\tif(calculateSurveyQuantity()>=10){\n\n\t\t\tfor(int i=0; i<surveys.length; i++){\n\n\t\t\t\tif(surveys[i]!=null){\n\n\t\t\t\t\tsatisfaction+=surveys[i].calculateSatisfaction();\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tsatisfaction/=calculateSurveyQuantity();\n\n\t\t}\n\n\t\treturn satisfaction;\n\n\t}", "static double fitness(vmnode[] vms, jobnode[] jobs, int[] assigned, HashMap<Integer, Integer> map, double[][] ect) {\n double libd = LIBD(vms, jobs, assigned);\n double makesp = calcmakespan(map, ect);\n return libd * makesp;\n }" ]
[ "0.665907", "0.65339607", "0.6525925", "0.651297", "0.64246744", "0.63040453", "0.62073416", "0.6146668", "0.6140747", "0.6131258", "0.612247", "0.60897285", "0.6070355", "0.6062654", "0.6019451", "0.59659135", "0.59429836", "0.59384537", "0.58902526", "0.5869509", "0.58683765", "0.5859353", "0.5841902", "0.5828048", "0.58140504", "0.58087456", "0.58055", "0.57975394", "0.5789395", "0.5779389", "0.5764907", "0.57635975", "0.57611704", "0.5756182", "0.5723345", "0.5716709", "0.57157683", "0.57149523", "0.56986904", "0.5683485", "0.5680118", "0.5653645", "0.56488764", "0.5647546", "0.5645653", "0.5617648", "0.56115323", "0.5603695", "0.55986136", "0.55984265", "0.559503", "0.55870825", "0.55797803", "0.5574696", "0.55702734", "0.5564644", "0.5547347", "0.5538082", "0.5512607", "0.55063474", "0.5480413", "0.54769766", "0.5473227", "0.5470096", "0.54684114", "0.54680073", "0.5457611", "0.545519", "0.5449572", "0.54477024", "0.5438349", "0.54325634", "0.5432109", "0.5429948", "0.5429543", "0.54183036", "0.5418182", "0.5417429", "0.5408515", "0.54083157", "0.54062384", "0.54054034", "0.5404154", "0.5387538", "0.5380703", "0.5379318", "0.5372398", "0.53651536", "0.53648716", "0.53645474", "0.53576183", "0.5356836", "0.534902", "0.53481585", "0.53450966", "0.53390425", "0.53382206", "0.5335663", "0.53343266", "0.5329025", "0.5328064" ]
0.0
-1
RPEntity2DView Get the full directional animation tile set for this entity.
@Override protected Sprite getAnimationSprite() { final SpriteStore store = SpriteStore.get(); ZoneInfo info = ZoneInfo.get(); Sprite sprite; try { final RPEntity npc = entity; final int code = npc.getOutfit(); final String strcode = npc.getExtOutfit(); final OutfitColor color = OutfitColor.get(npc.getRPObject()); if (strcode != null) { sprite = OutfitStore.get().getAdjustedOutfit(strcode, color, info.getZoneColor(), info.getColorMethod()); } else if (code != RPEntity.OUTFIT_UNSET) { final int body = code % 100; final int dress = code / 100 % 100; final int head = (int) (code / Math.pow(100, 2) % 100); final int hair = (int) (code / Math.pow(100, 3) % 100); final int detail = (int) (code / Math.pow(100, 4) % 100); final StringBuilder sb = new StringBuilder(); sb.append("body=" + body); sb.append(",dress=" + dress); sb.append(",head=" + head); sb.append(",hair=" + hair); sb.append(",detail=" + detail); sprite = OutfitStore.get().getAdjustedOutfit(sb.toString(), color, info.getZoneColor(), info.getColorMethod()); } else { // This NPC's outfit is read from a single file. sprite = store.getModifiedSprite(translate("npc/" + entity.getEntityClass()), info.getZoneColor(), info.getColorMethod()); } } catch (final Exception e) { logger.error("Cannot build animations", e); sprite = store.getModifiedSprite(translate(entity.getEntityClass()), info.getZoneColor(), info.getColorMethod()); } return sprite; // return addShadow(sprite); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Animation<TextureRegion> getHeroWalkRight() {\n return heroWalkRight;\n }", "public abstract TiledMapTileSet getTileSet();", "public WorldToScreenTransform getWorldToScreenTransform() { return this; }", "public Projector getVerticalProjector() {\n return (_tile!=null)?_tile.getVerticalProjector():null;\n }", "@NotNull\r\n BlockState[] getTileEntities();", "public Animation<TextureRegion> getHeroWalkDown() {\n return heroWalkDown;\n }", "public Tile[] getAdjs(){\r\n return adjTiles;\r\n }", "public Entity getShoulderEntityRight ( ) {\n\t\treturn extract ( handle -> handle.getShoulderEntityRight ( ) );\n\t}", "public Rect getTileRect(){\n return this.tileRect;\n }", "public Tile getTile() {\n return _tile;\n }", "public Tile getTile() { return tile; }", "public Tile getTile() {\n return tile;\n }", "public Tile getTile() {\n return tile;\n }", "public Tile[][] getTiles() {\n return tiles;\n }", "final Locatable extent ()\n {\n return _goal.extent();\n }", "public SetOfTiles getSetOfTiles();", "public Tiles getTiles() {\n return tiles;\n }", "public Tile[][] getTiles() {\n return tiles;\n }", "public WorldCoord getFrameLinkset()\r\n/* 45: */ {\r\n/* 46: 34 */ return null;\r\n/* 47: */ }", "public final World getWorld() {\n\t\treturn baseTile.getWorld();\n\t}", "public Rectangle2D getView() {\r\n return new Rectangle2D.Double(minX, minY, maxX - minX, maxY - minY);\r\n }", "@Override\n public Tile[][] getGrid() { return grid; }", "public ArrayList<TileView> getTileViewList() {\n\t\treturn tileViewList;\n\t}", "public TextureRegion getStandRight(){\n return standRight;\n }", "public FloorTile getGoalTile() {\r\n return goalTile;\r\n }", "@Override\n protected void buildWorldRepresentation() {\n java.util.List<BasicModelEntity> worldModelEntityList = spaceExplorerModel.getWorldEntityList();\n java.util.List<CSysEntity> viewWorldEntityList = new ArrayList();\n for (int i = 0; i < worldModelEntityList.size(); i++) {\n\n BasicModelEntity basicModelEntity = worldModelEntityList.get(i);\n\n CSysEntity cSysEntity = null;\n if (basicModelEntity instanceof ModelLineEntity) {\n cSysEntity = new SeCSysLineEntity(this, (ModelLineEntity) basicModelEntity);\n cSysEntity.setDrawColor(basicModelEntity.getColor());\n// addWorldEntity(cSysLineEntity);\n } else if (basicModelEntity instanceof ModelPolyLineEntity) {\n cSysEntity = new SeCSysViewPolyLineEntity(this, (ModelPolyLineEntity) basicModelEntity);\n cSysEntity.setDrawColor(basicModelEntity.getColor());\n// addWorldEntity(seCSysViewPolylineEntity);\n }\n viewWorldEntityList.add(cSysEntity);\n }\n\n createAxis(viewWorldEntityList);\n viewWorldEntityArray = viewWorldEntityList.toArray(new BasicCSysEntity[viewWorldEntityList.size()]);\n updateCSysEntList(combinedRotatingMatrix);\n }", "public mat4 getMatrix() {\n return worldMatrix;\n }", "public ArrayList<MahjongSolitaireTile>[][] getTileGrid() \n { \n return tileGrid; \n }", "public static byte[] getGoalTiles() {\n return GOAL_TILES;\n }", "@Override\n\tprotected void loadWalkRight() {\n\t\tthis.walkRight = new Animation(RenderableHolder.getInstance().skullMonsterSprite, frameWidth, frameHeight,\n\t\t\t\twalkFrameCount, 2, 1);\n\t\tthis.walkRight.setOffset(offsetX, offsetY);\n\t\tthis.walkRight.setPosition(this.logicalX, this.logicalY);\n\n\t}", "public ArrayList<Tile> getTiles(){\r\n return tiles;\r\n }", "public boolean[][] getRotateRight() {\n boolean[][] out = new boolean[size][size];\n for(int y = 0; y < size; y++)\n for(int x = 0; x < size; x++)\n out[x][y] = tileLogic[y][size - x - 1];\n return out;\n }", "public double getDirectionView();", "protected final Direction getDirection() {\n\t\treturn tile.getDirection();\n\t}", "public RMAnimator getAnimator() { return getAnimator(false); }", "private Animation inFromRightAnimation() {\n\n Animation inFromRight = new TranslateAnimation(\n Animation.RELATIVE_TO_PARENT, +1.0f,\n Animation.RELATIVE_TO_PARENT, 0.0f,\n Animation.RELATIVE_TO_PARENT, 0.0f,\n Animation.RELATIVE_TO_PARENT, 0.0f );\n\n inFromRight.setDuration(200);\n inFromRight.setInterpolator(new AccelerateInterpolator());\n\n return inFromRight;\n\n }", "public Tile[][] getTileMap(){\r\n\t\treturn tileMap;\r\n\t}", "public OrthogonalTiledMapRenderer getRenderer() {\n\t\treturn renderer; \n\t}", "public ArrayList<TileSet> getTilesets() {\r\n return this.tileSets;\r\n }", "public Animation<TextureRegion> getHeroWalkUp() {\n return heroWalkUp;\n }", "Directions getDirections(){\n return this.dir;\n }", "public Collection<? extends Direction> getDirections ()\r\n {\r\n return directions;\r\n }", "public IAnimationSyncSet getCurrentAnimationSyncSet()\n\t{\n\t\treturn _animationSyncSet;\n\t}", "public Vector2D method_876() {\n return this.field_660;\n }", "Animation getStructure();", "public TileMap getMyTileMap() {\n return this.myTileMap;\n }", "public List<ImageResourceWrapper> getMap() {\n // Declare a new list to hold the rendering info for the physics objects.\n List<ImageResourceWrapper> rtrnResources = new ArrayList<>();\n for(PhysicsEntity physicsEntity : this.physModel.getEntities()) {\n // Get the graphics entity corresponding to the current physics entity.\n GraphicsEntity graphicsEntity = this.graphModel.getEntityByID(physicsEntity.getId());\n String imgResource = graphicsEntity.getImgResId(physicsEntity.getOrientation());\n rtrnResources.add(new ImageResourceWrapper(new Point(physicsEntity.getPosition().x, physicsEntity.getPosition().y), imgResource));\n }\n for(Objective objective : this.gameStateModel.getObjectives()) {\n GraphicsEntity graphicsEntity = this.graphModel.getEntityByID(objective.getId());\n // TODO: Orientation for objectives\n String imgResource = graphicsEntity.getImgResId(0);\n rtrnResources.add(new ImageResourceWrapper(new Point(objective.getPosition().x, objective.getPosition().y), imgResource));\n }\n return rtrnResources;\n }", "public RMTimeline getTimeline() { return getTimeline(false); }", "SurfaceEntity createRoadEntity(Tile tile) {\r\n\t\tSurfaceEntity result = new SurfaceEntity();\r\n\t\tresult.tile = tile;\r\n\t\tresult.tile.alpha = alpha;\r\n\t\tresult.type = SurfaceEntityType.ROAD;\r\n\t\treturn result;\r\n\t}", "public Room[][] getMaze ( )\r\n\t{\r\n\t\treturn maze;\r\n\t}", "public Tile[] generateTiles() {\n return null;\n }", "@Override\n\tprotected void loadAttackRight() {\n\t\tthis.attackRight = new SequenceAnimation(RenderableHolder.getInstance().skullMonsterSprite, frameWidth,\n\t\t\t\tframeHeight, attackFrameCount, 2, 2);\n\t\tthis.attackRight.setOffset(offsetX, offsetY);\n\t\tthis.attackRight.setPosition(this.logicalX, this.logicalY);\n\n\t}", "@Override\r\n\tpublic Trajectory getRightTrajectory() {\n\t\treturn right;\r\n\t}", "TileLevelController getTileLevelController();", "public Creature[][] getGrid()\n\t{\n\t\treturn grid;\n\t}", "public Projectile getArrow() {\r\n return entity;\r\n }", "@Override\r\n protected Matrix4f genViewMatrix() {\r\n\r\n // refreshes the position\r\n position = calcPosition();\r\n\r\n // calculate the camera's coordinate system\r\n Vector3f[] coordSys = genCoordSystem(position.subtract(center));\r\n Vector3f right, up, forward;\r\n forward = coordSys[0];\r\n right = coordSys[1];\r\n up = coordSys[2];\r\n\r\n // we move the world, not the camera\r\n Vector3f position = this.position.negate();\r\n\r\n return genViewMatrix(forward, right, up, position);\r\n }", "public Vector2 getUnprojected() {\n return unprojected;\n }", "@Override\n\tprotected void loadIdleRight() {\n\t\tthis.idleRight = new Animation(RenderableHolder.getInstance().skullMonsterSprite, frameWidth, frameHeight,\n\t\t\t\tidleFrameCount, 2, 0);\n\t\tthis.idleRight.setOffset(offsetX, offsetY);\n\t\tthis.idleRight.setPosition(this.logicalX, this.logicalY);\n\n\t}", "public godot.wire.Wire.Transform2D.Builder getTransform2DValueBuilder() {\n return getTransform2DValueFieldBuilder().getBuilder();\n }", "public TilesManager getTilesManager() {\n return this.tilesManager;\n }", "@Override\n\tpublic BlockState[] getTileEntities()\n\t{\n\t\tthrow new UnimplementedOperationException();\n\t}", "public ArrayList<MahjongSolitaireTile> getStackTiles()\n {\n return stackTiles;\n }", "@NotNull\n @Override\n public AABB getRenderBoundingBox() {\n Direction frameDirection = getFrameDirection();\n return frameDirection == null ? new AABB(worldPosition, worldPosition.offset(1, 1, 1)) : getTeleporterBoundingBox(frameDirection);\n }", "public BufferedImage getDrawable(){\n\t\tif(this.isOilContamination()){\n\t\t\treturn this.myFlyweight.getDeadDrawable();\n\t\t}\n\t\t//check direction -- such a horrible way to write a method\n\t\t//redundant checking and ugh.... design this away please...........................\n\t\tif(this.getDirection().getX() > 0 && !this.myFlyweight.getMovingBackAnimationSequence().isEmpty()){\n\t\t\treturn this.myFlyweight.getMovingBackAnimationSequence().get(animationFrame);\n\t\t}\n\t\treturn this.myFlyweight.getAnimationSequence().get(animationFrame);\n\t}", "public Map<IGridRobot, GridCell> getRobot2Dest(){\n \treturn this.robot2dest;\n }", "public Direction reverse()\n {\n return new Direction(dirInDegrees + (FULL_CIRCLE / 2));\n }", "public Animation<TextureRegion> getHeroDying() {\n return heroDying;\n }", "public List<Tile> getPathSegment() {\n return pathSegment;\n }", "public Tile getTile() {\n\t\treturn tile;\n\t}", "public LivingEntity getLivingEntity() {\n return eliteMob;\n }", "TileRenderProperties getTileRenderProperties();", "private Animation inFromRightAnimation(){\r\n\t\tAnimation inFromRight = new TranslateAnimation(\r\n\t\tAnimation.RELATIVE_TO_PARENT, +1.0f,\r\n\t\tAnimation.RELATIVE_TO_PARENT, 0.0f,\r\n\t\tAnimation.RELATIVE_TO_PARENT, 0.0f,\r\n\t\tAnimation.RELATIVE_TO_PARENT, 0.0f);\r\n\t\tinFromRight.setDuration(350);\r\n\t\tinFromRight.setInterpolator(new AccelerateInterpolator());\r\n\t\treturn inFromRight;\r\n\t}", "Entity getShooter();", "@Override\n\tpublic Mat GetTranslateMatrix()\n\t{\n\t\treturn mT;\n\t}", "public MyAnimation getRearSprite();", "public int[][] getworld(){\n return world;\n }", "public final View mo67902d() {\n View view = this.itemView;\n C7573i.m23582a((Object) view, \"itemView\");\n return view;\n }", "public Class<? extends TileEntity> getTileEntity() {\n return this.tileEntity;\n }", "public Vector2D method_878() {\n return this.field_661;\n }", "@Nullable\n public Direction frameDirection() {\n if (frameDirection == null) {\n return getFrameDirection();\n }\n return frameDirection;\n }", "public RMAnimator getChildAnimator() { return getChildAnimator(false); }", "public Tile getTile(){\n\t\treturn currentTile;\n\t}", "public Position reverseBoard()\n {\n return this;\n }", "@JSProperty(\"right\")\n @Nullable\n Chart3dFrameRightOptions getRight();", "public List<Tile> getRoute() {\n List<Tile> currentRoute = new ArrayList<Tile>();\n for (int i = 0; i < route.size(); i++) {\n currentRoute.add(route.get(i));\n }\n return currentRoute;\n }", "public Vector2 Origin() {\r\n return new Vector2(Animation().FrameWidth() / 2.0f, Animation().FrameHeight());\r\n }", "public WorldImage draw() {\n return new OverlayImage(\n new Stem(this.leftLength, this.leftTheta, this.left).draw(),\n new Stem(this.rightLength, this.rightTheta, this.right).draw()); \n }", "@Override\r\n\tpublic MoveRightCommand getRight() {\n\t\treturn null;\r\n\t}", "private ArrayList<StoryItemUnit> getAdapter() {\n return ((TwitterTimeLineFlipAdapter) mAdapter).getAdapter();\r\n }", "public Level getWorld() {\r\n return this;\r\n }", "public ArrayList<Tile> getDeckTiles() {\n\t\treturn tileDeck.getDeck();\n\t}", "public MapEntity getTileAt(IntVector2D v) {\n\t\tif(v == null)\n\t\t\treturn null;\n\t\treturn getTileAt(v.getX(), v.getY());\n\t}", "public Direction toRight()\n {\n return new Direction(dirInDegrees + (FULL_CIRCLE / 4));\n }", "public List<Tile> getOwnedTiles() {\n return new ArrayList<Tile>(ownedTiles);\n }", "@Nonnull\n Texture getWorldMap();", "public void getTile_B8();", "public Location getLocation() {\n return ((Location) tile);\n }", "public interface Entity {\r\n\r\n /**\r\n * Gets the initial (relative, map) position of the entity.\r\n * \r\n * @return the initial position of the player\r\n */\r\n Pair<Integer, Integer> getInitialPosition();\r\n\r\n /**\r\n * Gets the position of the entity on screen (absolute, pixel).\r\n * \r\n * @return entity current position on screen\r\n */\r\n Pair<Integer, Integer> getPosition();\r\n\r\n /**\r\n * Sets the position of the entity on screen.\r\n * Can be used to change an absolute position (that is grid locked because they're a multiple of a value) \r\n * to a specific position and place an object everywhere you want\r\n * \r\n * Please check {@link TestEntity} for an in-depth explanation of how this works.\r\n * \r\n * @param position defines the entity position on screen\r\n */\r\n void setPosition(Pair<Integer, Integer> position);\r\n\r\n /**\r\n * Gets the hitbox of the entity (a Rectangle if it's solid, null otherwise).\r\n * \r\n * @return the collision box of the entity.\r\n */\r\n Rectangle getCollisionBox();\r\n\r\n /**\r\n * Gets the path of the image that will be used by the view. \r\n * \r\n * @return the path where the image of the entity is located\r\n */\r\n String getImagePath();\r\n\r\n /**\r\n * Sets the path of the image that will be used by the view.\r\n * \r\n * @param path the path where the image of the entity is located\r\n */\r\n void setImagePath(String path);\r\n\r\n /**\r\n * Method that defines if the entity is destroyed or not.\r\n * \r\n * @return true if destroyed, false otherwise\r\n */\r\n boolean isDestroyed();\r\n\r\n /**\r\n * Sets the status of the entity (true if destroyed, false otherwise).\r\n * \r\n * @param destroyed defines if the entity has been destroyed or not\r\n */\r\n void setStatus(boolean destroyed);\r\n\r\n /**\r\n * Gets the entity width.\r\n * \r\n * @return entity width\r\n */\r\n int getWidth();\r\n\r\n /**\r\n * Sets the new entity width.\r\n * \r\n * @param width defines the new entity width\r\n */\r\n void setWidth(int width);\r\n\r\n /**\r\n * Gets the entity height.\r\n * \r\n * @return entity height\r\n */\r\n int getHeight();\r\n\r\n /**\r\n * Sets the new entity height.\r\n * \r\n * @param height defines the new entity width\r\n */\r\n void setHeight(int height);\r\n\r\n /**\r\n * Return the state of the block, if it is solid or not.\r\n * @return true if entity is solid, false otherwise.\r\n */\r\n boolean isSolid();\r\n\r\n /**\r\n * Sets the score value of the entity.\r\n * \r\n * @param scoreValue defines the value that will be given (added) to players score when the entity is destroyed\r\n */\r\n void setScoreValue(int scoreValue);\r\n\r\n /**\r\n * Gets the score value of the entity.\r\n * \r\n * @return a score value that defines the value of the entity\r\n */\r\n int getScoreValue();\r\n}", "@Nullable\n public SlideOutTransition getSlideOut() {\n if (mImpl.hasSlideOut()) {\n return SlideOutTransition.fromProto(mImpl.getSlideOut());\n } else {\n return null;\n }\n }" ]
[ "0.5556786", "0.549701", "0.5194212", "0.5151242", "0.5131139", "0.50964403", "0.5092022", "0.50833064", "0.5046017", "0.5035386", "0.50278413", "0.4995077", "0.4995077", "0.49932295", "0.4983873", "0.4974328", "0.49530393", "0.49523446", "0.4902118", "0.4892647", "0.48922697", "0.4873858", "0.48390794", "0.48109502", "0.48051563", "0.47915235", "0.47901705", "0.47776648", "0.47658226", "0.47495964", "0.47481963", "0.4733836", "0.4714231", "0.4712786", "0.4706513", "0.4696557", "0.46864864", "0.4682572", "0.46814698", "0.46736243", "0.46661893", "0.46629268", "0.46437538", "0.46367782", "0.4631114", "0.46190837", "0.46155283", "0.46067855", "0.45924872", "0.45901194", "0.45862478", "0.45759094", "0.4565609", "0.4556697", "0.4556294", "0.45547011", "0.4553239", "0.45525464", "0.4543484", "0.45433167", "0.4537073", "0.45071405", "0.4502253", "0.44911957", "0.44887134", "0.4486018", "0.448252", "0.4473984", "0.44729054", "0.44719893", "0.44673213", "0.4466328", "0.44653848", "0.44620708", "0.44614264", "0.44586796", "0.44578245", "0.44507542", "0.44471774", "0.4436752", "0.4432978", "0.44319987", "0.44280693", "0.44277686", "0.4427054", "0.4420874", "0.44103274", "0.44065621", "0.44053075", "0.44022912", "0.43997917", "0.4396792", "0.43855488", "0.43813214", "0.43802088", "0.4375102", "0.43723738", "0.43703568", "0.43624976", "0.4360406" ]
0.44508094
77
Get the appropriate idea sprite.
private Sprite getIdeaSprite() { final String idea = entity.getIdea(); if (idea == null) { return null; } return SpriteStore.get().getSprite( "data/sprites/ideas/" + idea + ".png"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Image sprite(){\n\t\treturn (face);\n\t}", "protected abstract void chooseSprite();", "public Sprite getSprite(String ref) {\n\t\tif (ref.equals(\"boss\")) {\n\t\t\treturn sprite.get(\"bossSprite\");\n\t\t} else if (ref.equals(\"boss_bullet\")) {\n\t\t\treturn sprite.get(\"bossBulletSprite\");\n\t\t} else if (ref.equals(\"boss_explosion\")) {\n\t\t\treturn sprite.get(\"bossExplosionSprite\");\n\t\t} else if (ref.equals(\"boss_hit\")) {\n\t\t\treturn sprite.get(\"bossHitSprite\");\n\t\t} else if (ref.equals(\"bullet\")) {\n\t\t\treturn sprite.get(\"bulletSprite\");\n\t\t} else if (ref.equals(\"enemy_bullet\")) {\n\t\t\treturn sprite.get(\"enemyBulletSprite\");\n\t\t} else if (ref.equals(\"enemy_explosion\")) {\n\t\t\treturn sprite.get(\"enemyExplosionSprite\");\n\t\t} else if (ref.equals(\"enemy_hit\")) {\n\t\t\treturn sprite.get(\"enemyHitSprite\");\n\t\t} else if (ref.equals(\"green_box\")) {\n\t\t\treturn sprite.get(\"greenBoxSprite\");\n\t\t} else if (ref.equals(\"laser\")) {\n\t\t\treturn sprite.get(\"laserSprite\");\n\t\t} else if (ref.equals(\"player\")) {\n\t\t\treturn sprite.get(\"playerSprite\");\n\t\t} else if (ref.equals(\"player_explosion\")) {\n\t\t\treturn sprite.get(\"playerExplosionSprite\");\n\t\t} else if (ref.equals(\"player_hit\")) {\n\t\t\treturn sprite.get(\"playerHitSprite\");\n\t\t} else if (ref.equals(\"powerup_explosion\")) {\n\t\t\treturn sprite.get(\"powerupExplosionSprite\");\n\t\t} else if (ref.equals(\"red_box\")) {\n\t\t\treturn sprite.get(\"redBoxSprite\");\n\t\t} else {\n\t\t\tSystem.out.println(\"fatal error\");\n\t\t\tSystem.out.println(ref);\n\t\t\treturn null;\n\t\t}\n\t}", "public Java2DSprite getSprite(Image ref) {\r\n\t\tif (window == null) {\r\n\t\t\tthrow new RuntimeException(\"Attempt to retrieve sprite before game window was created\");\r\n\t\t}\r\n\t\treturn new Java2DSprite((Java2DGameWindow) window,ref);\r\n\t}", "@Override\n public Sprite getHurtSprite() {\n return Assets.getInstance().getSprite(\"entity/zombie_blood0.png\");\n }", "public Sprite getCurrentSprite() {\n\t\tif (this.getVx() <= 0) {\n\t\t\treturn getImages()[0];\n\t\t}\n\t\treturn getImages()[1];\n\t}", "public Sprite getSprite() {\n\t\treturn image;\n\t}", "@Override\n\tpublic final Sprite getSprite() {\n\t\treturn this.sprite;\n\t}", "public synchronized Sprite getSprite(String ref) {\n\t\t// if we've already got the sprite in the cache\n\t\t// then just return the existing version\n\t\tif (sprites.get(ref) != null) {\n\t\t\treturn sprites.get(ref);\n\t\t}\n\t\t\n\t\t// otherwise, go away and grab the sprite from the resource\n\t\t// loader\n\t\t\n\t\t// The ClassLoader.getResource() ensures we get the sprite\n\t\t// from the appropriate place, this helps with deploying the game\n\t\t// with things like webstart. You could equally do a file look\n\t\t// up here.\n\t\ttry (InputStream imgStr = this.getClass().getClassLoader().getResourceAsStream(ref)) {\n\t\t\tif (imgStr == null) {\n\t\t\t\tfail(\"Can't find ref: \"+ref);\n\t\t\t}\n\t\t\t\n\t\t\t// use ImageIO to read the image in\n\t\t\t// create a sprite, add it the cache then return it\n\t\t\tSprite sprite = new Sprite(new Image(imgStr));\n\t\t\t\n\t\t\tsprites.put(ref,sprite);\n\t\t\tnewSprites.put(ref, sprite);\n\t\t\t\n\t\t\treturn sprite;\n\t\t} catch (IOException e) {\n\t\t\tthrow new UncheckedIOException(e);\n\t\t}\n\t\t\n\t}", "public MyAnimation getSprite();", "private void chooseSprite()\r\n\t{\r\n\t\t//Ensure pedestrian sprites exist\r\n\t\tif (sprites.isEmpty()) {\r\n\t\t\tSystem.err.println(\"ERROR: No pedestrian sprites have been loaded\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t//Select a random sprite\r\n\t\tint index = (int) Math.floor( Math.random()*sprites.size() );\r\n\t\tspriteName = sprites.get(index);\r\n\t\tsetSprite(\"pedestrians/\"+spriteName);\r\n\t}", "public BufferedImage getSpriteImage(String ref) {\n\t\treturn sprites.get(ref);\n\t}", "public Sprite getSprite()\n\t{\n\t\treturn sprite;\n\t}", "@Override\r\n protected void chooseSprite() {\r\n switch(_direction) {\r\n case 0:\r\n case 1:\r\n if(_moving)\r\n _sprite = Sprite.movingSprite(Sprite.stupid_right1, Sprite.stupid_right2, Sprite.stupid_right3, _animate, 60);\r\n else\r\n _sprite = Sprite.stupid1;\r\n break;\r\n case 2:\r\n case 3:\r\n if(_moving)\r\n _sprite = Sprite.movingSprite(Sprite.stupid1, Sprite.stupid2, Sprite.stupid3, _animate, 60);\r\n else\r\n _sprite = Sprite.stupid1;\r\n break;\r\n }\r\n }", "ImageView getRepresentationFromSpriteId(int spriteId);", "public MyAnimation getFrontSprite();", "public Sprite getSprite() {\n\t\tlong currTime = System.currentTimeMillis();\n\t\tif(currTime - lastUpdate > timeEach) {\n\t\t\tlastUpdate = currTime;\n\t\t\tcurrSprite++;\n\t\t\tif(currSprite >= sprites.length)\n\t\t\t\tcurrSprite = 0;\n\t\t}\n\t\treturn sprites[currSprite];\n\t}", "public Sprite getSprite(String spriteName)\n {\n if (this.sprites.containsKey(spriteName))\n return this.sprites.get(spriteName);\n else\n {\n \tSystem.out.println(\"Sprite \" + spriteName + \"does not exist in the bank\");\n return null;\n }\n }", "public Sprite getSprite() {\n\t\treturn sprite;\n\t}", "public Sprite getSprite() {\n\t\treturn sprite;\n\t}", "public Image getImage(String token) {\n\t\tImage image = spriteMap.get(token);\n\t\tif (image == null) {\n\t\t\tSystem.out.println(\"null image on input \" + token);\n\t\t}\n\t\treturn image;\n\t}", "public static ImageIcon getSprite(String name)\n\t{\n\t\tImageIcon img = sprites.get(name);\n\t\tif (img == null)\n\t\t{\n\t\t\tDebug.println(\"Image \"+name+ \" loaded\");\n\t\t\ttry{\n\t\t\t\tURL url = new URL(\"https://deanattali.com/files/java/Scrabble/\" + name);\n\t\t\t img = new ImageIcon(url);\n\t\t\t}catch(Exception ex){}\n\t\t\tsprites.put(name,img);\n\t\t}\n\n\t\treturn img;\n\t}", "public static Bitmap GetDealSpriteBitmap()\r\n\t{\r\n\t\t// Load background desktop image from resouce\r\n\t\tBitmap image = null;\r\n\t\tif(CGameHelper.m_GameContext != null)\r\n\t\t{\r\n\t\t\tResources res = CGameHelper.m_GameContext.getResources();\r\n\t\t\tif(res == null)\r\n\t\t\t\treturn image; \r\n\r\n\t\t\tif(m_DealSpriteBitmap == null)\r\n\t\t\t{\r\n\t\t\t\tm_DealSpriteBitmap = BitmapFactory.decodeResource(res, R.drawable.face);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\timage = m_DealSpriteBitmap;\r\n\t\t} \r\n\t\treturn image;\r\n\t}", "@Override\n\tpublic final Image getImage() {\n\t\treturn this.getSprite().getImage();\n\t}", "private int getInstr(int index) {\n switch (index) {\n case 0:\n return R.drawable.chickpeacurry;\n case 1:\n return R.drawable.sweetpotatoblackbeanburger;\n case 2:\n return R.drawable.cabbagedietsoup;\n case 3:\n return R.drawable.instantpotvegetablesoup;\n case 4:\n return R.drawable.veganpumpkinsoup;\n\n default:\n return -1;\n }\n }", "public Sprite getBattleSprite()\n {\n return battleSprite;\n }", "public Image getBulletImg(){ \n return SpriteSheet.playerProjectileSprites[this.frameNumber]; \n }", "public MyAnimation getRearSprite();", "public int getSpriteID() {\n return spriteID;\n }", "public int getSpriteStandard()\n\t{\n\t\treturn this.spriteStandard;\n\t}", "@Override\n public void chooseSprite() {\n switch(direction){\n case 0:\n sprite=Sprite.python_down;\n if(moving)\n sprite=Sprite.movingSprite(Sprite.python_down,Sprite.python_down_1,Sprite.python_down_2,Sprite.python_down_3,animate,40);\n break;\n case 1:\n sprite=Sprite.python_right;\n if(moving)\n sprite=Sprite.movingSprite(Sprite.python_right,Sprite.python_right_1,Sprite.python_right_2,animate,40);\n break;\n case 2:\n sprite=Sprite.python_up;\n if(moving)\n sprite=Sprite.movingSprite(Sprite.python_up,Sprite.python_up_1,Sprite.python_up_2,animate,40);\n break;\n case 3:\n sprite=Sprite.python_left;\n if(moving)\n sprite=Sprite.movingSprite(Sprite.python_left,Sprite.python_left_1,Sprite.python_left_2,animate,40);\n break;\n\n\n }\n\n }", "private TextureAtlasSprite getActiveTexture() {\n TextureAtlasSprite activeTexture = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();\n if (texture instanceof TextureBase.Sprite) {\n TextureBase.Sprite sprite = (TextureBase.Sprite) texture;\n activeTexture = sprite.icon;\n } else if (texture instanceof TextureBase.Proxy) {\n TextureBase.Proxy proxySprite = (TextureBase.Proxy) texture;\n if (proxySprite.base instanceof TextureBase.Sprite) {\n activeTexture = ((TextureBase.Sprite) proxySprite.base).icon;\n }\n }\n\n return activeTexture;\n }", "abstract public void loadSprite();", "public Image getSpriteImage(Sprite sprite){\n if(sprite == null){\n return sprites.get(1);\n }\n return sprites.get(sprite.getSpriteIndex());\n }", "@Override\n\tpublic SpriteType getSpriteType() {\n\t\tif (isFinish) {\n\t\t\treturn SpriteType.FINISH_POINT;\n\t\t}\n\t\treturn SpriteType.BEGIN_POINT;\n\t}", "@Override\n\tprotected Sprite getAnimationSprite() {\n\t\tfinal SpriteStore store = SpriteStore.get();\n\t\tZoneInfo info = ZoneInfo.get();\n\n\t\tSprite sprite;\n\n\t\ttry {\n\t\t\tfinal RPEntity npc = entity;\n\t\t\tfinal int code = npc.getOutfit();\n\t\t\tfinal String strcode = npc.getExtOutfit();\n\n\t\t\tfinal OutfitColor color = OutfitColor.get(npc.getRPObject());\n\n\t\t\tif (strcode != null) {\n\t\t\t\tsprite = OutfitStore.get().getAdjustedOutfit(strcode, color, info.getZoneColor(), info.getColorMethod());\n\t\t\t} else if (code != RPEntity.OUTFIT_UNSET) {\n\t\t\t\tfinal int body = code % 100;\n\t\t\t\tfinal int dress = code / 100 % 100;\n\t\t\t\tfinal int head = (int) (code / Math.pow(100, 2) % 100);\n\t\t\t\tfinal int hair = (int) (code / Math.pow(100, 3) % 100);\n\t\t\t\tfinal int detail = (int) (code / Math.pow(100, 4) % 100);\n\n\t\t\t\tfinal StringBuilder sb = new StringBuilder();\n\t\t\t\tsb.append(\"body=\" + body);\n\t\t\t\tsb.append(\",dress=\" + dress);\n\t\t\t\tsb.append(\",head=\" + head);\n\t\t\t\tsb.append(\",hair=\" + hair);\n\t\t\t\tsb.append(\",detail=\" + detail);\n\n\t\t\t\tsprite = OutfitStore.get().getAdjustedOutfit(sb.toString(), color, info.getZoneColor(),\n\t\t\t\t\t\tinfo.getColorMethod());\n\t\t\t} else {\n\t\t\t\t// This NPC's outfit is read from a single file.\n\t\t\t\tsprite = store.getModifiedSprite(translate(\"npc/\"\n\t\t\t\t\t\t+ entity.getEntityClass()), info.getZoneColor(),\n\t\t\t\t\t\tinfo.getColorMethod());\n\t\t\t}\n\t\t} catch (final Exception e) {\n\t\t\tlogger.error(\"Cannot build animations\", e);\n\t\t\tsprite = store.getModifiedSprite(translate(entity.getEntityClass()),\n\t\t\t\t\tinfo.getZoneColor(), info.getColorMethod());\n\t\t}\n\n\t\treturn sprite;\n//\t\treturn addShadow(sprite);\n\t}", "Sprite getBackground();", "@Override\n\tpublic SpriteType getSpriteType() {\n\t\treturn null;\n\t}", "@Override\r\n\tpublic Image getImg(int code) {\n\t\treturn seasons[myTime.getDate()[1]][code].getImage();\r\n\t}", "public SpriteBase getSpriteBase() {\n return spriteBase;\n }", "java.lang.String getGameIconUrl();", "private static Image getAttackPoint()\n\t{\n\t\ttry {\n\t\t\treturn ImageIO.read(new File(guiDirectory + attack));\n\t\t} catch (IOException ioe) {\n\t\t}\n\t\treturn null;\n\t}", "private String getRef(int id)\n {\n if (id == 0)\n {\n return \"Sprites/Tile0.gif\";\n }\n else if (id == 1)\n {\n return \"Sprites/PlayerBack.gif\";\n }\n else if (id == 2)\n {\n return \"Sprites/PlayerFront.gif\";\n }\n else if (id == 3)\n {\n return \"Sprites/PlayerLeft.gif\";\n }\n else if (id == 4)\n {\n return \"Sprites/PlayerRight.gif\";\n }\n else if (id == 5)\n {\n return \"Sprites/PlayerBackRun.gif\";\n }\n else if (id == 6)\n {\n return \"Sprites/PlayerFrontRun.gif\";\n }\n else if (id == 7)\n {\n return \"Sprites/PlayerLeftRun.gif\";\n }\n else if (id == 8)\n {\n return \"Sprites/PlayerRightRun.gif\";\n }\n else if (id == 9)\n {\n return \"Sprites/PlayerBackAttack.gif\";\n }\n else if (id == 10)\n {\n return \"Sprites/PlayerFrontKnife.gif\";\n }\n else if (id == 11)\n {\n return \"Sprites/PlayerLeftKnife.gif\";\n }\n else if (id == 12)\n {\n return \"Sprites/PlayerRightKnife.gif\";\n }\n else if (id == 13)\n {\n return \"Sprites/PlayerFrontPistol.gif\";\n }\n else if (id == 14)\n {\n return \"Sprites/PlayerLeftPistol.gif\";\n }\n else if (id == 15)\n {\n return \"Sprites/PlayerRightPistol.gif\";\n }\n else if (id == 16)\n {\n return \"Sprites/PlayerFrontAR.gif\";\n }\n else if (id == 17)\n {\n return \"Sprites/PlayerLeftAR.gif\";\n }\n else if (id == 18)\n {\n return \"Sprites/PlayerRightAR.gif\";\n }\n else if (id == 19)\n {\n return \"Sprites/LightGuardBack.gif\";\n }\n else if (id == 20)\n {\n return \"Sprites/LightGuardFront.gif\";\n }\n else if (id == 21)\n {\n return \"Sprites/LightGuardLeft.gif\";\n }\n else if (id == 22)\n {\n return \"Sprites/LightGuardRight.gif\";\n }\n else if (id == 23)\n {\n return \"Sprites/LightGuardBackRun.gif\";\n }\n else if (id == 24)\n {\n return \"Sprites/LightGuardFrontRun.gif\";\n }\n else if (id == 25)\n {\n return \"Sprites/LightGuardLeftRun.gif\";\n }\n else if (id == 26)\n {\n return \"Sprites/LightGuardRightRun.gif\";\n }\n else if (id == 27)\n {\n return \"Sprites/MediumGuardBack.gif\";\n }\n else if (id == 28)\n {\n return \"Sprites/MediumGuardFront.gif\";\n }\n else if (id == 29)\n {\n return \"Sprites/MediumGuardLeft.gif\";\n }\n else if (id == 30)\n {\n return \"Sprites/MediumGuardRight.gif\";\n }\n else if (id == 31)\n {\n return \"Sprites/MediumGuardBackRun.gif\";\n }\n else if (id == 32)\n {\n return \"Sprites/MediumGuardFrontRun.gif\";\n }\n else if (id == 33)\n {\n return \"Sprites/MediumGuardLeftRun.gif\";\n }\n else if (id == 34)\n {\n return \"Sprites/MediumGuardRightRun.gif\";\n }\n else if (id == 35)\n {\n return \"Sprites/HeavyGuardBack.gif\";\n }\n else if (id == 36)\n {\n return \"Sprites/HeavyGuardFront.gif\";\n }\n else if (id == 37)\n {\n return \"Sprites/HeavyGuardLeft.gif\";\n }\n else if (id == 38)\n {\n return \"Sprites/HeavyGuardRight.gif\";\n }\n else if (id == 39)\n {\n return \"Sprites/HeavyGuardBackRun.gif\";\n }\n else if (id == 40)\n {\n return \"Sprites/HeavyGuardFrontRun.gif\";\n }\n else if (id == 41)\n {\n return \"Sprites/HeavyGuardLeftRun.gif\";\n }\n else if (id == 42)\n {\n return \"Sprites/HeavyGuardRightRun.gif\";\n }\n else if (id == 43)\n {\n return \"Sprites/water1.jpg\"; //was Water.gif\n }\n else if (id == 44)\n {\n return \"Sprites/sand.jpg\"; //was Sand.gif\n }\n else if (id == 45)\n {\n return \"Sprites/tallgrass.png\"; //was TallGrass.gif\n }\n else if (id == 46)\n {\n return \"Sprites/gate.gif\";\n }\n else if (id == 47)\n {\n return \"Sprites/tree.gif\";\n }\n else if (id == 48)\n {\n return \"Sprites/bricks.gif\";\n }\n else if (id == 49)\n {\n return \"Sprites/HorizontalPipes.gif\";\n }\n else if (id == 50)\n {\n return \"Sprites/VerticalPipes.gif\";\n }\n else if (id == 51)\n {\n return \"Sprites/Concrete2.gif\";\n }\n else if (id == 52)\n {\n return \"Sprites/RockWall.gif\";\n }\n else if (id == 53)\n {\n return \"Sprites/SimpleConcrete.gif\";\n }\n else if (id == 54)\n {\n return \"Sprites/DryWall.gif\";\n }\n else if (id == 55)\n {\n return \"Sprites/IndoorFloorTile.gif\";\n }\n else if (id == 56)\n {\n return \"Sprites/woodfloor.png\";\n }\n else if (id == 57)\n {\n return \"Sprites/Door.gif\";\n }\n else if (id == 58)\n {\n return \"Sprites/SecurityDoor.gif\";\n }\n else if (id == 59)\n {\n return \"Sprites/SecurityDoorOpen.gif\";\n }\n else if (id == 60)\n {\n return \"Sprites/VerticalRoadCenter.gif\";\n }\n else if (id == 61)\n {\n return \"Sprites/HorizontalRoadCenter.gif\";\n }\n else if (id == 62)\n {\n return \"Sprites/HorizontalRoadSideLeft.gif\";\n }\n else if (id == 63)\n {\n return \"Sprites/HorizontalRoadSideRight.gif\";\n }\n else if (id == 64)\n {\n return \"Sprites/VerticalRoadSideLeft.gif\";\n }\n else if (id == 65)\n {\n return \"Sprites/VerticalRoadSideRight.gif\";\n }\n else if (id == 66)\n {\n return \"Sprites/RoadSideLowerLeftCorner.gif\";\n }\n else if (id == 67)\n {\n return \"Sprites/RoadSideLowerRightCorner.gif\";\n }\n else if (id == 68)\n {\n return \"Sprites/RoadSideUpperLeftCorner.gif\";\n }\n else if (id == 69)\n {\n return \"Sprites/RoadSideUpperRightCorner.gif\";\n }\n else if (id == 70)\n {\n return \"Sprites/HealthKit.gif\";\n }\n else if (id == 71)\n {\n return \"Sprites/Pistol.png\";\n }\n else if (id == 72)\n {\n return \"Sprites/Silencer.gif\";\n }\n else if (id == 73)\n {\n return \"Sprites/AR.png\";\n }\n else if (id == 74)\n {\n return \"Sprites/Ammo.gif\";\n }\n else if (id == 75)\n {\n return \"Sprites/Cardkey1.gif\";\n }\n else if (id == 76)\n {\n return \"Sprites/Cardkey2.gif\";\n }\n else if (id == 77)\n {\n return \"Sprites/Cardkey3.gif\";\n }\n else if (id == 78)\n {\n return \"Sprites/grass.jpg\"; //Was Grass.gif\n }\n else if (id == 79)\n {\n return \"Sprites/snow.jpg\"; //Was Snow.gif\n }\n else if (id == 80)\n {\n return \"Sprites/fancyfloor2.png\";\n }\n else if (id == 81)\n {\n return \"Sprites/IndoorFloorTile3.gif\";\n }\n else if (id == 82)\n {\n return \"Sprites/whitetiles.png\";\n }\n else if (id == 83)\n {\n return \"Sprites/water2.jpg\"; //Was NightWater.gif\n }\n else if (id == 84)\n {\n return \"Sprites/grass2.jpg\"; //Was NightSand.gif\n }\n else if (id == 85)\n {\n return \"Sprites/LadderUp.gif\";\n }\n else if (id == 86)\n {\n return \"Sprites/LadderDown.gif\";\n }\n else if (id == 87)\n {\n return \"Sprites/ShadowTrail.gif\"; //Was WaterTrail.gif\n }\n else if (id == 88)\n {\n return \"Sprites/PlayerBackCrawl.gif\";\n }\n else if (id == 89)\n {\n return \"Sprites/PlayerFrontCrawl.gif\";\n }\n else if (id == 90)\n {\n return \"Sprites/PlayerLeftCrawl.gif\";\n }\n else if (id == 91)\n {\n return \"Sprites/PlayerRightCrawl.gif\";\n }\n else if (id == 92)\n {\n return \"Sprites/PlayerBackCrawling.gif\";\n }\n else if (id == 93)\n {\n return \"Sprites/PlayerFrontCrawling.gif\";\n }\n else if (id == 94)\n {\n return \"Sprites/PlayerLeftCrawling.gif\";\n }\n else if (id == 95)\n {\n return \"Sprites/PlayerRightCrawling.gif\";\n }\n else if (id == 96)\n {\n return \"Sprites/BoosterPack.gif\";\n }\n else if (id == 97)\n {\n return \"Sprites/desert.jpg\"; //was DesertGround.gif\n }\n else if (id == 98)\n {\n return \"Sprites/duct.png\";\n }\n else if (id == 99)\n {\n return \"Sprites/pinetreetop.png\";\n }\n else if (id == 100)\n {\n return \"Sprites/pinetreebottom.png\";\n }\n else if (id == 101)\n {\n return \"Sprites/PalmTreeTop.png\";\n }\n else if (id == 102)\n {\n return \"Sprites/PalmTreeBottom.png\";\n }\n else if (id == 103)\n {\n return \"Sprites/streetlight_left_top.gif\";\n }\n else if (id == 104)\n {\n return \"Sprites/streetlight_left_bottom.gif\";\n }\n else if (id == 105)\n {\n return \"Sprites/streetlight_right_top.gif\";\n }\n else if (id == 106)\n {\n return \"Sprites/streetlight_right_bottom.gif\";\n }\n else if (id == 107)\n {\n return \"Sprites/Crate.gif\";\n }\n else if (id == 108)\n {\n return \"Sprites/Bloodstain.gif\";\n }\n else if (id == 109)\n {\n return \"Sprites/DarkSolid.gif\";\n }\n else if (id == 110)\n {\n return \"Sprites/SubTopLeft.gif\";\n }\n else if (id == 111)\n {\n return \"Sprites/SubTopRight.gif\";\n }\n else if (id == 112)\n {\n return \"Sprites/computer.png\";\n }\n else if (id == 113)\n {\n return \"Sprites/NoseCone.gif\";\n }\n else if (id == 114)\n {\n return \"Sprites/MissileSegment.gif\";\n }\n else if (id == 115)\n {\n return \"Sprites/LeftFin.gif\";\n }\n else if (id == 116)\n {\n return \"Sprites/MiddleFin.gif\";\n }\n else if (id == 117)\n {\n return \"Sprites/RightFin.gif\";\n }\n else if (id == 118)\n {\n return \"Sprites/fancyfloor.png\";\n }\n else if (id == 119)\n {\n return \"Sprites/Boss1Back.gif\";\n }\n else if (id == 120)\n {\n return \"Sprites/Boss1Front.gif\";\n }\n else if (id == 121)\n {\n return \"Sprites/Boss1Left.gif\";\n }\n else if (id == 122)\n {\n return \"Sprites/Boss1Right.gif\";\n }\n else if (id == 123)\n {\n return \"Sprites/Boss1BackRun.gif\";\n }\n else if (id == 124)\n {\n return \"Sprites/Boss1FrontRun.gif\";\n }\n else if (id == 125)\n {\n return \"Sprites/Boss1LeftRun.gif\";\n }\n else if (id == 126)\n {\n return \"Sprites/Boss1RightRun.gif\";\n }\n else if (id == 127)\n {\n return \"Sprites/Boss2Back.gif\";\n }\n else if (id == 128)\n {\n return \"Sprites/Boss2Front.gif\";\n }\n else if (id == 129)\n {\n return \"Sprites/Boss2Left.gif\";\n }\n else if (id == 130)\n {\n return \"Sprites/Boss2Right.gif\";\n }\n else if (id == 131)\n {\n return \"Sprites/Boss2BackRun.gif\";\n }\n else if (id == 132)\n {\n return \"Sprites/Boss2FrontRun.gif\";\n }\n else if (id == 133)\n {\n return \"Sprites/Boss2LeftRun.gif\";\n }\n else if (id == 134)\n {\n return \"Sprites/Boss2RightRun.gif\";\n }\n else if (id == 135)\n {\n return \"Sprites/Boss3Back.gif\";\n }\n else if (id == 136)\n {\n return \"Sprites/Boss3Front.gif\";\n }\n else if (id == 137)\n {\n return \"Sprites/Boss3Left.gif\";\n }\n else if (id == 138)\n {\n return \"Sprites/Boss3Right.gif\";\n }\n else if (id == 139)\n {\n return \"Sprites/Boss3BackRun.gif\";\n }\n else if (id == 140)\n {\n return \"Sprites/Boss3FrontRun.gif\";\n }\n else if (id == 141)\n {\n return \"Sprites/Boss3LeftRun.gif\";\n }\n else if (id == 142)\n {\n return \"Sprites/Boss3RightRun.gif\";\n }\n else if (id == 143)\n {\n return \"Sprites/IndoorFloorTile5.gif\";\n }\n else if (id == 144)\n {\n return \"Sprites/IndoorFloorTile6.gif\";\n }\n else if (id == 145)\n {\n return \"Sprites/bed1.png\";\n }\n else if (id == 146)\n {\n return \"Sprites/bed2.png\";\n }\n else if (id == 147)\n {\n return \"Sprites/chair.png\";\n }\n else if (id == 148)\n {\n return \"Sprites/desk.png\";\n }\n else if (id == 149)\n {\n return \"Sprites/desk2.png\";\n }\n else if (id == 150)\n {\n return \"Sprites/computer_slacker.png\";\n }\n else if (id == 151)\n {\n return \"Sprites/computer_slacker2.png\";\n }\n else if (id == 152)\n {\n return \"Sprites/conferencedeskbottom.png\";\n }\n else if (id == 153)\n {\n return \"Sprites/conferencedesktop.png\";\n }\n else if (id == 154)\n {\n return \"Sprites/fancycarpet.png\";\n }\n else if (id == 155)\n {\n return \"Sprites/hpainting.png\";\n }\n else if (id == 156)\n {\n return \"Sprites/painting.gif\";\n }\n else if (id == 157)\n {\n return \"Sprites/fancywall.gif\";\n }\n else if (id == 158)\n {\n return \"Sprites/locker.gif\";\n }\n else if (id == 159)\n {\n return \"Sprites/computer2.gif\";\n }\n else if (id == 160)\n {\n return \"Sprites/crate2.gif\";\n }\n else if (id == 161)\n {\n return \"Sprites/tombstone.gif\";\n }\n else if (id == 162)\n {\n return \"Sprites/Scientist1Back.gif\";\n }\n else if (id == 163)\n {\n return \"Sprites/Scientist1Front.gif\";\n }\n else if (id == 164)\n {\n return \"Sprites/Scientist1Left.gif\";\n }\n else if (id == 165)\n {\n return \"Sprites/Scientist1Right.gif\";\n }\n else if (id == 166)\n {\n return \"Sprites/Scientist1BackRun.gif\";\n }\n else if (id == 167)\n {\n return \"Sprites/Scientist1FrontRun.gif\";\n }\n else if (id == 168)\n {\n return \"Sprites/Scientist1LeftRun.gif\";\n }\n else if (id == 169)\n {\n return \"Sprites/Scientist1RightRun.gif\";\n }\n else if (id == 170)\n {\n return \"Sprites/Scientist2Back.gif\";\n }\n else if (id == 171)\n {\n return \"Sprites/Scientist2Front.gif\";\n }\n else if (id == 172)\n {\n return \"Sprites/Scientist2Left.gif\";\n }\n else if (id == 173)\n {\n return \"Sprites/Scientist2Right.gif\";\n }\n else if (id == 174)\n {\n return \"Sprites/Scientist2BackRun.gif\";\n }\n else if (id == 175)\n {\n return \"Sprites/Scientist2FrontRun.gif\";\n }\n else if (id == 176)\n {\n return \"Sprites/Scientist2LeftRun.gif\";\n }\n else if (id == 177)\n {\n return \"Sprites/Scientist2RightRun.gif\";\n }\n else if (id == 178)\n {\n return \"Sprites/StoveTop.gif\";\n }\n else if (id == 179)\n {\n return \"Sprites/chemlab.png\";\n }\n else if (id == 180)\n {\n return \"Sprites/GlassWall.gif\";\n }\n else if (id == 181)\n {\n return \"Sprites/Bullet.gif\";\n }\n else if (id == 182)\n {\n return \"Sprites/RadarFree.gif\";\n }\n else if (id == 183)\n {\n return \"Sprites/RadarObstacle.gif\";\n }\n else if (id == 184)\n {\n return \"Sprites/RadarPlayer.gif\";\n }\n else if (id == 185)\n {\n return \"Sprites/RadarNPC.gif\";\n }\n else if (id == 186)\n {\n return \"Sprites/cactus.png\";\n }\n else if (id == 187)\n {\n return \"Sprites/garagedoor.gif\";\n }\n else if (id == 188)\n {\n return \"Sprites/PlayerFrontSMG.gif\";\n }\n else if (id == 189)\n {\n return \"Sprites/PlayerLeftSMG.gif\";\n }\n else if (id == 190)\n {\n return \"Sprites/PlayerRightSMG.gif\";\n }\n else if (id == 191)\n {\n return \"Sprites/Grenade.gif\";\n }\n else if (id == 192)\n {\n return \"Sprites/RadarObjective.gif\";\n }\n else if (id == 193)\n {\n return \"Sprites/Explosion2.gif\";\n }\n else if (id == 194)\n {\n return \"Sprites/PlayerFrontShotgun.gif\";\n }\n else if (id == 195)\n {\n return \"Sprites/PlayerLeftShotgun.gif\";\n }\n else if (id == 196)\n {\n return \"Sprites/PlayerRightShotgun.gif\";\n }\n else if (id == 197)\n {\n return \"Sprites/CameraUp.gif\";\n }\n else if (id == 198)\n {\n return \"Sprites/CameraDown.gif\";\n }\n else if (id == 199)\n {\n return \"Sprites/CameraLeft.gif\";\n }\n else if (id == 200)\n {\n return \"Sprites/CameraRight.gif\";\n }\n else if (id == 201)\n {\n return \"Sprites/Cardkey4.gif\";\n }\n else if (id == 202)\n {\n return \"Sprites/Cardkey5.gif\";\n }\n else if (id == 203)\n {\n return \"Sprites/NVG.gif\";\n }\n else if (id == 204)\n {\n return \"Sprites/Gasmask.gif\";\n }\n else if (id == 205)\n {\n return \"Sprites/SMG.png\";\n }\n else if (id == 206)\n {\n return \"Sprites/Shotgun.gif\";\n }\n else if (id == 207)\n {\n return \"Sprites/BodyArmor.gif\";\n }\n else if (id == 208)\n {\n return \"Sprites/bookcase.png\";\n }\n else if (id == 209)\n {\n return \"Sprites/GrassWall.png\";\n }\n else if (id == 210)\n {\n return \"Sprites/tank00.png\";\n }\n else if (id == 211)\n {\n return \"Sprites/tank10.png\";\n }\n else if (id == 212)\n {\n return \"Sprites/tank20.png\";\n }\n else if (id == 213)\n {\n return \"Sprites/tank01.png\";\n }\n else if (id == 214)\n {\n return \"Sprites/tank11.png\";\n }\n else if (id == 215)\n {\n return \"Sprites/tank21.png\";\n }\n else if (id == 216)\n {\n return \"Sprites/tank02.png\";\n }\n else if (id == 217)\n {\n return \"Sprites/tank12.png\";\n }\n else if (id == 218)\n {\n return \"Sprites/tank22.png\";\n }\n else if (id == 219)\n {\n return \"Sprites/tankbarrel.png\";\n }\n else if (id == 220)\n {\n return \"Sprites/HorizontalStairs.gif\";\n }\n else if (id == 221)\n {\n return \"Sprites/VerticalStairs.gif\";\n }\n else if (id == 222)\n {\n return \"Sprites/Objective1.gif\";\n }\n else if (id == 223)\n {\n return \"Sprites/Objective2.gif\";\n }\n else if (id == 224)\n {\n return \"Sprites/Objective3.gif\";\n }\n else if (id == 225)\n {\n return \"Sprites/Objective4.gif\";\n }\n else if (id == 226)\n {\n return \"Sprites/Boss4Back.gif\";\n }\n else if (id == 227)\n {\n return \"Sprites/Boss4Front.gif\";\n }\n else if (id == 228)\n {\n return \"Sprites/Boss4Left.gif\";\n }\n else if (id == 229)\n {\n return \"Sprites/Boss4Right.gif\";\n }\n else if (id == 230)\n {\n return \"Sprites/Boss4BackRun.gif\";\n }\n else if (id == 231)\n {\n return \"Sprites/Boss4FrontRun.gif\";\n }\n else if (id == 232)\n {\n return \"Sprites/Boss4LeftRun.gif\";\n }\n else if (id == 233)\n {\n return \"Sprites/Boss4RightRun.gif\";\n }\n else if (id == 234)\n {\n return \"Sprites/nhBack.gif\";\n }\n else if (id == 235)\n {\n return \"Sprites/nhFront.gif\";\n }\n else if (id == 236)\n {\n return \"Sprites/nhLeft.gif\";\n }\n else if (id == 237)\n {\n return \"Sprites/nhRight.gif\";\n }\n else if (id == 238)\n {\n return \"Sprites/nhBackRun.gif\";\n }\n else if (id == 239)\n {\n return \"Sprites/nhFrontRun.gif\";\n }\n else if (id == 240)\n {\n return \"Sprites/nhLeftRun.gif\";\n }\n else if (id == 241)\n {\n return \"Sprites/nhRightRun.gif\";\n }\n else if (id == 242)\n {\n return \"Sprites/Boss0Back.gif\";\n }\n else if (id == 243)\n {\n return \"Sprites/Boss0Front.gif\";\n }\n else if (id == 244)\n {\n return \"Sprites/Boss0Left.gif\";\n }\n else if (id == 245)\n {\n return \"Sprites/Boss0Right.gif\";\n }\n else if (id == 246)\n {\n return \"Sprites/Boss0BackRun.gif\";\n }\n else if (id == 247)\n {\n return \"Sprites/Boss0FrontRun.gif\";\n }\n else if (id == 248)\n {\n return \"Sprites/Boss0LeftRun.gif\";\n }\n else if (id == 249)\n {\n return \"Sprites/Boss0RightRun.gif\";\n }\n else if (id == 250)\n {\n return \"Sprites/Wristwatch.gif\";\n }\n else if (id == 251)\n {\n return \"Sprites/LocationObjective.gif\";\n }\n else if (id == 252){return \"Sprites/stonewall.png\";}\n else if (id == 253){return \"Sprites/stonewall2.png\";}\n else if (id == 254){return \"Sprites/water3.jpg\";}\n else if (id == 255){return \"Sprites/crimescene.gif\";}\n else if (id == 256){return \"Sprites/woodfloor2.jpg\";}\n else if (id == 257){return \"Sprites/fancycarpet2.png\";}\n else if (id == 258){return \"Sprites/surrogate1.gif\";}\n else if (id == 259){return \"Sprites/surrogate2.gif\";}\n else if (id == 260){return \"Sprites/surrogate3.gif\";}\n else if (id == 261){return \"Sprites/female_ally_back.gif\";}\n else if (id == 262){return \"Sprites/female_ally_front.gif\";}\n else if (id == 263){return \"Sprites/female_ally_left.gif\";}\n else if (id == 264){return \"Sprites/female_ally_right.gif\";}\n else if (id == 265){return \"Sprites/female_ally_back_run.gif\";}\n else if (id == 266){return \"Sprites/female_ally_front_run.gif\";}\n else if (id == 267){return \"Sprites/female_ally_left_run.gif\";}\n else if (id == 268){return \"Sprites/female_ally_right_run.gif\";}\n else if (id == 269){return \"Sprites/female_ally_back_workout.gif\";}\n else if (id == 270){return \"Sprites/female_ally_front_workout.gif\";}\n else if (id == 271){return \"Sprites/female_ally_left_workout.gif\";}\n else if (id == 272){return \"Sprites/female_ally_right_workout.gif\";}\n else if (id == 273){return \"Sprites/female_ally_back_run_workout.gif\";}\n else if (id == 274){return \"Sprites/female_ally_front_run_workout.gif\";}\n else if (id == 275){return \"Sprites/female_ally_left_run_workout.gif\";}\n else if (id == 276){return \"Sprites/female_ally_right_run_workout.gif\";}\n else if (id == 277){return \"Sprites/Mutant1Back.gif\";}\n else if (id == 278){return \"Sprites/Mutant1Front.gif\";}\n else if (id == 279){return \"Sprites/Mutant1Left.gif\";}\n else if (id == 280){return \"Sprites/Mutant1Right.gif\";}\n else if (id == 281){return \"Sprites/Mutant1BackRun.gif\";}\n else if (id == 282){return \"Sprites/Mutant1FrontRun.gif\";}\n else if (id == 283){return \"Sprites/Mutant1LeftRun.gif\";}\n else if (id == 284){return \"Sprites/Mutant1RightRun.gif\";}\n else if (id == 285){return \"Sprites/Mutant2Back.gif\";}\n else if (id == 286){return \"Sprites/Mutant2Front.gif\";}\n else if (id == 287){return \"Sprites/Mutant2Left.gif\";}\n else if (id == 288){return \"Sprites/Mutant2Right.gif\";}\n else if (id == 289){return \"Sprites/Mutant2BackRun.gif\";}\n else if (id == 290){return \"Sprites/Mutant2FrontRun.gif\";}\n else if (id == 291){return \"Sprites/Mutant2LeftRun.gif\";}\n else if (id == 292){return \"Sprites/Mutant2RightRun.gif\";}\n else if (id == 293){return \"Sprites/mine.gif\";}\n else if (id == 294){return \"Sprites/laser_horizontal.gif\";}\n else if (id == 295){return \"Sprites/laser_vertical.gif\";}\n else if (id == 296){return \"Sprites/MineDetector.gif\";}\n else if (id == 297){return \"Sprites/white.gif\";}\n else if (id == 298){return \"Sprites/borderbox.gif\";}\n\n else if (id == 299){return \"Sprites/metalboxtop1.gif\";}\n else if (id == 300){return \"Sprites/metalboxbottom1.gif\";}\n else if (id == 301){return \"Sprites/hshadow1.gif\";}\n else if (id == 302){return \"Sprites/vshadow1.gif\";}\n else if (id == 303){return \"Sprites/cshadow1.gif\";}\n else if (id == 304){return \"Sprites/vconeup.gif\";}\n else if (id == 305){return \"Sprites/vconedown.gif\";}\n else if (id == 306){return \"Sprites/vconeleft.gif\";}\n else if (id == 307){return \"Sprites/vconeright.gif\";}\n else if (id == 308){return \"Sprites/RoadCornerLeft.gif\";}\n else if (id == 309){return \"Sprites/RoadCornerRight.gif\";}\n\n else if (id == 310){return \"Sprites/Woman1Back.gif\";}\n else if (id == 311){return \"Sprites/Woman1Front.gif\";}\n else if (id == 312){return \"Sprites/Woman1Left.gif\";}\n else if (id == 313){return \"Sprites/Woman1Right.gif\";}\n else if (id == 314){return \"Sprites/Woman1BackRun.gif\";}\n else if (id == 315){return \"Sprites/Woman1FrontRun.gif\";}\n else if (id == 316){return \"Sprites/Woman1LeftRun.gif\";}\n else if (id == 317){return \"Sprites/Woman1RightRun.gif\";}\n\n else if (id == 318){return \"Sprites/Woman2Back.gif\";}\n else if (id == 319){return \"Sprites/Woman2Front.gif\";}\n else if (id == 320){return \"Sprites/Woman2Left.gif\";}\n else if (id == 321){return \"Sprites/Woman2Right.gif\";}\n else if (id == 322){return \"Sprites/Woman2BackRun.gif\";}\n else if (id == 323){return \"Sprites/Woman2FrontRun.gif\";}\n else if (id == 324){return \"Sprites/Woman2LeftRun.gif\";}\n else if (id == 325){return \"Sprites/Woman2RightRun.gif\";}\n\n else if (id == 326){return \"Sprites/Woman3Back.gif\";}\n else if (id == 327){return \"Sprites/Woman3Front.gif\";}\n else if (id == 328){return \"Sprites/Woman3Left.gif\";}\n else if (id == 329){return \"Sprites/Woman3Right.gif\";}\n else if (id == 330){return \"Sprites/Woman3BackRun.gif\";}\n else if (id == 331){return \"Sprites/Woman3FrontRun.gif\";}\n else if (id == 332){return \"Sprites/Woman3LeftRun.gif\";}\n else if (id == 333){return \"Sprites/Woman3RightRun.gif\";}\n\n else if (id == 334){return \"Sprites/chief_back.gif\";}\n else if (id == 335){return \"Sprites/chief_front.gif\";}\n else if (id == 336){return \"Sprites/chief_left.gif\";}\n else if (id == 337){return \"Sprites/chief_right.gif\";}\n else if (id == 338){return \"Sprites/chief_back_run.gif\";}\n else if (id == 339){return \"Sprites/chief_front_run.gif\";}\n else if (id == 340){return \"Sprites/chief_left_run.gif\";}\n else if (id == 341){return \"Sprites/chief_right_run.gif\";}\n\n else if (id == 342){return \"Sprites/un_guy_back.gif\";}\n else if (id == 343){return \"Sprites/un_guy_front.gif\";}\n else if (id == 344){return \"Sprites/un_guy_left.gif\";}\n else if (id == 345){return \"Sprites/un_guy_right.gif\";}\n else if (id == 346){return \"Sprites/un_guy_back_run.gif\";}\n else if (id == 347){return \"Sprites/un_guy_front_run.gif\";}\n else if (id == 348){return \"Sprites/un_guy_left_run.gif\";}\n else if (id == 349){return \"Sprites/un_guy_right_run.gif\";}\n\n else if (id == 350){return \"Sprites/SpecialGuardBack.gif\";}\n else if (id == 351){return \"Sprites/SpecialGuardFront.gif\";}\n else if (id == 352){return \"Sprites/SpecialGuardLeft.gif\";}\n else if (id == 353){return \"Sprites/SpecialGuardRight.gif\";}\n else if (id == 354){return \"Sprites/SpecialGuardBackRun.gif\";}\n else if (id == 355){return \"Sprites/SpecialGuardFrontRun.gif\";}\n else if (id == 356){return \"Sprites/SpecialGuardLeftRun.gif\";}\n else if (id == 357){return \"Sprites/SpecialGuardRightRun.gif\";}\n\n else if (id == 358){return \"Sprites/truck00.png\";}\n else if (id == 359){return \"Sprites/truck10.png\";}\n else if (id == 360){return \"Sprites/truck20.png\";}\n else if (id == 361){return \"Sprites/truck01.png\";}\n else if (id == 362){return \"Sprites/truck11.png\";}\n else if (id == 363){return \"Sprites/truck21.png\";}\n else if (id == 364){return \"Sprites/truck02.png\";}\n else if (id == 365){return \"Sprites/truck12.png\";}\n else if (id == 366){return \"Sprites/truck22.png\";}\n\n else if (id == 367){return \"Sprites/FireExtinguisher.gif\";}\n else if (id == 368){return \"Sprites/c4.gif\";}\n\n else if (id == 369){return \"Sprites/RoadCornerLeft2.gif\";}\n else if (id == 370){return \"Sprites/RoadCornerRight2.gif\";}\n\n else if (id == 371){return \"Sprites/painting2.gif\";}\n else if (id == 372){return \"Sprites/painting3.gif\";}\n else if (id == 373){return \"Sprites/painting4.gif\";}\n else if (id == 374){return \"Sprites/painting5.gif\";}\n\n else if (id == 375){return \"Sprites/snowparticle.gif\";}\n else if (id == 376){return \"Sprites/rainparticle.gif\";}\n\n else if (id == 377){return \"Sprites/airventclosed.gif\";}\n else if (id == 378){return \"Sprites/airventopen.gif\";}\n\n else if (id == 379){return \"Sprites/wateredgetop.png\";}\n else if (id == 380){return \"Sprites/wateredgebottom.png\";}\n else if (id == 381){return \"Sprites/wateredgeleft.png\";}\n else if (id == 382){return \"Sprites/wateredgeright.png\";}\n else if (id == 383){return \"Sprites/wateredgetopleft.png\";}\n else if (id == 384){return \"Sprites/wateredgetopright.png\";}\n else if (id == 385){return \"Sprites/wateredgebottomleft.png\";}\n else if (id == 386){return \"Sprites/wateredgebottomright.png\";}\n else if (id == 387){return \"Sprites/wateredgetopleftjunction.png\";}\n else if (id == 388){return \"Sprites/wateredgetoprightjunction.png\";}\n else if (id == 389){return \"Sprites/wateredgebottomleftjunction.png\";}\n else if (id == 390){return \"Sprites/wateredgebottomrightjunction.png\";}\n\n else if (id == 391){return \"Sprites/bathroom.png\";}\n\n else if (id == 392){return \"Sprites/treetop.png\";}\n else if (id == 393){return \"Sprites/treebottom.png\";}\n else if (id == 394){return \"Sprites/darktreetop.png\";}\n else if (id == 395){return \"Sprites/darktreebottom.png\";}\n \n else if (id == 396){return \"Sprites/cliff_face.png\";}\n else if (id == 397){return \"Sprites/cliff_left.png\";}\n else if (id == 398){return \"Sprites/cliff_right.png\";}\n else if (id == 399){return \"Sprites/cliff_cornerleft.png\";}\n else if (id == 400){return \"Sprites/cliff_cornerright.png\";}\n else if (id == 401){return \"Sprites/cliff_cornerupperleft.png\";}\n else if (id == 402){return \"Sprites/cliff_cornerupperright.png\";}\n else if (id == 403){return \"Sprites/cliff_face.png\";}\n else if (id == 404){return \"Sprites/GrassWallBottom.png\";}\n\n else if (id == 405){return \"Sprites/oldman_back.gif\";}\n else if (id == 406){return \"Sprites/oldman_front.gif\";}\n else if (id == 407){return \"Sprites/oldman_left.gif\";}\n else if (id == 408){return \"Sprites/oldman_right.gif\";}\n else if (id == 409){return \"Sprites/oldman_back_run.gif\";}\n else if (id == 410){return \"Sprites/oldman_front_run.gif\";}\n else if (id == 411){return \"Sprites/oldman_left_run.gif\";}\n else if (id == 412){return \"Sprites/oldman_right_run.gif\";}\n\n else if (id == 413){return \"Sprites/crippleBack.gif\";}\n else if (id == 414){return \"Sprites/crippleFront.gif\";}\n else if (id == 415){return \"Sprites/crippleLeft.gif\";}\n else if (id == 416){return \"Sprites/crippleRight.gif\";}\n else if (id == 417){return \"Sprites/crippleBackRun.gif\";}\n else if (id == 418){return \"Sprites/crippleFrontRun.gif\";}\n else if (id == 419){return \"Sprites/crippleLeftRun.gif\";}\n else if (id == 420){return \"Sprites/crippleRightRun.gif\";}\n\n else if (id == 421){return \"Sprites/scientist_female_back.gif\";}\n else if (id == 422){return \"Sprites/scientist_female_front.gif\";}\n else if (id == 423){return \"Sprites/scientist_female_left.gif\";}\n else if (id == 424){return \"Sprites/scientist_female_right.gif\";}\n else if (id == 425){return \"Sprites/scientist_female_back_run.gif\";}\n else if (id == 426){return \"Sprites/scientist_female_front_run.gif\";}\n else if (id == 427){return \"Sprites/scientist_female_left_run.gif\";}\n else if (id == 428){return \"Sprites/scientist_female_right_run.gif\";}\n\n else if (id == 429){return \"Sprites/EvaBack.gif\";}\n else if (id == 430){return \"Sprites/EvaFront.gif\";}\n else if (id == 431){return \"Sprites/EvaLeft.gif\";}\n else if (id == 432){return \"Sprites/EvaRight.gif\";}\n else if (id == 433){return \"Sprites/EvaBackRun.gif\";}\n else if (id == 434){return \"Sprites/EvaFrontRun.gif\";}\n else if (id == 435){return \"Sprites/EvaLeftRun.gif\";}\n else if (id == 436){return \"Sprites/EvaRightRun.gif\";}\n\n else if (id == 437){return \"Sprites/man_back.gif\";}\n else if (id == 438){return \"Sprites/man_front.gif\";}\n else if (id == 439){return \"Sprites/man_left.gif\";}\n else if (id == 440){return \"Sprites/man_right.gif\";}\n else if (id == 441){return \"Sprites/man_back_run.gif\";}\n else if (id == 442){return \"Sprites/man_front_run.gif\";}\n else if (id == 443){return \"Sprites/man_left_run.gif\";}\n else if (id == 444){return \"Sprites/man_right_run.gif\";}\n\n else if (id == 445){return \"Sprites/stairs_left_down.png\";}\n else if (id == 446){return \"Sprites/stairs_right_up.png\";}\n else if (id == 447){return \"Sprites/stairs_right_down.png\";}\n else if (id == 448){return \"Sprites/stairs_left_up.png\";}\n else if (id == 449){return \"Sprites/m1911a1.png\";}\n else if (id == 450){return \"Sprites/usp.png\";}\n else if (id == 451){return \"Sprites/fmk3.png\";}\n else if (id == 452){return \"Sprites/p90.png\";}\n else if (id == 453){return \"Sprites/m16.png\";}\n else if (id == 454){return \"Sprites/fara83.png\";}\n else if (id == 455){return \"Sprites/m4.png\";}\n else if (id == 456){return \"Sprites/sa08.png\";}\n else if (id == 457){return \"Sprites/spas12.png\";}\n else if (id == 458){return \"Sprites/saiga12.png\";}\n\n else if (id == 459){return \"Sprites/JuggernautBack.gif\";}\n else if (id == 460){return \"Sprites/JuggernautFront.gif\";}\n else if (id == 461){return \"Sprites/JuggernautLeft.gif\";}\n else if (id == 462){return \"Sprites/JuggernautRight.gif\";}\n else if (id == 463){return \"Sprites/JuggernautBackRun.gif\";}\n else if (id == 464){return \"Sprites/JuggernautFrontRun.gif\";}\n else if (id == 465){return \"Sprites/JuggernautLeftRun.gif\";}\n else if (id == 466){return \"Sprites/JuggernautRightRun.gif\";}\n\n else if (id == 467){return \"Sprites/Juggernaut2Back.gif\";}\n else if (id == 468){return \"Sprites/Juggernaut2Front.gif\";}\n else if (id == 469){return \"Sprites/Juggernaut2Left.gif\";}\n else if (id == 470){return \"Sprites/Juggernaut2Right.gif\";}\n else if (id == 471){return \"Sprites/Juggernaut2BackRun.gif\";}\n else if (id == 472){return \"Sprites/Juggernaut2FrontRun.gif\";}\n else if (id == 473){return \"Sprites/Juggernaut2LeftRun.gif\";}\n else if (id == 474){return \"Sprites/Juggernaut2RightRun.gif\";}\n \n else if (id == 475){return \"Sprites/female_ally_back_swim.gif\";}\n else if (id == 476){return \"Sprites/female_ally_front_swim.gif\";}\n else if (id == 477){return \"Sprites/female_ally_left_swim.gif\";}\n else if (id == 478){return \"Sprites/female_ally_right_swim.gif\";}\n else if (id == 479){return \"Sprites/female_ally_back_run_swim.gif\";}\n else if (id == 480){return \"Sprites/female_ally_front_run_swim.gif\";}\n else if (id == 481){return \"Sprites/female_ally_left_run_swim.gif\";}\n else if (id == 482){return \"Sprites/female_ally_right_run_swim.gif\";}\n\n else if (id == 483){return \"Sprites/GunCameraUp.png\";}\n else if (id == 484){return \"Sprites/GunCameraDown.png\";}\n else if (id == 485){return \"Sprites/GunCameraLeft.png\";}\n else if (id == 486){return \"Sprites/GunCameraRight.png\";}\n\n else if (id == 487){return \"Sprites/drone_up.png\";}\n else if (id == 488){return \"Sprites/drone_down.png\";}\n else if (id == 489){return \"Sprites/drone_left.png\";}\n else if (id == 490){return \"Sprites/drone_right.png\";}\n\n else if (id == 491){return \"Sprites/gun_drone_up.png\";}\n else if (id == 492){return \"Sprites/gun_drone_down.png\";}\n else if (id == 493){return \"Sprites/gun_drone_left.png\";}\n else if (id == 494){return \"Sprites/gun_drone_right.png\";}\n\n else if (id == 495){return \"Sprites/boat00.png\";}\n else if (id == 496){return \"Sprites/boat10.png\";}\n else if (id == 497){return \"Sprites/boat20.png\";}\n\n else if (id == 498){return \"Sprites/boat01.png\";}\n else if (id == 499){return \"Sprites/boat11.png\";}\n else if (id == 500){return \"Sprites/boat21.png\";}\n\n else if (id == 501){return \"Sprites/boat02.png\";}\n else if (id == 502){return \"Sprites/boat12.png\";}\n else if (id == 503){return \"Sprites/boat22.png\";}\n\n else if (id == 504){return \"Sprites/boat03.png\";}\n else if (id == 505){return \"Sprites/boat13.png\";}\n else if (id == 506){return \"Sprites/boat23.png\";}\n\n else if (id == 507){return \"Sprites/boat04.png\";}\n else if (id == 508){return \"Sprites/boat14.png\";}\n else if (id == 509){return \"Sprites/boat24.png\";}\n\n else if (id == 510){return \"Sprites/explosives.png\";}\n\n else if (id == 511){return \"Sprites/roof.png\";}\n else if (id == 512){return \"Sprites/roof2.png\";}\n else if (id == 513){return \"Sprites/roof3.png\";}\n else if (id == 514){return \"Sprites/roof4.png\";}\n\n else if (id == 515){return \"Sprites/window.png\";}\n else if (id == 516){return \"Sprites/window_dark.png\";}\n else if (id == 517){return \"Sprites/window_light.png\";}\n\n else if (id == 518){return \"Sprites/explosives2.png\";}\n else if (id == 519){return \"Sprites/lava.png\";}\n \n else if (id == 520){return \"Sprites/ghost_back.png\";}\n else if (id == 521){return \"Sprites/ghost_front.png\";}\n else if (id == 522){return \"Sprites/ghost_left.png\";}\n else if (id == 523){return \"Sprites/ghost_right.png\";}\n else if (id == 524){return \"Sprites/ghost_back_run.png\";}\n else if (id == 525){return \"Sprites/ghost_front_run.png\";}\n else if (id == 526){return \"Sprites/ghost_left_run.png\";}\n else if (id == 527){return \"Sprites/ghost_right_run.png\";}\n\n else if (id == 528){return \"Sprites/c4Objective.png\";}\n else if (id == 529){return \"Sprites/c4group.png\";}\n\n else if (id == 530){return \"Sprites/hitler_back.gif\";}\n else if (id == 531){return \"Sprites/hitler_front.gif\";}\n else if (id == 532){return \"Sprites/hitler_left.gif\";}\n else if (id == 533){return \"Sprites/hitler_right.gif\";}\n else if (id == 534){return \"Sprites/hitler_back_run.gif\";}\n else if (id == 535){return \"Sprites/hitler_front_run.gif\";}\n else if (id == 536){return \"Sprites/hitler_left_run.gif\";}\n else if (id == 537){return \"Sprites/hitler_right_run.gif\";}\n\n else if (id == 538){return \"Sprites/MutantBossBack.gif\";}\n else if (id == 539){return \"Sprites/MutantBossFront.gif\";}\n else if (id == 540){return \"Sprites/MutantBossLeft.gif\";}\n else if (id == 541){return \"Sprites/MutantBossRight.gif\";}\n else if (id == 542){return \"Sprites/MutantBossBackRun.gif\";}\n else if (id == 543){return \"Sprites/MutantBossFrontRun.gif\";}\n else if (id == 544){return \"Sprites/MutantBossLeftRun.gif\";}\n else if (id == 545){return \"Sprites/MutantBossRightRun.gif\";}\n\n else if (id == 546){return \"Sprites/patient_female.png\";}\n else if (id == 547){return \"Sprites/patient_female2.png\";}\n else if (id == 548){return \"Sprites/patient_male.png\";}\n else if (id == 549){return \"Sprites/patient_male2.png\";}\n else if (id == 550){return \"Sprites/patient_male_hitler.png\";}\n\n else if (id == 551){return \"Sprites/dockedge.png\";}\n else if (id == 552){return \"Sprites/ak104u.png\";}\n else if (id == 553){return \"Sprites/g18.png\";}\n else if (id == 554){return \"Sprites/m3a1sd.png\";}\n else if (id == 555){return \"Sprites/mp7sd.png\";}\n else if (id == 556){return \"Sprites/m1911a1custom.png\";}\n\n else if (id == 557){return \"Sprites/dockedge_left.png\";}\n else if (id == 558){return \"Sprites/dockedge_right.png\";}\n else if (id == 559){return \"Sprites/dockstairs.png\";}\n\n return \"Sprites/Tile0.gif\";\n\n }", "public Sprite getMazeSprite()\n {\n return mazeSprite;\n }", "public int getImageResource() {\n switch (id) {\n case 0: return R.drawable.aatrox_square_0;\n case 1: return R.drawable.ahri_square_0;\n case 2: return R.drawable.akali_square_0;\n case 3: return R.drawable.alistar_square_0;\n case 4: return R.drawable.amumu_square_0;\n case 5: return R.drawable.anivia_square_0;\n case 6: return R.drawable.annie_square_0;\n case 7: return R.drawable.ashe_square_0;\n case 8: return R.drawable.azir_square_0;\n case 9: return R.drawable.bard_square_0;\n case 10: return R.drawable.blitzcrank_square_0;\n case 11: return R.drawable.brand_square_0;\n case 12: return R.drawable.braum_square_0;\n case 13: return R.drawable.caitlyn_square_0;\n case 14: return R.drawable.cassiopeia_square_0;\n case 15: return R.drawable.chogath_square_0;\n case 16: return R.drawable.corki_square_0;\n case 17: return R.drawable.darius_square_0;\n case 18: return R.drawable.diana_square_0;\n case 19: return R.drawable.draven_square_0;\n case 20: return R.drawable.drmundo_square_0;\n default:\n return R.drawable.fizz_square_0;\n }\n }", "public abstract String getIcon(int current_turn);", "int getSelectedSpriteValue();", "public Collision getCollisionType(ISprite sprite);", "public Image getPokeImg(int index) {\n\t\treturn pokemonImgs[index];\n\t}", "public CroppableAtlasSprite obtainSprite(ETexture texture) {\n\t\treturn obtainSprite(ResourceCache.getTexture(texture));\n\t}", "public Image getImage() {\n return (isFacingRight) ? Images.get(\"rightTedhaun\") : Images.get(\"leftTedhaun\");\n }", "public void evaluateSprite(){\n if(this.orientation == Orientation.FACING_NORTH) {\n texture = new Texture(Gdx.files.internal(\"/assets/gameObjects/playerFacingNorth.png\"));\n }\n if(this.orientation == Orientation.FACING_WEST){\n texture = new Texture(Gdx.files.internal(\"/assets/gameObjects/playerFacingWest.png\"));\n }\n if(this.orientation == Orientation.FACING_SOUTH){\n texture = new Texture(Gdx.files.internal(\"/assets/gameObjects/playerFacingSouth.png\"));\n }\n if(this.orientation == Orientation.FACING_EAST){\n texture = new Texture(Gdx.files.internal(\"/assets/gameObjects/playerFacingEast.png\"));\n }\n\n this.sprite = new Sprite(texture);\n }", "public Image getDefault(int player, boolean ep) {if (player==1) return defaultImg1; else return defaultImg2;}", "public BufferedImage getDrawable(){\n\t\tif(this.isOilContamination()){\n\t\t\treturn this.myFlyweight.getDeadDrawable();\n\t\t}\n\t\t//check direction -- such a horrible way to write a method\n\t\t//redundant checking and ugh.... design this away please...........................\n\t\tif(this.getDirection().getX() > 0 && !this.myFlyweight.getMovingBackAnimationSequence().isEmpty()){\n\t\t\treturn this.myFlyweight.getMovingBackAnimationSequence().get(animationFrame);\n\t\t}\n\t\treturn this.myFlyweight.getAnimationSequence().get(animationFrame);\n\t}", "public static ImageUse getByNum(int i) {\n\t\tswitch (i) {\n\t\t\tcase Boardx.BOULDER:\n\t\t\t\treturn BOULDER;\n\t\t\tcase Boardx.CAVEMAN:\n\t\t\t\treturn PLAYER;\n\t\t\tcase Boardx.EMPTY:\n\t\t\t\treturn EMPTY;\n\t\t\tcase Boardx.EXIT:\n\t\t\t\treturn EXIT;\n\t\t\tcase Boardx.HOLE:\n\t\t\t\treturn HOLE;\n\t\t\tcase Boardx.WALL:\n\t\t\t\treturn WALL;\n\t\t\tdefault:\n\t\t\t\tthrow new IllegalArgumentException();\n\t\t}\n\t}", "private static Image getTarget()\n\t{\n\t\ttry {\n\t\t\treturn ImageIO.read(new File(tileDirectory + target));\n\t\t} catch (IOException ioe) {\n\t\t}\n\t\treturn null;\n\t}", "@Override\n public Sprite createSprite(SnakeSmash game) {\n Texture texture = game.getAssetManager().get(\"pinkSquare.png\");\n return new Sprite(texture, texture.getWidth(), texture.getHeight());\n }", "public static String getBallPossessor() {\r\n String imageResource = \"/bloodbowl/resources/possessor.gif\";\r\n\r\n return imageResource;\r\n }", "Texture getIcon();", "public Image getPunch2(int player, boolean ep) {if (player==1) return punchP12; else return punchP22;}", "public Image getJump(int player, boolean ep)\t{if (player==1) return jump1; else return jump2;}", "public abstract Tile getTileAt(int x, int y);", "public String getImg(){\n switch(image){\n case 0: // Case 0: Ant looks up/north\n return \"imgs/ant_n.png\";\n case 1: // Case 1: Ant looks right/east\n return \"imgs/ant_e.png\";\n case 2: // Case 2: Ant looks down/south\n return \"imgs/ant_s.png\";\n case 3: // Case 3: Ant looks left/west\n return \"imgs/ant_w.png\";\n default: // Default: This shouldn't happen on a normal run. It returns an empty string and prints an error.\n System.err.println(\"Something went wrong while the ant was trying change direction\");\n return \"\";\n }\n }", "public Image getPunch1(int player, boolean ep) {if (player==1) return punchP11; else return punchP21;}", "private SpriteFont getSpriteFontInstance() {\r\n\t\t// called by the seed batch upon making a batch\r\n\t\t// only needs docPoint if an influenceImage is set\r\n\t\t//System.out.println(\"SpriteFontBiome::getSpriteFontInstance ... num biomeItems = \" + biomeItems.size());\r\n\t\tif (probabilitiesNormalised == false) normaliseProbabilities();\r\n\r\n\t\tif (biomeItems.size() == 1) {\r\n\t\t\treturn biomeItems.get(0);\r\n\t\t}\r\n\r\n\t\t\r\n\t\tfloat r = randomStream.randRangeF(0f, 1f);\r\n\t\treturn getSpriteFontFromProbabilityStack(r);\r\n\t}", "protected Image getP0Image(){\n if (isBoosting()) {\n if (getAnimationStep()==3) return Boost4Image;\n if (getAnimationStep()==2) return Boost3Image;\n else return Boost2Image;\n }\n else return BoostImage;\n }", "public MovingSprite obstacleToSprite(MovingSprite s) {\n\t\treturn null;\n\t}", "public Optional<Sprite> select(String spriteKey) {\n\t\tselectedKey = spriteKey;\n\t\treturn current();\n\t}", "public Image getTieOver();", "@Override\n public Sprite createSprite(TSSGame game) {\n return new Sprite();\n }", "public Image getCardPlayer1() {\n Random rand = new Random();\r\n randomNum = rand.nextInt((52 - 1) + 1) + 1;\r\n Image p1 = new Image(\"/Images/cards/Card\" + randomNum + \".png\");\r\n return p1;\r\n }", "@Override\r\n\tpublic Image getGameIcon() {\n\t\treturn null;\r\n\t}", "protected ResourceLocation getEntityTexture(Entity p_110775_1_)\n {\n return this.getEntityTexture((EntityMegaZombie)p_110775_1_);\n }", "public Image getCardPlayer2() {\n Random rand1 = new Random();\r\n randomNum1 = rand1.nextInt((52 - 1) + 1) + 1;\r\n Image p2 = new Image(\"/Images/cards/Card\" + randomNum1 + \".png\");\r\n return p2;\r\n }", "private static Image getMovePoint()\n\t{\n\t\ttry {\n\t\t\treturn ImageIO.read(new File(guiDirectory + move));\n\t\t} catch (IOException ioe) {\n\t\t}\n\t\treturn null;\n\t}", "protected Image loadIcon() {\n /*\n * Icon by http://www.artua.com/, retrieved here:\n * http://www.iconarchive.com/show/star-wars-icons-by-artua.html\n */\n return new ImageLoader().loadIcon(\"moon.png\");\n }", "@Override\r\n\tpublic int getImage() {\n\t\treturn Parametre.BALLE;\r\n\t}", "public static Texture getTex(int type)\n {\n switch(type)\n {\n case FIREBALL:\n return JTactics.assets.fireball;\n case DEFEND:\n return JTactics.assets.shield;\n case SPIRIT_BURST:\n return JTactics.assets.boulder;\n case INVINCIBILITY:\n return JTactics.assets.starPower;\n }\n return null;\n }", "public static int getAboutImage() {\n switch (RANDOM.nextInt(4)) {\n default:\n case 0:\n return R.drawable.devteam;\n case 1:\n return R.drawable.devteam;\n case 2:\n return R.drawable.devteam;\n case 3:\n return R.drawable.devteam;\n }\n }", "public static Image target()\n\t{\n\t\treturn targetImg;\n\t}", "public static Image getTile(int faction, boolean transparent)\n\t{\n\t\treturn tileBases[transparent ? 1 : 0][faction];\n\t}", "public Tile getTileAt(Position p);", "@Override\n public ResourceLocation getTextureLocation(DroneEntity entity) {\n return entity.isAttacking() ? mobShootingTexture : mobTexture;\n }", "TileItem getCurrentTile();", "public Drawable getDrawable() {\n return this.wotCharacter.getDrawable(this);\n }", "protected ResourceLocation getEntityTexture(EntityZombie p_110775_1_)\n {\n return this.getEntityTexture((EntityMegaZombie)p_110775_1_);\n }", "public Image getSeven();", "public static String getThumbnailPlayerResource(Player player) {\r\n\r\n final int teamA = 1;\r\n final int teamB = 2;\r\n\r\n String imageResource = \"\";\r\n\r\n if (player != null) {\r\n switch (player.getTeamID()) {\r\n case teamA:\r\n switch (player.getType()) {\r\n case BLACKORC:\r\n imageResource = \"/bloodbowl/resources/TeamA/blackorc.gif\";\r\n break;\r\n case BLITZER:\r\n imageResource = \"/bloodbowl/resources/TeamA/blitzer.gif\";\r\n break;\r\n case CATCHER:\r\n imageResource = \"/bloodbowl/resources/TeamA/catcher.gif\";\r\n break;\r\n case GOBLIN:\r\n imageResource = \"/bloodbowl/resources/TeamA/goblin.gif\";\r\n break;\r\n case LINEMAN:\r\n imageResource = \"/bloodbowl/resources/TeamA/lineman.gif\";\r\n break;\r\n case OGRE:\r\n imageResource = \"/bloodbowl/resources/TeamA/ogre.gif\";\r\n break;\r\n case THROWER:\r\n imageResource = \"/bloodbowl/resources/TeamA/thrower.gif\";\r\n break;\r\n case TROLL:\r\n imageResource = \"/bloodbowl/resources/TeamA/troll.gif\";\r\n break;\r\n }\r\n break;\r\n case teamB:\r\n switch (player.getType()) {\r\n case BLACKORC:\r\n imageResource = \"/bloodbowl/resources/TeamB/blackorc.gif\";\r\n break;\r\n case BLITZER:\r\n imageResource = \"/bloodbowl/resources/TeamB/blitzer.gif\";\r\n break;\r\n case CATCHER:\r\n imageResource = \"/bloodbowl/resources/TeamB/catcher.gif\";\r\n break;\r\n case GOBLIN:\r\n imageResource = \"/bloodbowl/resources/TeamB/goblin.gif\";\r\n break;\r\n case LINEMAN:\r\n imageResource = \"/bloodbowl/resources/TeamB/lineman.gif\";\r\n break;\r\n case OGRE:\r\n imageResource = \"/bloodbowl/resources/TeamB/ogre.gif\";\r\n break;\r\n case THROWER:\r\n imageResource = \"/bloodbowl/resources/TeamB/thrower.gif\";\r\n break;\r\n case TROLL:\r\n imageResource = \"/bloodbowl/resources/TeamB/troll.gif\";\r\n break;\r\n }\r\n break;\r\n\r\n }\r\n }\r\n\r\n return imageResource;\r\n }", "private SpriteType initTileSpriteType(String imgFile, String spriteTypeID)\n {\n // WE'LL MAKE A NEW SPRITE TYPE FOR EACH GROUP OF SIMILAR LOOKING TILES\n SpriteType sT = new SpriteType(spriteTypeID);\n addSpriteType(sT);\n \n // LOAD THE ART\n BufferedImage img = miniGame.loadImageWithColorKey(imgFile, COLOR_KEY);\n Image tempImage = img.getScaledInstance(TILE_IMAGE_WIDTH, TILE_IMAGE_HEIGHT, BufferedImage.SCALE_SMOOTH);\n img = new BufferedImage(TILE_IMAGE_WIDTH, TILE_IMAGE_HEIGHT, BufferedImage.TYPE_INT_ARGB);\n img.getGraphics().drawImage(tempImage, 0, 0, null);\n \n // WE'LL USE THE SAME IMAGE FOR ALL STATES\n sT.addState(INVISIBLE_STATE, img);\n sT.addState(VISIBLE_STATE, img);\n sT.addState(SELECTED_STATE, img);\n sT.addState(INCORRECTLY_SELECTED_STATE, img);\n return sT;\n }", "@Override public BufferedImage getImg(){\n if(jumpState >= 1){\n return jumpingImg;\n }\n else\n return super.getImg();\n}", "public Image getTieUnder();", "private static Image getIcon()\n\t{\n\t\ttry {\n\t\t\treturn ImageIO.read(new File(guiDirectory + icon));\n\t\t} catch (IOException ioe) {\n\t\t}\n\t\treturn null;\n\t}", "public Tile getTile(int x, int y){\n\t\tif(x < 0 || y < 0 || x >= width || y >= height){\r\n\t\t\treturn Tile.grassTile;\r\n\t\t}\r\n\t\t\r\n\t\t//tiles[x][y] give us the id and the tiles[id] is the texture\r\n\t\tTile t = Tile.tiles[tiles[x][y]]; \r\n\t\tif(t == null){\r\n\t\t\t//If you try to access undefined tile index, return dirt tile as default\r\n\t\t\treturn Tile.dirtTile; \r\n\t\t}\r\n\t\telse{\r\n\t\t\treturn t;\r\n\t\t}\r\n\t}", "protected ResourceLocation getEntityTexture(Entity p_110775_1_)\n {\n return this.getEntityTexture((EntityBat)p_110775_1_);\n }", "public Tile getTile(int pos) {\n\t\tObject t = tileList.get(pos);\n\t\tif(t instanceof Property){\n\t\t\treturn (Property) t;\n\t\t} else if(t instanceof TaxTile){\n\t\t\treturn (TaxTile) t;\n\t\t} else { // Should not happen\n\t\t\treturn (Tile) t;\n\t\t}\n\t}", "private AnimatedImage armorSprite() throws FileNotFoundException {\n\n\t\tString[] imageArray = new String[4];\n\t\tfor (int i = 0; i < 4; i++) {\n\t\t\timageArray[i] = \"sprites/BluePotion\" + i + \".png\";\n\t\t}\n\n\t\tAnimatedImage armor = new AnimatedImage(imageArray, 0.125, 70, 70);\n\n\t\treturn armor;\n\n\t}", "public Image getImage() {\r\n\t\tif (isShieldActivated()) {\r\n\t\t\treturn GameGUI.SPACESHIP_IMAGE_SHIELD;\r\n\t\t}\r\n\t\treturn GameGUI.SPACESHIP_IMAGE;\r\n\t}", "private void getRandomSprite(String type) {\n\t\tint randInt = new Random().nextInt(3);\n\t\tspriteNum = randInt;\n\t\tswitch(type){\n\t\tcase \"red\":\n\t\t\tspriteCol = 0;\n\t\t\tbreak;\n\t\tcase \"blue\":\n\t\t\tspriteCol = 1;\n\t\t\tbreak;\n\t\tcase \"green\":\n\t\t\tspriteCol = 2;\n\t\t\tbreak;\n\t\tcase \"black\":\n\t\t\tspriteCol = 3;\n\t\t\tbreak;\n\t\tcase \"grey\":\n\t\t\tspriteCol = 4;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tspriteCol =0;\n\t\t\tbreak;\n\t\t}\n\t}", "public Image getCardPlayer3() {\n Random rand5 = new Random();\r\n randomNum5 = rand5.nextInt((52 - 1) + 1) + 1;\r\n Image p3 = new Image(\"/Images/cards/Card\" + randomNum5 + \".png\");\r\n return p3;\r\n }", "public String getDefaultImgSrc(){return \"/students/footballstudentdefault.png\";}" ]
[ "0.69453824", "0.6914971", "0.68888724", "0.65970856", "0.65732825", "0.65651006", "0.6540106", "0.6539612", "0.6477449", "0.64724755", "0.64631975", "0.64297134", "0.6388656", "0.6354086", "0.63505995", "0.6337815", "0.6287626", "0.6284226", "0.6265833", "0.6265833", "0.6247777", "0.6228216", "0.6224425", "0.611164", "0.60748214", "0.6051129", "0.6038771", "0.6008518", "0.59761006", "0.5930519", "0.59253776", "0.59078395", "0.5880814", "0.58557415", "0.58389556", "0.5831736", "0.58090353", "0.579225", "0.577692", "0.57707435", "0.5754424", "0.57325244", "0.5718971", "0.57005477", "0.568421", "0.568016", "0.5659966", "0.5654218", "0.5644198", "0.562773", "0.5614475", "0.5613889", "0.5613011", "0.55996805", "0.55825305", "0.5576213", "0.55541456", "0.5543029", "0.55315113", "0.5524915", "0.55221677", "0.55213493", "0.5514839", "0.5509097", "0.54956156", "0.5491505", "0.54714817", "0.5439786", "0.54283386", "0.5426361", "0.54246014", "0.5422709", "0.5413184", "0.5392399", "0.5391345", "0.5383872", "0.53824586", "0.5379998", "0.53744817", "0.53691703", "0.536347", "0.535684", "0.53550786", "0.53523314", "0.53515863", "0.5341553", "0.5317417", "0.5300477", "0.5298845", "0.52923715", "0.52834004", "0.5281251", "0.52810585", "0.5279469", "0.5277616", "0.5265459", "0.5256617", "0.52549964", "0.5254008", "0.5252314" ]
0.83388937
0
Gets the mouse cursor image to use for this entity.
@Override public StendhalCursor getCursor() { return StendhalCursor.LOOK; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract Cursor getMouseCursor();", "public Cursor getCursor() {\n Cursor cursor = super.getCursor();\n\n\t\tif ( cursor == Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR) && isEnabled()) {\n\t\t\tcursor = Cursor.getPredefinedCursor( Cursor.HAND_CURSOR);\n\t\t}\n\t\t\n\t\treturn cursor;\n }", "public Mouse getMouse()\r\n\t{\r\n\t\treturn mouse;\r\n\t}", "public Mouse getMouse() {\n return mouse;\n }", "T getMouse();", "public Image getImage() {\r\n\t\treturn GDAssemblerUI.getImage(GDAssemblerUI.IMAGE_GD);\r\n\t}", "public CursorWrapper getCursor() {\n\t\t\treturn cursor;\n\t\t}", "public YuiImage getSelectedImg() {\r\n\t\treturn selectedImg;\r\n\t}", "public BufferedImage getImage() {\n\t\tTelaInterna ti = ( TelaInterna )contentPane.getSelectedFrame();\n\t\tBufferedImage img;\n\t\timg = ti.getImage();\n\t\treturn img;\n\t}", "public java.lang.String getCursor() {\n return cursor_;\n }", "public Image getImage() {\r\n\t\tif (isShieldActivated()) {\r\n\t\t\treturn GameGUI.SPACESHIP_IMAGE_SHIELD;\r\n\t\t}\r\n\t\treturn GameGUI.SPACESHIP_IMAGE;\r\n\t}", "public com.google.protobuf.ByteString\n getCursorBytes() {\n return com.google.protobuf.ByteString.copyFromUtf8(cursor_);\n }", "public Graphics getImageGraphics() {\n\t\treturn image.getGraphics();\n\t}", "public BufferedImage getImage() {\n\t\treturn this.image;\n\t}", "public Login() {\n initComponents();\n \n this.setIconImage(new ImageIcon(getClass().getResource(\"ico.png\")).getImage());\n Toolkit toolkit = Toolkit.getDefaultToolkit();\n\nImage img = toolkit.getImage(\"cur1.png\");\n\nPoint point = new Point(0,0);\n Cursor cursor=toolkit.createCustomCursor(img, point, \"Cursor\"); \n\n setCursor(cursor);\n \n \n }", "public com.google.protobuf.ByteString\n getCursorBytes() {\n return instance.getCursorBytes();\n }", "public Rectangle getImage() {\n\t\treturn image;\n\t}", "public MousePointer () {\n\t\tthis.loadPointer(MousePointer.DEFAULT_CURSOR);\n\t}", "@Override\n\tpublic final Image getImage() {\n\t\treturn this.getSprite().getImage();\n\t}", "@Override\n public Point2D getMouseLocation() {\n if (PlatformAdapter.getOs() == PlatformAdapter.OS.UNIX &&\n !JavaVersionAdapter.currentVersion().isJava11Compatible()) {\n return waitForAsyncFx(RETRIEVAL_TIMEOUT_IN_MILLIS,\n () -> new Point2D(((Double) getRobot().getClass().getMethod(\"getMouseX\").invoke(\n getRobot())).intValue() / JavaVersionAdapter.getScreenScaleX(),\n ((Double) getRobot().getClass().getMethod(\"getMouseY\").invoke(\n getRobot())).intValue() / JavaVersionAdapter.getScreenScaleY()));\n }\n else {\n return waitForAsyncFx(RETRIEVAL_TIMEOUT_IN_MILLIS, () -> new Point2D(\n ((Double) getRobot().getClass().getMethod(\"getMouseX\").invoke(glassRobot)).intValue(),\n ((Double) getRobot().getClass().getMethod(\"getMouseY\").invoke(glassRobot)).intValue()));\n }\n }", "public String getCursorString() {\n\t\t\treturn getCursor() + \"@\" + getSelectionPos();\n\t\t}", "public Cursor getGraphCursor() {\r\n \t\treturn graph.getCursor();\r\n \t}", "public Cursor getLogoImagePath() {\n\n\t\ttry {\n\t\t\tString sql = \"SELECT LogoPath FROm Logos\";\n\n\t\t\tCursor mCur = mDb.rawQuery(sql, null);\n\t\t\treturn mCur;\n\n\t\t} catch (SQLException mSQLException) {\n\t\t\tLog.e(TAG, \"getTestData >>\" + mSQLException.toString());\n\t\t\tthrow mSQLException;\n\t\t}\n\t}", "public ImageIcon getImage() {\n\t\treturn this.image;\n\t}", "public java.lang.String getCursor() {\n return instance.getCursor();\n }", "public Vector2 getMousePosition() {\n\t\tif (camera == null)\n\t\t\treturn new Vector2(0,0);\n\t\tfloat mx = Program.mouse.getX(), my = Program.mouse.getY();\n\t\tfloat xPercent = mx/Program.DISPLAY_WIDTH, yPercent = my/Program.DISPLAY_HEIGHT;\n\t\tfloat x = camera.getX() + camera.getWidth() * xPercent,\n\t\t\t y = camera.getY() + camera.getHeight() * yPercent;\n\t\treturn new Vector2(x,y);\n\t}", "public Image getSourceIcon() {\n return impl.getSourceIcon();\n }", "public BufferedImage getImage() {\n return image;\n }", "public BufferedImage getImage() {\t\r\n\t\treturn this.image;\t\t\t\r\n\t}", "public Point2D getMousePosition() {\n\t\treturn Lel.coreEngine.panelPositionToWorld(input.getMousePosition());\n\t}", "public BufferedImage getImage() {\n\t\t return img;\n\t}", "@Override\r\n\tpublic Image getImg() {\n\t\treturn img.getImage();\r\n\t}", "public Object getOnmousemove() {\r\n\t\treturn getOnMouseMove();\r\n\t}", "public ImageIcon getImage(){\n\t\treturn this.image;\n\t}", "public BufferedImage getImage()\r\n\t{\r\n\t\treturn mImageBuffer;\r\n\t}", "public void setMouseOverCursor(Cursor cursor) {\n mouseOverCursor = cursor;\n }", "public Drawable getImage(){\n\t\treturn mImage;\n\t}", "public Cursor getEnabledCursor() {\r\n return enabledCursor;\r\n }", "public Image getImage() {\n MimsChartPanel mcp = getChartPanel();\n if (mcp == null) {\n return null;\n }\n BufferedImage img = mcp.getChart().createBufferedImage(mcp.getWidth(), mcp.getHeight());\n if (img == null) {\n return null;\n }\n return img;\n }", "public Image getImage()\n {\n if (fill instanceof ImageFill)\n {\n return ((ImageFill) fill).getImage();\n }\n else\n {\n return null;\n }\n }", "public YuiImage getSelectedImgOver() {\r\n\t\treturn selectedImgOver;\r\n\t}", "byte[] getCurrentPixel() {\n byte[] pixel = new byte[2];\n\n pixel[0] = ((byte) cursor.getX());\n pixel[1] = ((byte) cursor.getY());\n\n for (byte b : pixel) {\n\n if (b >= axisLength || b < 0) {\n return null;\n }\n }\n return pixel;\n }", "public Cursor getDisabledCursor() {\r\n return disabledCursor;\r\n }", "public Bitmap getImage() {\n return image;\n }", "public ImageIcon getImage()\n {\n return image;\n }", "public ImageIcon getCurrentImage() {\n\t\t\treturn this.currentImage;\n\t}", "public Cursor getCursor() {\n\t\treturn null;\n\t}", "private Point2D mouseLocation() {\n return FXGL.getInput().getMousePositionWorld();\n\n }", "public final int getCursorX() {\n return cursorX;\n }", "public Image getImage() {\n\t\treturn image;\n\t}", "public Image getImage() {\n\t\treturn image;\n\t}", "public Image getImage() {\n\t\treturn image;\r\n\t}", "public EntityIcon getIcon() {\r\n return icon;\r\n }", "public String getImage() {\n\t\treturn image;\n\t}", "public String getImage() {\n\t\treturn image;\n\t}", "public Image getImage() {\r\n\t\treturn image;\r\n\t}", "public final ImageProcessor getImage() {\r\n return image;\r\n }", "@Override\n\tImageIcon getImage() {\n\t\treturn img;\n\t}", "public java.lang.String getImage() {\n\t\treturn _imageCompanyAg.getImage();\n\t}", "public final int getCursorAbsoluteX() {\n return getAbsoluteX() + cursorX;\n }", "private org.eclipse.swt.graphics.Cursor getPlatformCursor(final CursorFrame cursorFrame) {\n if (cursorFrame.getCursorType() == CursorType.DEFAULT) {\n return null;\n }\n final org.eclipse.swt.graphics.Cursor cachedPlatformCursor =\n cursorFrame.getPlatformCursor(org.eclipse.swt.graphics.Cursor.class);\n if (cachedPlatformCursor != null) {\n // platform cursor already cached\n return cachedPlatformCursor;\n }\n\n // platform cursor not cached yet\n final org.eclipse.swt.graphics.Cursor platformCursor = \n SWTCursors.embedCursorToCursor(cursorFrame);\n cursorFrame.setPlatforCursor(org.eclipse.swt.graphics.Cursor.class, platformCursor);\n\n return platformCursor;\n }", "public static MouseState getMouseState() throws SDLException {\n\tint x[] = {0};\n\tint y[] = {0};\n\n\tint buttons = SWIG_SDLEvent.SDL_GetMouseState(x, y);\n\treturn new MouseState(x[0], y[0], buttons);\n }", "public double getMouseX() {\n\t\treturn getMousePosition().getX();\n\t}", "@Override\n\tpublic Image getImage() {\n\t\treturn img;\n\t}", "public ImageIcon getImage() {\n\t\treturn pigsty;\n\t}", "public ItemStack getItemOnCursor ( ) {\n\t\treturn extract ( handle -> handle.getItemOnCursor ( ) );\n\t}", "public BufferedImage image(){\n\t\treturn shotPic;\n\t}", "public final int getCursorY() {\n return cursorY;\n }", "String getKbmouseTarget();", "public Point getLastMousePosition () {\r\n return myLastMousePosition;\r\n }", "public javafx.scene.image.Image getImage() {\n return super.getImage();\n }", "public javafx.scene.image.Image getImage() {\n return super.getImage();\n }", "public javafx.scene.image.Image getImage() {\n return super.getImage();\n }", "public us.ihmc.euclid.tuple3D.Point3D getMousePoint()\n {\n return mouse_point_;\n }", "public BufferedImage getImage() {\n return boardImage;\n }", "public int getKeyDownMouse() {\r\n return Input.Keys.valueOf(getKeyDownMouseName());\r\n }", "Cursor getCursor(final Point p) {\n return getTarget().getCursor();\n }", "public Drawable getDrawable() {\n return this.wotCharacter.getDrawable(this);\n }", "public BufferedImage getCurrentImage(){\n\t\treturn getCurrentImage(System.currentTimeMillis()-lastUpdate);\n\t}", "public Image getInstanceImage() {\r\n return this.image;\r\n }", "public String getImage() {\n return this.Image;\n }", "public Cursor getBackgroundImagePath() {\n\n\t\ttry {\n\t\t\tString sql = \"SELECT BackgroundPath FROm PicturesPath order by id\";\n\n\t\t\tCursor mCur = mDb.rawQuery(sql, null);\n\t\t\treturn mCur;\n\n\t\t} catch (SQLException mSQLException) {\n\t\t\tLog.e(TAG, \"getTestData >>\" + mSQLException.toString());\n\t\t\tthrow mSQLException;\n\t\t}\n\t}", "public MouseCursor(ContentSystem contentSystem,\r\n\t\t\tMultiTouchInputComponent input, TableIdentity tableId,\r\n\t\t\tint cursorId, Color color) {\r\n\t\t\r\n\t\tBufferedImage cursorImage = null;\r\n\t\ttry {\r\n\t\t\tImage img = (new ImageIcon(\r\n\t\t\t\t\tMTDesktopConfigurations.class\r\n\t\t\t\t\t\t\t.getResource(\"tabletop/cursor.png\"))).getImage();\r\n\t\t\tcursorImage = new BufferedImage(img.getWidth(null),\r\n\t\t\t\t\timg.getHeight(null), BufferedImage.TYPE_INT_ARGB);\r\n\t\t\tGraphics g = cursorImage.createGraphics();\r\n\t\t\tg.drawImage(img, 0, 0, null);\r\n\t\t\tg.dispose();\r\n\t\t\tcursorImage = ColorChanger.changeColor(cursorImage, Color.white,\r\n\t\t\t\t\tcolor);\r\n\t\t\tFile coloredImageFile = new File(\r\n\t\t\t\t\tMTDesktopConfigurations.tabletopTempFolder + \"/\" + tableId\r\n\t\t\t\t\t\t\t+ \".png\");\r\n\t\t\tImageIO.write(cursorImage, \"png\", coloredImageFile);\r\n\t\t\twhile (!coloredImageFile.exists()) {\r\n\t\t\t}\r\n\t\t\t;\r\n\t\t\tcursor = (LightImageLabel) contentSystem\r\n\t\t\t\t\t.createContentItem(LightImageLabel.class);\r\n\t\t\tif (cursorImage != null) {\r\n\t\t\t\tcursor.drawImage(new File(\r\n\t\t\t\t\t\tMTDesktopConfigurations.tabletopTempFolder + \"/\"\r\n\t\t\t\t\t\t\t\t+ tableId + \".png\").toURI().toURL());\r\n\t\t\t} else {\r\n\t\t\t\tcursor.drawImage(MTDesktopConfigurations.class\r\n\t\t\t\t\t\t.getResource(\"tabletop/cursor.png\"));\r\n\t\t\t}\r\n\t\t\tcursor.setAutoFitSize(false);\r\n\t\t\tcursor.setWidth(CURSOR_WIDTH);\r\n\t\t\tcursor.setHeight(CURSOR_WIDTH);\r\n\t\t\tcursor.centerItem();\r\n\t\t\tcursor.setAsTopObject();\r\n\t\t\tcursor.setBringToTopable(false);\r\n\t\t\tthis.input = input;\r\n\t\t\tthis.tableId = tableId;\r\n\t\t} catch (IOException e) {\r\n\t\t\t\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public Image getImage() {\r\n return image;\r\n }", "public PImage getImage() {\n return this.image;\n }", "public ImageIdentifier getImageIdentifier() {\n synchronized (this.imageLock) {\n return this.animation.getCurrentImage();\n }\n }", "public Image getImage() {\n return image;\n }", "public Image getImage() {\n return image;\n }", "public ImageIcon image() {\n return image;\n }", "public Icon getImageIcon() {\r\n\t\treturn lblImageViewer.getIcon();\r\n\t}", "public void draw_cursor(){\n }", "public BufferedImage getImage()\n \t{\n \t\ttry\n \t\t{\n \t\t\tif(bi==null)\n \t\t\t{\n \t\t\t\tint\n \t\t\t\t\tiWidth=(int)(getInteger(PROPERTY_WIDTH)*getQuestion().getZoom()),\n \t\t\t\t\tiHeight=(int)(getInteger(PROPERTY_HEIGHT)*getQuestion().getZoom());\n \n \t\t\t\t// Create image\n \t\t\t\tbi=new BufferedImage(iWidth,iHeight,BufferedImage.TYPE_INT_RGB);\n \n \t\t\t\t// Fill to background\n \t\t\t\tGraphics g=bi.getGraphics();\n \t\t\t\tg.setColor(getBackground());\n \t\t\t\tg.fillRect(0,0,iWidth,iHeight);\n \t\t\t}\n \t\t\treturn bi;\n \t\t}\n \t\tcatch(OmDeveloperException ode)\n \t\t{\n \t\t\tthrow new OmUnexpectedException(ode);\n \t\t}\n \t}", "public String getImage() {\n return image;\n }", "public String getImage() {\n return image;\n }", "public String getImage() {\n return image;\n }", "public String getImage() {\n return image;\n }", "@Override\n\tpublic Image getImage() {\n\t\treturn image;\n\t}", "public Image getTileImage(){\n\t\treturn tileImage;\n\t}", "public BufferedImage queryImage() {\n\t\treturn cloud;\n\t}", "public WeightedPoint getCursor()\n {\n return cursor;\n }" ]
[ "0.70808357", "0.6363036", "0.61057", "0.60541093", "0.5953222", "0.5909639", "0.59033734", "0.5892197", "0.5808079", "0.57936937", "0.57639027", "0.57538724", "0.57457125", "0.5736615", "0.57256424", "0.57067376", "0.5688645", "0.56816787", "0.56808066", "0.567282", "0.56492364", "0.5642568", "0.5636649", "0.56201696", "0.56109613", "0.5600117", "0.55827403", "0.5578934", "0.5556336", "0.55500066", "0.5537119", "0.5528526", "0.5513218", "0.5502703", "0.54982513", "0.54947686", "0.5484636", "0.54845434", "0.54607207", "0.54559463", "0.5453932", "0.5450646", "0.5448857", "0.54061496", "0.5381584", "0.537292", "0.53636473", "0.53528285", "0.5351493", "0.53481907", "0.53481907", "0.53476524", "0.534718", "0.5346685", "0.5346685", "0.53463227", "0.5344913", "0.5337497", "0.53368735", "0.53362775", "0.533208", "0.5326072", "0.5325837", "0.5322359", "0.53076446", "0.5306936", "0.5301375", "0.52955806", "0.52938986", "0.52936924", "0.52934456", "0.52934456", "0.52934456", "0.5282429", "0.528078", "0.52758086", "0.527464", "0.5273025", "0.525511", "0.5254064", "0.5251018", "0.5250794", "0.5235949", "0.5233926", "0.5228935", "0.522871", "0.5217058", "0.52140725", "0.5209713", "0.52095306", "0.5209374", "0.52055967", "0.52042294", "0.52042294", "0.52042294", "0.52042294", "0.52006304", "0.51998186", "0.51901615", "0.51850986" ]
0.52791524
75
TODO submit data to server... Intent i = new Intent(DetailPembayaranActivity.this, KeranjangActivity.class); Bundle b = new Bundle(); b.putString("judul", "00"); i.putExtras(b); startActivity(i);
@OnClick(R.id.btnKembali) public void SaatKembali() { finish(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void onClick(View view){\n Intent toDetailActivity = new Intent (view.getContext(), Detail.class);\n toDetailActivity.putExtra(\"nama\", nama.getText().toString());\n toDetailActivity.putExtra(\"gender\",avatarCode);\n toDetailActivity.putExtra(\"pekerjaan\", job.getText().toString());\n view.getContext().startActivity(toDetailActivity);\n }", "@Override\n public void onClick(View v) {\n Intent intent=new Intent(activity.getApplicationContext(),ServisTalebi.class);\n intent.putExtra(\"id\",talep.getId().toString());\n intent.putExtra(\"baslik\",talep.getBaslik().toString());\n intent.putExtra(\"aciklama\",talep.getAciklama().toString());\n intent.putExtra(\"durum\",talep.getDurum().toString());\n intent.putExtra(\"yorum\",talep.getYorum().toString());\n\n activity.startActivity(intent);\n\n\n }", "public void ulang(View view) {\n finish();\n //perintah untuk intent HasilKuis ke halaman SoalKuis kembali\n Intent intent = new Intent(getApplicationContext(), SoalKuis.class);\n //untuk memulai intent\n startActivity(intent);\n }", "public void onClick(View v) {\n\n finish();\n Intent i=new Intent(getApplicationContext(),menhde.class);\n i.putExtra(\"id\", \"7\");\n startActivity(i);\n\n }", "@Override\n public void onClick(View view) {\n Intent i = new Intent(getActivity(), CadastroDespesaItem.class);\n i.putExtra(\"Reembolso\", Reembolso);\n Bundle params = new Bundle();\n params.putString(\"CU_LOGIN\", prpUsuario_Logado);\n params.putString(\"CU_ID\", prpUsuario_ID);\n params.putString(\"TIPO_PESQUISA\", _gsTIPOPESQUISA);\n i.putExtras(params);\n\n startActivity(i);\n }", "public void tampilNama(View view) {\n Intent ganti = new Intent(this, ListNamaMahasiswa.class);\n //memulai activity ke list nama mahasiswa\n startActivity(ganti);\n }", "@Override\n\t\t\tpublic void onClick(View v)\n\t\t\t{\n\t\t\t\tIntent intent = new Intent(DeviceActivity.this, sdw.com.CountyActivity.class);// ����������Activity\n\t\t\t\t Bundle bundle = new Bundle(0); \n\t bundle.putString(\"fun1\",transferValue);\n\t Log.e(\"TAG\",transferValue);\n\t bundle.putString(\"search1\",\"btnRunRecord\"); \n\t intent.putExtras(bundle);//can't \n\t\t\t\tstartActivity(intent);\n//\t\t\t\tfinish();\n\t\t\t}", "@Override\n public void onClick(View v) {\n Referinta.Verset = v.getId();\n\n Intent intent = new Intent(getContext(), TextActivity.class);\n // 2. put key/value data\n\n // intent.putExtra(\"referinta\", referinta );\n // intent.putExtra(\"message\", capitole[1]);\n\n // 3. or you can add data to a bundle\n\n\n // 5. start the activity\n startActivity(intent);\n // finish();\n\n }", "public void onClick(View v) {\n\n finish();\n Intent i=new Intent(getApplicationContext(), maotu.class);\n i.putExtra(\"id\", \"1\");\n startActivity(i);\n\n }", "@Override\n public void onClick(View v) {\n reference = FirebaseDatabase.getInstance().getReference().child(\"HutangApp\").\n child(\"hutang\" + hutangNum);\n reference.addListenerForSingleValueEvent(new ValueEventListener() { // Ketika ada perubahan data dibaca 1x\n @Override\n public void onDataChange(@NonNull DataSnapshot dataSnapshot) {\n // Set and put the data in MainActivity\n dataSnapshot.getRef().child(\"nama\").setValue(namahutang.getText().toString());\n dataSnapshot.getRef().child(\"jumlah\").setValue(jumlahhutang.getText().toString());\n dataSnapshot.getRef().child(\"deskripsi\").setValue(deskripsihutang.getText().toString());\n dataSnapshot.getRef().child(\"tanggal\").setValue(tanggalhutang.getText().toString());\n dataSnapshot.getRef().child(\"keyhutang\").setValue(keyhutang);\n\n // Show the data in MainActivity\n Toast.makeText(getApplicationContext(), \"Data successfully added\", Toast.LENGTH_SHORT).show();\n\n Intent a = new Intent(NewHutangAct.this, MainActivity.class);\n startActivity(a);\n finish();\n }\n\n @Override\n public void onCancelled(@NonNull DatabaseError databaseError) {\n\n }\n });\n }", "@Override\n public void onClick(View v) {\n\n Intent intent = new Intent(chitietsanpham.this, thanhtoandathang.class);\n // Intent intent = new Intent(mContext,chitietsanpham.class);\n intent.putExtra(\"name\",name);\n // intent.putExtra(\"image\",mData.get(position).getPhoto());\n intent.putExtra(\"gia\",gia1);\n startActivity(intent);\n }", "public void onClick(View v) {\n\n finish();\n Intent i=new Intent(getApplicationContext(),thantu.class);\n i.putExtra(\"id\", \"6\");\n startActivity(i);\n\n }", "@Override\n public void onClick(View view) {\n Intent intent = new Intent(context, DetailActivity.class);\n intent.putExtra(\"nb\", nama[position]);\n intent.putExtra(\"gb\", gambar[position]);\n intent.putExtra(\"dt\", detail[position]);\n context.startActivity(intent);\n\n\n\n\n }", "public void onClick(View arg0) {\n\n Intent i = new Intent(getApplicationContext(), sejarah.class);\n\n startActivity(i);\n }", "public void dalejClicked(View view) {\n\n if (done) {\n\n Bundle dane = new Bundle();\n\n dane.putDouble(\"czasNaUczelni\", czasNaUczelni);\n dane.putDouble(\"cnps\", cnps);\n dane.putDouble(\"bezCzWolny\", bezCzWolny);\n dane.putDouble(\"wzgleCzWolny\", wzgleCzWolny);\n dane.putDouble(\"czasZmarnowany\", czasZmarnowany);\n dane.putSerializable(\"kursy\",kursy);\n dane.putSerializable(\"cnpsKursu\",cnpsKursu);\n dane.putString(\"uzytkownik\",uzytkownik);\n dane.putString(\"specjalizacja\",specjalizacja);\n dane.putInt(\"semestr\",semestr);\n\n Intent wykresy= new Intent(getApplicationContext(),WykresyLen.class);\n wykresy.putExtra(\"Bundle\",dane);\n startActivity(wykresy);\n\n\n }\n\n }", "@Override\n public void onClick(View v) {\n j=0;\n dataBaseClass.updateData1(b1.getText().toString(),q.getText().toString());\n Intent i=new Intent(Question.this,Congratulation.class);\n// i.putExtra(\"json\",al);\n// i.putExtra(\"slectedAnswer\",alA);\n i.putExtra(\"Subject\",subject);\n i.putExtra(\"score\",String.valueOf(count));\n startActivity(i);\n }", "private void check_1() {\n\n Intent l = new Intent(MainActivity.this, MapsView.class);\n //l.putExtra(\"kategori\", \"Bank\");\n\n\n startActivity(l);\n }", "public void pindah_ke_log(View v)\n {\n Intent dashboard = new Intent(DashboardUser.this,BuyerTransactionActivity.class) ;\n dashboard.putExtra(\"param1\",value1);\n dashboard.putExtra(\"param2\",value2);\n dashboard.putExtra(\"param3\",value3);\n dashboard.putExtra(\"param4\",value4);\n dashboard.putExtra(\"param5\",value5);\n// SharedPreferences sharedPreferences = getSharedPreferences(SHARED_PREFS, MODE_PRIVATE);\n// SharedPreferences.Editor editor = sharedPreferences.edit();\n// editor.putString(TEXT, value1);\n// editor.putString(SWITCH, value2);\n// editor.apply();\n startActivityForResult(dashboard, 100);\n }", "@Override\n\t\t\t\t\tpublic void onClick(View v) {\n\t\t\t\t\t\tIntent intent=new Intent(getActivity(),Productdetailactivity.class);\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tintent.putExtra(\"productid\", jobject1.getString(\"Ipro_id\"));\n\t\t\t\t\t\t\tintent.putExtra(\"productname\", jobject1.getString(\"Ipro_name\"));\n\t\t\t\t\t\t\tintent.putExtra(\"buynum\",\"30天购买人数 \"+jobject1.getString(\"purchaseNum\"));\n\t\t\t\t\t\t\tintent.putExtra(\"day\", \"期限(天)\"+jobject1.getString(\"dayDiff\"));\n\t\t\t\t\t\t\tintent.putExtra(\"shouyi\", String.format(\"%.2f\", jobject1.getDouble(\"pctInterest\"))+\"%\");\n\t\t\t\t\t\t\tstartActivity(intent);\n\t\t\t\t\t\t} catch (JSONException e) {\n\t\t\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t}", "@Override\n public void onClick(View v) {\n j=0;\n dataBaseClass.updateData1(b2.getText().toString(),q.getText().toString());\n Intent i=new Intent(Question.this,Congratulation.class);\n// i.putExtra(\"json\",al);\n// i.putExtra(\"slectedAnswer\",alA);\n i.putExtra(\"Subject\",subject);\n i.putExtra(\"score\",String.valueOf(count));\n startActivity(i);\n }", "public void onClick(View v) {\n\n finish();\n Intent i=new Intent(getApplicationContext(),tinhtu.class);\n i.putExtra(\"id\", \"2\");\n startActivity(i);\n\n }", "public void onClick(View v) {\n\n finish();\n Intent i=new Intent(getApplicationContext(),sosanh.class);\n i.putExtra(\"id\", \"3\");\n startActivity(i);\n\n }", "public void onClick(View v) {\n\n finish();\n Intent i=new Intent(getApplicationContext(),gioitu.class);\n i.putExtra(\"id\", \"4\");\n startActivity(i);\n\n }", "@Override\n public void onClick(View v) {\n\n\n Intent int1 = new Intent(getApplicationContext(), lista.class);\n int1.putExtra(\"variableInvitado\", Sesion);\n startActivity(int1 );\n }", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tIntent i = new Intent(Akun.this, Keranjang.class);\n\t\t\t\tstartActivity(i);\n\t\t\t}", "public void onClick(View v) {\n\n finish();\n Intent i=new Intent(getApplicationContext(),lientu.class);\n i.putExtra(\"id\", \"5\");\n startActivity(i);\n\n }", "public void miClick(View v){\n Bundle bundle = new Bundle();\n bundle.putString(\"nombre\", edtNombre.getText().toString());\n bundle.putString(\"apellido\", edtApellido.getText().toString());\n int iEdad = Integer.parseInt(edtEdad.getText().toString());\n bundle.putInt(\"edad\",iEdad);\n int iSexo;\n if(rgS.getCheckedRadioButtonId() == R.id.rbtnM)\n iSexo = 0;\n else if(rgS.getCheckedRadioButtonId() == R.id.rbtnF)\n iSexo = 1;\n else\n iSexo = 2;\n bundle.putInt(\"sexo\", iSexo);\n inDatos.putExtras(bundle);\n startActivity(inDatos);\n\n }", "void mChapie(){\n Intent i = new Intent(context,Peminjaman.class);\n context.startActivity(i);\n\n }", "@Override\n public void onClick(View v) {\n Intent i=new Intent(getApplicationContext(),pagos.class);\n String user=bl.getString(\"user\");\n //pasar a la nueva ventana el user del usuario\n i.putExtra(\"user\",String.valueOf(user));\n //pasar a la nueva ventana el saldo del usuario\n i.putExtra(\"saldo\",etSaldo.getText().toString());\n //lanzar la nueva ventana\n startActivity(i);\n }", "@Override\r\n public void onClick(View v) {\n Intent i = new Intent(verify_list.this, Verify_a_donor.class);\r\n i.putExtra(\"name\", name_text);\r\n i.putExtra(\"username\", username_text);\r\n i.putExtra(\"blood\", bloodtext);\r\n i.putExtra(\"phno\", phnotext);\r\n i.putExtra(\"admin\", admin);\r\n startActivity(i);\r\n }", "@Override\n public void onClick(View view) {\n Toast.makeText(UserPemesananJadwalActivity.this, \"yes\", Toast.LENGTH_SHORT).show();\n Intent intent = new Intent(UserPemesananJadwalActivity.this, UserNotifActivity.class);\n startActivity(intent);\n finish();\n }", "@Override\n public void onClick(View v) {\n Intent intent = new Intent(MainActivity.this, layout2Activity.class);\n\n //creo bundle que va a llevar los datos ingresados\n Bundle datos = new Bundle();\n\n //agrego datos ingresados al bundle creado\n datos.putString(\"nombre\", nombreIngresado.getText().toString());\n datos.putString(\"apellido\", apellidoIngresado.getText().toString());\n datos.putString(\"edad\", edadIngresada.getText().toString());\n\n //asocio el bundle con el intent creado arriba\n intent.putExtras(datos);\n\n //ejecuto el intent\n startActivity(intent);\n\n }", "@Override\n public void onClick(View view) {\n context.startActivity(FirebaseDBReadSingleActivity.getActIntent((Activity) context).putExtra(\"data\", daftarBarang.get(position)));\n }", "@Override\n public void onClick(View view) {\n context.startActivity(FirebaseDBReadSingleActivity.getActIntent((Activity) context).putExtra(\"data\", daftarBarang.get(position)));\n }", "@Override\n public void onClick(View v) {\n\n Intent intent = new Intent(v.getContext(), DetailsDepto.class);\n Bundle extras = new Bundle();\n extras.putString(\"EXTRA_IdDepto\", listItemsInmueble.getIDDepto());\n extras.putBoolean(\"logedState\", logedIn);\n extras.putString(\"idDepto\",hasDepto);\n extras.putString(\"idUser\",idUser);\n extras.putString(\"user\", user);\n intent.putExtras(extras);\n v.getContext().startActivity(intent);\n\n\n }", "@Override\n public void onClick(View v) {\n Bundle bdl = new Bundle();\n String emailid = txt_Body.getText().toString().trim();\n String Subject = txt_Subject.getText().toString().trim();\n bdl.putString(\"body\", EmailBody);\n bdl.putString(\"subject\", Subject);\n Intent intent1 = new Intent(Emails_DetailsActivity.this,\n Email_Forword_Activity.class);\n intent1.putExtras(bdl);\n startActivity(intent1);\n }", "@Override\n public void onClick(View view) {\n Intent intent = new Intent();\n intent.setClass(getApplicationContext(), Atividade2.class);\n //envio do parametro chamado parametro1\n intent.putExtra(\"parametro1\", \"este é um parametro\");\n startActivity(intent);\n }", "@Override\n public void onClick(View arg0) {\n SQLiteDatabase db = mydb.getWritableDatabase();\n db.execSQL(\"update contact set nama='\" +\n ETnamaU.getText().toString() + \"', tgl='\" +\n ETtlpU.getText().toString() + \"', jk='\" +\n ETemailU.getText().toString() + \"', alamat='\" +\n ETalamatU.getText().toString() + \"' where id'\");\n Toast.makeText(getApplicationContext(), \"Berhasil\", Toast.LENGTH_LONG).show();\n Intent i = new Intent(getApplicationContext(), MainActivity.class);\n startActivity(i);\n }", "@Override\n public void onClick(View v) {\n Intent i=new Intent(mContext,DetailAnnonceCovoitureur.class);\n Intent intent=((Activity) mContext).getIntent();\n String s=intent.getStringExtra(\"action\");\n i.putExtra(\"action\",s);\n Bundle b = new Bundle();\n b.putSerializable(\"annonce\",annonceCovoitureurs.get(position));\n i.putExtras(b);\n mContext.startActivity(i);\n }", "public void submit(){\n\n Intent intentFinish = new Intent(MainActivity.this,Finish.class);\n Intent data = getIntent();\n String name = (String) data.getSerializableExtra(\"name\");\n String number = (String) data.getSerializableExtra(\"number\");\n intentFinish.putExtra(\"name\", name);\n intentFinish.putExtra(\"number\", number);\n startActivity(intentFinish);\n\n }", "public void mantUnidades(View view){\n Intent intent = new Intent(this, mant_unidades.class);\n startActivity(intent);\n }", "public void bSitio1(View view){\n Intent i = new Intent(getApplicationContext(), MapsActivity.class);\n i.putExtra(\"Latitud\", 6.21999);\n i.putExtra(\"Longitud\", -75.190537);\n i.putExtra(\"destino\", \"Isla Guaca\");\n startActivity(i);\n }", "@Override\r\n public void onClick(View v) {\n String robodata=\"robot data\";\r\n String stringdata = \"throwing\";\r\n Intent mysqlintent = new Intent(collect_Data.this,mysql.class); //defining the intent.\r\n mysqlintent.putExtra(robodata, stringdata); //putting the data into the intent\r\n startActivity(mysqlintent); //launching the mysql activity\r\n }", "@Override\n public void onClick(View v) {\n String s1=e1.getText().toString();\n String s2=e2.getText().toString();\n Intent i=new Intent(MainActivity.this,Secondactivity.class);\n //use method of intent class this is putExtra(through putextra method)send data in form of key n valu\n i.putExtra(\"name_key\",s1);\n i.putExtra(\"phone_name\",s2);\n startActivity(i);\n\n\n\n }", "@Override\n public void onResponse(Call<Response_cek> call, Response<Response_cek> response) {\n data = response.body().getResult();\n\n\n\n if (data.size()==0) {\n if (quiz_tampung.equals(\"1\")){\n Intent intent = new Intent(getApplicationContext(), menu_quiz_1.class);\n Bundle b = new Bundle();\n // Toast.makeText(getApplicationContext() ,\"Anda Sudah Quiz\", Toast.LENGTH_LONG).show();\n //Menyisipkan tipe data String ke dalam obyek bundle\n b.putString(\"id\", nis.getText().toString());\n b.putString(\"nama\", nama.getText().toString());\n // b.putString(\"kls\", txt_kls.getText().toString());\n // b.putString(\"vidio\", txtvidio.getText().toString());\n intent.putExtras(b);\n startActivity(intent);\n }else {\n Intent intent = new Intent(getApplicationContext(), menu_quiz_2.class);\n Bundle b = new Bundle();\n // Toast.makeText(getApplicationContext() ,\"Anda Sudah Quiz\", Toast.LENGTH_LONG).show();\n //Menyisipkan tipe data String ke dalam obyek bundle\n b.putString(\"id\", nis.getText().toString());\n b.putString(\"nama\", nama.getText().toString());\n // b.putString(\"kls\", txt_kls.getText().toString());\n // b.putString(\"vidio\", txtvidio.getText().toString());\n intent.putExtras(b);\n startActivity(intent);\n }\n\n }else {\n Toast.makeText(menu_quiz.this, \"Sudah Quiz\", Toast.LENGTH_SHORT).show();\n\n }\n }", "@Override\n public void onClick(View v) {\n Bundle bdl = new Bundle();\n String emailid = txt_Sender_Email_Id.getText().toString().trim();\n String Subject = txt_Subject.getText().toString().trim();\n bdl.putString(\"mailid\", emailid);\n bdl.putString(\"subject\", Subject);\n bdl.putString(\"body\", EmailBody);\n Intent intent = new Intent(Emails_DetailsActivity.this,\n Email_Replay_Activity.class);\n intent.putExtras(bdl);\n startActivity(intent);\n }", "public void tambahUang(Uang uang){\n SQLiteDatabase db = this.getWritableDatabase();\n\n ContentValues values = new ContentValues();\n values.put(COLUMN_PEMASUKAN, uang.getPemasukan());\n values.put(COLUMN_PENGELUARAN, uang.getPengeluaran());\n\n db.insert(TABLE_NAME, null, values);\n db.close();\n }", "@Override\n\t\t\tpublic void onClick(View v)\n\t\t\t{\n\t\t\t\tIntent intent = new Intent(DeviceActivity.this, sdw.com.CountyActivity.class);// ����������Activity\n\t\t\t\t Bundle bundle = new Bundle(0); \n\t bundle.putString(\"fun1\",transferValue); \n\t bundle.putString(\"search1\",\"btnCheckRecord\");\n\t intent.putExtras(bundle);//\n\t\t\t\tstartActivity(intent);\n\t\t\t\t//finish();\n\t\t\t}", "@Override\n public void onClick(View v) {\n\n userN =firstname.getText().toString();\n userL =lastName.getText().toString();\n gender = spin.getSelectedItem().toString();\n problem = reason.getText().toString();\n\n Intent intentsend = new Intent(getApplication(),profile.class);\n intentsend.putExtra(\"userN\",firstname.getText().toString());\n intentsend.putExtra(\"userL\", lastName.getText().toString());\n intentsend.putExtra(\"gender\",spin.getSelectedItem().toString());\n intentsend.putExtra(\"problem\",reason.getText().toString());\n startActivity(intentsend);\n }", "@Override\n public void onClick(View view)\n {\n Intent intent = new Intent(BoilerRoom.this, ScanQR.class);\n //intent.putExtra( \"id\", tvmechID.getText().toString() );\n startActivity(intent);\n }", "@Override\n\t\t\tpublic void onClick(View v)\n\t\t\t{\n\t\t\t\tIntent intent = new Intent(DeviceActivity.this, sdw.com.CountyActivity.class);// ����������Activity\n\t\t\t\t Bundle bundle = new Bundle(0); \n\t bundle.putString(\"fun1\",transferValue); \n\t bundle.putString(\"search1\",\"btnWaterFlow\");\n\t intent.putExtras(bundle);//\n\t\t\t\tstartActivity(intent);\n\t\t\t\t//finish();\n\t\t\t}", "@Override\n public void onClick(View v) {\n Intent intent = new Intent(context, ChatActivity.class);\n intent.putExtra(\"hisUid\", post.getRequester_UID());\n intent.putExtra(\"requestPost\", post);\n intent.putExtra(\"cplatformPost\", postData);\n context.startActivity(intent);\n activity.finish();\n }", "public void Aries(View view) {\n\n Intent intent = new Intent(this, PrevisaoActivity.class);\n\n intent.putExtra(\"nomeSigno\", \"aries\");\n intent.putExtra(\"idSigno\", \"1\");\n\n startActivity(intent);\n }", "@Override\n\tpublic void onClick(View v) {\n\t\tif (v.getId() == R.id.btn_setdetail) {\n\t\t\tIntent intent = new Intent(MydetialActivity.this,\n\t\t\t\t\tUpdateDetailActivity.class);\n\t\t\tintent.putExtra(\"nick\", nick.getText());\n\t\t\tintent.putExtra(\"name\", name.getText());\n\t\t\tintent.putExtra(\"sex\", sex.getText());\n\t\t\tintent.putExtra(\"tel\", tel.getText());\n\t\t\tintent.putExtra(\"qq\", qq.getText());\n\t\t\tintent.putExtra(\"email\", email.getText());\n\t\t\tintent.putExtra(\"level\", level.getText());\n\t\t\tstartActivityForResult(intent, REQUEST_CODE);\n\t\t}\n\t}", "@Override\n public void onDataChange(@NonNull DataSnapshot dataSnapshot) {\n // Set and put the data in MainActivity\n dataSnapshot.getRef().child(\"nama\").setValue(namahutang.getText().toString());\n dataSnapshot.getRef().child(\"jumlah\").setValue(jumlahhutang.getText().toString());\n dataSnapshot.getRef().child(\"deskripsi\").setValue(deskripsihutang.getText().toString());\n dataSnapshot.getRef().child(\"tanggal\").setValue(tanggalhutang.getText().toString());\n dataSnapshot.getRef().child(\"keyhutang\").setValue(keyhutang);\n\n // Show the data in MainActivity\n Toast.makeText(getApplicationContext(), \"Data successfully added\", Toast.LENGTH_SHORT).show();\n\n Intent a = new Intent(NewHutangAct.this, MainActivity.class);\n startActivity(a);\n finish();\n }", "@Override\n public void onClick(View v) {\n Bundle extras = getIntent().getExtras();\n if (extras != null) {\n str = extras.getString(\"data_to_be_sent\") + \"\\r\\n\" + answer.getText().toString() ;\n }\n Intent intent = new Intent(getBaseContext(), Question4.class);\n intent.putExtra(\"data_to_be_sent\",str);\n startActivity(intent);\n }", "private void checkKonsultasi(final String pasien) {\n String tag_string_req = \"req_lihatKonsultasi\";\n System.out.println(pasien);\n pDialog.setMessage(\"TUNGGU BEBERAPA SAAT...\");\n showDialog();\n\n StringRequest strReq = new StringRequest(Request.Method.POST,\n AppConfig.URL_lihatKosultasi, new Response.Listener<String>() {\n\n @Override\n public void onResponse(String response) {\n Log.d(TAG, \"Konsultasi Response: \" + response.toString());\n hideDialog();\n\n try {\n JSONObject jObj = new JSONObject(response);\n boolean error = jObj.getBoolean(\"error\");\n\n // Check for error node in json\n if (!error) {\n // user successfully logged in\n\n // Now store the user in SQLite\n JSONObject konsultasi = jObj.getJSONObject(\"konsultasi\");\n String idDokter = konsultasi.getString(\"namaDokter\");\n String namaPenyakit = konsultasi.getString(\"namaPenyakit\");\n JSONArray saranList = konsultasi.getJSONArray(\"saranDokter\");\n String tanggal = konsultasi.getString(\"tanggal\");\n String idKon= konsultasi.getString(\"idKonsultasi\");\n\n /*\n JSONObject obat = jObj.getJSONObject(\"obat\");\n String idObat = obat.getString(\"idObat\");\n String idKonsultasi = obat.getString(\"idKonsultasi\");\n String namaObat = obat.getString(\"namaObat\");\n String frekuensi = obat.getString(\"frekuensi\");\n String interval = obat.getString(\"interval\");\n db.addObat(idObat,idKonsultasi,namaObat,frekuensi,interval);\n */\n\n username.setText(\"DR. \"+idDokter);\n namaPenyakitTxt.setText(namaPenyakit);\n tanggalKonsul.setText(tanggal);\n idKonsultasi.setText(\"Nomor Konsultasi : \"+idKon);\n\n for(int i=0;i<saranList.length();i++){\n createEditSaran(saranList.getString(i));\n }\n\n\n\n /*Intent intent = new Intent(lihatKonsultasi.this,\n LoginActivity.class);\n startActivity(intent);\n finish();*/\n } else {\n // Error in login. Get the error message\n String errorMsg = jObj.getString(\"error_msg\");\n Toast.makeText(getApplicationContext(),\n errorMsg, Toast.LENGTH_LONG).show();\n }\n } catch (JSONException e) {\n // JSON error\n e.printStackTrace();\n Toast.makeText(getApplicationContext(), \"Json error: \" + e.getMessage(), Toast.LENGTH_LONG).show();\n }\n\n }\n }, new Response.ErrorListener() {\n\n @Override\n public void onErrorResponse(VolleyError error) {\n Log.e(TAG, \"Login Error: \" + error.getMessage());\n Toast.makeText(getApplicationContext(),\n error.getMessage(), Toast.LENGTH_LONG).show();\n hideDialog();\n }\n }) {\n\n @Override\n protected Map<String, String> getParams() {\n // Posting parameters to login url\n Map<String, String> params = new HashMap<String, String>();\n params.put(\"pasien\", pasien);\n\n return params;\n }\n\n };\n\n // Adding request to request queue\n RequestQueue requestQueue = Volley.newRequestQueue(this);\n requestQueue.add(strReq);\n }", "@Override\n public void onClick(View v) {\n //EditText vacìo.\n\n etCardName.setText(\"\");\n etCardCVV.setText(\"\");\n etCardNumber.setText(\"\");\n etCardValidThru.setText(\"\"); //esperame miro el codigo\n\n Toast.makeText(getApplicationContext(),\"Pagado Exitosamente\",Toast.LENGTH_SHORT).show();\n Toast.makeText(getApplicationContext(),\"Brindanos tus Comentarios Para Nuestras Mejoras\",Toast.LENGTH_SHORT).show();\n //aqui pegas el codigo para abrir la otra activity\n startActivity(new Intent(Pago.this,Coomentarios.class));\n finish();\n\n\n//si ya sale amigo solo le agregare un evento mas q me envie a una nueva actividad desde el mismo si\n\n\n }", "private void dodajZadanie() {\n Intent intent = new Intent(this, DodajEtap.class);\n startActivityForResult(intent, REQUEST_CODE);\n }", "@Override\n\t\t\tpublic void onClick(View v)\n\t\t\t{\n\t\t\t\tIntent intent = new Intent(DeviceActivity.this, sdw.com.CountyActivity.class);// ����������Activity\n\t\t\t\t Bundle bundle = new Bundle(0); \n\t bundle.putString(\"fun1\",transferValue); \n\t bundle.putString(\"search1\",\"btnCheckMap\");\n\t intent.putExtras(bundle);//\n\t\t\t\tstartActivity(intent);\n\t\t\t\t//finish();\n\t\t\t}", "@Override\n public void onClick(View view) {\n Intent myIntent = new Intent(DriverPrefrActivity.this, SearchParkActivity.class);\n //Creating a bundle\n Bundle bundle = new Bundle();\n //Adding values to bundle\n bundle.putString(\"driverlargecar\", String.valueOf(largecar));\n bundle.putString(\"drivertype\", String.valueOf(type));\n bundle.putString(\"driverprice\", String.valueOf(price));\n bundle.putString(\"driverdistancepklot\", String.valueOf(distpklot));\n\n myIntent.putExtra(\"mybundle\", bundle);\n startActivity(myIntent);\n }", "@Override\n public void onClick(View v) {\n\n\n Intent intent=new Intent(Product_cart.this,checkOut.class);\n\n intent.putExtra(\"total\",totalamount);\n intent.putExtra(\"grosstotal\",grosstotal.getText());\n intent.putExtra(\"patientname\",patient.getFullName());\n intent.putExtra(\"patientmobi\",patient.getMobile());\n intent.putExtra(\"patientemail\",patient.getEmail());\n intent.putExtra(\"cusID\",cusID);\n intent.putExtra(\"buttonID\",\"cart\");\n\n intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\n\n startActivity(intent);\n\n\n\n }", "public void mantItinerario(View view){\n Intent intent = new Intent(this, mant_itinerario.class);\n startActivity(intent);\n }", "@Override\n public void onClick(View v) {\n Intent i = new Intent(getBaseContext(), AgregarDireccion.class);\n i.putExtra(\"accion\",\"a\"); // Agregar\n i.putExtra(\"key\",\"\");\n i.putExtra(\"nombre\",\"\");\n i.putExtra(\"direccion\",\"\");\n i.putExtra(\"correo\",firebaseUser.getEmail());\n startActivity(i);\n }", "@Override\n public void onClick(View v) {\n Intent intent = new Intent(mContext, DemandDetailActivity.class);\n //intent.putExtra(\"id\",String.valueOf(item.getPid()));\n intent.putExtra(\"pid\", String.valueOf(item.getPid()));\n intent.putExtra(\"uid\", String.valueOf(item.getUid()));\n mContext.startActivity(intent);\n }", "@Override\n public void onClick(View view){\n sendData();\n\n Intent startHomeActivity = new Intent(view.getContext(), HomeActivity.class);\n startActivity(startHomeActivity);\n\n }", "@Override public void onClick(View view) {\n Intent nuevo_lugar = new Intent(getApplicationContext(), EdicionLugarActivity.class);\n nuevo_lugar.putExtra(\"_id\", \"UID\");\n startActivity(nuevo_lugar);\n }", "@Override\n public void onClick(View v) {\n String nom =\"\";\n String prenom = \"\";\n String mail = \"\";\n String tel = \"\";\n String mdp = \"\";\n String confMdp = \"\";\n\n // Recuperation des données saisies\n try {\n nom = nomInscription.getText().toString();\n prenom = prenomInscription.getText().toString();\n mail = mailInscription.getText().toString();\n tel = telInscription.getText().toString();\n mdp = mdpInscription.getText().toString();\n confMdp = mdpConfirmation.getText().toString();\n\n Utilisateur connexionUtilisateurs = new Utilisateur(nom,prenom,mail,tel,mdp);\n controle.setConnexionUtilisateurs(connexionUtilisateurs);\n }catch (Exception e){\n Log.d(\"Recup\", \"****************** Erreur reuperation donnees inscription\\n****\" + e);\n }\n\n // Controle des données saisie\n if((nom.equals(\"\"))||(prenom.equals(\"\"))||(mail.equals(\"\"))||(tel.equals(\"\"))||(mdp.equals(\"\"))||(confMdp.equals(\"\"))){\n Toast.makeText(InscriptionActivity.this,\"Saisie incorrect\",Toast.LENGTH_SHORT).show();\n }else if (!(mdp.equals(confMdp))){\n Toast.makeText(InscriptionActivity.this,\"mots de passe incorrect\",Toast.LENGTH_SHORT).show();\n }else if (tel.length() != 10){\n Toast.makeText(InscriptionActivity.this,\"Numéro de téléphone incorrect\",Toast.LENGTH_SHORT).show();\n }else if (!isValiEmail(mail)){\n Toast.makeText(InscriptionActivity.this,\"Format de l'adresse mail incorrect\",Toast.LENGTH_SHORT).show();\n }else {\n // si la saisie est correcte, envoie les informations à la base de données pour l'inscription\n afficheResult(nom,prenom,mail,tel,mdp);\n Utilisateur user = new Utilisateur(nom,prenom,mail,tel,mdp);\n AccesDistant accesDistant = new AccesDistant();\n Log.d(\"envoi inscript\",\"*************\" + user.inscriptionConvertToJSONArray());\n accesDistant.envoi(\"inscription\", user.inscriptionConvertToJSONArray());\n\n // Bouton pour aller vers la page home\n Intent intent = new Intent(InscriptionActivity.this,HomeActivity.class);\n startActivity(intent);\n }\n\n }", "@Override\n public void onClick(View v) {\n sendRequestWithOkHttp();\n// intent = new Intent(MainActivity.this,JsonText.class);\n// startActivity(intent);\n// Toast.makeText(MainActivity.this,\"Success\",Toast.LENGTH_SHORT).show();\n }", "@Override\n\t\t\tpublic void onClick(View arg0) {\n\t\t\t\tIntent ikhan_yunis = new Intent(man_lamar.this,man_khan_yunis.class);\n\t\t\t\tstartActivity(ikhan_yunis);\n\t\t\t\n\t\t\t}", "public void Continuar (View view)\n {\n Intent continuar = new Intent( this, Formulario2.class);\n continuar.putExtra(\"nombre\",et_nombre.getText().toString());\n continuar.putExtra(\"apellido\",et_apellido.getText().toString());\n continuar.putExtra(\"telefono\",et_telefono.getText().toString());\n continuar.putExtra(\"email\",et_email.getText().toString());\n continuar.putExtra(\"direccion\",et_direccion.getText().toString());\n continuar.putExtra(\"fecha\",et_fecha.getText().toString());\n continuar.putExtra(\"spinner1\",s1.getSelectedItem().toString());\n continuar.putExtra(\"spinner2\",s2.getSelectedItem().toString());\n startActivity(continuar );\n }", "@Override\r\n\t\t\tpublic void onClick(View arg0) {\n\t\t\t\tIntent intent =new Intent();\r\n\t\t\t\tintent.setAction(\"tijiaodingdan\");\r\n\t\t\t\tintent.putExtra(\"yisheng\", name);\r\n\t\t\t\tintent.putExtra(\"keshi\", keshitxt);\r\n\t\t\t\tintent.putExtra(\"yishengtype\", yisheng_type);\r\n//\t\t\t\tintent.putExtra(\"time\", shijian);\r\n\t\t\t\tintent.putExtra(\"free\", free);\r\n\t\t\t\tintent.putExtra(\"data\", data);\r\n\t\t\t\tintent.putExtra(\"postion\", postion);\r\n\t\t\t\t startActivity(intent);\r\n\t\t\t\t popuWindow.dismiss();\r\n\t\t\t\t WindowManager.LayoutParams params=context.getWindow().getAttributes(); \r\n\t\t\t params.alpha=1f; \r\n\t\t\t context.getWindow().setAttributes(params); \r\n\t\t\t}", "public void send(View v)\n {\n if(staticSpinner.getSelectedItemPosition() == 0) {\n TextView errorText = (TextView)staticSpinner.getSelectedView();\n errorText.setError(\"\");\n errorText.setTextColor(Color.RED);//just to highlight that this is an error\n errorText.setText(\"Harap Pilih Kategori\");\n }\n else if(msgTextField.getText().toString().equals(\"\") ){\n msgTextField.setError(\"required\");\n msgTextField.setHintTextColor(Color.RED);//just to highlight that this is an error\n msgTextField.setHint(\"Harap Diisi\");\n }\n else {\n if (staticSpinner.getSelectedItem().equals(\"Nama Produk\")) {\n spinK = \"nama_produk\";\n } else if (staticSpinner.getSelectedItem().equals(\"Nama Produsen\")) {\n spinK = \"nama_produsen\";\n } else {\n spinK = \"nomor_sertifikat\";\n }\n String msgSearch = msgTextField.getText().toString();\n Intent searchIntent = new Intent(MainActivity.this, HasilCari.class);\n Bundle extras = new Bundle();\n extras.putString(\"spinKat\", spinK);\n extras.putString(\"msgSearch\", msgSearch);\n searchIntent.putExtras(extras);\n startActivity(searchIntent);\n Log.v(TAG, spinK);\n }\n }", "@Override\n public void onClick(View v) {\n// Intent myIntent = new Intent(TripBaru.this,MainMenu.class);\n// myIntent.putExtra(\"user\",nUser.toString());\n// startActivity(myIntent);\n// //BUKA FORM MAIN ACTIVITY\n\n if ((\"1\".equals(nMandor.toString())))\n {\n //BUKA FORM MAIN ACTIVITY\n Intent myIntent = new Intent(TripBaruGantung.this,MainMenuMandor.class);\n myIntent.putExtra(\"user\",nUser.toString());\n startActivity(myIntent);\n //BUKA FORM MAIN ACTIVITY\n }\n else if ((\"2\".equals(nMandor.toString())))\n {\n //BUKA FORM MAIN ACTIVITY\n Intent myIntent = new Intent(TripBaruGantung.this,MainMenuNonMandor.class);\n myIntent.putExtra(\"user\",nUser.toString());\n startActivity(myIntent);\n //BUKA FORM MAIN ACTIVITY\n }\n else\n {\n //BUKA FORM MAIN ACTIVITY\n Intent myIntent = new Intent(TripBaruGantung.this,MainMenu.class);\n myIntent.putExtra(\"user\",nUser.toString());\n startActivity(myIntent);\n //BUKA FORM MAIN ACTIVITY\n }\n }", "public void bSitio2(View view){\n Intent i = new Intent(getApplicationContext(), MapsActivity.class);\n i.putExtra(\"Latitud\", 6.269434 );\n i.putExtra(\"Longitud\", -75.18322);\n i.putExtra(\"destino\", \"Represa Guatapé\");\n startActivity(i);\n }", "@Override\n public void onClick(View v) {\n switch (v.getId()) {\n case R.id.send:\n StringBuilder sb = new StringBuilder();\n\n // sb.append(config_preferences.getString(\"phoneID\",\n // \"xxxxxxxx\")+\",\"); //手机编号\n sb.append(Util.phoneID + \",\"); // 手机编号\n sb.append(datetime + \",\"); // 日期、时间\n sb.append(kindslist_Number.get(pestsKinds\n .getSelectedItemPosition()) + \",\"); // 每个数字对应的种类\n sb.append(stagelist_Number.get(pestsStage\n .getSelectedItemPosition()) + \",\"); // 生长阶段对应数字\n sb.append(amountlist_Number.get(pestsAmount\n .getSelectedItemPosition()) + \",\"); // 受害数量对应数字\n sb.append(levellist_Number.get(pestsLevel\n .getSelectedItemPosition()) + \",\"); // 危害程度对应数字\n sb.append(adviselist_Number.get(pestsAdvise\n .getSelectedItemPosition())); // 处理建议对应数字\n\n final Util util = new Util(PestsDetail.this);\n final String msg = sb.toString();\n\n Thread detail_Thread = new Thread() {\n @Override\n public void run() {\n util.sendPestsDetail(msg);\n }\n };\n if (Forest.isNetConnect(PestsDetail.this)) {\n detail_Thread.start();\n }\n Intent i = new Intent(PestsDetail.this, Main.class);\n i.setFlags(i.FLAG_ACTIVITY_NO_USER_ACTION);\n startActivity(i);\n i = null;\n break;\n default:\n break;\n }\n }", "@Override\n\t\tpublic void onClick(View v) {\n\t\t\tIntent i = new Intent(MainActivity.this, OgleAksam.class);\n\t\t\ti.putExtra(\"GosterimTipi\", 1); //sonraki activity'e yemeklerin gosterim seklini aktariyor\n\t\t\tstartActivity(i);\n\t\t}", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.transaksi_first);\n final TextView txtTitle = (TextView) findViewById(R.id.title);\n Intent i = getIntent();\n // Receiving the Data\n final String name = i.getStringExtra(\"name\");\n \n txtTitle.setText(name);\n \n final String pemb = \"Pembelian\";\n final String pemb2 = \"Pembelian2\";\n final String pemb3 = \"Pembelian3\";\n \n final String pemb4 = \"Pembayaran\";\n \n final String cekh = \"Cek Harga\";\n final String cekh_2 = \"CH\";\n final String ceks = \"Cek Saldo\";\n final String ceks_2 = \"S\";\n final String cekr = \"Cek Rekap harian\";\n final String cekr_2 = \"R\";\n \n final String gpin = \"Ganti Pin\";\n final String gpin_2 = \"GP\";\n final String trfd = \"Transfer Deposit\";\n final String trfd_2 = \"TD\";\n final String reg = \"Registrasi Agen\";\n final String reg_2 = \"R\";\n \n final ImageView btn_home = (ImageView) findViewById(R.id.home);\n btn_home.setOnClickListener(new View.OnClickListener() {\n\t\t\t\n\t\t\tpublic void onClick(View view) {\n\t\t\t\t// Launching News Feed Screen\n\t\t\t\tIntent i = new Intent(getApplicationContext(), TransaksiPulsaActivity.class);\n\t\t\t\ti.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\n\t\t\t\ti.putExtra(\"EXIT\", true); // just value to indicate i want to exit the application\n\t\t\t\tstartActivity(i);\n\t\t\t\t\n\t\t\t}\n\t\t});\n \n \n if(name.equalsIgnoreCase(pemb)){ \n \tString[] menu = new String[] { \"Token PLN\", \"Telkomsel\", \"Indosat\", \n \t\t\t\t\"XL\", \"Three\", \"Axis\",\"Esia\",\"Flexi\",\"Smart\",\"Fren\",\"Hepi\",\"Ceria\",\"Starone\"};\n \t\n \t\t//this.setListAdapter(new ArrayAdapter<String>(this,\n \t\t\t\t//R.layout.main,R.id.item_title, menu));\n \tsetListAdapter(new MyPerformanceArrayAdapter(this, menu));\n \t\t \n \t\t \n final ListView lv = getListView();\n lv.setTextFilterEnabled(true);\t\n lv.setOnItemClickListener(new OnItemClickListener() {\n \tpublic void onItemClick(AdapterView<?> parent, View view, int position, long id) { \n \t\t Intent i = new Intent(getApplicationContext(), KodeSmsCenter.class);\n \t\t i.putExtra(\"title\", pemb + \"|\" + lv.getItemAtPosition(position).toString());\n \t\t i.putExtra(\"name\", lv.getItemAtPosition(position).toString());\n \t\t \n \t\t String data = lv.getItemAtPosition(position).toString();\n \t\t \n \t\t if(data == \"Token PLN\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Token PLN\", \"PLNKU\"));\n \t\t }\n \t\t if(data == \"Telkomsel\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Telkomsel\", \"TSEL\"));\n \t\t }\n \t\t if(data == \"Indosat\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Indosat\", \"ISAT\"));\n \t\t }\n \t\t if(data == \"XL\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"XL\", \"XL\"));\n \t\t }\n \t\t if(data == \"Three\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Three\", \"TRI\"));\n \t\t }\n \t\t if(data == \"Axis\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Axis\", \"AXIS\"));\n \t }\n \t\t if(data == \"Esia\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Esia\", \"ESIA\"));\n \t }\n \t\t if(data == \"Flexi\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Flexi\", \"FLEXI\"));\n \t }\n \t\t if(data == \"Smart\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Smart\", \"SMART\"));\n \t }\n \t\t \n \t\t if(data == \"Fren\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Fren\", \"FREN\"));\n \t }\n \t\t if(data == \"Hepi\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Hepi\", \"HEPI\"));\n \t }\n \t\t \n \t\t if(data == \"Ceria\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Ceria\", \"CR\"));\n \t }\n \t\t \n \t\t if(data == \"Starone\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Starone\", \"STR\"));\n \t }\n \t\t \n \t\t i.putExtra(\"pemb\", pemb.toString());\n \t\t i.putExtra(\"cekh\", cekh.toString());\n \t\t startActivity(i);\n \t\t \n \t\t\t}\n \t\t});\n }\n \n \n if(name.equalsIgnoreCase(pemb2)){ \n \tString[] menu = new String[] { \"Token PLN\", \"Telkomsel\", \"Indosat\", \n \t\t\t\t\"XL\", \"Three\", \"Axis\",\"Esia\",\"Flexi\",\"Smart\",\"Fren\",\"Hepi\",\"Ceria\",\"Starone\"};\n \tsetListAdapter(new MyPerformanceArrayAdapter(this, menu));\n \t\t//this.setListAdapter(new ArrayAdapter<String>(this,\n \t\t\t\t//R.layout.main,R.id.item_title, menu));\n \t\t \n \t\t \n final ListView lv = getListView();\n lv.setTextFilterEnabled(true);\t\n lv.setOnItemClickListener(new OnItemClickListener() {\n \tpublic void onItemClick(AdapterView<?> parent, View view, int position, long id) { \n \t\t Intent i = new Intent(getApplicationContext(), KodeSmsCenter.class);\n \t\t i.putExtra(\"title\", pemb2 + \"|\" + lv.getItemAtPosition(position).toString());\n \t\t i.putExtra(\"name\", lv.getItemAtPosition(position).toString());\n \t\t \n \t\t String data = lv.getItemAtPosition(position).toString();\n \t\t \n \t\t if(data == \"Token PLN\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Token PLN\", \"PLNKU\"));\n \t\t }\n \t\t if(data == \"Telkomsel\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Telkomsel\", \"TSEL\"));\n \t\t }\n \t\t if(data == \"Indosat\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Indosat\", \"ISAT\"));\n \t\t }\n \t\t if(data == \"XL\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"XL\", \"XL\"));\n \t\t }\n \t\t if(data == \"Three\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Three\", \"TRI\"));\n \t\t }\n \t\t if(data == \"Axis\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Axis\", \"AXIS\"));\n \t }\n \t\t if(data == \"Esia\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Esia\", \"ESIA\"));\n \t }\n \t\t if(data == \"Flexi\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Flexi\", \"FLEXI\"));\n \t }\n \t\t if(data == \"Smart\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Smart\", \"SMART\"));\n \t }\n \t\t \n \t\t \n \t\t if(data == \"Fren\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Fren\", \"FREN\"));\n \t }\n \t\t if(data == \"Hepi\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Hepi\", \"HEPI\"));\n \t }\n \t\t \n \t\t if(data == \"Ceria\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Ceria\", \"CR\"));\n \t }\n \t\t \n \t\t \n \t\t if(data == \"Starone\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Starone\", \"STR\"));\n \t }\n \t\t \n \t\t i.putExtra(\"pemb\", pemb2.toString());\n \t\t i.putExtra(\"cekh\", cekh.toString());\n \t\t startActivity(i);\n \t\t \n \t\t\t}\n \t\t});\n }\n \n \n if(name.equalsIgnoreCase(pemb3)){ \n \tString[] menu = new String[] { \"Token PLN\", \"Telkomsel\", \"Indosat\", \n \t\t\t\t\"XL\", \"Three\", \"Axis\",\"Esia\",\"Flexi\",\"Smart\",\"Fren\",\"Hepi\",\"Ceria\",\"Starone\"};\n \tsetListAdapter(new MyPerformanceArrayAdapter(this, menu));\n \t\t//this.setListAdapter(new ArrayAdapter<String>(this,\n \t\t\t\t//R.layout.main,R.id.item_title, menu));\n \t\t \n \t\t \n final ListView lv = getListView();\n lv.setTextFilterEnabled(true);\t\n lv.setOnItemClickListener(new OnItemClickListener() {\n \tpublic void onItemClick(AdapterView<?> parent, View view, int position, long id) { \n \t\t Intent i = new Intent(getApplicationContext(), KodeSmsCenter.class);\n \t\t i.putExtra(\"title\", pemb3 + \"|\" + lv.getItemAtPosition(position).toString());\n \t\t i.putExtra(\"name\", lv.getItemAtPosition(position).toString());\n \t\t \n \t\t String data = lv.getItemAtPosition(position).toString();\n \t\t \n \t\t if(data == \"Token PLN\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Token PLN\", \"PLNKU\"));\n \t\t }\n \t\t if(data == \"Telkomsel\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Telkomsel\", \"TSEL\"));\n \t\t }\n \t\t if(data == \"Indosat\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Indosat\", \"ISAT\"));\n \t\t }\n \t\t if(data == \"XL\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"XL\", \"XL\"));\n \t\t }\n \t\t if(data == \"Three\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Three\", \"TRI\"));\n \t\t }\n \t\t if(data == \"Axis\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Axis\", \"AXIS\"));\n \t }\n \t\t if(data == \"Esia\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Esia\", \"ESIA\"));\n \t }\n \t\t if(data == \"Flexi\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Flexi\", \"Flexi\"));\n \t }\n \t\t if(data == \"Smart\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Smart\", \"SMART\"));\n \t }\n \t\t \n \t\t if(data == \"Fren\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Fren\", \"FREN\"));\n \t }\n \t\t if(data == \"Hepi\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Hepi\", \"HEPI\"));\n \t }\n \t\t \n \t\t if(data == \"Ceria\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Ceria\", \"CR\"));\n \t }\n \t\t \n \t\t \n \t\t if(data == \"Starone\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Starone\", \"STR\"));\n \t }\n \t\t \n \t\t i.putExtra(\"pemb\", pemb3.toString());\n \t\t i.putExtra(\"cekh\", cekh.toString());\n \t\t startActivity(i);\n \t\t \n \t\t\t}\n \t\t});\n }\n if(name.equalsIgnoreCase(cekh)){ \n \tString[] menu = new String[] { \"Token PLN\", \"Telkomsel\", \"Indosat\", \n \t\t\t\t\"XL\", \"Three\", \"Axis\",\"Esia\",\"Flexi\",\"Smart\",\"Fren\",\"Hepi\",\"Ceria\",\"Starone\"};\n \t\t//this.setListAdapter(new ArrayAdapter<String>(this,\n \t\t\t\t//R.layout.main,R.id.item_title, menu));\n \tsetListAdapter(new MyPerformanceArrayAdapter(this, menu));\n \t\t\n \t\tfinal ListView lv = getListView();\n lv.setTextFilterEnabled(true);\t\n lv.setOnItemClickListener(new OnItemClickListener() {\n \tpublic void onItemClick(AdapterView<?> parent, View view, int position, long id) { \n \t\t Intent i = new Intent(getApplicationContext(), Cek_Harga.class);\n \t\t i.putExtra(\"title\", cekh + \"|\" + lv.getItemAtPosition(position).toString());\n \t\t i.putExtra(\"name\", lv.getItemAtPosition(position).toString());\n \t\t \n \t\t String data = lv.getItemAtPosition(position).toString();\n \t\t if(data == \"Token PLN\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Token PLN\", \"PLNKU\"));\n \t\t }\n \t\t if(data == \"Telkomsel\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Telkomsel\", \"TSEL\"));\n \t\t }\n \t\t if(data == \"Indosat\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Indosat\", \"ISAT\"));\n \t\t }\n \t\t if(data == \"XL\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"XL\", \"XL\"));\n \t\t }\n \t\t if(data == \"Three\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Three\", \"TRI\"));\n \t\t }\n \t\t if(data == \"Axis\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Axis\", \"AXIS\"));\n \t }\n \t\t if(data == \"Esia\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Esia\", \"ESIA\"));\n \t }\n \t\t if(data == \"Flexi\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Flexi\", \"Flexi\"));\n \t }\n \t\t if(data == \"Smart\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Smart\", \"SMART\"));\n \t }\n \t\t \n \t\t if(data == \"Fren\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Fren\", \"FREN\"));\n \t }\n \t\t if(data == \"Hepi\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Hepi\", \"HEPI\"));\n \t }\n \t\t \n \t\t if(data == \"Ceria\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Ceria\", \"CR\"));\n \t }\n \t\t \n \t\t \n \t\t if(data == \"Starone\"){\n \t\t i.putExtra(\"alias\", data.toString().replace(\"Starone\", \"STR\"));\n \t }\n \t\t \n \t\t i.putExtra(\"cekh\", cekh.toString());\n \t\t i.putExtra(\"ceks\", ceks.toString());\n \t\t startActivity(i);\n \t\t \n \t\t\t}\n \t\t});\n }\n \n if(name.equalsIgnoreCase(ceks)){ \n //langsung ke cek_harga = cek saldo\n }\n \n \n if(name.equalsIgnoreCase(pemb4)){ \n \t txtTitle.setText(\"Untuk sementara layanan ini tidak tersedia\");\n }\n \n \n }", "@Override\n\tpublic void onClick(View arg0) {\n switch (arg0.getId())\n {\n case R.id.btnContinue:\n {\n registerPhone();\n break;\n }\n case R.id.lnSelectLanguage:\n {\n Intent intent = new Intent(mContext,\n SelectNationActivity.class);\n intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP\n | Intent.FLAG_ACTIVITY_SINGLE_TOP);\n startActivityForResult(intent, Constants.KEY_SELECT_LANGUAGE);\n break;\n }\n case R.id.tvDieuKhoan:\n {\n Intent i = new Intent(Intent.ACTION_VIEW);\n String language= Pasgo.getInstance().prefs.getLanguage();\n String dieuKhoan;\n if(language.equals(Constants.LANGUAGE_VIETNAM))\n {\n dieuKhoan=Constants.KEY_DIEU_KHOAN_VN;\n }else\n {\n dieuKhoan=Constants.KEY_DIEU_KHOAN_EN;\n }\n i.setData(Uri.parse(dieuKhoan));\n startActivity(i);\n break;\n }\n }\n\t}", "@Override\n public void onClick(View v) {\n\n Intent intent = new Intent(ResultActivity.this, SecondActivity.class);\n intent.putExtra(\"data1\", Edata2.getText().toString());\n startActivity(intent);\n }", "@Override\n public void onClick(View view) {\n\n Intent Main_Save_Intent = new Intent(getApplicationContext(),PingTestSetup.class);\n Bundle Main_Save_Bundle = new Bundle();\n Main_Save_Bundle.putSerializable(\"Play_TC_List\",Play_TC_List);\n Main_Save_Intent.putExtras(Main_Save_Bundle);\n startActivity(Main_Save_Intent);\n\n\n }", "@Override\n\t\t\tpublic void onClick(View arg0) {\n\t\t\t\tIntent it = new Intent(ManaInsertActivity.this,ManaMediActivity.class); \n it.putExtras(it);\n startActivity(it);\n\t\t\t}", "@Override\n public void onClick(View view) {\n List<DataQuestion>listAnswer = adapter.getAllAnswer();\n\n int nilai = 0;\n //looping untuk nilai\n for (int i = 0; i <listAnswer.size() ; i++) {\n //cek jawaban sama atau tidak dengan kunci jawaban\n if(listAnswer.get(i).getJawaban().equals(listAnswer.get(i).getDipilih())){\n //jika jawaban betul maka nilai + 1\n nilai = nilai + 1;\n }\n }\n //tampilkan nilai di toast\n Toast.makeText(getApplicationContext(),\"Nilai anda: \"+nilai,Toast.LENGTH_LONG).show();\n }", "public void simpanDataBuku(){\n String sql = (\"INSERT INTO buku (judulBuku, pengarang, penerbit, tahun, stok)\" \n + \"VALUES ('\"+getJudulBuku()+\"', '\"+getPengarang()+\"', '\"+getPenerbit()+\"'\"\n + \", '\"+getTahun()+\"', '\"+getStok()+\"')\");\n \n try {\n //inisialisasi preparedstatmen\n PreparedStatement eksekusi = koneksi. getKoneksi().prepareStatement(sql);\n eksekusi.execute();\n \n //pemberitahuan jika data berhasil di simpan\n JOptionPane.showMessageDialog(null,\"Data Berhasil Disimpan\");\n } catch (SQLException ex) {\n //Logger.getLogger(modelPelanggan.class.getName()).log(Level.SEVERE, null, ex);\n JOptionPane.showMessageDialog(null, \"Data Gagal Disimpan \\n\"+ex);\n }\n }", "@Override\n public void onClick(View v) {\n Intent p1page = new Intent(v.getContext(), AshmoleanMusuem.class);\n startActivity(p1page);\n }", "@Override\n public void onClick(View v) {\n try\n {\n rslt=\"START\";\n Caller c=new Caller();\n c.user= nUser.toString();\n c.nopol= mNoPol.getText().toString().concat(\"*\").concat(mSupir.getText().toString());\n c.emkl= mEMKL.getText().toString();\n c.jnsorder= mJenisOrderan.getSelectedItem().toString();\n c.tujuantarif= mTujuanTarif.getText().toString();\n c.dari= mDari.getText().toString();\n c.sampai= mTujuanTarif.getText().toString();\n c.ukurancontainer= mUkuranCont.getSelectedItem().toString();\n c.nochasis= \"\";\n c.statuscont= \"FULL\";\n c.islongtrip= 0;\n c.shipper =mShipper.getText().toString();\n c.gudang=mGudang.getText().toString();\n c.jnsritasi=\"\";\n c.ritasidr=\"\";\n c.ritasike=\"\";\n\n c.status= \"START\";\n c.sCommand =\"entrytripgantung\";\n c.join();\n c.start( );\n while(rslt==\"START\")\n {\n try\n {\n Thread.sleep(10);\n\n }catch(Exception ex)\n {\n\n }\n }\n\n ad.setTitle(\"INFO\");\n ad.setMessage(rslt);\n ad.show();\n\n mNoPol.setText(\"\");\n mEMKL.setText(\"\");\n mTujuanTarif.setText(\"\");\n mDari.setText(dari);\n mSampai.setText(\"\");\n mShipper.setText(\"\");\n mGudang.setText(\"\");\n\n }catch(Exception ex) {\n\n }\n }", "public void onClick(View view){\n String name = Name.getText().toString();\n String age = Age.getText().toString();\n\n // Change Main Activity into NewActivity in screen through intent.\n Intent intent = new Intent(getApplicationContext(), NewActivity.class);\n\n // Send data values that name and age .\n intent.putExtra(\"loginName\", name);\n intent.putExtra(\"loginAge\", age);\n\n startActivity(intent);\n }", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tIntent i = new Intent(Akun.this, Tukang.class);\n\t\t\t\tstartActivity(i);\n\t\t\t}", "@Override\n public void onClick(View v) {\n BeritaItem beritaItem = new BeritaItem();\n\n //TODO mengambil data dari berita item\n beritaItem.setTitle(beritaList.get(i).getTitle());\n beritaItem.setUrlToImage(beritaList.get(i).getUrlToImage());\n beritaItem.setContent(beritaList.get(i).getContent());\n beritaItem.setPublishedAt(beritaList.get(i).getPublishedAt());\n\n //TODO melakukan perpindahan halaman\n Intent intent = new Intent(context, DetailActivity.class);\n intent.putExtra(DetailActivity.EXTRA_OBJ,beritaItem);\n context.startActivity(intent);\n }", "@Override\n\t\t\tpublic void onClick(View arg0) {\n\t\t\t\t\n\t\t\t\tif(!isInputPassed())\n\t\t\t\t\treturn;\n\t\t\t\tlmv.show(\"正在查询\");\n\t\t String urlString = UrlUtils.GetGoInfo;\n\t\t RequestParams params = new RequestParams(); // 绑定参数\n\t\t params.put(\"phone\", phone.getText().toString());\n\n\t\t HttpUtils.post(urlString, params, new BaseJsonHttpResponseHandler<GoInfoModel>() {\n\n\t\t \t\n\t\t @Override\n\t\t public void onSuccess(int statusCode, Header[] headers, String rawJsonResponse, GoInfoModel response) {\n\t\t \t\tif(response.isLogin() && response.isSuccess())\n\t\t \t\t{\n\t\t \t\t\tGlobalConfig config =GlobalConfig.getInstance();\n\t\t \t\t\tconfig.setAmount(Float.parseFloat(amount.getText().toString()));\n\t\t \t\t\tconfig.setCustomGoCoin(response.getData().getBalance());\n\t\t \t\t\tconfig.setProportion(response.getData().getProportion());\n\t\t \t\t\tconfig.setCustomName(response.getData().getName());\n\t\t \t\t\tconfig.setCustomPhone(phone.getText().toString());\n\t\t \t\t\tconfig.setCusomerId(response.getData().getCid());\n\t\t \t\t\t\tIntent it = new Intent(MainActivity.this,PayMethodActivity.class);\n\t\t \t\t\t\tstartActivity(it);\n\t\t \t\t}\n\t\t \t\telse\n\t\t \t\t{\n\t\t \t\t\tif(!response.isLogin())\n\t\t \t\t\t\tMainActivity.this.toLogin();\n\t\t \t\t\telse\n\t\t \t\t\t\tToast.makeText(MainActivity.this, response.getErrorMessage(), Toast.LENGTH_LONG).show();\n\t\t \t\t}\n\t\t \t\tlmv.hide();\n\t\t }\n\n\t\t @Override\n\t\t public void onFailure(int statusCode, Header[] headers, Throwable throwable, String rawJsonData, GoInfoModel errorResponse) {\n\n\t\t \t\tToast.makeText(MainActivity.this, throwable.getMessage(), Toast.LENGTH_LONG).show();\n\t\t \t\tlmv.hide();\n\t\t }\n\n\t\t @Override\n\t\t protected GoInfoModel parseResponse(String rawJsonData) throws Throwable {\n\t\t return new ObjectMapper().readValues(new JsonFactory().createParser(rawJsonData), GoInfoModel.class).next();\n\t\t }\n\n\t\t });\n\n\t\t\t}", "@Override\r\n\t\t\tpublic void onItemClick(AdapterView<?> arg0, View arg1, int arg2,\r\n\t\t\t\t\tlong arg3) {\n\t\t\t\tString pilihan = ((TextView) arg1).getText().toString();\r\n\t\t\t\t// Toast.makeText(getApplicationContext(), pilihan\r\n\t\t\t\t// +\" \"+arg2+\" \", Toast.LENGTH_SHORT).show();\r\n\t\t\t\ttry {\r\n\t\t\t\t\tIntent intent = null;\r\n\t\t\t\t\tif (pilihan.equals(\"Tambah Data\")) {\r\n\t\t\t\t\t\tintent = new Intent(MainActivity.this,\r\n\t\t\t\t\t\t\t\tInsertActivity.class);\r\n\t\t\t\t\t\t// Toast.makeText(getApplicationContext(),\r\n\t\t\t\t\t\t// intent.getDataString(), Toast.LENGTH_SHORT).show();\r\n\t\t\t\t\t} else if (pilihan.equals(\"Tampilkan Data\")) {\r\n\t\t\t\t\t\tintent = new Intent(MainActivity.this,\r\n\t\t\t\t\t\t\t\tJSONActivity.class);\r\n\t\t\t\t\t\t// Toast.makeText(getApplicationContext(), pilihan\r\n\t\t\t\t\t\t// +\" \"+arg2+\" \", Toast.LENGTH_SHORT).show();\r\n\r\n\t\t\t\t\t} else if (pilihan.equals(\"Exit\")) {\r\n\t\t\t\t\t\tfinish();\r\n\t\t\t\t\t\t// Toast.makeText(getApplicationContext(), pilihan\r\n\t\t\t\t\t\t// +\" \"+arg2+\" \", Toast.LENGTH_SHORT).show();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tstartActivity(intent);\r\n\r\n\t\t\t\t} catch (Exception e) {\r\n\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t}\r\n\t\t\t}", "@Override\n\t\t\tpublic void onClick(View arg0) {\n\t\t\t\tIntent i = new Intent(Akun.this, Riwayat_pemesanan.class);\n\t\t\t\tstartActivity(i);\n\t\t\t}", "public void pesanNow(View view) {\n GRUP = (RadioGroup) findViewById(R.id.radioGroup);\n // bila radio button terpilih pada radio untuk dine in :\n if (GRUP.getCheckedRadioButtonId()== R.id.rbDineIn){\n Toast.makeText(this, \"Dine In terpilih\", Toast.LENGTH_SHORT).show();\n // pindah ke activity DineIn\n startActivity(new Intent(this, DineIn.class));\n\n }\n // bila terpilih selain dine in\n else {\n Toast.makeText(this, \"Take Away terpilih\", Toast.LENGTH_SHORT).show();\n // pindah ke activity Take Away\n startActivity(new Intent(this, TakeAway.class));\n }\n\n }", "@Override\n public void onClick(View view) {\n Toast.makeText(getActivity(),\"bal\",Toast.LENGTH_SHORT).show();\n Intent intent=new Intent(getActivity(),osmanyhallcapt.class);\n startActivity(intent);\n }", "@Override\n public void onClick(DialogInterface dialog,\n\n int which) {\n\n Intent i = new Intent(getApplicationContext(), MainActivity.class);\n i.putExtra(\"from_value\", \"enquiry\");\n startActivity(i);\n\n }", "@Override\n public void onClick(View view) {\n Intent intent = new Intent(MainActivity.this, PageDetailDestinasiPopuler.class);\n startActivity(intent);\n }", "public void clickPolisi(View view) {\n Intent i = new Intent(this,KantorPolisi.class);\n startActivity(i);\n }", "@Override\n public void onClick(View view) {\n Intent intent = new Intent(view.getContext(), NotificationMsgActivity.class);\n// Bundle bundle = new Bundle();\n// bundle.putString(\"date\",txtTimeNotificationSingleRow.getText().toString());\n// intent.putExtras(bundle); //be careful here will be putExtra's\n intent.putExtra(\"date\",txtTimeNotificationSingleRow.getText().toString());\n intent.putExtra(\"title\",txtTitleNotificationSingleRow.getText().toString());\n intent.putExtra(\"message\",txtMessageNotificationSingleRow.getText().toString());\n view.getContext().startActivity(intent); //Without context we will not be able to startActivity.\n\n }", "public void funds_clicked(View view) {\n Intent intent = new Intent(this, FundsActivity.class);\n // EditText editText = (EditText) findViewById(R.id.editText);\n // String message = \"final data\";\n // intent.putExtra(EXTRA_MESSAGE, message);\n startActivity(intent);\n }", "private void TambahData(String judul,String penulis,String harga){\n try{ // memanipulasi kesalahan\n String sql = \"INSERT INTO buku VALUES(NULL,'\"+judul+\"','\"+penulis+\"',\"+harga+\")\"; // menambahkan data dengan mengkonekan dari php\n stt = con.createStatement(); // membuat statement baru dengan mengkonekan ke database\n stt.executeUpdate(sql); \n model.addRow(new Object[]{judul,penulis,harga}); // datanya akan tertambah dibaris baru di tabel model\n \n }catch(SQLException e){ // memanipulasi kesalahan\n System.out.println(\"ini error\"); // menampilkan pesan ini error\n }\n }", "protected void onCreate(Bundle savedInstanceState) {\n\tsuper.onCreate(savedInstanceState);\r\n\tsetContentView(R.layout.input_med);\r\n\tButton submit=(Button)findViewById(R.id.button1);\r\n\t\r\n\t//Toast.makeText(getApplicationContext(), \r\n // a, Toast.LENGTH_LONG).show();\r\n\tsubmit.setOnClickListener(new View.OnClickListener() {\r\n\t\t\r\n\t\t@Override\r\n\t\tpublic void onClick(View v) {\r\n\t\t\t// TODO Auto-generated method stub\r\n\t\t\tdrug=(EditText)findViewById(R.id.editText1);\r\n\t\t\tabc=drug.getText().toString();\r\n\t\t\tToast.makeText(getApplicationContext(), \r\n\t\t abc, Toast.LENGTH_LONG).show();\r\n\t\t\tIntent intent3=new Intent(Input_Med.this,Med_Info.class);\r\n\t\t\tintent3.putExtra(\"drug\", abc);\r\n\t\t\tstartActivity(intent3);\r\n\t\t\t\r\n\t\t}\r\n\t});\r\n}" ]
[ "0.7286748", "0.72168624", "0.71836686", "0.69556046", "0.69471246", "0.69391906", "0.69212973", "0.6902614", "0.69003224", "0.689977", "0.6848619", "0.6813481", "0.6813319", "0.68126583", "0.6811442", "0.67929983", "0.6778342", "0.6769228", "0.6757116", "0.67367196", "0.67306364", "0.672156", "0.66894", "0.66848904", "0.666325", "0.6657841", "0.66458607", "0.66427326", "0.6637774", "0.66262037", "0.6621132", "0.6603212", "0.6592991", "0.6592991", "0.6581196", "0.6578347", "0.6571494", "0.65500414", "0.65484875", "0.6546192", "0.6538838", "0.6534114", "0.6533417", "0.65273017", "0.65252864", "0.6506363", "0.6492943", "0.6483482", "0.64785725", "0.64438736", "0.64373076", "0.6437047", "0.6434992", "0.64314395", "0.6407912", "0.63900524", "0.6388322", "0.63783956", "0.6377711", "0.6371853", "0.6363361", "0.6347061", "0.6338932", "0.6331154", "0.6322479", "0.63218284", "0.63150764", "0.6313658", "0.6310502", "0.63040096", "0.62918127", "0.6277858", "0.62757796", "0.6271688", "0.6269279", "0.6260937", "0.62559766", "0.62538594", "0.6252843", "0.624686", "0.6237683", "0.6232359", "0.62280643", "0.62201387", "0.6214299", "0.62135273", "0.62118244", "0.62103415", "0.6206149", "0.6204645", "0.620077", "0.6198478", "0.6185773", "0.61772436", "0.6176484", "0.61761326", "0.6175001", "0.61669195", "0.6164697", "0.6164213", "0.6161596" ]
0.0
-1
memunculkan toast + value Spinner yang dipilih (diambil dari adapter)
@Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { cityId = aKodeKota[i]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void addListenerOnButton() {\n\n isempleado = (Spinner) findViewById(R.id.spinnerWifi);\n spinner2 = (Spinner) findViewById(R.id.spinner2);\n\n\n Toast.makeText(getApplicationContext(), \"Spinner 1 \"+String.valueOf(isempleado.getSelectedItem()) +\n \"Spinner 2 : \"+ String.valueOf(spinner2.getSelectedItem()), Toast.LENGTH_LONG).show();\n\n\n }", "String getSpinnerText();", "@Override\n public void onItemSelected(AdapterView<?> parent, View view,\n int position, long id) {\n\n\n try{\n String s = \"\";\n Log.e(\"mytag\",\"(String) parent.getItemAtPosition(position):\"+(String) parent.getItemAtPosition(position).toString().trim());\n if (parent.getItemAtPosition(position).toString().trim().equals(\"בחר\")){\n s = \"-1\";\n }else{\n s = String.valueOf(ctype_map.get(parent.getItemAtPosition(position).toString().trim()).getCtypeID());\n }\n setCcustomerSpinner(s);\n }catch(Exception e){\n helper.LogPrintExStackTrace(e);\n }\n Log.e(\"mytag\", (String) parent.getItemAtPosition(position));\n //statusID = db.getCallStatusByCallStatusName((String) parent.getItemAtPosition(position)).getCallStatusID();\n //statusName = db.getCallStatusByCallStatusName((String) parent.getItemAtPosition(position)).getCallStatusName();\n //Toast.makeText(getApplication(), \"status: \" + s, Toast.LENGTH_LONG).show();\n //Log.v(\"item\", (String) parent.getItemAtPosition(position));\n }", "@Override\r\n\t\t\t\t\t\tpublic void onPostExecute(String result) {\n\t\t\t\t\t\t\tLog.d(\"TAG\", \"getdataspinner:\" + result);\r\n\t\t\t\t\t\t\tsetDataSpinner(result, jurusan);\r\n\t\t\t\t\t\t}", "@Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n SpinnerValue = (String)spinner.getSelectedItem();\n }", "@Override\n public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {\n\n // To retrieve the user's selected item in the Spinner, use getItemAtPosition().\n String spinnerLabel = adapterView.getItemAtPosition(i).toString();\n displayToast(spinnerLabel);\n }", "public void onNothingSelected(AdapterView<?> parent) {\n // Toast.makeText(getApplicationContext(), \"nada en el spinner\", Toast.LENGTH_LONG).show();\n }", "@Override\n protected void onPostExecute(final String[] medica) {\n ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(getApplicationContext(),R.layout.spinner_item, medica);\n spinnerArrayAdapter.setDropDownViewResource(R.layout.spinner_item); // The drop down view\n spinner.setAdapter(spinnerArrayAdapter);\n\n spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {\n medicamento = spinner.getSelectedItem().toString();\n Toast.makeText(getApplicationContext(), medicamento,\n Toast.LENGTH_LONG).show();\n }\n\n public void onNothingSelected(AdapterView<?> parent) {\n }\n });\n\n }", "@Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n baseService.getPukul(waktus.get(position).getId())\n .enqueue(new Callback<PukulResponse>() {\n @Override\n public void onResponse(Call<PukulResponse> call, Response<PukulResponse> response) {\n if (response.isSuccessful()){\n pukuls.clear();\n spnPukul.clear();\n pukuls = response.body().getPukuls();\n final ArrayAdapter<String> adapter2 = new ArrayAdapter<>(getApplicationContext(), android.R.layout.simple_list_item_1, spnPukul);\n if (!pukuls.isEmpty()){\n spinnerTime.setAdapter(adapter2);\n for (int j = 0; j<pukuls.size(); j++){\n String pkl = pukuls.get(j).getStart() + \" - \" +pukuls.get(j).getEnd();\n spnPukul.add(pkl);\n adapter2.notifyDataSetChanged();\n\n spinnerTime.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n id_pukul = pukuls.get(position).getId();\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n }\n }\n }\n }\n\n @Override\n public void onFailure(Call<PukulResponse> call, Throwable t) {\n Log.e(\"Error Message\", t.getMessage());\n }\n });\n }", "void dailod_dab() {\n AlertDialog.Builder alertdialogbuilder = new AlertDialog.Builder(MainActivity.this);\n\n\n alertdialogbuilder.setTitle(\"Select A slot \");\n\n\n alertdialogbuilder.setItems(value1, new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n String slt = Arrays.asList(value1).get(which);\n //slot=lis.get(which);\n\n db.opendb();\n String mnoo = db.get_Mobileno();\n String passs = db.get_PASS();\n if (mnoo != null && mnoo.length() > 0 && passs != null && passs.length() > 0) {\n sendSMS(mnoo, \"DB\" + slt + \" \" + passs);\n Toast.makeText(getApplicationContext(), slt, Toast.LENGTH_LONG).show();\n }\n // textview.setText(selectedText);\n\n }\n });\n\n AlertDialog dialog = alertdialogbuilder.create();\n\n dialog.show();\n }", "private void setSpinner() {\n class spinna extends AsyncTask<Void, Void, ArrayList<String>> {\n\n @Override\n protected void onPreExecute() {\n super.onPreExecute();\n }\n\n @Override\n protected ArrayList<String> doInBackground(Void... voids) {\n ArrayList<String> items = new ArrayList<>();\n for (Season season : series.getSeasons()) {\n int i = season.getSeasonNumber();\n items.add(String.valueOf(i));\n }\n\n return items;\n\n }\n\n @Override\n protected void onPostExecute(ArrayList<String> items) {\n super.onPostExecute(items);\n ArrayAdapter<String> adapter = new ArrayAdapter<String>(SeriesActivity.this, android.R.layout.simple_spinner_dropdown_item, items);\n adapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);\n dropdown.setAdapter(adapter);\n adapter.notifyDataSetChanged();\n adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n }\n }\n spinna kkkk = new spinna();\n kkkk.execute();\n\n\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n View rootView = inflater.inflate(R.layout.category_catchange, container, false);\n progressDialog = new ProgressDialog(getActivity());\n // db = new DBHandler(getActivity());\n userPreferences = UserPreferences.getInstance(getActivity());\n\n sealUsed = new ArrayList<String>(6);\n sealUsed.add(\" \");\n sealUsed.add(\" \");\n sealUsed.add(\" \");\n sealUsed.add(\" \");\n sealUsed.add(\" \");\n sealUsed.add(\" \");\n\n ((AppCompatActivity) getActivity()).getSupportActionBar().setTitle(\"CATEGORY CHANGE+\");\n\n\n Bundle bundle = getArguments();\n //orderData = (McrOrederProxie) bundle.getSerializable(\"orderData\");\n if (userPreferences.getLocalMsgId().equalsIgnoreCase(\"U01\")) {\n mcrOrderProxie = (McrOrderProxie) bundle.getSerializable(\"orderData\");\n } else {\n mcrOrderProxieOtherConn = (McrOrderProxieOtherConn) bundle.getSerializable(\"orderData\");\n }\n\n\n // seva kendra\n\n\n spin_purpose = (Spinner) rootView.findViewById(R.id.spin_purpose);\n spin_usage = (Spinner) rootView.findViewById(R.id.spin_usage);\n\n\n spin_purpose.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {\n\n if (i == 0) {\n usageArr = getResources().getStringArray(R.array.usage_array0);\n usageArrSub = getResources().getStringArray(R.array.usage_array_sub0);\n\n } else if (i == 1) {\n usageArr = getResources().getStringArray(R.array.usage_array1);\n usageArrSub = getResources().getStringArray(R.array.usage_array_sub1);\n } else if (i == 2) {\n usageArr = getResources().getStringArray(R.array.usage_array2);\n usageArrSub = getResources().getStringArray(R.array.usage_array_sub2);\n } else if (i == 3) {\n usageArr = getResources().getStringArray(R.array.usage_array3);\n usageArrSub = getResources().getStringArray(R.array.usage_array_sub3);\n } else if (i == 4) {\n usageArr = getResources().getStringArray(R.array.usage_array4);\n usageArrSub = getResources().getStringArray(R.array.usage_array_sub4);\n } else if (i == 5) {\n usageArr = getResources().getStringArray(R.array.usage_array5);\n usageArrSub = getResources().getStringArray(R.array.usage_array_sub5);\n } else {\n usageArr = getResources().getStringArray(R.array.usage_array0);\n usageArrSub = getResources().getStringArray(R.array.usage_array_sub0);\n }\n\n spin_usage.setAdapter(new SpinnerAdapterFilter(getActivity(), R.layout.custom_spinner, usageArr, usageArrSub));\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> adapterView) {\n\n }\n });\n\n //usageArr = getResources().getStringArray(R.array.usage_array);\n //usageArrSub = getResources().getStringArray(R.array.usage_array_sub);\n // seva kendra\n\n usageArr = getResources().getStringArray(R.array.usage_array0);\n usageArrSub = getResources().getStringArray(R.array.usage_array_sub0);\n\n // seva kendra\n\n spin_usage.setAdapter(new SpinnerAdapterFilter(getActivity(), R.layout.custom_spinner, usageArr, usageArrSub));\n spin_usage.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n\n if (position != 0) {\n TextView pmTypeText = (TextView) view.findViewById(R.id.text_main_seen);\n TextView pmTypeID = (TextView) view.findViewById(R.id.sub_text_seen);\n\n spinUsageVal = pmTypeID.getText().toString();\n //String compID = String.valueOf(reqId.getText().toString());\n } else {\n spinUsageVal = \"0\";\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n description = (EditText) rootView.findViewById(R.id.description);\n\n\n scanmeter = (Button) rootView.findViewById(R.id.scanmeter);\n\n\n devicenumber = (EditText) rootView.findViewById(R.id.devicenumber);\n\n\n radiostickerinstall = (RadioGroup) rootView.findViewById(R.id.radiostickerinstall);\n valStickerinstall = ((RadioButton) rootView.findViewById(radiostickerinstall.getCheckedRadioButtonId())).getText().toString();\n\n final LinearLayout stickerll = (LinearLayout) rootView.findViewById(R.id.stickerll);\n stickernumber = (EditText) rootView.findViewById(R.id.stickernumber);\n\n radiostickerinstall.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {\n @Override\n public void onCheckedChanged(RadioGroup group, int checkedId) {\n valStickerinstall = ((RadioButton) group.getRootView().findViewById(checkedId)).getText().toString();\n\n if (valStickerinstall.equalsIgnoreCase(\"Yes\")) {\n stickerll.setVisibility(View.VISIBLE);\n } else {\n stickerll.setVisibility(View.GONE);\n stickernumber.setText(\"\");\n }\n }\n });\n\n\n //devicenumber.setText(orderData.getDEVICENO());\n\n radioelcbinstall = (RadioGroup) rootView.findViewById(R.id.radioelcbinstall);\n valelcbinstall = ((RadioButton) rootView.findViewById(radioelcbinstall.getCheckedRadioButtonId())).getText().toString();\n\n final LinearLayout elcbbasedll = (LinearLayout) rootView.findViewById(R.id.elcbbasedll);\n\n radioelcbinstall.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {\n @Override\n public void onCheckedChanged(RadioGroup group, int checkedId) {\n valelcbinstall = ((RadioButton) group.getRootView().findViewById(checkedId)).getText().toString();\n\n if (valelcbinstall.equalsIgnoreCase(\"Yes\")) {\n // elcbbasedll.setVisibility(View.VISIBLE);\n valelcbinstall = \"Yes\";\n } else {\n\n valelcbinstall = \"No\";\n\n }\n }\n });\n\n radioInstalledBus = (RadioGroup) rootView.findViewById(R.id.radioinstalledbus);\n\n final LinearLayout busbarmainll = (LinearLayout) rootView.findViewById(R.id.busbarinstalled_ll);\n final LinearLayout busbarll = (LinearLayout) rootView.findViewById(R.id.busbarll);\n\n dropbussize = (Spinner) rootView.findViewById(R.id.dropbussize);\n dropbussizecust = (Spinner) rootView.findViewById(R.id.dropbussizecust);\n\n busnumber = (EditText) rootView.findViewById(R.id.busnumber);\n busbarcablesize = (Spinner) rootView.findViewById(R.id.busbarcablesize);\n drumnumberbb = (EditText) rootView.findViewById(R.id.drumnumberbb); // new\n\n radiocableinstalltypebb = (RadioGroup) rootView.findViewById(R.id.radiocableinstalltypebb);\n valInstallTypebb = ((RadioButton) rootView.findViewById(radiocableinstalltypebb.getCheckedRadioButtonId())).getText().toString();\n\n radiocableinstalltypebb.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {\n @Override\n public void onCheckedChanged(RadioGroup group, int checkedId) {\n valInstallTypebb = ((RadioButton) group.getRootView().findViewById(checkedId)).getText().toString();\n }\n });\n\n runninglengthfrombb = (EditText) rootView.findViewById(R.id.runninglengthfrombb); // new\n runninglengthtobb = (EditText) rootView.findViewById(R.id.runninglengthtobb); // new\n cablelengthbb = (EditText) rootView.findViewById(R.id.cablelengthbb);\n\n cablelengthbb.setEnabled(true);\n cablelengthbb.setOnTouchListener(new View.OnTouchListener() {\n @Override\n public boolean onTouch(View v, MotionEvent event) {\n\n if (runninglengthfrombb.getText().toString().trim().isEmpty()) {\n return false;\n } else {\n if (!runninglengthtobb.getText().toString().trim().isEmpty()) {\n\n\n frombb = Integer.parseInt(runninglengthfrombb.getText().toString().trim());\n tobb = Integer.parseInt(runninglengthtobb.getText().toString().trim());\n\n if (frombb < tobb || frombb == tobb) {\n int result = tobb - frombb;\n if (result < 0) {\n // return false;\n } else {\n cablelengthbb.setText(Integer.toString(result));\n }\n } else {\n Snackbar.make(getView(), \"From length should be less than to length!!\", Snackbar.LENGTH_LONG)\n .setAction(\"Action\", null).show();\n cablelengthbb.setText(\"\");\n runninglengthtobb.setText(\"\");\n }\n }\n }\n\n return false;\n }\n });\n\n\n final LinearLayout busbarcablesize_layout = (LinearLayout) rootView.findViewById(R.id.busbarcablesize_layout);\n final LinearLayout busbarcustomerll = (LinearLayout) rootView.findViewById(R.id.busbarcustomerll);\n valInstalledBus = ((RadioButton) rootView.findViewById(radioInstalledBus.getCheckedRadioButtonId())).getText().toString();\n final LinearLayout radiocustomerbusll = (LinearLayout) rootView.findViewById(R.id.radiocustomerbusll);\n\n radioInstalledBus.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {\n @Override\n public void onCheckedChanged(RadioGroup group, int checkedId) {\n valInstalledBus = ((RadioButton) group.getRootView().findViewById(checkedId)).getText().toString();\n\n if (valInstalledBus.equalsIgnoreCase(\"Yes\")) {\n radiocustomerbusll.setVisibility(View.GONE);\n\n busbarmainll.setVisibility(View.VISIBLE);\n dropbussizecustVal = \"\";\n } else if (valInstalledBus.equalsIgnoreCase(\"Old\")) {\n\n busbarmainll.setVisibility(View.VISIBLE);\n radiocustomerbusll.setVisibility(View.VISIBLE);\n\n } else {\n\n busbarmainll.setVisibility(View.GONE);\n radiocustomerbusll.setVisibility(View.GONE);\n dropbussizecustVal = \"\";\n }\n }\n });\n\n\n radiocustomerbus = (RadioGroup) rootView.findViewById(R.id.radiocustomerbus);\n radiocustomerbus.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {\n @Override\n public void onCheckedChanged(RadioGroup group, int checkedId) {\n valcustomerinstall = ((RadioButton) group.getRootView().findViewById(checkedId)).getText().toString();\n\n if (valcustomerinstall.equalsIgnoreCase(\"BSES Bus-Bar\")) {\n // elcbbasedll.setVisibility(View.VISIBLE);\n dropbussizecustVal = \"\";\n busbarcustomerll.setVisibility(View.GONE);\n busbarll.setVisibility(View.VISIBLE);\n } else {\n dropbussizecustVal = dropbussizecust.getSelectedItem().toString();\n busbarcustomerll.setVisibility(View.VISIBLE);\n busbarll.setVisibility(View.GONE);\n }\n }\n });\n\n dropreason = (Spinner) rootView.findViewById(R.id.dropreason);\n dropreason.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n if (position == 0) {\n valdropreason = \"01\";\n } else {\n valdropreason = \"01\";\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n dropreasonre = (Spinner) rootView.findViewById(R.id.dropreasonre);\n dropreasonre.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n if (position == 0) {\n valdropreason = \"09\";\n } else {\n valdropreason = \"09\";\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n\n dropcablesize = (Spinner) rootView.findViewById(R.id.dropcablesize);\n\n drumnumber = (EditText) rootView.findViewById(R.id.drumnumber);\n\n outputcablelength = (EditText) rootView.findViewById(R.id.outputcablelength);\n\n radiocableinstalltype = (RadioGroup) rootView.findViewById(R.id.radiocableinstalltype);\n\n valInstallType = ((RadioButton) rootView.findViewById(radiocableinstalltype.getCheckedRadioButtonId())).getText().toString();\n\n radiocableinstalltype.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {\n @Override\n public void onCheckedChanged(RadioGroup group, int checkedId) {\n valInstallType = ((RadioButton) group.getRootView().findViewById(checkedId)).getText().toString();\n }\n });\n\n runninglengthfrom = (EditText) rootView.findViewById(R.id.runninglengthfrom);\n runninglengthto = (EditText) rootView.findViewById(R.id.runninglengthto);\n cablelength = (EditText) rootView.findViewById(R.id.cablelength);\n\n cablelength.setEnabled(true);\n cablelength.setOnTouchListener(new View.OnTouchListener() {\n @Override\n public boolean onTouch(View v, MotionEvent event) {\n\n if (runninglengthfrom.getText().toString().trim().isEmpty()) {\n return false;\n } else {\n if (!runninglengthto.getText().toString().trim().isEmpty()) {\n\n from = Integer.parseInt(runninglengthfrom.getText().toString().trim());\n to = Integer.parseInt(runninglengthto.getText().toString().trim());\n\n if (from < to || from == to) {\n int result = to - from;\n if (result < 0) {\n // return false;\n } else {\n cablelength.setText(Integer.toString(result));\n }\n } else {\n Snackbar.make(getView(), \"From length should be less than to length!!\", Snackbar.LENGTH_LONG)\n .setAction(\"Action\", null).show();\n cablelength.setText(\"\");\n runninglengthto.setText(\"\");\n }\n }\n }\n return false;\n }\n });\n\n\n validateseal = (Button) rootView.findViewById(R.id.validateseal);\n\n\n validateseal.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n punchDataWS task = new punchDataWS();\n //Call execute\n task.execute();\n }\n });\n\n\n Button button1 = (Button) rootView.findViewById(R.id.next2);\n\n button1.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n\n\n mcrOrderProxieOtherConn.setStrPURPOSE_S5(spinUsageVal);\n mcrOrderProxieOtherConn.setStrDESC_S5(description.getText().toString());\n\n\n Fragment fragment = new PhotosAndID();\n Bundle bundle = new Bundle();\n bundle.putSerializable(\"orderData\", mcrOrderProxieOtherConn);\n fragment.setArguments(bundle);\n\n FragmentManager fm = getFragmentManager();\n FragmentTransaction fragmentTransaction = fm.beginTransaction();\n fragmentTransaction.replace(R.id.fragment_place, fragment, TAG_FRAGMENT);\n fragmentTransaction.addToBackStack(TAG_FRAGMENT);\n fragmentTransaction.commit();\n }\n });\n\n\n return rootView;\n }", "private void spinner() {\n ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,\n R.array.planets_array, R.layout.simple_spinner_item_new);\n// Specify the layout to use when the list of choices appears\n adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n// Apply the adapter to the spinner\n// dropDownViewTheme.\n planetsSpinner.setAdapter(adapter);\n planetsSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n Object itemAtPosition = parent.getItemAtPosition(position);\n Log.d(TAG, \"onItemSelected: \" + itemAtPosition);\n\n String[] stringArray = getResources().getStringArray(R.array.planets_array);\n Toast.makeText(DialogListActivity.this, \"选择 \" + stringArray[position], Toast.LENGTH_SHORT).show();\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n Toast.makeText(DialogListActivity.this, \"未选择\", Toast.LENGTH_SHORT).show();\n }\n });\n }", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n // I created a dynamic TextView here, but you can reference your own custom layout for each spinner item\n TextView label = new TextView(context);\n label.setTextColor(Color.BLACK);\n // Then you can get the current item using the values array (Users array) and the current position\n // You can NOW reference each method you has created in your bean object (User class)\n label.setText(values[position].get_projeadi());\n\n // And finally return your dynamic (or custom) view for each spinner item\n return label;\n }", "@Override\n protected void onPostExecute(String result) {\n super.onPostExecute(result);\n\n ArrayAdapter<String> adapter_state1 = new ArrayAdapter<String>(MainActivity.this, R.layout.simple_list_item_2, arrayListtype){\n\n @Override\n public boolean isEnabled(int position){\n if(position == 0)\n {\n // Disable the first item from Spinner\n // First item will be use for hint\n return false;\n }\n else\n {\n return true;\n }\n }\n @Override\n public View getDropDownView(int position, View convertView,\n ViewGroup parent) {\n View view = super.getDropDownView(position, convertView, parent);\n TextView tv = (TextView) view;\n if(position == 0){\n // Set the hint text color gray\n tv.setTextColor(getResources().getColor(R.color.grey));\n }\n else {\n tv.setTextColor(getResources().getColor(R.color.textcolour));\n }\n return view;\n }\n };\n\n adapter_state1\n .setDropDownViewResource(R.layout.simple_list_item_1);\n\n sp1.setAdapter(adapter_state1);\n pdia.dismiss();\n\n }", "@Override\n protected void onPostExecute(String s) {\n ActivitySpinnerAdapter activitySpinnerAdapter = new ActivitySpinnerAdapter(getActivity().getApplicationContext(), aImage, aName);\n activitySpinner.setAdapter(activitySpinnerAdapter);;\n }", "@Override\r\n public void onClick(View view) {\r\n Toast.makeText(context, \"satu\" +list_data.get(getAdapterPosition()), Toast.LENGTH_SHORT).show();\r\n\r\n }", "@Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n\n quanHuyens = sqLite_quanHuyen.getDSQH(arrTinhTP.get(position).getId());\n adapterRecyclerViewChonQuan = new AdapterRecyclerViewChonQuan(quanHuyens, getApplicationContext());\n recycleQH.setAdapter(adapterRecyclerViewChonQuan);\n\n //spinnerQuanHuyen_adapter = new SpinnerQuanHuyen_Adapter(getApplicationContext(), arrQuanHuyen);\n //spinnerQuanHuyen_adapter.notifyDataSetChanged();\n //spinnerQuanHuyen.setAdapter(spinnerQuanHuyen_adapter);\n\n }", "private void initSpinnerSelectionChamps() {\n\n //preparation de l'URL, recuperation de tous les champs dispo. dans la BDD\n final String url = WebService.buildUrlForRequest(Metier.DOMAIN, Metier.NOM_MODELE_CATEGORIES, WebService.ACTION_LIST, null);\n\n //preparation et execution de la requete en asynchrone\n asyncHttpClient.get(getActivity(), url, new AsyncHttpResponseHandler() {\n @Override\n public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {\n //recuperation des donnees et parsing en JSONArray\n String response = null;\n try {\n response = new String(responseBody, ENCODING);\n JSONArray jsonArray = new JSONArray(response);\n Log.e(\"JSONARRAY\", jsonArray.toString(1));\n } catch (UnsupportedEncodingException e) {\n e.printStackTrace();\n } catch (JSONException e) {\n e.printStackTrace();\n }\n\n }\n\n @Override\n public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {\n new AlertDialog.Builder(getActivity()).setMessage(getString(R.string.error_msg_fail_retrieve_data) + statusCode).show();\n }\n });\n/*\n try {\n JSONObject json = JsonUtils.loadJSONFromResources(getActivity(), R.raw.champs);\n this.spinnerChampAdapter = new ChampAdapter(getActivity(), JsonUtils.getJsonObjects(json, new ArrayList<JSONObject>()));\n } catch (IOException e) {\n e.printStackTrace();\n }*/\n }", "private void cargarSpinner() {\n\n admin = new AdminSQLiteOpenHelper(this, \"activo_fijo\", null, 1);\n BaseDeDatos = admin.getReadableDatabase();\n\n List<String> opciones = new ArrayList<String>();\n opciones.add(\"Selecciona una opción\");\n\n String selectQuery = \"SELECT * FROM sucursales\" ;\n Cursor cursor = BaseDeDatos.rawQuery(selectQuery, null);\n\n // looping through all rows and adding to list\n if (cursor.moveToFirst()) {\n do {\n // adding to tags list\n opciones.add(cursor.getString(cursor.getColumnIndex(\"local\")));\n } while (cursor.moveToNext());\n }\n\n BaseDeDatos.close();\n\n //spiner personalizado\n ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, opciones);\n spinner.setAdapter(adapter);\n\n }", "@Override\n public void onItemSelected(AdapterView<?> parent, View view, int position,\n long id) {\n nama_dokter2 = parent.getItemAtPosition(position).toString();\n\n // Showing selected spinner item\n Toast.makeText(parent.getContext(), \"You selected: \" + nama_dokter2,\n Toast.LENGTH_LONG).show();\n\n }", "@Override\n protected void onPostExecute(String result) {\n super.onPostExecute(result);\n ArrayAdapter<String> adapter_state2 = new ArrayAdapter<String>(MainActivity.this, R.layout.simple_list_item_3, arrayListsize){\n\n @Override\n public boolean isEnabled(int position){\n if(position == 0)\n {\n // Disable the first item from Spinner\n // First item will be use for hint\n return false;\n }\n else\n {\n return true;\n }\n }\n @Override\n public View getDropDownView(int position, View convertView,\n ViewGroup parent) {\n View view = super.getDropDownView(position, convertView, parent);\n TextView tv = (TextView) view;\n if(position == 0){\n // Set the hint text color gray\n tv.setTextColor(getResources().getColor(R.color.grey));\n }\n else {\n tv.setTextColor(getResources().getColor(R.color.textcolour));\n }\n return view;\n }\n };\n\n adapter_state2\n .setDropDownViewResource(R.layout.simple_list_item_1);\n\n sp2.setAdapter(adapter_state2);\n pdia.dismiss();\n\n\n }", "private void loadSpinnerData() {\n rows = db.getPumpDetails();\n\n // Creating adapter for spinner\n dataAdapter = new ArrayAdapter<String>(this,\n android.R.layout.simple_spinner_item, rows);\n\n // Drop down layout style - list view with radio button\n dataAdapter\n .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n\n // attaching data adapter to spinner\n spinner.setAdapter(dataAdapter);\n }", "void loadSpinner(Spinner sp){\n List<String> spinnerArray = new ArrayList<>();\n spinnerArray.add(\"Oui\");\n spinnerArray.add(\"Non\");\n\n// (3) create an adapter from the list\n ArrayAdapter<String> adapter = new ArrayAdapter<String>(\n this,\n android.R.layout.simple_spinner_item,\n spinnerArray\n );\n\n//adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n\n// (4) set the adapter on the spinner\n sp.setAdapter(adapter);\n\n }", "@Override\n public void onSuccess(Void aVoid) {\n Toast.makeText(getContext(), \"המוצר נמחק בהצלחה!\", Toast.LENGTH_SHORT).show();\n }", "public void send(View v)\n {\n if(staticSpinner.getSelectedItemPosition() == 0) {\n TextView errorText = (TextView)staticSpinner.getSelectedView();\n errorText.setError(\"\");\n errorText.setTextColor(Color.RED);//just to highlight that this is an error\n errorText.setText(\"Harap Pilih Kategori\");\n }\n else if(msgTextField.getText().toString().equals(\"\") ){\n msgTextField.setError(\"required\");\n msgTextField.setHintTextColor(Color.RED);//just to highlight that this is an error\n msgTextField.setHint(\"Harap Diisi\");\n }\n else {\n if (staticSpinner.getSelectedItem().equals(\"Nama Produk\")) {\n spinK = \"nama_produk\";\n } else if (staticSpinner.getSelectedItem().equals(\"Nama Produsen\")) {\n spinK = \"nama_produsen\";\n } else {\n spinK = \"nomor_sertifikat\";\n }\n String msgSearch = msgTextField.getText().toString();\n Intent searchIntent = new Intent(MainActivity.this, HasilCari.class);\n Bundle extras = new Bundle();\n extras.putString(\"spinKat\", spinK);\n extras.putString(\"msgSearch\", msgSearch);\n searchIntent.putExtras(extras);\n startActivity(searchIntent);\n Log.v(TAG, spinK);\n }\n }", "private void ShowSpinner(String[] items, Spinner spinner)\n {\n String[] list = items;\n\n final List<String> plantsList = new ArrayList<>(Arrays.asList(list));\n\n // Initializing an ArrayAdapter\n final ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(\n this, R.layout.support_simple_spinner_dropdown_item, plantsList) {\n @Override\n public boolean isEnabled(int position) {\n if (position == 0) {\n // Disable the first item from Spinner\n // First item will be use for hint\n return false;\n } else {\n return true;\n }\n }\n\n @Override\n public View getDropDownView(int position, View convertView,\n ViewGroup parent) {\n View view = super.getDropDownView(position, convertView, parent);\n TextView tv = (TextView) view;\n if (position == 0) {\n // Set the hint text color gray\n tv.setTextColor(Color.parseColor(\"#C1C1C1\"));\n } else {\n tv.setTextColor(Color.BLACK);\n }\n return view;\n }\n };\n spinnerArrayAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);\n spinner.setAdapter(spinnerArrayAdapter);\n spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n topicname = (String) parent.getItemAtPosition(position);\n // If user change the default selection\n // First item is disable and it is used for hint\n if (position > 0) {\n // Notify the selected item text\n Toast.makeText\n (getApplicationContext(), \"Topic \" + topicname+\" selected\", Toast.LENGTH_SHORT)\n .show();\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n }", "public void addItemsOnSpinner() {\n Data dataset = new Data(getApplicationContext());\n List<String> list = new ArrayList<String>();\n list = dataset.getClasses();\n ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list);\n dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n spinner.setAdapter(dataAdapter);\n }", "@Override\n public void onSuccess(String result) {\n if (!TextUtils.isEmpty(result)){\n\n Gson gson=new Gson();\n list = gson.fromJson(result,new TypeToken<List<SecondHandCollege>>() { }.getType());\n data = getStringArraty(list);\n collegeAdapter=new ArrayAdapter(RegisterActivity.this,android.R.layout.simple_spinner_item, data);\n registerCollegeSpinner.setAdapter(collegeAdapter);\n\n //下拉列表点击监听\n setCollegeSpinnerClick();\n\n }\n }", "private void povoarSpinners() {\n List<String> lista = new ArrayList<>();\n lista.add(UsuarioNivelConstantes.VETOR_DESCRICOES[0]);\n lista.add(UsuarioNivelConstantes.VETOR_DESCRICOES[1]);\n lista.add(UsuarioNivelConstantes.VETOR_DESCRICOES[2]);\n ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, lista);\n arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_item);\n spnNivel.setAdapter(arrayAdapter);\n lista = new ArrayList<>();\n lista.add(UsuarioEstadoConstantes.VETOR_DESCRICOES[0]);\n lista.add(UsuarioEstadoConstantes.VETOR_DESCRICOES[1]);\n arrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, lista);\n arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_item);\n spnEstado.setAdapter(arrayAdapter);\n }", "@Override\n public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long id) {\n Toast.makeText(getApplicationContext(),country[position] , Toast.LENGTH_LONG).show();\n }", "public void onItemSelected(AdapterView<?> parent, View view, int position,\n long id) {\n nama_pasien2 = parent.getItemAtPosition(position).toString();\n\n // Showing selected spinner item\n Toast.makeText(parent.getContext(), \"You selected: \" + nama_pasien2,\n Toast.LENGTH_LONG).show();\n\n }", "@Override\n protected void onPostExecute(Void args) {\n Spinner mySpinner = (Spinner) findViewById(R.id.profile_spinner);\n\n // Spinner adapter\n mySpinner\n .setAdapter(new ArrayAdapter<String>(NewUserVehicleDetails.this,\n android.R.layout.simple_spinner_dropdown_item,\n modelvarlist));\n\n // Spinner on item click listener\n mySpinner\n .setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n\n @Override\n public void onItemSelected(AdapterView<?> arg0,\n View arg1, int position, long arg3) {\n\n\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> arg0) {\n // TODO Auto-generated method stub\n }\n });\n }", "private void spinnerAction() {\n Spinner spinnerphonetype = (Spinner) findViewById(R.id.activity_one_phonetype_spinner);//phonetype spinner declaration\n ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,\n R.array.phone_spinner, android.R.layout.simple_spinner_item); //create the spinner array\n adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); //set the drop down function\n spinnerphonetype.setAdapter(adapter); //set the spinner array\n }", "public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {\n userType = (int) arg3;\n /* 将mySpinner 显示*/\n arg0.setVisibility(View.VISIBLE);\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_third);\n\n Intent intent = getIntent();\n // 4. get bundle from intent\n Bundle bundle = intent.getExtras();\n String message = intent.getStringExtra(\"mTextNewGroup\");\n // 5. get status value from bundle\n get_group2 = bundle.getString(\"mTextNewGroup\");\n\n // mTextNewGroup = (TextView)findViewById(R.id.textNewGroup);\n mTextView3= (TextView)findViewById(R.id.textView3);\n (mTextView3).setText(get_group2);\n\n mTextView5= (TextView)findViewById(R.id.textView5);\n\n s3 = (Spinner)findViewById(R.id.spinner3);\n\n List<String> listDepth = new ArrayList<>();\n listDepth.add(\"35\");\n listDepth.add(\"40\");\n listDepth.add(\"50\");\n listDepth.add(\"60\");\n listDepth.add(\"70\");\n listDepth.add(\"80\");\n listDepth.add(\"90\");\n listDepth.add(\"100\");\n listDepth.add(\"1100\");\n listDepth.add(\"120\");\n listDepth.add(\"130\");\n ArrayAdapter<String> dataAdapter = new ArrayAdapter<>(this,\n android.R.layout.simple_spinner_item, listDepth);\n dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n dataAdapter.notifyDataSetChanged();\n s3.setAdapter(dataAdapter);\n s3.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {\n String depthValue = String.valueOf(s3.getSelectedItem());\n\n if (depthValue.contentEquals(\"35\") && get_group2.contentEquals(\"A\")) {\n //Toast.makeText(getApplicationContext(), \"Your Max Underwater time is 185 minutes\", Toast.LENGTH_SHORT).show();\n (mTextView5).setText(\"Your Max Underwater time is 185 minutes\");\n } else if (depthValue.contentEquals(\"40\") && get_group2.contentEquals(\"A\")) {\n //Toast.makeText(getApplicationContext(), \"Your Max Underwater time is 122 minutes\", Toast.LENGTH_SHORT).show();\n (mTextView5).setText(\"Your Max Underwater time is 122 minutes\");\n } else if (depthValue.contentEquals(\"50\") && get_group2.contentEquals(\"A\")) {\n //Toast.makeText(getApplicationContext(), \"Your Max Underwater time is 66 minutes\", Toast.LENGTH_SHORT).show();\n (mTextView5).setText(\"Your Max Underwater time is 66 minutes\");\n } else if (depthValue.contentEquals(\"35\") && get_group2.contentEquals(\"B\")) {\n //Toast.makeText(getApplicationContext(), \"Your Max Underwater time is 167 minutes\", Toast.LENGTH_SHORT).show();\n (mTextView5).setText(\"Your Max Underwater time is 167 minutes\");\n } else if (depthValue.contentEquals(\"40\") && get_group2.contentEquals(\"B\")) {\n //Toast.makeText(getApplicationContext(), \"Your Max Underwater time is 108 minutes\", Toast.LENGTH_SHORT).show();\n (mTextView5).setText(\"Your Max Underwater time is 108 minutes\");\n } else if (depthValue.contentEquals(\"50\") && get_group2.contentEquals(\"B\")) {\n //Toast.makeText(getApplicationContext(), \"Your Max Underwater time is 54 minutes\", Toast.LENGTH_SHORT).show();\n (mTextView5).setText(\"Your Max Underwater time is 54 minutes\");\n }\n else if (depthValue.contentEquals(\"35\") && get_group2.contentEquals(\"C\")) {\n //Toast.makeText(getApplicationContext(), \"Your Max Underwater time is 54 minutes\", Toast.LENGTH_SHORT).show();\n (mTextView5).setText(\"Your Max Underwater time is 155 minutes\");\n }\n else if (depthValue.contentEquals(\"40\") && get_group2.contentEquals(\"C\")) {\n //Toast.makeText(getApplicationContext(), \"Your Max Underwater time is 54 minutes\", Toast.LENGTH_SHORT).show();\n (mTextView5).setText(\"Your Max Underwater time is 96 minutes\");\n }\n\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parentView) {\n // your code here\n }\n\n });\n\n\n }", "@Override\n public void onItemSelected(AdapterView<?> adapterView,\n View view, int i, long l) {\n mSpinnerLabel = adapterView.getItemAtPosition(i).toString();\n showText(view);\n }", "@Override\n\t\t\t\t\tpublic void onItemSelected(AdapterView<?> arg0, View arg1,\n\t\t\t\t\t\t\tint arg2, long arg3) {\n\t\t\t\t\t\tsbsno=arg0.getItemAtPosition(arg2).toString();\n\t\t\t\t\t\t\n\t\t\t\t\t\t((TextView) arg0.getChildAt(0)).setTextColor(Color.BLUE);\n\t\t\t\t\t\t\n\t\t\t\t\t\tToast.makeText(getApplicationContext(), \"\"+sbsno, Toast.LENGTH_SHORT).show();\n\t\t\t\t\t\tnew BusStopFetchApi().execute();\n\t\t\t\t\t\t\n\t\t\t\t\t}", "@Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n String item = parent.getItemAtPosition(position).toString();\n tuning = position;\n setUpDisplay();\n\n // Showing selected spinner item\n if (tuner1 == 3) {\n Toast.makeText(TunerActivity.this, \"\" + item, Toast.LENGTH_LONG).show();\n }\n }", "private void startSpinnerValues(Spinner spinner, ArrayList<String> valores, ArrayAdapter<String> adapter)\n {\n //Inicializamos el adaptador y lo agregamos al Spinner\n adapter=new ArrayAdapter<String>(this, R.layout.support_simple_spinner_dropdown_item,valores);\n spinner.setAdapter(adapter);\n }", "public void addItemsOnSpinner2() {\n }", "@Override\n public void onItemClick(AdapterView<?> parent, View view, int position, long id) {\n sensorSelect = (Sensor)parent.getItemAtPosition(position);\n et_tipo.setText(sensorSelect.getTipo());\n et_descripcion.setText(sensorSelect.getDescripcion());\n et_umbral_max.setText(sensorSelect.getValor_umbarl_maximo());\n et_umbral_min.setText(sensorSelect.getValor_umbarl_minimo());\n }", "@Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n String item = parent.getItemAtPosition(position).toString();\n\n // Showing selected spinner item\n Toast.makeText(parent.getContext(), \"Selected: \" + item, Toast.LENGTH_LONG).show();\n\n }", "@Override\n protected void onPostExecute(String s) {\n\n RepeatSpinnerAdapter repeatSpinnerAdapter = new RepeatSpinnerAdapter(getActivity().getApplicationContext(), iconsRepeat, rNames);\n repeatSpinner.setAdapter(repeatSpinnerAdapter);\n\n }", "private void updateSpinner() {\n ArrayAdapter<CharSequence> adaptador = new ArrayAdapter(getContext(), android.R.layout.simple_spinner_item,nombresEnComboBox);\n spinner.setAdapter(adaptador);\n //guardo el item seleccionado del combo\n spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){\n @Override\n public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {\n nombreDeLocSeleccionada[0] = (String) spinner.getAdapter().getItem(i);\n for (int j=0 ; j < listaLocalidades.size() ; j++){\n if (listaLocalidades.get(j).getNombreLocalidad().equals(nombreDeLocSeleccionada[0])) {\n idLoc = listaLocalidades.get(j).getIdLocalidad() ;\n break;\n }\n }\n //Toast.makeText(getActivity(), nombreDeLocSeleccionada[0], Toast.LENGTH_SHORT).show();\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> adapterView) {\n\n }\n });\n }", "private void loadSpinnerData() {\n List<String> patientList = db.getAllPatient();\n\n // Creating adapter for spinner\n ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,\n android.R.layout.simple_spinner_item, patientList);\n\n // Drop down layout style - list view with radio button\n dataAdapter\n .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n\n // attaching data adapter to spinner\n patientIdSpn.setAdapter(dataAdapter);\n }", "@Override\n protected void onPostExecute(Void args) {\n Spinner mySpinner = (Spinner) findViewById(R.id.manu_spinner);\n\n // Spinner adapter\n mySpinner\n .setAdapter(new ArrayAdapter<String>(NewUserVehicleDetails.this,\n android.R.layout.simple_spinner_dropdown_item,\n manufatureslist));\n\n // Spinner on item click listener\n mySpinner\n .setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n\n @Override\n public void onItemSelected(AdapterView<?> arg0,\n View arg1, int position, long arg3) {\n // new DownloadModelVarJSON().execute();\n Spinner manufacturSpin=(Spinner) findViewById(R.id.manu_spinner);\n String name = manufacturSpin.getSelectedItem().toString();\n\n GetModelVarDropdon(name);\n\n\n\n\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> arg0) {\n // TODO Auto-generated method stub\n }\n });\n }", "@Override\n public void onResponse(JSONArray response) {\n Toast.makeText(getApplicationContext(), \"Berhasil tambah data\" + response, Toast.LENGTH_SHORT).show();\n mProgressBar.setVisibility(View.INVISIBLE);\n }", "@Override\n protected void onPostExecute(String s) {\n PersonSpinnerAdapter personSpinnerAdapter = new PersonSpinnerAdapter(getActivity().getApplicationContext(), pIcon, pNames);\n personSpinner.setAdapter(personSpinnerAdapter);\n\n }", "@Override\n\t\t\tpublic void onItemSelected(AdapterView<?> arg0, View arg1,\n\t\t\t\t\tint arg2, long arg3) {\n\t\t\t\tToast.makeText(getApplicationContext(), \"Selected Text Is...\"+names[arg2]+\":\"+phones[arg2], 5000).show();\n\t\t\t}", "private void UpdateDataForSpinner(Spinner spinner){\n // Create an ArrayAdapter using the string array and a default spinner layout\n ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,\n R.array.serviceQuantity, android.R.layout.simple_spinner_item);\n // Specify the layout to use when the list of choices appears\n adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n // Apply the adapter to the spinner\n spinner.setAdapter(adapter);\n }", "private void initSpinnerTypeExam()\n {\n Spinner spinner = findViewById(R.id.iTypeExam);\n\n // Adapt\n final ArrayAdapter<String> adapter = new ArrayAdapter<>(\n this,\n R.layout.support_simple_spinner_dropdown_item\n );\n spinner.setAdapter(adapter);\n\n // ajout des types d'examens\n for(TypeExamen t : TypeExamen.values())\n {\n adapter.add(t.toString());\n }\n }", "public void bindSpinner() {\n // Create an ArrayAdapter using the string array and a spinner layout\n ArrayAdapter<CharSequence> adapter;\n adapter = ArrayAdapter.createFromResource(getActivity(), R.array.kind_of_reaction, R.layout.item_spinner_healthbook);\n // Specify the layout to use when the list of choices appears\n adapter.setDropDownViewResource(R.layout.item_spinner_healthbook_dropdown);\n // Apply the adapter to the spinner\n kindOfReactionSpinner.setAdapter(adapter);\n }", "@Override\n\t\t\tpublic void onItemSelected(AdapterView<?> arg0, View arg1,\n\t\t\t\t\tint arg2, long arg3) {\n\t\t\t\tSpinner s = (Spinner) arg0;\n\t\t\t\tString city = (String) s.getItemAtPosition(arg2);\n\t\t\t\tif (city.equals(\"-城市-\")){\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tLog.i(\"省份\",sr1.getSelectedItem().toString());\n\t\t\t\tLog.i(\"城市\",city);\n\t\t\t\t\n\t\t\t\tString urlRealTime = \"https://api.seniverse.com/v3/weather/now.json?key=kuw7pbduduh35zvd&location=\"+city+\"&language=zh-Hans&unit=c\";\n\t\t\t\tOkHttpClient mOkHttpClientRealTime = new OkHttpClient();\n\t\t\t\tfinal Request requestRealTime = new Request.Builder()\n \t.url(urlRealTime)\n \t.build();\n\t\t\t\tCall callRealTime = mOkHttpClientRealTime.newCall(requestRealTime); \n\t\t\t\tcallRealTime.enqueue(new Callback(){\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onFailure(Request request, IOException e){\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t}\n\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onResponse(final Response response) throws IOException{\n\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\tGson gson = new Gson();\n\t\t\t\t\t\t\tWeatherRealTime weatherRealTime = gson.fromJson(response.body().string(), WeatherRealTime.class); \n\t\t\t\t\t\t\tList<com.example.weather.WeatherRealTime.ResultsBean> results = weatherRealTime.getResults();\n\t\t\t\t\t\t\tfinal String textRealTime = results.get(0).getNow().getText();\n\t\t\t\t\t\t\tfinal String temperatureRealTime = results.get(0).getNow().getTemperature();\n\t\t\t\t\t\t\tMainActivity.this.runOnUiThread(new Runnable(){\n\t\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t\t\ttextNow.setText(textRealTime);\n\t\t\t\t\t\t\t\t\ttempNow.setText(temperatureRealTime);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} catch (Exception e){\t\n\t\t\t\t\t\t\t e.printStackTrace();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tString htmlStr = response.body().string();\n\t\t\t\t\t\tLog.e(\"res\",htmlStr);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\tString url = \"https://api.seniverse.com/v3/weather/daily.json?key=kuw7pbduduh35zvd&location=\"+city+\"&language=zh-Hans&unit=c&start=0&days=3\";\n\t\t\t\tOkHttpClient mOkHttpClient = new OkHttpClient();\n\t\t\t\tfinal Request request = new Request.Builder()\n \t.url(url)\n \t.build();\n\t\t\t\t\t//new call\n\t\t\t\tCall call = mOkHttpClient.newCall(request); \n\t\t\t\t//请求加入调度\n\t\t\t\tcall.enqueue(new Callback(){\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onFailure(Request request, IOException e){\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t}\n\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onResponse(final Response response) throws IOException{\n\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\tGson gson = new Gson();\n\t\t\t\t\t\t\tWeather weather = gson.fromJson(response.body().string(), Weather.class); \n\t\t\t\t\t\t\tList<ResultsBean> results = weather.getResults();\n\t\t\t\t\t\t\tfinal List<DailyBean> daily = results.get(0).getDaily();\n\t\t\t\t\t\t\tLog.e(\"high:\",daily.get(0).getHigh());\n\t\t\t\t\t\t\tMainActivity.this.runOnUiThread(new Runnable(){\n\t\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\t\t\t\t\tday1.setText(daily.get(0).getText_day());\n\t\t\t\t\t\t\t\t\ttemp1.setText(daily.get(0).getHigh()+\"° / \"+daily.get(0).getLow()+\"°\");\n\t\t\t\t\t\t\t\t\tday2.setText(daily.get(1).getText_day());\n\t\t\t\t\t\t\t\t\ttemp2.setText(daily.get(1).getHigh()+\"° / \"+daily.get(1).getLow()+\"°\");\n\t\t\t\t\t\t\t\t\tday3.setText(daily.get(2).getText_day());\n\t\t\t\t\t\t\t\t\ttemp3.setText(daily.get(2).getHigh()+\"° / \"+daily.get(2).getLow()+\"°\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} catch (Exception e){\t\n\t\t\t\t\t\t\t e.printStackTrace();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}); \n\t\t\t}", "@SuppressLint(\"SetTextI18n\")\r\n @Override\r\n public void onClick(View view) {\n\r\n s1 = spinner[0].getSelectedItem().toString();\r\n s2 = spinner2[0].getSelectedItem().toString();\r\n Toast.makeText(dashboard.this, s1 + \" to \" + s2, Toast.LENGTH_SHORT).show();\r\n\r\n\r\n if (\"Mumbai\".equals(s1) && \"Mumbai\".equals(s2)) {\r\n tokens.setText(\"0 Tokens\");\r\n amount.setText(\"0\");\r\n }\r\n if (\"Mumbai\".equals(s1) && \"Panvel\".equals(s2)) {\r\n tokens.setText(\"3 Tokens\");\r\n amount.setText(\"100\");\r\n\r\n\r\n }\r\n if (\"Mumbai\".equals(s1) && \"Thane\".equals(s2)) {\r\n tokens.setText(\"1 Tokens\");\r\n amount.setText(\"40\");\r\n\r\n\r\n }\r\n if (\"Mumbai\".equals(s1) && \"Pune\".equals(s2)) {\r\n tokens.setText(\"3 Tokens\");\r\n amount.setText(\"120\");\r\n\r\n\r\n }\r\n if (\"Mumbai\".equals(s1) && \"Ratnagiri\".equals(s2)) {\r\n tokens.setText(\"5 Tokens\");\r\n amount.setText(\"150\");\r\n\r\n }\r\n if (\"Panvel\".equals(s1) && \"Panvel\".equals(s2)) {\r\n tokens.setText(\"0 Tokens\");\r\n amount.setText(\"0\");\r\n }\r\n if (\"Panvel\".equals(s1) && \"Thane\".equals(s2)) {\r\n tokens.setText(\"2 Tokens\");\r\n amount.setText(\"80\");\r\n }\r\n if (\"Panvel\".equals(s1) && \"Pune\".equals(s2)) {\r\n tokens.setText(\"3 Tokens\");\r\n amount.setText(\"120\");\r\n }\r\n if (\"Panvel\".equals(s1) && \"Ratnagiri\".equals(s2)) {\r\n tokens.setText(\"4 Tokens\");\r\n amount.setText(\"140\");\r\n\r\n }\r\n if (\"Panvel\".equals(s1) && \"Mumbai\".equals(s2)) {\r\n tokens.setText(\"3 Tokens\");\r\n amount.setText(\"100\");\r\n\r\n\r\n }\r\n if (\"Thane\".equals(s1) && \"Thane\".equals(s2)) {\r\n tokens.setText(\"0 Tokens\");\r\n }\r\n if (\"Thane\".equals(s1) && \"Pune\".equals(s2)) {\r\n tokens.setText(\"4 Tokens\");\r\n amount.setText(\"150\");\r\n\r\n\r\n }\r\n if (\"Thane\".equals(s1) && \"Ratnagiri\".equals(s2)) {\r\n tokens.setText(\"6 Tokens\");\r\n amount.setText(\"180\");\r\n\r\n }\r\n if (\"Thane\".equals(s1) && \"Mumbai\".equals(s2)) {\r\n tokens.setText(\"1 Tokens\");\r\n amount.setText(\"40\");\r\n\r\n\r\n }\r\n if (\"Thane\".equals(s1) && \"Panvel\".equals(s2)) {\r\n tokens.setText(\"2 Tokens\");\r\n amount.setText(\"80\");\r\n\r\n }\r\n if (\"Pune\".equals(s1) && \"Thane\".equals(s2)) {\r\n tokens.setText(\"4 Tokens\");\r\n amount.setText(\"160\");\r\n\r\n }\r\n if (\"Pune\".equals(s1) && \"Pune\".equals(s2)) {\r\n tokens.setText(\"0 Tokens\");\r\n amount.setText(\"0\");\r\n\r\n }\r\n if (\"Pune\".equals(s1) && \"Ratnagiri\".equals(s2)) {\r\n tokens.setText(\"3 Tokens\");\r\n amount.setText(\"120\");\r\n\r\n }\r\n if (\"Pune\".equals(s1) && \"Mumbai\".equals(s2)) {\r\n tokens.setText(\"4 Tokens\");\r\n amount.setText(\"150\");\r\n\r\n }\r\n if (\"Pune\".equals(s1) && \"Panvel\".equals(s2)) {\r\n tokens.setText(\"4 Tokens\");\r\n amount.setText(\"160\");\r\n\r\n }\r\n if (\"Ratnagiri\".equals(s1) && \"Thane\".equals(s2)) {\r\n tokens.setText(\"6 Tokens\");\r\n amount.setText(\"180\");\r\n\r\n\r\n }\r\n if (\"Ratnagiri\".equals(s1) && \"Pune\".equals(s2)) {\r\n tokens.setText(\"4 Tokens\");\r\n amount.setText(\"160\");\r\n\r\n }\r\n if (\"Ratnagiri\".equals(s1) && \"Ratnagiri\".equals(s2)) {\r\n tokens.setText(\"0 Tokens\");\r\n amount.setText(\"0\");\r\n }\r\n if (\"Ratnagiri\".equals(s1) && \"Mumbai\".equals(s2)) {\r\n tokens.setText(\"6 Tokens\");\r\n amount.setText(\"180\");\r\n\r\n }\r\n if (\"Ratnagiri\".equals(s1) && \"Panvel\".equals(s2)) {\r\n tokens.setText(\"5 Tokens\");\r\n amount.setText(\"150\");\r\n\r\n }\r\n if (\"Select Source Location\".equals(s1) || \"Select Destination Location\".equals(s2)) {\r\n Toast.makeText(dashboard.this, \" Please Choose both Source and Destination \", Toast.LENGTH_SHORT).show();\r\n\r\n }\r\n\r\n\r\n }", "private void setUpSpinner(){\n ArrayAdapter paymentSpinnerAdapter =ArrayAdapter.createFromResource(this,R.array.array_gender_option,android.R.layout.simple_spinner_item);\n\n // Specify dropdown layout style - simple list view with 1 item per line, then apply adapter to the spinner\n paymentSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);\n mPaymentSpinner.setAdapter(paymentSpinnerAdapter);\n\n // To set the spinner to the selected payment method by the user when clicked from cursor adapter.\n if (payMode != null) {\n if (payMode.equalsIgnoreCase(\"COD\")) {\n mPaymentSpinner.setSelection(0);\n } else {\n mPaymentSpinner.setSelection(1);\n }\n mPaymentSpinner.setOnTouchListener(mTouchListener);\n }\n\n mPaymentSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n String selectedPayment = (String)parent.getItemAtPosition(position);\n if(!selectedPayment.isEmpty()){\n if(selectedPayment.equals(getString(R.string.payment_cod))){\n mPaymentMode = clientContract.ClientInfo.PAYMENT_COD; // COD = 1\n }else{\n\n mPaymentMode = clientContract.ClientInfo.PAYMENT_ONLINE; // ONLINE = 0\n }\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n }", "public void addItemsOnSpinner() {\r\n\r\n\tspinner = (Spinner) findViewById(R.id.spinner);\r\n\tList<String> list = new ArrayList<String>();\r\n\tlist.add(\"Food\");\r\n\tlist.add(\"RentHouse\");\r\n\tlist.add(\"Closing\");\r\n\tlist.add(\"Party\");\r\n\tlist.add(\"Material\");\r\n\tArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, list);\r\n\tdataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\r\n\tspinner.setAdapter(dataAdapter);\r\n }", "private void itemtypeSpinner() {\n ArrayAdapter<CharSequence> staticAdapter = ArrayAdapter\n .createFromResource(getContext(), R.array.select_array,\n android.R.layout.simple_spinner_item);\n\n // Specify the layout to use when the list of choices appears\n staticAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n\n // Apply the adapter to the spinner\n mItemTypeSpinnerA2.setAdapter(staticAdapter);\n\n mItemTypeSpinnerA2.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view,\n int position, long id) {\n String itemtypeText = (String) parent.getItemAtPosition(position);\n if (itemtypeText.equals(\"Mobile Phones\")) {\n\n mInputLayoutSerialNoA2.setVisibility(View.VISIBLE);\n mInputLayoutSerialNoA2.setClickable(true);\n mInputLayoutItemImeiA2.setVisibility(View.VISIBLE);\n mInputLayoutItemImeiA2.setClickable(true);\n\n\n } else if (itemtypeText.equals(\"Laptops\")) {\n\n mInputLayoutSerialNoA2.setVisibility(View.VISIBLE);\n mInputLayoutSerialNoA2.setClickable(true);\n mInputLayoutItemImeiA2.setVisibility(View.GONE);\n mInputLayoutItemImeiA2.setClickable(false);\n\n } else {\n mInputLayoutSerialNoA2.setVisibility(View.GONE);\n mInputLayoutSerialNoA2.setClickable(false);\n mInputLayoutItemImeiA2.setVisibility(View.GONE);\n mInputLayoutItemImeiA2.setClickable(false);\n }\n\n\n\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n mItemTypeSpinnerA2.getItemAtPosition(0);\n mInputLayoutSerialNoA2.setVisibility(View.GONE);\n mInputLayoutSerialNoA2.setClickable(false);\n mInputLayoutItemImeiA2.setVisibility(View.GONE);\n mInputLayoutItemImeiA2.setClickable(false);\n\n\n }\n });\n\n }", "@Override\n public void onClick(View view) {\n alert = new AlertDialog.Builder(x);\n LinearLayout lila1 = new LinearLayout(x);\n lila1.setOrientation(LinearLayout.VERTICAL); //1 is for vertical orientation\n /* final Spinner spin = new Spinner(x);\n spin.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {\n\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> adapterView) {\n\n }\n });\n SpinnerAdapter customAdapter=new SpinnerAdapter(getApplicationContext());\n spin.setAdapter(customAdapter);*/\n final EditText input = new EditText(x);\n input.setHint(\"Name\");\n final EditText input1 = new EditText(x);\n input1.setHint(\"Phone\");\n final EditText input2 = new EditText(x);\n input2.setHint(\"Address\");\n final EditText input3 = new EditText(x);\n input3.setHint(\"Bithdate\");\n final EditText input4 = new EditText(x);\n input4.setHint(\"Group\");\n\n\n\n lila1.addView(input);\n lila1.addView(input1);\n lila1.addView(input2);\n lila1.addView(input3);\n lila1.addView(input4);\n alert.setView(lila1);\n\n alert.setTitle(\"Add contact\");\n\n alert.setPositiveButton(\"Ok\", (dialog, whichButton) -> {\n name = input.getText().toString();\n phone = input1.getText().toString();\n String ad = input2.getText().toString();\n String birth = input3.getText().toString();\n String group = input4.getText().toString();\n ar.add(new Contact(name, phone,ad,birth,group,R.drawable.man_3));\n mRoomModule.getmRepository().insertEndMethod(ar);\n mRoomModule.getmRepository().getmAllContacts().observeForever(contacts -> {\n products.clear();\n products.addAll(contacts);\n boxAdapter = new BoxAdapter(getBaseContext(), products);\n lvMain.setAdapter(boxAdapter);\n });\n products.addAll(ar);\n ar.clear();\n boxAdapter.notifyDataSetChanged();\n Toast.makeText(getApplicationContext(), name, Toast.LENGTH_SHORT).show();\n\n });\n alert.setNegativeButton(\"Cancel\",\n new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int whichButton) {\n\n dialog.cancel();\n }\n });\n\n alert.show();\n }", "@Override\n public void onResponse(String s) {\n Log.d(TAG, \"Form Response: \" + s);\n // create new toast to confirm user about demand generation\n Toast.makeText(context, context.getResources().getString(R.string.demand_generation) + itemName,\n Toast.LENGTH_LONG).show();\n\n }", "@Override\n\t\t\tpublic void onItemSelected(AdapterView<?> arg0, View arg1,\n\t\t\t\t\tint position, long id) {\n\t\t\t\t\n\t\t\t\tnameoffriend = sp.getItemAtPosition(position).toString();\n\t\t\t\tToast.makeText(getApplicationContext(), nameoffriend, Toast.LENGTH_SHORT).show();\n\t\t\t}", "@Override\n public void onResponse(JSONObject jsonobj) {\n dialog.dismiss();\n try {\n JSONArray jArray=jsonobj.getJSONArray(\"rows\");\n JSONObject jData;\n list=new ArrayList<String>();\n listId=new ArrayList<String>();\n for (int i=0;i<jArray.length();i++){\n jData=jArray.getJSONObject(i);\n int Seq=jData.getInt(\"Seq\");\n if(Seq>0){\n list.add(jData.getString(\"LineName\"));\n listId.add(jData.getString(\"LineCode\"));\n }\n\n }\n\n if(listId.size()>0){\n initData(myDate,listId.get(index));\n initData02(listId.get(index));\n }\n\n niceSpinner.attachDataSource(list);\n\n //niceSpinner.attachDataSource(list);\n\n //loadPatrolTask(listId.get(0));\n } catch (JSONException e) {\n e.printStackTrace();\n }\n\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)\n {\n View v = inflater.inflate(R.layout.fragment_customer_information, container, false);\n\n mtypeadapter= ArrayAdapter.createFromResource(getActivity(),\n R.array.mtype_array, android.R.layout.simple_spinner_item);\n mtypeadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n mtrtypespinner=(Spinner)v.findViewById(R.id.mtype_spinner);\n mtrtypespinner.setAdapter(mtypeadapter);\n\n ctratioadapter= ArrayAdapter.createFromResource(getActivity(),\n R.array.cct_ratio_array, android.R.layout.simple_spinner_item);\n ctratioadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n ctratiospinner=(Spinner)v.findViewById(R.id.ctratio_spinner);\n ctratiospinner.setAdapter(ctratioadapter);\n\n cttypeadapter= ArrayAdapter.createFromResource(getActivity(),\n R.array.type_array, android.R.layout.simple_spinner_item);\n cttypeadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n cttypespinner=(Spinner)v.findViewById(R.id.type_spinner);\n cttypespinner.setAdapter(cttypeadapter);\n\n cctratioadapter= ArrayAdapter.createFromResource(getActivity(),\n R.array.cct_ratio_array, android.R.layout.simple_spinner_item);\n cctratioadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n cctratiospinner=(Spinner)v.findViewById(R.id.cct_ratio_spinner);\n cctratiospinner.setAdapter(cctratioadapter);\n\n change=(Button)v.findViewById(R.id.change);\n change.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View arg0)\n {\n openAlert(change);\n }\n });\n\n ctratiolinear=(LinearLayout)v.findViewById(R.id.ctratiolinear);\n ctdetailslayout=(LinearLayout)v.findViewById(R.id.ctdetailslayout);\n typelinear=(LinearLayout)v.findViewById(R.id.typelinear);\n cctratiolinear=(LinearLayout)v.findViewById(R.id.cctratiolinear);\n makelinear=(LinearLayout)v.findViewById(R.id.makelinear);\n\n mtrtypespinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener()\n {\n @Override\n public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {\n\n selectionPosition= mtypeadapter.getPosition(mtrtypespinner.getSelectedItem().toString());\n\n if (mtrtypespinner.getSelectedItem().toString().equals(\"WHOLE\"))\n {\n ctratiolinear.setVisibility(LinearLayout.GONE);\n ctdetailslayout.setVisibility(LinearLayout.GONE);\n typelinear.setVisibility(LinearLayout.GONE);\n cctratiolinear.setVisibility(LinearLayout.GONE);\n makelinear.setVisibility(LinearLayout.GONE);\n }\n else if(mtrtypespinner.getSelectedItem().toString().equals(\"Select\"))\n {\n ctratiolinear.setVisibility(LinearLayout.GONE);\n ctdetailslayout.setVisibility(LinearLayout.GONE);\n typelinear.setVisibility(LinearLayout.GONE);\n cctratiolinear.setVisibility(LinearLayout.GONE);\n makelinear.setVisibility(LinearLayout.GONE);\n }\n else\n {\n ctratiolinear.setVisibility(View.VISIBLE);\n ctdetailslayout.setVisibility(View.VISIBLE);\n typelinear.setVisibility(View.VISIBLE);\n cctratiolinear.setVisibility(View.VISIBLE);\n makelinear.setVisibility(View.VISIBLE);\n }\n String metertypespinner = mtrtypespinner.getSelectedItem().toString();\n PageConsumerEntity.setMeterType(metertypespinner);\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> adapterView)\n {\n }\n });\n\n ctratiospinner= (Spinner) v.findViewById(R.id.ctratio_spinner);\n ctratiospinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n\n @Override\n public void onItemSelected(AdapterView<?> arg0, View arg1,\n int arg2, long arg3) {\n String ctrationspinner = ctratiospinner.getSelectedItem().toString();\n PageConsumerEntity.setCTRatio(ctrationspinner);\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> arg0) {\n // TODO Auto-generated method stub\n PageConsumerEntity.setCTRatio(\" \");\n }\n });\n\n cttypespinner= (Spinner) v.findViewById(R.id.type_spinner);\n cttypespinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n\n @Override\n public void onItemSelected(AdapterView<?> arg0, View arg1,\n int arg2, long arg3) {\n String typespinner = cttypespinner.getSelectedItem().toString();\n PageConsumerEntity.setCTType(typespinner);\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> arg0) {\n // TODO Auto-generated method stub\n PageConsumerEntity.setCTType(\" \");\n }\n });\n\n cctratiospinner= (Spinner) v.findViewById(R.id.cct_ratio_spinner);\n cctratiospinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n\n @Override\n public void onItemSelected(AdapterView<?> arg0, View arg1,\n int arg2, long arg3) {\n String cctrtospinner = cctratiospinner.getSelectedItem().toString();\n PageConsumerEntity.setCCTRatio(cctrtospinner);\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> arg0) {\n // TODO Auto-generated method stub\n PageConsumerEntity.setCCTRatio(\" \");\n }\n });\n\n nxtbtn=(Button)v.findViewById(R.id.nextbtn);\n nxtbtn.setOnClickListener(this);\n\n PageConsumerEntity = ((ConsumerInfo) getActivity().getApplicationContext()).getConsumerDetails();\n\n cnsmrno= (EditText) v.findViewById(R.id.cnsmrno);\n cnsmrno.setText(new String(PageConsumerEntity.getCustomerNo()));\n\n cnsmrname= (EditText) v.findViewById(R.id.cnsmrname);\n cnsmrname.setText(new String(PageConsumerEntity.getCustomerName()));\n\n aliasname= (EditText) v.findViewById(R.id.aliasname);\n aliasname.setText(new String(PageConsumerEntity.getAliasName()));\n\n cntctno1= (EditText) v.findViewById(R.id.cntcno1);\n cntctno1.setText(new String(PageConsumerEntity.getContactNo1()));\n\n cntctno2= (EditText) v.findViewById(R.id.cntcno2);\n if(PageConsumerEntity.getContactNo2() == null)\n {\n cntctno2.setText(\"\");\n }\n else\n {\n cntctno2.setText(new String(PageConsumerEntity.getContactNo2()));\n }\n\n cntctno3= (EditText) v.findViewById(R.id.cntcno3);\n if(PageConsumerEntity.getContactNo3() == null)\n {\n cntctno3.setText(\"\");\n }\n else\n {\n cntctno3.setText(new String(PageConsumerEntity.getContactNo3()));\n }\n\n cntctprsn= (EditText) v.findViewById(R.id.cntcprsn);\n if(PageConsumerEntity.getContactPerson() == null)\n {\n cntctprsn.setText(\"\");\n }\n else\n {\n cntctprsn.setText(new String(PageConsumerEntity.getContactPerson()));\n }\n\n email= (EditText) v.findViewById(R.id.email);\n if(PageConsumerEntity.getEmail() == null)\n {\n email.setText(\"\");\n }\n else\n {\n email.setText(new String(PageConsumerEntity.getEmail()));\n }\n\n location= (EditText) v.findViewById(R.id.location);\n location.setText(new String(PageConsumerEntity.getLandmark()));\n\n mno= (EditText) v.findViewById(R.id.mno);\n mno.setText(new String(PageConsumerEntity.getPreMNO()));\n\n make= (EditText) v.findViewById(R.id.make);\n make.setText(new String(PageConsumerEntity.getPreMake()));\n\n String meterTypeValue = PageConsumerEntity.getMeterType();\n if (!meterTypeValue.equals(null)) {\n int spinnerPosition = mtypeadapter.getPosition(meterTypeValue);\n mtrtypespinner.setSelection(spinnerPosition);\n }\n\n String ctRatioValue = PageConsumerEntity.getCTRatio();\n if (ctRatioValue == null)\n {\n ctratiospinner.setSelection(0);\n }\n else\n {\n if (!ctRatioValue.equals(null))\n {\n int spinnerPosition = ctratioadapter.getPosition(ctRatioValue);\n ctratiospinner.setSelection(spinnerPosition);\n }\n }\n\n String ctTypeValue = PageConsumerEntity.getCTType();\n if (ctTypeValue == null)\n {\n cttypespinner.setSelection(0);\n }\n else\n {\n if (!ctTypeValue.equals(null))\n {\n int spinnerPosition = cttypeadapter.getPosition(ctTypeValue);\n cttypespinner.setSelection(spinnerPosition);\n }\n }\n\n String cctRatioValue = PageConsumerEntity.getCCTRatio();\n if (cctRatioValue == null)\n {\n cctratiospinner.setSelection(0);\n }\n else\n {\n if (!cctRatioValue.equals(null))\n {\n int spinnerPosition = cctratioadapter.getPosition(cctRatioValue);\n cctratiospinner.setSelection(spinnerPosition);\n }\n }\n\n ctmake= (EditText) v.findViewById(R.id.make1);\n if(PageConsumerEntity.getCTMake() == null)\n {\n ctmake.setText(\"\");\n }\n else\n {\n ctmake.setText(new String(PageConsumerEntity.getCTMake()));\n }\n\n l1c= (EditText) v.findViewById(R.id.l1c);\n if(PageConsumerEntity.getL1C() == null)\n {\n l1c.setText(\"\");\n }\n else\n {\n l1c.setText(new String(PageConsumerEntity.getL1C()));\n }\n\n l1d= (EditText) v.findViewById(R.id.l1d);\n if(PageConsumerEntity.getL1D() == null)\n {\n l1d.setText(\"\");\n }\n else\n {\n l1d.setText(new String(PageConsumerEntity.getL1D()));\n }\n\n l2c= (EditText) v.findViewById(R.id.l2c);\n if(PageConsumerEntity.getL2C() == null)\n {\n l2c.setText(\"\");\n }\n else\n {\n l2c.setText(new String(PageConsumerEntity.getL2C()));\n }\n\n l2d= (EditText) v.findViewById(R.id.l2d);\n if(PageConsumerEntity.getL2D() == null)\n {\n l2d.setText(\"\");\n }\n else\n {\n l2d.setText(new String(PageConsumerEntity.getL2D()));\n }\n\n l3c= (EditText) v.findViewById(R.id.l3c);\n if(PageConsumerEntity.getL3C() == null)\n {\n l3c.setText(\"\");\n }\n else\n {\n l3c.setText(new String(PageConsumerEntity.getL3C()));\n }\n\n l3d= (EditText) v.findViewById(R.id.l3d);\n if(PageConsumerEntity.getL3D() == null)\n {\n l3d.setText(\"\");\n }\n else\n {\n l3d.setText(new String(PageConsumerEntity.getL3D()));\n }\n\n if(back == 1)\n {\n// String meterTypeValue = PageConsumerEntity.getMeterType();\n if (!meterTypeValue.equals(null)) {\n int spinnerPosition = mtypeadapter.getPosition(meterTypeValue);\n mtrtypespinner.setSelection(spinnerPosition);\n }\n\n // String ctRatioValue = PageConsumerEntity.getCTRatio();\n if (!ctRatioValue.equals(null)) {\n int spinnerPosition = ctratioadapter.getPosition(ctRatioValue);\n ctratiospinner.setSelection(spinnerPosition);\n }\n\n // String ctTypeValue = PageConsumerEntity.getCTType();\n if (!ctTypeValue.equals(null)) {\n int spinnerPosition = cttypeadapter.getPosition(ctTypeValue);\n cttypespinner.setSelection(spinnerPosition);\n }\n\n // String cctRatioValue = PageConsumerEntity.getCCTRatio();\n if (!cctRatioValue.equals(null)) {\n int spinnerPosition = cctratioadapter.getPosition(cctRatioValue);\n cctratiospinner.setSelection(spinnerPosition);\n }\n\n ctmake.setText(new String(PageConsumerEntity.getCTMake()));\n\n l1c.setText(new String(PageConsumerEntity.getL1C()));\n\n l1d.setText(new String(PageConsumerEntity.getL1D()));\n\n l2c.setText(new String(PageConsumerEntity.getL2C()));\n\n l2d.setText(new String(PageConsumerEntity.getL2D()));\n\n l3c.setText(new String(PageConsumerEntity.getL3C()));\n\n l3d.setText(new String(PageConsumerEntity.getL3D()));\n }\n\n return v;\n }", "@Override\n public void onResponse(JSONObject response) {\n try {\n NumberFormat rupiah = NumberFormat.getInstance(Locale.GERMANY);\n textBalancep.setText(rupiah.format(response.getDouble(\"aset\")));\n\n JSONArray jsonArray = response.getJSONArray(\"hasil1\");\n for (int i=0; i <2;i++){\n JSONObject jsonObject;\n jsonObject = jsonArray.getJSONObject(i);\n HashMap<String, String> map = new HashMap<>();\n map.put(\"id1\", jsonObject.getString(\"id1\"));\n map.put(\"status1\", jsonObject.getString(\"status1\"));\n map.put(\"jumlah1\", jsonObject.getString(\"jumlah1\"));\n map.put(\"nama1\", jsonObject.getString(\"nama1\"));\n map.put(\"tanggal1\", jsonObject.getString(\"tanggal1\"));\n map.put(\"tanggal21\", jsonObject.getString(\"tanggal21\"));\n\n arusPiutang.add(map);\n }\n adapterReadP();\n }catch (JSONException e){\n e.printStackTrace();\n }\n }", "private void addNewSpinnerItem4() \n\t{\n\t\tmscust=ecust.getText().toString();\n\t\tCharSequence textHolder = \"\" +mscust; \n\t\tadapterpah.insert(textHolder, 0);\n\t\tspah.setAdapter(adapterpah);\n\t}", "public void addItemsToSpinner(){\n spinner = (Spinner) findViewById(R.id.newEvent_spinner_notification);\n spinner.setOnItemSelectedListener(new SpinnerActivity());\n ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,\n R.array.arrray_notification, android.R.layout.simple_spinner_item);\n adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n spinner.setAdapter(adapter);\n }", "@Override\n\t\t\t\t\t\tpublic void onItemSelected(AdapterView<?> parent,\n\t\t\t\t\t\t\t\tView view, int position, long id) {\n\t\t\t\t\t\t\tif(position!=0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tMyspinner sp = (Myspinner)mandilist.getSelectedItem();\n\t\t\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\t\t\tencryptedgeoid = new Webservicerequest().Encrypt(sp.getValue());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcatch(Exception e){\n\t\t\t\t\t\t\t\t\te.getMessage();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcategory3.addAll(get.getretailersList(encryptedgeoid));\t\n\t\t\t\t\t\t\t\tMyspinner[] redemo3 = new Myspinner[category3.size()];\n\t\t\t\t \t\t\t\tfor(int i=0; i<category3.size(); i++){\n\t\t\t\t \t\t\t\t\tredemo3[i] = new Myspinner(category3.get(i).get(\"2\"), category3.get(i).get(\"1\"), \"\");\n\t\t\t\t \t\t\t\t}\n\t\t\t\t \t\t\t\tArrayAdapter<Myspinner> adapter3 = new ArrayAdapter<Myspinner>(context, android.R.layout.simple_spinner_dropdown_item, redemo3);\n\t\t\t\t \t\t\t\tretailerslist.setAdapter(adapter3);\n\t\t\t\t\t\t\t\tArrayAdapter<String> adaptervillages = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_dropdown_item, get.getVillageNames(encryptedgeoid));\n\t\t\t\t\t\t\t\tvillages.setAdapter(adaptervillages);\n\t\t\t\t\t\t\t\tvillages.setThreshold(3);\n\t\t\t\t\t\t\t\tvillages.setOnItemClickListener(new OnItemClickListener() {\n\n\t\t\t\t\t\t\t\t\t @Override\n\t\t\t\t\t\t\t\t\t public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {\n\t\t\t\t\t\t\t\t\t InputMethodManager in = (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);\n\t\t\t\t\t\t\t\t\t in.hideSoftInputFromWindow(villages.getWindowToken(), 0);\n\n\t\t\t\t\t\t\t\t\t }\n\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t\tvillages.setAdapter(null);\n\t\t\t\t\t\t\t\tArrayList<HashMap<String, String>> category3=new ArrayList<HashMap<String,String>>();\n\t\t\t\t\t\t\t\tHashMap<String, String> map3=new HashMap<String, String>();\n\t\t\t\t \t\t\t\tmap3.put(\"1\",\"\");\n\t\t\t\t \t\t\t\tmap3.put(\"2\",\"Select Retailer\");\n\t\t\t\t \t\t\t\tcategory3.add(map3);\n\t\t\t\t \t\t\t\tMyspinner[] redemo3 = new Myspinner[category3.size()];\n\t\t\t\t \t\t\t\tfor(int i=0; i<category3.size(); i++){\n\t\t\t\t \t\t\t\t\tredemo3[i] = new Myspinner(category3.get(i).get(\"2\"), category3.get(i).get(\"1\"), \"\");\n\t\t\t\t \t\t\t\t}\n\t\t\t\t \t\t\t\tArrayAdapter<Myspinner> adapter3 = new ArrayAdapter<Myspinner>(context, android.R.layout.simple_spinner_dropdown_item, redemo3);\n\t\t\t\t \t\t\t\tretailerslist.setAdapter(adapter3); \t\t\t\t \t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}", "@Override\n public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {\n String taskType = adapterView.getItemAtPosition(i).toString();\n Log.d(TAG, \"SPINNER: \" + taskType);\n\n\n String[] tasks = getResources().getStringArray(R.array.tasktypelist);\n\n if (tasks.length > 0 && taskType.equals(tasks[0])) {\n taskParamsLayout.removeAllViews();\n\n piPointsNo = new EditText(MainActivity.this);\n piPointsNo.setInputType(InputType.TYPE_CLASS_NUMBER);\n piPointsNo.setHint(R.string.taskpi_help_points);\n\n taskParamsLayout.addView(piPointsNo);\n\n }\n\n else if (tasks.length > 1 && taskType.equals(tasks[1])) {\n taskParamsLayout.removeAllViews();\n\n Message msg=new Message();\n msg.obj=\"Wait! This task is a false one! :( \";\n toastHandler.sendMessage(msg);\n }\n\n else if (tasks.length > 2 && taskType.equals(tasks[2])) {\n taskParamsLayout.removeAllViews();\n\n Message msg=new Message();\n msg.obj=\"Wait! This task is a false one! :( \";\n toastHandler.sendMessage(msg);\n }\n\n }", "public void spinner() {\n /**\n * calls if the tasks was weekly, if not, it will be automatically set to \"once\"\n */\n if(weekly) {\n String[] items = new String[]{activity.getResources().getString(R.string.sunday), activity.getResources().getString(R.string.monday), activity.getResources().getString(R.string.tuesday), activity.getResources().getString(R.string.wednesday), activity.getResources().getString(R.string.thursday), activity.getResources().getString(R.string.friday), activity.getResources().getString(R.string.saturday)};\n ArrayAdapter<String> frequencyAdapter = new ArrayAdapter<String>(activity.getBaseContext(), android.R.layout.simple_spinner_dropdown_item, items);\n weekday.setAdapter(frequencyAdapter);\n weekday.getBackground().setColorFilter(activity.getResources().getColor(R.color.colorAccent), PorterDuff.Mode.SRC_ATOP);\n weekday.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n\n day = String.valueOf(position + 1); //chosen day is stored\n\n }\n\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n } else {\n day = \"8\";\n weekday.setVisibility(View.GONE);\n }\n }", "@Override\n public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {\n brand_id = String.valueOf(brand_list.get(i).getBrandId());\n brandName = brand_list.get(i).getBrand_name();\n\n Log.d(\"fsdklj\", brand_id + brandName);\n\n hitSpinnerSeries(brand_id);\n\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n view=inflater.inflate(R.layout.fragment_choose_template_operation, container, false);\n getNumberOfChannel=(LinearLayout)view.findViewById(R.id.layoutOfGetChannelNumber);\n getNumberOfChannel.setVisibility(View.INVISIBLE);\n NoDefaultSpinner spinner = (NoDefaultSpinner) view.findViewById(R.id.spinnerOfActivity);\n ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity(),\n R.array.Activity_array, android.R.layout.simple_spinner_item);\n adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n spinner.setAdapter(adapter,\"فرآیند را انتخاب کنید\");\n spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n\n public void onItemSelected(AdapterView<?> parent, View view1,\n int position, long id) {\n\n switch(position){\n case 0:\n TextView textOfGetChannelNumber= (TextView) view.findViewById(R.id.textViewOfGetChannelNumber);\n state=1;\n textOfGetChannelNumber.setText(\"شماره کانال مورد نظر برای روشن کردن را انتخاب کرده و دکمه مرحله بعد را بفشارید:\");\n getNumberOfChannel.setVisibility(View.VISIBLE);\n break;\n case 1:\n TextView textOfGetChannelNumber1= (TextView) view.findViewById(R.id.textViewOfGetChannelNumber);\n state=2;\n textOfGetChannelNumber1.setText(\"شماره کانال مورد نظر برای خاموش کردن را انتخاب کرده و دکمه مرحله بعد را بفشارید:\");\n getNumberOfChannel.setVisibility(View.VISIBLE);\n break;\n case 2:\n TextView textOfGetChannelNumber2= (TextView) view.findViewById(R.id.textViewOfGetChannelNumber);\n state=3;\n textOfGetChannelNumber2.setText(\"شماره کانال مورد نظر برای دریافت گزارش را انتخاب کرده و دکمه مرحله بعد را بفشارید:\");\n getNumberOfChannel.setVisibility(View.VISIBLE);\n break;\n case 3:\n state=4;\n getNumberOfChannel.setVisibility(View.INVISIBLE);\n// TextView textOfGetChannelNumber3= (TextView) findViewById(R.id.textViewOfGetChannelNumber);\n// NoDefaultSpinner spinner3 = (NoDefaultSpinner) findViewById(R.id.spinnerOfGetChannelNumber);\n// getNumberOfChannel.setVisibility(View.VISIBLE);\n// textOfGetChannelNumber3.setVisibility(View.INVISIBLE);\n// spinner3.setVisibility(View.INVISIBLE);\n// //Button button1=(Button)findViewById(R.id.buttonofCallDevice);\n // button1.setVisibility(View.VISIBLE);\n //setIntentToNextPage(\"configDevice\");\n break;\n default:\n\n }\n\n // Log.v(\"item........... :\", (String) parent.getItemAtPosition(position)+\" switch : \"+ simpleSwitch.isChecked());\n }\n\n\n public void onNothingSelected(AdapterView<?> parent) {\n Log.v(\"item........... :\", \"nothing Selected\");\n // TODO Auto-generated method stub\n }\n });\n NoDefaultSpinner spinner2 = (NoDefaultSpinner) view.findViewById(R.id.spinnerOfGetChannelNumber);\n ArrayAdapter<CharSequence> adapter2 = ArrayAdapter.createFromResource(getActivity(),\n R.array.channelNumber_array, android.R.layout.simple_spinner_item);\n adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n spinner2.setAdapter(adapter2,\"کانال را انتخاب کنید:\");\n spinner2.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n\n public void onItemSelected(AdapterView<?> parent, View view,\n int position, long id) {\n numberOfChannel=String.valueOf(position+1);\n }\n\n\n public void onNothingSelected(AdapterView<?> parent) {\n numberOfChannel=String.valueOf(-1);\n }\n });\n return view;\n }", "@Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n et_country = CountryNameSpinner.getSelectedItem().toString();\n et_mcode.setText(\"+\"+CountriesCode.get(position));\n }", "private void getDeviceSpinner() {\n\n StringRequest stringRequest = new StringRequest(\"https://cardtest10.000webhostapp.com/Sync_Spinner_D.php\", new Response.Listener<String>() {\n @Override\n public void onResponse(String response) {\n\n try{\n\n JSONObject jsonResponse = new JSONObject(response);\n JSONArray jsonArraytask = jsonResponse.getJSONArray(\"device\");\n\n for(int i=0; i < jsonArraytask.length(); i++)\n {\n JSONObject jsonObjecttask = jsonArraytask.getJSONObject(i);\n String task = jsonObjecttask.optString(\"Device_Type\");\n arrayDeviceType.add(task);\n }\n\n }catch (JSONException e){\n e.printStackTrace();\n }\n\n // Applying the adapter to our spinner\n spDeviceModel.setAdapter(new ArrayAdapter <>(UserAreaActivity.this, android.R.layout.simple_spinner_dropdown_item, arrayDeviceType));\n }\n },\n new Response.ErrorListener() {\n @Override\n public void onErrorResponse(VolleyError error) {\n Toast.makeText(UserAreaActivity.this, error + \"\", Toast.LENGTH_SHORT).show();\n }\n });\n\n RequestQueue requestQueue = Volley.newRequestQueue(this);\n requestQueue.add(stringRequest);\n\n }", "public SpinnerAdapter(Context mContext) {\n this.mContext = mContext;\n Resources res = mContext.getResources();\n this.values = res.getStringArray(R.array.checklist_values);\n\n }", "@Override\n public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {\n mPlayer.changeClass(i);\n updateInfo();\n Toast.makeText(getApplicationContext(), mPlayer.getStatistic(), Toast.LENGTH_SHORT).show();\n }", "@Override\n protected void onPostExecute(String result) {\n super.onPostExecute(result);\n\n spinner.setVisibility(View.VISIBLE);\n // dialog.dismiss();\n // Do things like hide the progress bar or change a TextView\n }", "@Override\n\t\t\tpublic void onItemSelected(AdapterView<?> parent, View view,\n\t\t\t\t\t\t\t\t\t int position, long id) {\n\t\t\t\tsign_tips = getResources().getStringArray(R.array.sign_excetion_reason)[position];\n\t\t\t}", "protected void onPostExecute(String result) {\n TXTNUMERO.setText(estado2);\n TXTNUMERO.setEnabled(false);\n //guardar datos en combo\n combo.setAdapter(new ArrayAdapter<ProyectoBean>(getActivity(), android.R.layout.simple_spinner_item, listado));\n\n progressDialog.dismiss();\n\n }", "@Override\n\t\t\t\t\t\tpublic void onItemSelected(AdapterView<?> parent,\n\t\t\t\t\t\t\t\tView view, int position, long id) {\n\t\t\t\t\t\t\tif(position!=0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tMyspinner sp = (Myspinner)districtlist.getSelectedItem();\n\t\t\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\t\t\tencryptedgeoid = new Webservicerequest().Encrypt(sp.getValue());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcatch(Exception e){\n\t\t\t\t\t\t\t\t\te.getMessage();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcategory2.addAll(get.getMandi(encryptedgeoid));\t\n\t\t\t\t\t\t\t\tMyspinner[] redemo2 = new Myspinner[category2.size()];\n\t\t\t\t \t\t\t\tfor(int i=0; i<category2.size(); i++){\n\t\t\t\t \t\t\t\t\tredemo2[i] = new Myspinner(category2.get(i).get(\"2\"), category2.get(i).get(\"1\"), \"\");\n\t\t\t\t \t\t\t\t}\n\t\t\t\t \t\t\t\tArrayAdapter<Myspinner> adapter2 = new ArrayAdapter<Myspinner>(context, android.R.layout.simple_spinner_dropdown_item, redemo2);\n\t\t\t\t \t\t\t\tmandilist.setAdapter(adapter2);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t\tArrayList<HashMap<String,String>> category2=new ArrayList<HashMap<String,String>>();\n\t\t\t\t\t\t\t\tHashMap<String, String> map2=new HashMap<String, String>();\n\t\t\t\t \t\t\t\tmap2.put(\"1\",\"\");\n\t\t\t\t \t\t\t\tmap2.put(\"2\",\"Select Mandi\");\n\t\t\t\t \t\t\t\tcategory2.add(map2);\n\t\t\t\t\t\t\t\tMyspinner[] redemo2 = new Myspinner[category2.size()];\n\t\t\t\t \t\t\t\tfor(int i=0; i<category2.size(); i++){\n\t\t\t\t \t\t\t\t\tredemo2[i] = new Myspinner(category2.get(i).get(\"2\"), category2.get(i).get(\"1\"), \"\");\n\t\t\t\t \t\t\t\t}\n\t\t\t\t \t\t\t\tArrayAdapter<Myspinner> adapter2 = new ArrayAdapter<Myspinner>(context, android.R.layout.simple_spinner_dropdown_item, redemo2);\n\t\t\t\t \t\t\t\tmandilist.setAdapter(adapter2);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}", "private void setupSpinner() {\n // Create adapter for spinner. The list options are from the String array it will use\n // the spinner will use the default layout\n ArrayAdapter fruitSpinnerAdapter = ArrayAdapter.createFromResource(this,\n R.array.array_fruit_options, android.R.layout.simple_spinner_item);\n\n // Specify dropdown layout style - simple list view with 1 item per line\n fruitSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);\n\n // Apply the adapter to the spinner\n mTypeSpinner.setAdapter(fruitSpinnerAdapter);\n\n // Set the integer mSelected to the constant values\n mTypeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n String selection = (String) parent.getItemAtPosition(position);\n if (!TextUtils.isEmpty(selection)) {\n if (selection.equals(getString(R.string.apple))) {\n mFruit = FruitEntry.TYPE_APPLE;\n } else if (selection.equals(getString(R.string.banana))) {\n mFruit = FruitEntry.TYPE_BANANA;\n } else if (selection.equals(getString(R.string.peach))) {\n mFruit = FruitEntry.TYPE_PEACH;\n } else if (selection.equals(getString(R.string.pineapple))) {\n mFruit = FruitEntry.TYPE_PINEAPPLE;\n } else if (selection.equals(getString(R.string.strawberry))) {\n mFruit = FruitEntry.TYPE_STRAWBERRY;\n } else if (selection.equals(getString(R.string.watermelon))) {\n mFruit = FruitEntry.TYPE_WATERMELON;\n } else {\n mFruit = FruitEntry.TYPE_NOTSELECTED;\n }\n }\n }\n\n // Because AdapterView is an abstract class, onNothingSelected must be defined\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n mFruit = FruitEntry.TYPE_NOTSELECTED;\n }\n });\n }", "@Override\n public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {\n if (position == 0) {\n p1Time.setText(getResources().getString(R.string.p1Time));\n p2Time.setText(getResources().getString(R.string.p2Time));\n p3Time.setText(getResources().getString(R.string.p3Time));\n p4Time.setText(getResources().getString(R.string.p4Time));\n p5Time.setText(getResources().getString(R.string.p5Time));\n p6Time.setText(getResources().getString(R.string.p6Time));\n p7Time.setText(getResources().getString(R.string.p7Time));\n p8Time.setText(getResources().getString(R.string.p8Time));\n p9Time.setText(getResources().getString(R.string.p9Time));\n } else {\n p1Time.setText(getResources().getString(R.string.p1Time2));\n p2Time.setText(getResources().getString(R.string.p2Time2));\n p3Time.setText(getResources().getString(R.string.p3Time2));\n p4Time.setText(getResources().getString(R.string.p4Time2));\n p5Time.setText(getResources().getString(R.string.p5Time2));\n p6Time.setText(getResources().getString(R.string.p6Time2));\n p7Time.setText(getResources().getString(R.string.p7Time2));\n p8Time.setText(getResources().getString(R.string.p8Time2));\n p9Time.setText(getResources().getString(R.string.p9Time2));\n }\n }", "@Override\n public void onClick(DialogInterface dialogInterface, int i) {\n nearest_tourist_spot = input_add_new_nearest_tourist_spot.getText().toString();\n\n db_table_result_rows_list.remove(0);\n db_table_result_rows_list.add(nearest_tourist_spot);\n\n ArrayAdapter<String> spinnerArrayAdapterNearestTouristsSpot = new ArrayAdapter<String>(AddNewLocation.this.getApplicationContext(), android.R.layout.simple_spinner_item, db_table_result_rows_list);\n spinnerArrayAdapterNearestTouristsSpot.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // The drop down view\n spinnerNearestTouristsSpot.setAdapter(spinnerArrayAdapterNearestTouristsSpot);\n\n spinnerNearestTouristsSpot.setSelection(((ArrayAdapter<String>)spinnerNearestTouristsSpot.getAdapter()).getPosition(nearest_tourist_spot));\n }", "public View setupSpinners(View v){\n // Assign Spinners\n spinnerCollect = (Spinner) v.findViewById(R.id.eSpinner_CollectWhat);\n\n // Create an ArrayAdapter using the string array and a default spinner layout\n ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this.getActivity(),\n R.array.eCollectWhat_array, android.R.layout.simple_spinner_item);\n // Specify the layout to use when the list of choices appears\n adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n spinnerCollect.setAdapter(adapter); // Apply the adapter to the spinner\n\n spinnerCollect.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {\n ((ScoutFormActivity) getActivity()).getScoutForm().setEHPCOLLECT_COLUMN(spinnerCollect.getSelectedItem().toString());\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> arg0) {\n }\n });\n\n return v;\n }", "@Override\n public void onClick(final View v) {\n AlertDialog.Builder dl = new AlertDialog.Builder(v.getContext());\n dl.setTitle(\"카테고리 선택\");\n dl.setSingleChoiceItems(items, 0, new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n // TODO Auto-generated method stub\n //Toast.makeText(v.getContext(), items[which], Toast.LENGTH_SHORT).show();\n ActivityStCategory = items[which];\n }\n });\n dl.setPositiveButton(\"선택완료\",\n new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int id)\n {\n // 프로그램을 종료한다\n ActivitySelectBool = true;\n ActivityBtCategoty.setText(ActivityStCategory);\n dialog.dismiss(); // 누르면 바로 닫히는 형태\n }\n });\n\n dl.setNegativeButton(\"취소\",\n new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int id)\n {\n // 프로그램을 종료한다\n dialog.dismiss(); // 누르면 바로 닫히는 형태\n }\n });\n\n\n dl.show();\n }", "@Override\n public void onClick(View v){\n EditText ec_local = (EditText)findViewById(R.id.pm_data_txt);\n EditText dd = (EditText)findViewById(R.id.dd);\n EditText mm = (EditText)findViewById(R.id.mm);\n EditText yyyy = (EditText)findViewById(R.id.yyyy);\n EditText qtde = (EditText)findViewById(R.id.qtde);\n Spinner dma = (Spinner)findViewById(R.id.dma);\n Spinner ec_eqp_id = (Spinner)findViewById(R.id.pm_eqp_tx);\n\n //Método de como transformar um String em Int: Integer.parseInt(myEditText.getText().toString())\n String id = ec_eqp_id.getSelectedItem().toString();\n String local = ec_local.getText().toString();\n String dia = dd.getText().toString();\n String mes = mm.getText().toString();\n String ano = yyyy.getText().toString();\n String qtd = qtde.getText().toString();\n String adm = dma.getSelectedItem().toString();\n\n \n if(TextUtils.isEmpty(local) || TextUtils.isEmpty(dia) || TextUtils.isEmpty(mes) || TextUtils.isEmpty(ano) || TextUtils.isEmpty(qtd)){\n Toast.makeText(getApplicationContext(),\"Insira as Informações Corretamente\",Toast.LENGTH_LONG).show();\n }else if (Integer.parseInt(mes)>12){\n Toast.makeText(getApplicationContext(), \"Mês Inválido\", Toast.LENGTH_LONG).show();\n }else if(Integer.parseInt(mes)==2 && Integer.parseInt(dia)>28){\n Toast.makeText(getApplicationContext(),\"Dia Inválido\",Toast.LENGTH_LONG).show();\n }else if((Integer.parseInt(mes)==1 || Integer.parseInt(mes)==3 || Integer.parseInt(mes)==5 || Integer.parseInt(mes)==7 || Integer.parseInt(mes)==8 || Integer.parseInt(mes)==10 || Integer.parseInt(mes)==12) && Integer.parseInt(dia)>31){\n Toast.makeText(getApplicationContext(),\"Dia Inválido\",Toast.LENGTH_LONG).show();\n }else if((Integer.parseInt(mes)==4 || Integer.parseInt(mes)==6 || Integer.parseInt(mes)==9 || Integer.parseInt(mes)==11) && Integer.parseInt(dia)>30){\n Toast.makeText(getApplicationContext(),\"Dia Inválido\",Toast.LENGTH_LONG).show();\n }else {\n BDController crud = new BDController(getBaseContext());\n int qt = Integer.parseInt(qtde.getText().toString());\n String resultado;\n //Realizando a inserção dos dados no banco de dados.\n String pei = \"\";\n if (adm.equals(\"Dia(s)\")) {\n pei = \"day\";\n } else if (adm.equals(\"Mes(es)\")) {\n pei = \"month\";\n } else if (adm.equals(\"Ano(s)\")) {\n pei = \"year\";\n }\n resultado = crud.insereDado(id, local, ano + \"-\" + mes + \"-\" + dia, qt, adm);\n\n Toast.makeText(getApplicationContext(), resultado, Toast.LENGTH_LONG).show();\n if (!resultado.equals(\"-1\")) {\n crud.updateEcDpm(qt,pei);\n Toast.makeText(getApplicationContext(), resultado, Toast.LENGTH_LONG).show();\n Intent it = new Intent(getApplicationContext(), Equips.class);\n startActivity(it);\n finish();\n }else{\n Toast.makeText(getApplicationContext(),\"Erro de BD\", Toast.LENGTH_LONG).show();\n }\n }\n\n }", "protected void mensajesAlerta() {\n\n// if(((Values)tipoViviendaSpinner.getSelectedItem()).getKey().equals(\"1\") &&\n// ((Values)materialTechoSpinner.getSelectedItem()).getKey().equals(\"6\")){\n// getAlert(getString(R.string.validacion_aviso),getString(R.string.mv_idTipoViviendaCasaMaterialTecho));\n// }\n//\n// if(((Values)tipoViviendaSpinner.getSelectedItem()).getKey().equals(\"2\") &&\n// ((Values)materialTechoSpinner.getSelectedItem()).getKey().equals(\"6\")){\n// getAlert(getString(R.string.validacion_aviso),getString(R.string.mv_idTipoViviendaDepartamentoMaterialTecho));\n// }\n\n if(((Values)tipoViviendaSpinner.getSelectedItem()).getKey().equals(\"2\") &&\n ((Values)ubicacionAguaSpinner.getSelectedItem()).getKey().equals(\"2\")){\n getAlert(getString(R.string.validacion_aviso),getString(R.string.mv_idTipoViviendaUbicacionAgua));\n }\n\n if(((Values)tipoViviendaSpinner.getSelectedItem()).getKey().equals(\"2\") &&\n ((Values)ubicacionSanitarioSpinner.getSelectedItem()).getKey().equals(\"2\")){\n getAlert(getString(R.string.validacion_aviso),getString(R.string.mv_idTipoViviendaUbicacionSanitario));\n }\n\n if( ((Values)tipoViviendaSpinner.getSelectedItem()).getKey().equals(\"3\") &&\n Integer.parseInt(((Values)tipoHogarSpinner.getSelectedItem()).getKey()) < 3 &&\n ((Values)documentoHogarSpinner.getSelectedItem()).getKey().equals(\"1\") ){\n getAlert(getString(R.string.validacion_aviso),getString(R.string.mv_idTipoViviendaTipoHogarDocumento));\n }\n\n if(((Values)materialTechoSpinner.getSelectedItem()).getKey().equals(\"6\")){\n getAlert(getString(R.string.validacion_aviso),getString(R.string.mv_materialTechoOpcionOtro));\n }\n\n if(((Values)servicioSanitarioSpinner.getSelectedItem()).getKey().equals(\"3\") &&\n ((Values)ubicacionSanitarioSpinner.getSelectedItem()).getKey().equals(\"1\")){\n getAlert(getString(R.string.validacion_aviso),getString(R.string.mv_idServicioSanitarioUbicacionSanitarioPozo));\n }\n\n if(((Values)servicioSanitarioSpinner.getSelectedItem()).getKey().equals(\"4\") &&\n ((Values)ubicacionSanitarioSpinner.getSelectedItem()).getKey().equals(\"1\")){\n getAlert(getString(R.string.validacion_aviso),getString(R.string.mv_idServicioSanitarioUbicacionSanitarioDescarga));\n }\n\n if(((Values)viaAccesoPrincipalSpinner.getSelectedItem()).getKey().equals(\"6\") &&\n ((Values)eliminaBasuraSpinner.getSelectedItem()).getKey().equals(\"1\")){\n getAlert(getString(R.string.validacion_aviso),getString(R.string.mv_idViaAccesoPrincipalEliminanBasura));\n }\n }", "public void onItemSelected(AdapterView<?> parent, View view,\n int pos, long id) {\n\n if(parent.getId()==R.id.Branch_Spinner)\n mNotification.setBranch((String)parent.getItemAtPosition(pos));\n\n if(parent.getId()==R.id.Year_Spinner)\n mNotification.setYear((String)parent.getItemAtPosition(pos));\n\n if(parent.getId()==R.id.Section_Spinner)\n mNotification.setSection((String)parent.getItemAtPosition(pos));\n\n\n\n\n\n\n }", "@Override\n public void onItemSelected(AdapterView<?> adapter, View v,\n int position, long id) {\n mappos = position;\n findmapinfo(position , adapter.getItemAtPosition(position).toString());\n \n // Showing selected spinner item\n \n }", "@Override\n public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {\n\n try {\n JSONObject dataClicked = units_array.getJSONObject(i);\n id_unit = dataClicked.getInt(\"id\");\n\n\n } catch (Exception e) {\n e.printStackTrace();\n\n }\n }", "private ArrayAdapter<String> adapterForSpinner(List<String> list)\n {\n ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list)\n {\n @Override\n public boolean isEnabled(int position) {\n return position != 0;\n }\n\n @Override\n public View getDropDownView(int position, View convertView, ViewGroup parent) {\n View view = super.getDropDownView(position, convertView, parent);\n TextView tv = (TextView) view;\n if(position == 0){\n // Set the hint text color gray\n tv.setTextColor(Color.GRAY);\n }\n else {\n tv.setTextColor(Color.BLACK);\n }\n return view;\n }\n };\n\n // Drop down layout style - list view with radio button\n dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n\n return dataAdapter;\n }", "@Override\n public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {\n String roomType = spinner.getSelectedItem().toString();\n mListener.onFragmentInteraction(roomType);\n String returnedFromMain = ((MainActivity)getActivity()).getShareInFragments();\n TextView descript = (TextView)view.findViewById(R.id.description);\n ((MainActivity)getActivity()).setRoomType(returnedFromMain);\n String displayR = ((MainActivity)getActivity()).hR.toString();\n descript.setText((displayR));\n }", "private void assignSpinner(int i, String s) {\n switch (s) {\n case \"Bitters\":\n ArrayAdapter<String> bittersAdapter;\n bittersAdapter = new ArrayAdapter<>(this, R.layout.support_simple_spinner_dropdown_item, bitters);\n bittersAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);\n spinnerArrayList.get(i-1).setAdapter(bittersAdapter);\n spinnerArrayList.get(i-1).setVisibility(View.VISIBLE);\n break;\n case \"Gin\":\n ArrayAdapter<String> ginAdapter;\n ginAdapter = new ArrayAdapter<>(this, R.layout.support_simple_spinner_dropdown_item, gin);\n ginAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);\n spinnerArrayList.get(i-1).setAdapter(ginAdapter);\n spinnerArrayList.get(i-1).setVisibility(View.VISIBLE);\n break;\n case \"Rum\":\n ArrayAdapter<String> rumAdapter;\n rumAdapter = new ArrayAdapter<>(this, R.layout.support_simple_spinner_dropdown_item, rum);\n rumAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);\n spinnerArrayList.get(i-1).setAdapter(rumAdapter);\n spinnerArrayList.get(i-1).setVisibility(View.VISIBLE);\n break;\n case \"Tequila\":\n ArrayAdapter<String> tequilaAdapter;\n tequilaAdapter = new ArrayAdapter<>(this, R.layout.support_simple_spinner_dropdown_item, tequila);\n tequilaAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);\n spinnerArrayList.get(i-1).setAdapter(tequilaAdapter);\n spinnerArrayList.get(i-1).setVisibility(View.VISIBLE);\n break;\n case \"Vodka\":\n ArrayAdapter<String> vodkaAdapter;\n vodkaAdapter = new ArrayAdapter<>(this, R.layout.support_simple_spinner_dropdown_item, vodka);\n vodkaAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);\n spinnerArrayList.get(i-1).setAdapter(vodkaAdapter);\n spinnerArrayList.get(i-1).setVisibility(View.VISIBLE);\n break;\n case \"Vermouth\":\n ArrayAdapter<String> vermouthAdapter;\n vermouthAdapter = new ArrayAdapter<>(this, R.layout.support_simple_spinner_dropdown_item, vodka);\n vermouthAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);\n spinnerArrayList.get(i-1).setAdapter(vermouthAdapter);\n spinnerArrayList.get(i-1).setVisibility(View.VISIBLE);\n break;\n case \"Whiskey\":\n ArrayAdapter<String> whiskeyAdapter;\n whiskeyAdapter = new ArrayAdapter<>(this, R.layout.support_simple_spinner_dropdown_item, whiskey);\n whiskeyAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);\n spinnerArrayList.get(i-1).setAdapter(whiskeyAdapter);\n spinnerArrayList.get(i-1).setVisibility(View.VISIBLE);\n break;\n }\n }", "@Override\n public void onClick(DialogInterface dialog, int position) {\n tv.setText(String.valueOf(items[position]));\n\n String tag = tv.getTag().toString();\n\n switch (tag) {\n\n case \"district\":\n districtStr = String.valueOf(items[position]);\n break;\n\n case \"village\":\n villageStr = String.valueOf(items[position]);\n break;\n\n case \"ward\":\n wardStr = String.valueOf(items[position]);\n break;\n\n case \"category\":\n categoryStr = String.valueOf(items[position]);\n break;\n\n }\n\n }", "@Override\n\tpublic void onItemSelected(AdapterView<?> parent, View view, int position,\n\t\t\tlong id) {\n\t\tString text = spnner_city.getSelectedItem().toString();\n\t\tToast.makeText(getApplicationContext(), text, Toast.LENGTH_LONG)\n\t\t.show();\n\n\t}", "private void getTaskSpinner() {\n\n StringRequest stringRequest = new StringRequest(\"https://cardtest10.000webhostapp.com/Sync_Spinner_T.php\", new Response.Listener<String>() {\n @Override\n public void onResponse(String response) {\n\n try{\n\n JSONObject jsonResponse = new JSONObject(response);\n JSONArray jsonArraytask = jsonResponse.getJSONArray(\"task\");\n\n for(int i=0; i < jsonArraytask.length(); i++)\n {\n JSONObject jsonObjecttask = jsonArraytask.getJSONObject(i);\n String task = jsonObjecttask.optString(\"Type\");\n arrayTask.add(task);\n }\n\n }catch (JSONException e){\n e.printStackTrace();\n }\n\n // Applying the adapter to our spinner\n spTaskType.setAdapter(new ArrayAdapter <>(UserAreaActivity.this, android.R.layout.simple_spinner_dropdown_item, arrayTask));\n }\n },\n new Response.ErrorListener() {\n @Override\n public void onErrorResponse(VolleyError error) {\n Toast.makeText(UserAreaActivity.this, error + \"\", Toast.LENGTH_SHORT).show();\n }\n });\n\n RequestQueue requestQueue = Volley.newRequestQueue(this);\n requestQueue.add(stringRequest);\n\n }", "@Override\n public void onClick(View v) {\n\n String s = v.getTag().toString();\n int duration = Toast.LENGTH_SHORT;\n Toast toast = Toast.makeText(context, s, duration);\n toast.show();\n }", "private void setUpLgaSpinner(List<String> lgas) {\n\n ArrayAdapter lgaAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, lgas);\n lgaAdapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);\n lgaAdapter.notifyDataSetChanged();\n mLgaSpinner.setAdapter(lgaAdapter);\n\n mLgaSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long l) {\n mLga = (String) parent.getItemAtPosition(position);\n// Toast.makeText(ProductsActivity.this, \"state: \" + mState + \" lga: \" + mLga, Toast.LENGTH_LONG).show();\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> adapterView) {\n }\n });\n }", "@Override\n public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long id) {\n switch (position)\n {\n case 1:\n break;\n case 2:\n Toast.makeText(this,appointmentTypes[position],Toast.LENGTH_LONG).show();\n /*Intent intent = new Intent(getApplicationContext(), AppointmentRequests.class);\n Bundle b = new Bundle();\n b.putString(\"userid\",userid);\n intent.putExtras(b);\n startActivity(intent);*/\n break;\n case 3:\n break;\n }\n }", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n if (convertView == null) {\n convertView = LayoutInflater.from(parent.getContext()).\n inflate(android.R.layout.simple_spinner_dropdown_item, parent, false);\n }\n\n TextView textView= (TextView) convertView;\n textView.setText(position==0?R.string.weight_unit_kilo:R.string.weight_unit_lbs);\n return convertView;\n }", "@Override\n public void onResponse(JSONObject response) {\n try {\n NumberFormat rupiah = NumberFormat.getInstance(Locale.GERMANY);\n textBalance.setText(rupiah.format(response.getDouble(\"masuk\")-response.getDouble(\"keluar\")));\n\n JSONArray jsonArray = response.getJSONArray(\"hasil\");\n for (int i=0; i <2;i++) {\n JSONObject jsonObject;\n jsonObject = jsonArray.getJSONObject(i);\n HashMap<String, String> map = new HashMap<>();\n map.put(\"id\", jsonObject.getString(\"id\"));\n map.put(\"status\", jsonObject.getString(\"status\"));\n map.put(\"jumlah\", jsonObject.getString(\"jumlah\"));\n map.put(\"keterangan\", jsonObject.getString(\"keterangan\"));\n map.put(\"tanggal\", jsonObject.getString(\"tanggal\"));\n map.put(\"tanggal2\", jsonObject.getString(\"tanggal2\"));\n\n arusuang.add(map);\n }\n adapterRead();\n }catch (JSONException e){\n e.printStackTrace();\n }\n }", "@Override\n public void onResponse(String s) {\n loading.dismiss();\n //Showing toast message of the response\n Toast.makeText(MainActivity.this, s , Toast.LENGTH_LONG).show();\n }" ]
[ "0.6732284", "0.66941786", "0.66680497", "0.65211445", "0.6517903", "0.64896053", "0.64880055", "0.64608663", "0.64073616", "0.640167", "0.6340691", "0.633418", "0.6302236", "0.62692714", "0.6252594", "0.6239709", "0.6220362", "0.6205768", "0.6204942", "0.6200814", "0.6197641", "0.6192454", "0.6187986", "0.61593246", "0.6143903", "0.61423016", "0.61413246", "0.61412543", "0.61394095", "0.6129666", "0.60995567", "0.60864747", "0.6084336", "0.6084278", "0.6083141", "0.60734457", "0.6065237", "0.6064253", "0.60544395", "0.6048819", "0.60472846", "0.60402036", "0.6030798", "0.6029815", "0.6029166", "0.6026581", "0.5998125", "0.5990239", "0.5981338", "0.5975845", "0.5959137", "0.5938369", "0.5936894", "0.59352225", "0.59325254", "0.5924761", "0.5920474", "0.591517", "0.5905971", "0.58991444", "0.58861375", "0.58651036", "0.586457", "0.5864119", "0.585699", "0.58559746", "0.58493274", "0.58450454", "0.5840485", "0.58404464", "0.58288944", "0.58213073", "0.581967", "0.5818986", "0.5810357", "0.58043283", "0.5801916", "0.5800957", "0.5796311", "0.57903683", "0.5789841", "0.57890993", "0.5784707", "0.5774437", "0.57731885", "0.5767842", "0.5766464", "0.57662755", "0.5764003", "0.5757701", "0.5757362", "0.575663", "0.5745786", "0.5744805", "0.5742226", "0.57367414", "0.5730488", "0.57276803", "0.57259035", "0.57233566", "0.5722858" ]
0.0
-1
memunculkan toast + value Spinner yang dipilih (diambil dari adapter)
@Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { cityId = aKodeKota[i]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void addListenerOnButton() {\n\n isempleado = (Spinner) findViewById(R.id.spinnerWifi);\n spinner2 = (Spinner) findViewById(R.id.spinner2);\n\n\n Toast.makeText(getApplicationContext(), \"Spinner 1 \"+String.valueOf(isempleado.getSelectedItem()) +\n \"Spinner 2 : \"+ String.valueOf(spinner2.getSelectedItem()), Toast.LENGTH_LONG).show();\n\n\n }", "String getSpinnerText();", "@Override\n public void onItemSelected(AdapterView<?> parent, View view,\n int position, long id) {\n\n\n try{\n String s = \"\";\n Log.e(\"mytag\",\"(String) parent.getItemAtPosition(position):\"+(String) parent.getItemAtPosition(position).toString().trim());\n if (parent.getItemAtPosition(position).toString().trim().equals(\"בחר\")){\n s = \"-1\";\n }else{\n s = String.valueOf(ctype_map.get(parent.getItemAtPosition(position).toString().trim()).getCtypeID());\n }\n setCcustomerSpinner(s);\n }catch(Exception e){\n helper.LogPrintExStackTrace(e);\n }\n Log.e(\"mytag\", (String) parent.getItemAtPosition(position));\n //statusID = db.getCallStatusByCallStatusName((String) parent.getItemAtPosition(position)).getCallStatusID();\n //statusName = db.getCallStatusByCallStatusName((String) parent.getItemAtPosition(position)).getCallStatusName();\n //Toast.makeText(getApplication(), \"status: \" + s, Toast.LENGTH_LONG).show();\n //Log.v(\"item\", (String) parent.getItemAtPosition(position));\n }", "@Override\r\n\t\t\t\t\t\tpublic void onPostExecute(String result) {\n\t\t\t\t\t\t\tLog.d(\"TAG\", \"getdataspinner:\" + result);\r\n\t\t\t\t\t\t\tsetDataSpinner(result, jurusan);\r\n\t\t\t\t\t\t}", "@Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n SpinnerValue = (String)spinner.getSelectedItem();\n }", "@Override\n public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {\n\n // To retrieve the user's selected item in the Spinner, use getItemAtPosition().\n String spinnerLabel = adapterView.getItemAtPosition(i).toString();\n displayToast(spinnerLabel);\n }", "public void onNothingSelected(AdapterView<?> parent) {\n // Toast.makeText(getApplicationContext(), \"nada en el spinner\", Toast.LENGTH_LONG).show();\n }", "@Override\n protected void onPostExecute(final String[] medica) {\n ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(getApplicationContext(),R.layout.spinner_item, medica);\n spinnerArrayAdapter.setDropDownViewResource(R.layout.spinner_item); // The drop down view\n spinner.setAdapter(spinnerArrayAdapter);\n\n spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {\n medicamento = spinner.getSelectedItem().toString();\n Toast.makeText(getApplicationContext(), medicamento,\n Toast.LENGTH_LONG).show();\n }\n\n public void onNothingSelected(AdapterView<?> parent) {\n }\n });\n\n }", "@Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n baseService.getPukul(waktus.get(position).getId())\n .enqueue(new Callback<PukulResponse>() {\n @Override\n public void onResponse(Call<PukulResponse> call, Response<PukulResponse> response) {\n if (response.isSuccessful()){\n pukuls.clear();\n spnPukul.clear();\n pukuls = response.body().getPukuls();\n final ArrayAdapter<String> adapter2 = new ArrayAdapter<>(getApplicationContext(), android.R.layout.simple_list_item_1, spnPukul);\n if (!pukuls.isEmpty()){\n spinnerTime.setAdapter(adapter2);\n for (int j = 0; j<pukuls.size(); j++){\n String pkl = pukuls.get(j).getStart() + \" - \" +pukuls.get(j).getEnd();\n spnPukul.add(pkl);\n adapter2.notifyDataSetChanged();\n\n spinnerTime.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n id_pukul = pukuls.get(position).getId();\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n }\n }\n }\n }\n\n @Override\n public void onFailure(Call<PukulResponse> call, Throwable t) {\n Log.e(\"Error Message\", t.getMessage());\n }\n });\n }", "void dailod_dab() {\n AlertDialog.Builder alertdialogbuilder = new AlertDialog.Builder(MainActivity.this);\n\n\n alertdialogbuilder.setTitle(\"Select A slot \");\n\n\n alertdialogbuilder.setItems(value1, new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n String slt = Arrays.asList(value1).get(which);\n //slot=lis.get(which);\n\n db.opendb();\n String mnoo = db.get_Mobileno();\n String passs = db.get_PASS();\n if (mnoo != null && mnoo.length() > 0 && passs != null && passs.length() > 0) {\n sendSMS(mnoo, \"DB\" + slt + \" \" + passs);\n Toast.makeText(getApplicationContext(), slt, Toast.LENGTH_LONG).show();\n }\n // textview.setText(selectedText);\n\n }\n });\n\n AlertDialog dialog = alertdialogbuilder.create();\n\n dialog.show();\n }", "private void setSpinner() {\n class spinna extends AsyncTask<Void, Void, ArrayList<String>> {\n\n @Override\n protected void onPreExecute() {\n super.onPreExecute();\n }\n\n @Override\n protected ArrayList<String> doInBackground(Void... voids) {\n ArrayList<String> items = new ArrayList<>();\n for (Season season : series.getSeasons()) {\n int i = season.getSeasonNumber();\n items.add(String.valueOf(i));\n }\n\n return items;\n\n }\n\n @Override\n protected void onPostExecute(ArrayList<String> items) {\n super.onPostExecute(items);\n ArrayAdapter<String> adapter = new ArrayAdapter<String>(SeriesActivity.this, android.R.layout.simple_spinner_dropdown_item, items);\n adapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);\n dropdown.setAdapter(adapter);\n adapter.notifyDataSetChanged();\n adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n }\n }\n spinna kkkk = new spinna();\n kkkk.execute();\n\n\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {\n View rootView = inflater.inflate(R.layout.category_catchange, container, false);\n progressDialog = new ProgressDialog(getActivity());\n // db = new DBHandler(getActivity());\n userPreferences = UserPreferences.getInstance(getActivity());\n\n sealUsed = new ArrayList<String>(6);\n sealUsed.add(\" \");\n sealUsed.add(\" \");\n sealUsed.add(\" \");\n sealUsed.add(\" \");\n sealUsed.add(\" \");\n sealUsed.add(\" \");\n\n ((AppCompatActivity) getActivity()).getSupportActionBar().setTitle(\"CATEGORY CHANGE+\");\n\n\n Bundle bundle = getArguments();\n //orderData = (McrOrederProxie) bundle.getSerializable(\"orderData\");\n if (userPreferences.getLocalMsgId().equalsIgnoreCase(\"U01\")) {\n mcrOrderProxie = (McrOrderProxie) bundle.getSerializable(\"orderData\");\n } else {\n mcrOrderProxieOtherConn = (McrOrderProxieOtherConn) bundle.getSerializable(\"orderData\");\n }\n\n\n // seva kendra\n\n\n spin_purpose = (Spinner) rootView.findViewById(R.id.spin_purpose);\n spin_usage = (Spinner) rootView.findViewById(R.id.spin_usage);\n\n\n spin_purpose.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {\n\n if (i == 0) {\n usageArr = getResources().getStringArray(R.array.usage_array0);\n usageArrSub = getResources().getStringArray(R.array.usage_array_sub0);\n\n } else if (i == 1) {\n usageArr = getResources().getStringArray(R.array.usage_array1);\n usageArrSub = getResources().getStringArray(R.array.usage_array_sub1);\n } else if (i == 2) {\n usageArr = getResources().getStringArray(R.array.usage_array2);\n usageArrSub = getResources().getStringArray(R.array.usage_array_sub2);\n } else if (i == 3) {\n usageArr = getResources().getStringArray(R.array.usage_array3);\n usageArrSub = getResources().getStringArray(R.array.usage_array_sub3);\n } else if (i == 4) {\n usageArr = getResources().getStringArray(R.array.usage_array4);\n usageArrSub = getResources().getStringArray(R.array.usage_array_sub4);\n } else if (i == 5) {\n usageArr = getResources().getStringArray(R.array.usage_array5);\n usageArrSub = getResources().getStringArray(R.array.usage_array_sub5);\n } else {\n usageArr = getResources().getStringArray(R.array.usage_array0);\n usageArrSub = getResources().getStringArray(R.array.usage_array_sub0);\n }\n\n spin_usage.setAdapter(new SpinnerAdapterFilter(getActivity(), R.layout.custom_spinner, usageArr, usageArrSub));\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> adapterView) {\n\n }\n });\n\n //usageArr = getResources().getStringArray(R.array.usage_array);\n //usageArrSub = getResources().getStringArray(R.array.usage_array_sub);\n // seva kendra\n\n usageArr = getResources().getStringArray(R.array.usage_array0);\n usageArrSub = getResources().getStringArray(R.array.usage_array_sub0);\n\n // seva kendra\n\n spin_usage.setAdapter(new SpinnerAdapterFilter(getActivity(), R.layout.custom_spinner, usageArr, usageArrSub));\n spin_usage.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n\n if (position != 0) {\n TextView pmTypeText = (TextView) view.findViewById(R.id.text_main_seen);\n TextView pmTypeID = (TextView) view.findViewById(R.id.sub_text_seen);\n\n spinUsageVal = pmTypeID.getText().toString();\n //String compID = String.valueOf(reqId.getText().toString());\n } else {\n spinUsageVal = \"0\";\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n description = (EditText) rootView.findViewById(R.id.description);\n\n\n scanmeter = (Button) rootView.findViewById(R.id.scanmeter);\n\n\n devicenumber = (EditText) rootView.findViewById(R.id.devicenumber);\n\n\n radiostickerinstall = (RadioGroup) rootView.findViewById(R.id.radiostickerinstall);\n valStickerinstall = ((RadioButton) rootView.findViewById(radiostickerinstall.getCheckedRadioButtonId())).getText().toString();\n\n final LinearLayout stickerll = (LinearLayout) rootView.findViewById(R.id.stickerll);\n stickernumber = (EditText) rootView.findViewById(R.id.stickernumber);\n\n radiostickerinstall.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {\n @Override\n public void onCheckedChanged(RadioGroup group, int checkedId) {\n valStickerinstall = ((RadioButton) group.getRootView().findViewById(checkedId)).getText().toString();\n\n if (valStickerinstall.equalsIgnoreCase(\"Yes\")) {\n stickerll.setVisibility(View.VISIBLE);\n } else {\n stickerll.setVisibility(View.GONE);\n stickernumber.setText(\"\");\n }\n }\n });\n\n\n //devicenumber.setText(orderData.getDEVICENO());\n\n radioelcbinstall = (RadioGroup) rootView.findViewById(R.id.radioelcbinstall);\n valelcbinstall = ((RadioButton) rootView.findViewById(radioelcbinstall.getCheckedRadioButtonId())).getText().toString();\n\n final LinearLayout elcbbasedll = (LinearLayout) rootView.findViewById(R.id.elcbbasedll);\n\n radioelcbinstall.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {\n @Override\n public void onCheckedChanged(RadioGroup group, int checkedId) {\n valelcbinstall = ((RadioButton) group.getRootView().findViewById(checkedId)).getText().toString();\n\n if (valelcbinstall.equalsIgnoreCase(\"Yes\")) {\n // elcbbasedll.setVisibility(View.VISIBLE);\n valelcbinstall = \"Yes\";\n } else {\n\n valelcbinstall = \"No\";\n\n }\n }\n });\n\n radioInstalledBus = (RadioGroup) rootView.findViewById(R.id.radioinstalledbus);\n\n final LinearLayout busbarmainll = (LinearLayout) rootView.findViewById(R.id.busbarinstalled_ll);\n final LinearLayout busbarll = (LinearLayout) rootView.findViewById(R.id.busbarll);\n\n dropbussize = (Spinner) rootView.findViewById(R.id.dropbussize);\n dropbussizecust = (Spinner) rootView.findViewById(R.id.dropbussizecust);\n\n busnumber = (EditText) rootView.findViewById(R.id.busnumber);\n busbarcablesize = (Spinner) rootView.findViewById(R.id.busbarcablesize);\n drumnumberbb = (EditText) rootView.findViewById(R.id.drumnumberbb); // new\n\n radiocableinstalltypebb = (RadioGroup) rootView.findViewById(R.id.radiocableinstalltypebb);\n valInstallTypebb = ((RadioButton) rootView.findViewById(radiocableinstalltypebb.getCheckedRadioButtonId())).getText().toString();\n\n radiocableinstalltypebb.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {\n @Override\n public void onCheckedChanged(RadioGroup group, int checkedId) {\n valInstallTypebb = ((RadioButton) group.getRootView().findViewById(checkedId)).getText().toString();\n }\n });\n\n runninglengthfrombb = (EditText) rootView.findViewById(R.id.runninglengthfrombb); // new\n runninglengthtobb = (EditText) rootView.findViewById(R.id.runninglengthtobb); // new\n cablelengthbb = (EditText) rootView.findViewById(R.id.cablelengthbb);\n\n cablelengthbb.setEnabled(true);\n cablelengthbb.setOnTouchListener(new View.OnTouchListener() {\n @Override\n public boolean onTouch(View v, MotionEvent event) {\n\n if (runninglengthfrombb.getText().toString().trim().isEmpty()) {\n return false;\n } else {\n if (!runninglengthtobb.getText().toString().trim().isEmpty()) {\n\n\n frombb = Integer.parseInt(runninglengthfrombb.getText().toString().trim());\n tobb = Integer.parseInt(runninglengthtobb.getText().toString().trim());\n\n if (frombb < tobb || frombb == tobb) {\n int result = tobb - frombb;\n if (result < 0) {\n // return false;\n } else {\n cablelengthbb.setText(Integer.toString(result));\n }\n } else {\n Snackbar.make(getView(), \"From length should be less than to length!!\", Snackbar.LENGTH_LONG)\n .setAction(\"Action\", null).show();\n cablelengthbb.setText(\"\");\n runninglengthtobb.setText(\"\");\n }\n }\n }\n\n return false;\n }\n });\n\n\n final LinearLayout busbarcablesize_layout = (LinearLayout) rootView.findViewById(R.id.busbarcablesize_layout);\n final LinearLayout busbarcustomerll = (LinearLayout) rootView.findViewById(R.id.busbarcustomerll);\n valInstalledBus = ((RadioButton) rootView.findViewById(radioInstalledBus.getCheckedRadioButtonId())).getText().toString();\n final LinearLayout radiocustomerbusll = (LinearLayout) rootView.findViewById(R.id.radiocustomerbusll);\n\n radioInstalledBus.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {\n @Override\n public void onCheckedChanged(RadioGroup group, int checkedId) {\n valInstalledBus = ((RadioButton) group.getRootView().findViewById(checkedId)).getText().toString();\n\n if (valInstalledBus.equalsIgnoreCase(\"Yes\")) {\n radiocustomerbusll.setVisibility(View.GONE);\n\n busbarmainll.setVisibility(View.VISIBLE);\n dropbussizecustVal = \"\";\n } else if (valInstalledBus.equalsIgnoreCase(\"Old\")) {\n\n busbarmainll.setVisibility(View.VISIBLE);\n radiocustomerbusll.setVisibility(View.VISIBLE);\n\n } else {\n\n busbarmainll.setVisibility(View.GONE);\n radiocustomerbusll.setVisibility(View.GONE);\n dropbussizecustVal = \"\";\n }\n }\n });\n\n\n radiocustomerbus = (RadioGroup) rootView.findViewById(R.id.radiocustomerbus);\n radiocustomerbus.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {\n @Override\n public void onCheckedChanged(RadioGroup group, int checkedId) {\n valcustomerinstall = ((RadioButton) group.getRootView().findViewById(checkedId)).getText().toString();\n\n if (valcustomerinstall.equalsIgnoreCase(\"BSES Bus-Bar\")) {\n // elcbbasedll.setVisibility(View.VISIBLE);\n dropbussizecustVal = \"\";\n busbarcustomerll.setVisibility(View.GONE);\n busbarll.setVisibility(View.VISIBLE);\n } else {\n dropbussizecustVal = dropbussizecust.getSelectedItem().toString();\n busbarcustomerll.setVisibility(View.VISIBLE);\n busbarll.setVisibility(View.GONE);\n }\n }\n });\n\n dropreason = (Spinner) rootView.findViewById(R.id.dropreason);\n dropreason.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n if (position == 0) {\n valdropreason = \"01\";\n } else {\n valdropreason = \"01\";\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n dropreasonre = (Spinner) rootView.findViewById(R.id.dropreasonre);\n dropreasonre.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n if (position == 0) {\n valdropreason = \"09\";\n } else {\n valdropreason = \"09\";\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n\n dropcablesize = (Spinner) rootView.findViewById(R.id.dropcablesize);\n\n drumnumber = (EditText) rootView.findViewById(R.id.drumnumber);\n\n outputcablelength = (EditText) rootView.findViewById(R.id.outputcablelength);\n\n radiocableinstalltype = (RadioGroup) rootView.findViewById(R.id.radiocableinstalltype);\n\n valInstallType = ((RadioButton) rootView.findViewById(radiocableinstalltype.getCheckedRadioButtonId())).getText().toString();\n\n radiocableinstalltype.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {\n @Override\n public void onCheckedChanged(RadioGroup group, int checkedId) {\n valInstallType = ((RadioButton) group.getRootView().findViewById(checkedId)).getText().toString();\n }\n });\n\n runninglengthfrom = (EditText) rootView.findViewById(R.id.runninglengthfrom);\n runninglengthto = (EditText) rootView.findViewById(R.id.runninglengthto);\n cablelength = (EditText) rootView.findViewById(R.id.cablelength);\n\n cablelength.setEnabled(true);\n cablelength.setOnTouchListener(new View.OnTouchListener() {\n @Override\n public boolean onTouch(View v, MotionEvent event) {\n\n if (runninglengthfrom.getText().toString().trim().isEmpty()) {\n return false;\n } else {\n if (!runninglengthto.getText().toString().trim().isEmpty()) {\n\n from = Integer.parseInt(runninglengthfrom.getText().toString().trim());\n to = Integer.parseInt(runninglengthto.getText().toString().trim());\n\n if (from < to || from == to) {\n int result = to - from;\n if (result < 0) {\n // return false;\n } else {\n cablelength.setText(Integer.toString(result));\n }\n } else {\n Snackbar.make(getView(), \"From length should be less than to length!!\", Snackbar.LENGTH_LONG)\n .setAction(\"Action\", null).show();\n cablelength.setText(\"\");\n runninglengthto.setText(\"\");\n }\n }\n }\n return false;\n }\n });\n\n\n validateseal = (Button) rootView.findViewById(R.id.validateseal);\n\n\n validateseal.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n punchDataWS task = new punchDataWS();\n //Call execute\n task.execute();\n }\n });\n\n\n Button button1 = (Button) rootView.findViewById(R.id.next2);\n\n button1.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n\n\n mcrOrderProxieOtherConn.setStrPURPOSE_S5(spinUsageVal);\n mcrOrderProxieOtherConn.setStrDESC_S5(description.getText().toString());\n\n\n Fragment fragment = new PhotosAndID();\n Bundle bundle = new Bundle();\n bundle.putSerializable(\"orderData\", mcrOrderProxieOtherConn);\n fragment.setArguments(bundle);\n\n FragmentManager fm = getFragmentManager();\n FragmentTransaction fragmentTransaction = fm.beginTransaction();\n fragmentTransaction.replace(R.id.fragment_place, fragment, TAG_FRAGMENT);\n fragmentTransaction.addToBackStack(TAG_FRAGMENT);\n fragmentTransaction.commit();\n }\n });\n\n\n return rootView;\n }", "private void spinner() {\n ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,\n R.array.planets_array, R.layout.simple_spinner_item_new);\n// Specify the layout to use when the list of choices appears\n adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n// Apply the adapter to the spinner\n// dropDownViewTheme.\n planetsSpinner.setAdapter(adapter);\n planetsSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n Object itemAtPosition = parent.getItemAtPosition(position);\n Log.d(TAG, \"onItemSelected: \" + itemAtPosition);\n\n String[] stringArray = getResources().getStringArray(R.array.planets_array);\n Toast.makeText(DialogListActivity.this, \"选择 \" + stringArray[position], Toast.LENGTH_SHORT).show();\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n Toast.makeText(DialogListActivity.this, \"未选择\", Toast.LENGTH_SHORT).show();\n }\n });\n }", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n // I created a dynamic TextView here, but you can reference your own custom layout for each spinner item\n TextView label = new TextView(context);\n label.setTextColor(Color.BLACK);\n // Then you can get the current item using the values array (Users array) and the current position\n // You can NOW reference each method you has created in your bean object (User class)\n label.setText(values[position].get_projeadi());\n\n // And finally return your dynamic (or custom) view for each spinner item\n return label;\n }", "@Override\n protected void onPostExecute(String result) {\n super.onPostExecute(result);\n\n ArrayAdapter<String> adapter_state1 = new ArrayAdapter<String>(MainActivity.this, R.layout.simple_list_item_2, arrayListtype){\n\n @Override\n public boolean isEnabled(int position){\n if(position == 0)\n {\n // Disable the first item from Spinner\n // First item will be use for hint\n return false;\n }\n else\n {\n return true;\n }\n }\n @Override\n public View getDropDownView(int position, View convertView,\n ViewGroup parent) {\n View view = super.getDropDownView(position, convertView, parent);\n TextView tv = (TextView) view;\n if(position == 0){\n // Set the hint text color gray\n tv.setTextColor(getResources().getColor(R.color.grey));\n }\n else {\n tv.setTextColor(getResources().getColor(R.color.textcolour));\n }\n return view;\n }\n };\n\n adapter_state1\n .setDropDownViewResource(R.layout.simple_list_item_1);\n\n sp1.setAdapter(adapter_state1);\n pdia.dismiss();\n\n }", "@Override\n protected void onPostExecute(String s) {\n ActivitySpinnerAdapter activitySpinnerAdapter = new ActivitySpinnerAdapter(getActivity().getApplicationContext(), aImage, aName);\n activitySpinner.setAdapter(activitySpinnerAdapter);;\n }", "@Override\r\n public void onClick(View view) {\r\n Toast.makeText(context, \"satu\" +list_data.get(getAdapterPosition()), Toast.LENGTH_SHORT).show();\r\n\r\n }", "private void initSpinnerSelectionChamps() {\n\n //preparation de l'URL, recuperation de tous les champs dispo. dans la BDD\n final String url = WebService.buildUrlForRequest(Metier.DOMAIN, Metier.NOM_MODELE_CATEGORIES, WebService.ACTION_LIST, null);\n\n //preparation et execution de la requete en asynchrone\n asyncHttpClient.get(getActivity(), url, new AsyncHttpResponseHandler() {\n @Override\n public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {\n //recuperation des donnees et parsing en JSONArray\n String response = null;\n try {\n response = new String(responseBody, ENCODING);\n JSONArray jsonArray = new JSONArray(response);\n Log.e(\"JSONARRAY\", jsonArray.toString(1));\n } catch (UnsupportedEncodingException e) {\n e.printStackTrace();\n } catch (JSONException e) {\n e.printStackTrace();\n }\n\n }\n\n @Override\n public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {\n new AlertDialog.Builder(getActivity()).setMessage(getString(R.string.error_msg_fail_retrieve_data) + statusCode).show();\n }\n });\n/*\n try {\n JSONObject json = JsonUtils.loadJSONFromResources(getActivity(), R.raw.champs);\n this.spinnerChampAdapter = new ChampAdapter(getActivity(), JsonUtils.getJsonObjects(json, new ArrayList<JSONObject>()));\n } catch (IOException e) {\n e.printStackTrace();\n }*/\n }", "@Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n\n quanHuyens = sqLite_quanHuyen.getDSQH(arrTinhTP.get(position).getId());\n adapterRecyclerViewChonQuan = new AdapterRecyclerViewChonQuan(quanHuyens, getApplicationContext());\n recycleQH.setAdapter(adapterRecyclerViewChonQuan);\n\n //spinnerQuanHuyen_adapter = new SpinnerQuanHuyen_Adapter(getApplicationContext(), arrQuanHuyen);\n //spinnerQuanHuyen_adapter.notifyDataSetChanged();\n //spinnerQuanHuyen.setAdapter(spinnerQuanHuyen_adapter);\n\n }", "private void cargarSpinner() {\n\n admin = new AdminSQLiteOpenHelper(this, \"activo_fijo\", null, 1);\n BaseDeDatos = admin.getReadableDatabase();\n\n List<String> opciones = new ArrayList<String>();\n opciones.add(\"Selecciona una opción\");\n\n String selectQuery = \"SELECT * FROM sucursales\" ;\n Cursor cursor = BaseDeDatos.rawQuery(selectQuery, null);\n\n // looping through all rows and adding to list\n if (cursor.moveToFirst()) {\n do {\n // adding to tags list\n opciones.add(cursor.getString(cursor.getColumnIndex(\"local\")));\n } while (cursor.moveToNext());\n }\n\n BaseDeDatos.close();\n\n //spiner personalizado\n ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, opciones);\n spinner.setAdapter(adapter);\n\n }", "@Override\n public void onItemSelected(AdapterView<?> parent, View view, int position,\n long id) {\n nama_dokter2 = parent.getItemAtPosition(position).toString();\n\n // Showing selected spinner item\n Toast.makeText(parent.getContext(), \"You selected: \" + nama_dokter2,\n Toast.LENGTH_LONG).show();\n\n }", "@Override\n protected void onPostExecute(String result) {\n super.onPostExecute(result);\n ArrayAdapter<String> adapter_state2 = new ArrayAdapter<String>(MainActivity.this, R.layout.simple_list_item_3, arrayListsize){\n\n @Override\n public boolean isEnabled(int position){\n if(position == 0)\n {\n // Disable the first item from Spinner\n // First item will be use for hint\n return false;\n }\n else\n {\n return true;\n }\n }\n @Override\n public View getDropDownView(int position, View convertView,\n ViewGroup parent) {\n View view = super.getDropDownView(position, convertView, parent);\n TextView tv = (TextView) view;\n if(position == 0){\n // Set the hint text color gray\n tv.setTextColor(getResources().getColor(R.color.grey));\n }\n else {\n tv.setTextColor(getResources().getColor(R.color.textcolour));\n }\n return view;\n }\n };\n\n adapter_state2\n .setDropDownViewResource(R.layout.simple_list_item_1);\n\n sp2.setAdapter(adapter_state2);\n pdia.dismiss();\n\n\n }", "private void loadSpinnerData() {\n rows = db.getPumpDetails();\n\n // Creating adapter for spinner\n dataAdapter = new ArrayAdapter<String>(this,\n android.R.layout.simple_spinner_item, rows);\n\n // Drop down layout style - list view with radio button\n dataAdapter\n .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n\n // attaching data adapter to spinner\n spinner.setAdapter(dataAdapter);\n }", "void loadSpinner(Spinner sp){\n List<String> spinnerArray = new ArrayList<>();\n spinnerArray.add(\"Oui\");\n spinnerArray.add(\"Non\");\n\n// (3) create an adapter from the list\n ArrayAdapter<String> adapter = new ArrayAdapter<String>(\n this,\n android.R.layout.simple_spinner_item,\n spinnerArray\n );\n\n//adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n\n// (4) set the adapter on the spinner\n sp.setAdapter(adapter);\n\n }", "@Override\n public void onSuccess(Void aVoid) {\n Toast.makeText(getContext(), \"המוצר נמחק בהצלחה!\", Toast.LENGTH_SHORT).show();\n }", "public void send(View v)\n {\n if(staticSpinner.getSelectedItemPosition() == 0) {\n TextView errorText = (TextView)staticSpinner.getSelectedView();\n errorText.setError(\"\");\n errorText.setTextColor(Color.RED);//just to highlight that this is an error\n errorText.setText(\"Harap Pilih Kategori\");\n }\n else if(msgTextField.getText().toString().equals(\"\") ){\n msgTextField.setError(\"required\");\n msgTextField.setHintTextColor(Color.RED);//just to highlight that this is an error\n msgTextField.setHint(\"Harap Diisi\");\n }\n else {\n if (staticSpinner.getSelectedItem().equals(\"Nama Produk\")) {\n spinK = \"nama_produk\";\n } else if (staticSpinner.getSelectedItem().equals(\"Nama Produsen\")) {\n spinK = \"nama_produsen\";\n } else {\n spinK = \"nomor_sertifikat\";\n }\n String msgSearch = msgTextField.getText().toString();\n Intent searchIntent = new Intent(MainActivity.this, HasilCari.class);\n Bundle extras = new Bundle();\n extras.putString(\"spinKat\", spinK);\n extras.putString(\"msgSearch\", msgSearch);\n searchIntent.putExtras(extras);\n startActivity(searchIntent);\n Log.v(TAG, spinK);\n }\n }", "private void ShowSpinner(String[] items, Spinner spinner)\n {\n String[] list = items;\n\n final List<String> plantsList = new ArrayList<>(Arrays.asList(list));\n\n // Initializing an ArrayAdapter\n final ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(\n this, R.layout.support_simple_spinner_dropdown_item, plantsList) {\n @Override\n public boolean isEnabled(int position) {\n if (position == 0) {\n // Disable the first item from Spinner\n // First item will be use for hint\n return false;\n } else {\n return true;\n }\n }\n\n @Override\n public View getDropDownView(int position, View convertView,\n ViewGroup parent) {\n View view = super.getDropDownView(position, convertView, parent);\n TextView tv = (TextView) view;\n if (position == 0) {\n // Set the hint text color gray\n tv.setTextColor(Color.parseColor(\"#C1C1C1\"));\n } else {\n tv.setTextColor(Color.BLACK);\n }\n return view;\n }\n };\n spinnerArrayAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);\n spinner.setAdapter(spinnerArrayAdapter);\n spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n topicname = (String) parent.getItemAtPosition(position);\n // If user change the default selection\n // First item is disable and it is used for hint\n if (position > 0) {\n // Notify the selected item text\n Toast.makeText\n (getApplicationContext(), \"Topic \" + topicname+\" selected\", Toast.LENGTH_SHORT)\n .show();\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n }", "public void addItemsOnSpinner() {\n Data dataset = new Data(getApplicationContext());\n List<String> list = new ArrayList<String>();\n list = dataset.getClasses();\n ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list);\n dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n spinner.setAdapter(dataAdapter);\n }", "@Override\n public void onSuccess(String result) {\n if (!TextUtils.isEmpty(result)){\n\n Gson gson=new Gson();\n list = gson.fromJson(result,new TypeToken<List<SecondHandCollege>>() { }.getType());\n data = getStringArraty(list);\n collegeAdapter=new ArrayAdapter(RegisterActivity.this,android.R.layout.simple_spinner_item, data);\n registerCollegeSpinner.setAdapter(collegeAdapter);\n\n //下拉列表点击监听\n setCollegeSpinnerClick();\n\n }\n }", "private void povoarSpinners() {\n List<String> lista = new ArrayList<>();\n lista.add(UsuarioNivelConstantes.VETOR_DESCRICOES[0]);\n lista.add(UsuarioNivelConstantes.VETOR_DESCRICOES[1]);\n lista.add(UsuarioNivelConstantes.VETOR_DESCRICOES[2]);\n ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, lista);\n arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_item);\n spnNivel.setAdapter(arrayAdapter);\n lista = new ArrayList<>();\n lista.add(UsuarioEstadoConstantes.VETOR_DESCRICOES[0]);\n lista.add(UsuarioEstadoConstantes.VETOR_DESCRICOES[1]);\n arrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, lista);\n arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_item);\n spnEstado.setAdapter(arrayAdapter);\n }", "@Override\n public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long id) {\n Toast.makeText(getApplicationContext(),country[position] , Toast.LENGTH_LONG).show();\n }", "public void onItemSelected(AdapterView<?> parent, View view, int position,\n long id) {\n nama_pasien2 = parent.getItemAtPosition(position).toString();\n\n // Showing selected spinner item\n Toast.makeText(parent.getContext(), \"You selected: \" + nama_pasien2,\n Toast.LENGTH_LONG).show();\n\n }", "private void spinnerAction() {\n Spinner spinnerphonetype = (Spinner) findViewById(R.id.activity_one_phonetype_spinner);//phonetype spinner declaration\n ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,\n R.array.phone_spinner, android.R.layout.simple_spinner_item); //create the spinner array\n adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); //set the drop down function\n spinnerphonetype.setAdapter(adapter); //set the spinner array\n }", "@Override\n protected void onPostExecute(Void args) {\n Spinner mySpinner = (Spinner) findViewById(R.id.profile_spinner);\n\n // Spinner adapter\n mySpinner\n .setAdapter(new ArrayAdapter<String>(NewUserVehicleDetails.this,\n android.R.layout.simple_spinner_dropdown_item,\n modelvarlist));\n\n // Spinner on item click listener\n mySpinner\n .setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n\n @Override\n public void onItemSelected(AdapterView<?> arg0,\n View arg1, int position, long arg3) {\n\n\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> arg0) {\n // TODO Auto-generated method stub\n }\n });\n }", "public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {\n userType = (int) arg3;\n /* 将mySpinner 显示*/\n arg0.setVisibility(View.VISIBLE);\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_third);\n\n Intent intent = getIntent();\n // 4. get bundle from intent\n Bundle bundle = intent.getExtras();\n String message = intent.getStringExtra(\"mTextNewGroup\");\n // 5. get status value from bundle\n get_group2 = bundle.getString(\"mTextNewGroup\");\n\n // mTextNewGroup = (TextView)findViewById(R.id.textNewGroup);\n mTextView3= (TextView)findViewById(R.id.textView3);\n (mTextView3).setText(get_group2);\n\n mTextView5= (TextView)findViewById(R.id.textView5);\n\n s3 = (Spinner)findViewById(R.id.spinner3);\n\n List<String> listDepth = new ArrayList<>();\n listDepth.add(\"35\");\n listDepth.add(\"40\");\n listDepth.add(\"50\");\n listDepth.add(\"60\");\n listDepth.add(\"70\");\n listDepth.add(\"80\");\n listDepth.add(\"90\");\n listDepth.add(\"100\");\n listDepth.add(\"1100\");\n listDepth.add(\"120\");\n listDepth.add(\"130\");\n ArrayAdapter<String> dataAdapter = new ArrayAdapter<>(this,\n android.R.layout.simple_spinner_item, listDepth);\n dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n dataAdapter.notifyDataSetChanged();\n s3.setAdapter(dataAdapter);\n s3.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {\n String depthValue = String.valueOf(s3.getSelectedItem());\n\n if (depthValue.contentEquals(\"35\") && get_group2.contentEquals(\"A\")) {\n //Toast.makeText(getApplicationContext(), \"Your Max Underwater time is 185 minutes\", Toast.LENGTH_SHORT).show();\n (mTextView5).setText(\"Your Max Underwater time is 185 minutes\");\n } else if (depthValue.contentEquals(\"40\") && get_group2.contentEquals(\"A\")) {\n //Toast.makeText(getApplicationContext(), \"Your Max Underwater time is 122 minutes\", Toast.LENGTH_SHORT).show();\n (mTextView5).setText(\"Your Max Underwater time is 122 minutes\");\n } else if (depthValue.contentEquals(\"50\") && get_group2.contentEquals(\"A\")) {\n //Toast.makeText(getApplicationContext(), \"Your Max Underwater time is 66 minutes\", Toast.LENGTH_SHORT).show();\n (mTextView5).setText(\"Your Max Underwater time is 66 minutes\");\n } else if (depthValue.contentEquals(\"35\") && get_group2.contentEquals(\"B\")) {\n //Toast.makeText(getApplicationContext(), \"Your Max Underwater time is 167 minutes\", Toast.LENGTH_SHORT).show();\n (mTextView5).setText(\"Your Max Underwater time is 167 minutes\");\n } else if (depthValue.contentEquals(\"40\") && get_group2.contentEquals(\"B\")) {\n //Toast.makeText(getApplicationContext(), \"Your Max Underwater time is 108 minutes\", Toast.LENGTH_SHORT).show();\n (mTextView5).setText(\"Your Max Underwater time is 108 minutes\");\n } else if (depthValue.contentEquals(\"50\") && get_group2.contentEquals(\"B\")) {\n //Toast.makeText(getApplicationContext(), \"Your Max Underwater time is 54 minutes\", Toast.LENGTH_SHORT).show();\n (mTextView5).setText(\"Your Max Underwater time is 54 minutes\");\n }\n else if (depthValue.contentEquals(\"35\") && get_group2.contentEquals(\"C\")) {\n //Toast.makeText(getApplicationContext(), \"Your Max Underwater time is 54 minutes\", Toast.LENGTH_SHORT).show();\n (mTextView5).setText(\"Your Max Underwater time is 155 minutes\");\n }\n else if (depthValue.contentEquals(\"40\") && get_group2.contentEquals(\"C\")) {\n //Toast.makeText(getApplicationContext(), \"Your Max Underwater time is 54 minutes\", Toast.LENGTH_SHORT).show();\n (mTextView5).setText(\"Your Max Underwater time is 96 minutes\");\n }\n\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parentView) {\n // your code here\n }\n\n });\n\n\n }", "@Override\n public void onItemSelected(AdapterView<?> adapterView,\n View view, int i, long l) {\n mSpinnerLabel = adapterView.getItemAtPosition(i).toString();\n showText(view);\n }", "@Override\n\t\t\t\t\tpublic void onItemSelected(AdapterView<?> arg0, View arg1,\n\t\t\t\t\t\t\tint arg2, long arg3) {\n\t\t\t\t\t\tsbsno=arg0.getItemAtPosition(arg2).toString();\n\t\t\t\t\t\t\n\t\t\t\t\t\t((TextView) arg0.getChildAt(0)).setTextColor(Color.BLUE);\n\t\t\t\t\t\t\n\t\t\t\t\t\tToast.makeText(getApplicationContext(), \"\"+sbsno, Toast.LENGTH_SHORT).show();\n\t\t\t\t\t\tnew BusStopFetchApi().execute();\n\t\t\t\t\t\t\n\t\t\t\t\t}", "@Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n String item = parent.getItemAtPosition(position).toString();\n tuning = position;\n setUpDisplay();\n\n // Showing selected spinner item\n if (tuner1 == 3) {\n Toast.makeText(TunerActivity.this, \"\" + item, Toast.LENGTH_LONG).show();\n }\n }", "private void startSpinnerValues(Spinner spinner, ArrayList<String> valores, ArrayAdapter<String> adapter)\n {\n //Inicializamos el adaptador y lo agregamos al Spinner\n adapter=new ArrayAdapter<String>(this, R.layout.support_simple_spinner_dropdown_item,valores);\n spinner.setAdapter(adapter);\n }", "public void addItemsOnSpinner2() {\n }", "@Override\n public void onItemClick(AdapterView<?> parent, View view, int position, long id) {\n sensorSelect = (Sensor)parent.getItemAtPosition(position);\n et_tipo.setText(sensorSelect.getTipo());\n et_descripcion.setText(sensorSelect.getDescripcion());\n et_umbral_max.setText(sensorSelect.getValor_umbarl_maximo());\n et_umbral_min.setText(sensorSelect.getValor_umbarl_minimo());\n }", "@Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n String item = parent.getItemAtPosition(position).toString();\n\n // Showing selected spinner item\n Toast.makeText(parent.getContext(), \"Selected: \" + item, Toast.LENGTH_LONG).show();\n\n }", "@Override\n protected void onPostExecute(String s) {\n\n RepeatSpinnerAdapter repeatSpinnerAdapter = new RepeatSpinnerAdapter(getActivity().getApplicationContext(), iconsRepeat, rNames);\n repeatSpinner.setAdapter(repeatSpinnerAdapter);\n\n }", "private void updateSpinner() {\n ArrayAdapter<CharSequence> adaptador = new ArrayAdapter(getContext(), android.R.layout.simple_spinner_item,nombresEnComboBox);\n spinner.setAdapter(adaptador);\n //guardo el item seleccionado del combo\n spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){\n @Override\n public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {\n nombreDeLocSeleccionada[0] = (String) spinner.getAdapter().getItem(i);\n for (int j=0 ; j < listaLocalidades.size() ; j++){\n if (listaLocalidades.get(j).getNombreLocalidad().equals(nombreDeLocSeleccionada[0])) {\n idLoc = listaLocalidades.get(j).getIdLocalidad() ;\n break;\n }\n }\n //Toast.makeText(getActivity(), nombreDeLocSeleccionada[0], Toast.LENGTH_SHORT).show();\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> adapterView) {\n\n }\n });\n }", "private void loadSpinnerData() {\n List<String> patientList = db.getAllPatient();\n\n // Creating adapter for spinner\n ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,\n android.R.layout.simple_spinner_item, patientList);\n\n // Drop down layout style - list view with radio button\n dataAdapter\n .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n\n // attaching data adapter to spinner\n patientIdSpn.setAdapter(dataAdapter);\n }", "@Override\n protected void onPostExecute(Void args) {\n Spinner mySpinner = (Spinner) findViewById(R.id.manu_spinner);\n\n // Spinner adapter\n mySpinner\n .setAdapter(new ArrayAdapter<String>(NewUserVehicleDetails.this,\n android.R.layout.simple_spinner_dropdown_item,\n manufatureslist));\n\n // Spinner on item click listener\n mySpinner\n .setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n\n @Override\n public void onItemSelected(AdapterView<?> arg0,\n View arg1, int position, long arg3) {\n // new DownloadModelVarJSON().execute();\n Spinner manufacturSpin=(Spinner) findViewById(R.id.manu_spinner);\n String name = manufacturSpin.getSelectedItem().toString();\n\n GetModelVarDropdon(name);\n\n\n\n\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> arg0) {\n // TODO Auto-generated method stub\n }\n });\n }", "@Override\n public void onResponse(JSONArray response) {\n Toast.makeText(getApplicationContext(), \"Berhasil tambah data\" + response, Toast.LENGTH_SHORT).show();\n mProgressBar.setVisibility(View.INVISIBLE);\n }", "@Override\n protected void onPostExecute(String s) {\n PersonSpinnerAdapter personSpinnerAdapter = new PersonSpinnerAdapter(getActivity().getApplicationContext(), pIcon, pNames);\n personSpinner.setAdapter(personSpinnerAdapter);\n\n }", "@Override\n\t\t\tpublic void onItemSelected(AdapterView<?> arg0, View arg1,\n\t\t\t\t\tint arg2, long arg3) {\n\t\t\t\tToast.makeText(getApplicationContext(), \"Selected Text Is...\"+names[arg2]+\":\"+phones[arg2], 5000).show();\n\t\t\t}", "private void UpdateDataForSpinner(Spinner spinner){\n // Create an ArrayAdapter using the string array and a default spinner layout\n ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,\n R.array.serviceQuantity, android.R.layout.simple_spinner_item);\n // Specify the layout to use when the list of choices appears\n adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n // Apply the adapter to the spinner\n spinner.setAdapter(adapter);\n }", "private void initSpinnerTypeExam()\n {\n Spinner spinner = findViewById(R.id.iTypeExam);\n\n // Adapt\n final ArrayAdapter<String> adapter = new ArrayAdapter<>(\n this,\n R.layout.support_simple_spinner_dropdown_item\n );\n spinner.setAdapter(adapter);\n\n // ajout des types d'examens\n for(TypeExamen t : TypeExamen.values())\n {\n adapter.add(t.toString());\n }\n }", "public void bindSpinner() {\n // Create an ArrayAdapter using the string array and a spinner layout\n ArrayAdapter<CharSequence> adapter;\n adapter = ArrayAdapter.createFromResource(getActivity(), R.array.kind_of_reaction, R.layout.item_spinner_healthbook);\n // Specify the layout to use when the list of choices appears\n adapter.setDropDownViewResource(R.layout.item_spinner_healthbook_dropdown);\n // Apply the adapter to the spinner\n kindOfReactionSpinner.setAdapter(adapter);\n }", "@Override\n\t\t\tpublic void onItemSelected(AdapterView<?> arg0, View arg1,\n\t\t\t\t\tint arg2, long arg3) {\n\t\t\t\tSpinner s = (Spinner) arg0;\n\t\t\t\tString city = (String) s.getItemAtPosition(arg2);\n\t\t\t\tif (city.equals(\"-城市-\")){\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tLog.i(\"省份\",sr1.getSelectedItem().toString());\n\t\t\t\tLog.i(\"城市\",city);\n\t\t\t\t\n\t\t\t\tString urlRealTime = \"https://api.seniverse.com/v3/weather/now.json?key=kuw7pbduduh35zvd&location=\"+city+\"&language=zh-Hans&unit=c\";\n\t\t\t\tOkHttpClient mOkHttpClientRealTime = new OkHttpClient();\n\t\t\t\tfinal Request requestRealTime = new Request.Builder()\n \t.url(urlRealTime)\n \t.build();\n\t\t\t\tCall callRealTime = mOkHttpClientRealTime.newCall(requestRealTime); \n\t\t\t\tcallRealTime.enqueue(new Callback(){\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onFailure(Request request, IOException e){\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t}\n\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onResponse(final Response response) throws IOException{\n\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\tGson gson = new Gson();\n\t\t\t\t\t\t\tWeatherRealTime weatherRealTime = gson.fromJson(response.body().string(), WeatherRealTime.class); \n\t\t\t\t\t\t\tList<com.example.weather.WeatherRealTime.ResultsBean> results = weatherRealTime.getResults();\n\t\t\t\t\t\t\tfinal String textRealTime = results.get(0).getNow().getText();\n\t\t\t\t\t\t\tfinal String temperatureRealTime = results.get(0).getNow().getTemperature();\n\t\t\t\t\t\t\tMainActivity.this.runOnUiThread(new Runnable(){\n\t\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t\t\ttextNow.setText(textRealTime);\n\t\t\t\t\t\t\t\t\ttempNow.setText(temperatureRealTime);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} catch (Exception e){\t\n\t\t\t\t\t\t\t e.printStackTrace();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tString htmlStr = response.body().string();\n\t\t\t\t\t\tLog.e(\"res\",htmlStr);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\tString url = \"https://api.seniverse.com/v3/weather/daily.json?key=kuw7pbduduh35zvd&location=\"+city+\"&language=zh-Hans&unit=c&start=0&days=3\";\n\t\t\t\tOkHttpClient mOkHttpClient = new OkHttpClient();\n\t\t\t\tfinal Request request = new Request.Builder()\n \t.url(url)\n \t.build();\n\t\t\t\t\t//new call\n\t\t\t\tCall call = mOkHttpClient.newCall(request); \n\t\t\t\t//请求加入调度\n\t\t\t\tcall.enqueue(new Callback(){\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onFailure(Request request, IOException e){\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t}\n\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onResponse(final Response response) throws IOException{\n\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\tGson gson = new Gson();\n\t\t\t\t\t\t\tWeather weather = gson.fromJson(response.body().string(), Weather.class); \n\t\t\t\t\t\t\tList<ResultsBean> results = weather.getResults();\n\t\t\t\t\t\t\tfinal List<DailyBean> daily = results.get(0).getDaily();\n\t\t\t\t\t\t\tLog.e(\"high:\",daily.get(0).getHigh());\n\t\t\t\t\t\t\tMainActivity.this.runOnUiThread(new Runnable(){\n\t\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\t\t\t\t\tday1.setText(daily.get(0).getText_day());\n\t\t\t\t\t\t\t\t\ttemp1.setText(daily.get(0).getHigh()+\"° / \"+daily.get(0).getLow()+\"°\");\n\t\t\t\t\t\t\t\t\tday2.setText(daily.get(1).getText_day());\n\t\t\t\t\t\t\t\t\ttemp2.setText(daily.get(1).getHigh()+\"° / \"+daily.get(1).getLow()+\"°\");\n\t\t\t\t\t\t\t\t\tday3.setText(daily.get(2).getText_day());\n\t\t\t\t\t\t\t\t\ttemp3.setText(daily.get(2).getHigh()+\"° / \"+daily.get(2).getLow()+\"°\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} catch (Exception e){\t\n\t\t\t\t\t\t\t e.printStackTrace();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}); \n\t\t\t}", "@SuppressLint(\"SetTextI18n\")\r\n @Override\r\n public void onClick(View view) {\n\r\n s1 = spinner[0].getSelectedItem().toString();\r\n s2 = spinner2[0].getSelectedItem().toString();\r\n Toast.makeText(dashboard.this, s1 + \" to \" + s2, Toast.LENGTH_SHORT).show();\r\n\r\n\r\n if (\"Mumbai\".equals(s1) && \"Mumbai\".equals(s2)) {\r\n tokens.setText(\"0 Tokens\");\r\n amount.setText(\"0\");\r\n }\r\n if (\"Mumbai\".equals(s1) && \"Panvel\".equals(s2)) {\r\n tokens.setText(\"3 Tokens\");\r\n amount.setText(\"100\");\r\n\r\n\r\n }\r\n if (\"Mumbai\".equals(s1) && \"Thane\".equals(s2)) {\r\n tokens.setText(\"1 Tokens\");\r\n amount.setText(\"40\");\r\n\r\n\r\n }\r\n if (\"Mumbai\".equals(s1) && \"Pune\".equals(s2)) {\r\n tokens.setText(\"3 Tokens\");\r\n amount.setText(\"120\");\r\n\r\n\r\n }\r\n if (\"Mumbai\".equals(s1) && \"Ratnagiri\".equals(s2)) {\r\n tokens.setText(\"5 Tokens\");\r\n amount.setText(\"150\");\r\n\r\n }\r\n if (\"Panvel\".equals(s1) && \"Panvel\".equals(s2)) {\r\n tokens.setText(\"0 Tokens\");\r\n amount.setText(\"0\");\r\n }\r\n if (\"Panvel\".equals(s1) && \"Thane\".equals(s2)) {\r\n tokens.setText(\"2 Tokens\");\r\n amount.setText(\"80\");\r\n }\r\n if (\"Panvel\".equals(s1) && \"Pune\".equals(s2)) {\r\n tokens.setText(\"3 Tokens\");\r\n amount.setText(\"120\");\r\n }\r\n if (\"Panvel\".equals(s1) && \"Ratnagiri\".equals(s2)) {\r\n tokens.setText(\"4 Tokens\");\r\n amount.setText(\"140\");\r\n\r\n }\r\n if (\"Panvel\".equals(s1) && \"Mumbai\".equals(s2)) {\r\n tokens.setText(\"3 Tokens\");\r\n amount.setText(\"100\");\r\n\r\n\r\n }\r\n if (\"Thane\".equals(s1) && \"Thane\".equals(s2)) {\r\n tokens.setText(\"0 Tokens\");\r\n }\r\n if (\"Thane\".equals(s1) && \"Pune\".equals(s2)) {\r\n tokens.setText(\"4 Tokens\");\r\n amount.setText(\"150\");\r\n\r\n\r\n }\r\n if (\"Thane\".equals(s1) && \"Ratnagiri\".equals(s2)) {\r\n tokens.setText(\"6 Tokens\");\r\n amount.setText(\"180\");\r\n\r\n }\r\n if (\"Thane\".equals(s1) && \"Mumbai\".equals(s2)) {\r\n tokens.setText(\"1 Tokens\");\r\n amount.setText(\"40\");\r\n\r\n\r\n }\r\n if (\"Thane\".equals(s1) && \"Panvel\".equals(s2)) {\r\n tokens.setText(\"2 Tokens\");\r\n amount.setText(\"80\");\r\n\r\n }\r\n if (\"Pune\".equals(s1) && \"Thane\".equals(s2)) {\r\n tokens.setText(\"4 Tokens\");\r\n amount.setText(\"160\");\r\n\r\n }\r\n if (\"Pune\".equals(s1) && \"Pune\".equals(s2)) {\r\n tokens.setText(\"0 Tokens\");\r\n amount.setText(\"0\");\r\n\r\n }\r\n if (\"Pune\".equals(s1) && \"Ratnagiri\".equals(s2)) {\r\n tokens.setText(\"3 Tokens\");\r\n amount.setText(\"120\");\r\n\r\n }\r\n if (\"Pune\".equals(s1) && \"Mumbai\".equals(s2)) {\r\n tokens.setText(\"4 Tokens\");\r\n amount.setText(\"150\");\r\n\r\n }\r\n if (\"Pune\".equals(s1) && \"Panvel\".equals(s2)) {\r\n tokens.setText(\"4 Tokens\");\r\n amount.setText(\"160\");\r\n\r\n }\r\n if (\"Ratnagiri\".equals(s1) && \"Thane\".equals(s2)) {\r\n tokens.setText(\"6 Tokens\");\r\n amount.setText(\"180\");\r\n\r\n\r\n }\r\n if (\"Ratnagiri\".equals(s1) && \"Pune\".equals(s2)) {\r\n tokens.setText(\"4 Tokens\");\r\n amount.setText(\"160\");\r\n\r\n }\r\n if (\"Ratnagiri\".equals(s1) && \"Ratnagiri\".equals(s2)) {\r\n tokens.setText(\"0 Tokens\");\r\n amount.setText(\"0\");\r\n }\r\n if (\"Ratnagiri\".equals(s1) && \"Mumbai\".equals(s2)) {\r\n tokens.setText(\"6 Tokens\");\r\n amount.setText(\"180\");\r\n\r\n }\r\n if (\"Ratnagiri\".equals(s1) && \"Panvel\".equals(s2)) {\r\n tokens.setText(\"5 Tokens\");\r\n amount.setText(\"150\");\r\n\r\n }\r\n if (\"Select Source Location\".equals(s1) || \"Select Destination Location\".equals(s2)) {\r\n Toast.makeText(dashboard.this, \" Please Choose both Source and Destination \", Toast.LENGTH_SHORT).show();\r\n\r\n }\r\n\r\n\r\n }", "private void setUpSpinner(){\n ArrayAdapter paymentSpinnerAdapter =ArrayAdapter.createFromResource(this,R.array.array_gender_option,android.R.layout.simple_spinner_item);\n\n // Specify dropdown layout style - simple list view with 1 item per line, then apply adapter to the spinner\n paymentSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);\n mPaymentSpinner.setAdapter(paymentSpinnerAdapter);\n\n // To set the spinner to the selected payment method by the user when clicked from cursor adapter.\n if (payMode != null) {\n if (payMode.equalsIgnoreCase(\"COD\")) {\n mPaymentSpinner.setSelection(0);\n } else {\n mPaymentSpinner.setSelection(1);\n }\n mPaymentSpinner.setOnTouchListener(mTouchListener);\n }\n\n mPaymentSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n String selectedPayment = (String)parent.getItemAtPosition(position);\n if(!selectedPayment.isEmpty()){\n if(selectedPayment.equals(getString(R.string.payment_cod))){\n mPaymentMode = clientContract.ClientInfo.PAYMENT_COD; // COD = 1\n }else{\n\n mPaymentMode = clientContract.ClientInfo.PAYMENT_ONLINE; // ONLINE = 0\n }\n }\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n\n }", "public void addItemsOnSpinner() {\r\n\r\n\tspinner = (Spinner) findViewById(R.id.spinner);\r\n\tList<String> list = new ArrayList<String>();\r\n\tlist.add(\"Food\");\r\n\tlist.add(\"RentHouse\");\r\n\tlist.add(\"Closing\");\r\n\tlist.add(\"Party\");\r\n\tlist.add(\"Material\");\r\n\tArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, list);\r\n\tdataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\r\n\tspinner.setAdapter(dataAdapter);\r\n }", "private void itemtypeSpinner() {\n ArrayAdapter<CharSequence> staticAdapter = ArrayAdapter\n .createFromResource(getContext(), R.array.select_array,\n android.R.layout.simple_spinner_item);\n\n // Specify the layout to use when the list of choices appears\n staticAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n\n // Apply the adapter to the spinner\n mItemTypeSpinnerA2.setAdapter(staticAdapter);\n\n mItemTypeSpinnerA2.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view,\n int position, long id) {\n String itemtypeText = (String) parent.getItemAtPosition(position);\n if (itemtypeText.equals(\"Mobile Phones\")) {\n\n mInputLayoutSerialNoA2.setVisibility(View.VISIBLE);\n mInputLayoutSerialNoA2.setClickable(true);\n mInputLayoutItemImeiA2.setVisibility(View.VISIBLE);\n mInputLayoutItemImeiA2.setClickable(true);\n\n\n } else if (itemtypeText.equals(\"Laptops\")) {\n\n mInputLayoutSerialNoA2.setVisibility(View.VISIBLE);\n mInputLayoutSerialNoA2.setClickable(true);\n mInputLayoutItemImeiA2.setVisibility(View.GONE);\n mInputLayoutItemImeiA2.setClickable(false);\n\n } else {\n mInputLayoutSerialNoA2.setVisibility(View.GONE);\n mInputLayoutSerialNoA2.setClickable(false);\n mInputLayoutItemImeiA2.setVisibility(View.GONE);\n mInputLayoutItemImeiA2.setClickable(false);\n }\n\n\n\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n mItemTypeSpinnerA2.getItemAtPosition(0);\n mInputLayoutSerialNoA2.setVisibility(View.GONE);\n mInputLayoutSerialNoA2.setClickable(false);\n mInputLayoutItemImeiA2.setVisibility(View.GONE);\n mInputLayoutItemImeiA2.setClickable(false);\n\n\n }\n });\n\n }", "@Override\n public void onClick(View view) {\n alert = new AlertDialog.Builder(x);\n LinearLayout lila1 = new LinearLayout(x);\n lila1.setOrientation(LinearLayout.VERTICAL); //1 is for vertical orientation\n /* final Spinner spin = new Spinner(x);\n spin.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {\n\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> adapterView) {\n\n }\n });\n SpinnerAdapter customAdapter=new SpinnerAdapter(getApplicationContext());\n spin.setAdapter(customAdapter);*/\n final EditText input = new EditText(x);\n input.setHint(\"Name\");\n final EditText input1 = new EditText(x);\n input1.setHint(\"Phone\");\n final EditText input2 = new EditText(x);\n input2.setHint(\"Address\");\n final EditText input3 = new EditText(x);\n input3.setHint(\"Bithdate\");\n final EditText input4 = new EditText(x);\n input4.setHint(\"Group\");\n\n\n\n lila1.addView(input);\n lila1.addView(input1);\n lila1.addView(input2);\n lila1.addView(input3);\n lila1.addView(input4);\n alert.setView(lila1);\n\n alert.setTitle(\"Add contact\");\n\n alert.setPositiveButton(\"Ok\", (dialog, whichButton) -> {\n name = input.getText().toString();\n phone = input1.getText().toString();\n String ad = input2.getText().toString();\n String birth = input3.getText().toString();\n String group = input4.getText().toString();\n ar.add(new Contact(name, phone,ad,birth,group,R.drawable.man_3));\n mRoomModule.getmRepository().insertEndMethod(ar);\n mRoomModule.getmRepository().getmAllContacts().observeForever(contacts -> {\n products.clear();\n products.addAll(contacts);\n boxAdapter = new BoxAdapter(getBaseContext(), products);\n lvMain.setAdapter(boxAdapter);\n });\n products.addAll(ar);\n ar.clear();\n boxAdapter.notifyDataSetChanged();\n Toast.makeText(getApplicationContext(), name, Toast.LENGTH_SHORT).show();\n\n });\n alert.setNegativeButton(\"Cancel\",\n new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int whichButton) {\n\n dialog.cancel();\n }\n });\n\n alert.show();\n }", "@Override\n public void onResponse(String s) {\n Log.d(TAG, \"Form Response: \" + s);\n // create new toast to confirm user about demand generation\n Toast.makeText(context, context.getResources().getString(R.string.demand_generation) + itemName,\n Toast.LENGTH_LONG).show();\n\n }", "@Override\n\t\t\tpublic void onItemSelected(AdapterView<?> arg0, View arg1,\n\t\t\t\t\tint position, long id) {\n\t\t\t\t\n\t\t\t\tnameoffriend = sp.getItemAtPosition(position).toString();\n\t\t\t\tToast.makeText(getApplicationContext(), nameoffriend, Toast.LENGTH_SHORT).show();\n\t\t\t}", "@Override\n public void onResponse(JSONObject jsonobj) {\n dialog.dismiss();\n try {\n JSONArray jArray=jsonobj.getJSONArray(\"rows\");\n JSONObject jData;\n list=new ArrayList<String>();\n listId=new ArrayList<String>();\n for (int i=0;i<jArray.length();i++){\n jData=jArray.getJSONObject(i);\n int Seq=jData.getInt(\"Seq\");\n if(Seq>0){\n list.add(jData.getString(\"LineName\"));\n listId.add(jData.getString(\"LineCode\"));\n }\n\n }\n\n if(listId.size()>0){\n initData(myDate,listId.get(index));\n initData02(listId.get(index));\n }\n\n niceSpinner.attachDataSource(list);\n\n //niceSpinner.attachDataSource(list);\n\n //loadPatrolTask(listId.get(0));\n } catch (JSONException e) {\n e.printStackTrace();\n }\n\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)\n {\n View v = inflater.inflate(R.layout.fragment_customer_information, container, false);\n\n mtypeadapter= ArrayAdapter.createFromResource(getActivity(),\n R.array.mtype_array, android.R.layout.simple_spinner_item);\n mtypeadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n mtrtypespinner=(Spinner)v.findViewById(R.id.mtype_spinner);\n mtrtypespinner.setAdapter(mtypeadapter);\n\n ctratioadapter= ArrayAdapter.createFromResource(getActivity(),\n R.array.cct_ratio_array, android.R.layout.simple_spinner_item);\n ctratioadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n ctratiospinner=(Spinner)v.findViewById(R.id.ctratio_spinner);\n ctratiospinner.setAdapter(ctratioadapter);\n\n cttypeadapter= ArrayAdapter.createFromResource(getActivity(),\n R.array.type_array, android.R.layout.simple_spinner_item);\n cttypeadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n cttypespinner=(Spinner)v.findViewById(R.id.type_spinner);\n cttypespinner.setAdapter(cttypeadapter);\n\n cctratioadapter= ArrayAdapter.createFromResource(getActivity(),\n R.array.cct_ratio_array, android.R.layout.simple_spinner_item);\n cctratioadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n cctratiospinner=(Spinner)v.findViewById(R.id.cct_ratio_spinner);\n cctratiospinner.setAdapter(cctratioadapter);\n\n change=(Button)v.findViewById(R.id.change);\n change.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View arg0)\n {\n openAlert(change);\n }\n });\n\n ctratiolinear=(LinearLayout)v.findViewById(R.id.ctratiolinear);\n ctdetailslayout=(LinearLayout)v.findViewById(R.id.ctdetailslayout);\n typelinear=(LinearLayout)v.findViewById(R.id.typelinear);\n cctratiolinear=(LinearLayout)v.findViewById(R.id.cctratiolinear);\n makelinear=(LinearLayout)v.findViewById(R.id.makelinear);\n\n mtrtypespinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener()\n {\n @Override\n public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {\n\n selectionPosition= mtypeadapter.getPosition(mtrtypespinner.getSelectedItem().toString());\n\n if (mtrtypespinner.getSelectedItem().toString().equals(\"WHOLE\"))\n {\n ctratiolinear.setVisibility(LinearLayout.GONE);\n ctdetailslayout.setVisibility(LinearLayout.GONE);\n typelinear.setVisibility(LinearLayout.GONE);\n cctratiolinear.setVisibility(LinearLayout.GONE);\n makelinear.setVisibility(LinearLayout.GONE);\n }\n else if(mtrtypespinner.getSelectedItem().toString().equals(\"Select\"))\n {\n ctratiolinear.setVisibility(LinearLayout.GONE);\n ctdetailslayout.setVisibility(LinearLayout.GONE);\n typelinear.setVisibility(LinearLayout.GONE);\n cctratiolinear.setVisibility(LinearLayout.GONE);\n makelinear.setVisibility(LinearLayout.GONE);\n }\n else\n {\n ctratiolinear.setVisibility(View.VISIBLE);\n ctdetailslayout.setVisibility(View.VISIBLE);\n typelinear.setVisibility(View.VISIBLE);\n cctratiolinear.setVisibility(View.VISIBLE);\n makelinear.setVisibility(View.VISIBLE);\n }\n String metertypespinner = mtrtypespinner.getSelectedItem().toString();\n PageConsumerEntity.setMeterType(metertypespinner);\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> adapterView)\n {\n }\n });\n\n ctratiospinner= (Spinner) v.findViewById(R.id.ctratio_spinner);\n ctratiospinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n\n @Override\n public void onItemSelected(AdapterView<?> arg0, View arg1,\n int arg2, long arg3) {\n String ctrationspinner = ctratiospinner.getSelectedItem().toString();\n PageConsumerEntity.setCTRatio(ctrationspinner);\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> arg0) {\n // TODO Auto-generated method stub\n PageConsumerEntity.setCTRatio(\" \");\n }\n });\n\n cttypespinner= (Spinner) v.findViewById(R.id.type_spinner);\n cttypespinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n\n @Override\n public void onItemSelected(AdapterView<?> arg0, View arg1,\n int arg2, long arg3) {\n String typespinner = cttypespinner.getSelectedItem().toString();\n PageConsumerEntity.setCTType(typespinner);\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> arg0) {\n // TODO Auto-generated method stub\n PageConsumerEntity.setCTType(\" \");\n }\n });\n\n cctratiospinner= (Spinner) v.findViewById(R.id.cct_ratio_spinner);\n cctratiospinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n\n @Override\n public void onItemSelected(AdapterView<?> arg0, View arg1,\n int arg2, long arg3) {\n String cctrtospinner = cctratiospinner.getSelectedItem().toString();\n PageConsumerEntity.setCCTRatio(cctrtospinner);\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> arg0) {\n // TODO Auto-generated method stub\n PageConsumerEntity.setCCTRatio(\" \");\n }\n });\n\n nxtbtn=(Button)v.findViewById(R.id.nextbtn);\n nxtbtn.setOnClickListener(this);\n\n PageConsumerEntity = ((ConsumerInfo) getActivity().getApplicationContext()).getConsumerDetails();\n\n cnsmrno= (EditText) v.findViewById(R.id.cnsmrno);\n cnsmrno.setText(new String(PageConsumerEntity.getCustomerNo()));\n\n cnsmrname= (EditText) v.findViewById(R.id.cnsmrname);\n cnsmrname.setText(new String(PageConsumerEntity.getCustomerName()));\n\n aliasname= (EditText) v.findViewById(R.id.aliasname);\n aliasname.setText(new String(PageConsumerEntity.getAliasName()));\n\n cntctno1= (EditText) v.findViewById(R.id.cntcno1);\n cntctno1.setText(new String(PageConsumerEntity.getContactNo1()));\n\n cntctno2= (EditText) v.findViewById(R.id.cntcno2);\n if(PageConsumerEntity.getContactNo2() == null)\n {\n cntctno2.setText(\"\");\n }\n else\n {\n cntctno2.setText(new String(PageConsumerEntity.getContactNo2()));\n }\n\n cntctno3= (EditText) v.findViewById(R.id.cntcno3);\n if(PageConsumerEntity.getContactNo3() == null)\n {\n cntctno3.setText(\"\");\n }\n else\n {\n cntctno3.setText(new String(PageConsumerEntity.getContactNo3()));\n }\n\n cntctprsn= (EditText) v.findViewById(R.id.cntcprsn);\n if(PageConsumerEntity.getContactPerson() == null)\n {\n cntctprsn.setText(\"\");\n }\n else\n {\n cntctprsn.setText(new String(PageConsumerEntity.getContactPerson()));\n }\n\n email= (EditText) v.findViewById(R.id.email);\n if(PageConsumerEntity.getEmail() == null)\n {\n email.setText(\"\");\n }\n else\n {\n email.setText(new String(PageConsumerEntity.getEmail()));\n }\n\n location= (EditText) v.findViewById(R.id.location);\n location.setText(new String(PageConsumerEntity.getLandmark()));\n\n mno= (EditText) v.findViewById(R.id.mno);\n mno.setText(new String(PageConsumerEntity.getPreMNO()));\n\n make= (EditText) v.findViewById(R.id.make);\n make.setText(new String(PageConsumerEntity.getPreMake()));\n\n String meterTypeValue = PageConsumerEntity.getMeterType();\n if (!meterTypeValue.equals(null)) {\n int spinnerPosition = mtypeadapter.getPosition(meterTypeValue);\n mtrtypespinner.setSelection(spinnerPosition);\n }\n\n String ctRatioValue = PageConsumerEntity.getCTRatio();\n if (ctRatioValue == null)\n {\n ctratiospinner.setSelection(0);\n }\n else\n {\n if (!ctRatioValue.equals(null))\n {\n int spinnerPosition = ctratioadapter.getPosition(ctRatioValue);\n ctratiospinner.setSelection(spinnerPosition);\n }\n }\n\n String ctTypeValue = PageConsumerEntity.getCTType();\n if (ctTypeValue == null)\n {\n cttypespinner.setSelection(0);\n }\n else\n {\n if (!ctTypeValue.equals(null))\n {\n int spinnerPosition = cttypeadapter.getPosition(ctTypeValue);\n cttypespinner.setSelection(spinnerPosition);\n }\n }\n\n String cctRatioValue = PageConsumerEntity.getCCTRatio();\n if (cctRatioValue == null)\n {\n cctratiospinner.setSelection(0);\n }\n else\n {\n if (!cctRatioValue.equals(null))\n {\n int spinnerPosition = cctratioadapter.getPosition(cctRatioValue);\n cctratiospinner.setSelection(spinnerPosition);\n }\n }\n\n ctmake= (EditText) v.findViewById(R.id.make1);\n if(PageConsumerEntity.getCTMake() == null)\n {\n ctmake.setText(\"\");\n }\n else\n {\n ctmake.setText(new String(PageConsumerEntity.getCTMake()));\n }\n\n l1c= (EditText) v.findViewById(R.id.l1c);\n if(PageConsumerEntity.getL1C() == null)\n {\n l1c.setText(\"\");\n }\n else\n {\n l1c.setText(new String(PageConsumerEntity.getL1C()));\n }\n\n l1d= (EditText) v.findViewById(R.id.l1d);\n if(PageConsumerEntity.getL1D() == null)\n {\n l1d.setText(\"\");\n }\n else\n {\n l1d.setText(new String(PageConsumerEntity.getL1D()));\n }\n\n l2c= (EditText) v.findViewById(R.id.l2c);\n if(PageConsumerEntity.getL2C() == null)\n {\n l2c.setText(\"\");\n }\n else\n {\n l2c.setText(new String(PageConsumerEntity.getL2C()));\n }\n\n l2d= (EditText) v.findViewById(R.id.l2d);\n if(PageConsumerEntity.getL2D() == null)\n {\n l2d.setText(\"\");\n }\n else\n {\n l2d.setText(new String(PageConsumerEntity.getL2D()));\n }\n\n l3c= (EditText) v.findViewById(R.id.l3c);\n if(PageConsumerEntity.getL3C() == null)\n {\n l3c.setText(\"\");\n }\n else\n {\n l3c.setText(new String(PageConsumerEntity.getL3C()));\n }\n\n l3d= (EditText) v.findViewById(R.id.l3d);\n if(PageConsumerEntity.getL3D() == null)\n {\n l3d.setText(\"\");\n }\n else\n {\n l3d.setText(new String(PageConsumerEntity.getL3D()));\n }\n\n if(back == 1)\n {\n// String meterTypeValue = PageConsumerEntity.getMeterType();\n if (!meterTypeValue.equals(null)) {\n int spinnerPosition = mtypeadapter.getPosition(meterTypeValue);\n mtrtypespinner.setSelection(spinnerPosition);\n }\n\n // String ctRatioValue = PageConsumerEntity.getCTRatio();\n if (!ctRatioValue.equals(null)) {\n int spinnerPosition = ctratioadapter.getPosition(ctRatioValue);\n ctratiospinner.setSelection(spinnerPosition);\n }\n\n // String ctTypeValue = PageConsumerEntity.getCTType();\n if (!ctTypeValue.equals(null)) {\n int spinnerPosition = cttypeadapter.getPosition(ctTypeValue);\n cttypespinner.setSelection(spinnerPosition);\n }\n\n // String cctRatioValue = PageConsumerEntity.getCCTRatio();\n if (!cctRatioValue.equals(null)) {\n int spinnerPosition = cctratioadapter.getPosition(cctRatioValue);\n cctratiospinner.setSelection(spinnerPosition);\n }\n\n ctmake.setText(new String(PageConsumerEntity.getCTMake()));\n\n l1c.setText(new String(PageConsumerEntity.getL1C()));\n\n l1d.setText(new String(PageConsumerEntity.getL1D()));\n\n l2c.setText(new String(PageConsumerEntity.getL2C()));\n\n l2d.setText(new String(PageConsumerEntity.getL2D()));\n\n l3c.setText(new String(PageConsumerEntity.getL3C()));\n\n l3d.setText(new String(PageConsumerEntity.getL3D()));\n }\n\n return v;\n }", "@Override\n public void onResponse(JSONObject response) {\n try {\n NumberFormat rupiah = NumberFormat.getInstance(Locale.GERMANY);\n textBalancep.setText(rupiah.format(response.getDouble(\"aset\")));\n\n JSONArray jsonArray = response.getJSONArray(\"hasil1\");\n for (int i=0; i <2;i++){\n JSONObject jsonObject;\n jsonObject = jsonArray.getJSONObject(i);\n HashMap<String, String> map = new HashMap<>();\n map.put(\"id1\", jsonObject.getString(\"id1\"));\n map.put(\"status1\", jsonObject.getString(\"status1\"));\n map.put(\"jumlah1\", jsonObject.getString(\"jumlah1\"));\n map.put(\"nama1\", jsonObject.getString(\"nama1\"));\n map.put(\"tanggal1\", jsonObject.getString(\"tanggal1\"));\n map.put(\"tanggal21\", jsonObject.getString(\"tanggal21\"));\n\n arusPiutang.add(map);\n }\n adapterReadP();\n }catch (JSONException e){\n e.printStackTrace();\n }\n }", "private void addNewSpinnerItem4() \n\t{\n\t\tmscust=ecust.getText().toString();\n\t\tCharSequence textHolder = \"\" +mscust; \n\t\tadapterpah.insert(textHolder, 0);\n\t\tspah.setAdapter(adapterpah);\n\t}", "public void addItemsToSpinner(){\n spinner = (Spinner) findViewById(R.id.newEvent_spinner_notification);\n spinner.setOnItemSelectedListener(new SpinnerActivity());\n ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,\n R.array.arrray_notification, android.R.layout.simple_spinner_item);\n adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n spinner.setAdapter(adapter);\n }", "@Override\n\t\t\t\t\t\tpublic void onItemSelected(AdapterView<?> parent,\n\t\t\t\t\t\t\t\tView view, int position, long id) {\n\t\t\t\t\t\t\tif(position!=0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tMyspinner sp = (Myspinner)mandilist.getSelectedItem();\n\t\t\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\t\t\tencryptedgeoid = new Webservicerequest().Encrypt(sp.getValue());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcatch(Exception e){\n\t\t\t\t\t\t\t\t\te.getMessage();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcategory3.addAll(get.getretailersList(encryptedgeoid));\t\n\t\t\t\t\t\t\t\tMyspinner[] redemo3 = new Myspinner[category3.size()];\n\t\t\t\t \t\t\t\tfor(int i=0; i<category3.size(); i++){\n\t\t\t\t \t\t\t\t\tredemo3[i] = new Myspinner(category3.get(i).get(\"2\"), category3.get(i).get(\"1\"), \"\");\n\t\t\t\t \t\t\t\t}\n\t\t\t\t \t\t\t\tArrayAdapter<Myspinner> adapter3 = new ArrayAdapter<Myspinner>(context, android.R.layout.simple_spinner_dropdown_item, redemo3);\n\t\t\t\t \t\t\t\tretailerslist.setAdapter(adapter3);\n\t\t\t\t\t\t\t\tArrayAdapter<String> adaptervillages = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_dropdown_item, get.getVillageNames(encryptedgeoid));\n\t\t\t\t\t\t\t\tvillages.setAdapter(adaptervillages);\n\t\t\t\t\t\t\t\tvillages.setThreshold(3);\n\t\t\t\t\t\t\t\tvillages.setOnItemClickListener(new OnItemClickListener() {\n\n\t\t\t\t\t\t\t\t\t @Override\n\t\t\t\t\t\t\t\t\t public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {\n\t\t\t\t\t\t\t\t\t InputMethodManager in = (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);\n\t\t\t\t\t\t\t\t\t in.hideSoftInputFromWindow(villages.getWindowToken(), 0);\n\n\t\t\t\t\t\t\t\t\t }\n\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t\tvillages.setAdapter(null);\n\t\t\t\t\t\t\t\tArrayList<HashMap<String, String>> category3=new ArrayList<HashMap<String,String>>();\n\t\t\t\t\t\t\t\tHashMap<String, String> map3=new HashMap<String, String>();\n\t\t\t\t \t\t\t\tmap3.put(\"1\",\"\");\n\t\t\t\t \t\t\t\tmap3.put(\"2\",\"Select Retailer\");\n\t\t\t\t \t\t\t\tcategory3.add(map3);\n\t\t\t\t \t\t\t\tMyspinner[] redemo3 = new Myspinner[category3.size()];\n\t\t\t\t \t\t\t\tfor(int i=0; i<category3.size(); i++){\n\t\t\t\t \t\t\t\t\tredemo3[i] = new Myspinner(category3.get(i).get(\"2\"), category3.get(i).get(\"1\"), \"\");\n\t\t\t\t \t\t\t\t}\n\t\t\t\t \t\t\t\tArrayAdapter<Myspinner> adapter3 = new ArrayAdapter<Myspinner>(context, android.R.layout.simple_spinner_dropdown_item, redemo3);\n\t\t\t\t \t\t\t\tretailerslist.setAdapter(adapter3); \t\t\t\t \t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}", "@Override\n public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {\n String taskType = adapterView.getItemAtPosition(i).toString();\n Log.d(TAG, \"SPINNER: \" + taskType);\n\n\n String[] tasks = getResources().getStringArray(R.array.tasktypelist);\n\n if (tasks.length > 0 && taskType.equals(tasks[0])) {\n taskParamsLayout.removeAllViews();\n\n piPointsNo = new EditText(MainActivity.this);\n piPointsNo.setInputType(InputType.TYPE_CLASS_NUMBER);\n piPointsNo.setHint(R.string.taskpi_help_points);\n\n taskParamsLayout.addView(piPointsNo);\n\n }\n\n else if (tasks.length > 1 && taskType.equals(tasks[1])) {\n taskParamsLayout.removeAllViews();\n\n Message msg=new Message();\n msg.obj=\"Wait! This task is a false one! :( \";\n toastHandler.sendMessage(msg);\n }\n\n else if (tasks.length > 2 && taskType.equals(tasks[2])) {\n taskParamsLayout.removeAllViews();\n\n Message msg=new Message();\n msg.obj=\"Wait! This task is a false one! :( \";\n toastHandler.sendMessage(msg);\n }\n\n }", "public void spinner() {\n /**\n * calls if the tasks was weekly, if not, it will be automatically set to \"once\"\n */\n if(weekly) {\n String[] items = new String[]{activity.getResources().getString(R.string.sunday), activity.getResources().getString(R.string.monday), activity.getResources().getString(R.string.tuesday), activity.getResources().getString(R.string.wednesday), activity.getResources().getString(R.string.thursday), activity.getResources().getString(R.string.friday), activity.getResources().getString(R.string.saturday)};\n ArrayAdapter<String> frequencyAdapter = new ArrayAdapter<String>(activity.getBaseContext(), android.R.layout.simple_spinner_dropdown_item, items);\n weekday.setAdapter(frequencyAdapter);\n weekday.getBackground().setColorFilter(activity.getResources().getColor(R.color.colorAccent), PorterDuff.Mode.SRC_ATOP);\n weekday.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n\n day = String.valueOf(position + 1); //chosen day is stored\n\n }\n\n\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n\n }\n });\n } else {\n day = \"8\";\n weekday.setVisibility(View.GONE);\n }\n }", "@Override\n public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {\n brand_id = String.valueOf(brand_list.get(i).getBrandId());\n brandName = brand_list.get(i).getBrand_name();\n\n Log.d(\"fsdklj\", brand_id + brandName);\n\n hitSpinnerSeries(brand_id);\n\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n view=inflater.inflate(R.layout.fragment_choose_template_operation, container, false);\n getNumberOfChannel=(LinearLayout)view.findViewById(R.id.layoutOfGetChannelNumber);\n getNumberOfChannel.setVisibility(View.INVISIBLE);\n NoDefaultSpinner spinner = (NoDefaultSpinner) view.findViewById(R.id.spinnerOfActivity);\n ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity(),\n R.array.Activity_array, android.R.layout.simple_spinner_item);\n adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n spinner.setAdapter(adapter,\"فرآیند را انتخاب کنید\");\n spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n\n public void onItemSelected(AdapterView<?> parent, View view1,\n int position, long id) {\n\n switch(position){\n case 0:\n TextView textOfGetChannelNumber= (TextView) view.findViewById(R.id.textViewOfGetChannelNumber);\n state=1;\n textOfGetChannelNumber.setText(\"شماره کانال مورد نظر برای روشن کردن را انتخاب کرده و دکمه مرحله بعد را بفشارید:\");\n getNumberOfChannel.setVisibility(View.VISIBLE);\n break;\n case 1:\n TextView textOfGetChannelNumber1= (TextView) view.findViewById(R.id.textViewOfGetChannelNumber);\n state=2;\n textOfGetChannelNumber1.setText(\"شماره کانال مورد نظر برای خاموش کردن را انتخاب کرده و دکمه مرحله بعد را بفشارید:\");\n getNumberOfChannel.setVisibility(View.VISIBLE);\n break;\n case 2:\n TextView textOfGetChannelNumber2= (TextView) view.findViewById(R.id.textViewOfGetChannelNumber);\n state=3;\n textOfGetChannelNumber2.setText(\"شماره کانال مورد نظر برای دریافت گزارش را انتخاب کرده و دکمه مرحله بعد را بفشارید:\");\n getNumberOfChannel.setVisibility(View.VISIBLE);\n break;\n case 3:\n state=4;\n getNumberOfChannel.setVisibility(View.INVISIBLE);\n// TextView textOfGetChannelNumber3= (TextView) findViewById(R.id.textViewOfGetChannelNumber);\n// NoDefaultSpinner spinner3 = (NoDefaultSpinner) findViewById(R.id.spinnerOfGetChannelNumber);\n// getNumberOfChannel.setVisibility(View.VISIBLE);\n// textOfGetChannelNumber3.setVisibility(View.INVISIBLE);\n// spinner3.setVisibility(View.INVISIBLE);\n// //Button button1=(Button)findViewById(R.id.buttonofCallDevice);\n // button1.setVisibility(View.VISIBLE);\n //setIntentToNextPage(\"configDevice\");\n break;\n default:\n\n }\n\n // Log.v(\"item........... :\", (String) parent.getItemAtPosition(position)+\" switch : \"+ simpleSwitch.isChecked());\n }\n\n\n public void onNothingSelected(AdapterView<?> parent) {\n Log.v(\"item........... :\", \"nothing Selected\");\n // TODO Auto-generated method stub\n }\n });\n NoDefaultSpinner spinner2 = (NoDefaultSpinner) view.findViewById(R.id.spinnerOfGetChannelNumber);\n ArrayAdapter<CharSequence> adapter2 = ArrayAdapter.createFromResource(getActivity(),\n R.array.channelNumber_array, android.R.layout.simple_spinner_item);\n adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n spinner2.setAdapter(adapter2,\"کانال را انتخاب کنید:\");\n spinner2.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n\n public void onItemSelected(AdapterView<?> parent, View view,\n int position, long id) {\n numberOfChannel=String.valueOf(position+1);\n }\n\n\n public void onNothingSelected(AdapterView<?> parent) {\n numberOfChannel=String.valueOf(-1);\n }\n });\n return view;\n }", "@Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n et_country = CountryNameSpinner.getSelectedItem().toString();\n et_mcode.setText(\"+\"+CountriesCode.get(position));\n }", "private void getDeviceSpinner() {\n\n StringRequest stringRequest = new StringRequest(\"https://cardtest10.000webhostapp.com/Sync_Spinner_D.php\", new Response.Listener<String>() {\n @Override\n public void onResponse(String response) {\n\n try{\n\n JSONObject jsonResponse = new JSONObject(response);\n JSONArray jsonArraytask = jsonResponse.getJSONArray(\"device\");\n\n for(int i=0; i < jsonArraytask.length(); i++)\n {\n JSONObject jsonObjecttask = jsonArraytask.getJSONObject(i);\n String task = jsonObjecttask.optString(\"Device_Type\");\n arrayDeviceType.add(task);\n }\n\n }catch (JSONException e){\n e.printStackTrace();\n }\n\n // Applying the adapter to our spinner\n spDeviceModel.setAdapter(new ArrayAdapter <>(UserAreaActivity.this, android.R.layout.simple_spinner_dropdown_item, arrayDeviceType));\n }\n },\n new Response.ErrorListener() {\n @Override\n public void onErrorResponse(VolleyError error) {\n Toast.makeText(UserAreaActivity.this, error + \"\", Toast.LENGTH_SHORT).show();\n }\n });\n\n RequestQueue requestQueue = Volley.newRequestQueue(this);\n requestQueue.add(stringRequest);\n\n }", "public SpinnerAdapter(Context mContext) {\n this.mContext = mContext;\n Resources res = mContext.getResources();\n this.values = res.getStringArray(R.array.checklist_values);\n\n }", "@Override\n public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {\n mPlayer.changeClass(i);\n updateInfo();\n Toast.makeText(getApplicationContext(), mPlayer.getStatistic(), Toast.LENGTH_SHORT).show();\n }", "@Override\n protected void onPostExecute(String result) {\n super.onPostExecute(result);\n\n spinner.setVisibility(View.VISIBLE);\n // dialog.dismiss();\n // Do things like hide the progress bar or change a TextView\n }", "@Override\n\t\t\tpublic void onItemSelected(AdapterView<?> parent, View view,\n\t\t\t\t\t\t\t\t\t int position, long id) {\n\t\t\t\tsign_tips = getResources().getStringArray(R.array.sign_excetion_reason)[position];\n\t\t\t}", "protected void onPostExecute(String result) {\n TXTNUMERO.setText(estado2);\n TXTNUMERO.setEnabled(false);\n //guardar datos en combo\n combo.setAdapter(new ArrayAdapter<ProyectoBean>(getActivity(), android.R.layout.simple_spinner_item, listado));\n\n progressDialog.dismiss();\n\n }", "@Override\n\t\t\t\t\t\tpublic void onItemSelected(AdapterView<?> parent,\n\t\t\t\t\t\t\t\tView view, int position, long id) {\n\t\t\t\t\t\t\tif(position!=0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tMyspinner sp = (Myspinner)districtlist.getSelectedItem();\n\t\t\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\t\t\tencryptedgeoid = new Webservicerequest().Encrypt(sp.getValue());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcatch(Exception e){\n\t\t\t\t\t\t\t\t\te.getMessage();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcategory2.addAll(get.getMandi(encryptedgeoid));\t\n\t\t\t\t\t\t\t\tMyspinner[] redemo2 = new Myspinner[category2.size()];\n\t\t\t\t \t\t\t\tfor(int i=0; i<category2.size(); i++){\n\t\t\t\t \t\t\t\t\tredemo2[i] = new Myspinner(category2.get(i).get(\"2\"), category2.get(i).get(\"1\"), \"\");\n\t\t\t\t \t\t\t\t}\n\t\t\t\t \t\t\t\tArrayAdapter<Myspinner> adapter2 = new ArrayAdapter<Myspinner>(context, android.R.layout.simple_spinner_dropdown_item, redemo2);\n\t\t\t\t \t\t\t\tmandilist.setAdapter(adapter2);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t\tArrayList<HashMap<String,String>> category2=new ArrayList<HashMap<String,String>>();\n\t\t\t\t\t\t\t\tHashMap<String, String> map2=new HashMap<String, String>();\n\t\t\t\t \t\t\t\tmap2.put(\"1\",\"\");\n\t\t\t\t \t\t\t\tmap2.put(\"2\",\"Select Mandi\");\n\t\t\t\t \t\t\t\tcategory2.add(map2);\n\t\t\t\t\t\t\t\tMyspinner[] redemo2 = new Myspinner[category2.size()];\n\t\t\t\t \t\t\t\tfor(int i=0; i<category2.size(); i++){\n\t\t\t\t \t\t\t\t\tredemo2[i] = new Myspinner(category2.get(i).get(\"2\"), category2.get(i).get(\"1\"), \"\");\n\t\t\t\t \t\t\t\t}\n\t\t\t\t \t\t\t\tArrayAdapter<Myspinner> adapter2 = new ArrayAdapter<Myspinner>(context, android.R.layout.simple_spinner_dropdown_item, redemo2);\n\t\t\t\t \t\t\t\tmandilist.setAdapter(adapter2);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}", "@Override\n public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {\n if (position == 0) {\n p1Time.setText(getResources().getString(R.string.p1Time));\n p2Time.setText(getResources().getString(R.string.p2Time));\n p3Time.setText(getResources().getString(R.string.p3Time));\n p4Time.setText(getResources().getString(R.string.p4Time));\n p5Time.setText(getResources().getString(R.string.p5Time));\n p6Time.setText(getResources().getString(R.string.p6Time));\n p7Time.setText(getResources().getString(R.string.p7Time));\n p8Time.setText(getResources().getString(R.string.p8Time));\n p9Time.setText(getResources().getString(R.string.p9Time));\n } else {\n p1Time.setText(getResources().getString(R.string.p1Time2));\n p2Time.setText(getResources().getString(R.string.p2Time2));\n p3Time.setText(getResources().getString(R.string.p3Time2));\n p4Time.setText(getResources().getString(R.string.p4Time2));\n p5Time.setText(getResources().getString(R.string.p5Time2));\n p6Time.setText(getResources().getString(R.string.p6Time2));\n p7Time.setText(getResources().getString(R.string.p7Time2));\n p8Time.setText(getResources().getString(R.string.p8Time2));\n p9Time.setText(getResources().getString(R.string.p9Time2));\n }\n }", "private void setupSpinner() {\n // Create adapter for spinner. The list options are from the String array it will use\n // the spinner will use the default layout\n ArrayAdapter fruitSpinnerAdapter = ArrayAdapter.createFromResource(this,\n R.array.array_fruit_options, android.R.layout.simple_spinner_item);\n\n // Specify dropdown layout style - simple list view with 1 item per line\n fruitSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);\n\n // Apply the adapter to the spinner\n mTypeSpinner.setAdapter(fruitSpinnerAdapter);\n\n // Set the integer mSelected to the constant values\n mTypeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {\n String selection = (String) parent.getItemAtPosition(position);\n if (!TextUtils.isEmpty(selection)) {\n if (selection.equals(getString(R.string.apple))) {\n mFruit = FruitEntry.TYPE_APPLE;\n } else if (selection.equals(getString(R.string.banana))) {\n mFruit = FruitEntry.TYPE_BANANA;\n } else if (selection.equals(getString(R.string.peach))) {\n mFruit = FruitEntry.TYPE_PEACH;\n } else if (selection.equals(getString(R.string.pineapple))) {\n mFruit = FruitEntry.TYPE_PINEAPPLE;\n } else if (selection.equals(getString(R.string.strawberry))) {\n mFruit = FruitEntry.TYPE_STRAWBERRY;\n } else if (selection.equals(getString(R.string.watermelon))) {\n mFruit = FruitEntry.TYPE_WATERMELON;\n } else {\n mFruit = FruitEntry.TYPE_NOTSELECTED;\n }\n }\n }\n\n // Because AdapterView is an abstract class, onNothingSelected must be defined\n @Override\n public void onNothingSelected(AdapterView<?> parent) {\n mFruit = FruitEntry.TYPE_NOTSELECTED;\n }\n });\n }", "@Override\n public void onClick(DialogInterface dialogInterface, int i) {\n nearest_tourist_spot = input_add_new_nearest_tourist_spot.getText().toString();\n\n db_table_result_rows_list.remove(0);\n db_table_result_rows_list.add(nearest_tourist_spot);\n\n ArrayAdapter<String> spinnerArrayAdapterNearestTouristsSpot = new ArrayAdapter<String>(AddNewLocation.this.getApplicationContext(), android.R.layout.simple_spinner_item, db_table_result_rows_list);\n spinnerArrayAdapterNearestTouristsSpot.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // The drop down view\n spinnerNearestTouristsSpot.setAdapter(spinnerArrayAdapterNearestTouristsSpot);\n\n spinnerNearestTouristsSpot.setSelection(((ArrayAdapter<String>)spinnerNearestTouristsSpot.getAdapter()).getPosition(nearest_tourist_spot));\n }", "public View setupSpinners(View v){\n // Assign Spinners\n spinnerCollect = (Spinner) v.findViewById(R.id.eSpinner_CollectWhat);\n\n // Create an ArrayAdapter using the string array and a default spinner layout\n ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this.getActivity(),\n R.array.eCollectWhat_array, android.R.layout.simple_spinner_item);\n // Specify the layout to use when the list of choices appears\n adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n spinnerCollect.setAdapter(adapter); // Apply the adapter to the spinner\n\n spinnerCollect.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {\n ((ScoutFormActivity) getActivity()).getScoutForm().setEHPCOLLECT_COLUMN(spinnerCollect.getSelectedItem().toString());\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> arg0) {\n }\n });\n\n return v;\n }", "@Override\n public void onClick(final View v) {\n AlertDialog.Builder dl = new AlertDialog.Builder(v.getContext());\n dl.setTitle(\"카테고리 선택\");\n dl.setSingleChoiceItems(items, 0, new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n // TODO Auto-generated method stub\n //Toast.makeText(v.getContext(), items[which], Toast.LENGTH_SHORT).show();\n ActivityStCategory = items[which];\n }\n });\n dl.setPositiveButton(\"선택완료\",\n new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int id)\n {\n // 프로그램을 종료한다\n ActivitySelectBool = true;\n ActivityBtCategoty.setText(ActivityStCategory);\n dialog.dismiss(); // 누르면 바로 닫히는 형태\n }\n });\n\n dl.setNegativeButton(\"취소\",\n new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int id)\n {\n // 프로그램을 종료한다\n dialog.dismiss(); // 누르면 바로 닫히는 형태\n }\n });\n\n\n dl.show();\n }", "@Override\n public void onClick(View v){\n EditText ec_local = (EditText)findViewById(R.id.pm_data_txt);\n EditText dd = (EditText)findViewById(R.id.dd);\n EditText mm = (EditText)findViewById(R.id.mm);\n EditText yyyy = (EditText)findViewById(R.id.yyyy);\n EditText qtde = (EditText)findViewById(R.id.qtde);\n Spinner dma = (Spinner)findViewById(R.id.dma);\n Spinner ec_eqp_id = (Spinner)findViewById(R.id.pm_eqp_tx);\n\n //Método de como transformar um String em Int: Integer.parseInt(myEditText.getText().toString())\n String id = ec_eqp_id.getSelectedItem().toString();\n String local = ec_local.getText().toString();\n String dia = dd.getText().toString();\n String mes = mm.getText().toString();\n String ano = yyyy.getText().toString();\n String qtd = qtde.getText().toString();\n String adm = dma.getSelectedItem().toString();\n\n \n if(TextUtils.isEmpty(local) || TextUtils.isEmpty(dia) || TextUtils.isEmpty(mes) || TextUtils.isEmpty(ano) || TextUtils.isEmpty(qtd)){\n Toast.makeText(getApplicationContext(),\"Insira as Informações Corretamente\",Toast.LENGTH_LONG).show();\n }else if (Integer.parseInt(mes)>12){\n Toast.makeText(getApplicationContext(), \"Mês Inválido\", Toast.LENGTH_LONG).show();\n }else if(Integer.parseInt(mes)==2 && Integer.parseInt(dia)>28){\n Toast.makeText(getApplicationContext(),\"Dia Inválido\",Toast.LENGTH_LONG).show();\n }else if((Integer.parseInt(mes)==1 || Integer.parseInt(mes)==3 || Integer.parseInt(mes)==5 || Integer.parseInt(mes)==7 || Integer.parseInt(mes)==8 || Integer.parseInt(mes)==10 || Integer.parseInt(mes)==12) && Integer.parseInt(dia)>31){\n Toast.makeText(getApplicationContext(),\"Dia Inválido\",Toast.LENGTH_LONG).show();\n }else if((Integer.parseInt(mes)==4 || Integer.parseInt(mes)==6 || Integer.parseInt(mes)==9 || Integer.parseInt(mes)==11) && Integer.parseInt(dia)>30){\n Toast.makeText(getApplicationContext(),\"Dia Inválido\",Toast.LENGTH_LONG).show();\n }else {\n BDController crud = new BDController(getBaseContext());\n int qt = Integer.parseInt(qtde.getText().toString());\n String resultado;\n //Realizando a inserção dos dados no banco de dados.\n String pei = \"\";\n if (adm.equals(\"Dia(s)\")) {\n pei = \"day\";\n } else if (adm.equals(\"Mes(es)\")) {\n pei = \"month\";\n } else if (adm.equals(\"Ano(s)\")) {\n pei = \"year\";\n }\n resultado = crud.insereDado(id, local, ano + \"-\" + mes + \"-\" + dia, qt, adm);\n\n Toast.makeText(getApplicationContext(), resultado, Toast.LENGTH_LONG).show();\n if (!resultado.equals(\"-1\")) {\n crud.updateEcDpm(qt,pei);\n Toast.makeText(getApplicationContext(), resultado, Toast.LENGTH_LONG).show();\n Intent it = new Intent(getApplicationContext(), Equips.class);\n startActivity(it);\n finish();\n }else{\n Toast.makeText(getApplicationContext(),\"Erro de BD\", Toast.LENGTH_LONG).show();\n }\n }\n\n }", "protected void mensajesAlerta() {\n\n// if(((Values)tipoViviendaSpinner.getSelectedItem()).getKey().equals(\"1\") &&\n// ((Values)materialTechoSpinner.getSelectedItem()).getKey().equals(\"6\")){\n// getAlert(getString(R.string.validacion_aviso),getString(R.string.mv_idTipoViviendaCasaMaterialTecho));\n// }\n//\n// if(((Values)tipoViviendaSpinner.getSelectedItem()).getKey().equals(\"2\") &&\n// ((Values)materialTechoSpinner.getSelectedItem()).getKey().equals(\"6\")){\n// getAlert(getString(R.string.validacion_aviso),getString(R.string.mv_idTipoViviendaDepartamentoMaterialTecho));\n// }\n\n if(((Values)tipoViviendaSpinner.getSelectedItem()).getKey().equals(\"2\") &&\n ((Values)ubicacionAguaSpinner.getSelectedItem()).getKey().equals(\"2\")){\n getAlert(getString(R.string.validacion_aviso),getString(R.string.mv_idTipoViviendaUbicacionAgua));\n }\n\n if(((Values)tipoViviendaSpinner.getSelectedItem()).getKey().equals(\"2\") &&\n ((Values)ubicacionSanitarioSpinner.getSelectedItem()).getKey().equals(\"2\")){\n getAlert(getString(R.string.validacion_aviso),getString(R.string.mv_idTipoViviendaUbicacionSanitario));\n }\n\n if( ((Values)tipoViviendaSpinner.getSelectedItem()).getKey().equals(\"3\") &&\n Integer.parseInt(((Values)tipoHogarSpinner.getSelectedItem()).getKey()) < 3 &&\n ((Values)documentoHogarSpinner.getSelectedItem()).getKey().equals(\"1\") ){\n getAlert(getString(R.string.validacion_aviso),getString(R.string.mv_idTipoViviendaTipoHogarDocumento));\n }\n\n if(((Values)materialTechoSpinner.getSelectedItem()).getKey().equals(\"6\")){\n getAlert(getString(R.string.validacion_aviso),getString(R.string.mv_materialTechoOpcionOtro));\n }\n\n if(((Values)servicioSanitarioSpinner.getSelectedItem()).getKey().equals(\"3\") &&\n ((Values)ubicacionSanitarioSpinner.getSelectedItem()).getKey().equals(\"1\")){\n getAlert(getString(R.string.validacion_aviso),getString(R.string.mv_idServicioSanitarioUbicacionSanitarioPozo));\n }\n\n if(((Values)servicioSanitarioSpinner.getSelectedItem()).getKey().equals(\"4\") &&\n ((Values)ubicacionSanitarioSpinner.getSelectedItem()).getKey().equals(\"1\")){\n getAlert(getString(R.string.validacion_aviso),getString(R.string.mv_idServicioSanitarioUbicacionSanitarioDescarga));\n }\n\n if(((Values)viaAccesoPrincipalSpinner.getSelectedItem()).getKey().equals(\"6\") &&\n ((Values)eliminaBasuraSpinner.getSelectedItem()).getKey().equals(\"1\")){\n getAlert(getString(R.string.validacion_aviso),getString(R.string.mv_idViaAccesoPrincipalEliminanBasura));\n }\n }", "public void onItemSelected(AdapterView<?> parent, View view,\n int pos, long id) {\n\n if(parent.getId()==R.id.Branch_Spinner)\n mNotification.setBranch((String)parent.getItemAtPosition(pos));\n\n if(parent.getId()==R.id.Year_Spinner)\n mNotification.setYear((String)parent.getItemAtPosition(pos));\n\n if(parent.getId()==R.id.Section_Spinner)\n mNotification.setSection((String)parent.getItemAtPosition(pos));\n\n\n\n\n\n\n }", "@Override\n public void onItemSelected(AdapterView<?> adapter, View v,\n int position, long id) {\n mappos = position;\n findmapinfo(position , adapter.getItemAtPosition(position).toString());\n \n // Showing selected spinner item\n \n }", "@Override\n public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {\n\n try {\n JSONObject dataClicked = units_array.getJSONObject(i);\n id_unit = dataClicked.getInt(\"id\");\n\n\n } catch (Exception e) {\n e.printStackTrace();\n\n }\n }", "@Override\n public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {\n String roomType = spinner.getSelectedItem().toString();\n mListener.onFragmentInteraction(roomType);\n String returnedFromMain = ((MainActivity)getActivity()).getShareInFragments();\n TextView descript = (TextView)view.findViewById(R.id.description);\n ((MainActivity)getActivity()).setRoomType(returnedFromMain);\n String displayR = ((MainActivity)getActivity()).hR.toString();\n descript.setText((displayR));\n }", "private ArrayAdapter<String> adapterForSpinner(List<String> list)\n {\n ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list)\n {\n @Override\n public boolean isEnabled(int position) {\n return position != 0;\n }\n\n @Override\n public View getDropDownView(int position, View convertView, ViewGroup parent) {\n View view = super.getDropDownView(position, convertView, parent);\n TextView tv = (TextView) view;\n if(position == 0){\n // Set the hint text color gray\n tv.setTextColor(Color.GRAY);\n }\n else {\n tv.setTextColor(Color.BLACK);\n }\n return view;\n }\n };\n\n // Drop down layout style - list view with radio button\n dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);\n\n return dataAdapter;\n }", "private void assignSpinner(int i, String s) {\n switch (s) {\n case \"Bitters\":\n ArrayAdapter<String> bittersAdapter;\n bittersAdapter = new ArrayAdapter<>(this, R.layout.support_simple_spinner_dropdown_item, bitters);\n bittersAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);\n spinnerArrayList.get(i-1).setAdapter(bittersAdapter);\n spinnerArrayList.get(i-1).setVisibility(View.VISIBLE);\n break;\n case \"Gin\":\n ArrayAdapter<String> ginAdapter;\n ginAdapter = new ArrayAdapter<>(this, R.layout.support_simple_spinner_dropdown_item, gin);\n ginAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);\n spinnerArrayList.get(i-1).setAdapter(ginAdapter);\n spinnerArrayList.get(i-1).setVisibility(View.VISIBLE);\n break;\n case \"Rum\":\n ArrayAdapter<String> rumAdapter;\n rumAdapter = new ArrayAdapter<>(this, R.layout.support_simple_spinner_dropdown_item, rum);\n rumAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);\n spinnerArrayList.get(i-1).setAdapter(rumAdapter);\n spinnerArrayList.get(i-1).setVisibility(View.VISIBLE);\n break;\n case \"Tequila\":\n ArrayAdapter<String> tequilaAdapter;\n tequilaAdapter = new ArrayAdapter<>(this, R.layout.support_simple_spinner_dropdown_item, tequila);\n tequilaAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);\n spinnerArrayList.get(i-1).setAdapter(tequilaAdapter);\n spinnerArrayList.get(i-1).setVisibility(View.VISIBLE);\n break;\n case \"Vodka\":\n ArrayAdapter<String> vodkaAdapter;\n vodkaAdapter = new ArrayAdapter<>(this, R.layout.support_simple_spinner_dropdown_item, vodka);\n vodkaAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);\n spinnerArrayList.get(i-1).setAdapter(vodkaAdapter);\n spinnerArrayList.get(i-1).setVisibility(View.VISIBLE);\n break;\n case \"Vermouth\":\n ArrayAdapter<String> vermouthAdapter;\n vermouthAdapter = new ArrayAdapter<>(this, R.layout.support_simple_spinner_dropdown_item, vodka);\n vermouthAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);\n spinnerArrayList.get(i-1).setAdapter(vermouthAdapter);\n spinnerArrayList.get(i-1).setVisibility(View.VISIBLE);\n break;\n case \"Whiskey\":\n ArrayAdapter<String> whiskeyAdapter;\n whiskeyAdapter = new ArrayAdapter<>(this, R.layout.support_simple_spinner_dropdown_item, whiskey);\n whiskeyAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);\n spinnerArrayList.get(i-1).setAdapter(whiskeyAdapter);\n spinnerArrayList.get(i-1).setVisibility(View.VISIBLE);\n break;\n }\n }", "@Override\n public void onClick(DialogInterface dialog, int position) {\n tv.setText(String.valueOf(items[position]));\n\n String tag = tv.getTag().toString();\n\n switch (tag) {\n\n case \"district\":\n districtStr = String.valueOf(items[position]);\n break;\n\n case \"village\":\n villageStr = String.valueOf(items[position]);\n break;\n\n case \"ward\":\n wardStr = String.valueOf(items[position]);\n break;\n\n case \"category\":\n categoryStr = String.valueOf(items[position]);\n break;\n\n }\n\n }", "@Override\n\tpublic void onItemSelected(AdapterView<?> parent, View view, int position,\n\t\t\tlong id) {\n\t\tString text = spnner_city.getSelectedItem().toString();\n\t\tToast.makeText(getApplicationContext(), text, Toast.LENGTH_LONG)\n\t\t.show();\n\n\t}", "private void getTaskSpinner() {\n\n StringRequest stringRequest = new StringRequest(\"https://cardtest10.000webhostapp.com/Sync_Spinner_T.php\", new Response.Listener<String>() {\n @Override\n public void onResponse(String response) {\n\n try{\n\n JSONObject jsonResponse = new JSONObject(response);\n JSONArray jsonArraytask = jsonResponse.getJSONArray(\"task\");\n\n for(int i=0; i < jsonArraytask.length(); i++)\n {\n JSONObject jsonObjecttask = jsonArraytask.getJSONObject(i);\n String task = jsonObjecttask.optString(\"Type\");\n arrayTask.add(task);\n }\n\n }catch (JSONException e){\n e.printStackTrace();\n }\n\n // Applying the adapter to our spinner\n spTaskType.setAdapter(new ArrayAdapter <>(UserAreaActivity.this, android.R.layout.simple_spinner_dropdown_item, arrayTask));\n }\n },\n new Response.ErrorListener() {\n @Override\n public void onErrorResponse(VolleyError error) {\n Toast.makeText(UserAreaActivity.this, error + \"\", Toast.LENGTH_SHORT).show();\n }\n });\n\n RequestQueue requestQueue = Volley.newRequestQueue(this);\n requestQueue.add(stringRequest);\n\n }", "@Override\n public void onClick(View v) {\n\n String s = v.getTag().toString();\n int duration = Toast.LENGTH_SHORT;\n Toast toast = Toast.makeText(context, s, duration);\n toast.show();\n }", "private void setUpLgaSpinner(List<String> lgas) {\n\n ArrayAdapter lgaAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, lgas);\n lgaAdapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);\n lgaAdapter.notifyDataSetChanged();\n mLgaSpinner.setAdapter(lgaAdapter);\n\n mLgaSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {\n @Override\n public void onItemSelected(AdapterView<?> parent, View view, int position, long l) {\n mLga = (String) parent.getItemAtPosition(position);\n// Toast.makeText(ProductsActivity.this, \"state: \" + mState + \" lga: \" + mLga, Toast.LENGTH_LONG).show();\n }\n\n @Override\n public void onNothingSelected(AdapterView<?> adapterView) {\n }\n });\n }", "@Override\n public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long id) {\n switch (position)\n {\n case 1:\n break;\n case 2:\n Toast.makeText(this,appointmentTypes[position],Toast.LENGTH_LONG).show();\n /*Intent intent = new Intent(getApplicationContext(), AppointmentRequests.class);\n Bundle b = new Bundle();\n b.putString(\"userid\",userid);\n intent.putExtras(b);\n startActivity(intent);*/\n break;\n case 3:\n break;\n }\n }", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n if (convertView == null) {\n convertView = LayoutInflater.from(parent.getContext()).\n inflate(android.R.layout.simple_spinner_dropdown_item, parent, false);\n }\n\n TextView textView= (TextView) convertView;\n textView.setText(position==0?R.string.weight_unit_kilo:R.string.weight_unit_lbs);\n return convertView;\n }", "@Override\n public void onResponse(String s) {\n loading.dismiss();\n //Showing toast message of the response\n Toast.makeText(MainActivity.this, s , Toast.LENGTH_LONG).show();\n }", "@Override\n public void onResponse(JSONObject response) {\n try {\n NumberFormat rupiah = NumberFormat.getInstance(Locale.GERMANY);\n textBalance.setText(rupiah.format(response.getDouble(\"masuk\")-response.getDouble(\"keluar\")));\n\n JSONArray jsonArray = response.getJSONArray(\"hasil\");\n for (int i=0; i <2;i++) {\n JSONObject jsonObject;\n jsonObject = jsonArray.getJSONObject(i);\n HashMap<String, String> map = new HashMap<>();\n map.put(\"id\", jsonObject.getString(\"id\"));\n map.put(\"status\", jsonObject.getString(\"status\"));\n map.put(\"jumlah\", jsonObject.getString(\"jumlah\"));\n map.put(\"keterangan\", jsonObject.getString(\"keterangan\"));\n map.put(\"tanggal\", jsonObject.getString(\"tanggal\"));\n map.put(\"tanggal2\", jsonObject.getString(\"tanggal2\"));\n\n arusuang.add(map);\n }\n adapterRead();\n }catch (JSONException e){\n e.printStackTrace();\n }\n }" ]
[ "0.6730361", "0.6692434", "0.6667208", "0.65195775", "0.65164614", "0.6488976", "0.6487494", "0.645936", "0.640682", "0.6403136", "0.63396645", "0.6334037", "0.63010114", "0.62687397", "0.6251632", "0.62385976", "0.6220892", "0.62048125", "0.6204007", "0.6199511", "0.6195941", "0.6191614", "0.61853665", "0.61574817", "0.6145051", "0.6142118", "0.6139717", "0.6139551", "0.6137395", "0.6128052", "0.60988164", "0.60855955", "0.60822076", "0.60819876", "0.6081063", "0.6072901", "0.60641485", "0.6063703", "0.605259", "0.6046869", "0.6045469", "0.60392207", "0.6029818", "0.6029142", "0.6027916", "0.6023703", "0.5995978", "0.59897345", "0.5980048", "0.59750676", "0.5957", "0.59362525", "0.59349924", "0.59347683", "0.5930853", "0.59237623", "0.5918521", "0.5913677", "0.59059834", "0.5899356", "0.5884908", "0.5864907", "0.58639175", "0.586387", "0.58559275", "0.58550686", "0.58483666", "0.5844167", "0.5839317", "0.58380556", "0.58290696", "0.58199805", "0.5818339", "0.5818242", "0.58099407", "0.5802902", "0.5802277", "0.57998157", "0.57953787", "0.5790095", "0.57886285", "0.5788298", "0.57828003", "0.5775661", "0.5771795", "0.5767387", "0.5765404", "0.57649934", "0.5763184", "0.57563394", "0.57557076", "0.5755195", "0.57461977", "0.574384", "0.57409936", "0.57386273", "0.5729067", "0.5727072", "0.5724935", "0.57232577", "0.5723186" ]
0.0
-1
creates a new BiNode, length must be set afterwards. constructor does not create a DOMnode
public BiNode(final int co, final String ns, final String n, final Attributes a) { this.childOffset = co; this.namespaceURI = ns; this.eName = n; this.attrs = a; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public BinaryNode() {\n\t\tthis(null);\t\t\t// Call next constructor\n\t}", "public static Node buildBNode(final String id) {\n\t\treturn NodeFactory.createAnon(AnonId.create(id));\n\t}", "private BTNode createNode() {\n BTNode btNode;\n btNode = new <DataPair>BTNode ();\n btNode.mIsLeaf = true;\n btNode.mCurrentKeyNum = 0;\n return btNode;\n }", "BElement createBElement();", "public BinaryTree(){}", "public BinaryNode(String dataPortion) {\n\t\tthis(dataPortion, null, null);\t\t\t// Call next constructor\n\t}", "public BinTree( BiNode root )\n {\n _root = root;\n }", "public BinaryTree() {\n\t}", "public Node(){}", "Node(Byte value, int weight) {\n this.value = value;\n leftChild = null;\n rightChild = null;\n this.weight = weight;\n }", "private BinaryTree() {\n root = new Node(0);\n }", "private ITree.Node createNode(int i) {\n if (i < currentSize) {\n ITree.Node node = new ITree.Node(this.elements[i]);\n node.setLeftNode(createNode(this.leftChild(i)));\n node.setRightNode(createNode(this.rightChild(i)));\n\n return node;\n }\n return null;\n }", "public LinkedBinaryTree(T element){\n\t\t root = new BinaryTreeNode<T>(element);\n\t }", "public TreeNode(){ this(null, null, 0);}", "public BinaryTree()\r\n\t{\r\n\t\t// Initialize field values\r\n\t\tthis.counter = 0;\r\n\t\tthis.arrayCounter = 0;\r\n\t\tthis.root = null;\r\n\t}", "public BTNode(int value){ \r\n node = value; \r\n leftleaf = null;\r\n rightleaf = null;\r\n }", "public Node() {}", "public Node() {}", "public Node() {}", "public Node() {}", "BElementStructure createBElementStructure();", "TNode createTNode();", "public Node(){\n this(9);\n }", "public BTreeNode(int t){\n T = t;\n isLeaf = true;\n key = new int[2*T-1];\n c = new BTreeNode[2*T];\n n=0; \n }", "public LinkedBinaryTree() { // constructs an empty binary tree\n\n }", "public DLB(){\r\n\t\t//generate the root node with a terminating value\r\n\t\tnodes = new DLBNode('/');\r\n\t}", "public BinaryTree() {\n count = 0;\n root = null;\n }", "Node(TNode i, Node n){\t\t\t//A function to create a Node\n\t\telement = i;\t\t\t\t\n\t\tnext = n;\n\t}", "public BinaryTree() {\r\n\t\troot = null;\r\n\t\tcount = 0;\r\n\t}", "public BinaryNode(AnyType element,BinaryNode<AnyType> left,BinaryNode<AnyType> right) {\n this.element=element;\n this.left=left;\n this.right=right;\n }", "public BinaryNumber(int length) {\n\t\tdata = new int[length];\n\t\tfor(int i = 0;i < length;i++) {\n\t\t\tdata[i] = 0;\n\t\t}\n\t}", "public BinaryTree(E item) {\n\t\troot = new TreeNode<E>(item);\n\t}", "public Node()\r\n {\r\n initialize(null);\r\n lbl = id;\r\n }", "public Node(int element){\r\n this(element, null, null);\r\n }", "private void constructTree() {\r\n\t\tsortLeaves();\r\n\t\tNode currentNode;\r\n\t\tint index = 0;\r\n\t\t\tdo{\r\n\t\t\t\t// Create a new node with the next two least frequent nodes as its children\r\n\t\t\t\tcurrentNode = new Node(this.treeNodes[0], this.treeNodes[1]); \r\n\t\t\t\taddNewNode(currentNode);\r\n\t\t\t}\r\n\t\t\twhile (this.treeNodes.length > 1); // Until there is only one root node\r\n\t\t\tthis.rootNode = currentNode;\r\n\t\t\tindex++;\r\n\t}", "public BinaryNumber(int length){\n\t\tdata = new int[length];\n\t\tfor (int i=0; i<length; i++){\n\t\t\tdata[i] = 0;\n\t\t}\n\t}", "public Node(){\n\n\t\t}", "public Regular(Node t) {\n }", "public Node() {\r\n\t}", "public Node() {\r\n\t}", "void create(Node node) {\n if (node.table.negatives() == 0) {\r\n node.atribute = 1;\r\n return;\r\n }\r\n if (node.table.positives() == 0) {\r\n node.atribute = 0;\r\n return;\r\n }\r\n\r\n //If no test split the data, make it a leaf with the majoriti of the target atribute\r\n int atr;\r\n //Choose the best atribute\r\n atr = this.chooseBestAtrib(node);\r\n node.atribute = atr;\r\n\r\n //No atribute split the data, so make the node a leaf with the majoriti of the class (either positive or negative)\r\n if (node.atribute == -1) {\r\n //System.out.println(\"Atribute is -1 in TeeBuidler.create\");\r\n if (node.table.negatives() > node.table.positives()) {\r\n node.atribute = 0;\r\n return;\r\n }\r\n if (node.table.positives() >= node.table.negatives()) {\r\n node.atribute = 1;\r\n return;\r\n }\r\n }\r\n\r\n Table table_left = new Table(), table_right = new Table();\r\n node.table.splitByAtrib(node.atribute, table_left, table_right);\r\n\r\n //Create two children for the current node //parameters: identifier,parent_result,atribute of split,id_child1, id_child2, table\r\n node.child_left = new Node(node.id + node.id, \"1\", -1, -1, -1, table_left);\r\n node.child_right = new Node(node.id + node.id+1, \"0\", -1, -1, -1, table_right);\r\n node.id_child_left = node.id + node.id;\r\n node.id_child_right = node.id + node.id+1;\r\n\r\n\r\n TreeBuilder builder = new TreeBuilder();\r\n builder.create(node.child_left);\r\n builder.create(node.child_right);\r\n\r\n }", "public BNode(int key, int value) {\n this.key = key;\n this.value = value;\n this.left = null;\n this.right = null;\n this.next = null;\n this.height = 0;\n }", "public Node() {\n\t}", "public BinaryNode(String dataPortion, BinaryNode newLeftChild, BinaryNode newRightChild) {\n\t\tdata = dataPortion;\n\t\tleftChild = newLeftChild;\n\t\trightChild = newRightChild;\n\t}", "public HuffmanNode(int freq){\r\n this(freq, null, null);\r\n }", "public Node() {\n }", "Node(int weight, Node leftChild, Node rightChild) {\n this.weight = weight;\n this.leftChild = leftChild;\n this.rightChild = rightChild;\n value = null;\n }", "public DLBNode(char inputValue){\r\n\t\t\tvalue = inputValue;\r\n\t\t\tchildNode = null;\r\n\t\t\tsiblingNode = null;\r\n\t\t}", "public Node() {\n\n }", "public Node()\n\t{\n\t\ttitle = \" \";\n\t\tavail = 0;\n\t\trented = 0;\n\t\tleft = null;\n\t\tright = null;\n\t\t\n\t}", "private static Node createNode(int value) {\n\t\treturn new Node(value);\n\t}", "public CWLNodeFactory() {\n super(true);\n }", "public BinarySearchTree() {}", "public BinarySearchTree() {\n\n\t}", "private Node(int c) {\n this.childNo = c; // Construct a node with c children.\n }", "private Node() {\n\n }", "public CassandraNode() {\r\n\t\tthis(null, 0);\r\n\t}", "public ChildNode() {\r\n\t\tsuper();\r\n\t\t// TODO Auto-generated constructor stub\r\n\t}", "protected XMLElement createAnotherElement() {\n return new XMLElement(this.conversionTable,\n this.skipLeadingWhitespace,\n false,\n this.ignoreCase);\n }", "public RedBlackNode(int element) \n { \n this( element, null, null ); \n }", "public Node (String newW ) {\n word = newW;\n left = null;\n right = null;\n freq = 0;\n }", "public BTree(int order) {\n throw new UnsupportedOperationException(\"implement me!\");\n }", "public BinaryTree(T v, BinaryTree<T> l, BinaryTree<T> r) {\n root = new TreeNode(v, l.root, r.root);\n count = l.count + r.count + 1;\n }", "public ArvoreRB(String n){\r\n\tthis.raiz = new Node(n);\r\n\tthis.pr = raiz;\r\n\tthis.tamanho = 0;\r\n\tthis.print = \" \";\r\n}", "static binaryTreeNode inorderConstruct(int[] keys){\n binaryTreeNode head = null;\n binaryTreeNode lnode = null;\n binaryTreeNode rnode = null;\n for(int i:keys){\n if(head == null){\n head = new binaryTreeNode(i);\n continue;\n }\n if(lnode == null){\n lnode = head;\n head = new binaryTreeNode(i);\n continue;\n }\n if(rnode == null){\n rnode = new binaryTreeNode(i);\n head.lnode = lnode;\n head.rnode = rnode;\n rnode = null;\n lnode = null;\n }\n }\n return head;\n }", "public Node createNode(int value) {\r\n\t\treturn new Node(value, null, null);\r\n\t}", "void nodeCreate( long id );", "protected Node newNode() {\n\t\treturn new RCPOMDocument();\n\t}", "public ArvoreRB(Node nil){\r\n\tthis.raiz = nil;\r\n\tthis.pr = nil;\r\n\tthis.aux = nil;\r\n\tthis.tamanho = 0;\r\n\tthis.print = \" \";\r\n this.nil=nil;\r\n}", "protected a bi() {\n return new a(this);\n }", "public BinaryMatrixNew() {\n\t\t\tsuper(Matrixes.<R, C>newValidating(PredicateUtils.inBetween(0d, 1d)));\n\t\t}", "public static Treenode createBinaryTree() {\n\t\tTreenode rootnode = new Treenode(40);\r\n\t\tTreenode r40 = new Treenode(50);\r\n\t\tTreenode l40 = new Treenode(20);\r\n\t\tTreenode r50 = new Treenode(60);\r\n\t\tTreenode l50 = new Treenode(45);\r\n\t\tTreenode r20 = new Treenode(30);\r\n\t\tTreenode l20 = new Treenode(10);\r\n\t\trootnode.right = r40;\r\n\t\trootnode.left = l40;\r\n\t\tr40.right=r50;\r\n\t\tr40.left = l50;\r\n\t\tl40.right=r20;\r\n\t\tl40.left=l20;\r\n\t\t r40.parent=rootnode; l40.parent= rootnode;\r\n\t\t r50.parent=r40;\r\n\t\tl50.parent=r40 ;\r\n\t\t r20.parent=l40;\r\n\t\t l20.parent=l40 ;\r\n\t\treturn rootnode;\r\n\t\t\r\n\t}", "public BinarySearchTree(Integer data) {\n\t\troot = new TreeNode(data);\n\t\tlength++;\n\t}", "public TrieNode(){}", "public Node(int index, int size){\n processId = NO_PROCESS;\n startIndex = index;\n this.size = size;\n this.full = false;\n }", "private Node() {\n // Start empty.\n element = null;\n }", "public Node(int id, int index, int size){\n processId = id;\n startIndex = index;\n this.size = size;\n this.full = true;\n }", "public Node(){\n }", "public Node(T value) {\n this.value = value;\n this.height = 0;\n this.leftChild = null;\n this.rightChild = null;\n this.parent = null;\n }", "public BinaryTreeNode(T _data) {\n\t\t\t// Invoke the 2-parameter constructor with null parent\n\t\t\tthis(_data, null);\n\t\t}", "public void createBinaryTree()\r\n\t{\n\t\t\r\n\t\tNode node = new Node(1);\r\n\t\tnode.left = new Node(2);\r\n\t\tnode.right = new Node(3);\r\n\t\tnode.left.left = new Node(4);\r\n\t\tnode.left.right = new Node(5);\r\n\t\tnode.left.right.right = new Node(10);\r\n\t\tnode.left.left.left = new Node(8);\r\n\t\tnode.left.left.left.right = new Node(15);\r\n\t\tnode.left.left.left.right.left = new Node(17);\r\n\t\tnode.left.left.left.right.left.left = new Node(18);\r\n\t\tnode.left.left.left.right.right = new Node(16);\r\n\t\tnode.left.left.right = new Node(9);\r\n\t\tnode.right.left = new Node(6);\r\n\t\tnode.right.left.left = new Node(13);\r\n\t\tnode.right.left.left.left = new Node(14);\r\n\t\tnode.right.right = new Node(7);\r\n\t\tnode.right.right.right = new Node(11);\r\n\t\tnode.right.right.right.right = new Node(12);\r\n\t\troot = node;\r\n\t\t\r\n\t}", "public RBTree() {\r\n\t\t// well its supposed just create a new Red Black Tree\r\n\t\t// Maybe create a new one that does a array of Objects\r\n\t}", "public BTreeInternalNode(int m,int id,int p_id,int l_id,int r_id,int prior_id,int next_id,int prior_number,\n int next_number,IndexBuffer bf,TableAttribute[] attrs,String db_name,String table_name){\n super(m,id,p_id,l_id,r_id,prior_id,next_id,prior_number,next_number,bf,attrs,db_name,table_name);\n System.arraycopy(Util.byte2bytes((byte)0),0,index_data,0,1);\n type = 0;\n }", "public XMLBuilder()\n\t{\n\t\tthis(\"\");\n\t}", "TreeNode generateBinaryTree(int[] arr) {\n\n if (arr.length == 0) {\n\n return null;\n }\n return buildNode(arr, 0, 1, 2);\n }", "public BinaryTree() {\n root = null;\n }", "public BinaryTree() {\n root = null;\n }", "public Bite() {\r\n\t\tsuper(8, \"bites\");\r\n\t}", "public Binary() { \n\t_decNum = 0;\n\t_binNum = \"0\";\n }", "static BTNode newNode(int k)\r\n{\r\n\tBTNode temp = new BTNode();\r\n temp.key = k;\r\n temp.left = temp.right = null;\r\n return temp;\r\n}", "Edge(Node from,Node to, int length){\n this.source=from;\n this.destination=to;\n this.weight=length;\n }", "Node(){\n\t\t\tthis.array = new Node[256];\n\t\t\tthis.val = null;\n\t\t}", "public BinarySearchTree()\n\t{\n\t\tsuper();\n\t}", "public Node()\n\t{\n\t\t\n\t\tdata = new IntData();\n\t\tdata.setData(Integer.MIN_VALUE);\n\t\tnext=null;\n\t}", "public PacketBuilder() {\n\t\tthis(1024);\n\t}", "public Node(T value) \n\t\t//PRE: T is initialized\n\t\t//POST: A node is created with value T \n\t\t{\n\t\t\tthis.value = value;\t\n\t\t\tnext = null;\n\t\t\tisCurrent = false;\n\t\t}", "public ChildNode(ArrayList<String> values, String tagName, boolean isChildnode) {\r\n\t\tsuper();\r\n\t\tthis.values = values;\r\n\t\tthis.tagName = tagName;\r\n\t\tthis.isChildnode = isChildnode;\r\n\t}", "public HuffmanTree() {\r\n\t\tsuper();\r\n\t}", "protected BaseAuroraDataBuffer(long length) {\n this(length, true);\n }", "public BinaryTree()\n {\n this.root = null;\n this.actualNode = null;\n this.altMode = false;\n this.deepestRight = null;\n }" ]
[ "0.6485013", "0.62070805", "0.6132087", "0.61247605", "0.6048384", "0.6024496", "0.5970121", "0.5962074", "0.5925226", "0.58873993", "0.5880892", "0.5830755", "0.5828121", "0.58014935", "0.5790016", "0.57891715", "0.5780035", "0.5780035", "0.5780035", "0.5780035", "0.577514", "0.57690704", "0.5744669", "0.572672", "0.57210183", "0.5668685", "0.56605154", "0.56330985", "0.5632503", "0.5604277", "0.557842", "0.5566221", "0.5563498", "0.55493975", "0.55271834", "0.55196613", "0.55045485", "0.5496588", "0.5483801", "0.5483801", "0.54723334", "0.54669094", "0.54490423", "0.5438937", "0.5413529", "0.54123795", "0.5408311", "0.5397895", "0.5396467", "0.5387974", "0.5377614", "0.53711474", "0.53545547", "0.53540933", "0.53493786", "0.5348735", "0.5338533", "0.5335104", "0.53270245", "0.53260624", "0.532248", "0.53208375", "0.5320575", "0.53205293", "0.5317389", "0.5308103", "0.5307876", "0.5305227", "0.52972925", "0.5295771", "0.5284992", "0.52747566", "0.5269186", "0.5267427", "0.5265938", "0.52586126", "0.52547866", "0.5254111", "0.5252601", "0.5241696", "0.5241568", "0.5241212", "0.523882", "0.52378964", "0.5227507", "0.5227151", "0.5227151", "0.5222599", "0.52207136", "0.52094686", "0.5207132", "0.52053344", "0.52034384", "0.51912606", "0.5187948", "0.518668", "0.5183111", "0.5180195", "0.51800144", "0.51750624" ]
0.621346
1
get the name of the node (tagname).
public String getNodeName() { final String ret; if (this.eName == null) { if (this.getNode() == null) { ret = null; } else { ret = this.getNode().getNodeName(); } } else { ret = this.eName; } return ret; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String getTagName() \n {\n return _node == null ? null : _node.getName().getLocalPart();\n }", "public final String name() {\n return node.getNodeName();\n }", "public String getName() {\n return element.getNodeName();\n }", "public final String getTagName() {\n return getNodeName();\n }", "String getNameElement();", "static String getName(Node node) {\n Attr attribute = (Attr) node.getAttributes().getNamedItemNS(null, ATTR_NAME);\n\n if (attribute != null) {\n return attribute.getValue();\n }\n\n return null;\n }", "public String getName()\n {\n \tif (_nodeVRL==null)\n \t\treturn null;\n \t\n return _nodeVRL.getBasename(); // default= last part of path\n }", "String getNodeName();", "public String getNodeName (CyNode node) {\n return nodeHandler.getNodeName(node);\n }", "private String getName(Node node) {\n\t\tif (node.hasAttributes() == false) \n\t\t\treturn null;\n\t\t\n\t\tfor (int i = 0; i<node.getAttributes().getLength(); i++) {\n\t\t\tif (node.getAttributes().item(i).getNodeName().equals(\"name\")) \n\t\t\t\treturn node.getAttributes().item(i).getNodeValue();\n\t\t}\n\t\treturn null;\n\t}", "public String getName() { \n\t\treturn getNameElement().getValue();\n\t}", "public String getName() { \n\t\treturn getNameElement().getValue();\n\t}", "public String getName() { \n\t\treturn getNameElement().getValue();\n\t}", "private String getName(Name node) {\n\t\tif (node.isQualifiedName()) {\n\t\t\tQualifiedName name = (QualifiedName) node;\n\t\t\treturn getName(name.getQualifier());\n\t\t}\n\t\t//if it's a simple name\n\t\telse if (node.isSimpleName()) {\n\t\t\treturn node.toString();\n\t\t}\n\t\t\n\t\treturn null;\n\t}", "@Nullable\n public String getName() {\n return getElement().getName();\n }", "public String getName() {\n if (_lastTag == null)\n return null;\n return _lastTag.getName();\n }", "String getNodeName() {\n return this.nodeName;\n }", "private String getTagName(final Node tag) {\n if (tag != null) {\n if (tag.isElement()) {\n return \"<\" + tag.element + \">\";\n }\n else if (tag.type == NodeType.EndTag) {\n return \"</\" + tag.element + \">\";\n }\n else if (tag.type == NodeType.DocTypeTag) {\n return \"<!DOCTYPE>\";\n }\n else if (tag.type == NodeType.TextNode) {\n return \"plain text\";\n }\n else if (tag.type == NodeType.XmlDecl) {\n return \"XML declaration\";\n }\n else if (tag.element != null) {\n return tag.element;\n }\n }\n return \"\";\n }", "public String getTagName() {\n return TAG_NAME;\n }", "public final native java.lang.String getTagName() /*-{\n return this.tagName;\n }-*/;", "org.apache.xmlbeans.XmlString xgetName();", "org.apache.xmlbeans.XmlString xgetName();", "public java.lang.String getName() {\r\n return localName;\r\n }", "public java.lang.String getName() {\r\n return localName;\r\n }", "public String getNodeName()\n\t{\n\t\tif (this.name == null)\n\t\t\tthis.name = StyleEditorUtility.DEFAULT_STYLE_NODE_NAME;\n\n\t\treturn this.name;\n\t}", "public String getNodeName()\n {\n return Constants.ELEMNAME_NUMBER_STRING;\n }", "public abstract String toName(Object inNode);", "public java.lang.String getName() {\n return localName;\n }", "public java.lang.String getName() {\n return localName;\n }", "public java.lang.String getName() {\n return localName;\n }", "public java.lang.String getName(){\r\n return localName;\r\n }", "public java.lang.String getName(){\r\n return localName;\r\n }", "public java.lang.String getName(){\r\n return localName;\r\n }", "String getNodeName() {\n return nodeName;\n }", "@Override\n\tpublic String getName() {\n\t\tfinal PsiElement nameIdentifier = getNameIdentifier();\n\t\treturn nameIdentifier != null ? nameIdentifier.getText() : getText();\n\t}", "@Override\r\n\tpublic String getTagName() {\n\t\treturn tagName;\r\n\t}", "public String getTagName() {\n return this.tagName;\n }", "public String getNodeName()\n {\n return displayNode.toString();\n }", "public String getTagname() {\n return tagname;\n }", "public String getTagName() {\n return this.tagName;\n }", "@Override\n\tpublic String getTagName() {\n\t\treturn getClass().getSimpleName();\n\t}", "public String getName () { return n.getName(); }", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "public String getNodeName() {\n return nodeName;\n }", "public String getNameIdNode() {\r\n String nameIdNode = null;\r\n nameIdNode = this.getParam(ESCOConstantes.NAMEID_NODE);\r\n // Add the root element if not present\r\n if (null != nameIdNode && !nameIdNode.startsWith(ESCOConstantes.STEM_NAME_SEPARATOR)) {\r\n nameIdNode = ESCOConstantes.STEM_NAME_SEPARATOR + nameIdNode;\r\n }\r\n\r\n return nameIdNode;\r\n }", "public org.apache.xmlbeans.XmlNMTOKEN xgetName()\r\n {\r\n synchronized (monitor())\r\n {\r\n check_orphaned();\r\n org.apache.xmlbeans.XmlNMTOKEN target = null;\r\n target = (org.apache.xmlbeans.XmlNMTOKEN)get_store().find_attribute_user(NAME$26);\r\n return target;\r\n }\r\n }", "public String getXMLBaseNodeName();", "public java.lang.String getName();", "public String getNodeName(String propertyName);" ]
[ "0.8161503", "0.80850124", "0.7890728", "0.77633286", "0.75357974", "0.7328048", "0.72361356", "0.7226093", "0.7221165", "0.71558696", "0.71149117", "0.71149117", "0.71149117", "0.71040523", "0.7002314", "0.6994721", "0.6941785", "0.6912084", "0.68826854", "0.6882294", "0.68689895", "0.68689895", "0.68659973", "0.6852028", "0.6849856", "0.68384326", "0.6788604", "0.6777767", "0.6777767", "0.6777767", "0.6769832", "0.6769832", "0.6769832", "0.671469", "0.66675544", "0.6643061", "0.6616371", "0.66075987", "0.6606812", "0.66062725", "0.6604061", "0.6598394", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65966845", "0.65362597", "0.65265393", "0.65203714", "0.6516706", "0.6503125", "0.6492646" ]
0.6925714
17
add a child to this node, if node has already a child, forward to child.
public void addChild(final IBiNode c) { // 1st child if (this.child == null) { this.setChild(c); } else { // 2nd - nth child this.child.addSibling(c); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void addChild(Node child)\n\t{\n\t\tchild.parent = this;\n\t\t//if (!children.contains(child))\n\t\t//{\t\n\t\tchildren.add(child);\n\t\t//children.get(children.indexOf(child)-1).setBro(child);\n\t\t//}\n\t}", "public void addChild(Node child){\n children.add(child);\n }", "public void addChild(T child) {\n this.children.add(child);\n child.setParent(this);\n this.invalidate();\n }", "public void addChild(DecTreeNode child) {\r\n if (children != null)\r\n children.add(child);\r\n }", "public void addChild(TreeNode child) {\n if (this.children!= null && !this.children.contains(child) && child != null)\n this.children.add(child);\n }", "public void addChild(XMLElement child)\n/* */ {\n/* 398 */ if (child == null) {\n/* 399 */ throw new IllegalArgumentException(\"child must not be null\");\n/* */ }\n/* 401 */ if ((child.getLocalName() == null) && (!this.children.isEmpty())) {\n/* 402 */ XMLElement lastChild = (XMLElement)this.children.lastElement();\n/* */ \n/* 404 */ if (lastChild.getLocalName() == null) {\n/* 405 */ lastChild.setContent(lastChild.getContent() + \n/* 406 */ child.getContent());\n/* 407 */ return;\n/* */ }\n/* */ }\n/* 410 */ child.parent = this;\n/* 411 */ this.children.addElement(child);\n/* */ }", "public void add(Node<E> child) {\n this.children.add(child);\n }", "public void addChild(FileNode child) {\r\n child.setParent(this);\r\n children.add(child);\r\n childNum++;\r\n }", "public void addChild(Node childnode)\n {\n children.add(childnode);\n }", "public void addChild(DecTreeNode child) {\n\t\tif (children != null) {\n\t\t\tchildren.add(child);\n\t\t}\n\t}", "public void addChild(final ParseTreeNode child) {\r\n child.setParent(this);\r\n if (_children == null) { _children = new ArrayList<ParseTreeNode>(); }\r\n _children.add(child);\r\n }", "public void addChild( ChildType child );", "public void addChildNode (Node child) {\n\t\tObjects.requireNonNull(child);\n\t\t\n\t\tif(children == null) {\n\t\t\tchildren = new ArrayIndexedCollection();\t\n\t\t}\n\t\t\n\t\tchildren.add(child);\n\t}", "protected void addChild(TreeNode child) {\n\t\t\tchildren.add(child);\n\t\t\tchild.parent = this;\n\t\t}", "protected void append_child(AstNode child) throws Exception {\r\n\t\tif (child == null)\r\n\t\t\tthrow new IllegalArgumentException(\"Invalid child: null\");\r\n\t\telse {\r\n\t\t\tif (child instanceof AstNodeImpl)\r\n\t\t\t\t((AstNodeImpl) child).set_parent(this);\r\n\t\t\tthis.children.add(child);\r\n\t\t\tthis.update_location(); /* automatically update */\r\n\t\t}\r\n\t}", "public void addChild(Element child) {\n super.addChild(child);\n }", "public void addChild(Element child) {\n super.addChild(child);\n }", "public void addChild(Element child) {\n super.addChild(child);\n }", "public void addChild(Element child) {\n super.addChild(child);\n }", "public void addChild(Element child) {\n super.addChild(child);\n }", "public void addChild(Element child) {\n super.addChild(child);\n }", "public void addChild(Element child) {\n super.addChild(child);\n }", "public void add(TreeNode child){\r\n\t\t\tchildren.add(child);\r\n\t\t\t//child.setParent(this);\r\n\t\t}", "protected void addChild(Layer child) {\n\t\tchildren.add(child);\n\t}", "private void addChild(Content child) {\n/* 238 */ this.tail.setNext(this.document, child);\n/* 239 */ this.tail = child;\n/* */ }", "public void addChild(TreeNode child)\r\n\t{\r\n child.setParent(this);\r\n\t\tm_children.addElement(child);\r\n\t}", "public void addChild(Node node){\n children.add(node);\n \n }", "protected void addChild(PafDimMember childNode) throws PafException {\r\n\t\t\r\n\t\ttry {\r\n\t\t\t// Create a new ArrayList of child nodes, if this is the first child\r\n\t\t\tif (children == null) \r\n\t\t\t\tchildren = new ArrayList<PafDimMember>();\r\n\t\t\t\r\n\t\t\t// Set parent of child node to current PafBaseMember node\r\n\t\t\tchildNode.parent = this;\r\n\r\n\t\t\t// Add child node to PafBaseTree\r\n\t\t\tchildren.add(childNode);\r\n\r\n\t\t} catch (Exception ex) {\r\n\t\t\t// throw Paf Exception\r\n\t\t\tString errMsg = \"Java Exception: \" + ex.getMessage();\r\n\t\t\tlogger.error(errMsg);\r\n\t\t\tPafException pfe = new PafException(errMsg, PafErrSeverity.Error, ex);\t\r\n\t\t\tthrow pfe;\r\n\t\t}\r\n\t}", "public void addChild(String branch, CommitNode child) {\r\n\t\tchildren.put(branch, child);\r\n\t}", "@Override\n public void childAdded(Node child) {\n }", "public void addChild(final int childIndex) {\n if (!this.children.contains(childIndex)) {\n this.children.add(childIndex);\n }\n }", "private void addChild(final TWidget child) {\n children.add(child);\n\n if ((child.enabled)\n && !(child instanceof THScroller)\n && !(child instanceof TVScroller)\n ) {\n for (TWidget widget: children) {\n widget.active = false;\n }\n child.active = true;\n activeChild = child;\n }\n for (int i = 0; i < children.size(); i++) {\n children.get(i).tabOrder = i;\n }\n }", "@Override\n public void addChild(WXComponent child) {\n addChild(child, -1);\n }", "public void addChild(AsNode child, double cost) {\n\t\tif(!children.contains(child)) {\n\t\t\tchildren.add(child);\n\t\t\tchildCost.put(child, cost);\n\t\t}\n\t}", "@objid (\"808c0873-1dec-11e2-8cad-001ec947c8cc\")\n public final void moveChild(GmNodeModel child, int index) {\n int oldIndex = this.children.indexOf(child);\n \n if (oldIndex == -1) {\n throw new IllegalArgumentException(\"The element is not in the children list\");\n }\n \n // If child already at asked position do nothing\n if (index == oldIndex) {\n return;\n }\n \n // If child already at asked last position do nothing\n if (index == -1 && oldIndex == this.children.size() - 1) {\n return;\n }\n \n this.children.remove(child);\n \n if (index == -1) {\n // Add to the end\n this.children.add(child);\n } else if (index > oldIndex) {\n // Child moved after old position,\n // Fix the index after removal.\n this.children.add(index - 1, child);\n } else {\n // Child moved before old position\n this.children.add(index, child);\n }\n \n firePropertyChange(IGmObject.PROPERTY_CHILDREN, null, child);\n }", "public abstract void addChild(Node node);", "public boolean addChild(ChronologElement child) {\r\n return children.add(child);\r\n }", "public void addChild(Node child, int weight) {\n\t\tthis.children.put(child, weight);\n\t}", "public void addChild( StringNode child )\r\n\t{\r\n\t\tthis.children.add( child );\r\n\t}", "public void add( Bacteria child) {\n\t\tinds.add(child);\n\t\tpopSize++;\n\t}", "public void insertChild(XMLElement child, int index)\n/* */ {\n/* 422 */ if (child == null) {\n/* 423 */ throw new IllegalArgumentException(\"child must not be null\");\n/* */ }\n/* 425 */ if ((child.getLocalName() == null) && (!this.children.isEmpty())) {\n/* 426 */ XMLElement lastChild = (XMLElement)this.children.lastElement();\n/* 427 */ if (lastChild.getLocalName() == null) {\n/* 428 */ lastChild.setContent(lastChild.getContent() + \n/* 429 */ child.getContent());\n/* 430 */ return;\n/* */ }\n/* */ }\n/* 433 */ child.parent = this;\n/* 434 */ this.children.insertElementAt(child, index);\n/* */ }", "public void add(QueryNode child);", "public void addRootNode(Node child){\r\n this.child = child;\r\n }", "public void addChild(Element child) {\n super.addChild(child);\n if (child instanceof TerminalDevice) terminalDevice = (TerminalDevice)child;\n }", "public void addChild(Taxon child) {\n\t\tif (child != null) {\n\t\t\tchildren.add(child);\n\t\t}\n\t}", "public void addChild(IDirectory child) {\n children.add(child);\n }", "void insertChild(K key, Node child) {\r\n\t\t\tint loc = Collections.binarySearch(keys, key);\r\n\t\t\tint childIndex = loc >= 0 ? loc + 1 : -loc - 1;\r\n\t\t\tif (loc >= 0) {\r\n\t\t\t\tchildren.set(childIndex, child);\r\n\t\t\t} else {\r\n\t\t\t\tkeys.add(childIndex, key);\r\n\t\t\t\tchildren.add(childIndex + 1, child);\r\n\t\t\t}\r\n\t\t}", "public void addChild(Node newChild) {\r\n\t\t\tchildren.reset();\r\n\t\t\t\r\n\t\t\tnewChild.setParent(this);\r\n\r\n\t\t\tif (children.size() == 0)\r\n\t\t\t\tchildren.add(newChild);\r\n\t\t\telse if (children.get().getData(0).getKey().compareTo(newChild.getData(0).getKey()) > 0) \r\n\t\t\t\tchildren.insert(newChild);\r\n\t\t\telse {\r\n\t\t\t\twhile (children.hasNext()) {\r\n\t\t\t\t\tif (children.next().getData(0).getKey().compareTo(newChild.getData(0).getKey()) > 0) break;\r\n\t\t\t\t}\r\n\t\t\t\tif (children.get().getData(0).getKey().compareTo(newChild.getData(0).getKey()) > 0) \r\n\t\t\t\t\tchildren.insert(newChild);\r\n\t\t\t\telse\r\n\t\t\t\t\tchildren.add(newChild);\r\n\t\t\t}\r\n\t\t}", "public void addChild(BTreeNode<E> newChild) {\n\t\tint index = 0;\n\t\tfor (BTreeNode<E> node : children) {\n\t\t\tif (node == null || cmp.compare(newChild.getData(0), node.data.get(0)) > 0) {\n\t\t\t\tindex++;\n\t\t\t}\n\t\t}\n\t\tchildren.add(index, newChild);\n\t\tnewChild.parent = this;\n\t}", "void appendChild(Object child);", "public void addChild(Node node) {\n\t\tthis.children.add(node);\n\t}", "public void addChildAt(int index, FileNode child) {\r\n child.setParent(this);\r\n this.children.add(index, child);\r\n childNum++;\r\n }", "@Override\n\tpublic void addChild(Node node) {\n\t\t\n\t}", "public void addChild(TreeNode toAdd) {\n\t\t\tthis.children.add(toAdd);\n\t\t}", "public void addChild(Character ch){\n children.put(ch,new Node(ch));\n }", "@Override\n public boolean add(E parent, E child) {\n Node tmp;\n boolean isAdded = true;\n\n if (parent == null || child == null) {\n isAdded = false;\n }\n //Add root and his child.\n if (root == null) {\n root = new Node(parent);\n root.children.add(new Node(child));\n } else {\n tmp = serchNode(parent, root);\n tmp.children.add(new Node(child));\n isAdded = true;\n\n }\n\n return isAdded;\n }", "public void addLastChild( PlanNode child ) {\n assert child != null;\n this.children.addLast(child);\n child.removeFromParent();\n child.parent = this;\n }", "protected final void addChild(final XmlAntTask child) {\n\t\tchilds.add(child);\n\t\tchild.setParent(this);\n\t}", "public void addChild(MagicPattern child) {\n\t\tif (child != null) {\n\t\t\tthis.children.add(child);\n\t\t}\n\t}", "void addChild( JBurgPatternMatcher child )\n\t{\n checkPrecondition ( ! this.hasNaryTail(), \"Cannot add a subpattern after an n-ary subpattern.\");\n checkPrecondition ( null == child.parent, \"Child \" + child.toString() + \" already has a parent.\");\n \n child.positionInParent = new Integer(this.subPatterns.size());\n child.parent = this;\n this.subPatterns.add(child);\n\t}", "TreeNode addChild(TreeNode node);", "@Override\n public boolean add(T parent, T child) {\n boolean result = false;\n if (this.root == null) {\n this.root = new Node<>(parent);\n this.root.add(new Node<>(child));\n result = true;\n this.modCount++;\n } else if (findBy(parent).isPresent()) {\n findBy(parent).get().add(new Node<>(child));\n result = true;\n this.modCount++;\n }\n return result;\n }", "public void childAdder(Character ch)\n {\n node.put(ch,new Node());\n }", "@Transient\n // not really needed\n public void addChild(final ChangeRequestMessageEntry child) {\n children.add(child);\n child.setParent(this);\n child.setProcessInstanceId(getProcessInstanceId());\n }", "@DISPID(1)\n\t// = 0x1. The runtime will prefer the VTID if present\n\t@VTID(7)\n\t@ReturnValue(type = NativeType.Dispatch)\n\tcom4j.Com4jObject addChild(\n\t\t\t@MarshalAs(NativeType.VARIANT) java.lang.Object node);", "@Override\n\tpublic void AddChild (Rule_ child) {\n\t\tchildRuleData.add(child);\n\t}", "public void addChild(Element child) {\n super.addChild(child);\n if (child instanceof LbInstances) lbInstances = (LbInstances)child;\n else if (child instanceof DataInstances) dataInstances = (DataInstances)child;\n }", "public void updateDatabaseRefForward(String child) {\n // move reference to the file, and then to the children attribute\n myRef = myRef.child(child).child(\"children\");\n }", "public void addChild(WSLNode node) {children.addElement(node);}", "public void addChildFile(IFile child) {\n childFiles.add(child);\n }", "public Tree<T> addChild(T childVal)\n {\n Tree<T> child = new Tree<T>(childVal, this);\n this.children.add(child);\n return child;\n }", "public TreeMapNode addChild(TreeMapNode child) {\n child.setParent(this);\n this.children.add(child);\n return child;\n }", "@Override\n\t\tpublic void add(TiUIView child)\n\t\t{\n\t\t\tfinal View nativeView = getNativeView();\n\t\t\tif (nativeView != null) {\n\t\t\t\tsetNativeView(this.content);\n\t\t\t\tsuper.add(child);\n\t\t\t\tsetNativeView(nativeView);\n\t\t\t} else {\n\t\t\t\tsuper.add(child);\n\t\t\t}\n\t\t}", "private void insertChild(K key, Node child) {\r\n\r\n // binary search for correct index\r\n int correct_place = Collections.binarySearch(keys, key);\r\n int child_indexing;\r\n\r\n // to check if the key is already in there and get the correct index after using collections.binarySearch\r\n if (correct_place >= 0) {\r\n child_indexing = correct_place + 1;\r\n } else {\r\n child_indexing = -correct_place - 1;\r\n }\r\n\r\n if (correct_place >= 0) {\r\n keys.add(child_indexing, key);\r\n children.add(child_indexing, child);\r\n } else {\r\n keys.add(child_indexing, key);\r\n children.add(child_indexing + 1, child);\r\n }\r\n }", "public void addChild(Node node) {\n\t\tValidate.notNull(node, \"The given node is null\");\n\t\tValidate.isTrue(this.graph == node.graph, \"The given node doesn't belong to the same graph\");\n\t\tValidate.isTrue(this != node, \"A node can't be its own child or parent\");\n\n\t\tthis.children.add(node);\n\t}", "public void moveChild( ChildType child, int index );", "public synchronized void addChild (TreeNode node)\r\n {\r\n if (logger.isFineEnabled()) {\r\n logger.fine(\"addChild node=\" + node + \" for \" + this);\r\n }\r\n\r\n children.add(node);\r\n node.setParent(this);\r\n }", "public void addChild(IndividualReference individualReference) {\n if (this.children == null) this.children = new ArrayList<>();\n this.children.add(individualReference);\n setNumChildren(Integer.toString(Integer.parseInt(this.numChildren.toString()) + 1));\n }", "public void addChild(ConfigurationTreeNode child) {\r\n\t\tchildren.put(child.getName(), child);\r\n\t\tchild.setParent(this);\r\n\t}", "public XMLPath addChild(String childLocalName) {\r\n if (childLocalName == null) {\r\n throw new IllegalArgumentException(\"XMLPath child localName cannot be null.\");\r\n }\r\n XMLPath child = new XMLPath(childLocalName, this);\r\n this.childs.put(childLocalName, child);\r\n return child;\r\n }", "public void connectChild(int childNum,Node child)\r\n\t{\r\n\t\tchildArray[childNum]=child;\r\n\t\tif(child!=null)\r\n\t\t{\r\n\t\t\tchild.parent=this;\r\n\t\t}\r\n\t}", "public DynamicModelPart addDynamicChild(DynamicModelPart child) {\n this.children.add(child);\n return this;\n }", "@Override\n\tpublic void insert(Node node) {\n\t\tchildren.add(node);\n\t}", "public void addFirstChild(Element parent, Element child) {\r\n\t\tNode firstChild = parent.getFirstChild();\r\n\t\tif (child.getNodeName() == firstChild.getNodeName()) {\r\n\t\t\tparent.replaceChild(child, firstChild);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tparent.insertBefore(child, parent.getFirstChild());\t\t\t\r\n\t\t}\r\n\t\t\r\n\t}", "public void addChild(int index, Node node) {\n\t\tthis.children.add(index, node);\n\t}", "public void addFirstChild( PlanNode child ) {\n assert child != null;\n this.children.addFirst(child);\n child.removeFromParent();\n child.parent = this;\n }", "public void addLastChild(Element parent, Element child) {\r\n\t\tNode lastChild = parent.getLastChild();\r\n\t\tif (child.getNodeName() == lastChild.getNodeName()) {\r\n\t\t\tparent.replaceChild(child, lastChild);\t\t\t\r\n\t\t}\r\n\t\telse {\r\n\t\t\tparent.appendChild(child);\t\t\t\r\n\t\t}\t\t\r\n\t}", "public void addChildLink(String page_id, Vector<String> child_ids) throws IOException \n\t{\n\t\tVector<String> children;\n\t\tif(childLink.getEntry(page_id)==null) \n\t\t{\n\t\t\tchildren = child_ids;\n\t\t}else{\n\t\t\tchildren = (Vector<String>) childLink.getEntry(page_id);\n\t\t\tchildren.addAll(child_ids);\n\t\t\tCollection noDup = new LinkedHashSet(children);\n\t\t\tchildren.clear();\n\t\t\tchildren.addAll(noDup);\n\t\t}\n\t\tchildLink.addEntry(page_id, children);\n\t}", "@Override\n public void addChild(ConfigurationNode child)\n {\n children.addNode(child);\n child.setAttribute(false);\n child.setParentNode(this);\n }", "@Override\n public void addChild(PandoraBoxAdapter<T> sub) {\n if (sub == null)\n return;\n\n if (sub.hasBind2Parent()) {\n sub.removeFromOriginalParent();\n }\n\n onBeforeChanged();\n int groupIndex = subs.size();\n sub.setGroupIndex(groupIndex);\n\n long count = getDataCount();\n sub.setStartIndex((int) count);\n sub.notifyHasAddToParent(this);\n subs.add(sub);\n onAfterChanged();\n }", "void depend(int parentID, int childID){\n check(parentID, childID);\n nodes_[childID].parent_ = parentID;\n nodes_[parentID].addChild(childID);\n }", "void insert(K key, V value) {\r\n\r\n\r\n Node child = getChild(key);\r\n child.insert(key, value);\r\n // to check if the child is overloaded\r\n if (child.isOverflow()) {\r\n Node sibling = child.split();\r\n insertChild(sibling.getFirstLeafKey(), sibling);\r\n }\r\n\r\n // if the node is full then it requires to split\r\n if (root.isOverflow()) {\r\n Node sibling = split();\r\n InternalNode newRoot = new InternalNode();\r\n newRoot.keys.add(sibling.getFirstLeafKey());\r\n newRoot.children.add(this);\r\n newRoot.children.add(sibling);\r\n root = newRoot;\r\n }\r\n\r\n }", "protected void addChild(DataNode value) {\n m_values.add(value);\n if (isCollection()) {\n \n // make this a complex collection if the added child is something more than a simple value\n if (value.getSchemaComponent() != getSchemaComponent() &&\n value.isInterior() || value.isCollection()) {\n m_complexCollection = true;\n }\n }\n }", "public boolean addChild(INode node) {\r\n final int low = searchChildren(node.getLocalNameBytes());\r\n if (low >= 0) {\r\n return false;\r\n }\r\n addChild(node, low);\r\n return true;\r\n }", "public void setChild(String child) {\n this.child = child;\n }", "public void addChildNode(TreeNode treeNode) {\n initChildList();\n childList.add(treeNode);\n }", "private void addChild(Ent e){\n\t\tif(e.getParent() == this){\n\t\t\treturn;\n\t\t}else if(e.getParent() != null){\n\t\t\te.removeFromParent();\n\t\t}\n\t\tif(e instanceof PhysEnt){\n\t\t\tDbg.Error(\"Cannot make PhysEnt a child : PhysEnt must be root entities.\");\n\t\t\treturn;\n\t\t}\n\t\te.bound.setParent(this);\n\t\tif(childList == null){\n\t\t\tchildList = new ArrayList<Ent>();\n\t\t}\n\t\tchildList.add(e);\n\t\tfor(Scene s:sceneList){\n\t\t\ts.addEntity(e);\n\t\t}\n\t}", "public void addBeforeLastChild(Element parent, Element child) {\r\n\t\tNode lastChild = parent.getLastChild();\r\n\t\tNode beforeLastChild = lastChild.getPreviousSibling();\r\n\t\tif (child.getNodeName() == beforeLastChild.getNodeName()) {\r\n\t\t\tparent.replaceChild(child, beforeLastChild);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tparent.insertBefore(child, lastChild);\t\t\t\r\n\t\t}\t\t\r\n\t}", "void addChild(InetSocketAddress address) throws IOException, JAXBException {\n if (!isRoot && parent.getAddress().equals(address)) {\n throw new IllegalArgumentException(\"Cannot assign parent to be a child\");\n }\n if (!children.containsKey(address)) {\n children.put(address, new Neighbor(socket, address, eventDispatcher));\n }\n }", "private void moveChild(ReactShadowNode child, int moveFromIndex) {\n mMoveProxy.setChildMoveFrom(moveFromIndex, child);\n }" ]
[ "0.7880707", "0.7673854", "0.7385615", "0.7350192", "0.734885", "0.7263794", "0.7226588", "0.71872973", "0.7132268", "0.71170294", "0.7037102", "0.7011188", "0.6972095", "0.6947975", "0.6899569", "0.68884504", "0.68884504", "0.68884504", "0.68884504", "0.68884504", "0.68884504", "0.68884504", "0.67895687", "0.66828156", "0.6681968", "0.663532", "0.6543908", "0.65373063", "0.651701", "0.64919764", "0.6490557", "0.6487534", "0.648381", "0.6476677", "0.6392966", "0.63879836", "0.63875127", "0.6377333", "0.63681257", "0.635073", "0.63498795", "0.6335974", "0.63192016", "0.63063693", "0.6299401", "0.62965924", "0.62847537", "0.62753606", "0.6265864", "0.62495196", "0.6232885", "0.62080806", "0.6194023", "0.61896217", "0.61710405", "0.61611885", "0.61148506", "0.6110784", "0.6100013", "0.6091776", "0.608896", "0.6074276", "0.60474056", "0.6042817", "0.60414785", "0.6040299", "0.5997002", "0.59955347", "0.5951187", "0.5904731", "0.589493", "0.58637166", "0.5863527", "0.5818731", "0.5818354", "0.58061695", "0.5803405", "0.5786365", "0.577258", "0.57516384", "0.57501227", "0.5738051", "0.5733719", "0.567657", "0.5670412", "0.5661992", "0.5641738", "0.5629977", "0.5615018", "0.55926704", "0.5588572", "0.5576577", "0.5547811", "0.5533048", "0.5524768", "0.5518728", "0.5513963", "0.5512198", "0.5492589", "0.5490745" ]
0.6388884
35
get the child of the node.
public IBiNode getChild() { return this.child; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Node getChild();", "public N getChild() {\n\t\tcheckRep();\n\t\treturn this.child;\n\t}", "public child getChild() {\n return this.child;\n }", "@Pure\n\tpublic TreeNode<?, ?> getChild() {\n\t\treturn this.child;\n\t}", "Node getChild(String childID) throws IllegalAccessException;", "public String getChild() {\n return child;\n }", "@Override public BTreeNode getChild(int index) {\n return this.children[index];\n }", "public Node getChild(int index) {\n\t\treturn this.children.get(index);\n\t}", "public BTreeNode<E> getChild(int pos) {\n\t\tif (pos >= 0 && pos < children.size()) {\n\t\t\treturn children.get(pos);\n\t\t}\n\t\telse {\n\t\t\treturn null;\n\t\t}\n\t}", "public Node getChild(int childNum) {\r\n\t\t\tif (childNum > children.size()) return null;\r\n\t\t\treturn children.get(childNum);\r\n\t\t}", "public IContentNode getChild(String path);", "Node getChild(K key) {\r\n\t\t\tint loc = Collections.binarySearch(keys, key);\r\n\t\t\tint childIndex = loc >= 0 ? loc + 1 : -loc - 1;\r\n\t\t\treturn children.get(childIndex);\r\n\t\t}", "public XMLPath getChild(String localName) {\r\n return this.childs.get(localName);\r\n }", "public Node getChild(Character ch){\n return children.get(ch);\n }", "private Node getChildById(String identifier)\r\n {\r\n Node result = null;\r\n\r\n result = convertNode(cmisSession.getObject(identifier));\r\n\r\n return result;\r\n }", "@objid (\"808c0841-1dec-11e2-8cad-001ec947c8cc\")\n public final GmNodeModel getChild(MRef ref) {\n for (GmNodeModel child : this.children) {\n if (child.getRepresentedRef().equals(ref)) {\n return child;\n }\n }\n return null;\n }", "public Figure getChild() {\n\t\treturn _child;\n\t}", "private Node getChild(char key) {\n for (Node child : children) {\n if (child.getKey() == key) {\n return child;\n }\n }\n return null;\n }", "private Node getChild(K key) {\r\n\r\n // binarySearch for the correct index\r\n int correct_place = Collections.binarySearch(keys, key);\r\n int child_indexing;\r\n if (correct_place >= 0) {\r\n child_indexing = correct_place + 1;\r\n } else {\r\n child_indexing = -correct_place - 1;\r\n }\r\n\r\n return children.get(child_indexing);\r\n }", "public ParseTreeNode getChild(final int index) {\r\n return _children.get(index);\r\n }", "public Node getChild(int quadrant) {\n\t\t\tif (quadrant < 0 || quadrant > 3) {\n\t\t\t\tthrow new IllegalArgumentException();\n\t\t\t} else {\n\t\t\t\treturn children[quadrant];\n\t\t\t}\n\t\t}", "public XMLElement getChild(int index)\n/* */ {\n/* 545 */ return (XMLElement)this.children.elementAt(index);\n/* */ }", "public Node returnNextChild(){\n try{\n return children.get(counter);\n }catch(Exception ex){\n return null;\n }\n }", "public TreeNode getChildAt(int childIndex)\n {\n return mChildren[childIndex];\n }", "public PlanNode getChild( int index ) {\n return this.children.isEmpty() ? null : this.children.get(index);\n }", "public Operator getChild() {\r\n\t\treturn child;\r\n\t}", "TreeNodeValueModel<T> child(int index);", "@Override\n public Object getChild(int groupPos, int childPos) {\n return item.get(groupPos).elements.get(childPos);\n }", "public Node getChild(String... args) throws ChildNotFoundException {\n\t\tNode child = null;\n\t\tfor(Node node : selected_nodes) {\n\t\t\ttry {\n\t\t\t\tchild = node.getChild(args);\n\t\t\t} catch (ChildNotFoundException e) {}\n\t\t}\n\t\tif(child == null) {\n\t\t\tthrow new ChildNotFoundException(\"No child found with that path\");\n\t\t}\n\t\treturn child;\n\t}", "@Override\n public Object getChild(int groupPosition, int childPosition) {\n return children[groupPosition][childPosition];\n }", "public final int child ()\r\n {\r\n return _value.child();\r\n }", "public WSLNode getChild(int i) {return (WSLNode) children.elementAt(i);}", "public Node getRightChild() {\r\n \treturn getChild(false);\r\n }", "public ChildType getChildAt( int index );", "@Override\n public ConfigurationNode getChild(int index)\n {\n return children.getNode(index);\n }", "private TreeNode getOnlyChild() {\n return templateRoot.getChildren().get(0);\n }", "@Override\n\tpublic NumberInterface getChild(int n) {\n\t\treturn numbers.get(n);\n\t}", "public Node getChild(boolean isLeft) {\r\n if (isLeft) {\r\n return leftChild;\r\n }\r\n else {\r\n return rightChild;\r\n }\r\n }", "@Override\r\n\tpublic Object getChild(int groupPosition, int childPosition) {\n\t\treturn null;\r\n\t}", "public estNode getChildWithID(int id) {\r\n\t\tif (children == null)\r\n\t\t\treturn null;\r\n\t\tfor (estNode child : children) {\r\n\t\t\tif (child.itemID == id) {\r\n\t\t\t\treturn child;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t}", "public Element getChild(String name) {\n return getChild(name, null, null);\n }", "@Override\n\tpublic Object getChild(int groupPosition, int childPosition) {\n\t\treturn null;\n\t}", "public FileNode getChildAt(int index) {\r\n return children.get(index);\r\n }", "public TreeItem getChild(int i) { return (TreeItem)children[i]; }", "public TreeNode getChildAt(int i) { return data[i]; }", "@Pure\n public QuadTreeNode<D> getUpperLeftChild() {\n QuadTreeNode<D>[] _children = this.children;\n QuadTreeNode<D> _get = null;\n if (_children!=null) {\n _get=_children[1];\n }\n return _get;\n }", "public int getChildNum() {\n return childNum;\n }", "public Object\tgetChild(Object parent, int index) {\t\n \tif (! (parent instanceof IdentityBranch)) return -1;\n \tIdentityBranch ibParent = (IdentityBranch)parent;\n \treturn ibParent.getChild(index);\n }", "public FcgLevel child() {\n\t\tif (direction == IN_AND_OUT) {\n\t\t\t// undefined--this node goes in both directions\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\"To get the child of the source level you \" + \"must use the constructor directly\");\n\t\t}\n\n\t\treturn child(direction);\n\t}", "public final AbstractComponent getChildComponent() {\n return this.child;\n }", "@DISPID(3)\n\t// = 0x3. The runtime will prefer the VTID if present\n\t@VTID(9)\n\t@ReturnValue(type = NativeType.Dispatch)\n\tcom4j.Com4jObject child(java.lang.String nodeName);", "Object getChild(int groupPosition, int childPosition);", "@Override\n public Object getChild(int groupPosition, int childPosition)\n {\n return children.get(headers.get(groupPosition)).get(childPosition);\n }", "public BaseGenerator\n getChild\n (\n Comparable key\n )\n throws ParseException\n {\n return pChildren.get(key);\n }", "public PSNode getChild(int parentPcr, QNm name, byte kind,\n\t\t\tNsMapping nsMapping) throws DocumentException;", "@Override\n\t\tpublic Object getChild(int groupPosition, int childPosition) {\n\t\t\treturn childPosition;\n\t\t}", "@Override\n public Object getChild(int groupPosition, int childPosition) {\n return this.child.get(this.header.get(groupPosition)).get(childPosition);\n }", "public int getChildNum() {\r\n\t\treturn childNum;\r\n\t}", "public ASTNode getChild(int i)\n\t{\n\t\treturn children.get(i);\n\t}", "public TrieNode<F> getChild(char label) {\r\n if(trieNodeMap.containsKey(label)){\r\n return trieNodeMap.get(label);\r\n }\r\n return null;\r\n }", "HNode getFirstChild();", "public XMLElement getChild(String path)\n/* */ {\n/* 563 */ if (path.indexOf('/') != -1) {\n/* 564 */ return getChildRecursive(PApplet.split(path, '/'), 0);\n/* */ }\n/* 566 */ int childCount = getChildCount();\n/* 567 */ for (int i = 0; i < childCount; i++) {\n/* 568 */ XMLElement kid = getChild(i);\n/* 569 */ String kidName = kid.getName();\n/* 570 */ if ((kidName != null) && (kidName.equals(path))) {\n/* 571 */ return kid;\n/* */ }\n/* */ }\n/* 574 */ return null;\n/* */ }", "public RMShape getChild(int anIndex) { return null; }", "public Node getLeftChild() {\r\n \treturn getChild(true);\r\n }", "@Pure\n\tpublic int getChildIndex() {\n\t\treturn this.childIndex;\n\t}", "public TeachersDomainStandardsNode getChild(String id) {\n\t\treturn (TeachersDomainStandardsNode) this.childMap.get(id);\n\t}", "@Override\n\tpublic Object getChild(int sectionPosition, int childPosition) {\n\t\treturn sections.get(sectionPosition).getArrayChildren().get(childPosition);\n\t}", "@JsProperty\n Node getFirstChild();", "public Node getRightChild() {\n\t\treturn null;\n\t}", "ComponentAgent getChild(int index);", "@Override\n\tpublic Component getChild(int index) {\n\t\treturn _childComponents.get(index);\n\t}", "public <T extends AbstractSceneElement> T getChildOfClass(Class<T> childClass) {\n for(AbstractSceneElement element : children) {\n if(element.getClass() == childClass) {\n return (T)element;\n }\n }\n throw new NullPointerException();\n }", "public TreeNode getChildNode(GameMove move) throws IllegalArgumentException;", "public SaveGameNode getFirstChild() {\r\n SaveGameNode node;\r\n node = this.children.get(0);\r\n return node;\r\n }", "@Pure\n public QuadTreeNode<D> getUpperRightChild() {\n QuadTreeNode<D>[] _children = this.children;\n QuadTreeNode<D> _get = null;\n if (_children!=null) {\n _get=_children[3];\n }\n return _get;\n }", "int getChildID(int nodeID, int n){\n check(nodeID);\n if (n < 0 || n >= nodes_[nodeID].size_)\n return -1;\n return nodes_[nodeID].children_[n];\n }", "Node getNode();", "@Override\n public IStatement getChild(int i) {\n\t return this._children.get(i);\n }", "public Node getNode() {\n\t\tif(piece != null)\n\t\t\troot.getChildren().addAll(piece.getImage(),rectangle);\n\t\telse\n\t\t\troot.getChildren().add(rectangle);\n\t\treturn root;\n\t}", "public int getChildIndex() {\n return childIndex;\n }", "public Node getChild(DslTagParser tag){\n this.rowWithoutDslTags = false; //if we go deeper it means that we found at least one nested tag\n Node node = new Node(this, tag, this.dictionaryName);\n this.children.add(node);\n this.currentNodeText = null; //reset currentNodeText\n return node;\n }", "@Override\n public Object getChild(int groupPosition, int childPosition) {\n return Lesson[groupPosition];\n }", "@Override\n public Node getImmediateChild(ChildKey name) {\n if (name.isPriorityChildName() && !this.priority.isEmpty()) {\n return this.priority;\n } else if (children.containsKey(name)) {\n return children.get(name);\n } else {\n return EmptyNode.Empty();\n }\n }", "public Node getNode();", "public ChildUser getChild(Long id){\n return childUserParser.getChild(id);\n }", "public abstract FilesystemEntry getNamedChild(String name);", "public String getDescendant() {\n return descendant;\n }", "public Glyph child(int position) throws OperationNotSupportedException, IndexOutOfBoundsException {\n throw new OperationNotSupportedException(\"This Glyph cannot have children\");\n }", "public BinaryTreeNode getRightChild() {\n\t\t\treturn null;\n\t\t}", "@Pure\n public QuadTreeNode<D> getLowerRightChild() {\n QuadTreeNode<D>[] _children = this.children;\n QuadTreeNode<D> _get = null;\n if (_children!=null) {\n _get=_children[2];\n }\n return _get;\n }", "public String getChildTagName() {\n return (String)attributes.get(\"childTagName\");\n }", "public static Node getChildNode(final Node node, final int nodeType) {\n\t\tfinal NodeList childNodeList = node.getChildNodes(); //get a reference to the child nodes\n\t\tfinal int childCount = childNodeList.getLength(); //find out how many children there are\n\t\tfor(int i = 0; i < childCount; ++i) { //look at each of the children\n\t\t\tfinal Node childNode = childNodeList.item(i); //get a reference to this node\n\t\t\tif(childNode.getNodeType() == nodeType) { //if this node is of the correct type\n\t\t\t\treturn childNode; //return this child node\n\t\t\t}\n\t\t}\n\t\treturn null; //indicate that no matching nodes were found\n\t}", "public Element getChild(String name, String attribute, String value) {\n return getChild(name, attribute, value, false);\n }", "public Component getChild(int i){\n return null;\n }", "public Node getNode() {\n return node;\n }", "public Node getNode() {\n return node;\n }", "public HTMLComponent getChild(int i);", "public Object getChild(int groupPosition, int childPosititon)\n {\n return playersDetails.get(groupPosition).get(childPosititon);\n }", "public String getHaschild() {\n return haschild;\n }", "public Resource getChild(String relPath) {\n return null;\n }" ]
[ "0.8088309", "0.77294564", "0.74550414", "0.74462235", "0.7227042", "0.7213356", "0.7212879", "0.70811135", "0.6987439", "0.6914412", "0.6858815", "0.6846831", "0.6825616", "0.6726408", "0.669017", "0.66296905", "0.6623513", "0.6610381", "0.6602525", "0.66019094", "0.655167", "0.65491444", "0.65309185", "0.6514582", "0.65082955", "0.65077627", "0.6485401", "0.64805204", "0.6480187", "0.64739335", "0.64493537", "0.64449406", "0.6425249", "0.64017093", "0.638777", "0.63791305", "0.63623285", "0.6361426", "0.6358976", "0.63460743", "0.63050586", "0.6295813", "0.62621534", "0.62489593", "0.62319356", "0.622526", "0.62131363", "0.620319", "0.61963665", "0.6190941", "0.6186214", "0.6183357", "0.6179424", "0.61759657", "0.6159296", "0.615604", "0.6136415", "0.6128776", "0.61182344", "0.60949665", "0.6080771", "0.60767925", "0.6075887", "0.60492224", "0.60389936", "0.60283", "0.6006884", "0.5993473", "0.59732515", "0.59729314", "0.59702575", "0.59580094", "0.5945769", "0.5928988", "0.591808", "0.5906718", "0.5902847", "0.58876115", "0.58717126", "0.58640057", "0.58624405", "0.5860735", "0.58511126", "0.5838081", "0.58328956", "0.58305615", "0.58159447", "0.58100903", "0.5804578", "0.58025193", "0.57958907", "0.57920694", "0.5785423", "0.57713264", "0.5770344", "0.5770344", "0.5758121", "0.57542485", "0.5753168", "0.57525355" ]
0.7583212
2
set child for this node.
public void setChild(final IBiNode c) { if (c != null) { c.setPrevious(this); } this.child = c; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setChild(String child) {\n this.child = child;\n }", "@Override\n\tpublic void setChild(Knoten child) {\n\n\t}", "public final XmlAttributeInfo setChild (int child)\r\n {\r\n _value.setChild(child);\r\n return this;\r\n }", "public void setChild(int position, Node n) {\r\n System.out.println(\"Attempt to add child to Variable\");\r\n }", "public void setChild(boolean isLeft, Node value) {\r\n \t// System.out.println(this + \", \" + value + \", \" + leftChild + \", \" + rightChild);\r\n if (isLeft) {\r\n leftChild = value;\r\n if (value != null) leftChild.parent = this;\r\n }\r\n else {\r\n rightChild = value;\r\n if (value != null) rightChild.parent = this;\r\n }\r\n }", "public void setChild(Figure f) {\n\t\tif (_child != null) {\n\t\t\t_child.repaint();\n\t\t\t_child.setParent(null);\n\t\t}\n\n\t\t_child = f;\n\n\t\tif (_child != null) {\n\t\t\t_child.setParent(this);\n\n\t\t\t// XXX _child.repaint();\n\t\t}\n\t}", "@Override\n\tpublic void setRightChild(WhereNode rightChild) {\n\n\t}", "public void testSetChild() {\n GeneralizableElement mockChild = EasyMock.createMock(GeneralizableElement.class);\n instance.setChild(mockChild);\n assertSame(\"same value expected.\", mockChild, instance.getChild());\n\n mockChild = EasyMock.createMock(GeneralizableElement.class);\n instance.setChild(mockChild);\n assertSame(\"same value expected.\", mockChild, instance.getChild());\n }", "public void setIsChild(Boolean isChild) {\n this.isChild = isChild;\n }", "@Override\n\tpublic void setLeftChild(WhereNode leftChild) {\n\n\t}", "public void setLeftChild(TreeNode leftChild) {\n this.leftChild = leftChild;\n }", "public void setChildNum(int value) {\n this.childNum = value;\n }", "public Builder setChildId(\n String value) {\n if (value == null) {\n throw new NullPointerException();\n }\n\n childId_ = value;\n onChanged();\n return this;\n }", "public void setRightChild(TreeNode rightChild) {\n this.rightChild = rightChild;\n }", "@Override\n\tpublic void setRightChild(ASTNode node) {\n\t\tthis.rightChild = node;\n\n\t}", "public void addChild(DecTreeNode child) {\r\n if (children != null)\r\n children.add(child);\r\n }", "public void addChild(Node child)\n\t{\n\t\tchild.parent = this;\n\t\t//if (!children.contains(child))\n\t\t//{\t\n\t\tchildren.add(child);\n\t\t//children.get(children.indexOf(child)-1).setBro(child);\n\t\t//}\n\t}", "public void setLeftChild(TreeNode left){\n\t\tleftChild = left;\n\t}", "public void setMater(T target, T rchild) throws ElementNotFoundException {\r\n int index = getIndex(target);\r\n if (index == -1) {\r\n throw new ElementNotFoundException(\"setMater: target not found\");\r\n }\r\n if (index * 2 + 2 >= SIZE) {\r\n System.out.println(\"out of bound\");\r\n return;\r\n } else {\r\n tree[index * 2 + 2] = rchild;\r\n }\r\n }", "public void setPater(T target, T lchild) throws ElementNotFoundException {\r\n int index = getIndex(target);\r\n if (index == -1) {\r\n throw new ElementNotFoundException(\"setPater: target not found\");\r\n }\r\n if (index * 2 + 1 >= SIZE) {\r\n System.out.println(\"out of bound\");\r\n return;\r\n } else {\r\n tree[index * 2 + 1] = lchild;\r\n }\r\n }", "@Override\n\tpublic void setLeftChild(ASTNode node) {\n\t\tthis.leftChild = node;\n\n\t}", "public void setLeftChild(RegressionTreeNode leftChild) {\n\t\tthis.leftChild = leftChild;\n\t}", "public void setLeftChild(BinaryNode leftChild) {\n\t\tthis.leftChild = leftChild;\n\t}", "public void setRightChild(BinaryNode rightChild) {\n\t\tthis.rightChild = rightChild;\n\t}", "public void addChild(DecTreeNode child) {\n\t\tif (children != null) {\n\t\t\tchildren.add(child);\n\t\t}\n\t}", "void setValue(String childID, Object value) throws ConverterException, IllegalAccessException;", "public void addRootNode(Node child){\r\n this.child = child;\r\n }", "public void addChild(Node child){\n children.add(child);\n }", "public void setLeftChild(Node<T> leftChild) {\n this.leftChild = leftChild;\n }", "public void setRightChild(RegressionTreeNode rightChild) {\n\t\tthis.rightChild = rightChild;\n\t}", "protected void addChild(PafDimMember childNode) throws PafException {\r\n\t\t\r\n\t\ttry {\r\n\t\t\t// Create a new ArrayList of child nodes, if this is the first child\r\n\t\t\tif (children == null) \r\n\t\t\t\tchildren = new ArrayList<PafDimMember>();\r\n\t\t\t\r\n\t\t\t// Set parent of child node to current PafBaseMember node\r\n\t\t\tchildNode.parent = this;\r\n\r\n\t\t\t// Add child node to PafBaseTree\r\n\t\t\tchildren.add(childNode);\r\n\r\n\t\t} catch (Exception ex) {\r\n\t\t\t// throw Paf Exception\r\n\t\t\tString errMsg = \"Java Exception: \" + ex.getMessage();\r\n\t\t\tlogger.error(errMsg);\r\n\t\t\tPafException pfe = new PafException(errMsg, PafErrSeverity.Error, ex);\t\r\n\t\t\tthrow pfe;\r\n\t\t}\r\n\t}", "public void addChild(XMLElement child)\n/* */ {\n/* 398 */ if (child == null) {\n/* 399 */ throw new IllegalArgumentException(\"child must not be null\");\n/* */ }\n/* 401 */ if ((child.getLocalName() == null) && (!this.children.isEmpty())) {\n/* 402 */ XMLElement lastChild = (XMLElement)this.children.lastElement();\n/* */ \n/* 404 */ if (lastChild.getLocalName() == null) {\n/* 405 */ lastChild.setContent(lastChild.getContent() + \n/* 406 */ child.getContent());\n/* 407 */ return;\n/* */ }\n/* */ }\n/* 410 */ child.parent = this;\n/* 411 */ this.children.addElement(child);\n/* */ }", "public void setHaschild(String haschild) {\n this.haschild = haschild == null ? null : haschild.trim();\n }", "public void setRightChild(Node<T> rightChild) {\n this.rightChild = rightChild;\n }", "private boolean setChild(TreeNode parent, TreeNode newChild, boolean isRightChild) {\n\t\tif(isRightChild) {\n\t\t\tparent.setRightChild(newChild);\n\t\t\tlength--;\n\t\t\treturn true;\n\t\t} else {\n\t\t\tparent.setLeftChild(newChild);\n\t\t\tlength--; \n\t\t\treturn true;\n\t\t}\n\t}", "public void addChild( StringNode child )\r\n\t{\r\n\t\tthis.children.add( child );\r\n\t}", "public void setRightChild(TreeNode right){\n\t\trightChild = right;\n\t}", "public void addChild( ChildType child );", "public void setChildNbr(String v) {\n if (ChildType_Type.featOkTst && ((ChildType_Type)jcasType).casFeat_childNbr == null)\n jcasType.jcas.throwFeatMissing(\"childNbr\", \"net.myerichsen.gedcom.ChildType\");\n jcasType.ll_cas.ll_setStringValue(addr, ((ChildType_Type)jcasType).casFeatCode_childNbr, v);}", "@Override\r\n\tpublic void setLeftChild(BinaryNodeInterface<E> leftChild) {\n\t\tthis.left=(BinaryNode<E>) leftChild;\r\n\t}", "public void addChild(T child) {\n this.children.add(child);\n child.setParent(this);\n this.invalidate();\n }", "public String getChild() {\n return child;\n }", "public void testSetChild_NullChild() {\n instance.setChild(null);\n assertNull(\"null expected.\", instance.getChild());\n }", "public void setLeftChild(BSTNode left) {\n\t\tthis.leftChild = left;\n\t}", "public Node getChild();", "public void replaceChild(Node child, Node newChild)\n\t{\n\t\tint index =0;\n\t\tif (children.contains(child))\n\t\t{\n\t\t\tindex=children.indexOf(child);\n\t\t\tchildren.set(index, newChild);\n\t\t}\n\t}", "public void setFather(node_data father) {\n\t\tthis.father = (DNode)father;\n\t}", "protected TreeChild (TreeChild child) {\n super (child);\n }", "public void addChild(Element child) {\n super.addChild(child);\n }", "public void addChild(Element child) {\n super.addChild(child);\n }", "public void addChild(Element child) {\n super.addChild(child);\n }", "public void addChild(Element child) {\n super.addChild(child);\n }", "public void addChild(Element child) {\n super.addChild(child);\n }", "public void addChild(Element child) {\n super.addChild(child);\n }", "public void addChild(Element child) {\n super.addChild(child);\n }", "@Override\r\n\tpublic void setRightChild(BinaryNodeInterface<E> rightChild) {\n\t\tthis.right=(BinaryNode<E>) rightChild;\r\n\t}", "public ChildNode() {\r\n\t\tsuper();\r\n\t\t// TODO Auto-generated constructor stub\r\n\t}", "public void addChild(FileNode child) {\r\n child.setParent(this);\r\n children.add(child);\r\n childNum++;\r\n }", "private void addChild(Content child) {\n/* 238 */ this.tail.setNext(this.document, child);\n/* 239 */ this.tail = child;\n/* */ }", "public void addChild(Element child) {\n super.addChild(child);\n if (child instanceof TerminalDevice) terminalDevice = (TerminalDevice)child;\n }", "public child getChild() {\n return this.child;\n }", "@Override public void setChildren(BTreeNode[] children) {\n this.children = children;\n }", "public void childAdder(Character ch)\n {\n node.put(ch,new Node());\n }", "public void addChild(String branch, CommitNode child) {\r\n\t\tchildren.put(branch, child);\r\n\t}", "public Edge(N child, L label) {\n\t\tthis.child = child;\n\t\tthis.label = label;\n\t\tcheckRep();\n\t}", "public IBiNode getChild() {\n return this.child;\n }", "protected void append_child(AstNode child) throws Exception {\r\n\t\tif (child == null)\r\n\t\t\tthrow new IllegalArgumentException(\"Invalid child: null\");\r\n\t\telse {\r\n\t\t\tif (child instanceof AstNodeImpl)\r\n\t\t\t\t((AstNodeImpl) child).set_parent(this);\r\n\t\t\tthis.children.add(child);\r\n\t\t\tthis.update_location(); /* automatically update */\r\n\t\t}\r\n\t}", "@objid (\"808c0873-1dec-11e2-8cad-001ec947c8cc\")\n public final void moveChild(GmNodeModel child, int index) {\n int oldIndex = this.children.indexOf(child);\n \n if (oldIndex == -1) {\n throw new IllegalArgumentException(\"The element is not in the children list\");\n }\n \n // If child already at asked position do nothing\n if (index == oldIndex) {\n return;\n }\n \n // If child already at asked last position do nothing\n if (index == -1 && oldIndex == this.children.size() - 1) {\n return;\n }\n \n this.children.remove(child);\n \n if (index == -1) {\n // Add to the end\n this.children.add(child);\n } else if (index > oldIndex) {\n // Child moved after old position,\n // Fix the index after removal.\n this.children.add(index - 1, child);\n } else {\n // Child moved before old position\n this.children.add(index, child);\n }\n \n firePropertyChange(IGmObject.PROPERTY_CHILDREN, null, child);\n }", "@Override\n public void childAdded(Node child) {\n }", "final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor property, boolean get, ASTNode child) {\n if (property == NAME_PROPERTY) {\n if (get) {\n return getName();\n } else {\n setName((SimpleName) child);\n return null;\n }\n }\n if (property == EXPRESSION_PROPERTY) {\n if (get) {\n return getExpression();\n } else {\n setExpression((Expression) child);\n return null;\n }\n }\n // allow default implementation to flag the error\n return super.internalGetSetChildProperty(property, get, child);\n }", "public void setRightChild(BSTNode right) {\n\t\tthis.rightChild = right;\n\t}", "@Override\n public void addChild(ConfigurationNode child)\n {\n children.addNode(child);\n child.setAttribute(false);\n child.setParentNode(this);\n }", "public void insertChild(XMLElement child, int index)\n/* */ {\n/* 422 */ if (child == null) {\n/* 423 */ throw new IllegalArgumentException(\"child must not be null\");\n/* */ }\n/* 425 */ if ((child.getLocalName() == null) && (!this.children.isEmpty())) {\n/* 426 */ XMLElement lastChild = (XMLElement)this.children.lastElement();\n/* 427 */ if (lastChild.getLocalName() == null) {\n/* 428 */ lastChild.setContent(lastChild.getContent() + \n/* 429 */ child.getContent());\n/* 430 */ return;\n/* */ }\n/* */ }\n/* 433 */ child.parent = this;\n/* 434 */ this.children.insertElementAt(child, index);\n/* */ }", "public void addChildNode (Node child) {\n\t\tObjects.requireNonNull(child);\n\t\t\n\t\tif(children == null) {\n\t\t\tchildren = new ArrayIndexedCollection();\t\n\t\t}\n\t\t\n\t\tchildren.add(child);\n\t}", "public void setFather(RMITreeNode father) throws RemoteException;", "public void addChild(Node childnode)\n {\n children.add(childnode);\n }", "@Override\n\tpublic void getChild(int index) {\n\t\t\n\t}", "public Builder setChildIdBytes(\n com.google.protobuf.ByteString value) {\n if (value == null) {\n throw new NullPointerException();\n }\n checkByteStringIsUtf8(value);\n\n childId_ = value;\n onChanged();\n return this;\n }", "public void setChildCount (int childCount) {\n this.childCount = childCount;\n }", "void appendChild(Object child);", "public void setRightChild(ObjectTreeNode parent, ObjectTreeNode r){\n if (parent == null || parent.getRight() != null) {\n System.out.println(\"Runtime Error: setRightChild()\");\n System.exit(1);\n }\n parent.setRight(r);\n }", "public void addChild(TreeNode child) {\n if (this.children!= null && !this.children.contains(child) && child != null)\n this.children.add(child);\n }", "public DiscoveryItem setChildColour(Colourizer colour) {\n this.childLineColour = colour;\n return this;\n }", "public void addChild(Character ch){\n children.put(ch,new Node(ch));\n }", "public void setChildren(Vector children)\r\n\t{\r\n\t\tm_children = children;\r\n\t}", "public void connectChild(int childNum,Node child)\r\n\t{\r\n\t\tchildArray[childNum]=child;\r\n\t\tif(child!=null)\r\n\t\t{\r\n\t\t\tchild.parent=this;\r\n\t\t}\r\n\t}", "public void addChildAt(int index, FileNode child) {\r\n child.setParent(this);\r\n this.children.add(index, child);\r\n childNum++;\r\n }", "public void setParent(int id);", "public void addChild(final ParseTreeNode child) {\r\n child.setParent(this);\r\n if (_children == null) { _children = new ArrayList<ParseTreeNode>(); }\r\n _children.add(child);\r\n }", "public void add(Node<E> child) {\n this.children.add(child);\n }", "public void add(TreeNode child){\r\n\t\t\tchildren.add(child);\r\n\t\t\t//child.setParent(this);\r\n\t\t}", "@Test\r\n public void testSetCollapsedChildAtExpanded() {\r\n getView().setShowRoot(true);\r\n TreeItem child = createBranch(\"single-replaced-child\", true);\r\n int index = 3;\r\n setItem(index -1, child);\r\n getSelectionModel().select(index);\r\n TreeItem collapsedChild = createBranch(\"another-single-replaced\");\r\n setItem(index -1, collapsedChild);\r\n assertEquals(index, getSelectedIndex());\r\n assertEquals(collapsedChild, getSelectedItem());\r\n }", "public void changeChild(Node oldChild, Node newChild) {\r\n System.out.println(\"Variable.changeChild() should never be called!\");\r\n }", "private void addChild(final TWidget child) {\n children.add(child);\n\n if ((child.enabled)\n && !(child instanceof THScroller)\n && !(child instanceof TVScroller)\n ) {\n for (TWidget widget: children) {\n widget.active = false;\n }\n child.active = true;\n activeChild = child;\n }\n for (int i = 0; i < children.size(); i++) {\n children.get(i).tabOrder = i;\n }\n }", "public void setLeftChild(ObjectTreeNode parent, ObjectTreeNode r) {\n if (parent == null || parent.getLeft() != null) {\n System.out.println(\"Runtime Error: setLeftChild()\");\n System.exit(1);\n }\n parent.setLeft(r);\n }", "public void addChild(TreeNode child)\r\n\t{\r\n child.setParent(this);\r\n\t\tm_children.addElement(child);\r\n\t}", "public void addChild(Taxon child) {\n\t\tif (child != null) {\n\t\t\tchildren.add(child);\n\t\t}\n\t}", "public void addChild(Element child) {\n super.addChild(child);\n if (child instanceof LbInstances) lbInstances = (LbInstances)child;\n else if (child instanceof DataInstances) dataInstances = (DataInstances)child;\n }", "@Override\n\t\tpublic void add(TiUIView child)\n\t\t{\n\t\t\tfinal View nativeView = getNativeView();\n\t\t\tif (nativeView != null) {\n\t\t\t\tsetNativeView(this.content);\n\t\t\t\tsuper.add(child);\n\t\t\t\tsetNativeView(nativeView);\n\t\t\t} else {\n\t\t\t\tsuper.add(child);\n\t\t\t}\n\t\t}", "final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor property, boolean get, ASTNode child) {\r\n\t\tif (property == EXPRESSION_PROPERTY) {\r\n\t\t\tif (get) {\r\n\t\t\t\treturn getExpression();\r\n\t\t\t} else {\r\n\t\t\t\tsetExpression((Expression) child);\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t}\r\n\t\t// allow default implementation to flag the error\r\n\t\treturn super.internalGetSetChildProperty(property, get, child);\r\n\t}" ]
[ "0.74733996", "0.72773", "0.6958668", "0.65741897", "0.63371146", "0.6282134", "0.6241083", "0.620601", "0.6182767", "0.6177626", "0.61431867", "0.6143166", "0.61329454", "0.6112557", "0.6082826", "0.60638976", "0.6008301", "0.5976364", "0.59514", "0.5930858", "0.59294313", "0.59269166", "0.59178424", "0.5909634", "0.59044737", "0.58641857", "0.58609545", "0.5854275", "0.58275414", "0.58264786", "0.5797305", "0.5760722", "0.57482404", "0.5737845", "0.5729563", "0.5725773", "0.5710387", "0.56871045", "0.56678504", "0.5662638", "0.56621766", "0.56539184", "0.56368226", "0.56287456", "0.5628578", "0.5615923", "0.56090826", "0.55935806", "0.55914015", "0.55914015", "0.55914015", "0.55914015", "0.55914015", "0.55914015", "0.55914015", "0.558609", "0.5584707", "0.55714154", "0.5569079", "0.55686384", "0.5560813", "0.5557669", "0.55564606", "0.5554022", "0.555188", "0.5536853", "0.55360013", "0.55143267", "0.55108774", "0.55035406", "0.5501429", "0.5489696", "0.54656506", "0.5459655", "0.5457923", "0.5451063", "0.5441241", "0.5416598", "0.54057497", "0.5392236", "0.5392019", "0.5383793", "0.53829306", "0.5382804", "0.5381183", "0.5376906", "0.5335329", "0.53316236", "0.5329073", "0.532872", "0.5317616", "0.52829", "0.52703446", "0.5267501", "0.5266342", "0.52396196", "0.5229852", "0.522805", "0.5206422", "0.5204776" ]
0.68406415
3
get the type of node.
public BiType getType() { return BiType.NODE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "NodeType getType();", "public NodeType getType() {\n return type;\n }", "public static String getNodeType() {\n\t\treturn NODE_TYPE;\n\t}", "public abstract AbstractNodeType getType();", "@NonNull NodeType<?> getType();", "public ASTType getTypeNode() {\n return (ASTType) getChild(0);\n }", "public Name getNodeTypeName() {\n return nodeTypeName;\n }", "Class<?> getNodeType() {\n return nodeType;\n }", "public NodeType getNodeType();", "public INodeType getNodeType();", "public Type getType(ParseTree node) {\n\t\treturn this.types.get(node);\n\t}", "@Override\n\tpublic int getNodeType() {\n\t\treturn nodeType;\n\t}", "short getNodeType(Object node);", "public short getNodeType();", "uk.ac.cam.acr31.features.javac.proto.GraphProtos.FeatureNode.NodeType getType();", "public uk.ac.cam.acr31.features.javac.proto.GraphProtos.FeatureNode.NodeType getType() {\n @SuppressWarnings(\"deprecation\")\n uk.ac.cam.acr31.features.javac.proto.GraphProtos.FeatureNode.NodeType result = uk.ac.cam.acr31.features.javac.proto.GraphProtos.FeatureNode.NodeType.valueOf(type_);\n return result == null ? uk.ac.cam.acr31.features.javac.proto.GraphProtos.FeatureNode.NodeType.TOKEN : result;\n }", "public uk.ac.cam.acr31.features.javac.proto.GraphProtos.FeatureNode.NodeType getType() {\n @SuppressWarnings(\"deprecation\")\n uk.ac.cam.acr31.features.javac.proto.GraphProtos.FeatureNode.NodeType result = uk.ac.cam.acr31.features.javac.proto.GraphProtos.FeatureNode.NodeType.valueOf(type_);\n return result == null ? uk.ac.cam.acr31.features.javac.proto.GraphProtos.FeatureNode.NodeType.TOKEN : result;\n }", "public int getNodeType(String type) {\n \treturn this.nodeType_index_.get(type);\n }", "public String getType(JmmNode node) {\n switch (node.getKind()) {\n case \"Add\":\n case \"Sub\":\n case \"Mul\":\n case \"Div\":\n return \"int\";\n\n case \"LessThan\":\n case \"And\":\n case \"Not\":\n return \"boolean\";\n\n case \"Var\":\n return getVariableSymbol(node.get(\"name\")).getType().getName();\n default:\n return null;\n }\n }", "public abstract int getNodeType();", "public String getTreeType();", "public String getNodeType( Node node )\n {\n String type;\n\n switch( node.getNodeType() )\n {\n case Node.ELEMENT_NODE:\n {\n type = \"Element\";\n break;\n }\n case Node.ATTRIBUTE_NODE:\n {\n type = \"Attribute\";\n break;\n }\n case Node.TEXT_NODE:\n {\n type = \"Text\";\n break;\n }\n case Node.CDATA_SECTION_NODE:\n {\n type = \"CData section\";\n break;\n }\n case Node.ENTITY_REFERENCE_NODE:\n {\n type = \"Entity reference\";\n break;\n }\n case Node.ENTITY_NODE:\n {\n type = \"Entity\";\n break;\n }\n case Node.PROCESSING_INSTRUCTION_NODE:\n {\n type = \"Processing instruction\";\n break;\n }\n case Node.COMMENT_NODE:\n {\n type = \"Comment\";\n break;\n }\n case Node.DOCUMENT_NODE:\n {\n type = \"Document\";\n break;\n }\n case Node.DOCUMENT_TYPE_NODE:\n {\n type = \"Document type\";\n break;\n }\n case Node.DOCUMENT_FRAGMENT_NODE:\n {\n type = \"Document fragment\";\n break;\n }\n case Node.NOTATION_NODE:\n {\n type = \"Notation\";\n break;\n }\n default:\n {\n type = \"Unknown, contact Sun!\";\n break;\n }\n }\n return type;\n }", "@Override\n\tpublic Type getType() {\n\t\treturn nodeList.get(nodeList.size() - 1).getType();\n\t}", "public String treeType();", "public static Class getType(final Node n) {\r\n return (Class) n.getProperty(TYPE);\r\n }", "public Type getType();", "public String getType();", "public String getType();", "public String getType();", "public String getType();", "public String getType();", "public String getType();", "public String getType();", "public String getType();", "public String getType();", "public String getType();", "public String getType();", "public String getType();", "public String getType();", "Type getType();", "Type getType();", "Type getType();", "Type getType();", "Type getType();", "Type getType();", "Type getType();", "Type getType();", "Type getType();", "Type getType();", "Type getType();", "protected abstract Class<? extends TreeStructure> getTreeType();", "type getType();", "public int getNodeType() {\n return mNodeType;\n }", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "String getType();", "public int getType();", "public int getType();", "public int getType();", "public int getType();", "public int getType();", "public String getNodeTypeString() {\n int nodeType = getNodeType();\n \n switch (nodeType) {\n case LocationStep.NODETYPE_NODE:\n return \"node()\";\n case LocationStep.NODETYPE_TEXT:\n return \"text()\";\n case LocationStep.NODETYPE_COMMENT:\n return \"comment()\";\n case LocationStep.NODETYPE_PI:\n return \"processing-instruction()\";\n }\n \n return null;\n }", "public String getType()\n \t{\n \t\treturn this.type;\n \t}", "int getType();", "int getType();", "int getType();", "int getType();", "int getType();", "int getType();", "int getType();", "int getType();", "NeuronType getType();", "public Class getType();", "public String getNodeTypeName(int idx) {\n \treturn this.nodeType_index_.get(idx);\n }", "public Type getType () {\n\t\treturn type;\n\t}", "java.lang.String getType();", "java.lang.String getType();", "java.lang.String getType();" ]
[ "0.83824116", "0.80093944", "0.7957543", "0.7904091", "0.7874124", "0.7858364", "0.78483355", "0.78087693", "0.7698615", "0.7563219", "0.7521271", "0.7478327", "0.7474336", "0.7420546", "0.7392698", "0.73886544", "0.7383956", "0.73561615", "0.73345554", "0.7292813", "0.72458094", "0.71789604", "0.71755993", "0.71735024", "0.7166793", "0.7119402", "0.70879215", "0.70879215", "0.70879215", "0.70879215", "0.70879215", "0.70879215", "0.70879215", "0.70879215", "0.70879215", "0.70879215", "0.70879215", "0.70879215", "0.70879215", "0.7062933", "0.7062933", "0.7062933", "0.7062933", "0.7062933", "0.7062933", "0.7062933", "0.7062933", "0.7062933", "0.7062933", "0.7062933", "0.70604146", "0.7056089", "0.70524687", "0.703876", "0.703876", "0.703876", "0.703876", "0.703876", "0.703876", "0.703876", "0.703876", "0.703876", "0.703876", "0.703876", "0.703876", "0.703876", "0.703876", "0.703876", "0.703876", "0.703876", "0.703876", "0.703876", "0.703876", "0.703876", "0.703876", "0.703876", "0.703876", "0.703876", "0.70326626", "0.70326626", "0.70326626", "0.70326626", "0.70326626", "0.69710386", "0.697069", "0.6967656", "0.6967656", "0.6967656", "0.6967656", "0.6967656", "0.6967656", "0.6967656", "0.6967656", "0.6959949", "0.6941505", "0.69308966", "0.69218946", "0.6904066", "0.6904066", "0.6904066" ]
0.742662
13
set the node as invalid, remove all children. replace node in DOMtree with a red ''
private void makeInvalidNode(final Document doc) { Element element; // create INVALID-textnode in DOM tree element = doc.createElement("mi"); element.setAttribute("mathcolor", "#F00"); element.appendChild(doc.createTextNode("#")); if (this.getNode().getParentNode() == null) { doc.replaceChild(element, this.getNode()); } else { this.getNode().getParentNode() .replaceChild(element, this.getNode()); } // remove bi-subtree this.setNode(element); this.child = null; this.invalid = true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void unhilitNode()\n {\n\tif (hilited==null) return;\n\tGraphics g = getGraphics();\n\tsetRenderColor(g,Color.black);\n\trenderCircle(g,hilited.x,hilited.y,hilited.diameter+4);\n\thilited = null;\n }", "public void clearError() {\n _hasError = false;\n _highlight = HighlightMode.NORMAL;\n _error = NodeError.NONE;\n \n }", "@Override\n public void clear() {\n root = new Node ('i', false, 256);\n }", "public void makeEmpty() {\r\n\t\troot = null;\r\n\t\tleftChild = null;\r\n\t\trightChild= null;\r\n\t}", "protected void checkRoot(){\n if (this.isEmpty() && this.root != null){\n this.root.setElement(null); //\n }\n }", "public void removeAll() \n { \n header.rightChild = nullNode; \n }", "public RedBlackTree()\n { \n \t root = null;\n }", "public void makeEmpty() {\n root = null;\n }", "public void setAsEmpty(){\n\t\tnodeStatus = Status.empty;\n\t\tunitNum=-1;\n\t}", "private void adjustRedParentNode(Node deficientNode, AtomicReference<Node> rootRef) {\n\t\tNode sibling = getSibling(deficientNode);\n if(deficientNode.parent.color == Color.RED && sibling.color == Color.BLACK && sibling.left.color == Color.BLACK\n && sibling.right.color == Color.BLACK) {\n \tsibling.color = Color.RED;\n \tdeficientNode.parent.color = Color.BLACK;\n return;\n } else {\n \tadjustRedChildBlackSibling(deficientNode, rootRef);\n }\n\t}", "public void clear() {\n\t\tthis.root = new Node();\n\t}", "public void makeEmpty() {\r\n\t\troot = null;\r\n\t}", "private void clearFullTree()\r\n {\r\n fullXmlTree = new StringBuilder();\r\n }", "public void makeEmpty() {\n\t\troot = null;\n\t}", "private Node removeChildNodes(Node node) throws TransformerException {\r\n\r\n NodeList children = node.getChildNodes();\r\n int index = 0;\r\n int length = children.getLength();\r\n\r\n for (index = 0; index < length; index++) {\r\n Node n = children.item(index);\r\n String nString = nodeToString(n);\r\n\r\n // for(Node n : node.getChildNodes()){\r\n if (n != null) {\r\n if (n.hasChildNodes()) {// edit to remove children of children\r\n removeChildNodes(n);\r\n node.removeChild(n);\r\n } else\r\n node.removeChild(n);\r\n }\r\n }\r\n String nodeString = nodeToString(node);\r\n return node;\r\n }", "protected void uncolorChildren(Node node) {\r\n int children = node.getChildren().size();\r\n for (int k = 0; k < children; k++) {\r\n colorObject(\"p\" + node.getChildren().get(k).getId(), edgeColor);\r\n }\r\n }", "private void deleteDegreeOneChild(Node curr, AtomicReference<Node> rootRef) {\n\t\tNode child = curr.right.isNull ? curr.left : curr.right;\n replaceNode(curr, child, rootRef);\n if(curr.color == Color.BLACK) {\n if(child.color == Color.RED) {\n child.color = Color.BLACK;\n } else {\n adjustRootDeficiency(child, rootRef);\n }\n }\n\t}", "public void makeEmpty()\n {\n root = nil;\n }", "public void makeEmpty( )\r\n\t{\r\n\t\troot = null;\r\n\t}", "public void reset(){\r\n \tif (blank != null){\r\n \t\tblank.clear();\r\n \t}\r\n \tif (blankNode != null){\r\n \t\tblankNode.clear();\r\n \t}\r\n }", "public void deleteNode ()\n {\n ConfigTreeNode node = _tree.getSelectedNode();\n ConfigTreeNode parent = (ConfigTreeNode)node.getParent();\n int index = parent.getIndex(node);\n ((DefaultTreeModel)_tree.getModel()).removeNodeFromParent(node);\n int ccount = parent.getChildCount();\n node = (ccount > 0) ?\n (ConfigTreeNode)parent.getChildAt(Math.min(index, ccount - 1)) : parent;\n if (node != _tree.getModel().getRoot()) {\n _tree.setSelectionPath(new TreePath(node.getPath()));\n }\n DirtyGroupManager.setDirty(group, true);\n }", "private void clearNodeFields() {\n nodeId.setText(\"\");\n sequencePreview.setText(\"\");\n leftNeighbours.setText(\"\");\n rightNeighbours.setText(\"\");\n position.setText(\"\");\n }", "public void removeRedBorder (){\n ((Label)_node).setBorder(NO_BORDER);\n }", "@Override\n protected void setChildrenEmptyFlags() {\n this.setIsRutaCollectionEmpty();\n }", "@Override\r\n public void clear(){\r\n root = null;\r\n }", "void fixViolation(Node node){\n\t\tNode parentPtr = nil;\n\t\tNode grParentPtr = nil;\n\t\t\n\t\twhile( node != root && node.colour != \"Black\" && node.parent.colour == \"Red\" && node.parent.parent != nil){\n\t\t\t\n\t\t\tparentPtr = node.parent;\n\t\t\tgrParentPtr = node.parent.parent;\n\t\t\t//case A\n\t\t\t//parent of node is the left child of grandparent\n\t\t\tif(parentPtr == grParentPtr.left){\n\t\t\t\tNode unclePtr = grParentPtr.right;\n\t\t\t\t\n\t\t\t\t//case 1 \n\t\t\t\t//Uncle is red in color\n\t\t\t\tif(unclePtr != nil && unclePtr.colour == \"Red\"){\n\t\t\t\t\tgrParentPtr.colour = \"Red\";\n\t\t\t\t\tparentPtr.colour = \"Black\";\n\t\t\t\t\tunclePtr.colour = \"Black\";\n\t\t\t\t\tnode = grParentPtr;\n\t\t\t\t}else{\n\t\t\t\t\t//case 2\n\t\t\t\t\t//of node is the right child of its parent\n\t\t\t\t\tif(node == parentPtr.right){\n\t\t\t\t\t\trotateLeft(parentPtr);\n\t\t\t\t\t\tnode = parentPtr;\n\t\t\t\t\t\tparentPtr = node.parent;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t//case 3\n\t\t\t\t\t//node is the left child of its parent left rotation is required\n\t\t\t\t\trotateRight(grParentPtr);\n\t\t\t\t\tString temp = parentPtr.colour;\n\t\t\t\t\tparentPtr.colour = grParentPtr.colour;\n\t\t\t\t\tgrParentPtr.colour = temp;\n\t\t\t\t\tnode = parentPtr;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t//case B\n\t\t\t//parent of the node is the right child of grand parent\n\t\t\tif(parentPtr == grParentPtr.right){\n\t\t\t\tNode unclePtr = grParentPtr.left;\n\t\t\t\t//case 1\n\t\t\t\t//uncle pointer is red\n\t\t\t\tif(unclePtr != nil && unclePtr.colour == \"Red\"){\n\t\t\t\t\tgrParentPtr.colour = \"Red\";\n\t\t\t\t\tparentPtr.colour = \"Black\";\n\t\t\t\t\tunclePtr.colour = \"Black\";\n\t\t\t\t\tnode = grParentPtr;\n\t\t\t\t}else{\n\t\t\t\t\t//case 2\n\t\t\t\t\t//node is the left child of its parent right rotation is required\n\t\t\t\t\tif(node == parentPtr.left){\n\t\t\t\t\t\trotateRight(parentPtr);\n\t\t\t\t\t\tnode = parentPtr;\n\t\t\t\t\t\tparentPtr = node.parent;\n\t\t\t\t\t}\n\t\t\t\t\t//case 3\n\t\t\t\t\t//node is the right child of its parent left rotation is required\n\t\t\t\t\trotateLeft(grParentPtr);\n\t\t\t\t\tString temp = parentPtr.colour;\n\t\t\t\t\tparentPtr.colour = grParentPtr.colour;\n\t\t\t\t\tgrParentPtr.colour = temp;\n\t\t\t\t\tnode = parentPtr;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\troot.colour = \"Black\";\n\t}", "public abstract void removeChild(Node node);", "@Override\n public void clear() {\n root = null;\n }", "TreeNode(){\n this.elem = null;\n this.left = null;\n this.right = null;\n }", "Node replaceChild(Node newChild, Node oldChild);", "private void adjustBlackSiblingRedChild(Node deficientNode, AtomicReference<Node> rootRef) {\n\t\tNode sibling = getSibling(deficientNode);\n\t\tsibling.color = sibling.parent.color;\n\t\tsibling.parent.color = Color.BLACK;\n if(isLeftChild(deficientNode)) {\n \tsibling.right.color = Color.BLACK;\n rotateLeft(sibling, false);\n } else {\n \tsibling.left.color = Color.BLACK;\n rotateRight(sibling, false);\n }\n if(sibling.parent == null) {\n \trootRef.set(sibling);\n }\n\t}", "@Override\r\n\tpublic void redo() \r\n\t\t{\n\t\twasRemoved = parent.removeChild(child);\r\n\t\tif (wasRemoved) \r\n\t\t\t{\r\n\t\t\tremoveArcs(sourceArcs);\r\n\t\t\tremoveArcs(targetArcs);\r\n\t\t\t}\r\n\t\t}", "public void invalidateAllEdges(EntityInstance root)\r\n\t{\r\n\t\tEnumeration en;\r\n\r\n\t\t/* Draw all the visible objects */\r\n\r\n\t\troot.invalidateAllEdges(); \r\n\r\n\t\tif (root.isOpen()) {\r\n\t\t\tfor (en = root.getChildren(); en.hasMoreElements(); ) {\r\n\t\t\t\tinvalidateAllEdges((EntityInstance) en.nextElement());\r\n\t\t}\t}\r\n\t}", "private void parseAndReplace(final BiTree biTree, final String text,\n final int length) throws ReparseException,\n NonIncrementalElementException {\n BiTree treePart;\n Node domValid;\n BiNode parent;\n final boolean invalidSibling;\n final boolean invalidPrevious;\n\n treePart = SAXBiParser.getInstance().parse(text);\n\n // parse unsuccessful\n if (treePart == null) {\n invalidSibling = this.getSibling() != null\n && this.getSibling().getType() == BiType.NODE\n && ((BiNode) this.getSibling()).invalid;\n\n invalidPrevious = this.getPrevious() != null\n && this.getPrevious().getType() == BiType.NODE\n && ((BiNode) this.getPrevious()).invalid;\n\n // if node & previous or node & sibling are invalid - reparse\n // parent\n if (invalidPrevious || invalidSibling) {\n throw new ReparseException();\n }\n\n if (!this.invalid) {\n this.makeInvalidNode((Document) biTree.getDocument());\n }\n\n this.changeLengthRec(length);\n\n } else {\n\n parent = this.getParent();\n domValid = treePart.getDOMTree((Document) biTree.getDocument());\n treePart.getRoot().addSibling(this.getSibling());\n\n // node is root\n if (parent == null) {\n\n // no emtpy text\n if (this.getPrevious() == null) {\n biTree.setRoot(treePart.getRoot());\n } else {\n // empty text on left side of root\n this.getPrevious().setSibling(treePart.getRoot());\n }\n\n // replace invalid DOM node\n biTree.getDocument().replaceChild(domValid, this.getNode());\n\n } else {\n if (this.getPrevious() == parent) {\n // invalid node is 1st child\n this.getParent().setChild(treePart.getRoot());\n } else {\n // 2nd - nth child\n this.getPrevious().setSibling(treePart.getRoot());\n }\n\n // replace invalid DOM node\n parent.getNode().replaceChild(domValid, this.getNode());\n parent.changeLengthRec(length);\n }\n\n this.invalid = false;\n }\n }", "public void fixViolationDelete(Node node){ \n\t\t\n\t while(node!=root && node.colour==\"Black\"){\n\t if(node==node.parent.left){\n\t \t//if the node is the left child and sibling is in the right\n\t Node sibling=node.parent.right;\n\t //check if the color of sibling is red then exchange the color with parent and rotate left \n\t if(sibling.colour == \"Red\"){\n\t \tsibling.colour = \"Black\";\n\t node.parent.colour = \"Red\";\n\t rotateLeft(node.parent);\n\t sibling=node.parent.right;\n\t }\n\t if(sibling.left.colour==\"Black\" && sibling.right.colour ==\"Black\"){\n\t \t//if both the children of sibling are black, change the color of the sibling and transfer the problem up the parent\n\t \tsibling.colour = \"Red\";\n\t node=node.parent;\n\t }\n\t else{ \n\t if(sibling.right.colour==\"Black\"){\n\t \t//if the left child of the sibling in red exchange the color of the sibling's child with sibling and color the child black\n\t \t// and rotate right\n\t \tsibling.left.colour = \"Black\";\n\t \tsibling.colour = \"Red\";\n\t rotateRight(sibling);\n\t sibling=node.parent.right;\n\t }\n\t //followed my the left rotation\n\t sibling.colour = node.parent.colour;\n\t node.parent.colour = \"Black\";\n\t sibling.right.colour = \"Black\";\n\t rotateLeft(node.parent);\n\t node=root;\n\t }\n\t }\n\t else{\n\t \t//node is the right child of the parent and sibling is the left child\n\t Node sibling=node.parent.left;\n\t \n\t if(sibling.colour == \"Red\"){\n\t \tsibling.colour = \"Black\";\n\t node.parent.colour = \"Red\";\n\t rotateRight(node.parent);\n\t sibling=node.parent.left;\n\t }\n\t \n\t if(sibling.right.colour==\"Black\" && sibling.left.colour==\"Black\"){\n\t \tsibling.colour = \"Red\";\n\t node=node.parent;\n\t }else{\n\t if(sibling.left.colour==\"Black\"){\n\t \tsibling.right.colour= \"Black\";\n\t \tsibling.colour = \"Red\";\n\t rotateLeft(sibling);\n\t sibling=node.parent.left;\n\t }\n\t \n\t sibling.colour = node.parent.colour;\n\t node.parent.colour = \"Black\";\n\t sibling.left.colour = \"Black\";\n\t rotateRight(node.parent);\n\t node=root;\n\t }\n\t }\n\t }\n\t //we color the node black\n\t node.colour = \"Black\";\n\t}", "public static void clear(Node node) {\n if (node.getNodeType() == Node.TEXT_NODE) {\n node.setNodeValue(\"\");\n } else {\n Node nextSibling, child = node.getFirstChild();\n while (child != null) {\n nextSibling = child.getNextSibling();\n child.removeFromParent();\n child = nextSibling;\n }\n }\n }", "private Node() {\n // Start empty.\n element = null;\n }", "TriNode() {\r\n children = new HashMap<>();\r\n isValidWord = false;\r\n }", "protected abstract AnimationFX resetNode();", "@Override\r\n\t\tpublic Node replaceChild(Node newChild, Node oldChild) throws DOMException\r\n\t\t\t{\n\t\t\t\treturn null;\r\n\t\t\t}", "public void makeEmpty(){\n deleteAll(root);\n root = null;\n numItems = 0;\n }", "void deleteTree(TreeNode node) \n {\n root = null; \n }", "public void removeInvalid() {\n invalidLabel.setVisible(false);\n }", "public void removeChildren() {\r\n this.children.clear();\r\n childNum = 0;\r\n }", "public void setToOriginals(){\n\t\t//set all occupied nodes as empty\n\t\tif(nodeStatus == Status.occupied){\n\t\t\tsetAsEmpty();\n\t\t}\n\t\t//if the node had a unit end on it, reset that value\n\t\tif(ended == true){\n\t\t\tended=false;\n\t\t}\n\t\tf=0;\n\t\tg=0;\n\t\th=0;\n\t}", "public void clear() {\n root = null;\n }", "public void clear() {\n root = null;\n }", "public void clear() {\n tree.clear();\n }", "@Override\r\n\t\tpublic Node removeChild(Node oldChild) throws DOMException\r\n\t\t\t{\n\t\t\t\treturn null;\r\n\t\t\t}", "protected void notifyChildRemoval(FONode node) {\n //nop\n }", "public void removeNode()\n\t{\n\t\tif (parent != null)\n\t\t\tparent.removeChild(this);\n\t}", "private void clearValidationError() {\n\n\t\tdataValid = false;\n\n\t\tvalidationErrorPending = false;\n\t\tvalidationErrorParent = null;\n\t\tvalidationErrorTitle = null;\n\t\tvalidationErrorMessage = null;\n\t\tvalidationErrorType = 0;\n\t}", "public void clear() {\n\t\t\tfor (AbstractTreeNode node : children) {\n\t\t\t\tnode.setParent(null);\n\t\t\t}\n\t\t\t\n\t\t\t// clear children\n\t\t\tchildren.clear();\n\t\t}", "public void delete() {\n this.root = null;\n }", "public FpTreeNode() {\n item_num = -1;\n parentNode = null;\n }", "public void removeChildren(QueryNode childNode);", "public void clear()\n\t{\n\t\tthis.getChildren().clear();\n\t}", "public void checkTree() {\r\n checkTreeFromNode(treeRoot);\r\n }", "public void updateChildNodes() {\n\t\tList<FTNonLeafNode> nodesToRemove = new ArrayList<FTNonLeafNode>();\n\t\tfor (FTNonLeafNode intermediateNode : intermediateNodes.values()) {\n\t\t\tList<FTNode> childNodesToRemove = new ArrayList<FTNode>();\n\t\t\tfor (String childName : intermediateNode.childNodes.keySet()) {\n\t\t\t\tif (intermediateNodes.containsKey(childName)) {\n\t\t\t\t\t// update child node if it has child node\n\t\t\t\t\tFTNonLeafNode childNode = intermediateNodes.get(childName);\n\t\t\t\t\tif ((childNode instanceof FTOrNode) || (childNode instanceof FTAndNode)) {\n\t\t\t\t\t\tintermediateNode.addChildNode(childName, intermediateNodes.get(childName));\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t// if parent node is an OR node\n\t\t\t\t\t\t// remove this child\n\t\t\t\t\t\tif (intermediateNode instanceof FTOrNode) {\n\t\t\t\t\t\t\tchildNodesToRemove.add(childNode);\n\t\t\t\t\t\t\tnodesToRemove.add(childNode);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// if parent node is an AND node\n\t\t\t\t\t\t// remove the parent node and child node\n\t\t\t\t\t\t// and set their values to false in case they are referenced by other nodes\n\t\t\t\t\t\telse if (intermediateNode instanceof FTAndNode) {\n\t\t\t\t\t\t\tnodesToRemove.add(intermediateNode);\n\t\t\t\t\t\t\tnodesToRemove.add(childNode);\n\t\t\t\t\t\t\t// mark the nodes as they are not getting removed till after the loop\n\t\t\t\t\t\t\tintermediateNode.resolved = true;\n\t\t\t\t\t\t\tintermediateNode.nodeValue = false;\n\t\t\t\t\t\t\tchildNode.resolved = true;\n\t\t\t\t\t\t\tchildNode.nodeValue = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tintermediateNode.removeChildNodes(childNodesToRemove);\n\t\t\t// if no child node left for this intermediate node,\n\t\t\t// then its parent node should remove this intermediate node as well\n\t\t}\n\t\t// remove the no child nodes\n\t\tfor (FTNonLeafNode node : nodesToRemove) {\n\t\t\tintermediateNodes.remove(node.nodeName);\n\t\t}\n\t}", "private void checkValidTree(Node node) {\n node.walk(store::updateObject);\n assertTrue(service.validateTree(node));\n }", "public void checkNodes() {\n // Don't do anything when you check the nodes. This nodes is built by\n // when the setTarget method is called.\n }", "void retainOutlineAndBoundaryGrid() {\n\t\tfor (final PNode child : getChildrenAsPNodeArray()) {\n\t\t\tif (child != selectedThumbOutline && child != yellowSIcolumnOutline && child != boundary) {\n\t\t\t\tremoveChild(child);\n\t\t\t}\n\t\t}\n\t\tcreateOrDeleteBoundary();\n\t}", "BaleElementEvent fixup()\n{\n if (line_elements.size() > 0) addLine();\n\n BaleElementEvent ee = new BaleElementEvent(root_element,new_children);\n root_element.clear();\n for (BaleElement be : new_children) root_element.add(be);\n BoardLog.logD(\"BALE\",\"ELEMENT FIXUP ROOT \" + new_children.size());\n\n return ee;\n}", "public Builder clearNode() {\n if (nodeBuilder_ == null) {\n node_ = null;\n onChanged();\n } else {\n node_ = null;\n nodeBuilder_ = null;\n }\n\n return this;\n }", "public Builder clearNode() {\n if (nodeBuilder_ == null) {\n node_ = null;\n onChanged();\n } else {\n node_ = null;\n nodeBuilder_ = null;\n }\n\n return this;\n }", "public void setInvalid();", "@Override\n public void clearAst() {\n this.root = null;\n }", "private void Clean(){\n \t NodeIterable nodeit = graphModel.getGraph().getNodes();\n \t\n \t for (Node node : nodeit) {\n\t\t\t\n \t\t \n \t\t \n\t\t}\n \t\n }", "public static void reset() {\n\t\tnodes.clear();\n\t\tid = 0;\n\t}", "final void setRemove(){\n getDocument().removeSpan(this);\n for (T child: this){\n if (child instanceof SpanBranch) ((SpanBranch)child).setRemove();\n }\n }", "public void cancelCellEditing() {\n boolean isDuplicated = isDuplicated((TreeNode)new DefaultMutableTreeNode(nodeEditor.getText()));\r\n if(isDuplicated && isPrintingHierarchy){\r\n DefaultMutableTreeNode modifiedNode = (DefaultMutableTreeNode)new DefaultMutableTreeNode(nodeEditor.getText());\r\n if(modifiedNode != null && selTreePath != null && selectedNode.getLevel() == 1) {\r\n TreePath currentTreePath = sponsorHierarchyTree.getPathForRow(0);\r\n sponsorHierarchyTree.getCellEditor().stopCellEditing();\r\n int row = sponsorHierarchyTree.getLeadSelectionRow();\r\n sponsorHierarchyTree.setSelectionRow(row);\r\n sponsorHierarchyTree.startEditingAtPath(currentTreePath.pathByAddingChild(modifiedNode));\r\n return;\r\n }\r\n }\r\n //Case#2445 - End\r\n if(!nodeEditor.getText().equals(selectedNode.toString())) {\r\n selectedNode.setUserObject(nodeEditor.getText());\r\n updateGroup((String)selectedNode.getUserObject(),selectedNode.getLevel());\r\n saveRequired = true;\r\n return;\r\n }\r\n currentEditor.cancelCellEditing();\r\n }", "private void unmountTree() {\n if (tree != null) {\n treePane.getChildren().clear();\n }\n }", "@Override\n public void removeChildren()\n {\n children.clear();\n }", "public void clearChildren() {\r\n this.children = null;\r\n }", "void invalidate() {\n\t\tinvalid = true;\n\t}", "public void reset() {\r\n\t\t_tb = new TreeBuffer();\r\n\t}", "private void resetAllTouched() {\n for (NetworkNode n: network.nodes) {\n n.touched = false;\n }\n }", "protected void removeAllChildNodes(Node elem) {\n NodeList<Node> childNodes = elem.getChildNodes();\n for (int i = childNodes.getLength() - 1; i >= 0; i--) {\n elem.removeChild(childNodes.getItem(i));\n }\n }", "protected void checkState()\n {\n if (getParentNode() != null)\n {\n throw new IllegalStateException(\n \"Node cannot be modified when added to a parent!\");\n }\n }", "private void removeRedundantGreyTable()\r\n \t{\r\n \t\tdeleteNodes(XPath.GREY_TABLE.query);\r\n \t}", "private void RemoveRootNode() {\n\t\t\n\t\troot_map.remove(this);\n\t\tis_node_set = false;\n\t\tif(left_ptr == null && right_ptr == null) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tleft_ptr.RemoveRootNode();\n\t\tright_ptr.RemoveRootNode();\n\t}", "public void resetValid()\n\t{\n\t\tthis.valid = true;\n\t}", "@Override\n public NodeList getChildNodes() {\n return null;\n }", "public void delete(Node node){\n\t\t//System.out.println(\" in delete\");\n\t Node tempNode=node;\n\t Node other;\n\t String checkColour = tempNode.colour;\n\t if(node.left==nil){\n\t \tother=node.right;\n\t transferLink(node,node.right);\n\t }\n\t else if(node.right==nil){\n\t \tother=node.left;\n\t transferLink(node,node.left);\n\t }\n\t else{\n\t \ttempNode=node.right;\n\t while(tempNode.left!=nil)\n\t \ttempNode=tempNode.left;\n\t checkColour=tempNode.colour;\n\t other=tempNode.right;\n\t if(tempNode.parent==node)\n\t \tother.parent=tempNode;\n\t else{\n\t \ttransferLink(tempNode,tempNode.right);\n\t \ttempNode.right=node.right;\n\t \ttempNode.right.parent=tempNode;\n\t }\n\t transferLink(node,tempNode);\n\t tempNode.left=node.left;\n\t tempNode.left.parent=tempNode;\n\t tempNode.colour=node.colour;\n\t }\n\t //if the node to be deleted has back color we caused a violation and is needed to be fixed\n\t if(checkColour==\"Black\")\n\t \tfixViolationDelete(other);\n\t}", "@Override\n protected void setChildrenEmptyFlags() {\n this.setIsMenuRolListEmpty();\n }", "@Override\n public void clear() {\n root = null;\n size = 0;\n }", "@Override\n public void clear() {\n root = null;\n size = 0;\n }", "@Override\n public void clear() {\n root = null;\n size = 0;\n }", "void forceRemoveNodesAndExit(Collection<Node> nodesToRemove) throws Exception;", "public RBTree() {\r\n\t\troot = null;\r\n\t}", "public void clearNodeList() {\r\n\t\tfor (int i = 0; i < radix; i++) {\r\n\t\t\tmyArray[i] = new NodeList();\r\n\t\t}\r\n\t}", "public void insertNewNode(int newElement ) \n { \n current = parent = grand = header; //set header value to current, parent, and grand node \n nullNode.element = newElement; //set newElement to the element of the null node \n \n //repeat statements until the element of the current node will not equal to the value of the newElement \n while (current.element != newElement) \n { \n great = grand; \n grand = parent; \n parent = current; \n \n //if the value of the newElement is lesser than the current node element, the current node will point to the current left child else point to the current right child. \n current = newElement < current.element ? current.leftChild : current.rightChild; \n \n // Check whether both the children are RED or NOT. If both the children are RED change them by using handleColors() method \n if (current.leftChild.color == RED && current.rightChild.color == RED) \n handleColors( newElement ); \n } \n \n // insertion of the new node will be fail if will already present in the tree \n if (current != nullNode) \n return; \n \n //create a node having no left and right child and pass it to the current node \n current = new RedBlackNode(newElement, nullNode, nullNode); \n \n //connect the current node with the parent \n if (newElement < parent.element) \n parent.leftChild = current; \n else \n parent.rightChild = current; \n handleColors( newElement ); \n }", "private void deleteNode(Node<K> p) {\n // If strictly internal, copy successor's element to p and then make p\n // point to successor.\n if (p.left != null && p.right != null) {\n Node<K> s = successor(p); // 节点有 2 个子节点时,找到实际删除的后继节点\n p.key = s.key; // 将后继节点的值复制到原来节点上,原来的节点只是值被删除,节点本身不删除\n p = s; // 将实际要删除的节点位置指向后继节点位置\n } // p has 2 children //\n // //////////////////////////////////////////////////////////////////\n // Start fixup at replacement node, if it exists. //\n Node<K> replacement = (p.left != null ? p.left : p.right); // 实际删除的节点最多只有一个子节点,并且一定是红色子节点\n if (replacement != null) { // 如果有一个红色子节点\n // Link replacement to parent //\n replacement.parent = p.parent; // 将此节点上移\n if (p.parent == null) //\n root = replacement; //\n else if (p == p.parent.left) // 实际被删除的节点 p 为左子\n p.parent.left = replacement; //\n else // 实际被删除的节点 p 为右子\n p.parent.right = replacement; //\n // //\n // Null out links so they are OK to use by fixAfterDeletion. //\n p.left = p.right = p.parent = null; //\n // //\n // Fix replacement //////////////////////////////////////////////////////////////////\n if (p.color == BLACK) // 删除情形 5. 因为 replacement 是红节点,所以这里 p 的颜色一定是黑色的\n fixAfterDeletion(replacement); // 修复只要将此红节点上移并置黑就完成了\n } else if (p.parent == null) { // return if we are the only node. //////////////////////////////////////////////////////////////////\n root = null; // 根节点被删除\n } else { // No children. Use self as phantom replacement and unlink. // 被删除的节点没有子节点时\n if (p.color == BLACK) // 如果是红色的节点,直接删除就完成\n fixAfterDeletion(p); // 如果被删除的是黑色节点,则会破坏红黑树性质 5,需要修复红黑树\n\n if (p.parent != null) {\n if (p == p.parent.left)\n p.parent.left = null;\n else if (p == p.parent.right)\n p.parent.right = null;\n p.parent = null;\n }\n }\n }", "public void clear() {\r\n\t\troot = null;\r\n\t\tsize = 0;\r\n\t}", "public void clear()\n {\n nodes.clear();\n }", "public void removePiece() {\n\t\troot.getChildren().clear();\n\t\tthis.piece = null;\n\t\troot.getChildren().add(rectangle);\n\t}", "public void setError() {\n _hasError = true;\n _highlight = HighlightMode.ERROR;\n _error = NodeError.ERROR;\n }", "public void clear() {\n\t\tnodeList.clear();\n\t}", "void validateNode(IQTree child) throws InvalidIntermediateQueryException;", "public void removeChild(WSLNode node) {children.removeElement(node);}" ]
[ "0.61553293", "0.6026618", "0.5933879", "0.56978476", "0.56831294", "0.5645256", "0.5626953", "0.5626049", "0.5623175", "0.5621088", "0.56143117", "0.55602974", "0.55515075", "0.55513", "0.5521457", "0.5518875", "0.55128723", "0.5483649", "0.5483429", "0.54424703", "0.5436913", "0.54204345", "0.54078287", "0.53977245", "0.5383995", "0.5380076", "0.5373745", "0.5363741", "0.5348276", "0.5318211", "0.5316904", "0.5287158", "0.52818924", "0.5262804", "0.5261706", "0.5256675", "0.5255983", "0.5255669", "0.5255567", "0.52553743", "0.5253337", "0.52419835", "0.52256435", "0.5225331", "0.52188075", "0.521436", "0.521436", "0.52093107", "0.520926", "0.5208446", "0.5206091", "0.5205737", "0.520087", "0.51924366", "0.5184417", "0.51835346", "0.51821864", "0.5171374", "0.51687", "0.5144778", "0.51408064", "0.51370984", "0.51247305", "0.51203805", "0.51203805", "0.5117606", "0.51142687", "0.51025295", "0.51012677", "0.51007336", "0.5096802", "0.5093494", "0.50784326", "0.50753486", "0.50740314", "0.5067573", "0.5057748", "0.5034229", "0.50321436", "0.5032006", "0.5019516", "0.50190973", "0.5018887", "0.50055426", "0.49913725", "0.49900538", "0.49900538", "0.49900538", "0.49881306", "0.49812087", "0.49803713", "0.4970305", "0.4952596", "0.49502912", "0.49473578", "0.49472144", "0.49461612", "0.49379462", "0.49372953", "0.49332482" ]
0.7593623
0
try to parse the text, if valid replace this node with parsed tree. else replace this node with invalid mark ''
private void parseAndReplace(final BiTree biTree, final String text, final int length) throws ReparseException, NonIncrementalElementException { BiTree treePart; Node domValid; BiNode parent; final boolean invalidSibling; final boolean invalidPrevious; treePart = SAXBiParser.getInstance().parse(text); // parse unsuccessful if (treePart == null) { invalidSibling = this.getSibling() != null && this.getSibling().getType() == BiType.NODE && ((BiNode) this.getSibling()).invalid; invalidPrevious = this.getPrevious() != null && this.getPrevious().getType() == BiType.NODE && ((BiNode) this.getPrevious()).invalid; // if node & previous or node & sibling are invalid - reparse // parent if (invalidPrevious || invalidSibling) { throw new ReparseException(); } if (!this.invalid) { this.makeInvalidNode((Document) biTree.getDocument()); } this.changeLengthRec(length); } else { parent = this.getParent(); domValid = treePart.getDOMTree((Document) biTree.getDocument()); treePart.getRoot().addSibling(this.getSibling()); // node is root if (parent == null) { // no emtpy text if (this.getPrevious() == null) { biTree.setRoot(treePart.getRoot()); } else { // empty text on left side of root this.getPrevious().setSibling(treePart.getRoot()); } // replace invalid DOM node biTree.getDocument().replaceChild(domValid, this.getNode()); } else { if (this.getPrevious() == parent) { // invalid node is 1st child this.getParent().setChild(treePart.getRoot()); } else { // 2nd - nth child this.getPrevious().setSibling(treePart.getRoot()); } // replace invalid DOM node parent.getNode().replaceChild(domValid, this.getNode()); parent.changeLengthRec(length); } this.invalid = false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void makeInvalidNode(final Document doc) {\n Element element;\n\n // create INVALID-textnode in DOM tree\n element = doc.createElement(\"mi\");\n element.setAttribute(\"mathcolor\", \"#F00\");\n element.appendChild(doc.createTextNode(\"#\"));\n\n if (this.getNode().getParentNode() == null) {\n doc.replaceChild(element, this.getNode());\n } else {\n this.getNode().getParentNode()\n .replaceChild(element, this.getNode());\n }\n\n // remove bi-subtree\n this.setNode(element);\n this.child = null;\n this.invalid = true;\n }", "private static void treeApproach(String s) throws ParsingException {\n\t}", "public void reParse() {\r\n \r\n \t\tSystem.out.println(\"Starting reparse\");\r\n \r\n \t\t// to reparse an entire document\r\n \r\n \t\t// A. remove all document positions & problem markers\r\n \t\tSystem.out.println(\"DUMPING POSITIONS\");\r\n \t\tdumpPositions();\r\n \t\ttry {\r\n \t\t\tgetFile().deleteMarkers(IMarker.PROBLEM, true, IResource.DEPTH_ZERO);\r\n \t\t\t_parseErrors.clear();\r\n \t\t} catch (CoreException e) {\r\n \t\t\te.printStackTrace();\r\n \t\t}\r\n \r\n \t\t// if this is not set, the document is new and has never been parsed before.\r\n \t\tif (_doc == null) {\r\n \t\t\tgetProjectNature().addToModel(this);\r\n \t\t} else {\r\n \r\n \t\t\t// B. remove compilation unit from model tree\r\n \t\t\tif(Config.debug()) {\r\n \t\t\t System.out.println(\"removing compilation unit from tree\");\r\n \t\t\t}\r\n \t\t\t// C. remove Document from project\r\n \t\t\tif(Config.debug()) {\r\n \t\t\t\tSystem.out.println(\"Remove document from project\");\r\n \t\t\t}\r\n \t\t\tgetProjectNature().removeDocument(this);\r\n \r\n \t\t\t// D. Re-add Document to the project (wich will cause it to be parsed)\r\n \t\t\tif(Config.debug()) {\r\n \t\t\t System.out.println(\"Re-add document to project\");\r\n \t\t\t}\r\n \t\t\tNamespace root = getProjectNature().getModel();\r\n \t\t\tgetProjectNature().addModelElement(this, root);\r\n \t\t}\r\n \r\n \t\tSystem.out.println(\"Einde reparse\");\r\n \t}", "private void parseRawText() {\n\t\t//1-new lines\n\t\t//2-pageObjects\n\t\t//3-sections\n\t\t//Clear any residual data.\n\t\tlinePositions.clear();\n\t\tsections.clear();\n\t\tpageObjects.clear();\n\t\tcategories.clear();\n\t\tinterwikis.clear();\n\t\t\n\t\t//Generate data.\n\t\tparsePageForNewLines();\n\t\tparsePageForPageObjects();\n\t\tparsePageForSections();\n\t}", "void visit(Text node);", "public void formatText(String text){\n\t\ttext = text.replaceAll(\"\\\\<[^>]*>\",\"\");\n\t}", "private void normaliseWhitespace() {\t\t\t\r\n\t\tdocument.normalizeDocument();\r\n\t\t\r\n\t\tif (document.getDocumentElement() == null) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\tfinal Queue<Node> queue = Lists.newLinkedList();\r\n\t\tqueue.add(document.getDocumentElement());\r\n\t\twhile (!queue.isEmpty()) {\r\n\t\t\tfinal Node node = queue.remove();\r\n\t\t\tfinal NodeList children = node.getChildNodes();\r\n\t\t\tfor (int index = 0; index < children.getLength(); index++) {\r\n\t\t\t\tqueue.add(children.item(index));\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (node.getNodeType() == Node.TEXT_NODE) {\r\n\t\t\t\tnode.setTextContent(node.getTextContent().trim());\r\n\t\t\t\tif (node.getTextContent().isEmpty()) {\r\n\t\t\t\t\tnode.getParentNode().removeChild(node);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public FreeTextNode(String content)\n {\n this.content = content == null ? \"\" : content;\n }", "public void set (String text) throws ParseException {\n\t\tParsing t = new Parsing(text);\n\t\tboolean p;\n\t\tthis.set();\t\t\t\t// Reset\n\t\tp = this.parsing(t);\n\t\tt.gobbleSpaces();\n\t\t/* Accept NULL */\n\t\tif (DEBUG>0) System.out.println(\"....Unit.set(\"+text+\")\" + p \n\t\t\t\t+ \" => \" + this.toString());\n\t\tif (t.pos < t.length) throw new ParseException\n\t\t(\"****Unit: set '\" + text + \"'+\" + t.pos, t.pos);\n\t}", "protected final void _setDocText(String text)\n throws BadLocationException\n {\n _doc.remove(0, _doc.getLength());\n _doc.insertString(0, text, null);\n }", "public TreeItem(StringBuffer text) throws DataFormatException, IOException {\n\t\tthis(text, 0);\n\t\tStreamTokenizer st = new StreamTokenizer(new StringReader(text.toString()));\n\t\tsetTokenizerNoWhitespace(st);\n\t\twhile (st.nextToken() != StreamTokenizer.TT_EOF)\n\t\t\tthrow new DataFormatException(\" Unexpected token \"+text.toString());\n\t\tsetNumNodes();\n\t}", "public void parse(){\n\n Integer childStart = this.findNewElement(0, this.document.length - 1);\n if(childStart == null){\n return;\n }\n\n this.root.removeData();\n this.copyTextToDocumentTree(this.root, 0, childStart - 1);\n\n DocumentSectionType childType = this.getType(childStart);\n\n do {\n Integer end = this.findNextSameLevelElement(childStart + 1, childType);\n //now we have boundaries of our new element, so let's grab it's index\n //we need appropriate matcher\n\n Matcher childMatcher = childType.getPattern().matcher(this.document[childStart]);\n childMatcher.find();\n DocumentTree child = new DocumentTree(childType, childMatcher.group(1), null);\n\n //now clear first line\n try{\n String group2 = childMatcher.group(2);\n this.document[childStart] = group2 != null ? group2 + \" \" : \"\";\n }catch(IndexOutOfBoundsException e){\n this.document[childStart] = \"\";\n }\n try {\n this.document[childStart] += childMatcher.group(3);\n }catch(IndexOutOfBoundsException e){\n this.document[childStart] += \"\";\n }\n //and copy it's text\n this.copyTextToDocumentTree(child, childStart, end - 1);\n root.addChild(child);\n //finally, parse it\n DocumentParser childParser = new DocumentParser(child, joinChapterWithChapterNames);\n childParser.parse();\n\n childStart = end;\n }while(childStart != this.document.length);\n\n if(this.root.getType() == DocumentSectionType.CHAPTER && this.joinChapterWithChapterNames){\n DocumentTree nameNode = (DocumentTree)this.root.getChildren().get(0);\n this.root.removeData();\n this.root.appendData(nameNode.getIndex());\n this.root.replaceChild(nameNode, nameNode.getChildren());\n }\n\n }", "private void parse() {\n stack.push(documentNode);\n try {\n Token token = lexer.nextToken();\n boolean tagOpened = false;\n\n while (token.getType() != TokenType.EOF) {\n\n if (token.getType() == TokenType.TEXT) {\n TextNode textNode = new TextNode((String) token.getValue());\n ((Node) stack.peek()).addChild(textNode);\n\n } else if (token.getType() == TokenType.TAG_OPEN) {\n if (tagOpened) {\n throw new SmartScriptParserException(\"The tag was previously open but is not yet closed.\");\n }\n tagOpened = true;\n lexer.setState(LexerState.TAG);\n\n } else if (token.getType() == TokenType.TAG_NAME && token.getValue().equals(\"=\")) {\n parseEchoTag(tagOpened);\n tagOpened = false;\n\n } else if (token.getType() == TokenType.TAG_NAME && ((String) token.getValue()).matches(\"[Ff][Oo][Rr]\")) {\n parseForTag(tagOpened);\n tagOpened = false;\n\n } else if (token.getType() == TokenType.TAG_NAME && ((String) token.getValue()).matches(\"[Ee][Nn][Dd]\")) {\n parseEndTag();\n tagOpened = false;\n } else {\n throw new SmartScriptParserException(PARSE_ERROR);\n }\n token = lexer.nextToken();\n }\n if (!(stack.peek() instanceof DocumentNode)) {\n throw new SmartScriptParserException(PARSE_ERROR);\n }\n } catch (LexerException | EmptyStackException exc) {\n throw new SmartScriptParserException(PARSE_ERROR);\n }\n}", "protected void textLeafInserted(MutationEvent evt) throws MelodyException {\r\n\t\tsuper.textLeafInserted(evt);\r\n\t\t// the changed node\r\n\t\tText t = (Text) evt.getTarget();\r\n\t\t// its parent element\r\n\t\tElement e = (Element) t.getParentNode();\r\n\t\tDUNID edunid = DUNIDDocHelper.getDUNID(e);\r\n\t\t// Modify the DUNIDDoc\r\n\t\tElement eori = getOwnerDUNIDDoc(e).getElement(edunid);\r\n\t\t// It is assume that the Element is a leaf, so setTextContent is OK\r\n\t\teori.setTextContent(t.getTextContent());\r\n\t\t// Modify the targets descriptor\r\n\t\tif (!areTargetsFiltersDefined()) {\r\n\t\t\t/*\r\n\t\t\t * If there is no targets filters defined, there's no need to modify\r\n\t\t\t * the targets descriptor.\r\n\t\t\t */\r\n\t\t\treturn;\r\n\t\t}\r\n\t\teori = getTargetsDescriptor().getElement(edunid);\r\n\t\tif (eori != null) { // changed node is in the targets descriptor\r\n\t\t\t// It is assume that the Element is a leaf, so setTextContent is OK\r\n\t\t\teori.setTextContent(t.getTextContent());\r\n\t\t}\r\n\t}", "public TreeNode(String text) {\n this.text = text;\n this.leftChild = null;\n this.rightChild = null;\n }", "private static RootedTree parseTree(String line,\n\t\t\tMap<String, String> translation)\n\t{\t\t\n\t\tString newickStr = StringUtils.selectFirstRegex(newickPattern, line);\t\t\t\t\n\t\tnewickStr=newickStr.substring(4); \t\n\t\t// hack (cannot translate in tree rep because of limitation of newick parser\t\t\n\t\tfor (String code : translation.keySet())\n\t\t{\n\t\t\tString codeCtx = StringUtils.selectFirstRegex(\"([,)(])\" + code + \"[:]\", newickStr);\t\t\t\n\t\t\tnewickStr = newickStr.replace(codeCtx + code + \":\", codeCtx + translation.get(code) + \":\");\n\t\t}\n\n\t\t// for (int i = translation.size(); i >= 1; i--)\n\t\t// newickStr = newickStr.replace(\"\" + i + \":\" , translation.get(\"\" + i) + \":\"); \n\n\t\tnewickStr = newickStr + \";\";\t\t\n\t\treturn RootedTree.Util.fromNewickString(newickStr);\n\t}", "protected synchronized void addChild(\n SetupParser parser, String text, int position\n ){\n boolean first = position == 0 && isDocumentFirst();\n SetupPointer pointer = SetupPointer.updatePointer(text,\n getDocument(), first);\n Optional<SpanBranch> span = parser.parse(pointer);\n stateCheck(! pointer.hasNext() && span.isPresent(),\n \"Has left over characters when reparsing: \" +\n getClass().getSimpleName()\n );\n addChild(span.get(), position);\n updateSpan();\n }", "private void textilize () {\n\n textIndex = 0;\n int textEnd = line.length() - 1;\n listChars = new StringBuffer();\n linkAlias = false;\n while (textIndex < line.length()\n && (Character.isWhitespace(textChar()))) {\n textIndex++;\n }\n while (textEnd >= 0\n && textEnd >= textIndex\n && Character.isWhitespace (line.charAt (textEnd))) {\n textEnd--;\n }\n boolean blankLine = (textIndex >= line.length());\n if (blankLine) {\n textilizeBlankLine();\n }\n else\n if ((textIndex > 0)\n || ((line.length() > 0 )\n && (line.charAt(0) == '<'))) {\n // First character is white space of the beginning of an html tag:\n // Doesn't look like textile... process it without modification.\n }\n else\n if (((textEnd - textIndex) == 3)\n && line.substring(textIndex,textEnd + 1).equals (\"----\")) {\n // && (line.substring(textIndex, (textEnd + 1)).equals (\"----\")) {\n textilizeHorizontalRule(textIndex, textEnd);\n } else {\n textilizeNonBlankLine();\n };\n }", "private void parseAndFormatInput() {\n try {\n String input = getText();\n if (input == null || input.length() == 0) {\n return;\n }\n Number parsedNumber = nf.parse(input);\n BigDecimal newValue = new BigDecimal(parsedNumber.toString());\n setNumber(newValue);\n selectAll();\n } catch (ParseException ex) {\n // If parsing fails keep old number\n setText(nf.format(number.get()));\n }\n }", "public TextNode(String text) {\n\t\tthis.text = text;\n\t}", "public boolean setRawText(String text) {\n\t\ttry {\n\t\t\ttext = text.replace(\" \", \"\");\n\t\t\tString[] line = text.split(\"\\n\");\n\n\t\t\tif (line.length != 2) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tline[0] = replaceWithChars(line[0]);\n\t\t\tline[0] = line[0].substring(5);\n\n\t\t\tString[] names = line[0].split(\"<\");\n\n\t\t\tthis.nume = names[0];\n\n\t\t\tthis.prenume = \"\";\n\t\t\tfor (int i=1; i<names.length; i++) {\n\t\t\t\tif (names[i] != null && ! names[i].equals(\"\")) {\n\t\t\t\t\tthis.prenume += names[i] + \" \";\n\t\t\t\t}\n\t\t\t}\n\t\t\t//\n\t\t\t// Start processing second line. \n\t\t\t//\n\t\t\tnames = line[1].split(\"<\");\n\n\t\t\tif (names.length != 2) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tthis.seria = \"\" + names[0].charAt(0); \n\t\t\tif (names[0].charAt(1) == '0') {\n\t\t\t\tthis.seria += \"D\";\n\t\t\t} else {\n\t\t\t\tthis.seria += names[0].charAt(1);\n\t\t\t}\n\n\t\t\tthis.numarul = replaceWithNumbers( names[0].substring(2) );\n\t\t\tthis.cetatenia = replaceWithNumbers( names[1].substring(0,4) ) ;\n\t\t\tthis.dataNasteri = replaceWithNumbers( names[1].substring(4,10) ) ;\n\t\t\tthis.sex = names[1].charAt(11);\n\t\t\tif (sex == 'H') {\n\t\t\t\tsex = 'M';\n\t\t\t}\n\t\t\t\n\t\t\tthis.valabilitate = replaceWithNumbers(names[1].substring(12,18));\n\n\t\t\tthis.CNP = sex == 'F'?\"2\" : \"1\";\n\t\t\tthis.CNP += this.dataNasteri + replaceWithNumbers( names[1].substring(20,26));\n\t\t\t\n\t\t\tthis.validate();\n\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "private void processText(){\n if(text == null || text.length() == 0){\n // When posting a tweet, Twitter returns the \"text\" JSON field even if it's not trimmed...\n text = trimmedText;\n }else{\n // Trim the original contents received from Twitter\n text = text.substring(0, text.offsetByCodePoints(0, displayTextRange[1]));\n }\n\n // Transform HTML characters (for some reason Twitter sends those)\n text = org.apache.commons.text.StringEscapeUtils.unescapeHtml4(text);\n }", "public void reset(){\n try {\n getDocument().remove(0,getDocument().getLength()); \n if(defaultText != null){\n getDocument().insertString(0,defaultText,null); \n }\n }catch (BadLocationException ble){\n System.err.println(\"Reset ist fehlgeschlagen!\");\n }\n }", "public void unsetText()\n {\n synchronized (monitor())\n {\n check_orphaned();\n get_store().remove_element(TEXT$18, 0);\n }\n }", "public SimpleHtmlParser createNewParserFromHereToText(String text) throws ParseException {\n return new SimpleHtmlParser(getStringToTextAndSkip(text));\n }", "@Override\n\tpublic String unparse() {\n\t\treturn null;\n\t}", "void visitTextNode(TextNode node);", "@Override\n public String parse(ValidationInfo validationInfo) {\n return null;\n }", "protected void textLeafModified(MutationEvent evt) throws MelodyException {\r\n\t\tsuper.textLeafModified(evt);\r\n\t\t// the changed node\r\n\t\tText t = (Text) evt.getTarget();\r\n\t\t// its parent element\r\n\t\tElement e = (Element) t.getParentNode();\r\n\t\tDUNID edunid = DUNIDDocHelper.getDUNID(e);\r\n\t\t// Modify the DUNIDDoc\r\n\t\tElement eori = getOwnerDUNIDDoc(e).getElement(edunid);\r\n\t\t// It is assume that the Element is a leaf, so getFirstChild is OK\r\n\t\teori.getFirstChild().setNodeValue(t.getTextContent());\r\n\t\t// Modify the targets descriptor\r\n\t\tif (!areTargetsFiltersDefined()) {\r\n\t\t\t/*\r\n\t\t\t * If there is no targets filters defined, there's no need to modify\r\n\t\t\t * the targets descriptor.\r\n\t\t\t */\r\n\t\t\treturn;\r\n\t\t}\r\n\t\teori = getTargetsDescriptor().getElement(edunid);\r\n\t\tif (eori != null) { // changed node is in the targets descriptor\r\n\t\t\t// It is assume that the Element is a leaf, so getFirstChild is OK\r\n\t\t\teori.getFirstChild().setNodeValue(t.getTextContent());\r\n\t\t}\r\n\t}", "protected void textLeafRemoved(MutationEvent evt) throws MelodyException {\r\n\t\tsuper.textLeafRemoved(evt);\r\n\t\t// the changed node\r\n\t\tText t = (Text) evt.getTarget();\r\n\t\t// its parent element\r\n\t\tElement e = (Element) t.getParentNode();\r\n\t\tDUNID edunid = DUNIDDocHelper.getDUNID(e);\r\n\t\t// Modify the DUNIDDoc\r\n\t\tElement eori = getOwnerDUNIDDoc(e).getElement(edunid);\r\n\t\t// It is assume that the Element is a leaf, so getFirstChild is OK\r\n\t\teori.removeChild(eori.getFirstChild());\r\n\t\t// Modify the targets descriptor\r\n\t\tif (!areTargetsFiltersDefined()) {\r\n\t\t\t/*\r\n\t\t\t * If there is no targets filters defined, there's no need to modify\r\n\t\t\t * the targets descriptor.\r\n\t\t\t */\r\n\t\t\treturn;\r\n\t\t}\r\n\t\teori = getTargetsDescriptor().getElement(edunid);\r\n\t\tif (eori != null) { // changed node is in the targets descriptor\r\n\t\t\t// It is assume that the Element is a leaf, so getFirstChild is OK\r\n\t\t\teori.removeChild(eori.getFirstChild());\r\n\t\t}\r\n\t}", "public synchronized void setText(final String text) {\n try {\n int length = document.getLength();\n if (document instanceof AbstractDocument) {\n ((AbstractDocument)document).replace(0, length, text, null);\n } else {\n document.remove(0, length);\n document.insertString(0, text, null);\n }\n } catch (final BadLocationException e) {\n }\n }", "private void processPendingText() throws SAXException {\n if(state==AFTER_START_ELEMENT) {\n for( int i=bufLen-1; i>=0; i-- )\n if( !WhiteSpaceProcessor.isWhiteSpace(buf[i]) ) {\n super.characters(buf, 0, bufLen);\n return;\n }\n }\n }", "public DecisionTree(String text) {\r\n\t\tsuper(text);\r\n\t\t// Current node starts at root of tree\r\n\t\tcurrent = this.getRootNode();\r\n\t}", "public static void parseText(Lexer lexer, ObjectStack stack) {\n\t\tToken token = lexer.getToken();\n\t\tNode parsed = new TextNode((String) token.getValue());\n\t\t\n\t\tNodeStackManager.addChildToStack(stack, parsed);\n\t}", "@Test\n\tpublic void testTextToXml()\n\t{\n\t\tDocument doc = XMLUtil.createEmpty();\n\t\tText text = new Text(\"Steve Unger Smells\");\n\t\tElement element = this.parser.toXML(doc, text);\n\t\tText text2 = this.parser.fromXML(element);\n\t\t\n\t\tassertEquals(\"Steve Unger Smells\", text2.getText());\t\t\n\t}", "@Override\r\n\t\tpublic void setTextContent(String textContent) throws DOMException\r\n\t\t\t{\n\t\t\t\t\r\n\t\t\t}", "public abstract boolean isParseCorrect();", "@Override\r\n\tprotected void parseSelf(String leftstr)\r\n\t{\n\t\t\r\n\t}", "void replaceRegex() {\n int index = -1;\n for (int i = 0; i < regex.elist.size(); i++) {\n if (regex.elist.get(i).isShareableUnit) {\n ElementShareableUnit share = (ElementShareableUnit) regex.elist.get(i);\n if (share.share == this) {\n index = i;\n }\n }\n }\n //replace in parenthesis\n for (int i = 0; i < regex.elist.size(); i++) {\n Element e = regex.elist.get(i);\n if (e.isParentheis) {\n e.replaceRegex(this);\n }\n\n }\n if (index == -1) {\n System.out.println(\"there is error \" + this.getString());\n } else {\n regex.elist.remove(index);\n for (int i = 0; i < this.lelement.size(); i++) {\n regex.elist.add(index + i, this.lelement.get(i));\n }\n }\n //System.out.println(\"After: \" + this.regex.getString());\n }", "public void markup( String text )\n {\n // Indent only of this is the first text on the line\n markup( text, rst.isEmpty() || rst.endsWith( NEW_LINE ) );\n }", "public synchronized void replaceSelection(final String text) {\n int dot = caret.getDot();\n int mark = caret.getMark();\n try {\n int start = Math.min(dot, mark);\n int length = Math.abs(dot - mark);\n if (document instanceof AbstractDocument) {\n ((AbstractDocument)document).replace(start, length, text, null);\n } else {\n replaceString(start, length, text, null);\n }\n } catch (final BadLocationException e) { }\n }", "@Override public List<Node> visitText(@NotNull XQueryParser.TextContext ctx) {\n\t\tfor(int i = 0; i < r.size(); ){\n\t\t\tif(r.get(i).getNodeType() != Node.TEXT_NODE ){\n\t\t\t\tr.remove(i);\n\t\t\t} else i++;\n\t\t}\n\t\treturn visitChildren(ctx);\n\t}", "@Test\n public void testPhylogeneticTreeParserNoNamesNoDistance() {\n // create the actual tree\n String tree = \"(,,(,));\";\n PhylogeneticTreeItem rootActual = PhylogeneticTreeParser.parse(tree);\n\n // create the expected Tree\n // root node\n PhylogeneticTreeItem rootExpected = new PhylogeneticTreeItem();\n // add 3 child nodes\n PhylogeneticTreeItem current = new PhylogeneticTreeItem();\n current.setParent(rootExpected);\n current = new PhylogeneticTreeItem();\n current.setParent(rootExpected);\n current = new PhylogeneticTreeItem();\n current.setParent(rootExpected);\n // add 2 child nodes to the third node\n PhylogeneticTreeItem current2 = new PhylogeneticTreeItem();\n current2.setParent(current);\n current2 = new PhylogeneticTreeItem();\n current2.setParent(current);\n\n // compare the trees\n assertEquals(\"both trees do not match\", rootExpected, rootActual);\n\n }", "@Override\npublic\tvoid parseInput() {\n InputStream is = new ByteArrayInputStream(this.body.toString().getBytes());\n\t\t\n\t\t\n\t\ttry {\n\t\t\tthis.domIn = new XMLInputConversion(is);\n\t\t} catch (ParserConfigurationException | SAXException | IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\tthis.rootXML = this.domIn.extractDOMContent();\n\t}", "public void update() {\n textBuffer.resetLineInfo();\n textBuffer.resetTraversalMan();\n x_pos = X_INIT;\n y_pos = 0;\n queue = new LinkedList<>();\n auxQueue = new LinkedList<>();\n cursorPos = null;\n\n renderFlag = Math.max(renderFlag-1, -1);\n if (renderFlag == 0) {\n root.getChildren().removeAll(renderPieces);\n renderPieces.clear();\n }\n\n Text text;\n while ((text = textBuffer.advance()) != null) {\n if (textBuffer.isCurrentPos()) {\n cursorPos = text;\n }\n if (x_pos == X_INIT) {\n textBuffer.putLineNo_StartNode_mapping(textBuffer.getCurrentNode());\n }\n if (text.getText().equals(\"\\n\")) {\n if (cursorPos == text) {\n cursor.setX(X_INIT);\n cursor.setY((textBuffer.getMaxLine() - 1) * lineHeight);\n }\n\n x_pos = X_INIT;\n y_pos += lineHeight;\n queue.clear();\n auxQueue.clear();\n } else if (text.getText().equals(\" \")) {\n queue.clear();\n auxQueue.clear();\n setText(text, x_pos, y_pos);\n x_pos += round(text.getLayoutBounds().getWidth());\n\n if (cursorPos == text) {\n if (x_pos > span) {\n cursor.setX(span);\n cursor.setY(y_pos);\n } else {\n cursor.setX(x_pos+1);\n cursor.setY(y_pos);\n }\n }\n } else {\n queue.addLast(text);\n auxQueue.addLast(textBuffer.getCurrentNode());\n setText(text, x_pos, y_pos);\n x_pos += round(text.getLayoutBounds().getWidth());\n if (x_pos > span) {\n if (round(queue.getFirst().getX()) == X_INIT) {\n text = queue.getLast();\n queue.clear();\n queue.addLast(text);\n textBuffer.putLineNo_StartNode_mapping(textBuffer.getCurrentNode());\n x_pos = X_INIT;\n y_pos += lineHeight;\n setText(text, x_pos, y_pos);\n x_pos += round(text.getLayoutBounds().getWidth());\n } else {\n x_pos = X_INIT;\n y_pos += lineHeight;\n for (Text t : queue) {\n setText(t, x_pos, y_pos);\n x_pos += round(t.getLayoutBounds().getWidth());\n }\n textBuffer.putLineNo_StartNode_mapping(auxQueue.getFirst());\n auxQueue.clear();\n }\n }\n }\n }\n\n if (cursorPos == null) {\n cursor.setX(X_INIT);\n cursor.setY(0);\n }\n\n updateScrollBarSize();\n updateRootPos();\n }", "@Override\r\n\t\t\t\tpublic Object stringToValue(String text) throws ParseException {\n\t\t\t\t\treturn \"\";\r\n\t\t\t\t}", "public void update() {\r\n if (parseStyle == ParseStyle.CHARACTER) {\r\n wrapText();\r\n int begin = getPosition();\r\n int end = getPosition() + 1;\r\n setCurrentItem(new TextItem(begin, end, getText().substring(begin,\r\n end)));\r\n setPosition(end);\r\n } else if (parseStyle == ParseStyle.WORD) {\r\n if (matcher == null) {\r\n return;\r\n }\r\n wrapText();\r\n boolean matchFound = findNextToken();\r\n if (matchFound) {\r\n selectCurrentToken();\r\n } else {\r\n // No match found. Go back to the beginning of the text area\r\n // and select the first token found\r\n setPosition(0);\r\n updateMatcher();\r\n // Having wrapped to the beginning select the next token, if\r\n // there is one.\r\n if (findNextToken()) {\r\n selectCurrentToken();\r\n }\r\n }\r\n }\r\n\r\n }", "@Override\n public String parse(AssignmentInfo assignmentInfo) {\n return null;\n }", "public void setValue (String text) throws ParseException {\n\t\tParsing t = new Parsing(text);\n\t\tint posini;\n\t\t/* Ignore the leading blanks */\n\t\tt.gobbleSpaces();\n\t\tposini = t.pos;\n\t\t/* Take care of units requiring data in Sexagesimal */\n\t\tif ((symbol.charAt(0) == '\"') && (symbol.indexOf(':')>0)) \t// \"\n\t\t\tvalue = t.parseSexa();\n\t\telse value = t.parseFactor();\n\t\tif (t.pos == posini) {\t\t// Nothing (NaN checked in Parsing)\n\t\t\tvalue = 0./0. ;\n\t\t\t// while ((t.pos < t.length) && (t.a[t.pos] == '-')) t.pos++;\n\t\t}\n\t\t/* Skip the trailing blanks */\n\t\tt.gobbleSpaces();\n\t\tif (t.pos < t.length) throw new ParseException\n\t\t(\"****Unit: setValue '\" + text + \"'+\" + t.pos, t.pos);\n\t}", "public void reset() {\n\t\tlocalName = \"\";\n\t\turi = \"\";\n\t\tdata = null;\n\t\tchars = null;\n\t\tcharCount = 0;\n\t\tline = 0;\n\t\tcolumn = 0;\n\t\tleaf = true;\n\t}", "private String doParse(String inputText)\n\t{\n\t\tmakeParser(\"program test \" + inputText);\n\t\ttree = parser.dijkstraText();\n\t\tassertTrue(true);\n\t\treturn tree.toStringTree(parser);\n\t}", "private void parse() {\n if (workingDirectory != null) {\n Parser.initConstants(this, workingDirectory, remainderFile);\n Parser.parseIt();\n workingDirectory = null;\n remainderFile = null;\n jbParse.setEnabled(false);\n }\n }", "public JSONDocument parse (String data){\n JSONDocument temp = null;\n if (data != null && !data.isEmpty()){\n temp = this.parseString(this.cleanString(data));\n }else throw new IllegalArgumentException(\"data cannot be null or empty\");\n return temp;\n }", "public final boolean synpred1_InternalSText() {\r\n state.backtracking++;\r\n int start = input.mark();\r\n try {\r\n synpred1_InternalSText_fragment(); // can never throw exception\r\n } catch (RecognitionException re) {\r\n System.err.println(\"impossible: \"+re);\r\n }\r\n boolean success = !state.failed;\r\n input.rewind(start);\r\n state.backtracking--;\r\n state.failed=false;\r\n return success;\r\n }", "@Override\n\tpublic Object visit(ASTText node, Object data) {\n\t\tSystem.out.print(\"text()\");\n\t\treturn null;\n\t}", "@Override\n public void clearAst() {\n this.root = null;\n }", "private Object read() throws XMLParseException {\n\t\tswitch (_tokenizer.next()) {\n\t\tdefault: break;\n\t\tcase ERROR: throw new XMLParseException(_tokenizer.getCurrentText());\n\t\tcase TEXT: return _tokenizer.getCurrentText();\n\t\tcase OPEN:\n\t\t\tElement result = new Element(_tokenizer.getCurrentName());\n\t\t\twhile (_tokenizer.next() == XMLTokenType.ATTR) {\n\t\t\t\tif (result.setAttr(_tokenizer.getCurrentName(), _tokenizer.getCurrentText()) != null) {\n\t\t\t\t\tthrow new XMLParseException(\"duplicate attribute: \" + _tokenizer.getCurrentName());\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (_tokenizer.current() == XMLTokenType.ECLOSE) {\n\t\t\t\t// System.out.println(\"ended /> for \" + result.getName());\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\tif (_tokenizer.current() != XMLTokenType.CLOSE) {\n\t\t\t\tthrow new XMLParseException(_tokenizer.getCurrentText());\n\t\t\t}\n\t\t\t_pending.push(result.getName());\n\t\t\twhile (_tokenizer.next() != XMLTokenType.ETAG) {\n\t\t\t\t/*if (_tokenizer.current() == XMLTokenType.END) {\n\t\t\t\t\tthrow new XMLParseException(\"Unexpected end of file\");\n\t\t\t\t}*/\n\t\t\t\tif (_tokenizer.current() == XMLTokenType.END) {\n\t\t\t\t\tif (isHTML) {\n\t\t\t\t\t\t_pending.pop();\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new XMLParseException(\"Missing end tag for <\" + result.getName() + \">\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t_tokenizer.saveToken();\n\t\t\t\tresult.addContent(read());\n\t\t\t}\n\t\t\t_pending.pop();\n\t\t\tif (!_tokenizer.getCurrentName().equals(result.getName())) {\n\t\t\t\tif (isHTML) {\n\t\t\t\t\t// System.out.println(\"HTML backup for \" + result.getName());\n\t\t\t\t\tfor (String p : _pending) {\n\t\t\t\t\t\tif (_tokenizer.getCurrentName().equals(p)) {\n\t\t\t\t\t\t\t_tokenizer.saveToken();\n\t\t\t\t\t\t\t//System.out.println(\"implicitly ended by </\" + p + \">\");\n\t\t\t\t\t\t\treturn result;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthrow new XMLParseException(\"<\" + result.getName() + \"> ended with </\" + _tokenizer.getCurrentName() + \">\");\n\t\t\t}\n\t\t\treturn result;\n\t\tcase END: throw new XMLParseException(\"no XML element\");\n\t\t}\n\t\t// NB: if execution reaches here, we did something wrong.\n\t\tthrow new XMLParseException(\"internal error: what kind of token is this? \" + _tokenizer);\n\t}", "public void processText(org.w3c.dom.Text text)\r\n\tthrows Exception\r\n\t{\r\n\tWriter xml = getWriter();\r\n\txml.write(getIndent());\r\n\txml.write(HDOMUtil.trim(text));\r\n\txml.write(\"\\n\");\r\n\treturn;\r\n\t}", "void insertToNode(String text, Node n) {\n\t\tList<String> list = new ArrayList<String>();\n\t\tint pos = 0, end;\n\t\t//Method finds all text part between spaces, but ignores the last text since there is no space, just newline\n\t\twhile ((end = text.indexOf(\" \", pos)) >= 0) {\n\t\t\tlist.add(text.substring(pos, end));\n\t\t\tpos = end + 1;\n\t\t}\n\t\t//Adds the last text since it else wise is ignored\n\t\tlist.add(2, text.substring(pos, text.length() - 1));\n\t\t\n\t\tn.setNum(Integer.parseInt(list.get(0).trim()));\n\t\tn.setLatitude(Double.parseDouble(list.get(1).trim()));\n\t\tn.setLongitude(Double.parseDouble(list.get(2).trim()));\n\t\tn.setPrev(new Last());\n\t}", "@Override\n\t\t\tprotected Type convert(String text) {\n\t\t\t\tType t = null;\n\t\t\t\ttry {\n\t\t\t\t\t// return null if the types do not match the\n\t\t\t\t\t// original\n\t\t\t\t\tt = Type.getType(text);\n\t\t\t\t\tif (t == null || !match(t, original)) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t} catch (Exception e) {}\n\t\t\t\treturn t;\n\t\t\t}", "private BaleElement fixLeafElement(BaleElement be,boolean first)\n{\n // handle indents\n BaleAstNode sn = cur_ast.getChild(be.getDocumentStartOffset());\n\n if (be.isEmpty() && !be.isEndOfLine()) {\n if (first && be instanceof BaleElement.Space) {\n\t be = new BaleElement.Indent(for_document,cur_parent,be.getStartOffset(),be.getEndOffset());\n }\n else if (!first && be instanceof BaleElement.Indent) {\n\t be = new BaleElement.Space(for_document,cur_parent,be.getStartOffset(),be.getEndOffset());\n }\n }\n else if (be.isIdentifier()) {\n BaleAstIdType ityp = BaleAstIdType.NONE;\n if (sn != null) ityp = sn.getIdType();\n switch (ityp) {\n\t case FIELD :\n\t if (!(be instanceof BaleElement.FieldId)) {\n\t be = new BaleElement.FieldId(for_document,cur_parent,be.getStartOffset(),be.getEndOffset());\n\t }\n\t break;\n\t case FIELD_STATIC :\n\t if (!(be instanceof BaleElement.StaticFieldId)) {\n\t be = new BaleElement.StaticFieldId(for_document,cur_parent,be.getStartOffset(),be.getEndOffset());\n\t }\n\t break;\n\t case CALL :\n\t if (!(be instanceof BaleElement.CallId)) {\n\t be = new BaleElement.CallId(for_document,cur_parent,be.getStartOffset(),be.getEndOffset());\n\t }\n\t break;\n\t case CALL_STATIC :\n\t if (!(be instanceof BaleElement.StaticCallId)) {\n\t be = new BaleElement.StaticCallId(for_document,cur_parent,be.getStartOffset(),be.getEndOffset());\n\t }\n\t break;\n\t case CALL_UNDEF :\n\t if (!(be instanceof BaleElement.UndefCallId)) {\n\t be = new BaleElement.UndefCallId(for_document,cur_parent,be.getStartOffset(),be.getEndOffset());\n\t }\n\t break;\n\t case CALL_DEPRECATED :\n\t if (!(be instanceof BaleElement.DeprecatedCallId)) {\n\t be = new BaleElement.DeprecatedCallId(for_document,cur_parent,be.getStartOffset(),be.getEndOffset());\n\t }\n\t break;\n\t case TYPE :\n\t if (!(be instanceof BaleElement.TypeId)) {\n\t be = new BaleElement.TypeId(for_document,cur_parent,be.getStartOffset(),be.getEndOffset());\n\t }\n\t break;\n\t case ENUMC :\n\t case FIELDC :\n\t if (!(be instanceof BaleElement.ConstId)) {\n\t be = new BaleElement.ConstId(for_document,cur_parent,be.getStartOffset(),be.getEndOffset());\n\t }\n\t break;\n\t case CLASS_DECL :\n\t if (!(be instanceof BaleElement.ClassDeclId)) {\n\t be = new BaleElement.ClassDeclId(for_document,cur_parent,be.getStartOffset(),be.getEndOffset());\n\t }\n\t break;\n\t case CLASS_DECL_MEMBER :\n\t if (!(be instanceof BaleElement.ClassDeclMemberId)) {\n\t be = new BaleElement.ClassDeclMemberId(for_document,cur_parent,be.getStartOffset(),be.getEndOffset());\n\t }\n\t break;\n\t case METHOD_DECL :\n\t if (!(be instanceof BaleElement.MethodDeclId)) {\n\t be = new BaleElement.MethodDeclId(for_document,cur_parent,be.getStartOffset(),be.getEndOffset());\n\t }\n\t break;\n\t case EXCEPTION_DECL :\n\t case LOCAL_DECL :\n\t if (!(be instanceof BaleElement.LocalDeclId)) {\n\t be = new BaleElement.LocalDeclId(for_document,cur_parent,be.getStartOffset(),be.getEndOffset());\n\t }\n\t break;\n\t case FIELD_DECL :\n\t if (!(be instanceof BaleElement.FieldDeclId)) {\n\t be = new BaleElement.FieldDeclId(for_document,cur_parent,be.getStartOffset(),be.getEndOffset());\n\t }\n\t break;\n\t case ANNOT :\n\t if (!(be instanceof BaleElement.AnnotationId)) {\n\t be = new BaleElement.AnnotationId(for_document,cur_parent,be.getStartOffset(),be.getEndOffset());\n\t }\n\t break;\n\t case UNDEF :\n\t if (!(be instanceof BaleElement.UndefId)) {\n\t be = new BaleElement.UndefId(for_document,cur_parent,be.getStartOffset(),be.getEndOffset());\n\t }\n\t break;\n\t case BUILTIN :\n\t if (!(be instanceof BaleElement.BuiltinId)) {\n\t be = new BaleElement.BuiltinId(for_document,cur_parent,be.getStartOffset(),be.getEndOffset());\n\t }\n\t break;\n\t default :\n if (be.getClass() != BaleElement.Identifier.class) {\n\t be = new BaleElement.Identifier(for_document,cur_parent,be.getStartOffset(),be.getEndOffset());\n\t }\n\t break;\n }\n }\n\n be.setAstNode(sn);\n return be;\n}", "public void parseSyntax( TextLayout layout )\r\n\t{\r\n\t\t// Obtain the text to parse\r\n\t\tString text = layout.getText();\r\n\t\t// Do not process null or blank text\r\n\t\tif (text == null || text.length()==0) return;\r\n\t\t// Default style\r\n\t\tlayout.setStyle(m_scheme.getDefaultStyle(), 0, text.length());\r\n\r\n\t\t// Create a source for the tokenizer with the text\r\n\t\tStringSource source = new StringSource( text );\r\n\t\t// Create the tokenizer using the current configuration\r\n\t\tStandardTokenizer tokenizer = new StandardTokenizer(m_properties);\r\n\t\t// Assign the source\r\n\t\ttokenizer.setSource(source);\r\n\t\tboolean inBlockComment = false;\r\n\t\ttry\r\n\t\t{\r\n\t\t\t// For each token recognised in the text\r\n\t\t\twhile(tokenizer.hasMoreToken())\r\n\t\t\t{\r\n\t\t\t\tToken token = tokenizer.nextToken();\r\n\t\t\t\tint type = token.getType();\r\n\t\t\t\t// This is the token text\r\n\t\t\t\tString word = tokenizer.currentImage();\r\n\t\t\t\t// When the image is null, we are processing EOL\r\n\t\t\t\tif (word == null) break;\r\n\t\t\t\tboolean isDocString = (type == Token.SPECIAL_SEQUENCE && word.equals(\"\\\"\\\"\\\"\")); \r\n\t\t\t\tif (isDocString)\r\n\t\t\t\t{\r\n\t\t\t\t\tinBlockComment = !inBlockComment;\r\n\t\t\t\t}\r\n\t\t\t\t// Find the applicable style, depending on the token type\r\n\t\t\t\tTextStyle toApply = null; \r\n\t\t\t\tif (inBlockComment || isDocString)\r\n\t\t\t\t{\r\n\t\t\t\t\ttoApply = m_scheme.getStyle(TokenTypes.COMMENT);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\ttoApply = getApplicableStyle(word,type);\r\n\t\t\t\t}\r\n\t\t\t\t// If no style is returned, continue to next token\r\n\t\t\t\tif (toApply == null) continue;\r\n\t\t\t\t// Get the applicable range (find token position)\r\n\t\t\t\tRange range = getApplicableRange(text, word, token);\r\n\t\t\t\t// Apply the style to the layout\r\n\t\t\t\tlayout.setStyle(toApply, range.start, range.end);\r\n\t\t\t}\r\n\t\t\t// Close tokenizer\r\n\t\t\ttokenizer.close();\r\n\t\t\ttokenizer = null;\r\n\t\t}\r\n\t\tcatch (TokenizerException e)\r\n\t\t{\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "private void clearText() {\n \n text_ = getDefaultInstance().getText();\n }", "public static Document makeDomFromString(String S, boolean blockTidy,String encoding)\n throws Exception {\n if(encoding==null) {\n encoding=default_encoding;\n }\n reporter theReporter=m_Def.getReporter();\n DocumentBuilder dBuilder=makeDocBuilder(false);\n try {\n return doDomFromString(S,dBuilder);\n } \n catch (IOException iox) {\n // nothing more we can do\n throw iox;\n } \n catch (SAXParseException saxx) {\n // we may attempt to tidy if it is not blocked and the option is on\n if ( tidyIsPossibleAndAllowed(!blockTidy)) {\n try {\n // --------- attempt to tidy, final attempt ----------\n theReporter.pushSimpleMessage(\"\\t\" + saxx.getMessage());\n theReporter.pushMessage(\"attempt_to_tidy\");\n S = m_Def.getTidyTool().tidyAndMakeXML(S, encoding, theReporter);\n // block encoding in final attempt\n return doDomFromString(S,dBuilder);\n } catch (Exception sex3) {\n theReporter.pushSimpleMessage(\"Tidy of string failed\");\n // nothing more we can do\n System.out.println(\"tidy failed: \"+sex3.getMessage());\n throw sex3;\n }\n } \n else {\n // we will do nothing\n throw new Exception(\"no tidy: \"+saxx.getMessage());\n }\n } \n }", "public void resetText (String textString) {\n\t\tbody=textString;\n\t\tTextLine line = new TextLine();\n\t\tContext context = new Context();\n\t\tText textobj = new Text();\n\t\tline = genText(textString,textobj,line,context);\n\t\ttextobj.copyLine(line);\n\t\ttextobj.finalize();\n\t\tMemoryTextWrapper textWrapper = new MemoryTextWrapper(textobj);\n\t\tthis.text = textWrapper;\n\t}", "protected void checkIntegrity(String text) {\n\t\tif (ExpressionTools.valuesAreDifferent(getText(), text)) {\n\t\t\tclearResolvedObjects();\n\t\t}\n\t}", "public Number parse(String text, ParsePosition parsePosition)\n/* */ {\n/* 1184 */ if (this.noParse)\n/* */ {\n/* 1186 */ return new Long(0L);\n/* */ }\n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* 1193 */ String workingText = text.substring(parsePosition.getIndex());\n/* 1194 */ ParsePosition workingPos = new ParsePosition(0);\n/* 1195 */ Number tempResult = null;\n/* */ \n/* */ \n/* */ \n/* 1199 */ Number result = new Long(0L);\n/* 1200 */ ParsePosition highWaterMark = new ParsePosition(workingPos.getIndex());\n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* 1206 */ for (int i = this.ruleSets.length - 1; i >= 0; i--)\n/* */ {\n/* 1208 */ if ((this.ruleSets[i].isPublic()) && (this.ruleSets[i].isParseable()))\n/* */ {\n/* */ \n/* */ \n/* */ \n/* */ \n/* 1214 */ tempResult = this.ruleSets[i].parse(workingText, workingPos, Double.MAX_VALUE);\n/* 1215 */ if (workingPos.getIndex() > highWaterMark.getIndex()) {\n/* 1216 */ result = tempResult;\n/* 1217 */ highWaterMark.setIndex(workingPos.getIndex());\n/* */ }\n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* 1226 */ if (highWaterMark.getIndex() == workingText.length()) {\n/* */ break;\n/* */ }\n/* */ \n/* */ \n/* */ \n/* 1232 */ workingPos.setIndex(0);\n/* */ }\n/* */ }\n/* */ \n/* */ \n/* 1237 */ parsePosition.setIndex(parsePosition.getIndex() + highWaterMark.getIndex());\n/* */ \n/* */ \n/* */ \n/* */ \n/* 1242 */ return result;\n/* */ }", "private SyntaxTreeNode parseTopLevel(SyntaxTreeNode parent, String text,\n String expression) {\n int line = getLineNumber();\n\n try {\n _xpathParser.setScanner(new XPathLexer(new StringReader(text)));\n Symbol result = _xpathParser.parse(expression, line);\n if (result != null) {\n final SyntaxTreeNode node = (SyntaxTreeNode)result.value;\n if (node != null) {\n node.setParser(this);\n node.setParent(parent);\n node.setLineNumber(line);\n return node;\n }\n }\n reportError(ERROR, new ErrorMsg(ErrorMsg.XPATH_PARSER_ERR,\n expression, parent));\n }\n catch (Exception e) {\n if (ErrorMsg.XPATH_LIMIT.equals(e.getMessage())) {\n throw new RuntimeException(ErrorMsg.XPATH_LIMIT);\n }\n if (_xsltc.debug()) e.printStackTrace();\n reportError(ERROR, new ErrorMsg(ErrorMsg.XPATH_PARSER_ERR,\n expression, parent));\n }\n\n // Return a dummy pattern (which is an expression)\n SyntaxTreeNode.Dummy.setParser(this);\n return SyntaxTreeNode.Dummy;\n }", "private boolean mapTokensToEDUUnitsRecursive(RSTTreeNode node, List<Token> tokens,\n AtomicInteger currentTokenIndex)\n {\n if (node instanceof EDU) {\n EDU edu = (EDU) node;\n String originalText = edu.getOriginalText();\n\n String trimmedText = originalText.replaceAll(\"^_!\", \"\").replaceAll(\"\\\\)+$\", \"\")\n .replaceAll(\"!_$\", \"\").replaceAll(\"<[sP]>$\", \"\");\n\n // some other WTFs :(\n trimmedText = trimmedText.replaceAll(\"etc\\\\.\", \"etc\");\n // we have to do some normalization\n trimmedText = trimmedText.replaceAll(\"’\", \"'\");\n trimmedText = trimmedText.replaceAll(\"”\", \"\\\"\");\n trimmedText = trimmedText.replaceAll(\"“\", \"\\\"\");\n trimmedText = trimmedText.replaceAll(\"´\", \"'\");\n\n String noSpaceText = trimmedText.replaceAll(\" \", \"\");\n\n // the first token of the span\n if (currentTokenIndex.get() >= tokens.size()) {\n // something is wrong here...\n return false;\n }\n\n Token begin = tokens.get(currentTokenIndex.get());\n\n // now find the last token of the span\n StringBuilder buffer = new StringBuilder();\n while (!buffer.toString().equals(noSpaceText)) {\n // get the current token's content\n int index = currentTokenIndex.get();\n if (index >= tokens.size()) {\n // we ran out of the buffer, something went wrong\n System.err.println(\"Mapping went wrong!\");\n System.err.println(\"noSpaceText:\\n\" + noSpaceText + \"\\nBuffer:\\n\" + buffer);\n\n for (int i = 0; i < tokens.size(); i++) {\n System.err.printf(\"%d:%s \", i, tokens.get(i).getCoveredText());\n }\n System.err.println();\n\n return false;\n }\n\n String tokenText = tokens.get(index).getCoveredText();\n\n // we have to do some normalization\n tokenText = tokenText.replaceAll(\"’\", \"'\");\n tokenText = tokenText.replaceAll(\"”\", \"\\\"\");\n tokenText = tokenText.replaceAll(\"“\", \"\\\"\");\n tokenText = tokenText.replaceAll(\"´\", \"'\");\n tokenText = tokenText.replaceAll(\"‘\", \"'\");\n tokenText = tokenText.replaceAll(\"—\", \"--\");\n tokenText = tokenText.replaceAll(\"–\", \"--\");\n tokenText = tokenText.replaceAll(\"\\\\.\\\\.\\\\.\\\\.+\", \"...\");\n tokenText = tokenText.replaceAll(\"…\", \"...\");\n tokenText = tokenText.replaceAll(\"£\", \"#\");\n\n buffer.append(tokenText);\n // and increase\n currentTokenIndex.incrementAndGet();\n }\n\n // the previous one was the last token of the EDU\n Token end = tokens.get(currentTokenIndex.get() - 1);\n\n // and now set the proper begin/end for the EDU\n edu.setBegin(begin.getBegin());\n edu.setEnd(end.getEnd());\n }\n\n boolean result = true;\n\n // recursive call for children (if applicable)\n if (node instanceof DiscourseRelation) {\n result &= mapTokensToEDUUnitsRecursive(((DiscourseRelation) node).getArg1(), tokens,\n currentTokenIndex);\n result &= mapTokensToEDUUnitsRecursive(((DiscourseRelation) node).getArg2(), tokens,\n currentTokenIndex);\n }\n\n return result;\n }", "Token fixSEMI(Token token, boolean retEnd) throws TokenStreamException\r\n {\r\n Token nullToken;\r\n int type;\r\n Token testToken = token;\r\n \r\n if ( !retEnd && testToken.getType() == MExprANTLRParserTokenTypes.COMMENT) {\r\n \tStack tmp = new Stack();\r\n \tToken token1;\r\n do {\r\n token1 = getNextToken();\r\n type = token1.getType(); \r\n tmp.push( token1);\r\n } while (type == MExprANTLRParserTokenTypes.COMMENT\r\n || type == MExprANTLRParserTokenTypes.WHITESPACE \r\n || fTypesetParse && whiteSpaceTypeset(token1));\r\n \r\n while( !tmp.empty()) {\r\n \tpushToken( (Token)tmp.pop());\r\n }\r\n \r\n if (tokenCanStart(token1) && !retEnd) {\r\n return token;\r\n }\r\n \r\n }\r\n \r\n if (tokenCanStart(testToken) && !retEnd) {\r\n return token;\r\n }\r\n\r\n String text = makeInsertedText(\"Null\");\r\n nullToken = makeToken(MExprANTLRParserTokenTypes.NULLID, text, lastExprToken);\r\n pushToken(token);\r\n\r\n if ( retEnd && token.getType() != MExprANTLRParserTokenTypes.EOF)\r\n pushToken( makeToken(MExprANTLRParserTokenTypes.PACKAGE, \"Package\", nullToken));\r\n\r\n return nullToken;\r\n }", "public void RecursiveExpansion() throws TreeTooBigException {\r\n int transIndex; //Index to count transitions\r\n int[] newMarkup; //markup used to create new node\r\n boolean aTransitionIsEnabled = false; //To check for deadlock\r\n //Attribute used for assessing whether a node has occured before\r\n boolean repeatedNode = false; \r\n \r\n boolean allOmegas = false;\r\n \r\n boolean[] enabledTransitions = \r\n tree.dataLayer.getTransitionEnabledStatusArray(markup);\r\n\r\n //For each transition\r\n for (int i = 0; i < enabledTransitions.length; i++) {\r\n if (enabledTransitions[i] == true) {\r\n //Set transArray of to true for this index\r\n transArray[i] = true;\r\n \r\n //System.out.println(\"\\n Transition \" + i + \" Enabled\" );\r\n aTransitionIsEnabled = true;\r\n \r\n //print (\"\\n Old Markup is :\", markup);//debug\r\n \r\n //Fire transition to produce new markup vector\r\n newMarkup = fire(i);\r\n \r\n //print (\"\\n New Markup is :\", newMarkup);//debug\r\n \r\n //Check for safeness. If any of places have > 1 token set variable.\r\n for (int j = 0; j < newMarkup.length; j++) {\r\n if (newMarkup[j] > 1 || newMarkup[j] == -1) {\r\n tree.moreThanOneToken = true;\r\n break;\r\n }\r\n } \r\n \r\n //Create a new node using the new markup vector and attach it to\r\n //the current node as a child.\r\n children[i] = \r\n new myNode(newMarkup, this, tree, depth + 1);\r\n \r\n /* Now need to (a) check if any omegas (represented by -1) need to \r\n * be inserted in the markup vector of the new node, and (b) if the \r\n * resulting markup vector has appeared anywhere else in the tree. \r\n * We must do (a) before (b) as we need to know if the new node \r\n * contains any omegas to be able to compare it with existing nodes. \r\n */ \r\n allOmegas = children[i].InsertOmegas();\r\n \r\n //check if the resulting markup vector has occured anywhere else in the tree\r\n repeatedNode = (tree.root).FindMarkup(children[i]);\r\n \r\n if (tree.nodeCount >= Pipe.MAX_NODES && !tree.tooBig) {\r\n tree.tooBig = true;\r\n throw new TreeTooBigException();\r\n }\r\n \r\n if (!repeatedNode && !allOmegas) {\r\n children[i].RecursiveExpansion();\r\n }\r\n }\r\n }\r\n \r\n if (!aTransitionIsEnabled) {\r\n System.err.println(\"No transition enabled\");\r\n if (!tree.noEnabledTransitions || tree.pathToDeadlock.length < depth-1) {\r\n RecordDeadlockPath();\r\n tree.noEnabledTransitions = true;\r\n } else {\r\n System.err.println(\"Deadlocked node found, but path is not shorter\"\r\n + \" than current path.\");\r\n }\r\n } else {\r\n //System.out.println(\"Transitions enabled.\");\r\n }\r\n }", "public void visit(TreeBuilder tree){\n\t\tString line;\n\t\twhile ((line = file.readLine(true)) != null)\n\t {\t\t \n \t\tString[] words = line.split(\" \");\n \t\tfor(String word : words){\n \t\t\tif(!word.equals(\"\")){\n \t\t\t\ttree.insertNode(word);\n \t\t\t}\n \t\t}\n \t}\n\t}", "private void cleanPharagraph() {\n postBodyHTMLContent = postBodyHTMLContent.replaceAll(\"[<](\\\\s+)?p[^>]*[>]\", \"\");\n\n // replace closing p tag with <br> to indicate paragraph\n postBodyHTMLContent = postBodyHTMLContent.replaceAll(\"[<](\\\\s+)?(/)(\\\\s+)?p[^>]*[>]\", \"<br>\");\n }", "@Override\n public void updateItem(FileTree item, boolean empty) {\n super.updateItem(item, empty);\n\n if (empty) {\n setText(null);\n setGraphic(null);\n } else {\n if (isEditing()) {\n if (text_field != null) {\n text_field.setText(getString());\n }\n setText(null);\n setGraphic(text_field);\n } else {\n setText(getString());\n setGraphic(getTreeItem().getGraphic());\n }\n }\n }", "public Node(){\r\n primarySequence = null;\r\n dotBracketString = null;\r\n validity = false;\r\n prev = null;\r\n next = null;\r\n }", "@Override\r\n\tpublic void setInnerText(String arg0) {\n\t\t\r\n\t}", "private void parseAndSend(String unparsedString){\n StringBuilder builder = new StringBuilder(unparsedString);\n //Filter level 1 - removing numbers\n for(int i = 0; i< unparsedString.length(); i++){\n if(Character.isDigit(builder.charAt(i)) || builder.charAt(i) == ' ' ){\n builder.deleteCharAt(i);\n }\n }\n\n\n }", "@Override\n public TreeNode make(Parser parser) {\n Token token = parser.peek();\n if(token.getTokenID() == Token.TIDEN){\n return nAlistNode.make(parser); //alist trans (dont consume token alist will need it)\n }\n return null; //eps trans\n }", "private void parse_text()\n {\n float temporary_min = min; // used to hold the values entered, before\n float temporary_max = max; // validating them\n\n String str = getText();\n Float Float_NaN = new Float(Float.NaN);\n // get the first number\n float val = findNumber( START, str, SEPARATOR );\n Float Float_val = new Float(val);\n if ( !Float_val.equals(Float_NaN) )\n temporary_min = val;\n // get the second number\n val = findNumber( SEPARATOR, str, END );\n Float_val = new Float(val);\n if ( !Float_val.equals(Float_NaN) )\n temporary_max = val;\n\n if ( temporary_min < temporary_max ) // make sure the values\n { // define a non-degenerate\n min = temporary_min; // interval, before we \n max = temporary_max; // accept them\n }\n\n show_text();\n }", "public ParseTreeNode(final Token token) {\r\n _parent = null;\r\n _token = token;\r\n }", "private void makeReplacementText() throws IOException {\n valueBuf.clear();\n Token t = new Token();\n int start = currentTokenStart + 1;\n final int end = bufStart - 1;\n try {\n for (;;) {\n\tint tok;\n\tint nextStart;\n\ttry {\n\t tok = Tokenizer.tokenizeEntityValue(buf, start, end, t);\n\t nextStart = t.getTokenEnd();\n\t}\n\tcatch (ExtensibleTokenException e) {\n\t tok = e.getTokenType();\n\t nextStart = end;\n\t}\n\thandleEntityValueToken(valueBuf, tok, start, nextStart, t);\n\tstart = nextStart;\n }\n }\n catch (PartialTokenException e) {\n currentTokenStart = end;\n fatal(\"NOT_WELL_FORMED\");\n }\n catch (InvalidTokenException e) {\n currentTokenStart = e.getOffset();\n reportInvalidToken(e);\n }\n catch (EmptyTokenException e) { }\n }", "private Element parseRoot() {\r\n \r\n assert iMessage!=null;\r\n assert iIndex>=0;\r\n assert iIndex<=iMessage.length();\r\n \r\n while (peek()<=' ') next();//skip whitespace\r\n switch (peek()) {//switch on next character\r\n case 'n': return new ScalarElement(parseNull());//parse null \r\n case 'f': return new ScalarElement(parseBoolean());//parse false\r\n case 't': return new ScalarElement(parseBoolean());//parse true\r\n case '[': return new ArrayElement(parseArray());//parse array \r\n case '{': return new ObjectElement(parseObject());//parse object\r\n default : throw new RuntimeException(\"Invalid syntax : \"+context());//ruh roh\r\n }//switch on next character\r\n \r\n }", "private void updateTree(String st, int lineno, double bl, PrintWriter missing){\n\t\t String[] str = st.split(\"\\\\s+\");\n\t\t String specName = str[0];\n\t\t if(str[0].indexOf(\"GRCh38\")>=0){\n\t\t\t specName= \"Homo_sapiens\";\n\t\t\t str[0] = specName;\n\t\t }\n\t\t String alias1 = collapse(str, 2, str.length, \" \");\n\t\t Node n = getSlug(specName, alias1);\n\t\t if(n==null) n = this.unclassified;\n\t\t Node newnode = this.createFromSpeciesFile(str,alias1, n, lineno, bl);\n\t\t this.putSlug(newnode);\n\t\t\t \n\t\t\n\t\t \n\t }", "String getTransformedText();", "void createItem(StreamTokenizer st) throws DataFormatException, IOException {\n\t\tboolean debug = false;\n\t\tboolean inComment = false;\n\t\tStringBuffer treebuf = new StringBuffer();\n\t\twhile (true) {\n\t\t\tswitch (st.nextToken()) {\n\t\t\tcase StreamTokenizer.TT_WORD:\n\t\t\t\t// inside a comment. Ignore it.\n\t\t\t\tif (inComment)\n\t\t\t\t\tbreak;\n\t\t\t\t// reached a valid piece. add it.\n\t\t\t\tif (debug) Debug.debug(debug, \"TreeItem: About to add token \"+st.sval);\n\t\t\t\ttreebuf.append(st.sval);\n\t\t\t\tbreak;\n\t\t\tcase '\"':\n\t\t\t\t// inside a comment. Ignore it.\n\t\t\t\tif (inComment)\n\t\t\t\t\tbreak;\n\t\t\t\t// reached a valid piece. add it.\n\t\t\t\t// check for length 0 and triple quote\n\t\t\t\tif (st.sval.length() == 0) {\n\t\t\t\t\tst.ordinaryChar('\"');\n\t\t\t\t\tif (st.nextToken() == '\"') {\n\t\t\t\t\t\tif (debug) Debug.debug(debug, \"Found triple quote\");\n\t\t\t\t\t\ttreebuf.append(\"\\\"\\\"\\\"\");\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tst.pushBack();\n\t\t\t\t\t\tif (debug) Debug.debug(debug, \"Found empty double quote\");\n\t\t\t\t\t\ttreebuf.append(\"\\\"\\\"\");\n\t\t\t\t\t}\n\t\t\t\t\tst.quoteChar('\"');\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (debug) Debug.debug(debug, \"TreeItem: About to add quoted token \"+st.sval);\n\t\t\t\t\ttreebuf.append(\"\\\"\"+st.sval+\"\\\"\");\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase '@':\n\t\t\tcase '#':\n\t\t\t\tif (debug) Debug.debug(debug, \"TreeItem: pushing symbol back\");\n\t\t\t\tst.pushBack();\n\t\t\tcase StreamTokenizer.TT_EOL:\n\t\t\tcase StreamTokenizer.TT_EOF:\n\n\t\t\t\t// in a newline. Reset any inComment aspect\n\t\t\t\tinComment = false;\n\t\t\t\tif (treebuf.length() > 0) {\n\t\t\t\t\tif (debug) Debug.debug(debug, \"TreeItem: About to process item \"+treebuf.toString());\n\t\t\t\t\tTreeItem t = new TreeItem(treebuf);\n\t\t\t\t\tchildren = t.children;\n\t\t\t\t\tnumChildren = t.numChildren;\n\t\t\t\t\tnumNodes = t.numNodes;\n\t\t\t\t\ttruncated = t.truncated;\n\t\t\t\t\tlabel = t.label;\n\t\t\t\t\tweight = t.weight;\n\t\t\t\t\tisEmptyString = false;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (debug) Debug.debug(debug, \"Skipping empty line\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// can't reach here, so no break\n\t\t\tcase COMMENT:\n\t\t\t\t// in a comment. Set inComment flag\n\t\t\t\tinComment = true;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new DataFormatException(\" Expected word, but read \"+st.ttype+\" which is \"+(char)st.ttype);\n\n\t\t\t}\n\t\t}\n\t}", "@Override\n\tpublic void postParse() {\n\t}", "@Override\n\tpublic void postParse() {\n\t}", "public void setText(String s) {\n ADocument doc = (ADocument) getDocument();\n Number oldValue = doc.currentVal;\n\n try {\n doc.currentVal = doc.parse(s);\n } catch (Exception e) {\n e.printStackTrace();\n\n return;\n }\n\n if (oldValue!=doc.currentVal) {\n doc.checkingEnabled = false;\n super.setText(s);\n doc.checkingEnabled = true;\n }\n }", "@Override\n\tpublic void setInnerText(String arg0) {\n\n\t}", "public static GeglNode fromXml(String text)\n\t{\n\t\treturn fromXml(\"/\");\n\t}", "private void textilizeNonBlankLine () {\n StringBuffer blockMod = new StringBuffer();\n int startPosition = 0;\n int textPosition = 0;\n leftParenPartOfURL = false;\n attributeType = 0;\n klass = new StringBuffer();\n id = new StringBuffer();\n style = new StringBuffer();\n language = new StringBuffer();\n String imageTitle = \"\";\n String imageURL = \"\";\n int endOfImageURL = -1;\n boolean doublePeriod = false;\n int periodPosition = line.indexOf (\".\");\n if (periodPosition >= 0) {\n textPosition = periodPosition + 1;\n if (textPosition < line.length()) {\n if (line.charAt (textPosition) == '.') {\n doublePeriod = true;\n textPosition++;\n }\n if (textPosition < line.length()\n && line.charAt (textPosition) == ' ') {\n textPosition++;\n textIndex = 0;\n while (textIndex < periodPosition\n && (Character.isLetterOrDigit (textChar()))) {\n blockMod.append (textChar());\n textIndex++;\n } // end while more letters and digits\n if (blockMod.toString().equals (\"p\")\n || blockMod.toString().equals (\"bq\")\n || blockMod.toString().equals (\"h1\")\n || blockMod.toString().equals (\"h2\")\n || blockMod.toString().equals (\"h3\")\n || blockMod.toString().equals (\"h4\")\n || blockMod.toString().equals (\"h5\")\n || blockMod.toString().equals (\"h6\")) {\n // look for attributes\n collectAttributes (periodPosition);\n } else {\n blockMod = new StringBuffer();\n textPosition = 0;\n }\n } // end if space follows period(s)\n } // end if not end of line following first period\n } // end if period found\n\n // Start processing at the beginning of the line\n textIndex = 0;\n\n // If we have a block modifier, then generate appropriate HTML\n if (blockMod.length() > 0) {\n lineDelete (textPosition);\n closeOpenBlockQuote();\n closeOpenBlock();\n doLists();\n if (blockMod.toString().equals (\"bq\")) {\n lineInsert (\"<blockquote><p\");\n context.blockQuoting = true;\n } else {\n lineInsert (\"<\" + blockMod.toString());\n }\n if (klass.length() > 0) {\n lineInsert (\" class=\\\"\" + klass.toString() + \"\\\"\");\n }\n lineInsert (\">\");\n if (doublePeriod) {\n context.nextBlock = blockMod.toString();\n } else {\n context.nextBlock = \"p\";\n }\n }\n\n // See if line starts with one or more list characters\n if (blockMod.length() <= 0) {\n while (textIndex < line.length()\n && (textChar() == '*'\n || textChar() == '#'\n || textChar() == ';')) {\n listChars.append (textChar());\n textIndex++;\n }\n if (listChars.length() > 0\n && (textIndex >= line.length()\n || ((! Character.isWhitespace (textChar()))\n && (textChar() != '(')))) {\n listChars = new StringBuffer();\n textIndex = 0;\n }\n int firstSpace = line.indexOf (\" \", textIndex);\n if (listChars.length() > 0) {\n collectAttributes (firstSpace);\n }\n }\n int endDelete = textIndex;\n if (endDelete < line.length()\n && Character.isWhitespace (line.charAt (endDelete))) {\n endDelete++;\n }\n\n if (listChars.length() > 0) {\n lineDelete (0, endDelete);\n }\n doLists();\n if (listChars.length() > 0\n && listChars.charAt(listChars.length() - 1) == ';') {\n lastDefChar = ';';\n } else {\n lastDefChar = ' ';\n }\n\n // See if this line contains a link alias\n if ((blockMod.length() <= 0)\n && ((line.length() - textIndex) >= 4)\n && (textChar() == '[')) {\n int rightBracketIndex = line.indexOf (\"]\", textIndex);\n if (rightBracketIndex > (textIndex + 1)) {\n linkAlias = true;\n String alias = line.substring (textIndex + 1, rightBracketIndex);\n String url = line.substring (rightBracketIndex + 1);\n lineDelete (line.length() - textIndex);\n lineInsert (\"<a alias=\\\"\" + alias + \"\\\" href=\\\"\" + url + \"\\\"> </a>\");\n }\n }\n\n // If no other instructions, use default start for a new line\n if (blockMod.length() <= 0 \n && listChars.length() <= 0\n & (! linkAlias)) {\n // This non-blank line does not start with a block modifier or a list char\n if (context.lastLineBlank) {\n if (context.nextBlock.equals (\"bq\")) {\n lineInsert (\"<p>\");\n } else {\n closeOpenBlockQuote();\n lineInsert (\"<\" + context.nextBlock + \">\");\n }\n } else {\n lineInsert (\"<br />\");\n }\n }\n\n // Now examine the rest of the line\n char last = ' ';\n char c = ' ';\n char next = ' ';\n leftParenPartOfURL = false;\n resetLineIndexArray();\n while (textIndex <= line.length()) {\n // Get current character, last character and next character\n last = c;\n if (textIndex < line.length()) {\n c = textChar();\n } else {\n c = ' ';\n }\n if ((textIndex + 1) < line.length()) {\n next = line.charAt (textIndex + 1);\n } else {\n next = ' ';\n }\n \n // ?? means a citation\n if (c == '?' && last == '?') {\n if (ix [CITATION] >= 0) {\n replaceWithHTML (CITATION, 2);\n } else {\n ix [CITATION] = textIndex - 1;\n textIndex++;\n }\n }\n else\n // __ means italics\n if (c == '_' && last == '_' && ix [QUOTE_COLON] < 0) {\n if (ix [ITALICS] >= 0) {\n replaceWithHTML (ITALICS, 2);\n } else {\n ix [ITALICS] = textIndex - 1;\n textIndex++;\n }\n }\n else\n // ** means bold\n if (c == '*' && last == '*') {\n if (ix [BOLD] >= 0) {\n replaceWithHTML (BOLD, 2);\n } else {\n ix [BOLD] = textIndex - 1;\n textIndex++;\n }\n }\n else\n // _ means emphasis\n if (c == '_' && next != '_' && ix [QUOTE_COLON] < 0) {\n if (ix [EMPHASIS] >= 0) {\n replaceWithHTML (EMPHASIS, 1);\n } else {\n ix [EMPHASIS] = textIndex;\n textIndex++;\n }\n }\n else\n // * means strong\n if (c == '*' && next != '*') {\n if (ix [STRONG] >= 0) {\n replaceWithHTML (STRONG, 1);\n } else {\n ix [STRONG] = textIndex;\n textIndex++;\n }\n }\n else\n // Exclamation points surround image urls\n if (c == '!' && Character.isLetter(next)\n && ix [QUOTE_COLON] < 0 && ix [EXCLAMATION] < 0) {\n // First exclamation point : store its location and move on\n ix [EXCLAMATION] = textIndex;\n textIndex++;\n }\n else\n // Second exclamation point\n if (c == '!'\n && ix [QUOTE_COLON] < 0 && ix [EXCLAMATION] >= 0) {\n // Second exclamation point\n imageTitle = \"\";\n endOfImageURL = textIndex;\n if (last == ')' && ix [EXCLAMATION_LEFT_PAREN] > 0) {\n ix [EXCLAMATION_RIGHT_PAREN] = textIndex - 1;\n endOfImageURL = ix [EXCLAMATION_LEFT_PAREN];\n imageTitle = line.substring\n (ix [EXCLAMATION_LEFT_PAREN] + 1, ix [EXCLAMATION_RIGHT_PAREN]);\n }\n imageURL = line.substring (ix [EXCLAMATION] + 1, endOfImageURL);\n // Delete the image url, title and parentheses,\n // but leave exclamation points for now.\n lineDelete (ix [EXCLAMATION] + 1, textIndex - ix [EXCLAMATION] - 1);\n String titleString = \"\";\n if (imageTitle.length() > 0) {\n titleString = \" title=\\\"\" + imageTitle + \"\\\" alt=\\\"\" + imageTitle + \"\\\"\";\n }\n lineInsert (ix [EXCLAMATION] + 1,\n \"<img src=\\\"\" + imageURL + \"\\\"\" + titleString + \" />\");\n if (next == ':') {\n // Second exclamation followed by a colon -- look for url for link\n ix [QUOTE_COLON] = textIndex;\n ix [LAST_QUOTE] = ix [EXCLAMATION];\n } else {\n lineDelete (ix [EXCLAMATION], 1);\n lineDelete (textIndex, 1);\n }\n ix [EXCLAMATION] = -1;\n ix [EXCLAMATION_LEFT_PAREN] = -1;\n ix [EXCLAMATION_RIGHT_PAREN] = -1;\n textIndex++;\n } // end if second exclamation point\n else\n // Parentheses within exclamation points enclose the image title\n if (c == '(' && ix [EXCLAMATION] > 0 ) {\n ix [EXCLAMATION_LEFT_PAREN] = textIndex;\n textIndex++;\n }\n else\n // Double quotation marks surround linked text\n if (c == '\"' && ix [QUOTE_COLON] < 0) {\n if (next == ':'\n && ix [LAST_QUOTE] >= 0\n && textIndex > (ix [LAST_QUOTE] + 1)) {\n ix [QUOTE_COLON] = textIndex;\n } else {\n ix [LAST_QUOTE] = textIndex;\n }\n textIndex++;\n }\n else\n // Flag a left paren inside of a url\n if (c == '(' && ix [QUOTE_COLON] > 0) {\n leftParenPartOfURL = true;\n textIndex++;\n }\n else\n // Space may indicate end of url\n if (Character.isWhitespace (c)\n && ix [QUOTE_COLON] > 0\n && ix [LAST_QUOTE] >= 0\n && textIndex > (ix [QUOTE_COLON] + 2)) {\n int endOfURL = textIndex - 1;\n // end of url is last character of url\n // do not include any trailing punctuation at end of url\n int backup = 0;\n while ((endOfURL > (ix [QUOTE_COLON] + 2))\n && (! Character.isLetterOrDigit (line.charAt(endOfURL)))\n && (! ((line.charAt(endOfURL) == ')') && (leftParenPartOfURL)))\n && (! (line.charAt(endOfURL) == '/'))) {\n endOfURL--;\n backup++;\n }\n String url = line.substring (ix [QUOTE_COLON] + 2, endOfURL + 1);\n // insert the closing anchor tag\n lineInsert (endOfURL + 1, \"</a>\");\n // Delete the quote, colon and url from the line\n lineDelete (ix [QUOTE_COLON], endOfURL + 1 - ix [QUOTE_COLON]);\n // insert the beginning of the anchor tag\n lineDelete (ix [LAST_QUOTE], 1);\n lineInsert (ix [LAST_QUOTE], \"<a href=\\\"\" + url + \"\\\">\");\n // Reset the pointers\n ix [QUOTE_COLON] = -1;\n ix [LAST_QUOTE] = -1;\n leftParenPartOfURL = false;\n // Increment the index to the next character\n if (backup > 0) {\n textIndex = textIndex - backup;\n } else {\n textIndex++;\n }\n }\n else\n // Look for start of definition\n if ((c == ':' || c == ';')\n && Character.isWhitespace(last)\n && Character.isWhitespace(next)\n && listChars.length() > 0\n && (lastDefChar == ';' || lastDefChar == ':')) {\n lineDelete (textIndex - 1, 3);\n lineInsert (closeDefinitionTag (lastDefChar)\n + openDefinitionTag (c));\n lastDefChar = c;\n }\n /* else\n // -- means an em dash\n if (c == '-' && last == '-') {\n textIndex--;\n lineDelete (2);\n lineInsert (\"&#8212;\");\n } */ else {\n textIndex++;\n }\n }// end while more characters to examine\n\n context.lastLineBlank = false;\n\n }", "protected void checkText(ParserResult result, String text) {\n\t\tif (text == null)\n\t\t\treturn;\n\t\tfor (Map<String, List<Object>> map : result.documents)\n\t\t\tif (checkText(map, text))\n\t\t\t\treturn;\n\t\tif (checkText(result.metas, text))\n\t\t\treturn;\n\t\tlogger.severe(\"Text \" + text + \" not found\");\n\t\tassert (false);\n\t}", "public void clearError() {\n _hasError = false;\n _highlight = HighlightMode.NORMAL;\n _error = NodeError.NONE;\n \n }", "public FreeMindWriter text( String text ) {\n if( ! tagOpen ) throw new IllegalStateException( \"Node start element is no longer open\" );\n \n out.print( \" TEXT='\" );\n out.writeEscapedXMLString( text, true );\n out.print( \"'\" ); \n return this;\n }", "private void TokenAnythingElse(Token token,\r\n\t\t\tTreeConstructor treeConstructor, boolean reprocessToken) {\n\t\tnew StackUpdater().updateStack(\"html\", \"element\");\r\n\t\tParser.currentMode = InsertionMode.before_head;\r\n\t\tif (reprocessToken)\r\n\t\t\ttreeConstructor.processToken(token);\r\n\t}", "private static void handleParser(char c) {\n if(c == '\\n'){\r\n return;\r\n }\r\n switch (state){\r\n case OUT_OF_TAG:{\r\n if(c == '<'){\r\n if(SAXParsedData.innerText.trim().length() != 0) {\r\n parserHandler.innerText(SAXParsedData.innerText);\r\n }\r\n SAXParsedData.innerText = \"\";\r\n SAXParsedData.tagName = \"\";\r\n state = SAXParserState.BEGIN_START_OR_END_TAG;\r\n } else if (c == '>') {\r\n state = SAXParserState.SYNTAX_ERROR;\r\n } else {\r\n SAXParsedData.innerText += c;\r\n }\r\n break;\r\n }\r\n case BEGIN_START_OR_END_TAG:{\r\n if(c == '/') {\r\n SAXParsedData.tagName = \"\";\r\n state = SAXParserState.IN_END_TAG;\r\n }else if(c == '?' || c == '!'){\r\n state = SAXParserState.METADATA;\r\n }else{\r\n SAXParsedData.tagName += c;\r\n state = SAXParserState.IN_START_TAG;\r\n }\r\n break;\r\n }\r\n case IN_START_TAG:{\r\n if(c == ' '){\r\n state = SAXParserState.SPACE_IN_START_TAG;\r\n }else if(c == '>'){\r\n // callback startElement event;\r\n parserHandler.startElement(SAXParsedData.tagName, SAXParsedData.attributes);\r\n SAXParsedData.clear();\r\n state = SAXParserState.CLOSE_START_TAG;\r\n }else {\r\n SAXParsedData.tagName += c;\r\n }\r\n break;\r\n }\r\n case SPACE_IN_START_TAG:{\r\n if(SAXParsedData.tagName.length() > 0){\r\n if(c != ' '){\r\n SAXParsedData.attribKey += c;\r\n state = SAXParserState.IN_ATTRIB_KEY;\r\n }\r\n }\r\n break;\r\n }\r\n case IN_ATTRIB_KEY:{\r\n if(c == '='){\r\n state = SAXParserState.IN_ATTRIB_EQUAL;\r\n }else{\r\n SAXParsedData.attribKey += c;\r\n }\r\n break;\r\n }\r\n case IN_ATTRIB_EQUAL:{\r\n if(c == '\"'){\r\n state = SAXParserState.IN_ATTRIB_VALUE;\r\n }\r\n break;\r\n }\r\n case IN_ATTRIB_VALUE:{\r\n if(c == '\"'){\r\n SAXParsedData.newAttribute();\r\n state = SAXParserState.IN_START_TAG;\r\n }else{\r\n SAXParsedData.attribValue += c;\r\n }\r\n break;\r\n }\r\n case CLOSE_START_TAG:{\r\n if(c == '<') {\r\n state = SAXParserState.BEGIN_START_OR_END_TAG;\r\n }else{\r\n SAXParsedData.innerText += c;\r\n state = SAXParserState.OUT_OF_TAG;\r\n }\r\n break;\r\n }\r\n case IN_END_TAG:{\r\n if(c == '>'){\r\n // callback endElement event\r\n parserHandler.endElement(SAXParsedData.tagName);\r\n state = SAXParserState.CLOSE_END_TAG;\r\n }else{\r\n SAXParsedData.tagName += c;\r\n }\r\n break;\r\n }\r\n case CLOSE_END_TAG:{\r\n if(c == ' '){\r\n state = SAXParserState.OUT_OF_TAG;\r\n }else if(c == '<'){\r\n SAXParsedData.tagName = \"\";\r\n state = SAXParserState.BEGIN_START_OR_END_TAG;\r\n }\r\n break;\r\n }\r\n case METADATA:{\r\n if(c == '>'){\r\n state = SAXParserState.CLOSE_END_TAG;\r\n }\r\n break;\r\n }\r\n case SYNTAX_ERROR:{\r\n try {\r\n\t\t\t\t\tthrow new Exception();\r\n\t\t\t\t} catch (Exception e) {\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t}\r\n }\r\n }\r\n\r\n }", "public static Document makeTransformedDomFromString(String theString, boolean blockTidy, URI transUri,\n HashMap<String, String> parameters, String encoding)\n throws Exception {\n if (encoding == null) {\n encoding = default_encoding;\n }\n reporter theReporter=m_Def.getReporter();\n theString = theString.trim();\n if (!theString.startsWith(\"<?xml\")) {\n theString = \"<?xml version=\\\"1.0\\\" encoding=\\\"\" + encoding + \"\\\" ?>\\n\" + theString;\n }\n // trouble here. The source is not located anywhere, what is systemID\n // send systemId for translation?\n // send null?\n try {\n return doTransformString(theString,transUri.toString(), transUri, parameters);\n } catch (IOException iox) {\n //nothing more we can do\n throw iox;\n } catch (Exception ex) {\n if(tidyIsPossibleAndAllowed(!blockTidy)){\n // --------- attempt to tidy, final attempt ----------\n theReporter.pushSimpleMessage(\"\\t\" + ex.getMessage());\n theReporter.pushMessage(\"attempt_to_tidy\");\n try {\n theString = m_Def.getTidyTool().tidyAndMakeXML(theString, encoding, theReporter);\n return doTransformString(theString,transUri.toString(), transUri, parameters);\n } catch (Exception sex3) {\n theReporter.pushMessage(\"could_not_tidy\" ,\"string\",sex3.getMessage());\n // nothing more we can do\n System.out.println(\"tidy failed: \"+sex3.getMessage());\n throw sex3;\n }\n } else {\n // we will do nothing\n throw new Exception(\"no tidy\");\n }\n }\n\n }", "default Parser<S, T, U> tr() {\n return s -> {\n int bak=s.pos;\n try {\n return parse(s);\n } catch (ParseException e) {\n s.seek(bak);\n throw e;\n }\n };\n }", "@Test\n public final void testCheckForBlankText() {\n Document testDoc = TestDocHelper.createDocument(\n \"<a></a>\");\n\n Node nonBlank = testDoc.createTextNode(\"a\");\n assertFalse(NodeOps.nodeIsEmptyText(nonBlank));\n\n Node blank = testDoc.createTextNode(\"\");\n assertTrue(NodeOps.nodeIsEmptyText(blank));\n }", "private String cleanupText(String text){\n return text.replaceAll(\"http[s]*[:](//)[^ ]+\", \"URL\");\n }" ]
[ "0.5506258", "0.53521407", "0.5280539", "0.5227032", "0.5182858", "0.51599205", "0.5115505", "0.5059286", "0.50578284", "0.50454247", "0.50373566", "0.49917266", "0.49575436", "0.4953463", "0.49424598", "0.49359614", "0.490726", "0.4898971", "0.48933518", "0.48910472", "0.4879183", "0.4876365", "0.48695308", "0.48689747", "0.48499092", "0.4842526", "0.48006153", "0.4792721", "0.4779426", "0.4770776", "0.47391656", "0.47156972", "0.47144556", "0.4693874", "0.46919084", "0.46817264", "0.4671509", "0.46711317", "0.46679285", "0.46518663", "0.46496353", "0.46477476", "0.46458527", "0.4632225", "0.46319115", "0.4623827", "0.4620478", "0.4574001", "0.45663008", "0.45655766", "0.45648852", "0.45648792", "0.455403", "0.45506945", "0.45454118", "0.4537857", "0.45375526", "0.45365378", "0.45344996", "0.4532224", "0.45305666", "0.45246503", "0.4511872", "0.45048878", "0.44944295", "0.44855866", "0.4484688", "0.44638482", "0.44637796", "0.44619536", "0.44616783", "0.44564414", "0.445428", "0.44432184", "0.44341314", "0.441918", "0.44185925", "0.44162807", "0.4412993", "0.44087493", "0.44072014", "0.43973574", "0.43953076", "0.43912533", "0.4376112", "0.43754816", "0.43754816", "0.4374501", "0.437379", "0.43727392", "0.43688452", "0.4367624", "0.436308", "0.43630663", "0.4362348", "0.43597594", "0.43576264", "0.43576226", "0.43518084", "0.43435723" ]
0.6810505
0
calculate the length of all children.
public int getLengthOfChildren() { int length = 0; IBiNode childTmp; if (this.child != null) { // length of first child length += this.child.getLength(); childTmp = this.child.getSibling(); while (childTmp != null) { // length of 2nd - nth children length += childTmp.getLength(); childTmp = childTmp.getSibling(); } } return length; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "int childrenSize();", "public int childrenSize()\r\n\t{\r\n\t\treturn this.children.size();\r\n\t}", "@Override\n public final int size() {\n return children.size();\n }", "public int countChildren() {\n return this.children.size();\n }", "@Override\n\tpublic int size() {\n\t\tint s = valCount; // saves value of current node\n\t\tfor (int i = 0; i < childCount; ++i) { // then checks all children\n\t\t\ts += children[i].size();\n\t\t}\n\t\treturn s;\n\t}", "public int numberOfChildren() {\n\t\tif(children == null) return 0;\n\t\telse return children.size();\n\t}", "public int countChildren() {\n return this.children.size();\n }", "public int getChildCount() {return children.size();}", "@Override\n public int getNumChildren() {\n\t return this._children.size();\n }", "public int size() {\n int count = terminal ? 1 : 0;\n for (Set<String> child : children)\n if (child != null) count += child.size();\n return count;\n }", "public int getChildCount() {\r\n if (_children == null) {\r\n return 0;\r\n }\r\n return _children.size();\r\n }", "int childCount(){\n return this.children.size();\n }", "int getChildCount();", "@Override\n public int getChildrenCount()\n {\n return children.getSubNodes().size();\n }", "public abstract int getNumChildren();", "public int getChildCount()\n {\n return mChildren.length; // The indexes and constraints\n }", "@Override\n\tpublic int size() {\n\t\tmodCount = root.numChildren();\n\t\treturn modCount;\n\t}", "public int getChildCount()\n/* */ {\n/* 500 */ return this.children.size();\n/* */ }", "public int getChildCount();", "public int getChildCount() {\n return this.children.size();\n }", "public int size() {\r\n\t\tint i = 0;\r\n\t\tif (this.value != 0) {\r\n\t\t\ti++;\r\n\t\t\tif(this.leftChild != null) {\r\n\t\t\t\ti = i + this.leftChild.size();\r\n\t\t\t}\r\n\t\t\tif(rightChild != null){\r\n\t\t\t\ti = i + this.rightChild.size();\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn i; \r\n\t}", "protected int numChildren() {\r\n return 3;\r\n }", "public int getChildCount() { return data.length; }", "@Override\n\tpublic int getChildrenNum() {\n\t\treturn children.size();\n\t}", "@DISPID(11)\n\t// = 0xb. The runtime will prefer the VTID if present\n\t@VTID(20)\n\tint childrenCount();", "public int getChildCount () {\n return childCount;\n }", "abstract long calculateChildCount() throws TskCoreException;", "public int size() {\n if(root == null){\n return 0;\n }\n else{\n return 1 + size(root.lc) + size(root.rc);\n }\n }", "public int getTotalChildren() {\n\t\treturn _nTotalChildren;\n\t}", "public int getChildCount() { return 0; }", "@Override\n public int size() {\n return size(root); }", "public int size(){\n return size(root);\n }", "@Override\n public int size() {\n return size(root);\n }", "public int shapeCount()\n {\n // return the number of children in the list\n return children.size();\n }", "@Override\n\tpublic int size() {\n\t\treturn size(root);\n\t}", "public final int size() {\r\n return sequentialSize(root);\r\n }", "@Override\r\n\tpublic int size() {\r\n\t\treturn size(root);\r\n\t}", "public static int size(Node root){\r\n int count = 0;\r\n for(int i=0; i<root.children.size(); i++){\r\n Node child = root.children.get(i);\r\n count += size(child);\r\n }\r\n return count + 1;\r\n }", "public int size() {\n\t\t// TODO\n\t\treturn size(root);\n\t}", "public StringWithCustomFacts getNumChildren() {\n return numChildren;\n }", "public int size() \r\n\t{\r\n\t\treturn size(root);\r\n\t}", "@Override\n\tpublic int height() {\n\t\tif (this.valCount == 0) { // if empty leaf\n\t\t\treturn 0;\n\t\t}\n\t\tint max = 1; \n\t\tfor (int i = 0; i < childCount; ++i) { // finds longest route among children\n\t\t\tmax = Math.max(max, children[i].height() + 1);\n\t\t}\n\t\treturn max;\n\t}", "public int getAccessibleChildrenCount() {\n try {\n return unoAccessibleContext.getAccessibleChildCount();\n } catch (com.sun.star.uno.RuntimeException e) {\n return 0;\n }\n }", "public int size() \n {\n return size(root);\n }", "public int size() \n\t {\n\t\t return size(root);\n\t }", "public int size() {\n return size(root);\n }", "public int size() {\n return size(root);\n }", "public int size() {\n\t\treturn root.count();\n\t}", "int size()\r\n\t{\r\n\t\treturn size(root);\r\n\t}", "public int size() {\n\t\treturn size(root);\n\t}", "public int size() {\n\t\treturn size(root);\n\t}", "public int size()\n {\n return _root.size();\n }", "@Override\n public int getChildrenCount(String name)\n {\n return children.getSubNodes(name).size();\n }", "@FameProperty(name = \"numberOfChildren\", derived = true)\n public Number getNumberOfChildren() {\n throw new UnsupportedOperationException(\"Not yet implemented!\"); \n }", "public int size() {\n return tree.count();\n }", "@Override\n public int getChildrenCount(int groupPosition) {\n return children[groupPosition].length;\n }", "int size() \n { \n return size(root); \n }", "private int numChildren(int index){\n\t\t\n\t\tint children = 0;\n\t\t\n\t\tif((index*2) + 1 <= this.currentSize){\n\t\t\tif(array[(index * 2) + 1] != null){\n\t\t\t\tchildren++;\n\t\t\t}\n\t\t}\n\t\tif((index*2) + 1 <= this.currentSize){\n\t\t\tif(array[(index * 2) + 2] != null){\n\t\t\t\tchildren++;\n\t\t\t}\n\t\t}\n\t\treturn children;\n\t}", "public abstract int getMaxChildren();", "public int size() {\n\t\tif (this.root == null) {\n\t\t\treturn 0;\n\t\t}\n\t\treturn this.root.getSize(); \n\t}", "int getNumberOfChildren(int nodeID){\n check(nodeID);\n return nodes_[nodeID].size_;\n }", "public int size() {\r\n\t\treturn size(rootNode);\r\n\t}", "public int size()\r\n\t {\r\n\t\t if(root == null)\r\n\t\t {\r\n\t\t\t return 0;\r\n\t\t }\r\n\t\t return root.getSubTreeSize();\r\n\t }", "public Integer GetNumOfChild() {\n\t\treturn this.ChildSMILES.size();\n\t}", "public ClosableIterator<org.ontoware.rdf2go.model.node.Node> getAllLength_asNode() {\r\n\t\treturn Base.getAll_asNode(this.model, this.getResource(), LENGTH);\r\n\t}", "public int size() {\r\n int count = 0;\r\n for (int i = 0; i < SIZE; i++) {\r\n if (tree[i] != null) {\r\n count++;\r\n }\r\n }\r\n return count;\r\n }", "int getLength() {\n return levels.length;\n }", "public int getLength()\n\t{\n\t\tDNode tem=first;\n\t\tint length=0;\n\t\twhile(tem.nextDNode!=null)\n\t\t{\n\t\t\tlength=length+1;\n\t\t\ttem=tem.nextDNode;\n\t\t}\n\t\tif(first!=null)\n\t\t\tlength=length+1;\n\t\treturn length;\n\t}", "public int size(){\n if(root!=null){ // มี node ใน tree\n return size(root);\n }\n else{\n return 0; // tree เปล่า size 0\n }\n }", "public int size() {\n return root.getNumberOfTerminalsInSubTree();\n }", "public int getBoundContainerElementCount() {\n return nestedElements.size();\n }", "public int length() {\n return nodeList.size();\n }", "private int countChildElements(final Node parent)\r\n {\r\n NodeList listOfChildren = parent.getChildNodes();\r\n return listOfChildren.getLength();\r\n }", "public int getSize() {\n\t\treturn this.getSizeRecursive(root);\n\t}", "@Override\n public int getLength()\n {\n int length = 0;\n\n for(int i = 0; i < this.movies.length; i++)\n {\n if(this.movies.get(i) != null)\n length++;\n }\n\n return length;\n }", "public int size(){\n int size = 0;\n for(LinkedList<E> item : this.data){\n size += item.size();\n }\n return size;\n }", "public int getSize(){\n /**\n * TODO: INSERT YOUR CODE HERE\n * FIND THE NUMBER OF NODES IN THE TREE AND STORE THE VALUE IN CLASS VARIABLE \"size\"\n * RETURN THE \"size\" VALUE\n *\n * HINT: THE NMBER OF NODES CAN BE UPDATED IN THE \"size\" VARIABLE EVERY TIME A NODE IS INSERTED OR DELETED FROM THE TREE.\n */\n\n return size;\n }", "public int length() {\n return size();\n }", "@Override\n public int getChildrenCount(int groupPosition)\n {\n return children.get(headers.get(groupPosition)).size();\n }", "public int length(){\n\t\tint length = 0;\n\t\tListNode temp = firstNode;\n\t\twhile(temp!=null){\n\t\t\tlength++;\n\t\t\ttemp = temp.getNextNode();\n\t\t}\n\n\t\treturn length;\n\t}", "public int length() {\n int ret_val = 1;\n LinkedList i = this;\n\n while (i.next != null) {\n i = i.next;\n ret_val++;\n }\n return ret_val;\n }", "public int order()\n\t{\n\t\treturn null == _children ? 0 : _children.size();\n\t}", "public double length() {\n\t\tdouble length = 0;\n\t\tif (isEmpty())\n\t\t\treturn 0;\n\t\tjava.util.ListIterator<PathPoint> it = listIterator();\n\t\tPathPoint current = it.next();\n\t\twhile (it.hasNext()) {\n\t\t\tPathPoint next = it.next();\n\t\t\tlength += mc.distance3d(current.getLocation(), next.getLocation());\n\t\t\tcurrent = next;\n\t\t}\n\t\treturn length;\n\t}", "@Override\r\n\tpublic int getChildCount(Object parent) {\r\n\t\r\n\t\treturn 0;\r\n\t}", "public int getLength() {\r\n int length = 0;\r\n \r\n Iterator it = collection.iterator();\r\n \r\n while(it.hasNext()) {\r\n length += ((Chunk)it.next()).getSize();\r\n }\r\n \r\n return length;\r\n }", "int computeHeight() {\n Node<Integer>[] nodes = new Node[parent.length];\n for (int i = 0; i < parent.length; i++) {\n nodes[i] = new Node<Integer>();\n }\n int rootIndex = 0;\n for (int childIndex = 0; childIndex < parent.length; childIndex++) {\n if (parent[childIndex] == -1) {\n rootIndex = childIndex;\n } else {\n nodes[parent[childIndex]].addChild(nodes[childIndex]);\n }\n }\n return getDepth(nodes[rootIndex]);\n }", "protected int getLength() {\n\t\treturn this.length;\n\t}", "@Override\n\tpublic int getChildrenCount(int sectionPosition) {\n\t\treturn sections.get(sectionPosition).getArrayChildren().size();\n\t}", "private int getNumberOfChildren(String elemId) {\n return selenium.getXpathCount(\"//*[@id='\" + elemId + \"']/*\").intValue();\n }", "@Override\n\tpublic int totalPathLength() {\n\t\treturn totalPathLength(root, sum);// returns total path lenght number\n\t}", "public static int size_parent() {\n return (8 / 8);\n }", "public @Override int getViewCount() {\n return getChildren().getChildCount();\n }", "public int size() {\n if (root == null) return 0;\n if (root.left == null && root.right == null) return 1;\n else {\n int treeSize = 0;\n treeSize = size(root, treeSize);\n return treeSize;\n }\n }", "public double length() {\n if (first.p == null) return 0;\n double distance = 0.0;\n Node n = first;\n Node n2 = first.next;\n while (!n.next.equals(first)) {\n distance += n.p.distanceTo(n2.p);\n n = n.next;\n n2 = n2.next;\n }\n distance += n.p.distanceTo(n2.p);\n return distance;\n }", "@Override\n\tpublic int getChildrenCount(int groupPosition) {\n\t\treturn listChildren.get(listTitles.get(groupPosition)).size();\n\t}", "public int size(){\n return nodes.size();\n }", "int treeSize() {\n return memSize() + (this.expression == null ? 0 : getExpression().treeSize()) + (this.typeArguments == null ? 0 : this.typeArguments.listSize()) + (this.methodName == null ? 0 : getName().treeSize());\n }", "public int getCount()\r\n {\r\n int answer=0;\r\n answer+=recCount(root);\r\n return answer;\r\n }", "@Override\n public int getChildrenCount(int groupPosition) {\n return getGroup(groupPosition).getChildrenCount();\n }", "public int size() {\n return this.treeSize - this.unusedTreeIndices.size();\n }" ]
[ "0.8119635", "0.7875079", "0.7767314", "0.75724214", "0.7540042", "0.7534535", "0.75333464", "0.75192004", "0.7434269", "0.7416618", "0.74016625", "0.7394214", "0.73626894", "0.736209", "0.73576665", "0.7356843", "0.73379576", "0.7335044", "0.7241104", "0.7208774", "0.71442956", "0.71145517", "0.7092172", "0.70546705", "0.6975415", "0.6925236", "0.6887976", "0.68522626", "0.68485856", "0.68214965", "0.6813353", "0.6778142", "0.67760426", "0.6735698", "0.67294186", "0.6720955", "0.6720835", "0.67042655", "0.67026955", "0.6702686", "0.66941726", "0.66902417", "0.6688195", "0.667758", "0.66673446", "0.6657551", "0.6657551", "0.665753", "0.66471833", "0.6643445", "0.6643445", "0.66396403", "0.6635362", "0.6623225", "0.655212", "0.65242666", "0.65208364", "0.6517351", "0.6511568", "0.6485659", "0.6470914", "0.6427011", "0.6401365", "0.64006686", "0.6398828", "0.63790154", "0.6375028", "0.6358137", "0.6343935", "0.6314337", "0.63094914", "0.63019854", "0.6293097", "0.62723637", "0.62368554", "0.6234742", "0.6233242", "0.6213398", "0.6210265", "0.6209692", "0.61951894", "0.6190106", "0.618937", "0.6179022", "0.6175015", "0.6170048", "0.6167786", "0.615907", "0.615672", "0.6150008", "0.6120584", "0.6117051", "0.6101597", "0.6094208", "0.6091905", "0.6084571", "0.6076472", "0.6076219", "0.6073697", "0.6066694" ]
0.8167076
0
create a DOMtree from node and all children (recursive).
public Node createDOMSubtree(final Document doc) { int i; String aName; Node childNode; Element element; IBiNode tmp; element = doc.createElementNS(this.namespaceURI, this.eName); // add attributes if (this.attrs != null) { for (i = 0; i < this.attrs.getLength(); i++) { aName = this.attrs.getLocalName(i); if ("".equals(aName)) { aName = this.attrs.getQName(i); } element.setAttribute(aName, this.attrs.getValue(i)); } } // create DOM-tree of children if (this.child != null) { tmp = this.child; while (tmp != null) { childNode = tmp.createDOMSubtree(doc); if (childNode != null) { element.appendChild(childNode); } tmp = tmp.getSibling(); } } this.namespaceURI = null; this.eName = null; this.attrs = null; this.setNode(element); return element; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void createTree() {\n Node<String> nodeB = new Node<String>(\"B\", null, null);\n Node<String> nodeC = new Node<String>(\"C\", null, null);\n Node<String> nodeD = new Node<String>(\"D\", null, null);\n Node<String> nodeE = new Node<String>(\"E\", null, null);\n Node<String> nodeF = new Node<String>(\"F\", null, null);\n Node<String> nodeG = new Node<String>(\"G\", null, null);\n root.leftChild = nodeB;\n root.rightChild = nodeC;\n nodeB.leftChild = nodeD;\n nodeB.rightChild = nodeE;\n nodeC.leftChild = nodeF;\n nodeC.rightChild = nodeG;\n\n }", "private TreeItem<File> buildTree(model.Node node, TreeItem<File> parent) throws IOException {\n // set the root of the tree\n TreeItem<File> root = new TreeItem<>(node.getDir().getFile());\n // show all subdirectories and photos by default\n root.setExpanded(true);\n // set all photos under the directory as the child TreeItem of this directory\n for (model.Photo photo : node.getDir().getPhotos()) {\n root.getChildren().add(new TreeItem<>(photo.getFile()));\n if (!model.PhotoManager.getPhotos().contains(photo)) {\n model.PhotoManager.addPhoto(photo);\n }\n }\n // set all subdirectories of this directory as the child TreeItem\n for (Object child : node.getChildren()) {\n model.Node subDir = (model.Node) child;\n buildTree(subDir, root);\n }\n if (parent == null) {\n return root;\n } else {\n parent.getChildren().add(root);\n }\n return null;\n }", "private void CreateTree()\r\n\t{\r\n\r\n\t\t//sample nodes which are not identical\r\n\t\ta = new Node(1);\r\n\t\ta.left = new Node(3);\r\n\t\ta.left.left = new Node(5);\r\n\t\ta.right = new Node(2);\r\n\r\n\r\n\t\tb = new Node(2);\r\n\t\tb.left = new Node(1);\r\n\t\tb.right = new Node(3);\r\n\t\tb.right.right = new Node(7);\r\n\t\tb.left.right = new Node(4);\r\n\r\n\t\t//sample nodes which are identical\r\n\t\ta1 = new Node(1);\r\n\t\ta1.left = new Node(3);\r\n\t\ta1.left.left = new Node(5);\r\n\t\ta1.right = new Node(2);\r\n\r\n\r\n\t\tb1 = new Node(1);\r\n\t\tb1.left = new Node(3);\r\n\t\tb1.right = new Node(2);\r\n\t\tb1.left.left = new Node(5); \r\n\t}", "public static TreeNode getTree() {\n\t\tTreeNode a = new TreeNode(\"a\", 314);\n\t\tTreeNode b = new TreeNode(\"b\", 6);\n\t\tTreeNode c = new TreeNode(\"c\", 271);\n\t\tTreeNode d = new TreeNode(\"d\", 28);\n\t\tTreeNode e = new TreeNode(\"e\", 0);\n\t\tTreeNode f = new TreeNode(\"f\", 561);\n\t\tTreeNode g = new TreeNode(\"g\", 3);\n\t\tTreeNode h = new TreeNode(\"h\", 17);\n\t\tTreeNode i = new TreeNode(\"i\", 6);\n\t\tTreeNode j = new TreeNode(\"j\", 2);\n\t\tTreeNode k = new TreeNode(\"k\", 1);\n\t\tTreeNode l = new TreeNode(\"l\", 401);\n\t\tTreeNode m = new TreeNode(\"m\", 641);\n\t\tTreeNode n = new TreeNode(\"n\", 257);\n\t\tTreeNode o = new TreeNode(\"o\", 271);\n\t\tTreeNode p = new TreeNode(\"p\", 28);\n\t\t\n\t\ta.left = b; b.parent = a;\n\t\tb.left = c; c.parent = b;\n\t\tc.left = d;\t d.parent = c;\n\t\tc.right = e; e.parent = c;\n\t\tb.right = f; f.parent = b;\n\t\tf.right = g; g.parent = f;\n\t\tg.left = h; h.parent = g;\n\t\ta.right = i; i.parent = a;\n\t\ti.left = j; j.parent = i;\n\t\ti.right = o; o.parent = i;\n\t\tj.right = k; k.parent = j;\n\t\to.right = p; p.parent = o;\n\t\tk.right = n; n.parent = k;\n\t\tk.left = l; l.parent = k;\n\t\tl.right = m; m.parent = l;\n\t\t\n\t\td.childrenCount = 0;\n\t\te.childrenCount = 0;\n\t\tc.childrenCount = 2;\n\t\tb.childrenCount = 6;\n\t\tf.childrenCount = 2;\n\t\tg.childrenCount = 1;\n\t\th.childrenCount = 0;\n\t\tl.childrenCount = 1;\n\t\tm.childrenCount = 0;\n\t\tn.childrenCount = 0;\n\t\tk.childrenCount = 3;\n\t\tj.childrenCount = 4;\n\t\to.childrenCount = 1;\n\t\tp.childrenCount = 0;\n\t\ti.childrenCount = 7;\n\t\ta.childrenCount = 15;\n\t\t\n\t\treturn a;\n\t}", "public static RootNode buildTree() {\n\t\t//1\n\t\tfinal RootNode root = new RootNode();\n\t\t\n\t\t//2\n\t\tEdgeNode a = attachEdgenode(root, \"a\");\n\t\tEdgeNode daa = attachEdgenode(root, \"daa\");\n\t\t\n\t\t//3\n\t\tExplicitNode e = Builder.buildExplicit();\n\t\te.setPreviousNode(a);\n\t\ta.addChildNode(e);\n\t\t\n\t\tattachLeafNode(daa, \"2\");\n\t\t\n\t\t//4\n\t\tEdgeNode a_e = attachEdgenode(e, \"a\");\n\t\tEdgeNode daa_e = attachEdgenode(e, \"daa\");\t\t\n\t\t\n\t\t//5\n\t\tattachLeafNode(a_e, \"3\");\n\t\tattachLeafNode(daa_e, \"1\");\n\t\treturn root;\n\t}", "public void createTree() {\n\t\taddNodeToParent(nodeMap);\n\t}", "public static DocumentFragment extractChildren(final Node node) throws DOMException {\n\t\treturn extractChildren(node, true); //extract the childen by removing them\n\t}", "private static Node getTree()\r\n {\r\n Node node1 = new Node( 1 );\r\n Node node2 = new Node( 2 );\r\n Node node3 = new Node( 3 );\r\n Node node4 = new Node( 4 );\r\n Node node5 = new Node( 5 );\r\n Node node6 = new Node( 6 );\r\n Node node7 = new Node( 7 );\r\n\r\n node1.left = node2;\r\n node1.right = node3;\r\n\r\n node2.left = node4;\r\n node2.right = node5;\r\n\r\n node3.left = node6;\r\n node3.right = node7;\r\n return node1;\r\n }", "List<Node<T>> children();", "Node[] getChildren(Node node);", "private void createDOMTree(){\n\t\t\tElement rootEle = dom.createElement(\"html\");\r\n\t\t\tdom.appendChild(rootEle);\r\n\t\t\t\r\n\t\t\t//\t\t\tcreates <head> and <title> tag\r\n\t\t\tElement headEle = dom.createElement(\"head\");\r\n\t\t\tElement titleEle = dom.createElement(\"title\");\r\n\t\t\t\r\n\t\t\t//\t\t\tset value to <title> tag\r\n\t\t\tText kuerzelText = dom.createTextNode(\"Auswertung\");\r\n\t\t\ttitleEle.appendChild(kuerzelText);\r\n\t\t\theadEle.appendChild(titleEle);\r\n\t\t\t\r\n\t\t\tElement linkEle = dom.createElement(\"link\");\r\n\t\t\tlinkEle.setAttribute(\"rel\", \"stylesheet\");\r\n\t\t\tlinkEle.setAttribute(\"type\", \"text/css\");\r\n\t\t\tlinkEle.setAttribute(\"href\", \"./format.css\");\r\n\t\t\theadEle.appendChild(linkEle);\r\n\t\t\t\r\n\t\t\trootEle.appendChild(headEle);\r\n\t\t\t\r\n\t\t\t\r\n\t\t\tElement bodyEle = dom.createElement(\"body\");\r\n\t\t\tElement divEle = dom.createElement(\"div\");\r\n\t\t\tdivEle.setAttribute(\"id\", \"cont\");\r\n\t\t\t\r\n\t\t\tVector<String> tmp = myData.get(0);\r\n\t\t\tElement h2Ele = dom.createElement(\"h2\");\r\n\t\t\tString h1Str = \"\";\r\n\t\t\tfor(Iterator i = tmp.iterator(); i.hasNext(); )\r\n\t\t\t{\r\n\t\t\t\th1Str = h1Str + (String)i.next() + \" \";\r\n\t\t\t}\r\n\t\t\tText aText = dom.createTextNode(h1Str);\r\n\t\t\th2Ele.appendChild(aText);\r\n\t\t\tdivEle.appendChild(h2Ele);\r\n\t\t\tmyData.remove(0);\r\n\t\t\t\r\n\t\t\tElement tableEle = dom.createElement(\"table\");\r\n//\t\t\ttableEle.setAttribute(\"border\", \"1\");\r\n\t\t\t\r\n\t\t\ttmp = myData.get(0);\r\n\t\t\tElement trHeadEle = createTrHeadElement(tmp);\r\n\t\t\ttableEle.appendChild(trHeadEle);\r\n\t\t\tmyData.remove(0);\r\n\t\t\t\r\n\t\t\tIterator it = myData.iterator();\r\n\t\t\twhile(it.hasNext()) {\r\n\t\t\t\ttmp = (Vector<String>)it.next();\r\n\t\t\t\tElement trEle = createTrElement(tmp);\r\n\t\t\t\ttableEle.appendChild(trEle);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tdivEle.appendChild(tableEle);\r\n\t\t\tbodyEle.appendChild(divEle);\r\n\t\t\trootEle.appendChild(bodyEle);\r\n\t\t\t\r\n\t\t}", "public static TreeNode buildTree() {\n\t\t\n\t\tTreeNode root = new TreeNode(1);\n\t\t\n\t\tTreeNode left = new TreeNode(2);\n\t\tleft.left = new TreeNode(4);\n\t\tleft.right = new TreeNode(5);\n\t\tleft.right.right = new TreeNode(8);\n\t\t\n\t\tTreeNode right = new TreeNode(3);\n\t\tright.left = new TreeNode(6);\n\t\tright.right = new TreeNode(7);\n\t\tright.right.left = new TreeNode(9);\n\t\t\n\t\troot.left = left;\n\t\troot.right = right;\n\t\t\n\t\treturn root;\n\t}", "public static Node buildRandomTree() {\n\t\tNode root = createNode(15);\n\t\troot.leftChild = createNode(10);\n\t\troot.rightChild = createNode(4);\n\t\troot.leftChild.leftChild = createNode(25);\n\t\troot.leftChild.leftChild.rightChild = createNode(27);\n\t\troot.leftChild.leftChild.leftChild = createNode(13);\n\t\troot.leftChild.rightChild = createNode(25);\n\t\troot.leftChild.rightChild.rightChild = createNode(7);\n\t\t\n\t\treturn root;\n\t}", "@Override\r\n\tpublic void buildTree() {\r\n\t\t\r\n\t\t// root level \r\n\t\trootNode = new TreeNode<String>(\"\");\r\n\t\t\r\n\t\t//first level\r\n\t\tinsert(\".\", \"e\");\r\n\t\tinsert(\"-\", \"t\");\r\n\t\t\r\n\t\t//second level\r\n\t\t\r\n\t\tinsert(\". .\", \"i\");\r\n\t\tinsert(\".-\", \"a\");\r\n\t\tinsert(\"-.\", \"n\"); \r\n\t\tinsert(\"--\", \"m\");\r\n\t\t\r\n\t\t//third level\r\n\t\tinsert(\"...\", \"s\");\r\n\t\tinsert(\"..-\", \"u\");\r\n\t\tinsert(\".-.\", \"r\");\r\n\t\tinsert(\".--\", \"w\");\r\n\t\tinsert(\"-..\", \"d\");\r\n\t\tinsert(\"-.-\", \"k\");\r\n\t\tinsert(\"--.\", \"g\");\r\n\t\tinsert(\"---\", \"o\");\r\n\t\t\r\n\t\t//fourth level\r\n\t\tinsert(\"....\", \"h\");\r\n\t\tinsert(\"...-\", \"v\");\r\n\t\tinsert(\"..-.\", \"f\");\r\n\t\tinsert(\".-..\", \"l\");\r\n\t\tinsert(\".--.\", \"p\");\r\n\t\tinsert(\".---\", \"j\");\r\n\t\tinsert(\"-...\", \"b\");\r\n\t\tinsert(\"-..-\", \"x\");\r\n\t\tinsert(\"-.-.\", \"c\");\r\n\t\tinsert(\"-.--\", \"y\");\r\n\t\tinsert(\"--..\", \"z\");\r\n\t\tinsert(\"--.-\", \"q\");\r\n\t\t\r\n\t}", "private void constructTree() {\r\n\t\tsortLeaves();\r\n\t\tNode currentNode;\r\n\t\tint index = 0;\r\n\t\t\tdo{\r\n\t\t\t\t// Create a new node with the next two least frequent nodes as its children\r\n\t\t\t\tcurrentNode = new Node(this.treeNodes[0], this.treeNodes[1]); \r\n\t\t\t\taddNewNode(currentNode);\r\n\t\t\t}\r\n\t\t\twhile (this.treeNodes.length > 1); // Until there is only one root node\r\n\t\t\tthis.rootNode = currentNode;\r\n\t\t\tindex++;\r\n\t}", "private AlertTreeNode createTree() \n throws AlertException {\n\n AlertTreeNode res = null;\n\n AlertComponent.AlertProperty prop = null;\n AlertComponent compRoot = null;\n AlertComponent compNode = null;\n AlertTreeNode node = null;\n AlertTreeNode prevNode = null;\n\n //\n // 'root' node\n //\n prop = new AlertComponent.AlertProperty(\"root\", AlertType.COMPOSITE);\n compRoot = new AlertRoot(prop);\n res = new AlertTreeNode(compRoot, null);\n\n //\n // 'node' Node.\n // \n for (int i = 0; i < compRoot.getNbChildren(); i++) {\n \n prop = compRoot.getPropertyChild(i);\n compNode = compRoot.getPropertyValueComponent(prop.getName());\n node = new AlertTreeNode(compNode, res);\n if (prevNode == null) {\n res.setChild(node);\n } else {\n prevNode.setSibling(node);\n }\n prevNode = node;\n }\n return res;\n }", "public BuildTree createBuildTree() {\n BuildTree buildTree = new BuildTree();\n createBuildTree(0, buildTree);\n return buildTree;\n }", "@Override\n public Element serialize(Node node, SerializationPosition state) {\n Element doc = state.doc;\n DefaultMutableTreeNode treeNode = state.currPos;\n \n Object value = treeNode.getUserObject();\n Element parentElement = null; \n \n parentElement = doc.getOwnerDocument().createElement(\"directory\");\n\n Directory book = (Directory) value;\n // Apply properties to root element...\n Attr attrName = doc.getOwnerDocument().createAttribute(\"name\");\n attrName.setNodeValue(book.getName());\n parentElement.getAttributes().setNamedItem(attrName);\n \n return parentElement;\n }", "protected static DefaultMutableTreeNode getDefaultTreeModel()\n {\n // New root node\n DefaultMutableTreeNode root =\n new DefaultMutableTreeNode(\"Root\");\n \n // First level\n for (int i = 1; i <= 5; i++)\n {\n // New node\n DefaultMutableTreeNode folder =\n new DefaultMutableTreeNode(\"Folder-\" + i);\n \n // Add node to root\n root.add(folder);\n \n // Second level\n for (int j = 1; j <= 3; j++)\n {\n // New node\n DefaultMutableTreeNode subfolder =\n new DefaultMutableTreeNode(\"Subfolder-\" + j);\n \n // Add node to parent node\n folder.add(subfolder);\n \n // Third level\n for (int k = 1; k <= 3; k++)\n {\n // New anchor\n A a = new A(\"http://jakarta.apache.org\");\n a.setTarget(\"target\").addElement(\"Document-\" + k);\n \n // New node (leaf)\n DefaultMutableTreeNode document =\n new DefaultMutableTreeNode(a.toString());\n \n // Add node to parent node\n subfolder.add(document);\n }\n }\n }\n \n // Return root node\n return root;\n }", "private Node removeChildNodes(Node node) throws TransformerException {\r\n\r\n NodeList children = node.getChildNodes();\r\n int index = 0;\r\n int length = children.getLength();\r\n\r\n for (index = 0; index < length; index++) {\r\n Node n = children.item(index);\r\n String nString = nodeToString(n);\r\n\r\n // for(Node n : node.getChildNodes()){\r\n if (n != null) {\r\n if (n.hasChildNodes()) {// edit to remove children of children\r\n removeChildNodes(n);\r\n node.removeChild(n);\r\n } else\r\n node.removeChild(n);\r\n }\r\n }\r\n String nodeString = nodeToString(node);\r\n return node;\r\n }", "private TreeNode createTree() {\n // Map<String, String> map = new HashMap<>();\n // map.put(\"dd\", \"qq\");\n // 叶子节点\n TreeNode G = new TreeNode(\"G\");\n TreeNode D = new TreeNode(\"D\");\n TreeNode E = new TreeNode(\"E\", G, null);\n TreeNode B = new TreeNode(\"B\", D, E);\n TreeNode H = new TreeNode(\"H\");\n TreeNode I = new TreeNode(\"I\");\n TreeNode F = new TreeNode(\"F\", H, I);\n TreeNode C = new TreeNode(\"C\", null, F);\n // 构造根节点\n TreeNode root = new TreeNode(\"A\", B, C);\n return root;\n }", "private Node constructInternal(List<Node> children){\r\n\r\n // Base case: root found\r\n if(children.size() == 1){\r\n return children.get(0);\r\n }\r\n\r\n // Generate parents\r\n boolean odd = children.size() % 2 != 0;\r\n for(int i = 1; i < children.size(); i += 2){\r\n Node left = children.get(i-1);\r\n Node right = children.get(i);\r\n Node parent = new Node(Utility.SHA512(left.hash + right.hash), left, right);\r\n children.add(parent);\r\n }\r\n\r\n // If the number of nodes is odd, \"inherit\" the remaining child node (no hash needed)\r\n if(odd){\r\n children.add(children.get(children.size() - 1));\r\n }\r\n return constructInternal(children);\r\n }", "private Node constructParsedTree(Node[] nodes) {\n int rootIndex = 0;\n for (int i = 0; i < nodes.length; i++) {\n if (nodes[i].getFather() > 0)\n nodes[nodes[i].getFather() - 1].addChild(nodes[i]);\n else\n rootIndex = i;\n }\n return nodes[rootIndex];\n }", "public TreeNode buildTree(ArrayList<TreeNode> nodes){\n // if empty arraylist\n if (nodes.size() == 0){\n return null;\n }\n // else\n TreeNode root = nodes.get(0);\n // Structure the tree\n for (int i = 0; i < nodes.size(); i++){\n if ((2*i+1) < nodes.size()){\n nodes.get(i).left = nodes.get(2*i+1);\n } else {\n nodes.get(i).left = null;\n }\n if ((2*i+2) < nodes.size()){\n nodes.get(i).right = nodes.get(2*i+2);\n } else {\n nodes.get(i).right = null;\n }\n }\n \n return root;\n }", "public static void generateTree(Node root){\n\n // If we hit the winning position or a draw, stop generating (Exit condition)\n if(defaultEvaluator.evaluate(root.getBoard()) != 0 || root.getBoard().getTurnNumber() == 9)\n return;\n\n // Else, keep generating recursively\n\n // Step0-Determine the turn player.\n GamePiece turnPlayer;\n if (root.getBoard().isXTurn()) {\n turnPlayer = GamePiece.X;\n }\n else {\n turnPlayer = GamePiece.O;\n }\n\n // Step1-generate a new board for every child of root\n int parentalBranches = root.getChildren().length;\n int childrenBranches = parentalBranches - 1;\n for(int i=0; i<parentalBranches; ++i){\n\n root.getChildren()[i] = new Node(childrenBranches);\n root.getChildren()[i].setBoard((Board)(root.getBoard().clone()));\n\n }\n\n // Step2-Place the pieces\n int childIndex=0;\n int placement = 0;\n while(childIndex<parentalBranches){\n\n try{\n\n root.getChildren()[childIndex].getBoard().set(placement %3, placement /3, turnPlayer);\n childIndex++;\n\n }catch(GridAlreadyChosenException ex){}\n placement++;\n\n }\n\n // Step3-Let the recursive madness begin. Call generateTree() on each child\n for (int i=0; i<parentalBranches; ++i)\n generateTree(root.getChildren()[i]);\n\n\n }", "@Test\n\tpublic void testBuildTree() {\n\t\tTree<Integer> tree = new Tree<Integer> ();\n\t\t//add first level children, 1\n\t\tNode<Integer> root = tree.getRoot();\n\t\troot.addChild(new Node<Integer>());\n\t\tNode<Integer> c1 = root.getFirstChild();\n\t\tassertTrue(c1.getData() == null);\n\t\t//add second level children, 3\n\t\tc1.addChild(new Node<Integer> ());\n\t\tc1.addChild(new Node<Integer> ());\n\t\tc1.addChild(new Node<Integer> ());\n\t\tassertTrue(c1.countChildren() == 3);\n\t\t//add third level children, 3 * 3\n\t\tint[][] leafData = {\n\t\t\t\t{8,7,2},\n\t\t\t\t{9,1,6},\n\t\t\t\t{2,4,1}\n\t\t};\n\t\tNode<Integer> c2 = c1.getFirstChild();\n\t\tint i = 0;\n\t\twhile (c2 != null) {\n\t\t\tc2.addChild(new Node<Integer> (leafData[i][0]));\n\t\t\tc2.addChild(new Node<Integer> (leafData[i][1]));\n\t\t\tc2.addChild(new Node<Integer> (leafData[i][2]));\n\t\t\tc2 = c2.next();\n\t\t\ti++;\n\t\t}\n\t\tassertTrue(tree.countDepth() == 3);\n\t\tNode<Integer> leaf = root;\n\t\twhile (leaf.countChildren() > 0) {\n\t\t\tleaf = leaf.getFirstChild();\n\t\t}\n\t\tassertTrue(leaf.getData() == 8);\t\t\t\n\t}", "public static Stream<Node> childNodesOf(@Nonnull final Node node) {\n\t\treturn streamOf(node.getChildNodes());\n\t}", "protected void makeTheTree(){\n\n structure.getRootNode().branchList.add(structure.getNode11());\n structure.getRootNode().branchList.add(structure.getNode12());\n structure.getRootNode().branchList.add(structure.getNode13());\n\n structure.getNode11().branchList.add(structure.getNode111());\n structure.getNode11().branchList.add(structure.getNode112());\n structure.getNode11().branchList.add(structure.getNode113());\n\n structure.getNode13().branchList.add(structure.getNode131());\n\n structure.getNode112().branchList.add(structure.getNode1121());\n\n }", "private List<Node<E>> getChildrenForNode(Node<E> node) {\n ArrayList<Node<E>> list = new ArrayList<>();\n for (Node<E> child : node.getChilden()) {\n list.add(child);\n }\n return list;\n }", "void createTreeNodesForElement(final DefaultMutableTreeNode dmtn, final Collection<Element> elements) {\n for (Element child : elements) {\n DefaultMutableTreeNode created = new DefaultMutableTreeNode(child.getName());\n dmtn.add(created);\n createTreeNodesForElement(created, child.getChildren());\n }\n }", "void createTreeNodesForElement(final DefaultMutableTreeNode dmtn, final Collection<Element> elements) {\n for (Element child : elements) {\n DefaultMutableTreeNode created = new DefaultMutableTreeNode(child.getName());\n dmtn.add(created);\n createTreeNodesForElement(created, child.getChildren());\n }\n }", "private void NewTree(HttpServletRequest request, HttpServletResponse response) throws ParserConfigurationException, IOException {\n XMLTree tree;\n tree = XMLTree.getInstance();\n //_response.getWriter().write(tree.newTree());\n String answer = tree.newTree();\n returnResponse(response, answer);\n }", "private DefaultMutableTreeNode buildSortedTree(DefaultMutableTreeNode oldNode, \n DefaultMutableTreeNode newNode) {\n \n List<DefaultMutableTreeNode> children = new ArrayList();\n Enumeration e = oldNode.children();\n while(e.hasMoreElements()) {\n DefaultMutableTreeNode child = (DefaultMutableTreeNode)e.nextElement();\n children.add(child);\n }\n \n // sort everything except the first level\n if (!(oldNode.getUserObject() instanceof RootNode)) {\n Collections.sort(children, new Comparator<DefaultMutableTreeNode>() {\n public int compare(DefaultMutableTreeNode node1, DefaultMutableTreeNode node2) {\n return node1.getUserObject().toString().compareTo(\n node2.getUserObject().toString());\n }\n });\n }\n \n for(DefaultMutableTreeNode oldChild : children) {\n DefaultMutableTreeNode newChild = new DefaultMutableTreeNode(oldChild.getUserObject());\n newNode.add(newChild);\n buildSortedTree(oldChild, newChild);\n }\n \n return newNode;\n }", "public static Element serialize( SerializationPosition state) {\n Element doc = state.doc;\n DefaultMutableTreeNode treeNode = state.currPos;\n \n Object value = treeNode.getUserObject();\n Element parentElement = null; \n \n parentElement = doc.getOwnerDocument().createElement(\"directory\");\n\n \n // Apply properties to root element...\n Attr attrName = doc.getOwnerDocument().createAttribute(\"name\");\n attrName.setNodeValue(state.currPos.toString());\n parentElement.getAttributes().setNamedItem(attrName);\n \n return parentElement;\n }", "TreeNode addChild(TreeNode node);", "public abstract List<Node> getChildNodes();", "public void makeTree(String xmlFileName) throws Exception {\n\t\tDocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\n\t\tDocumentBuilder db = dbf.newDocumentBuilder();\n\t\tDocument doc = db.parse(new FileInputStream(xmlFileName));;\n\t\tElement xmlRoot = doc.getDocumentElement();\n\n\t\troot = new Node();\n\t\twalk(xmlRoot, root);\n\t}", "public void encodeTree(){\n StringBuilder builder = new StringBuilder();\n encodeTreeHelper(root,builder);\n }", "void createTree() throws IOException {\n\n // create root\n rootTreeItem = createTreeRoot();\n\n // create tree structure recursively\n createTree(rootTreeItem);\n\n // sort tree structure by name\n rootTreeItem.getChildren()\n .sort(Comparator.comparing(new Function<TreeItem<FilePath>, String>() {\n @Override\n public String apply(TreeItem<FilePath> t) {\n return t.getValue().toString().toLowerCase();\n }\n }));\n\n }", "private void createDOMTree(){\n\t\tElement rootEle = dom.createElement(\"Personnel\");\n\t\tdom.appendChild(rootEle);\n\n\t\t//No enhanced for\n\t\tIterator it = user.iterator();\n\t\twhile(it.hasNext()) {\n\t\t\tUserInformation b = (UserInformation)it.next();\n\t\t\t//For each Book object create element and attach it to root\n\t\t\tElement bookEle = createUserElement(b);\n\t\t\trootEle.appendChild(bookEle);\n\t\t}\n\t}", "protected void buildTree(JSONArray level, TreeNode relativeRoot){\n\t\tint elements = level.size();\n\t\tJSONObject split;\n\t\tJSONArray sub_trees;\n\t\tfor(int node = 0; node < elements; node++){\n\t\t\tTreeNode create = new TreeNode();\n\t\t\tsplit = (JSONObject)(level.get(node));\n\t\t\tcreate.type = (String)split.get(\"type\");\n\t\t\tcreate.attribute = (String)split.get(\"attribute\");\n\t\t\tcreate.operator = (String)split.get(\"operator\");\n\t\t\tif(create.type.compareTo(\"node\") == 0){\n\t\t\t\tcreate.nom_value = (String)split.get(\"value\");\n\t\t\t\tcreate.children = null;\n\t\t\t\trelativeRoot.children.add(create);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tif(create.type.compareTo(\"nominal\") == 0)\n\t\t\t\tcreate.nom_value = (String)split.get(\"value\");\n\t\t\telse if(create.type.compareTo(\"numerical\") == 0)\n\t\t\t\tcreate.num_value = Double.parseDouble((String)split.get(\"value\"));\n\t\t\t\n\t\t\tsub_trees = (JSONArray)split.get(\"subtree\");\n\t\t\tbuildTree(sub_trees,create);\n\t\t\trelativeRoot.children.add(create);\n\t\t}\n\t}", "void createBST(Node rootnode){ \n \n //Insert data into new bst, and then pass next nodes so they can be inserted. \n tree.insertNode(tree.ROOT, rootnode.data);\n \n if(rootnode.left != null){\n createBST(rootnode.left);\n }\n \n if(rootnode.right != null){\n createBST(rootnode.right);\n } \n }", "public List<TreeNode> getChildrenNodes();", "public static Node constructTree() {\n\n Node node2 = new Node(2, null, null);\n Node node8 = new Node(8, null, null);\n Node node12 = new Node(12, null, null);\n Node node17 = new Node(17, null, null);\n\n Node node6 = new Node(6, node2, node8);\n Node node15 = new Node(15, node12, node17);\n\n //Root Node\n Node node10 = new Node(10, node6, node15);\n\n return node10;\n }", "private List<Node> returnAllNodes(Node node) {\n List<Node> listOfNodes = new ArrayList<Node>();\n if (node != null) {\n listOfNodes.add(node);\n for (int i = 0; i < listOfNodes.size(); ++i) {\n Node n = listOfNodes.get(i);\n List<Node> children = n.children;\n if (children != null) {\n for (Node child : children) {\n if (!listOfNodes.contains(child)) {\n listOfNodes.add(child);\n }\n }\n }\n }\n }\n return listOfNodes;\n }", "private AbstractJSObject createNodeWrapper(Node node) {\n return new XmlNodeWrapper(node);\n }", "@SuppressWarnings(\"unchecked\")\n protected synchronized T newChild() {\n try {\n T t = ((Class<T>)getClass()).newInstance();\n t.isRootNode = false;\n \n if( ! isRootNode ) {\n if( children == null ) children = new ArrayList<T>();\n children.add( t );\n }\n \n return t;\n } catch( Exception ex ) {\n throw new RuntimeException(ex);\n }\n }", "public static ArrayList<Node> getAllChildren(Node node) {\r\n ArrayList<Node> list = new ArrayList<Node>();\r\n if (node == null)\r\n return list;\r\n\r\n for (Node child = node.getFirstChild(); child != null; child = child.getNextSibling()) {\r\n list.add(child);\r\n }\r\n\r\n return list;\r\n }", "public void createNode()\r\n\t{\r\n\t\tTreeNode first=new TreeNode(1);\r\n\t\tTreeNode second=new TreeNode(2);\r\n\t\tTreeNode third=new TreeNode(3);\r\n\t\tTreeNode fourth=new TreeNode(4);\r\n\t\tTreeNode fifth=new TreeNode(5);\r\n\t\tTreeNode sixth=new TreeNode(6);\r\n\t\tTreeNode seventh=new TreeNode(7);\r\n\t\tTreeNode eight=new TreeNode(8);\r\n\t\tTreeNode nine=new TreeNode(9);\r\n\t\troot=first;\r\n\t\tfirst.left=second;\r\n\t\tfirst.right=third;\r\n\t\tsecond.left=fourth;\r\n\t\tthird.left=fifth;\r\n\t\tthird.right=sixth;\r\n\t\tfifth.left=seventh;\r\n\t\tseventh.right=eight;\r\n\t\teight.left=nine;\r\n\t\t\r\n\t}", "void makeTree()\n \t{\n \t\t\t \n \t\tobj.insert(5,\"spandu\");\n \tobj.insert(4,\"anshu\");\n \tobj.insert(3,\"anu\");\n \tobj.insert(6,\"himani\");\n \t\t\n \t}", "protected void createTree() {\n\n\t\tint nextPlayer = opponent;\n\n\t\tQueue<Node> treeQueue = new LinkedList<Node>();\n\t\tWinChecker winCheck = new WinChecker();\n\n\t\ttreeQueue.add(parent);\n\n\t\twhile (!treeQueue.isEmpty()) {\n\t\t\tNode currentNode = treeQueue.poll();\n\n\t\t\tif (currentNode.getMove().Row != -1\n\t\t\t\t\t&& currentNode.getMove().Col != -1) {\n\t\t\t\tgb.updateBoard(currentNode.getMove());\n\n\t\t\t\tif (winCheck.getWin(gb) >= 0) {\n\t\t\t\t\tgb.revertBoard(currentNode.getMove());\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tgb.revertBoard(currentNode.getMove());\n\t\t\t}\n\n\t\t\t// Restricting the depth to which we will create the tree\n\t\t\tif (currentNode.getPly() > 2) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tfor (List<Hexagon> tempList : this.gb.getBoard()) {\n\t\t\t\tfor (Hexagon tempHex : tempList) {\n\n\t\t\t\t\tif (tempHex == null) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (tempHex.getValue() == EMPTY) {\n\n\t\t\t\t\t\tif (currentNode.getPly() % 2 == 0) {\n\t\t\t\t\t\t\tnextPlayer = opponent;\n\t\t\t\t\t\t} else if (currentNode.getPly() % 2 == 1) {\n\t\t\t\t\t\t\tnextPlayer = player;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tMove nextMove = new Move(nextPlayer, false,\n\t\t\t\t\t\t\t\ttempHex.getRow(), tempHex.getColumn());\n\n\t\t\t\t\t\tNode newNode = new Node(currentNode.getPly() + 1,\n\t\t\t\t\t\t\t\tnextMove);\n\t\t\t\t\t\tnewNode.setParent(currentNode);\n\n\t\t\t\t\t\tcurrentNode.children.add(newNode);\n\n\t\t\t\t\t\ttreeQueue.add(newNode);\n\t\t\t\t\t\ttempHex.setValue(EMPTY);\n\t\t\t\t\t}// End of if statement\n\n\t\t\t\t}// End of inner ForLoop\n\t\t\t}// End of outer ForLoop\n\n\t\t\t// currentNode.printChildren();\n\n\t\t}// End of While Loop\n\n\t}", "@Override\n\tpublic Set<HtmlTag> getChildren()\n\t{\n\t\tImmutableSet.Builder<HtmlTag> childrenBuilder = ImmutableSet.builder();\n\t\tfor(TreeNode<? extends HtmlTag> child : node.getChildren())\n\t\t{\n\t\t\tchildrenBuilder.add(child.getValue());\n\t\t}\n\t\treturn childrenBuilder.build();\n\t}", "public HtmlTree(DefaultMutableTreeNode root)\n {\n setRoot(root);\n }", "public String generateXML() \n { \n \n String xml = new String();\n \n String nodetype = new String();\n if (type.equals(\"internal\")){\n nodetype = \"INTERNAL\"; //change this for change in XML node name\n }\n else {\n nodetype = \"LEAF\"; //change this for change in XML node name\n }\n \n xml = \"<\" + nodetype;\n if (!name.equals(\"\")){\n xml = xml + \" name = \\\"\" + name + \"\\\"\";\n }\n if (length >0){\n xml = xml + \" length = \\\"\" + length + \"\\\"\";\n }\n //Section below tests tree size and depths\n // if (level > 0){\n // xml = xml + \" level = \\\"\" + level + \"\\\"\";\n // }\n //if (depth > 0){\n // xml = xml + \" depth = \\\"\" + depth + \"\\\"\";\n //}\n //if (newicklength > 0){\n // xml = xml + \" newicklength = \\\"\" + newicklength + \"\\\"\";\n //}\n // if (treesize > 0){\n // xml = xml + \" treesize = \\\"\" + treesize + \"\\\"\";\n //}\n //if (startxcoord >= 0){\n // xml = xml + \" startx = \\\"\" + startxcoord + \"\\\"\";\n //}\n //if (endxcoord >= 0){\n // xml = xml + \" endx = \\\"\" + endxcoord + \"\\\"\";\n //}\n //Test section done\n xml = xml + \">\";\n \n if (!children.isEmpty()){ //if there are children in this node's arraylist\n Iterator it = children.iterator();\n while(it.hasNext()){\n Node child = (Node) it.next();\n xml = xml + child.generateXML(); //The recursive coolness happens here!\n }\n }\n xml = xml + \"</\" + nodetype + \">\";\n \n return xml;\n }", "public HtmlTree()\n {\n // do nothing\n }", "public TreeNode encode(Node root) {\n if (root == null) return null;\n TreeNode node = new TreeNode(root.val);\n List<Node> children = root.children;\n TreeNode tmp = node;\n if (!children.isEmpty()) {\n for (int i = 0; i < children.size(); i++) {\n if (i == 0) {\n node.left = encode(children.get(0));\n tmp = node.left;\n } else {\n tmp.right = encode(children.get(i));\n tmp = tmp.right;\n }\n }\n }\n return node;\n }", "public Node( Item root ) {\r\n\t\t\tsuper( null, 0, INTERACTIVE, null );\r\n\t\t\tthis.root = root;\r\n\t\t\tthis.root.parent = this;\r\n\t\t\tthis.children = new Container( false );\r\n\t\t\tthis.children.parent = this;\r\n\t\t}", "public static Node createLargeTree() {\n final int dcCount = 2;\n final int rackCount = 6;\n final int snCount = 6;\n final int hdCount = 12;\n\n int id = 0;\n // root\n Node root = new Node();\n root.setName(\"root\");\n root.setId(id++);\n root.setType(Types.ROOT);\n root.setSelection(Selection.STRAW);\n // DC\n List<Node> dcs = new ArrayList<Node>();\n for (int i = 1; i <= dcCount; i++) {\n Node dc = new Node();\n dcs.add(dc);\n dc.setName(\"dc\" + i);\n dc.setId(id++);\n dc.setType(Types.DATA_CENTER);\n dc.setSelection(Selection.STRAW);\n dc.setParent(root);\n // racks\n List<Node> racks = new ArrayList<Node>();\n for (int j = 1; j <= rackCount; j++) {\n Node rack = new Node();\n racks.add(rack);\n rack.setName(dc.getName() + \"rack\" + j);\n rack.setId(id++);\n rack.setType(StorageSystemTypes.RACK);\n rack.setSelection(Selection.STRAW);\n rack.setParent(dc);\n // storage nodes\n List<Node> sns = new ArrayList<Node>();\n for (int k = 1; k <= snCount; k++) {\n Node sn = new Node();\n sns.add(sn);\n sn.setName(rack.getName() + \"sn\" + k);\n sn.setId(id++);\n sn.setType(StorageSystemTypes.STORAGE_NODE);\n sn.setSelection(Selection.STRAW);\n sn.setParent(rack);\n // hds\n List<Node> hds = new ArrayList<Node>();\n for (int l = 1; l <= hdCount; l++) {\n Node hd = new Node();\n hds.add(hd);\n hd.setName(sn.getName() + \"hd\" + l);\n hd.setId(id++);\n hd.setType(StorageSystemTypes.DISK);\n hd.setWeight(100);\n hd.setParent(sn);\n }\n sn.setChildren(hds);\n }\n rack.setChildren(sns);\n }\n dc.setChildren(racks);\n }\n root.setChildren(dcs);\n return root;\n }", "public static Node[] initTree(int[] arr){\n int i;\n Node[] tree = new Node[n];\n Node node;\n for(i = 0; i < n; i++){\n node = new Node();\n node.data = arr[i];\n tree[i] = node;\n }\n tree[0].data = arr[0];\n tree[1].data = arr[1];\n tree[2].data = arr[2];\n tree[3].data = arr[3];\n tree[4].data = arr[4];\n tree[5].data = arr[5];\n tree[6].data = arr[6];\n\n tree[0].parent = null;\n tree[0].left = tree[1];\n tree[0].right = tree[2];\n\n tree[1].parent = tree[0];\n tree[1].left = null;\n tree[1].right = tree[3];\n\n tree[2].parent = tree[0];\n tree[2].left = tree[4];\n tree[2].right = null;\n \n tree[3].parent = tree[1];\n tree[3].left = null;\n tree[3].right = null;\n\n tree[4].parent = tree[2];\n tree[4].left = tree[5];\n tree[4].right = tree[6];\n\n tree[5].parent = tree[4];\n tree[5].left = null;\n tree[5].right = null;\n\n tree[6].parent = tree[4];\n tree[6].left = null;\n tree[6].right = null;\n\n root = tree[0];\n return tree; \n }", "public TreeNode() { \n this.name = \"\"; \n this.rule = new ArrayList<String>(); \n this.child = new ArrayList<TreeNode>(); \n this.datas = null; \n this.candAttr = null; \n }", "public static DocumentFragment extractChildren(final Node node, final boolean remove) throws DOMException {\n\t\treturn extractChildren(node, 0, node.getChildNodes().getLength(), remove); //extract all the children and return the new document fragment \n\t}", "private void addNodes(Node node) {\n\t\tif (node == null)\n\t\t\treturn;\n\n\t\taddNodes(node.left); // walk trough left sub-tree\n\t\tthis.child.add(node);\n\t\taddNodes(node.right); // walk trough right sub-tree\n\t}", "public static Treenode createBinaryTree() {\n\t\tTreenode rootnode = new Treenode(40);\r\n\t\tTreenode r40 = new Treenode(50);\r\n\t\tTreenode l40 = new Treenode(20);\r\n\t\tTreenode r50 = new Treenode(60);\r\n\t\tTreenode l50 = new Treenode(45);\r\n\t\tTreenode r20 = new Treenode(30);\r\n\t\tTreenode l20 = new Treenode(10);\r\n\t\trootnode.right = r40;\r\n\t\trootnode.left = l40;\r\n\t\tr40.right=r50;\r\n\t\tr40.left = l50;\r\n\t\tl40.right=r20;\r\n\t\tl40.left=l20;\r\n\t\t r40.parent=rootnode; l40.parent= rootnode;\r\n\t\t r50.parent=r40;\r\n\t\tl50.parent=r40 ;\r\n\t\t r20.parent=l40;\r\n\t\t l20.parent=l40 ;\r\n\t\treturn rootnode;\r\n\t\t\r\n\t}", "RootNode getRootNode();", "public TreeNode cloneTree(TreeNode root) {\n if (root == null) {\n return null;\n }\n res = new TreeNode(root.val);\n res.left = helper(res.left, root.left);\n res.right = helper(res.right, root.right);\n return res;\n }", "public static Document createDocument( StringNode root )\r\n\t\tthrows ParserConfigurationException\r\n\t{\r\n \tDocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();\r\n DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();\r\n Document doc = docBuilder.newDocument();\r\n String name = root.getName();\r\n Element element = doc.createElement( name );\r\n doc.appendChild( element );\r\n addElement( doc, element, root );\r\n return doc;\r\n\t}", "public static TreeNode getBasicTree(){\n TreeNode one = new TreeNode(1);\n TreeNode two = new TreeNode(2);\n TreeNode three = new TreeNode(3);\n TreeNode four = new TreeNode(4);\n TreeNode five = new TreeNode(5);\n TreeNode six = new TreeNode(6);\n TreeNode seven = new TreeNode(7);\n\n one.left = two;\n one.right = three;\n two.left = four;\n two.right = five;\n four.left = six;\n four.right = seven;\n\n return one;\n }", "private void addSubnodes( Element root, String node_name ) {\r\n\t\t// element elements\r\n\t\tElement element = doc.createElement( node_name );\r\n\t\troot.appendChild( element );\r\n\r\n\t\t// set attributes to element\r\n\t\twhile ( Inputs.confirm( \"¿Añadir un atributo?\" )) {\r\n\r\n\t\t\taddAttr( element );\r\n\t\t}\r\n\r\n\r\n\t\tint num = Inputs.getInt( \"¿Cuántos sub-elementos tiene <\" + node_name + \">?\" );\r\n\r\n\t\tfor ( int i = 0; i < num; i++ ) {\r\n\r\n\t\t\taddSubnodes( element, ( i + 1 ));\r\n\t\t}\r\n\t}", "DocumentRoot createDocumentRoot();", "DocumentRoot createDocumentRoot();", "DocumentRoot createDocumentRoot();", "DocumentRoot createDocumentRoot();", "public Node[] getChildren(){return children;}", "TreeNode(){\n this.elem = null;\n this.left = null;\n this.right = null;\n }", "public JdbTree(TreeNode root, boolean asksAllowsChildren) {\r\n this(new DefaultTreeModel(root, asksAllowsChildren));\r\n }", "public Node makeNode(Document xmlDoc) {\r\n Element out = xmlDoc.createElement(this.parent.getHeader());\r\n this.parent.updateSave();\r\n if (this.nodeText != null) {\r\n out.setTextContent(nodeText);\r\n }\r\n this.makeAtributes(out);\r\n for (int i = 0; i < this.children.size(); i++) {\r\n out.appendChild(this.children.get(i).makeNode(xmlDoc));\r\n }\r\n return out;\r\n}", "public void createBinaryTree()\r\n\t{\n\t\t\r\n\t\tNode node = new Node(1);\r\n\t\tnode.left = new Node(2);\r\n\t\tnode.right = new Node(3);\r\n\t\tnode.left.left = new Node(4);\r\n\t\tnode.left.right = new Node(5);\r\n\t\tnode.left.right.right = new Node(10);\r\n\t\tnode.left.left.left = new Node(8);\r\n\t\tnode.left.left.left.right = new Node(15);\r\n\t\tnode.left.left.left.right.left = new Node(17);\r\n\t\tnode.left.left.left.right.left.left = new Node(18);\r\n\t\tnode.left.left.left.right.right = new Node(16);\r\n\t\tnode.left.left.right = new Node(9);\r\n\t\tnode.right.left = new Node(6);\r\n\t\tnode.right.left.left = new Node(13);\r\n\t\tnode.right.left.left.left = new Node(14);\r\n\t\tnode.right.right = new Node(7);\r\n\t\tnode.right.right.right = new Node(11);\r\n\t\tnode.right.right.right.right = new Node(12);\r\n\t\troot = node;\r\n\t\t\r\n\t}", "private void insertNodeIntoTree(Node node) {\n\t\troot = insert(root,node);\t\n\t}", "private void initSubNodes()\n {\n children = createSubNodes(false);\n attributes = createSubNodes(true);\n }", "@Test\n public void whenAddNodesOnDifferentLevelsThenResultThreeNodeFromBottomToTop() {\n tree.addChild(nodeOne, \"1\");\n nodeOne.addChild(nodeTwo, \"2\");\n nodeTwo.addChild(nodeThree, \"3\");\n assertThat(tree.getChildren().toString(), is(\"[3, 2, 1]\"));\n }", "private static void createTree(TreeItem<FilePath> rootItem) throws IOException {\n\n try (DirectoryStream<Path> directoryStream = Files\n .newDirectoryStream(rootItem.getValue().getPath())) {\n\n for (Path path : directoryStream) {\n TreeItem<FilePath> newItem = new TreeItem<FilePath>(new FilePath(path));\n newItem.setExpanded(true);\n\n rootItem.getChildren().add(newItem);\n\n if (Files.isDirectory(path)) {\n createTree(newItem);\n }\n }\n } catch (AccessDeniedException ignored) {\n } catch (Exception ex) {\n ex.printStackTrace();\n }\n }", "public TreeNodeImpl(@NonNull List<NodeData> children) {\n mChildren = new ArrayList<>(children.size());\n for (NodeData child : children) {\n TreeNodeImpl childNode = new TreeNodeImpl(child);\n childNode.mParent = this;\n mChildren.add(childNode);\n }\n }", "public TreeBuilder() {\n\t\troot = null;\n\t}", "private static Node buildSmallerTree() {\n\t\tNode root = createNode(10);\n\t\troot.leftChild = createNode(25);\n\t\troot.rightChild = createNode(25);\n\t\troot.leftChild.leftChild = createNode(13);\n\t\troot.rightChild.rightChild = createNode(7);\n\t\troot.leftChild.rightChild = createNode(27);\n\t\t\n\t\treturn root;\n\t}", "public List<TreeNode> generateTrees(int n) {\n if(n==0) return new ArrayList<TreeNode>();\n return generate(1, n);\n }", "@Test\n public void whenAddNodesOnOneLevelThenResultThreeNodesInLine() {\n tree.addChild(nodeOne, \"1\");\n tree.addChild(nodeTwo, \"2\");\n tree.addChild(nodeThree, \"3\");\n assertThat(tree.getChildren().toString(), is(\"[1, 2, 3]\"));\n }", "private List<SimpleNode> getChildren(SimpleNode node) {\n Class<?> nodeType = node.getClass();\n List<SimpleNode> children = new ArrayList<>();\n for (int i = 0; i < node.jjtGetNumChildren(); i++) {\n children.addAll(flatten(node.jjtGetChild(i), nodeType));\n }\n return children;\n }", "public static INode createRootNode(INode node) {\n String type = node.getClass().getSimpleName();\n INode rootNode = createNode(type, node.getLabel(), IntegerOIDGenerator.getNextOID());\n rootNode.setRoot(true);\n return rootNode;\n }", "private void copy(Node node){\n parent_ = node.parent_;\n size_ = node.size_;\n for(int i = 0; i < size_; i++)\n children_[i] = node.children_[i];\n }", "private static TreeNode getNode() {\n TreeNode treeNode = new TreeNode(1);\n TreeNode left = new TreeNode(2);\n TreeNode right = new TreeNode(3);\n treeNode.left = left;\n treeNode.right = right;\n\n left.left = new TreeNode(4);\n right.left = new TreeNode(5);\n right.right = new TreeNode(6);\n return treeNode;\n }", "public Node()\n {\n this.name=\"/\";\n this.type=0;\n this.stage=0;\n children=new ArrayList<Node>();\n }", "public MutableMatrixTreeNode<E> buildTree() {\n\t\t// use parental relations to build the tree by directly inserting each child into it's parents\n\t\tfor (MutableMatrixTreeNode<E> node : nodeMap.values()) {\n\t\t\tPathMatrix key = node.getPathMatrix();\n\n\t\t\tif (!key.isRoot()) {\n\t\t\t\tPathMatrix parentKey = key.computeParentMatrix();\n\n\t\t\t\tMutableMatrixTreeNode<E> parentNode = nodeMap.get(parentKey);\n\t\t\t\tparentNode.insert(node);\n\t\t\t}\n\t\t}\n\n\t\t// get root\n\t\tPathMatrix firstKey = nodeMap.keySet().iterator().next();\n\t\treturn (MutableMatrixTreeNode<E>) nodeMap.get(firstKey).visitTopNode();\n\t}", "TNode createTNode();", "private void constructBSTree(Node<T> u, int n, String lr) {\n\t\tn++;\n\t\taddToPT(n, lr + \" \" + u.x.toString());\n\t\telements.add(u.x);\n\t\tif (u.left != nil)\n\t\t\tconstructBSTree(u.left, n, lr + \"L\");\n\t\tif (u.right != nil)\n\t\t\tconstructBSTree(u.right, n, lr + \"R\");\n\t}", "private <X extends Jgxx> X buildTree(X root) {\n\t\tList<X> list = this.extendedModelProvider.find(EXTEND_MODEL_XTGL_ZHGL_JGXX_CODE, Jgxx.class, SELECT_PRE_SQL + \" WHERE J.LFT BETWEEN ? AND ? AND J.DELETED = 0 ORDER BY J.LFT\",\n\t\t\t\troot.getLft(), root.getRgt());\n\t\tStack<X> rightStack = new Stack<X>();\n\t\tfor (X node : list) {\n\t\t\tif (!rightStack.isEmpty()) {\n\t\t\t\twhile (rightStack.lastElement().getRgt() < node.getRgt()) {\n\t\t\t\t\trightStack.pop();\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!rightStack.isEmpty()) {\n\t\t\t\trightStack.lastElement().addChild(node);\n\t\t\t}\n\t\t\trightStack.push(node);\n\t\t}\n\t\treturn rightStack.firstElement();\n\t}", "public static void createNode (PsiDirectory parentDirectory, VNode vNode) throws IOException {\r\n\t\tString name = mungeNamespace(vNode.getName());\r\n\t\tPsiDirectory contentDirectory = parentDirectory.createSubdirectory(name);\r\n\t\tPsiFile contentFile = contentDirectory.createFile(\".content.xml\");\r\n\t\twriteNodeContent(contentFile, vNode);\r\n\t}", "public static GraphNode createScene( GraphNode parent, Node dataNode ) {\r\n NodeList nodeList = dataNode.getChildNodes();\r\n for ( int i = 0; i < nodeList.getLength(); i++ ) {\r\n Node n = nodeList.item(i);\r\n // skip all text, just process the ELEMENT_NODEs\r\n if ( n.getNodeType() != Node.ELEMENT_NODE ) continue;\r\n String nodeName = n.getNodeName();\r\n GraphNode node = null;\r\n if ( nodeName.equalsIgnoreCase( \"node\" ) ) {\r\n \tnode = CharacterFromXML.createJoint( n );\r\n } else if ( nodeName.equalsIgnoreCase( \"geom\" ) ) { \t\t\r\n \t\tnode = CharacterFromXML.createGeom( n ) ; \r\n }\r\n // recurse to load any children of this node\r\n createScene( node, n );\r\n if ( parent == null ) {\r\n \t// if no parent, we can only have one root... ignore other nodes at root level\r\n \treturn node;\r\n } else {\r\n \tparent.add( node );\r\n }\r\n }\r\n return null;\r\n\t}", "public void testBuildTreeDeepStructure() {\n TreeNode root = buildRootNodeFromFile(\"testWihManyLevels.js\");\n\n // Ensure the hierarchy is correct.\n assertEquals(\"suite1\", root.getNodeValue().getTestText());\n assertEquals(4, root.getChildCount());\n }", "public Tree() // constructor\n\t{ root = null; }", "private void fixTreeRecursive(WordTree<StructureTag> tree) {\n\t\tfixTree(tree);\n\t\tif(!tree.isLeaf()) {\n\t\t\tfor(WordTree<StructureTag> child : tree.getChildren()) {\n\t\t\t\tfixTreeRecursive(child);\n\t\t\t}\n\t\t}\n\t}" ]
[ "0.6184931", "0.59695494", "0.5966105", "0.5861369", "0.5858697", "0.58441556", "0.5748024", "0.5700039", "0.56777966", "0.5676726", "0.5672007", "0.56290334", "0.56283396", "0.5597781", "0.55926716", "0.55899805", "0.55898046", "0.55680436", "0.55585396", "0.5520924", "0.55061215", "0.5498442", "0.5491777", "0.5474729", "0.5467038", "0.54546076", "0.54522794", "0.54484904", "0.54448897", "0.5435259", "0.5435259", "0.5417481", "0.53973913", "0.5392045", "0.5391866", "0.5382548", "0.5377583", "0.53599644", "0.5356084", "0.5344889", "0.53417283", "0.5340132", "0.53312373", "0.5315282", "0.5309276", "0.52941126", "0.5287598", "0.5286138", "0.526649", "0.5257278", "0.5253115", "0.5252522", "0.52524173", "0.52510273", "0.524379", "0.5230074", "0.5226604", "0.5219807", "0.5205449", "0.5203339", "0.52032506", "0.51859844", "0.5183789", "0.51605344", "0.51603395", "0.5152785", "0.51521045", "0.51465774", "0.5136711", "0.5136711", "0.5136711", "0.5136711", "0.51264083", "0.51248324", "0.51244867", "0.511862", "0.51152647", "0.50983506", "0.5094878", "0.50894296", "0.50893396", "0.5078179", "0.5072789", "0.5059764", "0.50584996", "0.5045798", "0.50378877", "0.5036796", "0.5031388", "0.50305164", "0.5020998", "0.501964", "0.5013523", "0.50072324", "0.50060815", "0.50048023", "0.5004586", "0.5002098", "0.49976304", "0.4995647" ]
0.5611194
13
Created by Administrator on 2016/8/17.
@Singleton @Component(modules = {ApplicationModule.class, ApiModule.class}) public interface ApplicationComponent { Context getContext(); Bus getBus(); TRApi getTRApi(); void inject(ZhihuApplication zhihuApplication); void inject(BaseNewActivity baseNewActivity); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private stendhal() {\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "public final void mo51373a() {\n }", "@Override\n\tprotected void getExras() {\n\n\t}", "public void mo38117a() {\n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "public void mo4359a() {\n }", "@Override\n protected void initialize() {\n\n \n }", "private static void cajas() {\n\t\t\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n public void settings() {\n // TODO Auto-generated method stub\n \n }", "@Override\n protected void initialize() \n {\n \n }", "private Rekenhulp()\n\t{\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "Constructor() {\r\n\t\t \r\n\t }", "public contrustor(){\r\n\t}", "@Override\n public void init() {\n\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\n\tpublic void create () {\n\n\t}", "Petunia() {\r\n\t\t}", "private TMCourse() {\n\t}", "protected MetadataUGWD() {/* intentionally empty block */}", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void autoDetails() {\n\t\t\r\n\t}", "@Override\n\tpublic void create() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "public Pitonyak_09_02() {\r\n }", "@Override\n protected void getExras() {\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "public void mo55254a() {\n }", "public void mo6081a() {\n }", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "public void verarbeite() {\n\t\t\r\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n void init() {\n }", "private void init() {\n\n\t}", "@Override\n\tprotected void interr() {\n\t}", "public void create() {\n\t\t\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\n public void init() {\n }", "public void mo12930a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n public void init() {\n\n }", "@Override\n public void init() {\n\n }", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n\tpublic void create() {\n\n\t}", "protected void mo6255a() {\n }", "@Override\n protected void init() {\n }", "@Override\r\n\tpublic void create() {\n\r\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\n\tpublic void afterInit() {\n\t\t\n\t}", "@Override\n\tpublic void afterInit() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}" ]
[ "0.6260884", "0.61520237", "0.599272", "0.59604377", "0.5932152", "0.5916378", "0.59124744", "0.58399767", "0.58281064", "0.58281064", "0.5821685", "0.5820737", "0.5807117", "0.5807117", "0.57874644", "0.57770795", "0.5767323", "0.5745536", "0.5738269", "0.5728603", "0.57251143", "0.57209784", "0.566492", "0.56590754", "0.5655095", "0.5630778", "0.56273574", "0.56123656", "0.56123656", "0.56123656", "0.56123656", "0.56123656", "0.56123656", "0.56123656", "0.5604537", "0.5602765", "0.55980533", "0.5596422", "0.5593774", "0.55925196", "0.5566203", "0.55618423", "0.5552916", "0.5551013", "0.55443984", "0.55443984", "0.55443984", "0.55443984", "0.55443984", "0.55443984", "0.5540931", "0.55406606", "0.5538195", "0.5532154", "0.55317104", "0.55310035", "0.55273926", "0.55265355", "0.55265355", "0.55171484", "0.55147344", "0.5505307", "0.5486966", "0.5483522", "0.5483522", "0.5483522", "0.5483522", "0.5483522", "0.5477681", "0.54669785", "0.5462196", "0.5461849", "0.54508835", "0.5445018", "0.54447806", "0.54436713", "0.5441073", "0.5437052", "0.54322076", "0.54299796", "0.54299796", "0.54299796", "0.54298663", "0.54281634", "0.54245204", "0.5424192", "0.5424192", "0.5424192", "0.5417076", "0.5417076", "0.54091614", "0.5404876", "0.54010206", "0.53986967", "0.53963315", "0.5395259", "0.53943646", "0.53943646", "0.53896934", "0.5389317", "0.5389317" ]
0.0
-1
Send event message with arbitrary message header
boolean sendEventMessage(Event<T> event, Map<String, Object> messageHeaderMap) { T entity = event.getData(); validateEventEntity(entity); String entityId = getEntityIdAsString(entity); String eventInfo = String.format("%s %s(id=%s)", event.getAction(), entityType, entityId); log.debug("Sending {} event message.", eventInfo); Message<Event<T>> message = MessageBuilder.withPayload(event) .setHeader(MessageHeaders.CONTENT_TYPE, MimeTypeUtils.APPLICATION_JSON) .setHeader(KafkaHeaders.MESSAGE_KEY, entityId.getBytes()) .copyHeaders(messageHeaderMap) .build(); boolean isSent = messageChannel.send(message); if (isSent) { log.debug("{} event message is sent successfully.", eventInfo); return true; } else { String errorMessage = String.format("Unable to send %s event message.", eventInfo); log.error(errorMessage); throw new MessageDeliveryException(errorMessage); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void sendEvent(Event event);", "public void addMessage(EventMessage message) {\n }", "public void send(EventStore es, Template template);", "@Override\n public void publish(Event<? extends Enum, ?> event) {\n byte[] body = null;\n if (null == event) {\n log.error(\"Captured event is null...\");\n return;\n }\n if (event instanceof DeviceEvent) {\n body = bytesOf(MQUtil.json((DeviceEvent) event));\n } else if (event instanceof TopologyEvent) {\n body = bytesOf(MQUtil.json((TopologyEvent) event));\n } else if (event instanceof LinkEvent) {\n body = bytesOf(MQUtil.json((LinkEvent) event));\n } else {\n log.error(\"Invalid event: '{}'\", event);\n return;\n }\n processAndPublishMessage(body);\n }", "public String buildMessage(Event event, Object[] params);", "@Override\n\tpublic void ActOnNotification(String message) {\n\t \tSystem.out.println(\"Sending Event\");\n\t}", "public void testSendMessageEventRequest() {\n // Create a chat for each connection\n Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null);\n\n // Create the message to send with the roster\n Message msg = new Message();\n msg.setSubject(\"Any subject you want\");\n msg.setBody(\"An interesting body comes here...\");\n // Add to the message all the notifications requests (offline, delivered, displayed,\n // composing)\n MessageEventManager.addNotificationsRequests(msg, true, true, true, true);\n\n // Send the message that contains the notifications request\n try {\n chat1.sendMessage(msg);\n } catch (Exception e) {\n fail(\"An error occured sending the message\");\n }\n }", "private static String formatSimple(ChannelHandlerContext ctx, String eventName, Object msg) {\n String chStr = getChStr(ctx);\n String msgStr = String.valueOf(msg);\n StringBuilder buf = new StringBuilder(chStr.length() + 1 + eventName.length() + 2 + msgStr.length());\n return buf.append(chStr).append(' ').append(eventName).append(\": \").append(msgStr).toString();\n }", "private void sendEventToServer() throws UnknownHostException, IOException {\n \t\t\n \t\tSocket socket = null; \n \t\t\n \t\tsocket = new Socket(Constants.ServerIp, Constants.Port);\n \t\t\n \t\tObjectOutputStream serializer = null;\n \t\t\n \t\tserializer = new ObjectOutputStream(socket.getOutputStream());\n \t\t//TODO: Send a message to server for new Event\n \t\t\n \t\tMessageType t = MessageType.newPubEventMessage;\n \t\tserializer.writeObject(t);\n \t\tserializer.writeObject(event);\n \t\tserializer.flush();\n \t\t//TODO: Send the event\n \t\t//TODO: Send to Pending Screen\n \t}", "private void sendMessage() {\n Log.d(\"sender\", \"Broadcasting message\");\n Intent intent = new Intent(\"custom-event-name\");\n // You can also include some extra data.\n double[] destinationArray = {getDestination().latitude,getDestination().longitude};\n intent.putExtra(\"destination\", destinationArray);\n LocalBroadcastManager.getInstance(this).sendBroadcast(intent);\n }", "public void send(Object object, MediaType mediaType)\n/* */ throws IOException\n/* */ {\n/* 106 */ if (object != null) {\n/* 107 */ send(event().data(object, mediaType));\n/* */ }\n/* */ }", "@Override\n\tpublic void messageSent(IoSession arg0, Object arg1) throws Exception {\n\n\t}", "@Override\n\tpublic void messageSent(IoSession arg0, Object arg1) throws Exception {\n\n\t}", "public void pipeMsgEvent ( PipeMsgEvent event ){\r\n\t// Get the message object from the event object\r\n\tMessage msg=null;\r\n\ttry {\r\n\t msg = event.getMessage();\r\n\t if (msg == null)\r\n\t\treturn;\r\n\t} \r\n\tcatch (Exception e) {\r\n\t e.printStackTrace();\r\n\t return;\r\n\t}\r\n\t\r\n\t// Get the String message element by specifying the element tag\r\n\tMessageElement newMessage = msg.getMessageElement(TAG);\r\n\tif (newMessage == null)\t\t\t\r\n\t System.out.println(\"null msg received\");\r\n\telse\r\n\t System.out.println(\"Received message: \" + newMessage);\r\n }", "public void dataSent(LLRPDataSentEvent event);", "public void setSendEvent(EventOccurrence sendEvent);", "public void emit(String event, JsonObject jsonObject) {\n//\t\tif (ev == 'newListener') {\n//\t\t\treturn this.$emit.apply(this, arguments);\n//\t\t}\n\n\t\tJsonObject packet = new JsonObject();\n\t\tpacket.putString(\"type\", \"event\");\n\t\tpacket.putString(\"name\", event);\n\n//\t\tif ('function' == typeof lastArg) {\n//\t\t\tpacket.id = ++this.ackPackets;\n//\t\t\tpacket.ack = lastArg.length ? 'data' : true;\n//\t\t\tthis.acks[packet.id] = lastArg;\n//\t\t\targs = args.slice(0, args.length - 1);\n//\t\t}\n\t\tif(jsonObject != null) {\n\t\t\tJsonArray args = new JsonArray();\n\t\t\targs.addObject(jsonObject);\n\t\t\tpacket.putArray(\"args\", args);\n\t\t}\n\t\tthis.packet(packet);\n\t}", "public void logOobMessage( PeerInfo client, PeerInfo server, Message message, long eventTS );", "void dispatchEvent(DistributedEvent event);", "void message(String response, GameChatEvent cause) throws InterruptedException, IOException;", "public void send(Message msg);", "void sendCommand(CommandEvent event);", "public void sendMsg(String address, String title, String content);", "private void sendCustomMessage(String message, String alli) {\n String frontA = \"V\" + alli;\n String gobbleDeGuck = \"<ID 0><CLR><WIN 0 0 287 31><POS 0 0><SL><S S><BL N><CS 3><GRN><T>\";\n String mid = message;\n String ender = \"</T>\";\n String sendableMsgString = frontA + gobbleDeGuck + mid + ender;\n //\n sendRawMessage(sendableMsgString);\n }", "@Test\n public void testDispatchEvent(){\n\n final SampleClass sample = new SampleClass();\n\n assertEquals(\"\", sample.getName());\n\n eventDispatcher.addSimulatorEventListener(new SimulatorEventListener(){\n\n public void onNewMessage(Exchange exchange, Conversation conversation) {\n sample.setName(\"Modified\");\n }\n\n public void onMatchingScenario(Exchange exchange, Conversation conversation) {\n\n }\n\n public void onResponseBuilt(Exchange exchange, Conversation conversation) {\n\n }\n\n public void onResponseSent(Exchange exchange, Conversation conversation) {\n \n }\n });\n\n eventDispatcher.dispatchEvent(SimulatorEventType.NEW_MESSAGE, null, null);\n\n assertEquals(\"Modified\",sample.getName());\n }", "private static String formatSimple(final ChannelHandlerContext ctx, final String eventName, final Object msg) {\n final String chStr = ctx.channel().toString();\n final String msgStr = String.valueOf(msg);\n final StringBuilder buf = new StringBuilder(chStr.length() + 1 + eventName.length() + 2 + msgStr.length());\n return buf.append(chStr).append(' ').append(eventName).append(\": \").append(msgStr).toString();\n }", "void messageSent(IMSession session, String messageId);", "public void sendMessage(String message) {}", "abstract void onMessage(byte[] message);", "@Override\n public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) {\n final Channel ch = e.getChannel();\n ChannelBuffer headerBuffer = ChannelBuffers.buffer(header.length());\n headerBuffer.writeBytes(header.getBytes());\n ChannelFuture f = ch.write(headerBuffer);\n f.addListener(ChannelFutureListener.CLOSE_ON_FAILURE);\n channelAtomicReference.set(ch);\n log.info(\"Input Stream {} : Channel Connected. Sent Header : {}\", name, header);\n }", "void sendMessage(int cycleCount, int index, int offset, long time)\n {\n Message msg = handler.obtainMessage(state, index, offset); //pos.offset);\n handler.sendMessage(msg);\n }", "@Override\n\tpublic void messageReceived(Message message) {\n\t\tappend(String.format(\"<%s> %s\",message.getSource().getName(),message.getMessage().toString()));\n\t}", "private void sendToMyself(ProxyEvent event) throws AppiaEventException {\n \t\ttry {\n \t\t\tProxyEvent clone = (ProxyEvent) event.cloneEvent();\n \t\t\tclone.storeMessage();\n \t\t\tclone.setDir(Direction.DOWN);\n \t\t\tclone.setChannel(vsChannel);\n \t\t\tclone.setSourceSession(this);\n \t\t\tclone.init();\n \n \t\t\tEchoEvent echo = new EchoEvent(clone, this.vsChannel, Direction.UP, this);\n \t\t\techo.init();\n \t\t\techo.go();\n \t\t} catch (CloneNotSupportedException e) {\n \t\t\te.printStackTrace();\n \t\t}\n \t}", "@Override\n public void onData(SocketIOClient client, Message data, AckRequest ackRequest) {\n data = new Message(\"hello i'm server\");\n //yuyuenamespace.getBroadcastOperations().sendEvent(\"message\", data);\n }", "Message buidMessage(CommandEvent event);", "public static void sendEvent(final ReactContext context, final String eventName, Object body) {\n if (context != null) {\n context\n .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)\n .emit(eventName, body);\n } else {\n Log.d(TAG, \"Missing context - cannot send event!\");\n }\n }", "private void sendConnectionMessage(EventMessage.EventType eventType) {\n EventMessage message = new EventMessage(eventType);\n EventBus.getDefault().post(message);\n }", "protected void writeHeaderMessage( String headerMessage ) {\r\n\t\tPrintWriter writer = new PrintWriter( outStream, true );\r\n\t\twriter.println( headerMessage );\r\n\t}", "@Override\r\n\tpublic void sendMessage(String message) {\n\t\t\r\n\t}", "public SendMessageEvent(SendThread _source, Socket _socket, Message _message) {\n source = _source; \n socket = _socket;\n message = _message;\n }", "public void sendMessage(String message);", "void onEvent (ZyniEvent event, Object ... params);", "public Event publish(Address resource, String event, int expires, Content body);", "void send(WebhookMessage msg);", "private <T extends QMessage> void sendTestMsg(T msg) {\n\n\t\ttry {\n\t\t\tString token = KeycloakUtils.getAccessToken(\"http://keycloak.genny.life\", \"genny\", \"genny\",\n\t\t\t\t\t\"056b73c1-7078-411d-80ec-87d41c55c3b4\", \"user1\", \"password1\");\n\t\t\tmsg.setToken(token);\n\n\t\t\t/* get the bridge url to publish the message to webcmd channel */\n\t\t\tString bridgetUrl = ENV_GENNY_BRIDGE_URL + \"/api/service?channel=webdata\";\n\n\t\t\tQwandaUtils.apiPostEntity(bridgetUrl, JsonUtils.toJson(msg), token);\n\n\t\t} catch (IOException e1) {\n\t\t\te1.printStackTrace();\n\t\t}\n\n\t}", "@Override\n public void send(String message) {\n\n out.println(message);\n out.flush();\n\n }", "public void sendRawMessage ( String message ) {\n\t\texecute ( handle -> handle.sendRawMessage ( message ) );\n\t}", "@Override\n\tpublic void send(DuDuMessage message, Object sessionToken) {\n\t\t\n\t}", "public MessageEvent(Message message) {\n super(message);\n this.message = message;\n }", "public void send(Opcode opcode);", "public EventMessage(Event event)\r\n {\r\n //super(\"EventMessage\");\r\n super(TYPE_IDENT, event);\r\n }", "private void send() {\n vertx.eventBus().publish(GeneratorConfigVerticle.ADDRESS, toJson());\n }", "public void send(String providedTopic,V msg);", "@Override\n protected String format(final ChannelHandlerContext ctx, final String eventName) {\n final String chStr = ctx.channel().toString();\n return new StringBuilder(chStr.length() + 1 + eventName.length()).append(chStr).append(' ').append(eventName)\n .toString();\n }", "public void onEvent(TCPReceiverThread receiverThread, Event event) throws IOException;", "public void setEventName(String name);", "void messageSent();", "public void sendEmployeeEvent(EmployeeEvent employeeEvent) throws JsonProcessingException {\n\n Integer key = employeeEvent.getEmpEventId();\n String value = objectMapper.writeValueAsString(employeeEvent);\n ListenableFuture<SendResult<Integer, String>> listenableFuture = kafkaTemplate.sendDefault(key, value); // sendDefault is of type Listenable future\n listenableFuture.addCallback(new ListenableFutureCallback<SendResult<Integer, String>>() { // Call back is of success and failure types\n @Override\n public void onFailure(Throwable e) {\n handleFailure(key, value, e);\n }\n\n @Override\n public void onSuccess(SendResult<Integer, String> result) { // Published message is successful\n handleSuccess(key, value, result);\n }\n });\n\n }", "private void sendStubEvent(StubEvent stubEvent, InetSocketAddress destination) throws AppiaEventException {\n \t\tstubEvent.storeMessage();\n \t\tstubEvent.setDir(Direction.DOWN);\n \t\tstubEvent.setChannel(listenChannel);\n \t\tstubEvent.setSourceSession(this);\n \t\tstubEvent.dest = destination;\n \t\tstubEvent.init();\n \t\tstubEvent.go();\n \t}", "void sendMessage(String msg);", "public void sendmsg(Message msg){\n try {\n oos.writeObject(new Datapacket(1, null, msg,null, null));\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "void send(String message);", "@Override\n public void send(final EventData data) {\n LOGGER.debug(\"async event {} sent via vert.x EventBus\", data.getData().ret$PQON());\n if (bus != null) {\n final EventParameters attribs = data.getData();\n if (attribs instanceof GenericEvent genericEvent) {\n bus.send(toBusAddress(genericEvent.getEventID()), data, ASYNC_EVENTBUS_DELIVERY_OPTIONS);\n } else {\n bus.send(toBusAddress(attribs.ret$PQON()), data, ASYNC_EVENTBUS_DELIVERY_OPTIONS);\n }\n } else {\n LOGGER.error(\"event bus is null - discarding event {}\", data.getData().ret$PQON());\n }\n }", "private void sendCastMessage(Video video)\n {\n Message msg = mHandler.obtainMessage();\n Bundle bundle = new Bundle();\n bundle.putSerializable(\"video\",video);\n msg.setData(bundle);\n msg.what = 2;\n mHandler.sendMessage(msg);\n }", "private void sendHelloMessage(String uName){\n HelloMessage hello = new HelloMessage(uName);\n ni.performSendHello(hello);\n Logger.log(\"Sending Hello to everyone \");\n\n }", "@EventName(\"receivedMessageFromTarget\")\n EventListener onReceivedMessageFromTarget(EventHandler<ReceivedMessageFromTarget> eventListener);", "public String getEventName();", "public void sendTextMessageViaHANBExample(String message) \n throws InstanceNotFoundException, MBeanException, ReflectionException;", "public void sendHearBeat() {\n try {\n JSONObject jsonObject = new JSONObject();\n jsonObject.put(\"type\", WsMessage.MessageType.HEART_BEAT_REQ);\n this.wsManager.sendMessage(WsMessage.MessageType.HEART_BEAT_REQ, jsonObject.toString());\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public interface MessageWriter {\n /**\n * Generic \"send\" method takes an EventStore, which is used to lookup stored variables\n * and a Template, which describes what to put in the message.\n * @param es The EventStore to use to lookup variables.\n * @param template The key/value pairs to send\n */\n\tpublic void send(EventStore es, Template template);\n}", "public void send(Opcode opcode, Serializable datum);", "@Override\n\tpublic void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {\n\t\tLog.i(\"userEventTriggered\", ((String) msg));\n\t\tsuper.write(ctx, msg, promise);\n\t}", "@Subscribe(threadMode = ThreadMode.MAIN)\n public void onMessageEvent(MessageEvent event) {\n btn.setText(event.Message);\n }", "boolean deliver(CommInfrastructure busType, String topic, Object event);", "public void messageReceived(OscMessage aMessage);", "void onMessage(String message) throws IOException;", "void mo23214a(Message message);", "void sendMessage(String msg) throws RpcException, StateMachineNotExpectedEventException;", "void sendMessage(String msg) throws RpcException, StateMachineNotExpectedEventException;", "void sendMessage(String msg) throws RpcException, StateMachineNotExpectedEventException;", "public void writeHL7Message(Message message);", "public void send(Message message) {\n\t\tthis.clockSer.addTS(this.localName);\n\t\t((TimeStampedMessage)message).setMsgTS(this.clockSer.getTs().makeCopy());\nSystem.out.println(\"TS add by 1\");\n\n\t\ttry {\n\t\t\tparseConfig();\n\t\t} catch (FileNotFoundException e) {\n\t\t\t// Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\tmessage.set_source(localName);\n\t\tmessage.set_seqNum(currSeqNum++);\n\t\t\t\t\n\t\tRule rule = null;\n\t\tif((rule = matchRule(message, RuleType.SEND)) != null) {\n\t\t\tif(rule.getAction().equals(\"drop\")) {\n\t\t\t\treturn ;\n\t\t\t}\n\t\t\telse if(rule.getAction().equals(\"duplicate\")) {\n\t\t\t\tMessage dupMsg = message.makeCopy();\n\t\t\t\tdupMsg.set_duplicate(true);\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t/* Send 'message' and 'dupMsg' */\n\t\t\t\tdoSend(message);\n\t\t\t\t/* update the timestamp */\n\t\t\t\tthis.clockSer.addTS(this.localName);\n\t\t\t\t((TimeStampedMessage)dupMsg).setMsgTS(this.clockSer.getTs().makeCopy());\nSystem.out.println(\"TS add by 1\");\n\t\t\t\tdoSend(dupMsg);\n\t\t\t\t\n\t\t\t\t/* We need to send delayed messages after new message.\n\t\t\t\t * This was clarified in Live session by Professor.\n\t\t\t\t */\n\t\t\t\tfor(Message m : delaySendQueue) {\n\t\t\t\t\tdoSend(m);\n\t\t\t\t}\n\t\t\t\tdelaySendQueue.clear();\n\n\t\t\t\t\n\t\t\t}\n\t\t\telse if(rule.getAction().equals(\"delay\")) {\n\t\t\t\tdelaySendQueue.add(message);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(\"We get a wierd message here!\");\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tdoSend(message);\n\t\t\t\n\t\t\t/* We need to send delayed messages after new message.\n\t\t\t * This was clarified in Live session by Professor.\n\t\t\t */\n\t\t\tfor(Message m : delaySendQueue) {\n\t\t\t\tdoSend(m);\n\t\t\t}\n\t\t\tdelaySendQueue.clear();\n\t\t}\n\t\t\n\t}", "public void send( MidiMessage message, long timeStamp ) {\n\t// Only accept CC messages (which are short messages)\n\tif ( message instanceof ShortMessage ) {\n\t ShortMessage shortMessage = (ShortMessage)message;\n\t // CC\n\t if ( shortMessage.getCommand() == 0xb0 ) {\n\t\thandleControlMessage( shortMessage.getData1(), shortMessage.getData2() );\n\t }\n\t}\n }", "public void onBattleMessage(BattleMessageEvent e) {\n//\t\tSystem.out.println(\"Msg> \" + e.getMessage());\n\t}", "private void send(byte[] message)\n\t\t\tthrows IOException\n\t{\n\t\tchannel.basicPublish(BUNGEECORD_QUEUE, \"\", null, message);\n\t}", "public void onLogMessage(String message);", "public final void event(final JSONObject builddata) {\n logger.fine(\"Sending event\");\n\n // Gather data\n JSONObject payload = new JSONObject();\n String hostname = nullSafeGetString(builddata, \"hostname\");\n String number = nullSafeGetString(builddata, \"number\");\n String buildurl = nullSafeGetString(builddata, \"buildurl\");\n String job = nullSafeGetString(builddata, \"job\");\n long timestamp = builddata.getLong(\"timestamp\");\n String message = \"\";\n\n // Setting source_type_name here, to allow modification based on type of event\n payload.put(\"source_type_name\", \"jenkins\");\n\n // Build title\n StringBuilder title = new StringBuilder();\n title.append(job).append(\" build #\").append(number);\n if ( \"SUCCESS\".equals( builddata.get(\"result\") ) ) {\n title.append(\" succeeded\");\n payload.put(\"alert_type\", \"success\");\n message = \"%%% \\n [See results for build #\" + number + \"](\" + buildurl + \") \";\n } else if ( builddata.get(\"result\") != null ) {\n title.append(\" failed\");\n payload.put(\"alert_type\", \"failure\");\n message = \"%%% \\n [See results for build #\" + number + \"](\" + buildurl + \") \";\n } else {\n title.append(\" started\");\n payload.put(\"alert_type\", \"info\");\n message = \"%%% \\n [Follow build #\" + number + \" progress](\" + buildurl + \") \";\n // Remove source_type_name to keep started events from being rolled up\n payload.remove(\"source_type_name\");\n }\n title.append(\" on \").append(hostname);\n\n // Add duration\n if ( builddata.get(\"duration\") != null ) {\n message = message + durationToString(builddata.getDouble(\"duration\"));\n }\n\n // Close markdown\n message = message + \" \\n %%%\";\n\n // Build payload\n payload.put(\"title\", title.toString());\n payload.put(\"text\", message);\n payload.put(\"date_happened\", timestamp);\n payload.put(\"event_type\", builddata.get(\"event_type\"));\n payload.put(\"host\", hostname);\n payload.put(\"result\", builddata.get(\"result\"));\n payload.put(\"tags\", assembleTags(builddata));\n payload.put(\"aggregation_key\", job); // Used for job name in event rollups\n\n post(payload, this.EVENT);\n }", "public void onBattleMessage(BattleMessageEvent e) {\n System.out.println(\"Msg> \" + e.getMessage());\n }", "public void sendPublicMessage(SensorMessage message) {\n \tpublicSender.send(message);\n }", "boolean deliver(CommInfrastructure busType, String topic, String event);", "public void sendEvent(int id, int arg) {\n\t\tgetWorld().addBlockEvent(getPos(), getWorld().getBlockState(getPos()).getBlock(), id, arg);\n\t}", "@Override\n public void sendMessage(Message<JsonPayload> message) throws IOException {\n System.out.println(\"Trying to send a message...\");\n outputMessageStream.write(message.getContent().getJson());\n outputMessageStream.newLine();\n outputMessageStream.flush();\n socket.shutdownOutput();\n }", "public abstract void message(String channel, String message);", "void sendMidi (byte[] msg, int offset, int count);", "void sendMessage(Message m) throws IOException {\n String msg = m.toString();\n\n buffer = msg.getBytes(\"Windows-1256\");\n toServer = new DatagramPacket(buffer, buffer.length,\n InetAddress.getByName(sendGroup), port);\n if (m.getType() == Message.DATA) {\n manager.mManager.addMessage(m);\n }\n\n System.out.println(getName() + \"-->\" + m);\n serverSocket.send(toServer);\n }", "protected void forward(IAnnounceEvent event){\r\n \t\ttry {\r\n \t\t\t_wrappedOut.write(event.getSerial());\r\n \t\t\t_output.writeASE(event.toSExp());\r\n \t\t} catch (IOException e) {\r\n \t\t\tSystem.err.println(\"Failed forwarding the message:\\n\"+event.toSExp()+\"\\nbecause: \"+e.getMessage());\r\n \t\t}\r\n \t}", "public void setEventMessage(String eventMessage) {\n this.eventMessage = eventMessage;\n }", "public void handleMessageEvent(StunMessageEvent e) {\n delegate.handleMessageEvent(e);\n }", "public void handleMessageEvent(StunMessageEvent e) {\n delegate.handleMessageEvent(e);\n }", "private byte[] execHandlerWrite( Message msg ) {\n\t\tbyte[] bytes = (byte[]) msg.obj;\n \tString data = mByteUtility.bytesToHexString( bytes ); \n\t\tlog_d( \"EventWrite \" + data );\n\t\treturn bytes;\n\t}" ]
[ "0.6640213", "0.6194478", "0.61526847", "0.6136581", "0.61360675", "0.60386807", "0.60233134", "0.600551", "0.5972319", "0.5952223", "0.59409493", "0.5937418", "0.5937418", "0.5927079", "0.58645123", "0.58231884", "0.57935447", "0.5780412", "0.57583624", "0.5741695", "0.57122594", "0.5704242", "0.56887025", "0.568298", "0.5666903", "0.5652705", "0.56493026", "0.56461155", "0.5634962", "0.5624225", "0.5609964", "0.5593826", "0.55930066", "0.5584014", "0.558308", "0.55829436", "0.5572919", "0.55720055", "0.5569744", "0.5568225", "0.5556548", "0.5548295", "0.5545653", "0.55357355", "0.5524895", "0.5508739", "0.5493993", "0.5491897", "0.54916155", "0.5490755", "0.54881746", "0.5485656", "0.54823977", "0.5480636", "0.5480498", "0.5473419", "0.5473051", "0.54717785", "0.54582465", "0.5456964", "0.54538", "0.5449283", "0.5445316", "0.54448676", "0.54377115", "0.5431893", "0.54317075", "0.5423866", "0.5420673", "0.5416286", "0.5413877", "0.5408352", "0.5407961", "0.5405096", "0.540277", "0.5394718", "0.5392929", "0.5392313", "0.5392313", "0.5392313", "0.53829366", "0.5378564", "0.5375793", "0.5370652", "0.53705406", "0.53654784", "0.5363857", "0.53558993", "0.53555334", "0.535331", "0.5347719", "0.53473616", "0.5347189", "0.53449005", "0.53410524", "0.5340837", "0.53376174", "0.5336173", "0.5336173", "0.53345865" ]
0.6158756
2
Manipulates the map once available. This callback is triggered when the map is ready to be used. This is where we can add markers or lines, add listeners or move the camera. In this case, we just add a marker near Sydney, Australia. If Google Play services is not installed on the device, the user will be prompted to install it inside the SupportMapFragment. This method will only be triggered once the user has installed Google Play services and returned to the app.
@Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; TypedValue tv = new TypedValue(); // move my location button down under toolbar if (getActivity().getTheme().resolveAttribute(R.attr.actionBarSize, tv, true)) { int actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data,getResources().getDisplayMetrics()); mMap.setPadding(0, actionBarHeight, 0, 0); } if (mParkedMarker != null) { mMap.animateCamera(CameraUpdateFactory.newLatLng(mParkedMarker.getPosition())); } else if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { mMap.setMyLocationEnabled(true); mFusedLocationClient = LocationServices.getFusedLocationProviderClient(getActivity()); mFusedLocationClient.getLastLocation() .addOnSuccessListener(getActivity(), new OnSuccessListener<Location>() { @Override public void onSuccess(Location location) { // Got last known location. In some rare situations this can be null. if (location != null) { LatLng myLocation = new LatLng(location.getLatitude(), location.getLongitude()); mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(myLocation, 15)); } } }); } else { Toast.makeText(getActivity(), "Don't have permission", Toast.LENGTH_LONG).show(); } mMap.setMaxZoomPreference(20); // Add a marker in Corvallis and move the camera LatLng corvallis = new LatLng(44.5646, -123.2620); mMap.setOnMapClickListener(this); mMap.setOnMapLongClickListener(this); mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(corvallis, 14)); TileProvider tileProvider = new SpotsTileProvider(getActivity()); mTileOverlay = mMap.addTileOverlay(new TileOverlayOptions().tileProvider(tileProvider)); mMap.setOnMyLocationButtonClickListener(this); mMap.setOnMyLocationClickListener(this); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void onMapReady(GoogleMap googleMap) {\n Geocoder geoCoder = new Geocoder(getActivity(), Locale.getDefault());\n double lat, lng;\n try {\n List<Address> addresses = geoCoder.getFromLocationName(\"Western Sydney Paramatta, NSW\", 5);\n lat = addresses.get(0).getLatitude();\n lng = addresses.get(0).getLongitude();\n } catch (Exception e) {\n lat = -34;\n lng = 151;\n }\n\n LatLng sydney = new LatLng(lat, lng);\n googleMap.addMarker(new MarkerOptions().position(sydney).title(\"WSU Paramatta\"));\n googleMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));\n if (ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n // TODO: Consider calling\n // ActivityCompat#requestPermissions\n // here to request the missing permissions, and then overriding\n // public void onRequestPermissionsResult(int requestCode, String[] permissions,\n // int[] grantResults)\n // to handle the case where the user grants the permission. See the documentation\n // for ActivityCompat#requestPermissions for more details.\n return;\n }\n googleMap.setMyLocationEnabled(true);\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n // Add a marker in Sydney, Australia, and move the camera.\n LatLng sydney = new LatLng(-34, 151);\n mMap.addMarker(new MarkerOptions().position(sydney).title(\"Marker in Sydney\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n // Add a marker in Sydney and move the camera\n LatLng sydney = new LatLng(17.2231, 78.2827);\n marker = mMap.addMarker(new MarkerOptions().position(sydney).title(\"Marker in Hyderbbad\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));\n initializeMap();\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION)\n == PackageManager.PERMISSION_GRANTED) {\n mMap.setMyLocationEnabled(true);\n } else {\n ActivityCompat.requestPermissions(this,new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION}, 1);\n }\n // Add a marker in Sydney and move the camera\n if (loc != -1 && loc != 0) {\n locationManager.removeUpdates(this);\n mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(MainActivity.locations.get(loc), 10));\n\n mMap.addMarker(new MarkerOptions().position(MainActivity.locations.get(loc)).title(MainActivity.places.get(loc)));\n } else {\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n // TODO: Consider calling\n // ActivityCompat#requestPermissions\n // here to request the missing permissions, and then overriding\n // public void onRequestPermissionsResult(int requestCode, String[] permissions,\n // int[] grantResults)\n // to handle the case where the user grants the permission. See the documentation\n // for ActivityCompat#requestPermissions for more details.\n return;\n }\n locationManager.requestLocationUpdates(provider, 400, 1, this);\n\n }\n mMap.setOnMapLongClickListener(this);\n }", "@SuppressLint(\"MissingPermission\")\n @Override\n public void onMapReady(GoogleMap googleMap) {\n Log.d(\"MAP_FRAG\", \"MapCallback\");\n\n mMap = googleMap;\n\n Log.d(\"MAP\", mMap.toString());\n\n mMap.setPadding(0, 0, 0, 300);\n\n mMap.setMyLocationEnabled(true);\n mMap.setTrafficEnabled(true);\n mMap.getUiSettings().setCompassEnabled(true);\n mMap.getUiSettings().setMyLocationButtonEnabled(false);\n mMap.getUiSettings().setMapToolbarEnabled(false);\n\n mMap.addMarker(new MarkerOptions().position(new LatLng(Common.latitude, Common.longitude))\n .icon(BitmapDescriptorFactory.fromResource(R.mipmap.ic_mark_red)));\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(Common.latitude, Common.longitude), 15.0f));\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n getMarkers();\n\n // Add a marker in Sydney and move the camera\n LatLng penn = new LatLng(39.952290, -75.197060);\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(penn, 15));\n mMap.setMyLocationEnabled(true);\n UiSettings uiSettings = mMap.getUiSettings();\n uiSettings.setZoomControlsEnabled(true);\n uiSettings.setCompassEnabled(true);\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n // Add a marker in Sydney and move the camera\n LatLng sydney = new LatLng(-34, 151);\n mMap.addMarker(new MarkerOptions().position(sydney).title(\"Marker in Sydney\")\n //below line is use to add custom marker on our map.\n .icon(BitmapFromVector(getApplicationContext(), R.drawable.ic_flag)));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mapReady = true;\n mMap = googleMap;\n // Add a marker in Sydney and move the camera\n LatLng Bangalore = new LatLng(12.972442, 77.580643);\n CameraPosition cameraPosition = new CameraPosition.Builder()\n .target(Bangalore)\n .zoom(17)\n .bearing(90)\n .tilt(30)\n .build();\n mMap.addMarker(new MarkerOptions().position(Bangalore).title(\"Marker in Bangalore\"));\n mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n // TODO: Consider calling\n // ActivityCompat#requestPermissions\n // here to request the missing permissions, and then overriding\n // public void onRequestPermissionsResult(int requestCode, String[] permissions,\n // int[] grantResults)\n // to handle the case where the user grants the permission. See the documentation\n // for ActivityCompat#requestPermissions for more details.\n return;\n }\n mMap.setMyLocationEnabled(true);\n mMap.setTrafficEnabled(true);\n mMap.setIndoorEnabled(true);\n mMap.setBuildingsEnabled(true);\n mMap.getUiSettings().setZoomControlsEnabled(true);\n\n // Add a marker in Sydney and move the camera\n LatLng sydney = new LatLng(43.777365,-79.3406);\n LatLng loc22=new LatLng(43.775748,-79.336674);\n LatLng loc3=new LatLng(43.769240,-79.360010);\n LatLng loc4=new LatLng(43.769290,-79.400101);\n LatLng loc5=new LatLng(43.769552,-79.601201);\n mMap.addMarker(new MarkerOptions().position(sydney).title(values[0]));\n mMap.addMarker(new MarkerOptions().position(loc22).title(values[1]));\n mMap.addMarker(new MarkerOptions().position(loc3).title(values[2]));\n mMap.addMarker(new MarkerOptions().position(loc4).title(values[3]));\n mMap.addMarker(new MarkerOptions().position(loc5).title(values[4]));\n\n //mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n LatLng position = new LatLng(latitude, longitude);\n\n // centre the map around the specified location\n mMap.animateCamera(CameraUpdateFactory.newLatLng(position));\n\n // add a marker at the specified location\n MarkerOptions options = new MarkerOptions();\n mMap.addMarker(options.position(position).title(locationName));\n\n // configure the map settings\n mMap.setTrafficEnabled(true);\n mMap.setBuildingsEnabled(true);\n mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);\n\n // enable the zoom controls\n mMap.getUiSettings().setZoomControlsEnabled(true);\n mMap.getUiSettings().setZoomGesturesEnabled(true);\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n if (ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n ActivityCompat.requestPermissions(getActivity(), new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, LOCATION_REQUEST_CODE);\n\n } else {\n buildGoogleApiClient();\n mMap.setMyLocationEnabled(true);\n }\n\n /* // Add a marker in Sydney and move the camera\n LatLng sydney = new LatLng(-34, 151);\n mMap.addMarker(new MarkerOptions().position(sydney).title(\"Marker in Sydney\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));*/\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n // Add a marker in city and move the camera\n LatLng cityCoord = new LatLng(lat, lng);\n float zoom = (float) 9.0;\n mMap.addMarker(new MarkerOptions().position(cityCoord).title(cityAddr));\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(cityCoord, zoom));\n }", "public static void onMapReady() {\n mMap.addMarker(new MarkerOptions().position(new LatLng(latitude, longitude)).title(\"My Home\").snippet(\"Home Address\"));\n // For zooming automatically to the Dropped PIN Location\n mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(latitude,\n longitude), 12.0f));\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n // Add a marker in Sydney, Australia,\n // and move the map's camera to the same location.\n LatLng singapore = new LatLng(1.338709, 103.819519);\n googleMap.addMarker(new MarkerOptions().position(singapore)\n .title(\"Marker in Singapore\"));\n googleMap.moveCamera(CameraUpdateFactory.newLatLng(singapore));\n googleMap.animateCamera(CameraUpdateFactory.zoomTo(11),3000,null);\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n // Add a marker in Sydney and move the camera\n\n\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n // Add a marker in Sydney and move the camera\n LatLng sydney = new LatLng(-34, 151);\n mMap.addMarker(new MarkerOptions().position(sydney).title(\"Marker in Sydney\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n // Add a marker in Sydney and move the camera\n LatLng sydney = new LatLng(-34, 151);\n mMap.addMarker(new MarkerOptions().position(sydney).title(\"Marker in Sydney\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n // Add a marker in Sydney and move the camera\n LatLng sydney = new LatLng(-34, 151);\n mMap.addMarker(new MarkerOptions().position(sydney).title(\"Marker in Sydney\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n // Add a marker in Sydney and move the camera\n LatLng sydney = new LatLng(-34, 151);\n mMap.addMarker(new MarkerOptions().position(sydney).title(\"Marker in Sydney\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n mMap.getUiSettings().setMyLocationButtonEnabled(true);\n\n if (ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED\n && ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n return;\n }\n mMap.setMyLocationEnabled(true);\n\n addMarkers();\n\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n\n // Add a marker in Sydney and move the camera\n LatLng sydney = new LatLng(-34, 151);\n marker = mMap.addMarker(new MarkerOptions().position(sydney).title(\"Marker in Sydney\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n // Add a marker in Sydney and move the camera\n LatLng place = new LatLng(Double.parseDouble(lat),Double.parseDouble(longitude));\n\n mMap.addMarker(new MarkerOptions().position(place));\n moveToCurrentLocation(place);\n\n }", "@Override\r\n public void onMapReady(GoogleMap googleMap) {\r\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {\r\n googleMap.setMyLocationEnabled(true);\r\n\r\n LocationManager locationManager = (LocationManager)\r\n getSystemService(Context.LOCATION_SERVICE);\r\n Criteria criteria = new Criteria();\r\n\r\n Location currentLocation = locationManager.getLastKnownLocation(locationManager.getBestProvider(criteria, false));\r\n\r\n LatLng sydney = new LatLng(currentLocation.getLatitude(), currentLocation.getLongitude());\r\n\r\n googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(sydney, 13));\r\n\r\n } else {\r\n PermissionUtils.requestPermission(this, LOCATION_PERMISSION_REQUEST_CODE, Manifest.permission.ACCESS_FINE_LOCATION, true);\r\n }\r\n\r\n updateMarkersData(googleMap);\r\n\r\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n CameraUpdate cUpdate = CameraUpdateFactory.newLatLngZoom(new LatLng(35.68, 139.76), 12);\n //mMap.addMarker(new MarkerOptions().position(new LatLng(35.68, 139.76)).title(\"Marker in Tokyo\"));\n mMap.moveCamera(cUpdate);\n if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n // TODO: Consider calling\n // ActivityCompat#requestPermissions\n // here to request the missing permissions, and then overriding\n // public void onRequestPermissionsResult(int requestCode, String[] permissions,\n // int[] grantResults)\n // to handle the case where the user grants the permission. See the documentation\n // for ActivityCompat#requestPermissions for more details.\n return;\n }\n mMap.setMyLocationEnabled(true);\n mMap.setTrafficEnabled(true);\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n // Add a marker in Sydney and move the camera\n LatLng wroclaw = new LatLng(51.110, 17.034);\n mMap.addMarker(new MarkerOptions().position(wroclaw));\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(wroclaw, 12));\n mMap.clear();\n // Setting a click event handler for the map\n mMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {\n\n @Override\n public void onMapClick(LatLng latLng) {\n bSelect.setEnabled(true);\n // Creating a marker\n MarkerOptions markerOptions = new MarkerOptions();\n\n // Setting the position for the marker\n markerOptions.position(latLng);\n\n // Setting the title for the marker.\n // This will be displayed on taping the marker\n markerOptions.title(\"NOWY: \" + latLng.latitude + \" : \" + latLng.longitude);\n\n markerOptions.alpha(0.6f);\n // Clears the previously touched position\n mMap.clear();\n\n // Animating to the touched position\n mMap.animateCamera(CameraUpdateFactory.newLatLng(latLng));\n\n // Placing a marker on the touched position\n mMap.addMarker(markerOptions);\n\n location = latLng.latitude + \" \" + latLng.longitude;\n\n setupMarker();\n }\n });\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n // Add a marker in Sydney and move the camera\n LatLng sydney = new LatLng(-34, 151);\n mMap.addMarker(new MarkerOptions().position(sydney).title(\"Marker in Sydney\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));\n mLocationRequest = LocationRequest.create()\n .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)\n .setInterval(1*1000)\n .setFastestInterval(5 * 100);\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)\n == PackageManager.PERMISSION_GRANTED) {\n mMap.setMyLocationEnabled(true);\n } else {\n // Show rationale and request permission.\n }\n }", "@Override\r\n public void onMapReady(GoogleMap googleMap) {\r\n Log.i(TAG, \"map is ready\");\r\n mMap = googleMap;\r\n\r\n mMap.setMyLocationEnabled(true);\r\n mMap.setOnMyLocationButtonClickListener(this);\r\n mMap.setOnMyLocationClickListener(this);\r\n\r\n startLocationUpdates();\r\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n frLatLng = new LatLng(getLatitude, getLongitude);\n\n map = googleMap;\n map.getUiSettings().setMyLocationButtonEnabled(false);\n\n if (ActivityCompat.checkSelfPermission(getContext()\n , Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED\n && ActivityCompat.checkSelfPermission(getContext(),\n Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n\n return;\n }\n\n map.addMarker(new MarkerOptions().position(frLatLng)).setTitle(getString(R.string.my_location));\n googleMap.getUiSettings().setMyLocationButtonEnabled(true);\n map.animateCamera(CameraUpdateFactory.newLatLngZoom(frLatLng, 520));\n\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n // Add a marker in Sydney and move the camera\n LatLng montesson = new LatLng(48.9190286,2.1380955);\n mMap.addMarker(new MarkerOptions().position(montesson).title(\"Marker in Montesson\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(montesson));\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n // Add a marker in Sydney and move the camera\n LatLng sydney = new LatLng(-34, 151);\n mMap.addMarker(new MarkerOptions().position(sydney).title(\"Marker in Sydney\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));\n\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)\n == PackageManager.PERMISSION_GRANTED) {\n mMap.setMyLocationEnabled(true);\n } else {\n // Show rationale and request permission.\n int i = 12;\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n i);\n\n }\n mMap.setMyLocationEnabled(true); //when location changed call line. loaction manager\n\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n // Add a marker in Sydney and move the camera\n LatLng myLocation = new LatLng(latitude, longitude);\n addMarker(myLocation, name);\n moveCamera(myLocation, 3);\n\n //search a place\n /*searchInput = (EditText) findViewById(R.id.map_search_input);\n searchInput.setOnEditorActionListener(new TextView.OnEditorActionListener() {\n @Override\n public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {\n if(actionId == EditorInfo.IME_ACTION_SEARCH\n || actionId == EditorInfo.IME_ACTION_DONE\n || actionId == KeyEvent.ACTION_DOWN\n || actionId == KeyEvent.KEYCODE_ENTER)\n //search location\n geoLocate();\n return false;\n }\n });*/\n\n //add location\n addButton = findViewById(R.id.map_add_button);\n addButton.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n Intent intent = new Intent();\n intent.putExtra(\"latitude\", marker.getPosition().latitude);\n intent.putExtra(\"longitude\", marker.getPosition().longitude);\n intent.putExtra(\"name\", marker.getTitle());\n setResult(4, intent);\n finish();\n }\n });\n\n //long tap to add a marker\n mMap.setOnMapLongClickListener(new GoogleMap.OnMapLongClickListener() {\n @Override\n public void onMapLongClick(@NonNull LatLng latLng) {\n addMarker(latLng, name);\n }\n });\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n // TODO: Consider calling\n // ActivityCompat#requestPermissions\n // here to request the missing permissions, and then overriding\n // public void onRequestPermissionsResult(int requestCode, String[] permissions,\n // int[] grantResults)\n // to handle the case where the user grants the permission. See the documentation\n // for ActivityCompat#requestPermissions for more details.\n return;\n }\n mMap.setMyLocationEnabled(true);\n mMap.setOnMyLocationChangeListener(this);\n markerIconBitmapDescriptor = BitmapDescriptorFactory.fromResource(R.mipmap.ic_driver_check_in);\n\n mFillColor = Color.HSVToColor(50, new float[]{0, 1, 1});\n mStrokeColor = Color.BLACK;\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n updateLocationUI();\n getDeviceLocation();\n // Add a marker in Sydney and move the camera\n //float zoom = 15;\n //LatLng gbc = new LatLng(43.676209, -79.410703);\n //mMap.addMarker(new MarkerOptions().position(gbc).title(\"Marker in GBC\"));\n //mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(gbc, zoom));\n\n }", "@Override\n public void onMapReady(final GoogleMap map) {\n map.moveCamera(CameraUpdateFactory.zoomTo(14));\n //map.moveCamera(CameraUpdateFactory.newLatLng(sydney));\n map.setMyLocationEnabled(true);\n map.setOnMyLocationButtonClickListener(new GoogleMap.OnMyLocationButtonClickListener() {\n @Override\n public boolean onMyLocationButtonClick() {\n\n return true;\n }\n });\n map.setOnMyLocationChangeListener(new GoogleMap.OnMyLocationChangeListener() {\n @Override\n public void onMyLocationChange(Location location) {\n Log.d(\"map\", \"onMyLocationChange\");\n if (!isinit) {\n isinit = true;\n if (now_Location == null ||\n now_Location.getLatitude() != location.getLatitude() ||\n now_Location.getLongitude() != location.getLongitude()) {\n now_Location = location;\n initStreetView();\n }\n }\n LatLng sydney = new LatLng(location.getLatitude(), location.getLongitude());\n map.moveCamera(CameraUpdateFactory.newLatLng(sydney));\n }\n });\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n // Add a marker in Sydney and move the camera\n LatLng sydney = new LatLng(121.5729889, 25.0776557);\n mMap.addMarker(new MarkerOptions().position(sydney).title(\"This is my first Maker\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n // Add a marker in Sydney and move the camera\n LatLng CSN = new LatLng(51.87, -8.481);\n mMap.setMapType(MAP_TYPE_HYBRID);\n mMap.addMarker(new MarkerOptions().position(CSN).title(\"Marker at CSN college\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(CSN, 15F));\n mMap.getUiSettings().setZoomControlsEnabled(true);\n }", "private void setUpMapIfNeeded() {\n if (mGoogleMap != null) {\n if (checkPermission()) {\n mGoogleMap.setMyLocationEnabled(true);\n }\n // Check if we were successful in obtaining the map.\n if (mMapView != null) {\n\n mGoogleMap.setOnMyLocationChangeListener(new GoogleMap.OnMyLocationChangeListener() {\n @Override\n public void onMyLocationChange(Location location) {\n mGoogleMap.addMarker(new MarkerOptions().position(new LatLng(location.getLatitude(), location.getLongitude())).title(\"It's Me!\"));\n mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location.getLatitude(), location.getLongitude()), 10));\n }\n });\n\n }\n }\n }", "@Override\r\n public void onMapReady(GoogleMap googleMap) {\r\n mMap = googleMap;\r\n\r\n // Add a marker in Sydney and move the camera\r\n LatLng charlotte = new LatLng(35.22, -80.84);\r\n //currentMarker = mMap.addMarker(new MarkerOptions().position(charlotte).title(\"Charlotte, NC\"));\r\n mMap.moveCamera(CameraUpdateFactory.newLatLng(charlotte));\r\n //currentMarker.setTag(0);\r\n\r\n mMap.setOnMapLongClickListener(this);\r\n\r\n\r\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED\r\n //&& ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED\r\n ) {\r\n // TODO: Consider calling\r\n\r\n return;\r\n }\r\n mMap.setMyLocationEnabled(true);\r\n mMap.setOnMyLocationButtonClickListener(new GoogleMap.OnMyLocationButtonClickListener() {\r\n @Override\r\n public boolean onMyLocationButtonClick() {\r\n Log.d(\"maps\", \"On my location button click\");\r\n return false;\r\n }\r\n });\r\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n Log.d(\"TEST\", \"MAP READY\");\n mMap = googleMap;\n\n // Add a marker in Sydney and move the camera\n mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);\n\n LatLng curLocation = new LatLng(latitude,longitude);\n CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(curLocation,15.0f);\n setPin(latitude,longitude, null);\n mMap.moveCamera(cameraUpdate);\n for(int i = 0; i < restaurantList.size(); i++){\n double lat = restaurantList.get(i).getLatitude();\n double lng = restaurantList.get(i).getLongitude();\n setPin(lat, lng, restaurantList.get(i));\n }\n //Check we have the users permission to access their location\n // if we dont have it, we have to request it\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)== PackageManager.PERMISSION_GRANTED){\n mMap.setMyLocationEnabled(true);\n\n } else {\n //we dont have permission, so we have to ask for it\n ActivityCompat.requestPermissions(this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n MY_LOCATION_REQUEST_CODE);\n //run asychronously.. show an alert dialog\n //user can choose allow or deny\n }\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n mMap.setTrafficEnabled(true);\n googleMap.setMyLocationEnabled(true);\n mMap.setOnMyLocationChangeListener(onMyLocationChangeListener);\n\n // mMap.setPadding(0, 0, 0, 100);\n UiSettings uiSettings = mMap.getUiSettings();\n uiSettings.setZoomControlsEnabled(true);\n\n mMap.addMarker(new MarkerOptions()\n .position(new LatLng(65.9667, -18.5333))\n .title(\"Hello world\"));\n\n\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n // Add a marker in Sydney and move the camera\n LatLng loc = new LatLng(v, v1);\n mMap.addMarker(new\n MarkerOptions().position(loc).title(\"0000000000\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(loc));\n }", "private void setUpMapIfNeeded() {\n if (mMap == null) {\n // Try to obtain the map from the SupportMapFragment.\n mMapFragment = ((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.fragment_show_place_info_map));\n mMap = mMapFragment.getMap();\n // Check if we were successful in obtaining the map.\n if (mMap != null) {\n setUpMap();\n }\n }\n }", "@Override\n public void onMapReady(GoogleMap map) {\n mMap = map;\n\n // Use a custom info window adapter to handle multiple lines of text in the\n // info window contents.\n mMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {\n\n @Override\n // Return null here, so that getInfoContents() is called next.\n public View getInfoWindow(Marker arg0) {\n return null;\n }\n\n @Override\n public View getInfoContents(Marker marker) {\n // Inflate the layouts for the info window, title and snippet.\n View infoWindow = getLayoutInflater().inflate(R.layout.custom_info_contents,\n (FrameLayout) findViewById(R.id.map), false);\n\n TextView title = ((TextView) infoWindow.findViewById(R.id.title));\n title.setText(marker.getTitle());\n\n TextView snippet = ((TextView) infoWindow.findViewById(R.id.snippet));\n snippet.setText(marker.getSnippet());\n\n return infoWindow;\n }\n });\n\n // Turn on the My Location layer and the related control on the map.\n updateLocationUI();\n\n // Get the current location of the device and set the position of the map.\n getDeviceLocation();\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n\n mMap = googleMap;\n\n // Add a marker in Sydney and move the camera\n LatLng sydney = new LatLng(-34, 151);\n mMap.addMarker(new MarkerOptions().position(sydney).title(\"you are in sydney\").draggable(true));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));\n mMap.setOnMarkerDragListener(this);\n mMap.setOnMapLongClickListener(this);\n\n }", "private void setUpMapIfNeeded() {\n if (mMap == null) {\n // Try to obtain the map from the SupportMapFragment.\n mMap = mMapFragment.getMap();\n // Check if we were successful in obtaining the map.\n if (mMap != null) {\n mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);\n mMap.setMyLocationEnabled(false);\n mMap.getUiSettings().setCompassEnabled(true);\n mMap.getUiSettings().setZoomControlsEnabled(true);\n mMap.getUiSettings().setMyLocationButtonEnabled(true);\n final LatLng update = getLastKnownLocation();\n if (update != null) {\n mMap.moveCamera(CameraUpdateFactory.newCameraPosition(CameraPosition.fromLatLngZoom(update, 11.0f)));\n }\n\n mMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {\n\n @Override\n public void onMapClick(LatLng latLng) {\n mIsNeedLocationUpdate = false;\n moveToLocation(latLng, false);\n }\n\n });\n\n }\n }\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n // Add a marker in Sydney and move the camera\n LatLng sydney = new LatLng(-34, 151);\n // Home Mark\n LatLng home = new LatLng(41.374736, 2.168308);\n float zoom = 13;\n\n // Inicialitzem mapa\n mMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN); //Tipus de mapa\n mMap.addMarker(new MarkerOptions().position(home).title(\"IOC\")); //Marcador inicial\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(home, zoom)); //Centrem mapa en el marcador inicial\n\n this.setMapLongClick(mMap);\n this.enableMyLocation();\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n // TODO: Consider calling\n // ActivityCompat#requestPermissions\n // here to request the missing permissions, and then overriding\n\n // to handle the case where the user grants the permission. See the documentation\n // for ActivityCompat#requestPermissions for more details.\n return;\n }\n\n final LatLng[] myLoc = {new LatLng(1, 1)};\n mMap.setMyLocationEnabled(true);\n// mMap.setOnMyLocationChangeListener(new GoogleMap.OnMyLocationChangeListener() {\n// @Override\n// public void onMyLocationChange(Location location) {\n// myLoc[0] = new LatLng(location.getLatitude(), location.getLongitude());\n// mMap.addCircle(new CircleOptions().center(myLoc[0]));\n// mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(myLoc[0], 15));\n// }\n// });\n\n mMap.addCircle(new CircleOptions().center(new LatLng(lat, lng)));\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(lat, lng), 18));\n\n mMap.setOnPoiClickListener(new GoogleMap.OnPoiClickListener() {\n @Override\n public void onPoiClick(PointOfInterest poi) {\n\n }\n });\n\n mMap.getUiSettings().setMapToolbarEnabled(true);\n\n // Add a marker in Sydney and move the camera\n\n\n showItems(lat, lng, radius);\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n LatLng posini = new LatLng(3.4,-76.5);\n myMarker = mMap.addMarker(new MarkerOptions().position(posini));\n\n requestLocation();\n\n googleMap.setOnCameraMoveListener(new GoogleMap.OnCameraMoveListener() {\n @Override\n public void onCameraMove() {\n if (!flag) {\n\n addMarker();\n flag = true;\n }\n }\n });\n\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n Log.d(logTag,\"4\");\n mMap = googleMap;\n mMap.getUiSettings().setZoomControlsEnabled(true);\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, LOCATION_REQUEST);\n return;\n }\n mMap.setOnMapLongClickListener(this);\n mMap.setOnInfoWindowClickListener( this );\n mMap.setOnMapClickListener(this);\n mMap.setMyLocationEnabled(true);\n ll=new LatLng(currentLocation.getLatitude(),currentLocation.getLongitude());\n MarkerOptions options = new MarkerOptions().position(ll);\n options.title(getAddressFromLatLng(ll));\n\n Log.d(logTag,\"5\");\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n // Add a marker in Sydney and move the camera\n LatLng hn = new LatLng(14.079526, -87.180662);\n mMap.moveCamera(CameraUpdateFactory.newLatLng(hn));\n mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(hn,7));\n helperFacturacion = new FacturacionHelper(MapListClientesActivity.this);\n\n\n addMarkers();\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n // Add a marker in Sydney and move the camera\n setInitialLocation(VehicleData.getLatitude(), VehicleData.getLongitude());\n }", "@Override\r\n public void onMapReady(GoogleMap googleMap) {\r\n mMap = googleMap;\r\n if(ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)!= PackageManager.PERMISSION_GRANTED){\r\n ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION},101);\r\n }\r\n loc = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);\r\n populateMap(loc);\r\n try {\r\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(lm.getLastKnownLocation(LocationManager.GPS_PROVIDER).getLatitude(), lm.getLastKnownLocation(LocationManager.GPS_PROVIDER).getLongitude()), 15.0f));\r\n }catch(Exception blyat){\r\n AlertDialog.Builder builder = new AlertDialog.Builder(this);\r\n builder.setMessage(\"No hemos podido acceder a tu localización, revisa el estado de GPS y reinicia la app\");\r\n builder.show();\r\n }\r\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n try{\n Geocoder geo = new Geocoder(this);\n\n //Get address provided for location as Address object\n List<Address> foundAddresses = geo.getFromLocationName(location.getAddress(),1);\n Address address = geo.getFromLocationName(location.getAddress(),1).get(0);\n\n LatLng position= new LatLng(address.getLatitude(),address.getLongitude());\n\n googleMap.addMarker(new MarkerOptions().position(position)\n .title(location.getTitle()));\n googleMap.setMinZoomPreference(12);\n googleMap.setMaxZoomPreference(15);\n googleMap.moveCamera(CameraUpdateFactory.newLatLng(position));\n }\n catch (IOException e){\n e.printStackTrace();\n }\n catch(IndexOutOfBoundsException e){\n e.printStackTrace();\n }\n }", "private void setUpMapIfNeeded() {\n if (mMap == null) {\n // Try to obtain the map from the SupportMapFragment.\n mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))\n .getMap();\n // Check if we were successful in obtaining the map.\n if (mMap != null) {\n mMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() {\n @Override\n public void onMapLoaded() {\n\n setUpMap();\n\n }\n });\n }\n }\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n// updateMap(new LocationModel(41.806363, 44.768531, \"Agmasheneblis Xeivani\"));\n if (shoppingList.getLocationReminder() != null) {\n updateMap(shoppingList.getLocationReminder());\n } else {\n updateMap(null);\n }\n }", "@Override\n @SuppressWarnings({\"MissingPermission\"})\n public void onMapReady(GoogleMap googleMap) {\n\n Log.d(TAG, \"Map is ready.\");\n mMap = googleMap;\n\n mMap.setMyLocationEnabled(true);\n mLastLocation = LocationServices.FusedLocationApi.getLastLocation(\n mGoogleApiClient);\n\n setMarkerToCurrentLocation();\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n // Add a marker in Sydney and move the camera\n LatLng sydney = new LatLng(LocationStorage.getInstance().getLocation().getLatitude(), LocationStorage.getInstance().getLocation().getLongitude());\n// BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(R.drawable.ic_large_marker);\n Marker marker = mMap.addMarker(new MarkerOptions().position(sydney).title(\"Current Location\").snippet(\"Hold and drag to your desired location\"));\n marker.showInfoWindow();\n mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));\n CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(sydney, 15);\n mMap.animateCamera(cameraUpdate);\n marker.setDraggable(true);\n mMap.setOnMarkerDragListener(new GoogleMap.OnMarkerDragListener() {\n @Override\n public void onMarkerDragStart(Marker marker) {\n\n }\n\n @Override\n public void onMarkerDrag(Marker marker) {\n\n }\n\n @Override\n public void onMarkerDragEnd(Marker marker) {\n LatLng latLng=marker.getPosition();\n Location temp = new Location(LocationManager.GPS_PROVIDER);\n temp.setLatitude(latLng.latitude);\n temp.setLongitude(latLng.longitude);\n LocationStorage.getInstance().setLocation(temp);\n }\n });\n// mMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {\n// @Override\n// public boolean onMarkerClick(Marker marker) {\n//\n// return true;\n// }\n// });\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n uiSettings = mMap.getUiSettings();\n uiSettings.setZoomControlsEnabled(false);\n // Add a marker in Sydney and move the camera\n LatLng sydney = new LatLng(-34, 151);\n mMap.addMarker(new MarkerOptions().position(sydney).title(\"Marker in Sydney\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));\n mcircleOptions = mcircleOptions.center(sydney);\n mcircleOptions = mcircleOptions.radius(500);\n mcircleOptions = mcircleOptions.strokeWidth(2);\n mcircleOptions = mcircleOptions.strokeColor(Color.argb(100, 255, 73, 73));\n mcircleOptions = mcircleOptions.fillColor(Color.argb(100, 255, 73, 73));\n mMap.addCircle(mcircleOptions);\n if (ActivityCompat.checkSelfPermission(this,\n android.Manifest.permission.ACCESS_FINE_LOCATION)\n !=\n PackageManager.PERMISSION_GRANTED\n &&\n ActivityCompat.checkSelfPermission(this,\n android.Manifest.permission.ACCESS_COARSE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n // TODO: Consider calling\n // ActivityCompat#requestPermissions\n // here to request the missing permissions, and then overriding\n // public void onRequestPermissionsResult(int requestCode, String[] permissions,\n // int[] grantResults)\n // to handle the case where the user grants the permission. See the documentation\n // for ActivityCompat#requestPermissions for more details.\n return;\n }\n mMap.setMyLocationEnabled(true);\n\n mMap.setOnMapLongClickListener(new GoogleMap.OnMapLongClickListener() {\n @Override\n public void onMapLongClick(LatLng latLng) {\n mlatLng = latLng;\n mMap.clear();\n mMap.addMarker(new MarkerOptions().position(mlatLng));\n mcircleOptions = mcircleOptions.center(mlatLng);\n mMap.addCircle(mcircleOptions);\n mMap.animateCamera(CameraUpdateFactory.newLatLng(latLng));\n geocoder = new Geocoder(Maps.this, Locale.getDefault());\n try {\n List<Address> addresses = geocoder.getFromLocation(mlatLng.latitude, mlatLng.longitude, 1);\n for (int i=0; i < addresses.get(0).getMaxAddressLineIndex(); i++) {\n Log.e(\"Address\", addresses.get(0).getAddressLine(i) + \"\");\n caddress = addresses.get(0).getAddressLine(i);\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n loc_data = getSharedPreferences(\"loc_data\", MODE_PRIVATE);\n SharedPreferences.Editor loc_data_editor = loc_data.edit();\n loc_data_editor.putString(\"lat\", Double.toString(mlatLng.latitude));\n loc_data_editor.putString(\"lng\", Double.toString(mlatLng.longitude));\n loc_data_editor.putString(\"add\", caddress + \"\");\n loc_data_editor.commit();\n }\n });\n }", "@Override\r\n public void onMapReady(GoogleMap googleMap) {\r\n mMap = googleMap;\r\n mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);\r\n\r\n //Initialize Google Play Services\r\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\r\n if (ContextCompat.checkSelfPermission(this,\r\n Manifest.permission.ACCESS_FINE_LOCATION)\r\n == PackageManager.PERMISSION_GRANTED) {\r\n buildGoogleApiClient();\r\n mMap.setMyLocationEnabled(true);\r\n }\r\n }\r\n else {\r\n buildGoogleApiClient();\r\n mMap.setMyLocationEnabled(true);\r\n }\r\n }", "@Override\n public void onMapReady(GoogleMap map) {\n mMap = map;\n\n // Use a custom info window adapter to handle multiple lines of text in the\n // info window contents.\n mMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {\n\n @Override\n // Return null here, so that getInfoContents() is called next.\n public View getInfoWindow(Marker arg0) {\n return null;\n }\n\n @Override\n public View getInfoContents(Marker marker) {\n // Inflate the layouts for the info window, title and snippet.\n View infoWindow = getLayoutInflater().inflate(R.layout.custom_info_contents,\n (FrameLayout) findViewById(R.id.map), false);\n\n TextView title = ((TextView) infoWindow.findViewById(R.id.title));\n title.setText(marker.getTitle());\n\n TextView snippet = ((TextView) infoWindow.findViewById(R.id.snippet));\n snippet.setText(marker.getSnippet());\n\n return infoWindow;\n }\n });\n\n // Turn on the My Location layer and the related control on the map.\n updateLocationUI();\n\n // Get the current location of the device and set the position of the map.\n getDeviceLocation();\n\n initializeOtherSettlements(new LatLng(mLastKnownLocation.getLatitude(), mLastKnownLocation.getLongitude()));\n initializeQuestLocations(new LatLng(mLastKnownLocation.getLatitude(), mLastKnownLocation.getLongitude()));\n\n mMap.setOnMarkerClickListener(this);\n mMap.setOnMapClickListener(this);\n mMap.setOnPoiClickListener(this);\n mMap.setOnInfoWindowClickListener(this);\n\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(\n new LatLng(mLastKnownLocation.getLatitude(),\n mLastKnownLocation.getLongitude()), 9));\n\n final PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment)\n getFragmentManager().findFragmentById(R.id.place_autocomplete_fragment);\n\n autocompleteFragment.getView().setBackgroundColor(Color.WHITE);\n autocompleteFragment.getView().setVisibility(View.GONE);\n autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {\n @Override\n public void onPlaceSelected(Place place) {\n //Bias results towards the user's current location\n /*autocompleteFragment.setBoundsBias(new LatLngBounds(\n new LatLng(place.getLatLng().latitude, place.getLatLng().longitude),\n new LatLng(place.getLatLng().latitude, place.getLatLng().longitude)));*/\n\n //Get info about the selected place.\n //Log.i(TAG, \"Place: \" + place.getName());\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(\n new LatLng(place.getLatLng().latitude,\n place.getLatLng().longitude), mMap.getCameraPosition().zoom));\n\n addMarkerAtPoi(place);\n }\n\n @Override\n public void onError(Status status) {\n // TODO: Handle the error.\n Log.i(TAG, \"An error occurred: \" + status);\n }\n });\n\n updateMapHistory();\n updateCustomTimeUI();\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n enableMyLocation();\n buildGoogleApiClient();\n\n }", "public void setUpMapIfNeeded() {\n if (mMap == null) {\n // Try to obtain the map from the SupportMapFragment.\n mMap = ((SupportMapFragment) getChildFragmentManager()\n .findFragmentById(R.id.location_map)).getMap();\n MapsInitializer.initialize(getActivity().getApplicationContext());\n // Check if we were successful in obtaining the map.\n if (mMap != null)\n setUpMap();\n }\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n String info = sTitle;\n // Add a marker in Sydney and move the camera\n LatLng pos = new LatLng(latitude, longitude);\n mMap.addMarker(new MarkerOptions().position(pos).title(info));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(pos));\n mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(pos, 8));\n\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n gpsTracker = new GPSTracker(this);\n\n // TODO Cek Permission >= Marshmellow\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED\n &&\n ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&\n checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED\n && checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n requestPermissions(new String[]{\n Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION\n }, 110);\n return;\n }\n }\n\n if (gpsTracker.canGetLocation()) {\n latawal = gpsTracker.getLatitude();\n lonawal = gpsTracker.getLongitude();\n namelocationawal = myLocation(latawal, lonawal);\n }\n\n // Add a marker in Sydney and move the camera\n LatLng myLocation = new LatLng(latawal, lonawal);\n locawal.setText(namelocationawal);\n mMap.addMarker(new MarkerOptions().position(myLocation).title(namelocationawal));\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(myLocation, 14));\n mMap.getUiSettings().setMyLocationButtonEnabled(true);\n mMap.setPadding(30, 80, 30, 80);\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n LatLng oregon = new LatLng(45.3, -122);\n mMap.addMarker(new MarkerOptions().position(oregon).title(\"Marker in Oregon\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(oregon));\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n /* mMap = googleMap;\n\n // Add a marker in Sydney and move the camera\n LatLng sydney = new LatLng(-34, 151);\n //mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);\n mMap.addMarker(new MarkerOptions().position(sydney).title(\"Marker in Sydney\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));*/\n LatLng ifto = new LatLng(-10.199202218157746, -48.31158433109522);\n mMap = googleMap;\n mMap.setOnCameraIdleListener(this);\n mMap.addMarker(new MarkerOptions().position(ifto).title(\"IFTO Campus Palmas\"));\n }", "private void setupMap() {\n if (googleMap == null) {\n SupportMapFragment mapFrag = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);\n mapFrag.getMapAsync(this);\n mLocationProvider = new LocationProvider(this, this);\n }\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n Log.d(TAG, \"onMapReady: map is ready\");\n mMap = googleMap;\n\n if (mLocationPermissionsGranted) {\n\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n return;\n }\n mMap.setMyLocationEnabled(true);\n mMap.getUiSettings().setMyLocationButtonEnabled(false);\n\n\n mMap.getUiSettings().setCompassEnabled(true);\n// mMap.getUiSettings().setZoomControlsEnabled(true);\n mMap.getUiSettings().setCompassEnabled(true);\n mMap.getUiSettings().setIndoorLevelPickerEnabled(true);\n mMap.getUiSettings().setMapToolbarEnabled(true);\n\n mMap.getUiSettings().setAllGesturesEnabled(true);\n getDeviceLocation();\n mMap.setOnMarkerDragListener(this);\n\n }\n }", "public void onMapReady(GoogleMap googleMap , double lati, double longi) {\n mMap = googleMap;\n\n // Add a marker in Sydney and move the camera\n LatLng sydney = new LatLng(lati, longi);\n mMap.addMarker(new MarkerOptions().position(sydney).title(\"Your Current Location\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));\n }", "@Override\n public void onMapReady(GoogleMap map) {\n mGoogleMap = map;\n mGoogleMap.setMyLocationEnabled(true);\n Log.d(TAG, \"Map Ready\");\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n\n\n mMap = googleMap;\n\n attachLocationListener();\n\n\n mMap.setOnMarkerDragListener(this);\n\n }", "public void onMapReady(GoogleMap googleMap) {\r\n mMap = googleMap;\r\n\r\n mMap.moveCamera(CameraUpdateFactory.zoomTo(1));\r\n\r\n\r\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\r\n // TODO: Consider calling\r\n // ActivityCompat#requestPermissions\r\n // here to request the missing permissions, and then overriding\r\n // public void onRequestPermissionsResult(int requestCode, String[] permissions,\r\n // int[] grantResults)\r\n // to handle the case where the user grants the permission. See the documentation\r\n // for ActivityCompat#requestPermissions for more details.\r\n return;\r\n }\r\n mMap.setMyLocationEnabled(true);\r\n\r\n /// This allows the user to zoom in and out of the map\r\n mMap.getUiSettings().setZoomControlsEnabled(true);\r\n mMap.getUiSettings().setMyLocationButtonEnabled(true);\r\n mMap.getUiSettings().isMyLocationButtonEnabled();\r\n mMap.getUiSettings().setMyLocationButtonEnabled(true);\r\n\r\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n\n mMap = googleMap;\n //Agafar la localitzacio actual per mostrar-ho al mapa\n LocationManager locationManager = (LocationManager)\n getSystemService(Context.LOCATION_SERVICE);\n Criteria criteria = new Criteria();\n\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n // TODO: Consider calling\n // ActivityCompat#requestPermissions\n // here to request the missing permissions, and then overriding\n // public void onRequestPermissionsResult(int requestCode, String[] permissions,\n // int[] grantResults)\n // to handle the case where the user grants the permission. See the documentation\n // for ActivityCompat#requestPermissions for more details.\n return;\n }\n Location location = locationManager.getLastKnownLocation(locationManager.getBestProvider(criteria, false));\n LatLng actual = new LatLng((location.getLatitude()),location.getLongitude());\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(actual,13));\n }", "@RequiresApi(api = Build.VERSION_CODES.M)\n @Override\n public void onMapReady(GoogleMap googleMap) {\n MapsInitializer.initialize(getContext());\n mMap = googleMap;\n mMap.setMinZoomPreference(13.0f);\n mMap.setMaxZoomPreference(20.0f);\n mMap.setOnMapClickListener(this);\n mMap.setInfoWindowAdapter(this);\n mMap.setOnInfoWindowClickListener(MyOnInfoWindowClickListener);\n\n if (ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n requestPermissions(new String[]{Manifest.permission.\n ACCESS_FINE_LOCATION}, 1);\n } else {\n mMap.setMyLocationEnabled(true);\n }\n }\n\n mMap.setMyLocationEnabled(true);\n\n buildGoogleApiClient();\n mGoogleApiClient.connect();\n\n }", "@Override\n public void onMapReady(final GoogleMap map) {\n mMap = map;\n\n mMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {\n\n @Override\n // Return null here, so that getInfoContents() is called next.\n public View getInfoWindow(Marker arg0) {\n return null;\n }\n\n @Override\n public View getInfoContents(Marker marker) {\n // Inflate the layouts for the info window, title and snippet.\n @SuppressLint(\"InflateParams\") View infoWindow = getLayoutInflater().inflate(R.layout.custom_info_contents, null);\n\n TextView title = infoWindow.findViewById(R.id.title);\n title.setText(marker.getTitle());\n\n TextView snippet = infoWindow.findViewById(R.id.snippet);\n snippet.setText(marker.getSnippet());\n\n return infoWindow;\n }\n });\n\n mMap.setOnMapLongClickListener(new GoogleMap.OnMapLongClickListener() {\n @Override\n public void onMapLongClick(LatLng point) {\n mMap.clear();\n buildMarker(\"User Tap\", \"This is snippet\", point, true);\n @SuppressLint(\"DefaultLocale\") String latLong = String.format(\"%f,%f\", point.latitude, point.longitude);\n String endPoint = String.format(placesURL,latLong, String.valueOf(distance), BuildConfig.API_KEY);\n Location locationSelected = new Location(mLastKnownLocation);\n locationSelected.setLatitude(point.latitude);\n locationSelected.setLongitude(point.longitude);\n showPlacesNearby(locationSelected, endPoint);\n }\n });\n\n mMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {\n @Override\n public void onMapClick(LatLng latLng) {\n mMap.clear();\n }\n });\n\n mMap.setOnMyLocationButtonClickListener(new GoogleMap.OnMyLocationButtonClickListener() {\n @Override\n public boolean onMyLocationButtonClick() {\n mMap.clear();\n updateLocationUI();\n getDeviceLocation();\n return true;\n }\n });\n\n\n // Prompt the user for permission.\n getLocationPermission();\n\n // Turn on the My Location layer and the related control on the map.\n updateLocationUI();\n\n // Get the current location of the device and set the position of the map.\n getDeviceLocation();\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n mUiSettings = mMap.getUiSettings();\n mUiSettings.setAllGesturesEnabled(mLock);\n\n mMap.setOnMyLocationButtonClickListener(this);\n mMap.setOnMapClickListener(this);\n mMap.setOnMapLongClickListener(this);\n mMap.setOnMarkerDragListener(this);\n\n enableMyLocation();\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n riderLat = getIntent().getDoubleExtra(DriverActivity.RIDER_LATITUDE_EXTRA, 0.0);\n riderLong = getIntent().getDoubleExtra(DriverActivity.RIDER_LONGITUDE_EXTRA, 0.0);\n LatLng rider = new LatLng(riderLat, riderLong);\n riderMarker = mMap.addMarker(new MarkerOptions()\n .position(rider)\n .title(\"Rider\")\n .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)));\n\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED\n\n && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n\n Toast.makeText(this, \"You don't have location permission\", Toast.LENGTH_LONG).show();\n return;\n }\n\n Location hereNow = mLocationManager.getLastKnownLocation(mBestProvider);\n if (hereNow != null) {\n onLocationChanged(hereNow);\n }\n\n mLocationManager.requestLocationUpdates(mBestProvider, 400, 1, this);\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n //Enable Current location\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.\n PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.\n ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n // TODO: Consider calling\n // ActivityCompat#requestPermissions\n // here to request the missing permissions, and then overriding\n // public void onRequestPermissionsResult(int requestCode, String[] permissions,\n // int[] grantResults)\n // to handle the case where the user grants the permission. See the documentation\n // for ActivityCompat#\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n\n requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE_LOCATION,\n Manifest.permission.ACCESS_FINE_LOCATION}, MY_REQUEST_INT);\n\n }\n\n\n return;\n\n } else {\n mMap.setMyLocationEnabled(true);\n\n\n }\n\n\n // Add a marker in Sydney and move the camera\n //LatLng sydney = new LatLng(-34, 151);\n //mMap.addMarker(new MarkerOptions().position(sydney).title(\"Marker in Sydney\")\n // .icon(BitmapDescriptorFactory.fromResource(R.drawable.blackspot))\n // );\n //mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));\n //mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(sydney,16),5000,null);\n //new MarkerOptions().icon(BitmapDescriptorFactory.fromResource(R.drawable.blackspot));\n\n //LatLng latLng = new LatLng(-1.2652560778411037, 36.81265354156495);\n //mMap.addMarker(new MarkerOptions().position(latLng).title(\"Marker in Parklands\"));\n //mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng,16),5000,null);\n //mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));\n\n //BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(R.drawable.blackspot);\n ////LatLng harmbug = new LatLng(-37, 120);\n //mMap.addMarker(new MarkerOptions().position(harmbug).title(\"Marker in Harmbug\")\n //.icon(icon));\n //mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(harmbug,16),5000,null);\n //mMap.moveCamera(CameraUpdateFactory.newLatLng(harmbug));\n\n //LatLng kenya = new LatLng(-2.456, 37);\n //mMap.addMarker(new MarkerOptions().position(kenya).title(\"Marker in Kenya\"));\n //mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(kenya,16),5000,null);\n //mMap.moveCamera(CameraUpdateFactory.newLatLng(kenya));\n\n LatLng sydney = new LatLng(-0.8041213212075744, 36.53117179870606);\n mMap.addMarker(new MarkerOptions().position(sydney).title(\"Blackspot at Kinungi\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));\n mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(sydney, 18), 5000, null);\n\n LatLng gilgil = new LatLng(-0.2167, 36.2667);\n mMap.addMarker(new MarkerOptions().position(gilgil).title(\"Blackspot at Gilgil\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(gilgil));\n mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(gilgil, 18), 5000, null);\n\n LatLng njoro = new LatLng(-0.3290, 35.9440);\n mMap.addMarker(new MarkerOptions().position(njoro).title(\"Blackspot at Njoro\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(njoro));\n mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(njoro, 18), 5000, null);\n\n LatLng bluepost = new LatLng(-1.0226988092777693, 37.06806957721711);\n mMap.addMarker(new MarkerOptions().position(bluepost).title(\"Blackspot at Bluepost Bridge\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(bluepost));\n mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(bluepost, 18), 5000, null);\n\n LatLng Nithi = new LatLng(-0.26649259802107667, 37.66248464584351);\n mMap.addMarker(new MarkerOptions().position(Nithi).title(\"Blackspot at Nithi Bridge\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(Nithi));\n mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(bluepost, 18), 5000, null);\n\n LatLng Maungu = new LatLng(-3.558353542362671, 38.74993801116944);\n mMap.addMarker(new MarkerOptions().position(Maungu).title(\"Blackspot at Maungu Area\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(Maungu));\n mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(Maungu, 18), 5000, null);\n\n LatLng Misikhu = new LatLng(0.6662027919912484, 34.75215911865235);\n mMap.addMarker(new MarkerOptions().position(Misikhu).title(\"Blackspot at Misikhu\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(Misikhu));\n mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(Maungu, 18), 5000, null);\n\n LatLng Muthaiga = new LatLng(-1.2614375406469367, 36.840720176696784);\n mMap.addMarker(new MarkerOptions().position(Muthaiga).title(\"Blackspot at Muthaiga Road\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(Muthaiga));\n mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(Maungu, 18), 5000, null);\n\n LatLng Pangani = new LatLng(-1.2665003190843396, 36.834239959716804);\n mMap.addMarker(new MarkerOptions().position(Muthaiga).title(\"Blackspot at Pangani\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(Pangani));\n mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(Pangani, 18), 5000, null);\n\n LatLng KU = new LatLng(-1.1823303731373749, 36.93703293800355);\n mMap.addMarker(new MarkerOptions().position(KU).title(\"Blackspot at KU\"));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(KU));\n mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(KU, 18), 5000, null);\n\n\n }", "@Override\n public void onMapReady(GoogleMap googleMap)\n {\n // This method is called AFTER the map is loaded from Google Play services\n // At this point the map is ready\n\n // Store the reference to the Google Map in our member variable\n mMap = googleMap;\n // Custom marker (Big Blue one - mymarker.png)\n LatLng myPosition = new LatLng(33.671028, -117.911305);\n\n // Add a custom marker at \"myPosition\"\n mMap.addMarker(new MarkerOptions().position(myPosition).title(\"My Location\").icon(BitmapDescriptorFactory.fromResource(R.drawable.my_marker)));\n\n // Center the camera over myPosition\n CameraPosition cameraPosition = new CameraPosition.Builder().target(myPosition).zoom(15.0f).build();\n CameraUpdate cameraUpdate = CameraUpdateFactory.newCameraPosition(cameraPosition);\n // Move map to our cameraUpdate\n mMap.moveCamera(cameraUpdate);\n\n // Then add normal markers for all the caffeine locations from the allLocationsList.\n // Set the zoom level of the map to 15.0f\n\n // Now, let's plot each Location form the list with a standard marker\n for (Location location : allLocationsList)\n {\n LatLng caffeineLocation = new LatLng(location.getLatitude(), location.getLongitude());\n mMap.addMarker(new MarkerOptions().position(caffeineLocation).title(location.getName()));\n }\n\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n Toast.makeText(this, \"Map is Ready\", Toast.LENGTH_SHORT).show();\n Log.d(TAG, \"onMapReady: map is ready\");\n mMap = googleMap;\n\n if (mLocationPermissionsGranted) {\n getDeviceLocation();\n\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n return;\n }\n mMap.setMyLocationEnabled(true);\n mMap.getUiSettings().setMyLocationButtonEnabled(false);\n\n init();\n }\n\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n LatLng location = new LatLng(mLat, mLng);\n moveCamera(location, DEFAUT_ZOOM);\n if (ActivityCompat.checkSelfPermission(this,\n android.Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED\n && ActivityCompat.checkSelfPermission(\n this,\n android.Manifest.permission.ACCESS_COARSE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n return;\n }\n mMap.setMyLocationEnabled(true);\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n // Add a marker in Pula and move the camera\n LatLng pula = new LatLng(44.86726450096342, 13.850460687162476);\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(pula, 13));\n\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n enableUserLocation();\n zoomTooUserLocation();\n } else {\n if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission\n .ACCESS_FINE_LOCATION)) {\n //we can show user dialog why this permission is necessery\n\n ActivityCompat.requestPermissions(this, new String[]{Manifest.permission\n .ACCESS_FINE_LOCATION}, LOCATION_REQUEST_CODE);\n\n } else {\n ActivityCompat.requestPermissions(this, new String[]{Manifest.permission\n .ACCESS_FINE_LOCATION}, LOCATION_REQUEST_CODE);\n }\n }\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n MapStyleOptions style = MapStyleOptions.loadRawResourceStyle(getContext(), R.raw.mapstyle_day);\n mMap.setMapStyle(style);\n\n if (locationProvider != null) {\n enableLocationBullet();\n if (lastpos != null) {\n mMap.moveCamera(CameraUpdateFactory.newCameraPosition(lastpos));\n }\n }\n // Start clustermanager and add markers\n setUpClusterManager();\n\n mMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() {\n @Override\n public void onMapLoaded() {\n mapReady = true;\n if (searchedRestaurants != null) {\n addRestaurants(searchedRestaurants, false);\n }\n\n Location loc = locationProvider.getLastLocation();\n if (!init) {\n zoomMapToPosition(loc, MY_LOCATION_ZOOM);\n init = true;\n }\n\n }\n });\n\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);\n\n ////run with it to check what is happening and remove it to see\n\n\n //Initialize Google Play Services\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {\n buildGoogleApiClient();\n mMap.setMyLocationEnabled(true);\n }\n } else {\n buildGoogleApiClient();\n mMap.setMyLocationEnabled(true);\n }\n }", "@Override\r\n public void onMapReady(GoogleMap googleMap) {\r\n mMap = googleMap;\r\n mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);\r\n\r\n //Initialize Google Play Services\r\n if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\r\n if (ContextCompat.checkSelfPermission(this,\r\n Manifest.permission.ACCESS_FINE_LOCATION)\r\n == PackageManager.PERMISSION_GRANTED) {\r\n buildGoogleApiClient();\r\n mMap.setMyLocationEnabled(true);\r\n }\r\n }\r\n else {\r\n buildGoogleApiClient();\r\n mMap.setMyLocationEnabled(true);\r\n }\r\n\r\n\r\n }", "@Override\n public void onMapReady(GoogleMap map) {\n mMap = map;\n mUiSettings = mMap.getUiSettings();\n mUiSettings.setCompassEnabled(false);\n mUiSettings.setMapToolbarEnabled(false);\n mUiSettings.setZoomControlsEnabled(false);\n mUiSettings.setScrollGesturesEnabled(false);\n mUiSettings.setTiltGesturesEnabled(false);\n mUiSettings.setRotateGesturesEnabled(false);\n\n // Add a marker in Sydney and move the camera\n final LatLng airport = new LatLng(listAirport.get(index).getLatitude(), listAirport.get(index).getLongitude());\n mMap.moveCamera(CameraUpdateFactory.newLatLng(airport));\n mMap.setMinZoomPreference(10.0f);\n mMap.setMaxZoomPreference(10.0f);\n mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);\n\n map.setOnMapClickListener(new GoogleMap.OnMapClickListener() {\n @Override\n public void onMapClick(LatLng latLng) {\n onClick(index, MapsActivity.class);\n }\n });\n\n }", "private void setUpMapIfNeeded() {\n if (mMap == null) {\n // Try to obtain the map from the SupportMapFragment.\n SupportMapFragment mapFragment = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map));\n mapFragment.getMapAsync(this);\n mMap = mapFragment.getMap();\n\n }\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n LatLng latlong = new LatLng(29.375859, 47.977405);\n googleMap.addMarker(new MarkerOptions().position(latlong).title(\"\"));\n googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latlong, 9.0f));\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n Log.d(LOG_TAG, \"called onMapReady()\");\n mMap = googleMap;\n\n // Set up UI for map\n mMap.setMyLocationEnabled(true);\n mMap.setBuildingsEnabled(true);\n mUiSettings = mMap.getUiSettings(); // https://developers.google.com/maps/documentation/android-sdk/controls\n mUiSettings.setMyLocationButtonEnabled(false);\n mUiSettings.setCompassEnabled(true);\n mUiSettings.setTiltGesturesEnabled(true);\n mUiSettings.setRotateGesturesEnabled(true);\n mUiSettings.setScrollGesturesEnabled(true);\n mUiSettings.setZoomGesturesEnabled(true);\n\n\n // Move the camera to last known user location\n fusedLocationClient.getLastLocation().addOnSuccessListener(this, new OnSuccessListener<Location>() { // this -> getActivity()??\n @Override\n public void onSuccess(Location location) {\n // Got last known location. In some rare situations this can be null.\n if (location != null) {\n double latitude = location.getLatitude();\n double longitude = location.getLongitude();\n LatLng startingLocation = new LatLng(latitude, longitude);\n\n CameraPosition cameraPosition = new CameraPosition.Builder()\n .target(startingLocation) // Sets the center of the map\n .zoom(16) // Sets the zoom\n .build(); // Creates a CameraPosition from the builder\n mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition), 250, null);\n Log.d(LOG_TAG, \" > moved map to last known location\");\n }\n }\n });\n addZoneHolesToMap(shiftZones);\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n // Add a marker in Sydney and move the camera\n LatLng livraria = new LatLng(maps.getLatitude(), maps.getLongitude());\n if(this.maps.getId() == 1){\n mMap.addMarker(new MarkerOptions().position(livraria).title(\"Livraria Saraiva - Praia de Belas\"));\n } else if(this.maps.getId() == 2){\n mMap.addMarker(new MarkerOptions().position(livraria).title(\"Livraria Cultura - Bourbon Country\"));\n } else if(this.maps.getId() == 3){\n mMap.addMarker(new MarkerOptions().position(livraria).title(\"Livraria Cameron\"));\n } else if(this.maps.getId() == 4){\n mMap.addMarker(new MarkerOptions().position(livraria).title(\"Livraria Siciliano\"));\n }\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(livraria, 15f));\n mMap.getUiSettings().setZoomControlsEnabled(true);\n\n }", "private void setUpMapIfNeeded() {\n if (mMap == null) {\n // Try to obtain the map from the SupportMapFragment.\n mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))\n .getMap();\n // Check if we were successful in obtaining the map.\n if (mMap != null) {\n Intent info = getIntent();\n setUpMap(new LatLng(info.getDoubleExtra(\"latitude\", 0), info.getDoubleExtra(\"longitude\", 0)), info.getStringExtra(\"name\"));\n }\n }\n }", "private void setUpMapIfNeeded() {\n if (mMap == null) {\n SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()\n .findFragmentById(R.id.map);\n mapFragment.getMapAsync(this);\n }\n }", "private void setUpMapIfNeeded() {\n if (mMap == null) {\n // Try to obtain the map from the SupportMapFragment.\n mMap = mMapFragment.getMap();\n // Check if we were successful in obtaining the map.\n if (mMap != null) {\n Log.i(TAG, \"Yes, we have a google map...\");\n setUpMap();\n } else {\n // means that Google Service is not available\n form.dispatchErrorOccurredEvent(this, \"setUpMapIfNeeded\",\n ErrorMessages.ERROR_GOOGLE_PLAY_NOT_INSTALLED);\n }\n\n }\n }", "private void setupMap() {\n int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getBaseContext());\n \t\tif ( status != ConnectionResult.SUCCESS ) {\n \t\t\t// Google Play Services are not available.\n \t\t\tint requestCode = 10;\n \t\t\tGooglePlayServicesUtil.getErrorDialog( status, this, requestCode ).show();\n \t\t} else {\n \t\t\t// Google Play Services are available.\n \t\t\tif ( this.googleMap == null ) {\n \t\t\t\tFragmentManager fragManager = this.getSupportFragmentManager();\n \t\t\t\tSupportMapFragment mapFrag = (SupportMapFragment) fragManager.findFragmentById( R.id.edit_gpsfilter_area_google_map );\n \t\t\t\tthis.googleMap = mapFrag.getMap();\n \n \t\t\t\tif ( this.googleMap != null ) {\n \t\t\t\t\t// The Map is verified. It is now safe to manipulate the map.\n \t\t\t\t\tthis.configMap();\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t}", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n // Add a marker in Sydney and move the camera\n LatLng liege = new LatLng(50.620552, 5.581177);\n LatLng victime = new LatLng(50.620957, 5.582263);\n mMap.addMarker(new MarkerOptions()\n .position(liege)\n .title(\"You are here !\")\n .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_YELLOW)));\n mMap.addMarker(new MarkerOptions()\n .position(victime)\n .title(\"Aurélie\")\n .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)));\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(liege,17));\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n\n // Add a marker in Sydney and move the camera\n LatLng parque = new LatLng(latitud, longitud);\n mMap.addMarker(new MarkerOptions().position(parque).title(lugar).icon(BitmapDescriptorFactory.fromResource(R.drawable.icons8_terraria_48)));\n mMap.moveCamera(CameraUpdateFactory.newLatLng(parque));\n mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(latitud, longitud),16.0f));\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n this.googleMap = googleMap;\n marker = googleMap.addMarker(markerOptions);\n googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));\n\n }", "private void setUpMapIfNeeded() {\n // Do a null check to confirm that we have not already instantiated the map.\n if (mMap == null) {\n // Try to obtain the map from the SupportMapFragment.\n mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))\n .getMap();\n mMap.setOnMarkerDragListener(this);\n // Check if we were successful in obtaining the map.\n if (mMap != null) {\n setUpMap();\n }\n }\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n buildGoogleApiClient();\n mMap.setMyLocationEnabled(true);\n\n }", "private void setUpMapIfNeeded() {\r\n if (map == null) {\r\n SupportMapFragment smf = null;\r\n smf = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);\r\n\r\n if (smf != null) {\r\n map = smf.getMap();\r\n if (map != null) {\r\n map.setMyLocationEnabled(true);\r\n }\r\n }\r\n }\r\n }", "@Override\n public void onMapReady(GoogleMap googleMap) {\n mMap = googleMap;\n mMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() {\n @Override\n public void onMapLoaded() {\n mapLoaded = true;\n waitForMapPlease();\n }\n });\n }" ]
[ "0.818836", "0.80435586", "0.8037214", "0.80335456", "0.79989773", "0.7977776", "0.795855", "0.7958179", "0.79548806", "0.7943136", "0.79374355", "0.7930872", "0.7915821", "0.79054713", "0.7890076", "0.78858536", "0.78858536", "0.78858536", "0.78858536", "0.7878132", "0.7845561", "0.78288746", "0.7820343", "0.7813879", "0.77974796", "0.7792897", "0.7787348", "0.77872163", "0.7764057", "0.7745415", "0.77431375", "0.7736697", "0.7730742", "0.7687352", "0.7674619", "0.7667946", "0.7667107", "0.76610047", "0.7660795", "0.7658657", "0.76579577", "0.76468956", "0.7640398", "0.76344794", "0.76288193", "0.76226294", "0.762222", "0.7619332", "0.7617938", "0.76100194", "0.7606094", "0.7600498", "0.7599349", "0.75936055", "0.75862086", "0.7585576", "0.7580679", "0.75722396", "0.7568258", "0.756524", "0.7564294", "0.75538987", "0.75520563", "0.7545412", "0.75443786", "0.75402915", "0.7530627", "0.7527199", "0.75204253", "0.75186056", "0.7516181", "0.74931604", "0.74914324", "0.7490549", "0.7487268", "0.7474037", "0.7468443", "0.74630255", "0.745885", "0.74581325", "0.7452987", "0.7451756", "0.74503934", "0.7448543", "0.7438022", "0.7430205", "0.7425193", "0.74189657", "0.74182457", "0.74177843", "0.7412122", "0.7410382", "0.74087656", "0.7400986", "0.7396589", "0.7394996", "0.7390116", "0.7389064", "0.73785", "0.73695856", "0.7359476" ]
0.0
-1
Got last known location. In some rare situations this can be null.
@Override public void onSuccess(Location location) { if (location != null) { LatLng myLocation = new LatLng(location.getLatitude(), location.getLongitude()); mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(myLocation, 15)); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private Location getLastKnownLocation(){\n \t \tLocation loc = LocationUtil.getBestLastKnowLocation(ctx);\t\n \t \tStatus.getCurrentStatus().setLocation(loc);\t\n \t \treturn loc;\n \t}", "public Location getLastLocation() {\n\t\tif (mLocationClient.isConnected()) {\n\t\t\treturn mLocationClient.getLastLocation();\n\t\t}\n\t\treturn null;\n\t}", "public static Location getLatestLocation(){\n if(latestLocation!= null) {\n return latestLocation;\n }else{\n return null;\n }\n }", "private Location getLastLocation() {\n try {\n return LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);\n } catch (SecurityException e) {\n e.printStackTrace();\n return null;\n }\n }", "@SuppressLint(\"MissingPermission\")//Assumes that is checked before calling\n private Location getLastLocation (){\n List<String> providers = mLocationManager.getProviders(true);\n Location loc=null;\n for (int i=0; i<providers.size() && loc==null;i++){\n loc = mLocationManager.getLastKnownLocation(providers.get(i));\n }\n return loc;\n }", "public abstract Location getLastLocation();", "public Location getLocation() {\n return getLocation(null);\n }", "public String getLastLocation() {\n return lastLocation;\n }", "public Location getLocation() {\n\n if (isPermissionGranted()) {\n try\n {\n\n lastKnownLocation = LocationServices.FusedLocationApi\n .getLastLocation(googleApiClient);\n\n Log.e(TAG, \"getLocation: LAST KNOWN LOCATION\" + (lastKnownLocation==null));\n return lastKnownLocation;\n }\n catch (SecurityException e)\n {\n e.printStackTrace();\n }\n }\n\n return null;\n\n }", "@SuppressLint(\"MissingPermission\")\n public Location getLastLocation() {\n this.context=context;\n if (isPermissionGranted()) {\n PrintLog.d(TAG, \"getLastLocation ..............: \");\n fusedLocationProviderClient.getLastLocation()\n .addOnCompleteListener(context, new OnCompleteListener<Location>() {\n @Override\n public void onComplete(@NonNull Task<Location> task) {\n if (task.isSuccessful() && task.getResult() != null) {\n mLastLocation = task.getResult();\n String result = \"Last known Location Latitude is \" +\n mLastLocation.getLatitude() + \"\\n\" +\n \"Last known longitude Longitude is \" + mLastLocation.getLongitude();\n PrintLog.d(TAG, \"getLastLocation ..............: \" + result);\n\n if (mLastLocation != null) {\n mLastLocation = mLastLocation;\n locationFetchedCallback.onLocationFetched(mLastLocation);\n }\n\n } else {\n callCurrentLocation();\n PrintLog.d(TAG, \"No Last known location found. Try current location..!\");\n }\n }\n });\n\n\n return mLastLocation;\n } else\n checkpermission();\n return null;\n }", "public Location getLocation() {\n try {\n initLocation();\n Location location = locationManager.getLastKnownLocation(locationProviderName);\n if (location == null) {\n Logger.e(\"Cannot obtain location from provider \" + locationProviderName);\n return new Location(\"unknown\");\n }\n return location;\n } catch (IllegalArgumentException e) {\n Logger.e(\"Cannot obtain location\", e);\n return new Location(\"unknown\");\n }\n }", "public Location getLastKnownLocation(String provider){\n\t\tif(provider.equals(GPS_PROVIDER)){\n\t\t\treturn locyNavigator.getLocation();\n\t\t}else\n\t\t\treturn null;\n\n\t}", "@SuppressWarnings(\"MissingPermission\")\n private void getLastLocation() {\n mFusedLocationClient.getLastLocation()\n .addOnCompleteListener(getActivity(), new OnCompleteListener<Location>() {\n @Override\n public void onComplete(@NonNull Task<Location> task) {\n if (task.isSuccessful() && task.getResult() != null) {\n mLastLocation = task.getResult();\n getWeather(mLastLocation);\n } else {\n Log.w(TAG, \"getLastLocation:exception\", task.getException());\n showSnackbar(getString(R.string.no_location_detected));\n }\n }\n });\n }", "private void fetchLastLocation() {\n try {\n FusedLocationProviderClient fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this);\n //get last known location of device\n Task<Location> task = fusedLocationProviderClient.getLastLocation();\n\n task.addOnSuccessListener(new OnSuccessListener<Location>() {\n @Override\n public void onSuccess(Location location) {\n if (location != null) {\n //store current location\n currentLocation = location;\n Toast.makeText(MapsActivity.this, currentLocation.getLatitude() + \" \" + currentLocation.getLongitude(), Toast.LENGTH_SHORT).show();\n // Obtain the SupportMapFragment\n supportMapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_content);\n // Attach OnMapReadyCallback listener using getMapAsync(OnMapReadyCallback)\n // This listener notified when the map is ready by invoking onMapReady along with a GoogleMap object.\n supportMapFragment.getMapAsync(MapsActivity.this);\n } else {\n Toast.makeText(MapsActivity.this, \"No Location recorded\", Toast.LENGTH_SHORT).show();\n }\n }\n });\n } catch (SecurityException e) {\n Log.e(\"Exception: %s\", e.getMessage());\n }\n }", "public URI getLocation()\r\n/* 293: */ {\r\n/* 294:441 */ String value = getFirst(\"Location\");\r\n/* 295:442 */ return value != null ? URI.create(value) : null;\r\n/* 296: */ }", "public google.maps.fleetengine.v1.VehicleLocation getLastLocation() {\n if (lastLocationBuilder_ == null) {\n return lastLocation_ == null ? google.maps.fleetengine.v1.VehicleLocation.getDefaultInstance() : lastLocation_;\n } else {\n return lastLocationBuilder_.getMessage();\n }\n }", "@java.lang.Override\n public google.maps.fleetengine.v1.VehicleLocation getLastLocation() {\n return lastLocation_ == null ? google.maps.fleetengine.v1.VehicleLocation.getDefaultInstance() : lastLocation_;\n }", "public Location getLastLocation() {\n return LocationServices.FusedLocationApi.getLastLocation(\n mGoogleApiClient);\n }", "@Nullable\n public Location getCurrentLocation() {\n if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n return null;\n }\n LocationManager mLocationManager = (LocationManager) getActivity().getApplicationContext().getSystemService(Context.LOCATION_SERVICE);\n List<String> providers = mLocationManager.getProviders(true);\n Location bestLocation = null;\n for (String provider : providers) {\n Location l = mLocationManager.getLastKnownLocation(provider);\n if (l == null) {\n continue;\n }\n if (bestLocation == null || l.getAccuracy() < bestLocation.getAccuracy()) {\n // Found best last known location: %s\", l);\n bestLocation = l;\n }\n }\n return bestLocation;\n }", "public void getLastLocation() {\n FusedLocationProviderClient locationClient = getFusedLocationProviderClient(this);\r\n\r\n locationClient.getLastLocation()\r\n .addOnSuccessListener(new OnSuccessListener<Location>() {\r\n @Override\r\n public void onSuccess(Location location) {\r\n // GPS location can be null if GPS is switched off\r\n if (location != null) {\r\n onLocationChanged(location);\r\n }\r\n }\r\n })\r\n .addOnFailureListener(new OnFailureListener() {\r\n @Override\r\n public void onFailure(@NonNull Exception e) {\r\n Log.d(\"MapDemoActivity\", \"Error trying to get last GPS location\");\r\n e.printStackTrace();\r\n }\r\n });\r\n }", "public Location getCurrentLocation();", "Location getLocation();", "Location getLocation();", "Location getLocation();", "Location getLocation();", "public Location checkLastLocationClicked()\n {\n Location loc = lastLocationClicked;\n lastLocationClicked = null;\n return loc;\n }", "@SuppressWarnings(\"unused\")\n Location getCurrentLocation();", "private void getLastKnownLocation(final OnResultListener callback) {\n try {\n getLocationProvider().getLastLocation()\n .addOnSuccessListener(location -> callback.onResult(location))\n .addOnCanceledListener(() -> callback.onResult(null))\n .addOnFailureListener(exception -> callback.onResult(null));\n } catch (SecurityException e) {\n callback.onResult(null);\n }\n }", "public double getLastLatitude(){\n if(location != null){\n lastLatitude = location.getLatitude();\n }else{\n lastLatitude = longitude;\n }\n return lastLatitude;\n }", "@Override\n\tpublic String getLocation() {\n\t\treturn null;\n\t}", "@Override\n\tpublic String getLocation() {\n\t\treturn null;\n\t}", "@SuppressWarnings({\"MissingPermission\"})\n public void getLastLocation() {\n if (isLocationEnabled()) {\n mFusedLocationClient.getLastLocation()\n .addOnSuccessListener(new OnSuccessListener<Location>() {\n @Override\n public void onSuccess(Location location) {\n // GPS location can be null if GPS is switched off\n if (location != null) {\n Toast.makeText(getContext(), \"location: \" + location, Toast.LENGTH_LONG).show();\n EventBus.getDefault().post(new LocationEvent(location));\n }\n }\n })\n .addOnFailureListener(new OnFailureListener() {\n @Override\n public void onFailure(@NonNull Exception e) {\n Log.d(\"MapDemoActivity\", \"Error trying to get last GPS location\");\n e.printStackTrace();\n }\n });\n }\n }", "public void getLastLocation() {\n FusedLocationProviderClient locationClient = getFusedLocationProviderClient(this);\n\n\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n // TODO: Consider calling\n // ActivityCompat#requestPermissions\n // here to request the missing permissions, and then overriding\n // public void onRequestPermissionsResult(int requestCode, String[] permissions,\n // int[] grantResults)\n // to handle the case where the user grants the permission. See the documentation\n // for ActivityCompat#requestPermissions for more details.\n Toast.makeText(this, \"Permissions Not Granted \", Toast.LENGTH_SHORT).show();\n // return;\n }\n locationClient.getLastLocation()\n .addOnSuccessListener(new OnSuccessListener<Location>() {\n @Override\n public void onSuccess(Location location) {\n // GPS location can be null if GPS is switched off\n if (location != null) {\n onLocationChanged(location);\n findNearbyHospitals(location);\n }\n }\n })\n .addOnFailureListener(new OnFailureListener() {\n @Override\n public void onFailure(@NonNull Exception e) {\n Log.d(\"MapDemoActivity\", \"Error trying to get last GPS location\");\n e.printStackTrace();\n }\n });\n }", "private void getLastKnownLocation()\n {\n Log.d(\"TAG\", \"getLastKnownLocation()\");\n if ( checkPermission() )\n {\n lastLocation = LocationServices.FusedLocationApi.getLastLocation(googleApiClient);\n if ( lastLocation != null )\n {\n Log.i(\"TAG\", \"LasKnown location. \" + \"Long: \" + lastLocation.getLongitude() + \" | Lat: \" + lastLocation.getLatitude());\n writeLastLocation();\n startLocationUpdates();\n }\n else\n {\n Log.w(\"TAG\", \"No location retrieved yet\");\n startLocationUpdates();\n }\n }\n else askPermission();\n }", "private void getLastKnownLocation() {\n Log.d(TAG, \"getLastKnownLocation()\");\n if (checkPermission()) {\n if (lastLocation != null) {\n Log.i(TAG, \"LasKnown location. \" +\n \"Long: \" + lastLocation.getLongitude() +\n \" | Lat: \" + lastLocation.getLatitude());\n\n markerLocation(new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude()));\n\n } else {\n Log.w(TAG, \"No location retrieved yet\");\n }\n } else askPermission();\n }", "@SuppressWarnings(\"WeakerAccess\")\n public Location getCurrentLocation() {\n final LocationClient locationClient = getLocationClient();\n return locationClient == null ? null: locationClient.getCurrentLocation();\n }", "private Location getLastKnownLocation(LocationManager mLocationManager) {\n List<String> providers = mLocationManager.getProviders(true);\n Location bestLocation = null;\n for (String provider : providers) {\n Location l = mLocationManager.getLastKnownLocation(provider);\n if (l == null) {\n continue;\n }\n if (bestLocation == null || l.getAccuracy() < bestLocation.getAccuracy()) {\n // Found best last known location: %s\", l);\n bestLocation = l;\n }\n }\n return bestLocation;\n }", "public BwLocation getLocation() {\n if (location == null) {\n location = BwLocation.makeLocation();\n }\n\n return location;\n }", "public Location getLocation(){\n\t\tWorld w = Bukkit.getWorld(worldName);\n\t\tif(w==null){\n\t\t\tSystem.out.println(\"Error, null world in Location from SQL\");\n\t\t\treturn null;\n\t\t}\n\t\treturn new Location(w, x+0.5, y, z+0.5);\n\t\t\n\t}", "public int getLocation() {\n\t\treturn 0;\n\t}", "java.lang.String getLocation();", "com.google.ads.googleads.v14.common.LocationInfo getLocation();", "public Location getLocation()\n\t{\n\t\treturn l;\n\t}", "public final Location getLocation() {\n\t\treturn location.clone();\n\t}", "public Location getLocation() {\n\t\treturn loc;\n\t}", "String getLocation();", "String getLocation();", "String getLocation();", "public int getLocation() {\n\t\tint location=super.getLocation();\n\t\treturn location;\n\t}", "public final String getLocation() {\n return location;\n }", "public int getLocation()\r\n {\n }", "public int getCurrentLocation() {\n\t\treturn currentLocation;\n\t}", "private void setLastLocation() {\n\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n == PackageManager.PERMISSION_GRANTED) {\n // Permission has already been granted\n mFusedLocationClient.getLastLocation()\n .addOnSuccessListener(this, new OnSuccessListener<Location>() {\n @Override\n public void onSuccess(Location location) {\n // Got last known location. In some rare situations this can be null.\n if (location != null) {\n lastLatitude = Double.toString(location.getLatitude());\n lastLongitude = Double.toString(location.getLongitude());\n //lastLocation = Double.toString(location.getLatitude()) + \",\" + Double.toString(location.getLongitude()) ;\n //String b = lastLocation;\n // Get into right format\n // Logic to handle location object\n }\n }\n });\n }\n }", "public Location getLocation() \n\t{\n\t\treturn location;\n\t}", "public int getLocation()\r\n {\r\n return location;\r\n }", "public Location getCurrentLocation()\n\t{\n\t\treturn currentLocation;\n\t}", "public String getLocation() {\r\n\t\treturn location; \r\n\t}", "public java.lang.String getLocation() {\n return location;\n }", "public java.lang.String getLocation() {\n return location;\n }", "private void getDeviceLocation() {\n /*\n * Get the best and most recent location of the device, which may be null in rare\n * cases when a location is not available.\n */\n try {\n if (mLocationPermissionGranted) {\n Task<Location> locationResult = mFusedLocationProviderClient.getLastLocation();\n locationResult.addOnCompleteListener(this, new OnCompleteListener<Location>() {\n @Override\n public void onComplete(@NonNull Task<Location> task) {\n if (task.isSuccessful()) {\n // Set the map's camera position to the current location of the device.\n mLastKnownLocation = task.getResult();\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(\n new LatLng(mLastKnownLocation.getLatitude(),\n mLastKnownLocation.getLongitude()), DEFAULT_ZOOM));\n showCurrentPlace();\n } else {\n Log.d(TAG, \"Current location is null. Using defaults.\");\n Log.e(TAG, \"Exception: %s\", task.getException());\n mMap.moveCamera(CameraUpdateFactory\n .newLatLngZoom(mDefaultLocation, DEFAULT_ZOOM));\n mMap.getUiSettings().setMyLocationButtonEnabled(false);\n }\n }\n });\n }\n } catch (SecurityException e) {\n Log.e(\"Exception: %s\", e.getMessage());\n }\n }", "public final Coord getLocation() {\n return location;\n }", "int getLocation() throws IllegalStateException;", "private void getDeviceLocation() {\n /*\n * Get the best and most recent location of the device, which may be null in rare\n * cases when a location is not available.\n */\n try {\n if (mLocationPermissionGranted) {\n Task<Location> locationResult = mFusedLocationProviderClient.getLastLocation();\n locationResult.addOnSuccessListener(this, new OnSuccessListener<Location>() {\n @Override\n public void onSuccess(Location location) {\n if (location != null) {\n // Set the map's camera position to the current location of the device.\n mLastKnownLocation = location;\n Log.d(TAG, \"Latitude: \" + mLastKnownLocation.getLatitude());\n Log.d(TAG, \"Longitude: \" + mLastKnownLocation.getLongitude());\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(\n new LatLng(mLastKnownLocation.getLatitude(),\n mLastKnownLocation.getLongitude()), DEFAULT_ZOOM));\n } else {\n Log.d(TAG, \"Current location is null. Using defaults.\");\n mMap.moveCamera(CameraUpdateFactory\n .newLatLngZoom(mDefaultLocation, DEFAULT_ZOOM));\n }\n\n getCurrentPlaceLikelihoods();\n }\n });\n }\n } catch (Exception e) {\n Log.e(\"Exception: %s\", e.getMessage());\n }\n }", "SiteLocation getLocatedAt();", "public String getLocation() {\r\n\t\treturn location;\r\n\t}", "public String getLocation() {\r\n return location;\r\n }", "@Nullable\n @Override\n public String getLocationString() {\n return null;\n }", "public Location getLocation() {\n return loc;\n }", "public Location getLocation() {\n return loc;\n }", "private void getDeviceLocation() {\n /*\n * Get the best and most recent location of the device, which may be null in rare\n * cases when a location is not available.\n */\n try {\n if (mLocationPermissionGranted) {\n Task<Location> locationResult = mFusedLocationProviderClient.getLastLocation();\n locationResult.addOnCompleteListener(this, new OnCompleteListener<Location>() {\n @Override\n public void onComplete(@NonNull Task<Location> task) {\n if (task.isSuccessful()) {\n // Set the map's camera position to the current location of the device.\n mLastKnownLocation = task.getResult();\n currLatLng = new LatLng(mLastKnownLocation.getLatitude(), mLastKnownLocation.getLongitude());\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(\n new LatLng(mLastKnownLocation.getLatitude(),\n mLastKnownLocation.getLongitude()), DEFAULT_ZOOM));\n destinationPoint.set(0,currLatLng);\n } else {\n Log.d(TAG, \"Current location is null. Using defaults.\");\n Log.e(TAG, \"Exception: %s\", task.getException());\n currLatLng = mDefaultLocation;\n mMap.moveCamera(CameraUpdateFactory\n .newLatLngZoom(mDefaultLocation, DEFAULT_ZOOM));\n mMap.getUiSettings().setMyLocationButtonEnabled(false);\n }\n }\n });\n }\n } catch (SecurityException e) {\n Log.e(\"Exception: %s\", e.getMessage());\n }\n }", "public Location getCurrentLocation() { return entity.getLocation(); }", "public String getLocation()\n {\n return location;\n }", "public Location getLocation() {\r\n\t\treturn location;\r\n\t}", "public Location getLocation() {\r\n\t\treturn location;\r\n\t}", "public Location getLocation ( ) {\n\t\treturn extract ( handle -> handle.getLocation ( ) );\n\t}", "public java.lang.String getLocation() {\n java.lang.Object ref = location_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n location_ = s;\n return s;\n }\n }", "public String getLocation() {\r\n return location;\r\n }", "public java.lang.String getLocation() {\n java.lang.Object ref = location_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n location_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public String getLocation() {\n\t\treturn location;\n\t}", "public String getLocation() {\n\t\treturn mLocation;\n\t}", "@Override\n\tpublic String getLocation() {\n\t\treturn this.location;\n\t}", "private void getDeviceLocation() {\n /*\n * Get the best and most recent location of the device, which may be null in rare\n * cases when a location is not available.\n */\n try {\n if (mLocationPermissionGranted) {\n Task<Location> locationResult = mFusedLocationProviderClient.getLastLocation();\n locationResult.addOnCompleteListener(mActivity, new OnCompleteListener<Location>() {\n @Override\n public void onComplete(@NonNull Task<Location> task) {\n if (task.isSuccessful()) {\n // Set the map's camera position to the current location of the device.\n mLastKnownLocation = task.getResult();\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(\n new LatLng(mLastKnownLocation.getLatitude(),\n mLastKnownLocation.getLongitude()), DEFAULT_ZOOM));\n } else {\n Log.d(TAG, \"Current location is null. Using defaults.\");\n Log.e(TAG, \"Exception: %s\", task.getException());\n mMap.moveCamera(CameraUpdateFactory\n .newLatLngZoom(mDefaultLocation, DEFAULT_ZOOM));\n mMap.getUiSettings().setMyLocationButtonEnabled(false);\n }\n }\n });\n }\n } catch (SecurityException e) {\n Log.e(\"Exception: %s\", e.getMessage());\n }\n }", "public Location getLocation() {\n\t\treturn location;\n\t}", "public java.lang.String getPreferredlocation() {\n return preferredlocation;\n }", "@java.lang.Override\n public google.maps.fleetengine.v1.VehicleLocationOrBuilder getLastLocationOrBuilder() {\n return getLastLocation();\n }", "public String getLocation() {\n return location;\n }", "public Location getLocation() {\n\t\treturn location.clone();\n\t}", "public String getLocation() { return location; }", "public String getLocation() { return location; }", "private void getDeviceLocation() {\n /*\n * Get the best and most recent location of the device, which may be null in rare\n * cases when a location is not available.\n */\n try {\n if (mLocationPermissionGranted) {\n Task<Location> locationResult = mFusedLocationProviderClient.getLastLocation();\n locationResult.addOnSuccessListener(this, new OnSuccessListener<Location>() {\n @Override\n public void onSuccess(Location location) {\n if (location != null) {\n // Set the map's camera position to the current location of the device.\n mLastKnownLocation = location;\n Log.d(TAG, \"Latitude: \" + mLastKnownLocation.getLatitude());\n Log.d(TAG, \"Longitude: \" + mLastKnownLocation.getLongitude());\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(\n new LatLng(mLastKnownLocation.getLatitude(),\n mLastKnownLocation.getLongitude()), DEFAULT_ZOOM));\n } else {\n Log.d(TAG, \"Current location is null. Using defaults.\");\n mMap.moveCamera(CameraUpdateFactory\n .newLatLngZoom(mDefaultLocation, DEFAULT_ZOOM));\n }\n\n }\n });\n }\n } catch (Exception e) {\n Log.e(\"Exception: %s\", e.getMessage());\n }\n }", "@Pure\n @NonNull\n public Location getLocation() {\n return this.location;\n }", "public synchronized Location m6501d() throws C0918i {\n Location lastKnownLocation;\n m6487e();\n lastKnownLocation = m6485a(true).getLastKnownLocation(m6503h());\n if (lastKnownLocation == null) {\n try {\n throw new C0918i(C0745b.m3222b(f2486z[10], new String[0]));\n } catch (C0918i e) {\n throw e;\n }\n }\n return lastKnownLocation;\n }", "@SuppressLint(\"MissingPermission\")\n private void getLastLocation() {\n if (checkPermissions()) {\n\n // check if location is enabled\n if (isLocationEnabled()) {\n\n // getting last\n // location from\n // FusedLocationClient\n // object\n mFusedLocationClient.getLastLocation().addOnCompleteListener(new OnCompleteListener<Location>() {\n @Override\n public void onComplete(@NonNull Task<Location> task) {\n Location location = task.getResult();\n if (location == null) {\n requestNewLocationData();\n } else {\n setUserCurrentLocation(location);\n }\n }\n });\n } else {\n Toast.makeText(this, \"Please turn on\" + \" your location...\", Toast.LENGTH_LONG).show();\n Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);\n startActivity(intent);\n }\n } else {\n // if permissions aren't available,\n // request for permissions\n requestPermissions();\n }\n }", "@Override\n public void onSuccess(Location location) {\n if (location != null) {\n // Logic to handle location object\n mLastLocation = location;\n Log.wtf(\"-GPS\", \"getLocation 169 : \" + mLastLocation.getLatitude() + \",\" + mLastLocation.getLongitude());\n\n } else {\n Log.wtf(\"-GPS\", \"getLocation 171 : \" + mLastLocation);\n\n }\n }", "public String getCurrentLocation() {\n return currentLocation;\n }", "public static MapLocation myLocation() {\n return RC.getLocation();\n }", "public String getLocation() {\n return location;\n }", "public String getLocation() {\n return location;\n }", "public String getLocation() {\n return location;\n }", "public String getLocation() {\n return location;\n }", "public String getLocation() {\n return location;\n }" ]
[ "0.8298965", "0.79684794", "0.78015167", "0.76988566", "0.76825714", "0.7584642", "0.75693685", "0.75532275", "0.75360984", "0.7416619", "0.7394422", "0.7291992", "0.7217621", "0.72050077", "0.7204059", "0.72032505", "0.71803224", "0.7136636", "0.7133068", "0.7099436", "0.70944506", "0.7039573", "0.7039573", "0.7039573", "0.7039573", "0.7038101", "0.70284486", "0.7025077", "0.69813275", "0.6976093", "0.6976093", "0.6957907", "0.6936544", "0.6924135", "0.6913619", "0.69032776", "0.68861735", "0.684722", "0.6835645", "0.683245", "0.6831902", "0.67983407", "0.67869884", "0.67826813", "0.6781497", "0.67695963", "0.67695963", "0.67695963", "0.6759863", "0.67552775", "0.67466754", "0.67446446", "0.6741331", "0.6740081", "0.6739652", "0.67354465", "0.6733024", "0.6724935", "0.6709143", "0.67090964", "0.6689425", "0.66838413", "0.66818047", "0.6681227", "0.6679346", "0.6666099", "0.6663205", "0.6657377", "0.6657377", "0.6657171", "0.6651345", "0.66473", "0.664337", "0.664337", "0.6637963", "0.6635693", "0.66265553", "0.6625345", "0.662525", "0.66245997", "0.66240996", "0.662249", "0.66146284", "0.6613315", "0.6613154", "0.6610779", "0.66094184", "0.659361", "0.659361", "0.6588833", "0.6585389", "0.65830076", "0.6577646", "0.6576716", "0.6575052", "0.65628415", "0.6561668", "0.6561668", "0.6561668", "0.6561668", "0.6561668" ]
0.0
-1
TODO: Warning this method won't work in the case the id fields are not set
@Override public boolean equals(Object object) { if (!(object instanceof SubCategories)) { return false; } SubCategories other = (SubCategories) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void setId(Integer id) { this.id = id; }", "private Integer getId() { return this.id; }", "public void setId(int id){ this.id = id; }", "public void setId(Long id) {this.id = id;}", "public void setId(Long id) {this.id = id;}", "public void setID(String idIn) {this.id = idIn;}", "public void setId(int id) { this.id = id; }", "public void setId(int id) { this.id = id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public void setId(long id) { this.id = id; }", "public void setId(long id) { this.id = id; }", "public int getId(){ return id; }", "public int getId() {return id;}", "public int getId() {return Id;}", "public int getId(){return id;}", "public void setId(long id) {\n id_ = id;\n }", "private int getId() {\r\n\t\treturn id;\r\n\t}", "public Integer getId(){return id;}", "public int id() {return id;}", "public long getId(){return this.id;}", "public int getId(){\r\n return this.id;\r\n }", "@Override public String getID() { return id;}", "public Long id() { return this.id; }", "public Integer getId() { return id; }", "@Override\n\tpublic Integer getId() {\n return id;\n }", "@Override\n public Long getId () {\n return id;\n }", "@Override\n public long getId() {\n return id;\n }", "public Long getId() {return id;}", "public Long getId() {return id;}", "public String getId(){return id;}", "@Override\r\n\tpublic Long getId() {\n\t\treturn null;\r\n\t}", "public Integer getId() { return this.id; }", "@Override\r\n public int getId() {\n return id;\r\n }", "@Override\n\t\tpublic long getId() {\n\t\t\treturn 0;\n\t\t}", "public int getId() {\n return id;\n }", "public long getId() { return _id; }", "public int getId() {\n/* 35 */ return this.id;\n/* */ }", "public long getId() { return id; }", "public long getId() { return id; }", "public void setId(Long id) \n {\n this.id = id;\n }", "@Override\n\tpublic Long getId() {\n\t\treturn null;\n\t}", "@Override\n\tpublic Long getId() {\n\t\treturn null;\n\t}", "public void setId(String id) {\n this.id = id;\n }", "@Override\n\tpublic void setId(Long id) {\n\t}", "public Long getId() {\n return id;\n }", "public long getId() { return this.id; }", "public int getId()\n {\n return id;\n }", "public void setId(int id){\r\n this.id = id;\r\n }", "@Test\r\n\tpublic void testSetId() {\r\n\t\tbreaku1.setId(5);\r\n\t\texternu1.setId(6);\r\n\t\tmeetingu1.setId(7);\r\n\t\tteachu1.setId(8);\r\n\r\n\t\tassertEquals(5, breaku1.getId());\r\n\t\tassertEquals(6, externu1.getId());\r\n\t\tassertEquals(7, meetingu1.getId());\r\n\t\tassertEquals(8, teachu1.getId());\r\n\t}", "protected abstract String getId();", "@Override\n\tpublic int getId(){\n\t\treturn id;\n\t}", "public int getID() {return id;}", "public int getID() {return id;}", "public String getId() { return id; }", "public String getId() { return id; }", "public String getId() { return id; }", "public int getId ()\r\n {\r\n return id;\r\n }", "@Override\n public int getField(int id) {\n return 0;\n }", "public void setId(Long id)\n/* */ {\n/* 66 */ this.id = id;\n/* */ }", "public int getId(){\r\n return localId;\r\n }", "void setId(int id) {\n this.id = id;\n }", "@Override\n public Integer getId() {\n return id;\n }", "@Override\n\tpublic Object selectById(Object id) {\n\t\treturn null;\n\t}", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "@Override\n public int getId() {\n return id;\n }", "@Override\n public int getId() {\n return id;\n }", "public void setId(int id)\n {\n this.id=id;\n }", "@Override\r\n public int getID()\r\n {\r\n\treturn id;\r\n }", "@Override\n\tpublic Integer getId() {\n\t\treturn null;\n\t}", "public int getId()\r\n {\r\n return id;\r\n }", "public void setId(Long id){\n this.id = id;\n }", "@java.lang.Override\n public int getId() {\n return id_;\n }", "@java.lang.Override\n public int getId() {\n return id_;\n }", "private void clearId() {\n \n id_ = 0;\n }", "final protected int getId() {\n\t\treturn id;\n\t}", "public abstract Long getId();", "public void setId(Long id) \r\n {\r\n this.id = id;\r\n }", "@Override\n public long getId() {\n return this.id;\n }", "public String getId(){ return id.get(); }", "@SuppressWarnings ( \"unused\" )\n private void setId ( final Long id ) {\n this.id = id;\n }", "public void setId(long id){\n this.id = id;\n }", "public void setId(long id){\n this.id = id;\n }", "public void setId(Integer id)\r\n/* */ {\r\n/* 122 */ this.id = id;\r\n/* */ }", "public Long getId() \n {\n return id;\n }", "@Override\n\tpublic void setId(int id) {\n\n\t}", "public void test_getId() {\n assertEquals(\"'id' value should be properly retrieved.\", id, instance.getId());\n }", "@Override\r\n\tpublic Object getId() {\n\t\treturn null;\r\n\t}", "public int getID(){\n return id;\n }", "public int getId()\n {\n return id;\n }", "public String getID(){\n return Id;\n }" ]
[ "0.6896886", "0.6838461", "0.67056817", "0.66419715", "0.66419715", "0.6592331", "0.6579151", "0.6579151", "0.6574321", "0.6574321", "0.6574321", "0.6574321", "0.6574321", "0.6574321", "0.65624106", "0.65624106", "0.65441847", "0.65243006", "0.65154546", "0.6487427", "0.6477893", "0.6426692", "0.6418966", "0.6416817", "0.6401561", "0.63664836", "0.63549376", "0.63515353", "0.6347672", "0.6324549", "0.6319196", "0.6301484", "0.62935394", "0.62935394", "0.62832105", "0.62710917", "0.62661785", "0.6265274", "0.6261401", "0.6259253", "0.62559646", "0.6251244", "0.6247282", "0.6247282", "0.6245526", "0.6238957", "0.6238957", "0.6232451", "0.62247443", "0.6220427", "0.6219304", "0.6211484", "0.620991", "0.62023336", "0.62010616", "0.6192621", "0.61895776", "0.61895776", "0.61893976", "0.61893976", "0.61893976", "0.6184292", "0.618331", "0.61754644", "0.6173718", "0.6168409", "0.6166131", "0.6161708", "0.6157667", "0.6157667", "0.6157667", "0.6157667", "0.6157667", "0.6157667", "0.6157667", "0.61556244", "0.61556244", "0.61430943", "0.61340135", "0.6128617", "0.6127841", "0.61065215", "0.61043483", "0.61043483", "0.6103568", "0.61028486", "0.61017346", "0.6101399", "0.6098963", "0.6094214", "0.6094", "0.6093529", "0.6093529", "0.6091623", "0.60896", "0.6076881", "0.60723215", "0.6071593", "0.6070138", "0.6069936", "0.6069529" ]
0.0
-1
Instantiates a new invalid login credentials exception.
public InvalidLoginCredentialsException( final LoginCredentials loginCredentials) { super(); this.loginCredentials = loginCredentials; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public LoginUnauthorizedException() {\r\n }", "public AuthenticationException() {\n }", "public InvalidCredentialsException(String message, Throwable cause) {\n/* 64 */ super(message, cause);\n/* */ }", "public CredentialManagerException() {\n\t\tsuper();\n\t}", "public LoginException(String exceptionMessage) {\n super(exceptionMessage);\n\t}", "public AuthException()\n {\n\n }", "public AuthenticationException() {\n\t\tsuper();\n\t}", "public InvalidPasswordException() {\n\t\tsuper(\"Invalid Password\");\n\t}", "public AuthenticationException() {\n super(\"common.msg.authentication\");\n }", "public InvalidUsernameException () {\n super();\n }", "public AuthenticationException(String key) {\n super(key);\n }", "public AuthenticationException(String message) {\n super(message);\n }", "public AuthException(String message, Exception ex)\n {\n super(message,ex);\n }", "public JiraServiceSecurityTokenExpiredException() {\r\n }", "public AuthException(String message)\n {\n super(message);\n }", "@Test\n\tpublic void testLoginAdminAccountWithInvalidCredentials() {\n\t\tassertEquals(2, adminAccountService.getAllAdminAccounts().size());\n\n\t\tString error = null;\n\t\tAdminAccount user = null; \n\t\ttry {\n\t\t\tuser = adminAccountService.loginAdminAccount(USERNAME2, PASSWORD1);\n\t\t} catch (InvalidInputException e) {\n\t\t\terror = e.getMessage();\n\t\t}\n\n\t\tassertNull(user);\n\t\t// check error\n\t\tassertEquals(\"Username or password incorrect. Please try again.\", error);\n\t}", "public AuthenticationException(String key, String urlname) {\n super(key, urlname);\n }", "public LoginUnauthorizedException(String msg) {\r\n super(msg);\r\n }", "public AuthenticationFailedException(String msg) {\r\n\t\tsuper(msg);\r\n\t}", "private void throwFailedLoginException(String msg) throws FailedLoginException\n {\n System.out.println(\"Throwing FailedLoginException(\"+msg+\")\");\n throw new FailedLoginException(msg);\n }", "public CalculadoraException() {\r\n }", "public InvalidEmployeeDetailsException(String exception) {\r\n super(exception);\r\n }", "public DAOException() {\r\n }", "@Test\n\tpublic void loginWithInvalidCredentials(){\n\t\tapp.loginScreen().waitUntilLoaded();\n\t\tapp.loginScreen().logIn(Credentials.USER_INVALID.username, Credentials.USER_INVALID.password);\n\t\tassertTrue(app.loginScreen().isActive());\n\t}", "public AuthenticationFailedException(String msg, Throwable cause) {\r\n\t\tsuper(msg, cause);\r\n\t}", "public InvalidUserDataException() {\n \n }", "public AuthenticationException(String message) {\n\t\tsuper(message);\n\t}", "public AuthenticationException(String message) {\n\t\tsuper(message);\n\t}", "public UnauthorizedException(String errorMessage) {\n\t\tsuper(errorMessage);\n\t}", "public void testInvalidAuthenticationCredentials() throws Exception {\n client = new PaysafeApiClient(\"username\", \"password\", Environment.TEST, merchantAccountNumber);\n\n try {\n SingleUseToken sObjResponse = client.customerVaultService().createSingleUseToken(\n SingleUseToken.builder()\n .card()\n .holderName(\"Mr. John Smith\")\n .cardNum(\"4917480000000008\")\n .cardExpiry()\n .month(7)\n .year(2019)\n .done()\n .billingAddress()\n .street(\"100 Queen Street West\")\n .street2(\"Unit 201\")\n .city(\"Toronto\")\n .country(\"CA\")\n .state(\"ON\")\n .zip(\"M5H 2N2\")\n .done()\n .done()\n .build());\n\n Assert.assertEquals(\"5279\", sObjResponse.getError().getCode());\n Assert.assertEquals(\"The authentication credentials are invalid.\",\n sObjResponse.getError().getMessage());\n\n } catch (IOException ioExp) {\n // Log IO Exception\n if(Constants.DEBUG_LOG_VALUE)\n Utils.debugLog(\"EXCEPTION TEST: \" + ioExp.getMessage());\n } catch (PaysafeException oExp) {\n // Log Paysafe Exception\n if(Constants.DEBUG_LOG_VALUE)\n Utils.debugLog(\"EXCEPTION TEST: \" + oExp.getMessage());\n } catch (Exception e) {\n // Log Exception\n if(Constants.DEBUG_LOG_VALUE)\n Utils.debugLog(\"EXCEPTION TEST: \" + e.getMessage());\n }\n }", "public InvalidUsernameException (String msg) {\n super(msg);\n }", "private void throwLoginException(String msg) throws LoginException\n {\n System.out.println(\"Throwing LoginException(\"+msg+\")\");\n throw new LoginException(msg);\n }", "public UserIDNotAvailableException(){\r\n super();\r\n }", "public SMSLibException() {}", "public WeekPasswordException() {\n\t\tsuper(formatMessage());\n\t}", "@Test(expected = IllegalArgumentException.class)\r\n public void constructorExceptionTest(){\n Owner invalid = new Owner(\"First\", \"Last\", \"333\");\r\n }", "public DataAccessLayerException() {\n }", "public UnauthorizedException() {\n\t\tsuper(\"User is not Authorized to do that.\");\n\t}", "public AuthenticationException(String message, Throwable cause) {\n super(message, cause);\n }", "public InvalidPasswordException(String message) {\n\t\tsuper(message);\n\t}", "public EmailException()\n {\n super();\n }", "public OrderServiceSecurityException() {\n\t}", "public InvalidPasswordException(Throwable cause) {\n\t\tsuper(cause);\n\t}", "public OLMSException() {\r\n super();\r\n }", "public InvalidPasswordException(String message, Throwable cause) {\n\t\tsuper(message, cause);\n\t}", "public NaoEhCuradorException(String username) {\n this.username = username;\n }", "public DataAccessorServiceException() {\n }", "public QueryException() {\n\n }", "public DuplicatedUserException() {\n super();\n }", "public UnmatchedException(){\r\n\r\n\t}", "public EmployeeNotFoundException() {\n super();\n }", "public DAOException()\r\n {\r\n super();\r\n }", "public InvalidGrantException(String msg) {\n super(msg);\n }", "public DaoException() {\r\n\t\tsuper();\r\n\t}", "private SmartServiceException createException(Throwable t, String key, Object... args) {\n return new SmartServiceException.Builder(getClass(), t).userMessage(key, args).build();\n }", "public UsuarioNotFoundException(){\r\n super(\"El usuario introducido no se ha encontrado\");\r\n }", "public OwnerAccessControlException(String groupName, String loginName) {\n super(loginName + \" is not a member of \" + groupName);\n this.groupName = groupName;\n this.loginName = loginName;\n }", "public AuthManagerException(String errorCode, String errorMessage) {\n\t\tsuper(errorMessage);\n\t\tthis.errorCode = errorCode;\n\t}", "public SysAccessCodeException(int code, String businessMessage)\n/* */ {\n/* 21 */ this(businessMessage);\n/* */ }", "public AuthenticationException(String message, Throwable cause) {\n\t\tsuper(message, cause);\n\t}", "@Deprecated\n\tpublic LoginException(Integer code, String message) {\n\t\tsuper(STATUS_CODE, code, message, null, null);\n\t}", "public NotValidException(String message) {\r\n super(message);\r\n }", "@Test(expected=RuntimeException.class)\n\tpublic void getUsernameExceptionTest() throws Exception {\n\t\tnew SecretCredentialsManagerImpl(null, \"true\", null, null) {\n\n\t\t\t@Override\n\t\t\tprotected SecretCache getSecretCache() {\n\t\t\t\tthrow new DecryptionFailureException(null);\n\t\t\t}\n\t\t}.getUsername();\n\t}", "public ItemInvalidoException() {\r\n }", "public JiraServiceException() {\r\n }", "@Test\n\tpublic void testAuthenticateAdminAccountWithInvalidToken() {\n\n\t\tString error = null;\n\t\tAdminAccount user = null;\n\t\ttry {\n\t\t\tuser = adminAccountService.authenticateAdminAccount(USERNAME2);\n\t\t} catch (InvalidInputException e) {\n\t\t\terror = e.getMessage();\n\t\t}\n\t\tassertNull(user);\n\t\t// check error\n\t\tassertEquals(\"An error occured. Please try again.\", error);\n\n\t}", "public EmployeeNotFoundException(String message) {\n super(message);\n }", "public AuthenticationException(Throwable cause) {\n\t\tsuper(cause);\n\t}", "public Exception() {\n\t\t\tsuper();\n\t\t}", "public HttpException() {\n }", "public StrongPasswordException(int code) {\n\t\tthis(code, (String) null);\n\t}", "public CaptchaIncorrectoException() {\n super(ERROR_KEY);\n }", "public AlreadyOnlineException() {\n\t\tsuper(\"The client is already logged in.\");\n\t\t\n\t\tthis.username = null;\n\t}", "@Test\n\tvoid new_GebruikerMetLegeEmail_ThrowsException() {\n\t\tAssertions.assertThrows(IllegalArgumentException.class, ()-> new Klant( \"test\", \"test\", \"test\", \"test\", null, 4000,\n\t\t\t\tnew Bedrijf()));\n\t}", "public SMSLibException(String errorMessage, Throwable originalE)\n/* 22: */ {\n/* 23:50 */ super(errorMessage);\n/* 24:51 */ this.originalE = originalE;\n/* 25: */ }", "public VariableNotSetException() {\n }", "public ValidationException(String userMessage, String logMessage) {\r\n super(userMessage, logMessage);\r\n }", "public YCAuthorizationException() {\n super();\n }", "public InvalidPlayerNumberException() {\n\n }", "public DynamicDeckDynamoException() {\n }", "public CryptoException(String err) {\n super(err);\n errMsg = err;\n }", "public Exception() {\n\tsuper();\n }", "public void testCtor_Failure1() {\r\n try {\r\n new TCAuthToken(-2);\r\n fail(\"IllegalArgumentException is expected.\");\r\n } catch (IllegalArgumentException e) {\r\n //success\r\n }\r\n }", "public InvalidSaleException(String sale)\r\n\t{\r\n\t\tsuper (sale);\r\n\t}", "public ShieldException() {\n }", "public ValidationException(String userMessage, String logMessage, String context) {\r\n super(userMessage, logMessage);\r\n setContext(context);\r\n }", "public EtudiantDejaInscritExceptionHolder(Etudes.EtudiantDejaInscritException initial)\r\n {\r\n value = initial;\r\n }", "private GmailErrorCodes() {\n }", "public void testApplicationsManagerExceptionAccuracy2() throws Exception {\n Exception e = new Exception(\"error1\");\n ApplicationsManagerException ce = new ApplicationsManagerException(\"error2\", e);\n assertEquals(\"message is incorrect.\", \"error2\", ce.getMessage());\n assertEquals(\"cause is incorrect.\", e, ce.getCause());\n }", "public CommandFailedByConfigException() {\n }", "public NoLowerAlphaException()\r\n { \r\n super(\"The password must contain at least one lowercase alphabetic character\"); \r\n }", "public XDBBaseException() {\n }", "public SenhaInvalidaException(String message) {\n\t\tsuper(message);\n\t}", "public StrongPasswordException(int code, String message) {\n\t\tthis(code, message, null);\n\t}", "public void testCtor_Failure() {\r\n try {\r\n new TCAuthToken(0);\r\n fail(\"IllegalArgumentException is expected.\");\r\n } catch (IllegalArgumentException e) {\r\n //success\r\n }\r\n }", "public EmployeeException(String message) {\n\t\tsuper(message);\n\t}", "public UserDataLoadException() {\n }", "@Test\n\tpublic void _01_loginWithInvalidCredentials() throws InterruptedException {\n\t\tlp = new LoginPage();\n\t\tThread.sleep(1000);\n\t\tsendText(lp.userName, \"effulgent\");\n\t\tlp.loginBtn.click();;\n\t\tsendText(lp.password, ConfigsReader.getProperty(\"password\"));\n\t\tlp.loginBtn.click();;\n\n\t\tThread.sleep(1000);//for demo purposes only\n\n\t\tAssertJUnit.assertTrue(lp.message.isDisplayed());\n\t\tString errorText = lp.message.getText().trim();\n\t\tAssertJUnit.assertEquals(\"Oops, that's not the right password. Please try again!\", errorText);\n\n\t}", "public InvalidMarkException() { }", "public BusinessObjectException() {\r\n super();\r\n }" ]
[ "0.73339176", "0.69022906", "0.6777771", "0.6589865", "0.65068895", "0.64897573", "0.64467", "0.6381281", "0.6343864", "0.6227447", "0.61274433", "0.59226376", "0.5916097", "0.5913293", "0.5875525", "0.58588755", "0.583085", "0.5810974", "0.577908", "0.57424647", "0.57033587", "0.56942254", "0.56920743", "0.5648182", "0.5635726", "0.5615636", "0.56080616", "0.56080616", "0.560545", "0.55876786", "0.5584573", "0.5583268", "0.5582279", "0.55714595", "0.5566578", "0.5564932", "0.555616", "0.55560344", "0.55490947", "0.5538902", "0.5537077", "0.55220544", "0.5517965", "0.5507468", "0.54868656", "0.5481654", "0.5449304", "0.5436911", "0.54206216", "0.5408762", "0.5405393", "0.5404539", "0.5395328", "0.5369499", "0.5364786", "0.53641856", "0.5363972", "0.5362431", "0.5357901", "0.53564113", "0.5351371", "0.53500724", "0.5344725", "0.5343561", "0.5341335", "0.53392416", "0.5335278", "0.5322719", "0.53207874", "0.5309185", "0.53089297", "0.5308854", "0.5304837", "0.53012526", "0.5281472", "0.52794474", "0.52751213", "0.5266663", "0.52652985", "0.52561146", "0.5249685", "0.5247745", "0.5237306", "0.5237164", "0.5236632", "0.5236046", "0.5232939", "0.5232151", "0.5231811", "0.5228916", "0.5226616", "0.52248544", "0.522283", "0.52098846", "0.52071613", "0.5206808", "0.520572", "0.5196306", "0.51856834", "0.518495" ]
0.6972389
1
Gets the login credentials.
public LoginCredentials getLoginCredentials() { return this.loginCredentials; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String getCredentials();", "private String[] getCredentials() {\n String[] cred = new String[2];\n System.out.print(\"Username: \");\n cred[0] = sc.nextLine();\n System.out.print(\"Password: \");\n cred[1] = sc.nextLine();\n return cred;\n }", "public LoginCredentials getGlobalCredentials() {\n return super.getCredentials();\n }", "private String getCredentials() {\n String credentials = \"\";\n AccountManager accountManager = AccountManager.get(getContext());\n\n final Account availableAccounts[] = accountManager.getAccountsByType(AccountGeneral.ACCOUNT_TYPE);\n\n //there should be only one ERT account\n if(availableAccounts.length > 0) {\n Account account = availableAccounts[0];\n AccountManagerFuture<Bundle> future = accountManager.getAuthToken(account, AccountGeneral.AUTHTOKEN_TYPE_FULL_ACCESS, null, null, null, null);\n try {\n Bundle bundle = future.getResult();\n String accountName = bundle.getString(AccountManager.KEY_ACCOUNT_NAME);\n String token = bundle.getString(AccountManager.KEY_AUTHTOKEN);\n credentials = accountName + \":\" + token;\n } catch (OperationCanceledException | IOException | AuthenticatorException e) {\n Log.e(LOG_TAG, e.getMessage());\n }\n }\n return credentials;\n }", "@Override\n public LoginCredentials getCredentials() {\n return (localSshCredentials != null) ? localSshCredentials : getGlobalCredentials();\n }", "@Override\n\tpublic Object getCredentials() {\n\t\treturn credentials;\n\t}", "public String getLogin () {\n return login;\n }", "public Object credentials() {\n return cred;\n }", "public String getLogin() {\n return login;\n }", "public String getLogin()\n {\n \treturn stringLogin;\n }", "public List<Authentication> getLoginCredentials(String username,String password) {\n // select * from administrators where adminID='Admin1' and password='123456';\n String loginQuery = \"SELECT * FROM administrators WHERE adminID = ? and password = ?\";\n return loginTemplate.query(loginQuery, (rs, rowNum) -> {\n Authentication authentication = new Authentication();\n authentication.setPassword(rs.getString(\"password\"));\n authentication.setUsername(rs.getString(\"adminID\"));\n\n System.out.println(authentication);\n return authentication;\n\n }, username,password\n );\n }", "public String getCredentials() {\n return serverGroup.getCredentials();\n }", "public List<String> loginParameters() {\n return this.loginParameters;\n }", "public Credentials getCredentials() {\n return mCredentials;\n }", "java.lang.String getCred();", "public AuthenticationCredentials getAuthenticationCredentials() {\n return authenticationCredentials;\n }", "public java.lang.String getLogin() {\n return login;\n }", "public java.lang.String getLogin() {\n return login;\n }", "public String getLogin() {\n\t\treturn login.getText();\n\t}", "public String getLoginPassword() {\n return loginPassword;\n }", "public String getLoginPassword() {\r\n return loginPassword;\r\n }", "public String getLoginPassword() {\r\n return loginPassword;\r\n }", "public String getLogin(){\r\n return login;\r\n }", "java.lang.String getLoginAccount();", "java.lang.String getLoginAccount();", "protected static Credentials getProxyCredentials() {\n if (!proxyUsernameSet) {\n return null;\n }\n String[] parts = getProxyUsername().split(\"\\\\\\\\\");\n if (parts.length > 1) {\n String domain = parts[0];\n String workstation = null;\n String user = parts[1];\n if (parts.length > 2) {\n workstation = user;\n user = parts[2];\n }\n return new Credentials(user, getProxyPassphrase(), domain, workstation);\n }\n return new Credentials(parts[0], getProxyPassphrase());\n }", "public java.lang.String getLogin() {\n\t\treturn login;\n\t}", "@Nullable\n public Credentials getCredentials() {\n return credentials;\n }", "public String getLoginAccount() {\n return loginAccount;\n }", "public Set<Credentials> getCredentials() {\n return credentials;\n }", "public Optional<String> getCredentials() {\n return Optional.ofNullable(credentials);\n }", "@DataProvider(name = \"Authentication\")\n\t public static Object[][] credentials() {\n\t return new Object[][] { { \"testuser_1\", \"Test@123\" }, { \"testuser_2\", \"Test@1234\" }}; \n\t }", "public static synchronized Credentials authenticate(String userName, String password){\n\t\t\tConnection connection;\n\t\t \tCredentials credentials=null;\n\t\t \t\n\t\t \tPreparedStatement statement=null;\n\t\t\tString preparedSQL = \"SELECT * FROM Credential WHERE Email = ? and Pass = ?\";\n\t\t\t\n\t\t try{\n\t\t \tconnection=DBConnector.getConnection();\n\t\t \tstatement = connection.prepareStatement(preparedSQL);\n\t\t \tstatement.setString(1, userName);\n\t\t \tstatement.setString(2, password);\n\t\t\t\tResultSet rs = statement.executeQuery();\n\t\t\t\tif(rs.next()){\n\t\t\t\t\tcredentials = new Credentials();\n\t\t\t\t\tcredentials.setCredID(rs.getInt(1));\n\t\t\t\t\tcredentials.setUserID(rs.getInt(2));\n\t\t\t\t\tcredentials.setEmail(rs.getString(3));\n\t\t\t\t\tcredentials.setPass(rs.getString(4));\n\t\t\t\t\tcredentials.setRole(rs.getString(5));\n\t\t\t\t\tcredentials.setValid(rs.getInt(6));\n\t\t\t\t\tcredentials.setRegKey(rs.getString(7));\n\t\t\t\t}\t\n\t\t\t\trs.close();\t\t\n\t\t\t\tstatement.close();\n\t\t\t\tconnection.close();\n\t\t\t\t\n\t\t\t}catch (SQLException ex){\n\t\t\t\t\tSystem.out.println(\"Error: \" + ex);\n\t\t\t\t\tSystem.out.println(\"Query: \" + statement.toString());\n\t\t\t\t\tcredentials = null;\n\t\t\t\t}\t\n\t\t\treturn credentials;\n\t}", "public static Pair<String, String> getLoginInfo(Context context) {\n SharedPreferences sharePreference = context.getSharedPreferences(preferenceName, Context.MODE_PRIVATE);\n byte[] emailRaw = Base64.decode(sharePreference.getString(KEY_EMAIL, \"\"), Base64.DEFAULT);\n byte[] pwdRaw = Base64.decode(sharePreference.getString(KEY_PWD, \"\"), Base64.DEFAULT);\n return new Pair<>(new String(emailRaw), new String(pwdRaw));\n }", "protected String getPassword(final String username) {\n return credentials.get(username);\n }", "@Override\n\tpublic User getUserWithCredentials(String username, String password) {\n\t\tUser loginUser=mobileDao.getLoginUser(username);\n\t\t//System.out.println(\"password is -\"+loginBean.getPassword());\n\t\tif(loginUser!=null)\n\t\t{\t\n\t\t\tif(password.equals(loginUser.getPassword()))\n\t\t\t\treturn loginUser;\n\t\t}\n\t\treturn null;\n\t}", "public Think.XmlWebServices.User_login_data getUser_login_data() {\n return user_login_data;\n }", "public Credential getCredential() {\n return this.credential;\n }", "public String[] getUsers(){\n try {\n names = credentials.keys();\n }catch (java.util.prefs.BackingStoreException e1){\n System.out.println(e1);\n }\n return names;\n }", "public static String getLogin(String username, String password)\n throws IOException {\n String loginUrl = getLoginUrl(username, password);\n\n return callHttp(loginUrl, \"GET\", null, null);\n }", "public Object getCredential()\n {\n return this.credential;\n }", "public Object getCredential()\n {\n return this.credential;\n }", "public Object getCredential()\n {\n return this.credential;\n }", "static String getAuth(String key) {\r\n try {\r\n Properties properties = new Properties();\r\n properties.load(new FileInputStream(new File(Run.CREDENTIALS_FILE_NAME)));\r\n\r\n return properties.getProperty(key);\r\n }\r\n catch(IOException e) {\r\n System.out.println(e.getMessage());\r\n }\r\n return null;\r\n }", "public Credentials getCredentials(AuthScope authscope)\n {\n return credentials;\n }", "public LoginMessageResponse getLoginResult() {\n return localLoginResult;\n }", "public String login()\n\t{\n\t\tString ret_ = \"\";\n\t\tAuthentication auth = SecurityContextHolder.getContext()\n\t\t\t\t.getAuthentication();\n\n\t\tif (!(auth instanceof AnonymousAuthenticationToken))\n\t\t{\n\t\t\tUserDetails ud_ = (UserDetails) auth.getPrincipal();\n\n\t\t\tfor (GrantedAuthority ga : ud_.getAuthorities())\n\t\t\t{\n\t\t\t\tif (ret_.length() > 0)\n\t\t\t\t\tret_ = ret_ + \",\";\n\t\t\t\tret_ = ret_ + ga.getAuthority();\n\t\t\t}\n\t\t\tif (ret_.length() > 0)\n\t\t\t\tret_ = \"/\" + ret_;\n\t\t\tret_ = ud_.getUsername() + ret_;\n\t\t}\n\t\treturn ret_;\n\t}", "protected Response login() {\n return login(\"\");\n }", "@Override\n\t\tpublic Object getCredentials() {\n\t\t\treturn null;\n\t\t}", "public String getLoginUsername() {\n return this.loginUsername;\n }", "public LoginSettings getLoginSettings() {\n return this.LoginSettings;\n }", "public static String[] readCredentials(boolean isAdmin) {\n String[] credentials = new String[4];\n\n System.out.println(\"CREDENTIALS must be at lest three characters long and may contain \" +\n \"only letters, digits, a dot sign or an underscore sign\");\n in.nextLine();\n\n System.out.println(\"Username (at least 3 characters): \");\n credentials[0] = in.nextLine();\n System.out.println(\"Password (at least 3 characters): \");\n credentials[1] = in.nextLine();\n System.out.println(\"Email: \");\n credentials[2] = in.nextLine();\n if (isAdmin) {\n System.out.println(\"Agency: \");\n credentials[3] = in.nextLine();\n } else {\n credentials[3] = \"CUSTOMER\";\n }\n return credentials;\n }", "public Login.Req getLoginReq() {\n return instance.getLoginReq();\n }", "public LoginModel getLogin() {\n return localLogin;\n }", "public String getLogin() {\n return this.session.sessionPersona().getUserName();\n }", "private String login() throws AxisFault {\n APIManagerConfiguration config = ServiceReferenceHolder.getInstance().\n getAPIManagerConfigurationService().getAPIManagerConfiguration();\n String user = config.getFirstProperty(APIConstants.API_GATEWAY_USERNAME);\n String password = config.getFirstProperty(APIConstants.API_GATEWAY_PASSWORD);\n String url = config.getFirstProperty(APIConstants.API_GATEWAY_SERVER_URL);\n\n if (url == null || user == null || password == null) {\n throw new AxisFault(\"Required API gateway admin configuration unspecified\");\n }\n\n String host;\n try {\n host = new URL(url).getHost();\n } catch (MalformedURLException e) {\n throw new AxisFault(\"API gateway URL is malformed\", e);\n }\n\n AuthenticationAdminStub authAdminStub = new AuthenticationAdminStub(\n ServiceReferenceHolder.getContextService().getClientConfigContext(),\n url + \"AuthenticationAdmin\");\n ServiceClient client = authAdminStub._getServiceClient();\n Options options = client.getOptions();\n options.setManageSession(true);\n try {\n authAdminStub.login(user, password, host);\n ServiceContext serviceContext = authAdminStub.\n _getServiceClient().getLastOperationContext().getServiceContext();\n String sessionCookie = (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING);\n return sessionCookie;\n } catch (RemoteException e) {\n throw new AxisFault(\"Error while contacting the authentication admin services\", e);\n } catch (LoginAuthenticationExceptionException e) {\n throw new AxisFault(\"Error while authenticating against the API gateway admin\", e);\n }\n }", "public List<UserCredential> getAllCredentials() {\n\t\t List<UserCredential> userCredentials = new ArrayList<>();\n\t\t \n\t\t credentialRepo.findAll().forEach(userCredential -> userCredentials.add(userCredential));\n\t\t \n\t\treturn userCredentials;\n\t}", "public Login.Res getLoginRes() {\n return instance.getLoginRes();\n }", "public LoginInfo getLoginInfo() {\n String __key = this.f_loginId;\n if (loginInfo__resolvedKey == null || loginInfo__resolvedKey != __key) {\n if (daoSession == null) {\n throw new DaoException(\"Entity is detached from DAO context\");\n }\n LoginInfoDao targetDao = daoSession.getLoginInfoDao();\n LoginInfo loginInfoNew = targetDao.load(__key);\n synchronized (this) {\n loginInfo = loginInfoNew;\n \tloginInfo__resolvedKey = __key;\n }\n }\n return loginInfo;\n }", "private HashMap<String, String> getclientCredentials(String strRequestXML) {\r\n\t\tlogger.info(\"Entering RequestValidator.getclientCredentials()\");\r\n\t\tHashMap<String, String> clientCredentialMap = new HashMap<String, String>();\r\n\t\ttry {\r\n\t\t\tDocumentBuilderFactory factory = DocumentBuilderFactory\r\n\t\t\t\t\t.newInstance();\r\n\t\t\tDocumentBuilder builder = factory.newDocumentBuilder();\r\n\t\t\tfactory.setNamespaceAware(true);\r\n\t\t\tDocument document = null;\r\n\t\t\tXPath xpath = XPathFactory.newInstance().newXPath();\r\n\t\t\tXPathExpression expression;\r\n\r\n\t\t\tdocument = builder.parse(new InputSource(new StringReader(\r\n\t\t\t\t\tstrRequestXML)));\r\n\t\t\tObject result;\r\n\t\t\tNodeList nodes;\r\n\r\n\t\t\texpression = xpath.compile(\"//\"\r\n\t\t\t\t\t+ PublicAPIConstant.IDENTIFICATION_USERNAME + \"/text()\");\r\n\t\t\tresult = expression.evaluate(document, XPathConstants.NODESET);\r\n\t\t\tnodes = (NodeList) result;\r\n\t\t\tclientCredentialMap.put(PublicAPIConstant.LOGIN_USERNAME, nodes\r\n\t\t\t\t\t.item(0).getNodeValue());\r\n\t\t\texpression = xpath.compile(\"//\"\r\n\t\t\t\t\t+ PublicAPIConstant.IDENTIFICATION_APPLICATIONKEY\r\n\t\t\t\t\t+ \"/text()\");\r\n\t\t\tresult = expression.evaluate(document, XPathConstants.NODESET);\r\n\t\t\tnodes = (NodeList) result;\r\n\t\t\tclientCredentialMap.put(PublicAPIConstant.API_KEY, nodes.item(0)\r\n\t\t\t\t\t.getNodeValue());\r\n\t\t\texpression = xpath.compile(\"//\"\r\n\t\t\t\t\t+ PublicAPIConstant.IDENTIFICATION_PASSWORD + \"/text()\");\r\n\t\t\tresult = expression.evaluate(document, XPathConstants.NODESET);\r\n\t\t\tnodes = (NodeList) result;\r\n\t\t\tclientCredentialMap.put(PublicAPIConstant.LOGIN_PASSWORD,\r\n\t\t\t\t\tCryptoUtil.generateHash(nodes.item(0).getNodeValue()));\r\n\t\t} catch (Exception e) {\r\n\t\t\tlogger.error(e);\r\n\t\t}\r\n\t\tlogger.info(\"Leaving RequestValidator.getclientCredentials()\");\r\n\t\treturn clientCredentialMap;\r\n\t}", "private void getGredentialsFromMemoryAndSetUser()\n\t{\n\t SharedPreferences settings = getSharedPreferences(LOGIN_CREDENTIALS, 0);\n\t String username = settings.getString(\"username\", null);\n\t String password = settings.getString(\"password\", null);\n\t \n\t //Set credentials to CouponsManager.\n\t CouponsManager.getInstance().setUser(new User(username, password));\n\t \n\t}", "public String authenticate() throws LoginException\r\n {\r\n HttpRequest conn = null;\r\n String cookie = \"\";\r\n conn = new HttpRequest(this.url, Method.POST);\r\n HttpResponse _response = conn.send(\"name=\" + username + \"&password=\" + password);\r\n if (_response.getStatus() == HttpURLConnection.HTTP_OK)\r\n {\r\n List<String> cookies = _response.getHeader(AUTH_COOKIE);\r\n for (String c : cookies)\r\n {\r\n this.cookieSession = c.split(\";\")[0];\r\n if (this.cookieSession != null)\r\n break;\r\n }\r\n cookie = this.cookieSession;\r\n }\r\n else if (_response.getStatus() == 401)\r\n {\r\n throw new LoginException(\"Access denied, unauthorized for user [\" + username + \"] and url [\" + url + \"]\");\r\n }\r\n else\r\n {\r\n throw new LoginException(\"Cannot make login in COUCHDB for user [\" + username + \"] and url [\" + url + \"]\"\r\n + \"Http code[\" + _response.getStatus() + \"] \" + _response.getBody());\r\n }\r\n return cookie;\r\n }", "LoginContext login(String username, String password) throws LoginException;", "public PasswordCredential getPasswordCredential() {\n return passCred;\n }", "private void getUserNamePwd() {\n\n try {\n // get Application Connection ID\n LogonCoreContext lgCtx = LogonCore.getInstance().getLogonContext();\n userName = lgCtx.getBackendUser();\n pwd = lgCtx.getBackendPassword();\n appConnID = LogonCore.getInstance().getLogonContext()\n .getConnId();\n } catch (LogonCoreException e) {\n LogManager.writeLogError(Constants.device_reg_failed_txt, e);\n }\n }", "@Override\n public Object getCredentials() {\n return token;\n }", "public java.lang.String getLoginAccount() {\n java.lang.Object ref = loginAccount_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n loginAccount_ = s;\n return s;\n }\n }", "public java.lang.String getLoginAccount() {\n java.lang.Object ref = loginAccount_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n loginAccount_ = s;\n return s;\n }\n }", "public final String getCredentialsFile() {\n return properties.get(CREDENTIALS_FILE_PROPERTY);\n }", "@DataProvider(name=\"SearchProvider\")\r\n\t public Object[][] getlogincredentials()\r\n\t {\n\t Object[][] cred=new Object[3][2];\r\n\t cred[0][0]=\"qaplanet1\";\r\n\t cred[0][1]=\"lab1\"; \r\n\t cred[1][0]=\"qaplanet2\";\r\n\t cred[1][1]=\"lab2\";\r\n\t cred[2][0]=\"qaplanet3\";\r\n\t cred[2][1]=\"lab3\";\r\n\t return cred; \r\n\t \r\n\t \r\n\t }", "public java.lang.String getLoginAccount() {\n java.lang.Object ref = loginAccount_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n loginAccount_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public java.lang.String getLoginAccount() {\n java.lang.Object ref = loginAccount_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n loginAccount_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public com.bingo.server.msg.REQ.LoginRequest getLogin() {\n return login_ == null ? com.bingo.server.msg.REQ.LoginRequest.getDefaultInstance() : login_;\n }", "public String getUserLoginName() {\n return userLoginName;\n }", "public CustomerEntity login(String username, String password) {\n return customerPersistencePort.getUser(username);\n }", "public String getLoginId() {\n return loginId;\n }", "public String getLoginId() {\r\n return loginId;\r\n }", "public String getLoginId() {\r\n return loginId;\r\n }", "@SuppressWarnings(\"unchecked\")\n\tpublic Collection<Object> getVerifiableCredentials() {\n\t\tObject list = jsonObject.get(JSONLD_KEY_VERIFIABLE_CREDENTIAL);\n\t\tif (list != null) {\n\t\t\treturn Collections.unmodifiableCollection((Collection<Object>)list);\n\t\t}\n\t\treturn null;\n\t}", "java.lang.String getAuth();", "java.lang.String getAuth();", "java.lang.String getAuth();", "@Override\n\tpublic String getLogin() {\n\t\tString pName= ctx.getCallerPrincipal().getName();\n\t\tPerson p=userEJB.findPerson(pName);\n\t\tString w=p.getLogin();\n\t\treturn w;\n\t}", "public String getLoginName() { \n return this.loginName;\n }", "public void logincredentials() {\n\t\tutil.entertext(prop.getValue(\"locators.text.uname\"), \"admin\");\n\t\tutil.entertext(prop.getValue(\"locators.text.password\"), \"Admin123\");\n\t\tutil.ClickElement(prop.getValue(\"locators.button.regdesk\"));\n\t\tutil.ClickElement(prop.getValue(\"locators.button.login\"));\n\t\tlogreport.info(\"logged into the application\");\n\n\t}", "public String getLoginKey() {\n\t\treturn this.loginKey;\n\t}", "private boolean _credList() \n {\n\n //File file = new File(loginFileLocation);\n File file = this._loginReader.getFile();\n String fileLocation = (file == null) ? null : file.getAbsolutePath();\n \n if (!file.canRead())\n {\n this._logger.info(\"No credentials exist.\");\n //this._logger.severe(\"Login Error! Please acquire credentials \"\n // + \"with login utility.\");\n System.exit(-1);\n }\n \n String format1 = \"EEE, d MMM yyyy HH:mm:ss Z\";\n String format2 = \"yyyy-MM-dd'T'HH:mm:ss.SSSZ\";\n DateFormat dateFormat = new SimpleDateFormat(format2);\n \n Date timeStamp = new Date(file.lastModified());\n this._logger.info(Constants.COPYRIGHT);\n this._logger.info(Constants.CLIENTVERSIONSTR);\n this._logger.info(Constants.APIVERSIONSTR);\n this._logger.info(\"\"); // empty line\n this._logger.info(\"Credential cache file: \" + fileLocation);\n this._logger.info(\"File modified on: \" + timeStamp.toString());\n String defUser = this._loginReader.getUsername();\n if (defUser != null)\n this._logger.info(\"Default principal: \" + defUser);\n else\n this._logger.info(\"No default principal specified.\");\n \n String[] sgroups = this._loginReader.getNamespaces();\n for (int i = 0; i < sgroups.length; ++i)\n {\n String ns = sgroups[i];\n if (!ns.equals(LoginFile.DEFAULT_NAMESPACE))\n {\n String user = this._loginReader.getUsername(ns, false);\n long expiry = this._loginReader.getExpiry(ns);\n if (user != null)\n {\n String line = \"Principal for group '\"+ns+\"' : \" + user;\n if (expiry != Constants.NO_EXPIRATION)\n {\n String date = dateFormat.format(new Date(expiry));\n if (expiry < System.currentTimeMillis())\n {\n line = line + \" (expired \"+date+\")\"; \n }\n else\n {\n line = line + \" (expires \"+date+\")\"; \n }\n }\n this._logger.info(line);\n }\n }\n }\n\n return true;\n }", "private static LoginInfo getLoginInfo() throws IOException {\n\t\tLoginInfo info = new LoginInfo();\n\t\tinfo.serverName = \"localhost\";\n\t\tinfo.serverPort = 5222;\n\n\t\t//Get selected user.\n\t\tString[] users = getAllUserName(userMap);\n\t\tSystem.out.println(\"Select from following users: \");\n\t\tfor (int i = 0; i < users.length; i++) {\n\t\t\tSystem.out.println(\"[\" + i + \"]: \" + users[i]);\n\t\t}\n\n\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t\tint selection = Integer.parseInt(in.readLine());\n\t\twhile (selection < 0 || selection > users.length) {\n\t\t\tSystem.out.println(\"Wrong selection, try again.\");\n\t\t\tselection = Integer.parseInt(in.readLine());\n\t\t}\n\n\t\tinfo.user = users[selection];\n\t\tinfo.password = userMap.get(info.user);\n\t\tSystem.out.println(\"Login with user: '\" + users[selection] + \"' on server: '\" + info.serverName + \"' port:\" + info.serverPort);\n\t\treturn info;\n\t}", "public String loginUser(Credentials credentials) throws Exception {\n\n\t\tString url = server_url + \"/user/login\";\n\t\tURL obj = new URL(url);\n\t\tHttpURLConnection con = (HttpURLConnection) obj.openConnection();\n\n\t\t//add request header\n\t\tcon.setRequestMethod(\"POST\");\n\t\tcon.setRequestProperty(\"User-Agent\", \"Mozilla/5.0\");\n\t\tcon.setRequestProperty(\"Accept-Language\", \"en-US,en;q=0.5\");\n\n\t\t//String urlParameters = \"username=\" + credentials.username + \"&password=\" + credentials.password;\n\t\tJsonObject urlParameters = new JsonObject();\n\t\turlParameters.addProperty(\"username\", credentials.username);\n\t\turlParameters.addProperty(\"password\", credentials.password);\n\t\t\n\t\t// Send post request\n\t\tcon.setDoOutput(true);\n\t\tDataOutputStream wr = new DataOutputStream(con.getOutputStream());\n\t\twr.writeBytes(urlParameters.toString());\n\t\twr.flush();\n\t\twr.close();\n\n\t\tint responseCode = con.getResponseCode();\n\t\t\n\t\tif (responseCode != 200) {\n\t\t\treturn \"Failure\";\n\t\t}\n\t\t////System.out.println(\"\\nSending 'POST' request to URL : \" + url);\n\t\t////System.out.println(\"Post parameters : \" + urlParameters);\n\t\t////System.out.println(\"Response Code : \" + responseCode);\n\t\t\n\t\tif (responseCode == 400) {\n\t\t\tthrow new Exception();\n\t\t}\n\t\t\n\t\t//When we log in the server gives us a cookie that keeps the user identity\n\t\tusercookie = con.getHeaderField(\"set-cookie\");\n\t\tusercookie = usercookie.substring(0, usercookie.length() - 8);\n\n//\t\t@SuppressWarnings(\"deprecation\")\n//\t\tString decodedUserCookie = URLDecoder.decode(usercookie.substring(11));\n//\t\t\n//\t\tJsonParser jsonParser = new JsonParser();\n//\t\tJsonObject element = jsonParser.parse(decodedUserCookie).getAsJsonObject();\n\n\t\tBufferedReader in = new BufferedReader(\n\t\t new InputStreamReader(con.getInputStream()));\n\t\tString inputLine;\n\t\tStringBuffer response = new StringBuffer();\n\n\t\twhile ((inputLine = in.readLine()) != null) {\n\t\t\tresponse.append(inputLine);\n\t\t}\n\t\tin.close();\n\t\t\n\t\treturn response.toString();\n\t}", "public Optional<AuthLogin> authLogin() {\n return Codegen.objectProp(\"authLogin\", AuthLogin.class).config(config).get();\n }", "public String getLoginID(){\r\n return loginID;\r\n }", "public String getLoginToken() {\n return loginToken;\n }", "public UserData login() {\n return null;\n }", "java.lang.String getPwd();", "public String getLoginName() {\n return loginName;\n }", "public String getLoginName() {\n return loginName;\n }", "public String getLoginName() {\n return loginName;\n }", "public String getLoginName() {\n return loginName;\n }", "public com.bingo.server.msg.REQ.LoginRequestOrBuilder getLoginOrBuilder() {\n return getLogin();\n }", "public com.bingo.server.msg.REQ.LoginRequest getLogin() {\n if (loginBuilder_ == null) {\n return login_ == null ? com.bingo.server.msg.REQ.LoginRequest.getDefaultInstance() : login_;\n } else {\n return loginBuilder_.getMessage();\n }\n }" ]
[ "0.73817265", "0.73052764", "0.6923846", "0.68046707", "0.68040234", "0.6712264", "0.6699981", "0.6697242", "0.664334", "0.6599602", "0.65592575", "0.6546151", "0.6512396", "0.6508838", "0.6507901", "0.649907", "0.64930624", "0.64930624", "0.6455343", "0.6372645", "0.6355589", "0.6355589", "0.63463813", "0.6319828", "0.6319828", "0.6311357", "0.6288966", "0.62883776", "0.6249167", "0.61960715", "0.6161121", "0.612443", "0.6089405", "0.6088259", "0.6082555", "0.60800564", "0.60755765", "0.6043933", "0.6033116", "0.6032972", "0.60189056", "0.60189056", "0.60189056", "0.6014021", "0.60017097", "0.5995928", "0.5992697", "0.5988632", "0.59834", "0.59397143", "0.5938017", "0.5922418", "0.5912172", "0.5903006", "0.58973944", "0.5877997", "0.587008", "0.5867646", "0.58656484", "0.58621794", "0.5844526", "0.58375984", "0.5831169", "0.58286166", "0.58210427", "0.5808938", "0.58088976", "0.58088976", "0.58076763", "0.5804474", "0.58012694", "0.58012694", "0.57845676", "0.5783215", "0.57763535", "0.57702047", "0.57477134", "0.57477134", "0.5735081", "0.57297426", "0.57297426", "0.57297426", "0.57224107", "0.5718959", "0.57162714", "0.57084846", "0.57005405", "0.5699186", "0.5694699", "0.56901085", "0.5685225", "0.56679916", "0.56663233", "0.5665191", "0.5664205", "0.5664205", "0.5664205", "0.5664205", "0.5662638", "0.5657728" ]
0.7825897
0
TODO Autogenerated method stub
public static void main(String[] args) { List<String> t1 = Arrays.asList("John", "[email protected]", "[email protected]"); List<String> t2 = Arrays.asList("John", "[email protected]"); List<String> t3 = Arrays.asList("John", "[email protected]","[email protected]"); List<String> t4 = Arrays.asList("Mary", "[email protected]"); List<List<String>> t = new ArrayList<>(); t.add(t1); t.add(t2); t.add(t3); t.add(t4); AccountsMerge721 am = new AccountsMerge721(); List<List<String>> result = am.accountsMerge2(t); result.stream() .forEach(System.out :: println); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.66713095", "0.6567948", "0.652319", "0.648097", "0.64770466", "0.64586824", "0.64132667", "0.6376419", "0.62759", "0.62545097", "0.62371093", "0.62237984", "0.6201738", "0.619477", "0.619477", "0.61924416", "0.61872935", "0.6173417", "0.613289", "0.6127952", "0.6080854", "0.6076905", "0.6041205", "0.6024897", "0.60200036", "0.59985113", "0.5967729", "0.5967729", "0.5965808", "0.5949083", "0.5941002", "0.59236866", "0.5909713", "0.59030116", "0.589475", "0.58857024", "0.58837134", "0.586915", "0.58575684", "0.5850424", "0.5847001", "0.5824116", "0.5810248", "0.5809659", "0.58069366", "0.58069366", "0.5800507", "0.5792168", "0.5792168", "0.5792168", "0.5792168", "0.5792168", "0.5792168", "0.57900196", "0.5790005", "0.578691", "0.578416", "0.578416", "0.5774115", "0.5774115", "0.5774115", "0.5774115", "0.5774115", "0.5761079", "0.57592577", "0.57592577", "0.5749888", "0.5749888", "0.5749888", "0.5748457", "0.5733414", "0.5733414", "0.5733414", "0.57209575", "0.57154554", "0.57149583", "0.57140404", "0.57140404", "0.57140404", "0.57140404", "0.57140404", "0.57140404", "0.57140404", "0.571194", "0.57043016", "0.56993437", "0.5696782", "0.5687825", "0.5677794", "0.5673577", "0.5672046", "0.5669512", "0.5661156", "0.56579345", "0.5655569", "0.5655569", "0.5655569", "0.56546396", "0.56543446", "0.5653163", "0.56502634" ]
0.0
-1
Bes method Time complexity is sum of AilogAi where Ai is each account and this time is for sorting. Since union by rank and path compression we will have amortized time complexity
public List<List<String>> accountsMerge(List<List<String>> accounts) { List<Account> accts = new ArrayList<>(); Map<String, Account> mapMailToAccount = new HashMap<>(); for (List<String> account : accounts) { String name = account.get(0); Account acct = new Account(name); accts.add(acct); for(int i=1;i<account.size();i++){ String mail = account.get(i); Account mappedAcct = mapMailToAccount.get(mail); if (mappedAcct == null) { mapMailToAccount.put(mail, acct); acct.mails.add(mail); } else { union(acct, mappedAcct); } } } for (Account acct : accts) { if (acct.parent != acct) { acct.parent = find(acct); acct.parent.mails.addAll(acct.mails); } } List<List<String>> mergedAccounts = new ArrayList<>(); for (Account acct : accts) { if (acct.parent == acct) { mergedAccounts.add(acct.convertToList()); } } return mergedAccounts; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void Union( int x, int y){\n\n int i = root(x);\n int j = root(y);\n if (i == j) return;\n if (rank[i] > rank[j]) { id[j] = i; rank[i] += rank[j]; }\n else { id[i] = j; rank[j] += rank[i]; }\n }", "public static ArrayList<ArrayList<Integer>> fourSum(ArrayList<Integer> a, int k) {\n Collections.sort(a);\n System.out.println(a);\n LinkedHashMap<Integer, List<List<Integer>>> m = new LinkedHashMap<Integer, List<List<Integer>>>();\n for (int i = 0; i <= a.size() - 3; i++) {\n for (int j = i + 1; j <= a.size() - 2; j++) {\n if (m.get(a.get(i) + a.get(j)) == null) {\n ArrayList<List<Integer>> v = new ArrayList<List<Integer>>();\n List<Integer> c = new ArrayList<Integer>();\n c.add(i);\n c.add(j);\n v.add(c);\n m.put(a.get(i) + a.get(j), v);\n } else {\n List<List<Integer>> v = m.get(a.get(i) + a.get(j));\n List<Integer> c = new ArrayList<Integer>();\n c.add(i);\n c.add(j);\n v.add(c);\n m.put(a.get(i) + a.get(j), v);\n }\n\n }\n }\n LinkedHashSet<ArrayList<Integer>> res = new LinkedHashSet<ArrayList<Integer>>();\n for (int i = 2; i <= a.size() - 1; i++) {\n for (int j = i + 1; j < a.size(); j++) {\n List<List<Integer>> v = m.get(k - (a.get(i) + a.get(j)));\n if (v != null && v.size() >= 1) {\n for (List<Integer> l : v) {\n\n if (l.get(0) < l.get(1) && l.get(1) < i && l.get(1) < j) {\n //System.out.println(l.get(0) + \" \" + l.get(1) + \" \" + i + \" \" + j);\n ArrayList<Integer> out = new ArrayList<Integer>();\n out.add(a.get(l.get(0)));\n out.add(a.get(l.get(1)));\n out.add(a.get(i));\n out.add(a.get(j));\n Collections.sort(out);\n //System.out.println(out);\n res.add(out);\n }\n }\n }\n }\n }\n return new ArrayList<ArrayList<Integer>>(res);\n }", "private void union(int node1, int node2, int[] parent, int[] rank) {\n int node1Parent = find(node1, parent);\n int node2Parent = find(node2, parent);\n\n if (node1Parent == node2Parent) {\n return;\n }\n\n if (rank[node1Parent] < rank[node2Parent]) {\n parent[node1Parent] = node2Parent;\n }else if (rank[node1Parent] > rank[node2Parent]) {\n parent[node2Parent] = node1Parent;\n } else {\n parent[node1Parent] = node2Parent;\n rank[node2Parent]++;\n }\n }", "public void union(int i, int j) {\n\n int root1 = find(i);\n int root2 = find(j);\n\n if (root2 == root1)\n return;\n\n if (_rank[root1] > _rank[root2]) {\n _parent[root2] = root1;\n } else if (_rank[root2] > _rank[root1]) {\n _parent[root1] = root2;\n } else {\n _parent[root2] = root1;\n _rank[root1]++;\n }\n }", "public static void main(String[] args) {\n int l1=1000, l2=1000;\n int[] a1=new int[l1];\n int[] a2=new int[l2];\n int[] combine = new int[l1+l2];\n\n Random r = new Random();\n for (int i=0; i<a1.length; ++i){\n a1[i]=r.nextInt(a1.length*3);\n combine[i]=a1[i];\n }\n\n for (int i=0; i<a2.length; ++i){\n a2[i]=r.nextInt(a2.length*3);\n combine[l1+i]=a2[i];\n }\n\n Arrays.sort(a1);\n Arrays.sort(a2);\n Arrays.sort(combine);\n\n cnt=0;\n int m = findByRank(a1, 0, a1.length, a2, 0, a2.length, (a1.length+a2.length)/2);\n int m2 = combine[combine.length/2-1];\n\n System.out.printf(\"m=%d, m2=%d, cnt=%d\", m, m2, cnt);\n\n\n\n }", "public static void main(String[] args) {\n\t\tint a[]= {15,3,7,1,9,2};\n\t\tsubarraysum(a,11);//Time complexity O(n^2) space O(1)\n\n\t\tsubarraysum_reducecomplexity(a,11,a.length); //Time complexity O(n) space O(1)\n\n\t}", "void union(int a, int b) {\n\t\tif (a==9 && b==4){\r\n\t\tSystem.out.println(\"DEBUGGING 9 AND 4\");\r\n\t\tSystem.out.println(\"size of A: \"+ sizeOf(a));\r\n\t\tSystem.out.println(\"size of B: \"+ sizeOf(b));\r\n\t\t}\r\n\t\tint rootB = getRoot(b); // N array access\r\n\t\tint rootA = getRoot(a); // N array access\r\n\t\tif (rootA==rootB)return;\r\n\r\n\t\tif (sizeOf(rootA)<sizeOf(rootB)){\r\n\t\t\tidNode[rootA] = rootB; // 1 array access\r\n\t\t}\r\n\t\telse{\r\n\t\t\tidNode[rootB] = rootA; // 1 array access\r\n\t\t}\r\n\t}", "void union(int x,int y){\n int xRoot=find(x),yRoot=find(y);\n if(xRoot==yRoot)return;\n if(rank[xRoot]<rank[yRoot])\n parent[xRoot]=yRoot;\n else if(rank[xRoot]>rank[yRoot])\n parent[yRoot]=xRoot;\n else{\n parent[yRoot]=xRoot;\n rank[xRoot]=rank[xRoot]+1;\n }\n --totalSets;\n }", "public static long journeyToMoon(int n, List<List<Integer>> astronaut) {\n // Write your code here\n Map<Integer, Node<Integer>> countryMap = new HashMap<>();\n for(List<Integer> pairs: astronaut) {\n Node<Integer> node1 = countryMap.computeIfAbsent(pairs.get(0), Node::new);\n Node<Integer> node2 = countryMap.computeIfAbsent(pairs.get(1), Node::new);\n node1.connected.add(node2);\n node2.connected.add(node1);\n }\n\n List<Integer> countryCluster = new ArrayList<>();\n for(Node<Integer> node: countryMap.values()) {\n if(node.connected.size() == 0) {\n countryCluster.add(1);\n } else if(!node.visited){\n countryCluster.add(getNodeCount3(node));\n }\n }\n List<Integer> countryNodes = countryMap.values().stream().map(nn -> nn.value).collect(Collectors.toList());\n List<Integer> missingNodes = new ArrayList<>();\n for(int i=0; i < n; i++) {\n if(!countryNodes.contains(i))\n missingNodes.add(i);\n }\n\n for(int i=0; i < missingNodes.size(); i++) {\n countryCluster.add(1);\n }\n\n long ans = 0;\n //For one country we cannot pair with any other astronauts\n if(countryCluster.size() >= 2) {\n ans = (long) countryCluster.get(0) * countryCluster.get(1);\n if(countryCluster.size() > 2) {\n int sum = countryCluster.get(0) + countryCluster.get(1);\n for(int i=2; i < countryCluster.size(); i++) {\n ans += (long) sum * countryCluster.get(i);\n sum += countryCluster.get(i);\n }\n }\n }\n\n /*\n permutation of two set with size A and B = AxB\n permutation of three set with size A,B,C = AxB + AxC + BxC = AxB + (A+B)xC\n permutation of four set with size A,B,C,D = AxB + AxC + AxD + BxC + BxD + CxD = AxB + (A+B)xC + (A+B+C)xD\n */\n /*\n if(keys.length == 1) {\n ans = keys[0].size();\n } else {\n ans = keys[0].size() * keys[1].size();\n if(keys.length > 2) {\n int sum = keys[0].size() + keys[1].size();\n for (int i = 2; i < keys.length; i++) {\n ans += sum * keys[i].size();\n sum += keys[i].size();\n }\n }\n }\n */\n return ans;\n }", "public static void main(String[] args) {\n\n pairsSum();\n\n printAllSubArrays();\n\n tripletZero();\n\n // int[][] sub = subsets();\n\n PairsSum sum = new PairsSum();\n int[] arr = { 10, 1, 2, 3, 4, 5, 6, 1 };\n boolean flag = sum.almostIncreasingSequence(arr);\n System.out.println(flag);\n\n String s = \"\";\n for (int i = 0; i < 100000; i++) {\n // s += \"CodefightsIsAwesome\";\n }\n long start = System.currentTimeMillis();\n // int k = subStr(s, \"IsA\");\n System.out.println(System.currentTimeMillis() - start);\n // System.out.println(k);\n\n String[] a = { \"aba\", \"aa\", \"ad\", \"vcd\", \"aba\" };\n String[] b = sum.allLongestStrings(a);\n System.out.println(Arrays.deepToString(b));\n\n List<String> al = new ArrayList<>();\n al.toArray();\n\n Map<Integer, Integer> map = new HashMap<>();\n Set<Integer> keySet = map.keySet();\n for (Integer integer : keySet) {\n\n }\n\n String st = reverseBracksStack(\"a(bc(de)f)g\");\n System.out.println(st);\n\n int[] A = { 1, 2, 3, 2, 2, 3, 3, 33 };\n int[] B = { 1, 2, 2, 2, 2, 3, 2, 33 };\n\n System.out.println(sum.isIPv4Address(\"2.2.34\"));\n\n Integer[] AR = { 5, 3, 6, 7, 9 };\n int h = sum.avoidObstacles(AR);\n System.out.println(h);\n\n int[][] image = { { 36, 0, 18, 9 }, { 27, 54, 9, 0 }, { 81, 63, 72, 45 } };\n int[][] im = { { 7, 4, 0, 1 }, { 5, 6, 2, 2 }, { 6, 10, 7, 8 }, { 1, 4, 2, 0 } };\n int[][] res = sum.boxBlur(im);\n\n for (int i = 0; i < res.length; i++) {\n for (int j = 0; j < res[0].length; j++) {\n System.out.print(res[i][j] + \" \");\n }\n System.out.println();\n }\n\n boolean[][] ms = { { true, false, false, true }, { false, false, true, false }, { true, true, false, true } };\n int[][] mines = sum.minesweeper(ms);\n for (int i = 0; i < mines.length; i++) {\n for (int j = 0; j < mines[0].length; j++) {\n System.out.print(mines[i][j] + \" \");\n }\n System.out.println();\n }\n\n System.out.println(sum.variableName(\"var_1__Int\"));\n\n System.out.println(sum.chessBoard());\n\n System.out.println(sum.depositProfit(100, 20, 170));\n\n String[] inputArray = { \"abc\", \"abx\", \"axx\", \"abx\", \"abc\" };\n System.out.println(sum.stringsRearrangement(inputArray));\n\n int[][] queens = { { 1, 1 }, { 3, 2 } };\n int[][] queries = { { 1, 1 }, { 0, 3 }, { 0, 4 }, { 3, 4 }, { 2, 0 }, { 4, 3 }, { 4, 0 } };\n boolean[] r = sum.queensUnderAttack(5, queens, queries);\n\n }", "public void radixSorting() {\n\t\t\n\t}", "public ArrayList<ArrayList<Integer>> fourSum_02(ArrayList<Integer> a, int b) {\n\t\t//List to store the result\n\t\tArrayList<ArrayList<Integer>> res = new ArrayList<ArrayList<Integer>>();\n \tint len = a.size();\n \tif(len < 4)\n \t return res;\n \t\n //Using the hashMap to store sum and corresponding 2 elements\n \tHashMap<Integer, Index> h = new HashMap<Integer, Index>();\n \t\n \tfor(int i = 0; i < len-1; i++) {\n \t\tfor(int j = i+1; j < len; j++) {\n \t\t\tint sum = a.get(i) + a.get(j);\n \t\t\tif(h.containsKey(b-sum)) {\n \t\t\t\t//then get the elements of the existing sum stored in hashmap\n \t\t\t\tIndex indx = h.get(b-sum);\n \t\t\t\tint exI = indx.getI();\n \t\t\t\tint exJ = indx.getJ();\n \t\t\t\tif(res.size() == 0) {\n \t\t\t\t\tArrayList<Integer> l = new ArrayList<Integer>();\n\t \t\t\t\tl.add(exI);\n\t \t\t\t\tl.add(exJ);\n\t \t\t\t\tl.add( a.get(i));\n\t \t\t\t\tl.add( a.get(j));\n\t \t\t\t\tCollections.sort(l);\n\t \t\t\t\tres.add(l);\n \t\t\t\t} else {\n\t \t\t\t\tif((exI != a.get(i)) && (exJ != a.get(j))) {\n\t \t\t\t\t\tArrayList<Integer> l = new ArrayList<Integer>();\n\t\t \t\t\t\tl.add(exI);\n\t\t \t\t\t\tl.add(exJ);\n\t\t \t\t\t\tl.add(a.get(i));\n\t\t \t\t\t\tl.add(a.get(j));\n\n\t\t \t\t\t\tCollections.sort(l);\n\t\t \t\t\t\tboolean flag = true;\n\t\t \t\t\t\t\n\t\t \t\t\t\tfor(ArrayList<Integer> ll : res) {\n\t\t \t\t\t\t\tif(ll.equals(l)) {\n\t\t \t\t\t\t\t\tflag = false;\n\t\t \t\t\t\t\t\tbreak;\n\t\t \t\t\t\t\t}\n\t\t \t\t\t\t}\n\t\t \t\t\t\tif(flag == true)\n\t\t \t\t\t\t\tres.add(l);\n\t\t \t\t\t\t\n\t \t\t\t\t}\n \t\t\t\t}\n \t\t\t} else\n \t\t\t\th.put(sum, new Index(a.get(i), a.get(j)));\n \t\t}\n \t}\n \treturn res;\n\t}", "public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int T = sc.nextInt();\n for(int i = 0 ; i < T; i++) {\n int n = sc.nextInt();\n int a = sc.nextInt();\n int b = sc.nextInt();\n PriorityQueue<Integer> queue = new PriorityQueue<Integer>();\n int[][] m = new int[n][n];\n //n^2 * log(n)\n for(int row = 0; row < n; row++) {\n for(int col = 0; col < n; col++) {\n if(row == 0 && col == 0 && n != 1) {\n continue;\n }else if(row == 0) {\n m[row][col] = m[row][col - 1] + a;\n }else if(col == 0) {\n m[row][col] = m[row-1][col] + b;\n }else {\n m[row][col] = m[row-1][col-1] + a + b;\n }\n\n if(row + col == (n -1)) {\n pool.add(m[row][col]); //log(n)\n }\n }\n }\n //O(n*log(n))\n for (Integer item:pool) {\n queue.add(item); //O(logn)\n }\n while(!queue.isEmpty()) {\n System.out.print(queue.poll() + \" \"); //O(1)\n }\n System.out.println();\n queue.clear();\n pool.clear();\n }\n }", "private void mergeAB() {\r\n //merge only for the indexes of this global_count\r\n boolean a_end = false;\r\n boolean b_end = false;\r\n boolean start = false;\r\n int a_count = splitA[global_count - 1];\r\n if(a_count == A.length - 1){\r\n a_count = splitA[global_count - 2] + 1;\r\n }\r\n int b_count = splitB[global_count - 1];\r\n if(b_count == B.length - 1){\r\n if(global_count != splitB.length){\r\n start = true;\r\n b_count = 0;\r\n }\r\n else{\r\n b_count = splitB[global_count - 2] + 1;\r\n }\r\n }\r\n if(b_count == -1){\r\n b_end = true;\r\n b_count = 0;\r\n if(splitB[0] == B.length - 1){\r\n b_count = B.length;\r\n }\r\n }\r\n int c_count = a_count + b_count;\r\n while(!a_end || !b_end){\r\n if(a_end){\r\n C[c_count] = B[b_count];\r\n b_count++;\r\n }\r\n else if(b_end){\r\n C[c_count] = A[a_count];\r\n a_count++;\r\n }\r\n //if a > b\r\n else if(A[a_count] > B[b_count]){\r\n C[c_count] = B[b_count];\r\n b_count++;\r\n c_count++;\r\n }\r\n //if a <= b\r\n else{\r\n C[c_count] = A[a_count];\r\n a_count++;\r\n c_count++;\r\n }\r\n if(!start){\r\n if(a_count == splitA[global_count - 1] + 1){\r\n a_end = true;\r\n }\r\n if(b_count == splitB[global_count - 1] + 1){\r\n b_end = true;\r\n }\r\n }\r\n else{\r\n if(a_count == splitA[global_count - 1] + 1){\r\n a_end = true;\r\n }\r\n if(b_count == splitB.length){\r\n b_end = true;\r\n }\r\n }\r\n }\r\n }", "public static void main(String[] args) throws IOException {\n BufferedReader bufferedReader = new BufferedReader(new FileReader(UFTest.class.getResource(\"/\").getPath()+\"1.5/largeUF.txt\"));\n String str = bufferedReader.readLine();\n UFLJWQU uf = new UFLJWQU(Integer.parseInt(str));\n long beginTime =System.currentTimeMillis();\n while ((str = bufferedReader.readLine())!=null){\n String[] array = str.split(\" \");\n int p = Integer.parseInt(array[0]);\n int q = Integer.parseInt(array[1]);\n if(uf.connected(p,q)) continue;\n uf.union(p,q);\n// System.out.println(p+\" -- \"+q);\n }\n System.out.println(uf.count());\n System.out.println(\"cost time :\"+(System.currentTimeMillis() - beginTime));\n }", "static void mergesort(MappedByteBuffer A, MappedByteBuffer result, \r\n\t\t\tint start, int end) throws IOException {\r\n\r\n\t\tif (end - start < 8) { \r\n\t\t\treturn; \r\n\t\t}\r\n\r\n\t\tif (end - start == 8) {\r\n\t\t\tresult.position(start);\r\n\t\t\tint left = result.getInt();\r\n\t\t\tint right = result.getInt();\r\n\t\t\tif (left > right) {\r\n\t\t\t\tresult.position (start);\r\n\t\t\t\tresult.putInt (right);\r\n\t\t\t\tresult.putInt (left);\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tint mid = (end + start)/8*4;\r\n\t\tmergesort (result, A, start, mid);\r\n\t\tmergesort (result, A, mid, end);\r\n\r\n\t\tresult.position(start);\r\n\t\tfor (int i = start, j = mid, idx=start; idx < end; idx += 4) {\r\n\t\t\tint Ai = A.getInt (i);\r\n\t\t\tint Aj = 0;\r\n\t\t\tif (j < end) { Aj = A.getInt (j); }\r\n\t\t\tif (j >= end || (i < mid && Ai < Aj)) { \r\n\t\t\t\tresult.putInt (Ai);\r\n\t\t\t\ti += 4;\r\n\t\t\t} else {\r\n\t\t\t\tresult.putInt (Aj);\r\n\t\t\t\tj += 4;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public int a(alq paramalq, int paramInt1, int paramInt2, fn paramfn)\r\n/* 120: */ {\r\n/* 121:137 */ int i = 0;\r\n/* 122: */ amj localamj;\r\n/* 123: */ int k;\r\n/* 124:138 */ for (int j = 0; j < this.a.length; j++)\r\n/* 125: */ {\r\n/* 126:139 */ localamj = this.a[j];\r\n/* 127:140 */ if (localamj != null) {\r\n/* 128:143 */ if ((paramalq == null) || (localamj.b() == paramalq)) {\r\n/* 129:146 */ if ((paramInt1 <= -1) || (localamj.i() == paramInt1)) {\r\n/* 130:149 */ if ((paramfn == null) || (cy.a(paramfn, localamj.o(), true)))\r\n/* 131: */ {\r\n/* 132:153 */ k = paramInt2 <= 0 ? localamj.b : Math.min(paramInt2 - i, localamj.b);\r\n/* 133:154 */ i += k;\r\n/* 134:155 */ if (paramInt2 != 0)\r\n/* 135: */ {\r\n/* 136:156 */ this.a[j].b -= k;\r\n/* 137:157 */ if (this.a[j].b == 0) {\r\n/* 138:158 */ this.a[j] = null;\r\n/* 139: */ }\r\n/* 140:160 */ if ((paramInt2 > 0) && (i >= paramInt2)) {\r\n/* 141:161 */ return i;\r\n/* 142: */ }\r\n/* 143: */ }\r\n/* 144: */ }\r\n/* 145: */ }\r\n/* 146: */ }\r\n/* 147: */ }\r\n/* 148: */ }\r\n/* 149:165 */ for (j = 0; j < this.b.length; j++)\r\n/* 150: */ {\r\n/* 151:166 */ localamj = this.b[j];\r\n/* 152:167 */ if (localamj != null) {\r\n/* 153:170 */ if ((paramalq == null) || (localamj.b() == paramalq)) {\r\n/* 154:173 */ if ((paramInt1 <= -1) || (localamj.i() == paramInt1)) {\r\n/* 155:176 */ if ((paramfn == null) || (cy.a(paramfn, localamj.o(), false)))\r\n/* 156: */ {\r\n/* 157:180 */ k = paramInt2 <= 0 ? localamj.b : Math.min(paramInt2 - i, localamj.b);\r\n/* 158:181 */ i += k;\r\n/* 159:182 */ if (paramInt2 != 0)\r\n/* 160: */ {\r\n/* 161:183 */ this.b[j].b -= k;\r\n/* 162:184 */ if (this.b[j].b == 0) {\r\n/* 163:185 */ this.b[j] = null;\r\n/* 164: */ }\r\n/* 165:187 */ if ((paramInt2 > 0) && (i >= paramInt2)) {\r\n/* 166:188 */ return i;\r\n/* 167: */ }\r\n/* 168: */ }\r\n/* 169: */ }\r\n/* 170: */ }\r\n/* 171: */ }\r\n/* 172: */ }\r\n/* 173: */ }\r\n/* 174:193 */ if (this.f != null)\r\n/* 175: */ {\r\n/* 176:194 */ if ((paramalq != null) && (this.f.b() != paramalq)) {\r\n/* 177:195 */ return i;\r\n/* 178: */ }\r\n/* 179:197 */ if ((paramInt1 > -1) && (this.f.i() != paramInt1)) {\r\n/* 180:198 */ return i;\r\n/* 181: */ }\r\n/* 182:200 */ if ((paramfn != null) && (!cy.a(paramfn, this.f.o(), false))) {\r\n/* 183:201 */ return i;\r\n/* 184: */ }\r\n/* 185:204 */ j = paramInt2 <= 0 ? this.f.b : Math.min(paramInt2 - i, this.f.b);\r\n/* 186:205 */ i += j;\r\n/* 187:206 */ if (paramInt2 != 0)\r\n/* 188: */ {\r\n/* 189:207 */ this.f.b -= j;\r\n/* 190:208 */ if (this.f.b == 0) {\r\n/* 191:209 */ this.f = null;\r\n/* 192: */ }\r\n/* 193:211 */ if ((paramInt2 > 0) && (i >= paramInt2)) {\r\n/* 194:212 */ return i;\r\n/* 195: */ }\r\n/* 196: */ }\r\n/* 197: */ }\r\n/* 198:217 */ return i;\r\n/* 199: */ }", "static int findUnion(int i) {\n int result = i;\n while(parent[result] != result)\n result = parent[result];\n\n // update all parents of i to result\n while(parent[i] != i) {\n int temp = parent[i];\n parent[i] = result;\n i = temp;\n }\n return result;\n }", "public static void main(String[] args) {\r\n\t\t/** 1.000\r\n\t\t * bruteforceBE Asc runtime: 1072294\r\n\t\t * bruteforceBE Desc runtime: 17835245\r\n\t\t * improvedBE Asc runtime: 3562199\r\n\t\t * improvedBE Desc runtime: 794515\r\n\t\t * linearBE Asc runtime: 1680780\r\n\t\t * linearBE Desc runtime: 1629310\r\n\t\t *\r\n\t\t * 10.000\r\n\t\t * bruteforceBE Asc runtime: 3850878\r\n\t\t * bruteforceBE Desc runtime: 113789179\r\n\t\t * improvedBE Asc runtime: 11800873\r\n\t\t * improvedBE Desc runtime: 8166293\r\n\t\t * linearBE Asc runtime: 14381578\r\n\t\t * linearBE Desc runtime: 5897656\r\n\t\t *\r\n\t\t * 100.000\r\n\t\t * bruteforceBE Asc runtime: 19376301\r\n\t\t * bruteforceBE Desc runtime: 7801237491\r\n\t\t * improvedBE Asc runtime: 52015969\r\n\t\t * improvedBE Desc runtime: 33891001\r\n\t\t * linearBE Asc runtime: 43042990\r\n\t\t * linearBE Desc runtime: 10088763\r\n\t\t *\r\n\t\t * 200.000\r\n\t\t * bruteforceBE Asc runtime: 27567279\r\n\t\t * bruteforceBE Desc runtime: 30705593272\r\n\t\t * improvedBE Asc runtime: 87086775\r\n\t\t * improvedBE Desc runtime: 51012088\r\n\t\t * linearBE Asc runtime: 61726040\r\n\t\t * linearBE Desc runtime: 56062681\r\n\t\t */\r\n\t\tArrayList<Integer> ArrayUnsortAsc = new ArrayList<>();\r\n\t\tArrayList<Integer> ArrayUnsortDesc = new ArrayList<>();\r\n\t\tint n = 1000;\r\n\r\n\t\tfor(int i = 1; i <= n; i++ ) {\r\n\t\t\tArrayUnsortAsc.add(i);\r\n\t\t}\r\n\t\tfor(int j = n; j >= 1; j-- ) {\r\n\t\t\tArrayUnsortDesc.add(j);\r\n\t\t}\r\n\r\n\t\tlong beginning = 0, end = 0;\r\n\t\tlong runtime;\r\n\t\t//1a test\r\n\t\tbeginning = System.nanoTime();\r\n\t\tbruteForceBE(ArrayUnsortAsc,ArrayUnsortAsc.size()/2);\r\n\t\tend = System.nanoTime();\r\n\t\truntime = end - beginning;\r\n\t\tSystem.out.println(\"bruteforceBE Asc runtime: \" + runtime);\r\n\r\n\t\tbeginning = System.nanoTime();\r\n\t\tbruteForceBE(ArrayUnsortDesc,ArrayUnsortDesc.size()/2);\r\n\t\tend = System.nanoTime();\r\n\t\truntime = end - beginning;\r\n\t\tSystem.out.println(\"bruteforceBE Desc runtime: \" + runtime);\r\n\r\n\r\n\t\t//1b test\r\n\t\tbeginning = System.nanoTime();\r\n\t\timprovedBE(ArrayUnsortAsc,ArrayUnsortAsc.size()/2);\r\n\t\tend = System.nanoTime();\r\n\t\truntime = end - beginning;\r\n\t\tSystem.out.println(\"improvedBE Asc runtime: \" + runtime);\r\n\r\n\t\tbeginning = System.nanoTime();\r\n\t\timprovedBE(ArrayUnsortDesc,ArrayUnsortAsc.size()/2);\r\n\t\tend = System.nanoTime();\r\n\t\truntime = end - beginning;\r\n\t\tSystem.out.println(\"improvedBE Desc runtime: \" + runtime);\r\n\r\n\r\n\t\t//1c test\r\n\t\tbeginning = System.nanoTime();\r\n\t\tlinearBE(ArrayUnsortAsc,ArrayUnsortAsc.size()/2);\r\n\t\tend = System.nanoTime();\r\n\t\truntime = end - beginning;\r\n\t\tSystem.out.println(\"linearBE Asc runtime: \" + runtime);\r\n\r\n\t\tbeginning = System.nanoTime();\r\n\t\tlinearBE(ArrayUnsortDesc,ArrayUnsortDesc.size()/2);\r\n\t\tend = System.nanoTime();\r\n\t\truntime = end - beginning;\r\n\t\tSystem.out.println(\"linearBE Desc runtime: \" + runtime);\r\n\r\n\t}", "public static void a2v2(int[] A)\n {\n Map<Integer, List<Integer>> hashMap = new HashMap<>();\n\n insert(hashMap, 0, -1);\n\n int sum = 0;\n\n for (int i = 0; i < A.length; i++)\n {\n sum += A[i];\n\n if (hashMap.containsKey(sum))\n {\n List<Integer> list = hashMap.get(sum);\n\n // find all subarrays with the same sum\n for (Integer value: list)\n {\n System.out.println(\"Subarray [\" + (value + 1) + \"…\" +\n i + \"]\");\n }\n }\n\n // insert (sum so far, current index) pair into the hashmap\n insert(hashMap, sum, i);\n }\n }", "public static void unionPathCompression(){\n\t\tint n = 10;\t\n\n\t\tdsf S = new dsf(n*n);\n\t\tMaze two = new Maze(n);\n\n\t\tRandom random;\n\t\tint sets = n*n;\t//number of sets in the DSF\n\t\tint randomNumber;\n\t\tint randomDirection;\n\t\tint row;\n\t\tint col;\n\n\t\tchar upperRight; \t//bottom or right\n\n\t\tS.print();\n\n\t\twhile(sets > 1){\n\t\t\trandom = new Random();\n\t\t\trandomNumber = random.nextInt((n*n) - 1);\n\t\t\t//System.out.println(\"RANDOM NUMBER: \"+randomNumber);\n\t\t\trow = randomNumber /n;\t//SWITCHED\n\t\t\tcol = randomNumber %n;\t//SWITCHED\n\t\t\trandomDirection = random.nextInt(2);\n\t\t\tString direct;\n\t\t\tif(randomDirection == 0)\n\t\t\t\tdirect = \"upper\";\n\t\t\telse\n\t\t\t\tdirect = \"right\";\n\t\t\tSystem.out.println(\"RANDOM DIRECTI0N: \"+direct);\n\t\t\tupperRight = two.direction(randomDirection);\n\n\t\t\tif(upperRight == 'u'){\n\t\t\t\tif((randomNumber) < ((n*n)-n)){\n\t\t\t\t\tSystem.out.println(\"Sets: \"+sets);\n\t\t\t\t\tif(S.findAndCompress(randomNumber+n) != S.findAndCompress(randomNumber)){\n\t\t\t\t\t\tS.union(randomNumber+n, randomNumber);\n\t\t\t\t\t\ttwo.remove_wall(col, row, 'u');\n\t\t\t\t\t\tS.print();\n\t\t\t\t\t\tsets--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(upperRight == 'r'){\n\t\t\t\tif(((randomNumber)%(n*n)) != n-1){\n\t\t\t\t\tif(S.findAndCompress(randomNumber) != S.findAndCompress(randomNumber+1)){\n\t\t\t\t\t\tS.union(randomNumber, randomNumber+1);\n\t\t\t\t\t\ttwo.remove_wall(col, row, 'r');\n\t\t\t\t\t\tS.print();\n\t\t\t\t\t\tsets--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tbuildAdjacencyList(two, n);\n\t\tuserSelection_SolveMaze(n);\n\n\n\t\tStdDraw.show(0);\n\t\ttwo.draw();\n\t\ttwo.printCellNumbers();\n\t}", "public static void main(String[] args) throws Exception {\n int arr[]= {7,9,88,-33,2,12,6,1};\n Arrays.sort(arr);\n /*for(int i=0; i<arr.length; i++)\n \t System.out.print(arr[i]+\", \");\n System.out.println(\"\\n DESC\");\n System.out.print(\"{ \");\n for(int i=arr.length-1; i>=0; i--) {\n \t if(arr[i]==arr[0])\n \t System.out.print(arr[i]);\n \t else \n \t\t System.out.print(arr[i]+\", \");\n }*/\n // System.out.print(\" }\");\n \n int[] ar= {6,2,2,5,2,2,1};\n int startIndex=0;\n int lastIndex=ar.length-1;\n //a is sumRight,b = sumLeft\n int a=0,b=0;\n /* while(true) {\n \t \n \t if(b>a) \n \t\t //1+2+2=+5\n \t\t a+=ar[lastIndex--];\n \t else \n \t\t //6+2+2\n \t\t\t b+=ar[startIndex++];\n \t\tif(startIndex>lastIndex) {\n \t\t\tSystem.out.println(startIndex);\n \t\t\tif(a==b)\n \t\t\t\tbreak;\n \t\t\t else\n \t\t\t throw new Exception(\"not a valid array\");\n \t\t\t\n \t\t}\n \t\t\t \n \t\t\n }\n System.out.println(lastIndex);\n */\n \n \n while(true) {\n \t \n \t if(b>a)\n \t\t a+= ar[lastIndex--];\n \t else\n b+=ar[startIndex++];\n \t if(startIndex>lastIndex) {\n \t\t if(a==b)\n \t\t\t break;\n \t }\n }\n System.out.println(lastIndex);\n\t}", "void solve() throws IOException {\n int[] nk = ril(2);\n int n = nk[0];\n int k = nk[1];\n int[] p = ril(n);\n int[] b = ril(k);\n for (int i = 0; i < n; i++) p[i]--;\n for (int i = 0; i < k; i++) b[i]--;\n\n int[] numToIdx = new int[n];\n for (int i = 0; i < n; i++) numToIdx[p[i]] = i;\n\n boolean[] remove = new boolean[n];\n Arrays.fill(remove, true);\n for (int bi : b) remove[bi] = false;\n List<Integer> toRemove = new ArrayList<>(n - k);\n for (int i = 0; i < n; i++) if (remove[i]) toRemove.add(i);\n Collections.sort(toRemove);\n\n int[] prevSmaller = new int[n];\n prevSmaller[0] = -1;\n int prevIdx = remove[p[0]] ? -1 : 0;\n for (int i = 1; i < n; i++) {\n int j = prevIdx;\n while (j != -1 && p[i] < p[j]) j = prevSmaller[j];\n prevSmaller[i] = j;\n if (!remove[p[i]]) prevIdx = i;\n }\n int[] nextSmaller = new int[n];\n nextSmaller[n-1] = n;\n prevIdx = remove[p[n-1]] ? n : n-1;\n for (int i = n-2; i >= 0; i--) {\n int j = prevIdx;\n while (j != n && p[i] < p[j]) j = nextSmaller[j];\n nextSmaller[i] = j;\n if (!remove[p[i]]) prevIdx = i;\n }\n\n int[] init = new int[n];\n Arrays.fill(init, 1);\n SegmentTree st = new SegmentTree(init);\n long ans = 0;\n for (int x : toRemove) {\n int idx = numToIdx[x];\n int l = prevSmaller[idx] + 1;\n int r = nextSmaller[idx] - 1;\n ans += st.query(l, r+1);\n st.modify(idx, 0);\n }\n pw.println(ans);\n }", "static\nint\nprintUnion(\nint\narr1[], \nint\narr2[], \nint\nm, \nint\nn) \n\n{ \n\nint\ni = \n0\n, j = \n0\n; \n\nwhile\n(i < m && j < n) \n\n{ \n\nif\n(arr1[i] < arr2[j]) \n\nSystem.out.print(arr1[i++]+\n\" \"\n); \n\nelse\nif\n(arr2[j] < arr1[i]) \n\nSystem.out.print(arr2[j++]+\n\" \"\n); \n\nelse\n\n{ \n\nSystem.out.print(arr2[j++]+\n\" \"\n); \n\ni++; \n\n} \n\n} \n\n\n/* Print remaining elements of \n\nthe larger array */\n\nwhile\n(i < m) \n\nSystem.out.print(arr1[i++]+\n\" \"\n); \n\nwhile\n(j < n) \n\nSystem.out.print(arr2[j++]+\n\" \"\n); \n\n\nreturn\n0\n; \n\n}", "int[] union(int s1,int t1,int s2,int t2)\r\n\t{\r\n\t\tint [] st=new int[2];\r\n\t\t//Please fill in the program here\r\n\t\tst[0] = incCapacity();\r\n\t\taddEdge(st[0], epssymbol, s1);\r\n\t\taddEdge(st[0], epssymbol, s2);\r\n\t\tst[1] = incCapacity();\r\n\t\taddEdge(t1, epssymbol, st[1]);\r\n\t\taddEdge(t2, epssymbol, st[1]);\r\n\r\n\t\treturn st;\r\n\t}", "public static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\n\t\tint a[] = {2,1,3,-4,-2};\n\t\t//int a[] = {1 ,2, 3, 7, 5};\n\t\tboolean found = false;\n\t\t\n\t\t//this will solve in o n^2\n\t\tfor(int i = 0 ; i < a.length ; i++){\n\t\t\tint sum = 0;\n\t\t\tfor(int j = i ; j< a.length ; j++){\n\t\t\t\tsum += a[j] ;\n\t\t\t\tif(sum == 0){\n\t\t\t\t\tfound = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\tif(found)\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\t\n\t\t// link : https://www.youtube.com/watch?v=PSpuM9cimxA&list=PLKKfKV1b9e8ps6dD3QA5KFfHdiWj9cB1s&index=49\n\t\tSystem.out.println(found + \" found\");\n\t\tfound = false;\n\t\t//solving with O of N with the help sets\n\t\t// x + 0 = y\n\t\tSet<Integer> set = new HashSet<>();\n\t\tint sum = 0;\n\t\tfor(int element : a){\n\t\t\tset.add(sum);\n\t\t\tsum += element;\n\t\t\tif(set.contains(sum)){\n\t\t\t\tfound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println();\n\t\tSystem.out.println(set);\n\t\t\n\t\tSystem.out.println(found + \" found\");\n\t\t\n\t\t\n\t\tfound = false;\n\t\t// when the sum of subarray is K\n\t\t\n\t\t//solving with O of N with the help sets\n\t\t//x + k = y >>>\n\t\tSet<Integer> set1 = new HashSet<>();\n\t\tint k = 12;\n\t\tint summ = 0;\n\t\tfor(int element : a){\n\t\t\tset1.add(summ);\n\t\t\tsumm += element;\n\t\t\tif(set1.contains(summ - k)){ // y - k = x(alredy presnt or not)\n\t\t\t\tfound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(set1);\n\t\tSystem.out.println();\n\t\tSystem.out.println(found + \" found\");\n\t\t\n\t\t\n\t}", "private void go(int i) {\n\t\tcol[i] = 1;\r\n\t\tint j = f[i];\r\n\t\tint cnt = 0;\r\n\t\tint delAll = 0;\r\n\t\tint[][] cd = new int[1000][3];\r\n\t\tint sa = 0;\r\n\t\tint sb = 0;\r\n\t\tint m1 = Integer.MAX_VALUE;\r\n\t\tint m2 = Integer.MAX_VALUE;\r\n\t\tint m1a = 0;\r\n\t\tint m2a = 0;\r\n\t\tint m1b = 0;\r\n\t\tint m2b = 0;\r\n\t\twhile (j != -1) {\r\n\t\t\tif (col[e[j]] == 0) {\r\n\t\t\t\tgo(e[j]);\r\n\t\t\t\tdelAll += a[e[j]];\r\n\t\t\t\tint dif = b[e[j]] - a[e[j]];\r\n\t\t\t\tif (dif < m1) {\r\n\t\t\t\t\tm2 = m1;\r\n\t\t\t\t\tm2b = m1b;\r\n\t\t\t\t\tm2a = m1a;\r\n\t\t\t\t\tm1 = dif;\r\n\t\t\t\t\tm1a = a[e[j]];\r\n\t\t\t\t\tm1b = b[e[j]];\r\n\t\t\t\t} else if (dif < m2) {\r\n\t\t\t\t\tm2 = dif;\r\n\t\t\t\t\tm2a = a[e[j]];\r\n\t\t\t\t\tm2b = b[e[j]];\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\tsa += a[e[j]];\r\n\t\t\t\tsb += a[e[j]];\r\n\t\t\t\tcd[cnt][0] = a[e[j]];\r\n\t\t\t\tcd[cnt][1] = b[e[j]];\r\n\t\t\t\tcd[cnt][2] = b[e[j]] - a[e[j]];\r\n\t\t\t\tcnt++;\r\n\t\t\t}\r\n\t\t\tj = next[j];\r\n\t\t}\r\n\t\tif (cnt == 0) {\r\n\t\t\ta[i] = 1;\r\n\t\t\tb[i] = 0;\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tArrays.sort(cd, new Comparator<int[]>() {\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic int compare(int[] o1, int[] o2) {\r\n\t\t\t\t// TODO Auto-generated method stub\t\t\t\t\r\n\t\t\t\treturn o1[2] - o2[2];\r\n\t\t\t}\r\n\t\t});\r\n\t\ta[i] = delAll + 1;\r\n\t\t//leave 0 or 2\r\n\t\tint cost1 = 0;\r\n\t\tint cost = 0;\r\n\t\tfor (j = 2; j < cnt; j++)\r\n\t\t\tcost1 += cd[j][0];\r\n\t\tif (cnt >= 2) {\r\n\t\t\tcost += m1b + m2b + sa - m1a - m2a;\r\n\t\t\tcost1 += cd[0][1] + cd[1][1];\r\n\t\t} else {\r\n\t\t\tcost += sa;\r\n\t\t\tcost1 += cd[0][0];\r\n\t\t}\r\n\t\tif (cost1 != cost)\r\n\t\t\tSystem.err.println(\"FUCK\");\r\n\t\tb[i] = cost;\r\n\t}", "public void union(int p, int q) {\n\t\tint i = root(p);\n\t\tint j = root(q);\n//\t\tid[i] = j; instead of this do below improvement\n\t\tif (sz[i] < sz[j]) {\n\t\t\tid[i] = j;\n\t\t\tsz[j] += sz[i];\n\t\t} else {\n\t\t\tid[j] = i;\n\t\t\tsz[i] += sz[j];\n\t\t}\n\t}", "private void trIntroSort(int r34, int r35, int r36, int r37, int r38, io.netty.handler.codec.compression.Bzip2DivSufSort.TRBudget r39, int r40) {\n /*\n r33 = this;\n r0 = r33;\n r0 = r0.SA;\n r16 = r0;\n r4 = 64;\n r0 = new io.netty.handler.codec.compression.Bzip2DivSufSort.StackEntry[r4];\n r29 = r0;\n r32 = 0;\n r27 = 0;\n r4 = r38 - r37;\n r22 = trLog(r4);\n r28 = r27;\n r23 = r22;\n L_0x001a:\n if (r23 >= 0) goto L_0x02b6;\n L_0x001c:\n r4 = -1;\n r0 = r23;\n if (r0 != r4) goto L_0x01a4;\n L_0x0021:\n r4 = r38 - r37;\n r0 = r39;\n r1 = r40;\n r4 = r0.update(r1, r4);\n if (r4 != 0) goto L_0x0050;\n L_0x002d:\n r22 = r23;\n L_0x002f:\n r26 = 0;\n L_0x0031:\n r0 = r26;\n r1 = r28;\n if (r0 >= r1) goto L_0x072a;\n L_0x0037:\n r4 = r29[r26];\n r4 = r4.d;\n r5 = -3;\n if (r4 != r5) goto L_0x004d;\n L_0x003e:\n r4 = r29[r26];\n r4 = r4.b;\n r5 = r29[r26];\n r5 = r5.c;\n r0 = r33;\n r1 = r34;\n r0.lsUpdateGroup(r1, r4, r5);\n L_0x004d:\n r26 = r26 + 1;\n goto L_0x0031;\n L_0x0050:\n r6 = r35 + -1;\n r10 = r38 + -1;\n r4 = r33;\n r5 = r34;\n r7 = r36;\n r8 = r37;\n r9 = r38;\n r25 = r4.trPartition(r5, r6, r7, r8, r9, r10);\n r0 = r25;\n r8 = r0.first;\n r0 = r25;\n r9 = r0.last;\n r0 = r37;\n if (r0 < r8) goto L_0x0072;\n L_0x006e:\n r0 = r38;\n if (r9 >= r0) goto L_0x016d;\n L_0x0072:\n r0 = r38;\n if (r8 >= r0) goto L_0x0087;\n L_0x0076:\n r17 = r37;\n r31 = r8 + -1;\n L_0x007a:\n r0 = r17;\n if (r0 >= r8) goto L_0x0087;\n L_0x007e:\n r4 = r16[r17];\n r4 = r4 + r34;\n r16[r4] = r31;\n r17 = r17 + 1;\n goto L_0x007a;\n L_0x0087:\n r0 = r38;\n if (r9 >= r0) goto L_0x009c;\n L_0x008b:\n r17 = r8;\n r31 = r9 + -1;\n L_0x008f:\n r0 = r17;\n if (r0 >= r9) goto L_0x009c;\n L_0x0093:\n r4 = r16[r17];\n r4 = r4 + r34;\n r16[r4] = r31;\n r17 = r17 + 1;\n goto L_0x008f;\n L_0x009c:\n r27 = r28 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r5 = 0;\n r6 = 0;\n r4.<init>(r5, r8, r9, r6);\n r29[r28] = r4;\n r28 = r27 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r5 = r35 + -1;\n r6 = -2;\n r0 = r37;\n r1 = r38;\n r4.<init>(r5, r0, r1, r6);\n r29[r27] = r4;\n r4 = r8 - r37;\n r5 = r38 - r9;\n if (r4 > r5) goto L_0x0117;\n L_0x00bd:\n r4 = 1;\n r5 = r8 - r37;\n if (r4 >= r5) goto L_0x00e3;\n L_0x00c2:\n r27 = r28 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r5 = r38 - r9;\n r5 = trLog(r5);\n r0 = r35;\n r1 = r38;\n r4.<init>(r0, r9, r1, r5);\n r29[r28] = r4;\n r38 = r8;\n r4 = r8 - r37;\n r22 = trLog(r4);\n L_0x00dd:\n r28 = r27;\n r23 = r22;\n goto L_0x001a;\n L_0x00e3:\n r4 = 1;\n r5 = r38 - r9;\n if (r4 >= r5) goto L_0x00f3;\n L_0x00e8:\n r37 = r9;\n r4 = r38 - r9;\n r22 = trLog(r4);\n r27 = r28;\n goto L_0x00dd;\n L_0x00f3:\n if (r28 != 0) goto L_0x00fa;\n L_0x00f5:\n r27 = r28;\n r22 = r23;\n L_0x00f9:\n return;\n L_0x00fa:\n r27 = r28 + -1;\n r20 = r29[r27];\n r0 = r20;\n r0 = r0.a_isRightVersion;\n r35 = r0;\n r0 = r20;\n r0 = r0.b;\n r37 = r0;\n r0 = r20;\n r0 = r0.c;\n r38 = r0;\n r0 = r20;\n r0 = r0.d;\n r22 = r0;\n goto L_0x00dd;\n L_0x0117:\n r4 = 1;\n r5 = r38 - r9;\n if (r4 >= r5) goto L_0x0138;\n L_0x011c:\n r27 = r28 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r5 = r8 - r37;\n r5 = trLog(r5);\n r0 = r35;\n r1 = r37;\n r4.<init>(r0, r1, r8, r5);\n r29[r28] = r4;\n r37 = r9;\n r4 = r38 - r9;\n r22 = trLog(r4);\n goto L_0x00dd;\n L_0x0138:\n r4 = 1;\n r5 = r8 - r37;\n if (r4 >= r5) goto L_0x0148;\n L_0x013d:\n r38 = r8;\n r4 = r8 - r37;\n r22 = trLog(r4);\n r27 = r28;\n goto L_0x00dd;\n L_0x0148:\n if (r28 != 0) goto L_0x014f;\n L_0x014a:\n r27 = r28;\n r22 = r23;\n goto L_0x00f9;\n L_0x014f:\n r27 = r28 + -1;\n r20 = r29[r27];\n r0 = r20;\n r0 = r0.a_isRightVersion;\n r35 = r0;\n r0 = r20;\n r0 = r0.b;\n r37 = r0;\n r0 = r20;\n r0 = r0.c;\n r38 = r0;\n r0 = r20;\n r0 = r0.d;\n r22 = r0;\n goto L_0x00dd;\n L_0x016d:\n r17 = r37;\n L_0x016f:\n r0 = r17;\n r1 = r38;\n if (r0 >= r1) goto L_0x017e;\n L_0x0175:\n r4 = r16[r17];\n r4 = r4 + r34;\n r16[r4] = r17;\n r17 = r17 + 1;\n goto L_0x016f;\n L_0x017e:\n if (r28 != 0) goto L_0x0186;\n L_0x0180:\n r27 = r28;\n r22 = r23;\n goto L_0x00f9;\n L_0x0186:\n r27 = r28 + -1;\n r20 = r29[r27];\n r0 = r20;\n r0 = r0.a_isRightVersion;\n r35 = r0;\n r0 = r20;\n r0 = r0.b;\n r37 = r0;\n r0 = r20;\n r0 = r0.c;\n r38 = r0;\n r0 = r20;\n r0 = r0.d;\n r22 = r0;\n goto L_0x00dd;\n L_0x01a4:\n r4 = -2;\n r0 = r23;\n if (r0 != r4) goto L_0x01ea;\n L_0x01a9:\n r27 = r28 + -1;\n r4 = r29[r27];\n r8 = r4.b;\n r4 = r29[r27];\n r9 = r4.c;\n r11 = r35 - r34;\n r4 = r33;\n r5 = r34;\n r6 = r36;\n r7 = r37;\n r10 = r38;\n r4.trCopy(r5, r6, r7, r8, r9, r10, r11);\n if (r27 != 0) goto L_0x01c8;\n L_0x01c4:\n r22 = r23;\n goto L_0x00f9;\n L_0x01c8:\n r27 = r27 + -1;\n r20 = r29[r27];\n r0 = r20;\n r0 = r0.a_isRightVersion;\n r35 = r0;\n r0 = r20;\n r0 = r0.b;\n r37 = r0;\n r0 = r20;\n r0 = r0.c;\n r38 = r0;\n r0 = r20;\n r0 = r0.d;\n r22 = r0;\n r28 = r27;\n r23 = r22;\n goto L_0x001a;\n L_0x01ea:\n r4 = r16[r37];\n if (r4 < 0) goto L_0x0202;\n L_0x01ee:\n r8 = r37;\n L_0x01f0:\n r4 = r16[r8];\n r4 = r4 + r34;\n r16[r4] = r8;\n r8 = r8 + 1;\n r0 = r38;\n if (r8 >= r0) goto L_0x0200;\n L_0x01fc:\n r4 = r16[r8];\n if (r4 >= 0) goto L_0x01f0;\n L_0x0200:\n r37 = r8;\n L_0x0202:\n r0 = r37;\n r1 = r38;\n if (r0 >= r1) goto L_0x028c;\n L_0x0208:\n r8 = r37;\n L_0x020a:\n r4 = r16[r8];\n r4 = r4 ^ -1;\n r16[r8] = r4;\n r8 = r8 + 1;\n r4 = r16[r8];\n if (r4 < 0) goto L_0x020a;\n L_0x0216:\n r4 = r16[r8];\n r4 = r4 + r34;\n r4 = r16[r4];\n r5 = r16[r8];\n r5 = r5 + r35;\n r5 = r16[r5];\n if (r4 == r5) goto L_0x0241;\n L_0x0224:\n r4 = r8 - r37;\n r4 = r4 + 1;\n r24 = trLog(r4);\n L_0x022c:\n r8 = r8 + 1;\n r0 = r38;\n if (r8 >= r0) goto L_0x0244;\n L_0x0232:\n r9 = r37;\n r31 = r8 + -1;\n L_0x0236:\n if (r9 >= r8) goto L_0x0244;\n L_0x0238:\n r4 = r16[r9];\n r4 = r4 + r34;\n r16[r4] = r31;\n r9 = r9 + 1;\n goto L_0x0236;\n L_0x0241:\n r24 = -1;\n goto L_0x022c;\n L_0x0244:\n r4 = r8 - r37;\n r5 = r38 - r8;\n if (r4 > r5) goto L_0x0264;\n L_0x024a:\n r27 = r28 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r5 = -3;\n r0 = r35;\n r1 = r38;\n r4.<init>(r0, r8, r1, r5);\n r29[r28] = r4;\n r35 = r35 + 1;\n r38 = r8;\n r22 = r24;\n r28 = r27;\n r23 = r22;\n goto L_0x001a;\n L_0x0264:\n r4 = 1;\n r5 = r38 - r8;\n if (r4 >= r5) goto L_0x0282;\n L_0x0269:\n r27 = r28 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r5 = r35 + 1;\n r0 = r37;\n r1 = r24;\n r4.<init>(r5, r0, r8, r1);\n r29[r28] = r4;\n r37 = r8;\n r22 = -3;\n r28 = r27;\n r23 = r22;\n goto L_0x001a;\n L_0x0282:\n r35 = r35 + 1;\n r38 = r8;\n r22 = r24;\n r23 = r22;\n goto L_0x001a;\n L_0x028c:\n if (r28 != 0) goto L_0x0294;\n L_0x028e:\n r27 = r28;\n r22 = r23;\n goto L_0x00f9;\n L_0x0294:\n r27 = r28 + -1;\n r20 = r29[r27];\n r0 = r20;\n r0 = r0.a_isRightVersion;\n r35 = r0;\n r0 = r20;\n r0 = r0.b;\n r37 = r0;\n r0 = r20;\n r0 = r0.c;\n r38 = r0;\n r0 = r20;\n r0 = r0.d;\n r22 = r0;\n r28 = r27;\n r23 = r22;\n goto L_0x001a;\n L_0x02b6:\n r4 = r38 - r37;\n r5 = 8;\n if (r4 > r5) goto L_0x02d5;\n L_0x02bc:\n r4 = r38 - r37;\n r0 = r39;\n r1 = r40;\n r4 = r0.update(r1, r4);\n if (r4 != 0) goto L_0x02cc;\n L_0x02c8:\n r22 = r23;\n goto L_0x002f;\n L_0x02cc:\n r33.trInsertionSort(r34, r35, r36, r37, r38);\n r22 = -3;\n r23 = r22;\n goto L_0x001a;\n L_0x02d5:\n r22 = r23 + -1;\n if (r23 != 0) goto L_0x0331;\n L_0x02d9:\n r4 = r38 - r37;\n r0 = r39;\n r1 = r40;\n r4 = r0.update(r1, r4);\n if (r4 == 0) goto L_0x002f;\n L_0x02e5:\n r15 = r38 - r37;\n r10 = r33;\n r11 = r34;\n r12 = r35;\n r13 = r36;\n r14 = r37;\n r10.trHeapSort(r11, r12, r13, r14, r15);\n r8 = r38 + -1;\n L_0x02f6:\n r0 = r37;\n if (r0 >= r8) goto L_0x032b;\n L_0x02fa:\n r4 = r16[r8];\n r0 = r33;\n r1 = r34;\n r2 = r35;\n r3 = r36;\n r32 = r0.trGetC(r1, r2, r3, r4);\n r9 = r8 + -1;\n L_0x030a:\n r0 = r37;\n if (r0 > r9) goto L_0x0329;\n L_0x030e:\n r4 = r16[r9];\n r0 = r33;\n r1 = r34;\n r2 = r35;\n r3 = r36;\n r4 = r0.trGetC(r1, r2, r3, r4);\n r0 = r32;\n if (r4 != r0) goto L_0x0329;\n L_0x0320:\n r4 = r16[r9];\n r4 = r4 ^ -1;\n r16[r9] = r4;\n r9 = r9 + -1;\n goto L_0x030a;\n L_0x0329:\n r8 = r9;\n goto L_0x02f6;\n L_0x032b:\n r22 = -3;\n r23 = r22;\n goto L_0x001a;\n L_0x0331:\n r8 = r33.trPivot(r34, r35, r36, r37, r38);\n r0 = r16;\n r1 = r37;\n r2 = r16;\n swapElements(r0, r1, r2, r8);\n r4 = r16[r37];\n r0 = r33;\n r1 = r34;\n r2 = r35;\n r3 = r36;\n r31 = r0.trGetC(r1, r2, r3, r4);\n r9 = r37 + 1;\n L_0x034e:\n r0 = r38;\n if (r9 >= r0) goto L_0x0369;\n L_0x0352:\n r4 = r16[r9];\n r0 = r33;\n r1 = r34;\n r2 = r35;\n r3 = r36;\n r32 = r0.trGetC(r1, r2, r3, r4);\n r0 = r32;\n r1 = r31;\n if (r0 != r1) goto L_0x0369;\n L_0x0366:\n r9 = r9 + 1;\n goto L_0x034e;\n L_0x0369:\n r8 = r9;\n r0 = r38;\n if (r9 >= r0) goto L_0x039e;\n L_0x036e:\n r0 = r32;\n r1 = r31;\n if (r0 >= r1) goto L_0x039e;\n L_0x0374:\n r9 = r9 + 1;\n r0 = r38;\n if (r9 >= r0) goto L_0x039e;\n L_0x037a:\n r4 = r16[r9];\n r0 = r33;\n r1 = r34;\n r2 = r35;\n r3 = r36;\n r32 = r0.trGetC(r1, r2, r3, r4);\n r0 = r32;\n r1 = r31;\n if (r0 > r1) goto L_0x039e;\n L_0x038e:\n r0 = r32;\n r1 = r31;\n if (r0 != r1) goto L_0x0374;\n L_0x0394:\n r0 = r16;\n r1 = r16;\n swapElements(r0, r9, r1, r8);\n r8 = r8 + 1;\n goto L_0x0374;\n L_0x039e:\n r17 = r38 + -1;\n L_0x03a0:\n r0 = r17;\n if (r9 >= r0) goto L_0x03bb;\n L_0x03a4:\n r4 = r16[r17];\n r0 = r33;\n r1 = r34;\n r2 = r35;\n r3 = r36;\n r32 = r0.trGetC(r1, r2, r3, r4);\n r0 = r32;\n r1 = r31;\n if (r0 != r1) goto L_0x03bb;\n L_0x03b8:\n r17 = r17 + -1;\n goto L_0x03a0;\n L_0x03bb:\n r18 = r17;\n r0 = r17;\n if (r9 >= r0) goto L_0x03f5;\n L_0x03c1:\n r0 = r32;\n r1 = r31;\n if (r0 <= r1) goto L_0x03f5;\n L_0x03c7:\n r17 = r17 + -1;\n r0 = r17;\n if (r9 >= r0) goto L_0x03f5;\n L_0x03cd:\n r4 = r16[r17];\n r0 = r33;\n r1 = r34;\n r2 = r35;\n r3 = r36;\n r32 = r0.trGetC(r1, r2, r3, r4);\n r0 = r32;\n r1 = r31;\n if (r0 < r1) goto L_0x03f5;\n L_0x03e1:\n r0 = r32;\n r1 = r31;\n if (r0 != r1) goto L_0x03c7;\n L_0x03e7:\n r0 = r16;\n r1 = r17;\n r2 = r16;\n r3 = r18;\n swapElements(r0, r1, r2, r3);\n r18 = r18 + -1;\n goto L_0x03c7;\n L_0x03f5:\n r0 = r17;\n if (r9 >= r0) goto L_0x045a;\n L_0x03f9:\n r0 = r16;\n r1 = r16;\n r2 = r17;\n swapElements(r0, r9, r1, r2);\n L_0x0402:\n r9 = r9 + 1;\n r0 = r17;\n if (r9 >= r0) goto L_0x042c;\n L_0x0408:\n r4 = r16[r9];\n r0 = r33;\n r1 = r34;\n r2 = r35;\n r3 = r36;\n r32 = r0.trGetC(r1, r2, r3, r4);\n r0 = r32;\n r1 = r31;\n if (r0 > r1) goto L_0x042c;\n L_0x041c:\n r0 = r32;\n r1 = r31;\n if (r0 != r1) goto L_0x0402;\n L_0x0422:\n r0 = r16;\n r1 = r16;\n swapElements(r0, r9, r1, r8);\n r8 = r8 + 1;\n goto L_0x0402;\n L_0x042c:\n r17 = r17 + -1;\n r0 = r17;\n if (r9 >= r0) goto L_0x03f5;\n L_0x0432:\n r4 = r16[r17];\n r0 = r33;\n r1 = r34;\n r2 = r35;\n r3 = r36;\n r32 = r0.trGetC(r1, r2, r3, r4);\n r0 = r32;\n r1 = r31;\n if (r0 < r1) goto L_0x03f5;\n L_0x0446:\n r0 = r32;\n r1 = r31;\n if (r0 != r1) goto L_0x042c;\n L_0x044c:\n r0 = r16;\n r1 = r17;\n r2 = r16;\n r3 = r18;\n swapElements(r0, r1, r2, r3);\n r18 = r18 + -1;\n goto L_0x042c;\n L_0x045a:\n r0 = r18;\n if (r8 > r0) goto L_0x0716;\n L_0x045e:\n r17 = r9 + -1;\n r26 = r8 - r37;\n r30 = r9 - r8;\n r0 = r26;\n r1 = r30;\n if (r0 <= r1) goto L_0x046c;\n L_0x046a:\n r26 = r30;\n L_0x046c:\n r19 = r37;\n r21 = r9 - r26;\n L_0x0470:\n if (r26 <= 0) goto L_0x0484;\n L_0x0472:\n r0 = r16;\n r1 = r19;\n r2 = r16;\n r3 = r21;\n swapElements(r0, r1, r2, r3);\n r26 = r26 + -1;\n r19 = r19 + 1;\n r21 = r21 + 1;\n goto L_0x0470;\n L_0x0484:\n r26 = r18 - r17;\n r4 = r38 - r18;\n r30 = r4 + -1;\n r0 = r26;\n r1 = r30;\n if (r0 <= r1) goto L_0x0492;\n L_0x0490:\n r26 = r30;\n L_0x0492:\n r19 = r9;\n r21 = r38 - r26;\n L_0x0496:\n if (r26 <= 0) goto L_0x04aa;\n L_0x0498:\n r0 = r16;\n r1 = r19;\n r2 = r16;\n r3 = r21;\n swapElements(r0, r1, r2, r3);\n r26 = r26 + -1;\n r19 = r19 + 1;\n r21 = r21 + 1;\n goto L_0x0496;\n L_0x04aa:\n r4 = r9 - r8;\n r8 = r37 + r4;\n r4 = r18 - r17;\n r9 = r38 - r4;\n r4 = r16[r8];\n r4 = r4 + r34;\n r4 = r16[r4];\n r0 = r31;\n if (r4 == r0) goto L_0x04d3;\n L_0x04bc:\n r4 = r9 - r8;\n r24 = trLog(r4);\n L_0x04c2:\n r17 = r37;\n r31 = r8 + -1;\n L_0x04c6:\n r0 = r17;\n if (r0 >= r8) goto L_0x04d6;\n L_0x04ca:\n r4 = r16[r17];\n r4 = r4 + r34;\n r16[r4] = r31;\n r17 = r17 + 1;\n goto L_0x04c6;\n L_0x04d3:\n r24 = -1;\n goto L_0x04c2;\n L_0x04d6:\n r0 = r38;\n if (r9 >= r0) goto L_0x04eb;\n L_0x04da:\n r17 = r8;\n r31 = r9 + -1;\n L_0x04de:\n r0 = r17;\n if (r0 >= r9) goto L_0x04eb;\n L_0x04e2:\n r4 = r16[r17];\n r4 = r4 + r34;\n r16[r4] = r31;\n r17 = r17 + 1;\n goto L_0x04de;\n L_0x04eb:\n r4 = r8 - r37;\n r5 = r38 - r9;\n if (r4 > r5) goto L_0x060c;\n L_0x04f1:\n r4 = r38 - r9;\n r5 = r9 - r8;\n if (r4 > r5) goto L_0x0571;\n L_0x04f7:\n r4 = 1;\n r5 = r8 - r37;\n if (r4 >= r5) goto L_0x051e;\n L_0x04fc:\n r27 = r28 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r5 = r35 + 1;\n r0 = r24;\n r4.<init>(r5, r8, r9, r0);\n r29[r28] = r4;\n r28 = r27 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r0 = r35;\n r1 = r38;\n r2 = r22;\n r4.<init>(r0, r9, r1, r2);\n r29[r27] = r4;\n r38 = r8;\n r23 = r22;\n goto L_0x001a;\n L_0x051e:\n r4 = 1;\n r5 = r38 - r9;\n if (r4 >= r5) goto L_0x0538;\n L_0x0523:\n r27 = r28 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r5 = r35 + 1;\n r0 = r24;\n r4.<init>(r5, r8, r9, r0);\n r29[r28] = r4;\n r37 = r9;\n r28 = r27;\n r23 = r22;\n goto L_0x001a;\n L_0x0538:\n r4 = 1;\n r5 = r9 - r8;\n if (r4 >= r5) goto L_0x0549;\n L_0x053d:\n r35 = r35 + 1;\n r37 = r8;\n r38 = r9;\n r22 = r24;\n r23 = r22;\n goto L_0x001a;\n L_0x0549:\n if (r28 != 0) goto L_0x054f;\n L_0x054b:\n r27 = r28;\n goto L_0x00f9;\n L_0x054f:\n r27 = r28 + -1;\n r20 = r29[r27];\n r0 = r20;\n r0 = r0.a_isRightVersion;\n r35 = r0;\n r0 = r20;\n r0 = r0.b;\n r37 = r0;\n r0 = r20;\n r0 = r0.c;\n r38 = r0;\n r0 = r20;\n r0 = r0.d;\n r22 = r0;\n r28 = r27;\n r23 = r22;\n goto L_0x001a;\n L_0x0571:\n r4 = r8 - r37;\n r5 = r9 - r8;\n if (r4 > r5) goto L_0x05c6;\n L_0x0577:\n r4 = 1;\n r5 = r8 - r37;\n if (r4 >= r5) goto L_0x059e;\n L_0x057c:\n r27 = r28 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r0 = r35;\n r1 = r38;\n r2 = r22;\n r4.<init>(r0, r9, r1, r2);\n r29[r28] = r4;\n r28 = r27 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r5 = r35 + 1;\n r0 = r24;\n r4.<init>(r5, r8, r9, r0);\n r29[r27] = r4;\n r38 = r8;\n r23 = r22;\n goto L_0x001a;\n L_0x059e:\n r4 = 1;\n r5 = r9 - r8;\n if (r4 >= r5) goto L_0x05c0;\n L_0x05a3:\n r27 = r28 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r0 = r35;\n r1 = r38;\n r2 = r22;\n r4.<init>(r0, r9, r1, r2);\n r29[r28] = r4;\n r35 = r35 + 1;\n r37 = r8;\n r38 = r9;\n r22 = r24;\n r28 = r27;\n r23 = r22;\n goto L_0x001a;\n L_0x05c0:\n r37 = r9;\n r23 = r22;\n goto L_0x001a;\n L_0x05c6:\n r4 = 1;\n r5 = r9 - r8;\n if (r4 >= r5) goto L_0x05f5;\n L_0x05cb:\n r27 = r28 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r0 = r35;\n r1 = r38;\n r2 = r22;\n r4.<init>(r0, r9, r1, r2);\n r29[r28] = r4;\n r28 = r27 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r0 = r35;\n r1 = r37;\n r2 = r22;\n r4.<init>(r0, r1, r8, r2);\n r29[r27] = r4;\n r35 = r35 + 1;\n r37 = r8;\n r38 = r9;\n r22 = r24;\n r23 = r22;\n goto L_0x001a;\n L_0x05f5:\n r27 = r28 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r0 = r35;\n r1 = r38;\n r2 = r22;\n r4.<init>(r0, r9, r1, r2);\n r29[r28] = r4;\n r38 = r8;\n r28 = r27;\n r23 = r22;\n goto L_0x001a;\n L_0x060c:\n r4 = r8 - r37;\n r5 = r9 - r8;\n if (r4 > r5) goto L_0x067b;\n L_0x0612:\n r4 = 1;\n r5 = r38 - r9;\n if (r4 >= r5) goto L_0x0639;\n L_0x0617:\n r27 = r28 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r5 = r35 + 1;\n r0 = r24;\n r4.<init>(r5, r8, r9, r0);\n r29[r28] = r4;\n r28 = r27 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r0 = r35;\n r1 = r37;\n r2 = r22;\n r4.<init>(r0, r1, r8, r2);\n r29[r27] = r4;\n r37 = r9;\n r23 = r22;\n goto L_0x001a;\n L_0x0639:\n r4 = 1;\n r5 = r8 - r37;\n if (r4 >= r5) goto L_0x0653;\n L_0x063e:\n r27 = r28 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r5 = r35 + 1;\n r0 = r24;\n r4.<init>(r5, r8, r9, r0);\n r29[r28] = r4;\n r38 = r8;\n r28 = r27;\n r23 = r22;\n goto L_0x001a;\n L_0x0653:\n r4 = 1;\n r5 = r9 - r8;\n if (r4 >= r5) goto L_0x0664;\n L_0x0658:\n r35 = r35 + 1;\n r37 = r8;\n r38 = r9;\n r22 = r24;\n r23 = r22;\n goto L_0x001a;\n L_0x0664:\n r27 = r28 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r0 = r35;\n r1 = r37;\n r2 = r38;\n r3 = r22;\n r4.<init>(r0, r1, r2, r3);\n r29[r28] = r4;\n r28 = r27;\n r23 = r22;\n goto L_0x001a;\n L_0x067b:\n r4 = r38 - r9;\n r5 = r9 - r8;\n if (r4 > r5) goto L_0x06d0;\n L_0x0681:\n r4 = 1;\n r5 = r38 - r9;\n if (r4 >= r5) goto L_0x06a8;\n L_0x0686:\n r27 = r28 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r0 = r35;\n r1 = r37;\n r2 = r22;\n r4.<init>(r0, r1, r8, r2);\n r29[r28] = r4;\n r28 = r27 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r5 = r35 + 1;\n r0 = r24;\n r4.<init>(r5, r8, r9, r0);\n r29[r27] = r4;\n r37 = r9;\n r23 = r22;\n goto L_0x001a;\n L_0x06a8:\n r4 = 1;\n r5 = r9 - r8;\n if (r4 >= r5) goto L_0x06ca;\n L_0x06ad:\n r27 = r28 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r0 = r35;\n r1 = r37;\n r2 = r22;\n r4.<init>(r0, r1, r8, r2);\n r29[r28] = r4;\n r35 = r35 + 1;\n r37 = r8;\n r38 = r9;\n r22 = r24;\n r28 = r27;\n r23 = r22;\n goto L_0x001a;\n L_0x06ca:\n r38 = r8;\n r23 = r22;\n goto L_0x001a;\n L_0x06d0:\n r4 = 1;\n r5 = r9 - r8;\n if (r4 >= r5) goto L_0x06ff;\n L_0x06d5:\n r27 = r28 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r0 = r35;\n r1 = r37;\n r2 = r22;\n r4.<init>(r0, r1, r8, r2);\n r29[r28] = r4;\n r28 = r27 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r0 = r35;\n r1 = r38;\n r2 = r22;\n r4.<init>(r0, r9, r1, r2);\n r29[r27] = r4;\n r35 = r35 + 1;\n r37 = r8;\n r38 = r9;\n r22 = r24;\n r23 = r22;\n goto L_0x001a;\n L_0x06ff:\n r27 = r28 + 1;\n r4 = new io.netty.handler.codec.compression.Bzip2DivSufSort$StackEntry;\n r0 = r35;\n r1 = r37;\n r2 = r22;\n r4.<init>(r0, r1, r8, r2);\n r29[r28] = r4;\n r37 = r9;\n r28 = r27;\n r23 = r22;\n goto L_0x001a;\n L_0x0716:\n r4 = r38 - r37;\n r0 = r39;\n r1 = r40;\n r4 = r0.update(r1, r4);\n if (r4 == 0) goto L_0x002f;\n L_0x0722:\n r22 = r22 + 1;\n r35 = r35 + 1;\n r23 = r22;\n goto L_0x001a;\n L_0x072a:\n r27 = r28;\n goto L_0x00f9;\n */\n throw new UnsupportedOperationException(\"Method not decompiled: io.netty.handler.codec.compression.Bzip2DivSufSort.trIntroSort(int, int, int, int, int, io.netty.handler.codec.compression.Bzip2DivSufSort$TRBudget, int):void\");\n }", "void merge_at(int i) {\n \n int pa = this.base[i];\n int pb = this.base[i+1];\n int na = this.len[i];\n int nb = this.len[i+1];\n \n //assert_(na > 0 && nb > 0);\n //assert_(pa + na == pb);\n \n // Record the length of the combined runs; if i is the 3rd-last\n // run now, also slide over the last run (which isn't involved\n // in this merge). The current run i+1 goes away in any case.\n if (i == this.n - 3) {\n this.len[i+1] = this.len[i+2];\n this.base[i+1] = this.base[i+2];\n }\n this.len[i] = na + nb;\n --this.n;\n \n // Where does b start in a? Elements in a before that can be\n // ignored (already in place).\n int k = gallop_right(this.data[pb], this.data, pa, na, 0);\n pa += k;\n na -= k;\n if (na == 0)\n return;\n \n // Where does a end in b? Elements in b after that can be\n // ignored (already in place).\n nb = gallop_left(this.data[pa + na - 1], this.data, pb, nb, nb-1);\n if (nb == 0)\n return;\n \n // Merge what remains of the runs, using a temp array with\n // min(na, nb) elements.\n if (na <= nb)\n merge_lo(pa, na, pb, nb);\n else\n merge_hi(pa, na, pb, nb);\n }", "static int APUtil(ArrayList<Arista>[] adj, int u, boolean visited[], int disc[], int low[], int parent[], int ap[]){\n\n // Count of children in DFS Tree\n int children = 0;\n\n // Mark the current node as visited\n visited[u] = true;\n\n // Initialize discovery time and low value\n disc[u] = low[u] = ++time;\n\n // Go through all vertices aadjacent to this\n for (Arista arista : adj[u]) {\n int v = arista.to; // v is current adjacent of u\n\n // If v is not visited yet, then make it a child of u\n // in DFS tree and recur for it\n if (!visited[v]) {\n children++;\n parent[v] = u;\n sol = APUtil(adj, v, visited, disc, low, parent, ap);\n\n // Check if the subtree rooted with v has a connection to\n // one of the ancestors of u\n low[u] = Math.min(low[u], low[v]);\n\n // u is an articulation point in following cases\n\n // (1) u is root of DFS tree and has two or more chilren.\n if (parent[u] == -1 && children > 1){\n ap[u]++;\n if((ap[u] > ap[sol]) || (ap[u] == ap[sol] && u < sol))\n sol = u;\n }\n\n\n // (2) If u is not root and low value of one of its child\n // is more than discovery value of u.\n if (parent[u] != -1 && low[v] >= disc[u]){\n ap[u]++;\n if((ap[u] > ap[sol]) || (ap[u] == ap[sol] && u < sol))\n sol = u;\n }\n\n }\n\n // Update low value of u for parent function calls.\n else if (v != parent[u])\n low[u] = Math.min(low[u], disc[v]);\n }\n\n return sol;\n }", "public RadixSorting()\n\t{\n\t\tbuckets.add(zero);\n\t\tbuckets.add(one);\n\t\tbuckets.add(two);\n\t\tbuckets.add(three);\n\t\tbuckets.add(four);\n\t\tbuckets.add(five);\n\t\tbuckets.add(six);\n\t\tbuckets.add(seven);\n\t\tbuckets.add(eight);\n\t\tbuckets.add(nine);\n\t\tbuckets.add(ten);\n\t\tbuckets.add(eleven);\n\t\tbuckets.add(twelve);\n\t\tbuckets.add(thirteen);\n\t\tbuckets.add(fourteen);\n\t\tbuckets.add(fifteen);\n\t\tbuckets.add(sixteen);\n\t\tbuckets.add(seventeen);\n\t\tbuckets.add(eighteen);\n\t\tbuckets.add(nineteen);\n\t}", "private int e(amj paramamj)\r\n/* 202: */ {\r\n/* 203:221 */ alq localalq = paramamj.b();\r\n/* 204:222 */ int i = paramamj.b;\r\n/* 205: */ \r\n/* 206:224 */ int j = d(paramamj);\r\n/* 207:225 */ if (j < 0) {\r\n/* 208:226 */ j = j();\r\n/* 209: */ }\r\n/* 210:228 */ if (j < 0) {\r\n/* 211:229 */ return i;\r\n/* 212: */ }\r\n/* 213:231 */ if (this.a[j] == null)\r\n/* 214: */ {\r\n/* 215:232 */ this.a[j] = new amj(localalq, 0, paramamj.i());\r\n/* 216:233 */ if (paramamj.n()) {\r\n/* 217:234 */ this.a[j].d((fn)paramamj.o().b());\r\n/* 218: */ }\r\n/* 219: */ }\r\n/* 220:238 */ int k = i;\r\n/* 221:239 */ if (k > this.a[j].c() - this.a[j].b) {\r\n/* 222:240 */ k = this.a[j].c() - this.a[j].b;\r\n/* 223: */ }\r\n/* 224:242 */ if (k > p_() - this.a[j].b) {\r\n/* 225:243 */ k = p_() - this.a[j].b;\r\n/* 226: */ }\r\n/* 227:246 */ if (k == 0) {\r\n/* 228:247 */ return i;\r\n/* 229: */ }\r\n/* 230:250 */ i -= k;\r\n/* 231:251 */ this.a[j].b += k;\r\n/* 232:252 */ this.a[j].c = 5;\r\n/* 233: */ \r\n/* 234:254 */ return i;\r\n/* 235: */ }", "private static void dfsBribe(int n, List<Integer>[] ch, long[] w) {\n if (ch[n].size() == 0){\n In[n] = w[n];\n OutD[n] = Long.MAX_VALUE;\n OutU[n] = 0;\n }\n //recurrance case: non.leaf, do dfs for all subordinates then calculate In, OutUp & OutDown.\n else{\n for (int c:ch[n])\n dfsBribe(c, ch, w); //running once for each child thereby O(N)\n In[n] = w[n];\n for (int c:ch[n]){ //O(N) running time\n In[n] += OutU[c];\n OutU[n] += Math.min(In[c], OutD[c]);\n OutD[n] += Math.min(In[c], OutD[c]);\n }\n OutD[n] += delta(n, ch); //add delta for no in Children\n }\n\n }", "private static void sortAccording(int A1[], int A2[], int m, int n)\n {\n // The temp array is used to store a copy \n // of A1[] and visited[] is used to mark the \n // visited elements in temp[].\n int temp[] = new int[m], visited[] = new int[m];\n for (int i = 0; i < m; i++)\n {\n temp[i] = A1[i];\n visited[i] = 0;\n }\n \n // Sort elements in temp\n Arrays.sort(temp);\n \n // for index of output which is sorted A1[]\n int ind = 0; \n \n // Consider all elements of A2[], find them\n // in temp[] and copy to A1[] in order.\n for (int i = 0; i < n; i++){\n\n // Find index of the first occurrence\n // of A2[i] in temp\n int f = first(temp, 0, m-1, A2[i], m);\n \n // If not present, no need to proceed\n if (f == -1) \n continue;\n \n // Copy all occurrences of A2[i] to A1[]\n for (int j = f; (j < m && temp[j] == A2[i]); j++){\n \n A1[ind++] = temp[j];\n visited[j] = 1;\n }\n }\n \n // Now copy all items of temp[] which are \n // not present in A2[]\n for (int i = 0; i < m; i++)\n if (visited[i] == 0)\n A1[ind++] = temp[i];\n }", "public void bucketSort() {\n MyArray ten = new MyArray();\n MyArray hundred = new MyArray();\n MyArray thousand = new MyArray();\n MyArray tenThousand = new MyArray();\n MyArray hundredThousand = new MyArray();\n MyArray million = new MyArray();\n MyArray tenMillion = new MyArray();\n MyArray hundredMillion = new MyArray();\n MyArray billion = new MyArray();\n\n for (int i = 0; i < array.length; i++) {\n if ((int) array[i] / 10 < 0) {\n ten.add(array[i]);\n } else if ((int) array[i] / 100 < 0) {\n hundred.add(array[i]);\n } else if ((int) array[i] / 1000 < 0) {\n thousand.add(array[i]);\n } else if ((int) array[i] / 10000 < 0) {\n tenThousand.add(array[i]);\n } else if ((int) array[i] / 100000 < 0) {\n hundredThousand.add(array[i]);\n } else if ((int) array[i] / 1000000 < 0) {\n million.add(array[i]);\n } else if ((int) array[i] / 10000000 < 0) {\n tenMillion.add(array[i]);\n } else if ((int) array[i] / 100000000 < 0) {\n hundredMillion.add(array[i]);\n } else {\n billion.add(array[i]);\n }\n }\n\n ten = ten.radixSort(ten);\n hundred = hundred.radixSort(hundred);\n thousand = thousand.radixSort(thousand);\n tenThousand = tenThousand.radixSort(tenThousand);\n hundredThousand = hundredThousand.radixSort(hundredThousand);\n million = million.radixSort(million);\n tenMillion = tenMillion.radixSort(tenMillion);\n hundredMillion = hundredMillion.radixSort(hundredMillion);\n billion = billion.radixSort(billion);\n\n int j = 0;\n for (int i = 0; i < ten.getSize(); i++) {\n array[i] = (T) ten.get(i);\n j++;\n }\n for (int i = 0; i < hundred.getSize(); i++) {\n array[i] = (T) hundred.get(i);\n j++;\n }\n for (int i = 0; i < thousand.getSize(); i++) {\n array[i] = (T) thousand.get(i);\n j++;\n }\n for (int i = 0; i < tenThousand.getSize(); i++) {\n array[i] = (T) tenThousand.get(i);\n j++;\n }\n for (int i = 0; i < hundredThousand.getSize(); i++) {\n array[i] = (T) hundredThousand.get(i);\n j++;\n }\n for (int i = 0; i < million.getSize(); i++) {\n array[i] = (T) million.get(i);\n j++;\n }\n for (int i = 0; i < tenMillion.getSize(); i++) {\n array[i] = (T) tenMillion.get(i);\n j++;\n }\n for (int i = 0; i < hundredMillion.getSize(); i++) {\n array[j] = (T) hundredMillion.get(i);\n j++;\n }\n for (int i = 0; i < billion.getSize(); i++) {\n array[j] = (T) billion.get(i);\n j++;\n }\n\n }", "WeightedUnionFind(int N){\n id = new int[N];\n size = new int[N];\n for (int i = 0; i < N; i++){\n id[i] = i;\n size[i] = 1;\n }\n }", "public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint arr[] = new int[n];\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tarr[i] = sc.nextInt();\n\t\t}\n\t\tint sum = sc.nextInt();\n\t\tHashMap<Integer,Integer> map = new HashMap<>();\n \t\tArrays.sort(arr);\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tint temp = arr[i];\n\t\t\tint reqSum = sum-temp;\n\t\t\tarr[i]=0;\n\t\t\tint l=0;\n\t\t\tint r = n-1;\n\t\t\twhile(l<r) {\n\t\t\t\t//System.out.println(\"l \" + l + \" r \" + r + \" i = \"+ i);\n\t\t\t\tif(arr[l] + arr[r]==reqSum && arr[l]!=0 && arr[r]!=0 ) {\n\t\t\t\t\tint arr2[] = new int[3];\n\t\t\t\t\tarr2[0] = temp;\n\t\t\t\t\tarr2[1] = arr[l];\n\t\t\t\t\tarr2[2] = arr[r];\n\t\t\t\t\tif(map.containsKey(arr2[0]) || map.containsKey(arr2[1]) || map.containsKey(arr2[2])) {\n\t\t\t\t\t\t\n\t\t\t\t\t}else {\n\t\t\t\t\t\tArrays.sort(arr2);\n\t\t\t\t\t\tSystem.out.println(arr2[0] + \" \" + arr2[1] + \" \" + arr2[2]);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tl++;\n\t\t\t\t}else if(arr[l] + arr[r] < reqSum) {\n\t\t\t\t\tl++;\n\t\t\t\t\t\n\t\t\t\t}else {\n\t\t\t\t\tr--;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\tarr[i] = temp;\t\n\t\t\tmap.put(arr[i], 1);\n\t\t}\n\t}", "private static Answer kruskalsAlgo(int v, int e, List<edge> edges) {\n Collections.sort(edges, new Comparator<edge>() {\n @Override\n public int compare(edge o1, edge o2) {\n return o1.w - o2.w;\n }\n });\n //To apply unionfind algorithm , we need to maintain a parent array\n //this will be initialised with same vertex\n int[] p = new int[v];\n for (int i = 0; i < v; i++) {\n p[i] = i;\n }\n //keep a boolean visited array\n boolean[] vis = new boolean[v];\n int cost=0;\n //iterate though edges 1 by 1 and check for cycle detection either by hasPath method or by unionFindalgorithm\n for (int i = 0; i < e; i++) {\n edge edge = edges.get(i);\n\n int p1 = findTopmostParent(edge.a, p);\n int p2 = findTopmostParent(edge.b, p);\n\n if (p1!=p2 && edges.get(i).w <A ) {\n cost+=edges.get(i).w;\n p[p2] = p1;\n\n }\n }\n int c =0;\n for(int i =0;i<v;i++){\n if(p[i]==i){\n c++;\n }\n }\n cost+=c*A;\n return new Answer(c,cost );\n }", "static List<Integer> unique(List<Integer> a, List<Integer> b) {\n\t\t\n\t\t// Base case 01:\n\t\tif (a.isEmpty()) {\n\t\t\t\n\t\t\treturn b;\n\t\t\n\t\t // Base case 02:\n\t\t} else if (b.isEmpty()) {\n\t\t\t\n\t\t\treturn a;\n\t\t\n\t\t // Recursive step:\n\t\t} else if (a.getHead() < b.getHead()) {\n\t\t\t\n\t\t\treturn new List<>(a.getHead(), unique(a.getTail(), b));\n\t\t\t\n\t\t} else if (a.getHead() > b.getHead()) {\n\t\t\t\n\t\t\treturn new List<>(b.getHead(), unique(a, b.getTail()));\n\t\t\t\n\t\t} else { // a.getHead() == b.getHead()\n\t\t\t\n\t\t\treturn unique(a.getTail(), b.getTail());\n\t\t}\n\t}", "static long[] radixsort(int arr[], int n)\r\n\r\n {\n\r\n int m = getMax(arr, n);\r\n\r\n long st = System.nanoTime();\r\n\r\n\r\n\r\n for (int exp = 1; m/exp > 0; exp *= 10)\r\n\r\n countSort(arr, n, exp);\r\n\r\n \r\n\r\n long et = System.nanoTime();\r\n\r\n threeVals[2] = et - st;\r\n\r\n return threeVals;\r\n\r\n }", "public static Long compactForwardAlgorithm(ArrayList<Integer>[] graph) {\n // define injective function eta - takes O(n log(n)) time\n Set<Pair<Integer, ArrayList<Integer>>> pairs = Utils.getSortedArrays(graph);\n Map<Integer, Integer> etas = Utils.getEtasMap(pairs);\n\n // sort adjacency arrays according to eta\n pairs.forEach(p -> Collections.sort(p.getSecond(), new Comparator<Integer>() {\n @Override\n public int compare(Integer first, Integer second) {\n if (etas.get(first) > etas.get(second))\n return 1;\n else\n return -1;\n }\n }));\n\n int triangleCount = 0;\n\n // main part, in which we actually count triangles\n Iterator<Pair<Integer, ArrayList<Integer>>> iterator = pairs.iterator();\n while (iterator.hasNext()) {\n Pair<Integer, ArrayList<Integer>> pair = iterator.next();\n Integer v = pair.getFirst();\n ArrayList<Integer> v_neighbors = graph[v];\n\n for (int u : v_neighbors) {\n if (etas.get(u) > etas.get(v)) {\n ArrayList<Integer> u_neighbors = graph[u];\n\n Iterator<Integer> uIterator = u_neighbors.iterator(), vIterator = v_neighbors.iterator();\n\n if (uIterator.hasNext() && vIterator.hasNext()) {\n Integer u_ = uIterator.next(), v_ = vIterator.next();\n while (uIterator.hasNext() && vIterator.hasNext() && etas.get(u_) < etas.get(v)\n && etas.get(v_) < etas.get(v)) {\n if (etas.get(u_) < etas.get(v_))\n u_ = uIterator.next();\n else if (etas.get(u_) > etas.get(v_))\n v_ = vIterator.next();\n else {\n triangleCount++;\n u_ = uIterator.next();\n v_ = vIterator.next();\n }\n }\n\n }\n }\n }\n }\n return new Long(triangleCount);\n }", "public void union(int first, int second){\n int firstId = find(first);\n int secondId = find(second);\n //Check if these are already connected\n if(firstId == secondId){\n return;\n }\n if(size[firstId] < size[secondId]){\n size[secondId]+=size[firstId];\n grid[first] = secondId;\n }\n else {\n size[firstId]+=size[secondId];\n grid[second] = firstId;\n }\n --numOfComponents;\n }", "private static int sortAndCount(Comparable[] a, Comparable[] aux, int lo, int hi) {\n if (hi <= lo) return 0;\n\n int mid = (lo + hi) / 2;\n // sort and count left inversions\n int left = sortAndCount(a, aux, lo, mid);\n // sort and count right inversions\n int right = sortAndCount(a, aux, mid+1, hi);\n // merge and count split inversions\n if (debug) {\n System.out.println(\"Merging ( \" + lo + \" \" + hi + \" ): \");\n for (int i = 0; i < a.length; i++)\n System.out.print(a[i] + \"\\t\");\n System.out.println();\n }\n int split = mergeAndCountSplit(a, aux, lo, mid, hi);\n // return all inversions\n if (debug) {\n System.out.println(\"Returning ( \" + lo + \" \" + hi + \" ): \");\n for (int i = 0; i < a.length; i++)\n System.out.print(a[i] + \"\\t\");\n System.out.println();\n }\n return (left + right + split);\n }", "static public void merge2(Comparable[]x,int ip,int im,int iu){\n\t\tObject[]aux = new Object[iu+1]; //arreglo auxiliar\n\t\tfor(int i=ip, i1=ip, i2=im+1; i<=iu; ++i)\n\t\t\tif(i1<=im && (i2>iu || x[i1].compareTo(x[i2])<0))\n\t\t\t\taux[i] = x[i1++];\n\t\t\telse\n\t\t\t\taux[i] = x[i2++];\n\t\t//copiar arreglo auxiliar en arreglo original\n\t\tfor(int i=ip; i<=iu; ++i) x[i]=(Comparable)aux[i];\n\t}", "private void rmerge(int[] arr, int a, int l, int r) {\n\t\tfor (int i = 0; i < l; i += r) {\n\t\t\t// select smallest arr[p0+n*r]\n\t\t\tint q = i;\n\t\t\tfor (int j = i + r; j < l; j += r) {\n\t\t\t\tif (this.reads.compare(arr[a + q], arr[a + j]) > 0) {\n\t\t\t\t\tq = j;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (q != i) {\n\t\t\t\taswap(arr, a + i, a + q, r); // swap it with current position\n\t\t\t}\n\t\t\tif (i != 0) {\n\t\t\t\taswap(arr, a + l, a + i, r); // swap current position with buffer\n\t\t\t\tbackmerge(arr, a + (l + r - 1), r, a + (i - 1), r); // buffer :merge: arr[i-r..i) -> arr[i-r..i+r)\n\t\t\t}\n\t\t}\n\t}", "public static void main(String[] args) throws IOException{\n Scanner f = new Scanner(System.in);\n //BufferedReader f = new BufferedReader(new FileReader(\"uva.in\"));\n //BufferedReader f = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n while(true) {\n int C = f.nextInt();\n int R = f.nextInt();\n if(C == 0 && R == 0) {\n break;\n }\n HashMap<String,Integer> getIndex = new HashMap<>();\n for(int i = 0; i < C; i++) {\n getIndex.put(f.next(),i);\n }\n int[] leaderIds = new int[C];\n int[] groupSizes = new int[C];\n for(int i = 0; i < C; i++) {\n leaderIds[i] = i;\n groupSizes[i] = 1;\n }\n for(int i = 0; i < R; i++) {\n int p = getIndex.get(f.next());\n int q = getIndex.get(f.next());\n if(root(leaderIds,p) != root(leaderIds,q)) {\n union(leaderIds,groupSizes,p,q);\n }\n }\n int max = 0;\n for(int i = 0; i < C; i++) {\n int p = root(leaderIds,i);\n max = Math.max(max,groupSizes[p]);\n }\n out.println(max);\n }\n f.close();\n out.close();\n }", "static int[][] packU(int n, int[] from, int[] to) {\n// this part of code is taken from \"uwi\" submission of codechef problem KNODES \n int[][] g = new int[n][];\n int[] p = new int[n];\n for (int f : from) {\n p[f]++;\n }\n for (int t : to) {\n p[t]++;\n }\n for (int i = 0; i < n; i++) {\n g[i] = new int[p[i]];\n }\n for (int i = 0; i < from.length; i++) {\n g[from[i]][--p[from[i]]] = to[i];\n g[to[i]][--p[to[i]]] = from[i];\n }\n return g;\n }", "public void union(int i, int j) {\n\tint p = findRoot(i);\n\tint q = findRoot(j);\n\t\n\tif (p == q) return;\n\t\n\tif (size[p] < size[q]) { //pick the smallest tree and append it to the bigger tree\n\t root[p] = q;\n\t size[p] += size[q];\n\t} else {\n\t root[q] = p;\n\t size[q] += size[p];\n\t}\n }", "public void topologicalSort() {\n HashMap<Integer, Integer> inDegrees = new HashMap<>();\n Queue<Integer> queue = new LinkedList<>();\n int numTotalNodes = 0;\n\n // Build the inDegree HashMap\n for (Entry<Integer, LinkedList<Edge<Integer>>> entry : g.adj.entrySet()) {\n LinkedList<Edge<Integer>> vList = entry.getValue();\n int currentVertex = entry.getKey();\n\n inDegrees.put(currentVertex, inDegrees.getOrDefault(currentVertex, 0));\n for (Edge<Integer> e : vList) {\n inDegrees.put(e.dest, inDegrees.getOrDefault(e.dest, 0) + 1);\n numTotalNodes++;\n }\n }\n\n // Add Elements with inDegree zero toe the queue\n for (int v : inDegrees.keySet()) {\n if (inDegrees.get(v) > 0)\n continue;\n queue.add(v);\n }\n\n int visitedNodes = 0;\n\n while (!queue.isEmpty()) {\n int v = queue.remove();\n System.out.print(v + \" \");\n for (int u : g.getNeighbors(v)) {\n int inDeg = inDegrees.get(u) - 1;\n if (inDeg == 0)\n queue.add(u);\n inDegrees.put(u, inDeg);\n }\n visitedNodes++;\n }\n\n if (visitedNodes != numTotalNodes) {\n System.out.println(\"Graph is not a DAG\");\n }\n }", "public interface FilterRestaurantsByVeganFriendlyPriceAndDistance {\n public List<Integer> filterRestaurants(int[][] restaurants, int veganFriendly, int maxPrice,\n int maxDistance);\n\n @Author(value = \"hiepit\", references = \"https://leetcode.com/problems/filter-restaurants-by-vegan-friendly-price-and-distance/discuss/491469/Java-Straight-Forward-HashMap\")\n @Submission(memory = 48.7, memoryBeatRate = 100, runtime = 10, runtimeBeatRate = 24.82, submittedDate = @DateTime(\"20200327\"), url = \"https://leetcode.com/submissions/detail/316279312/\")\n @SortAlgorithm(timeComplexity = @TimeComplexity(average = ComplexityEnum.O_N_LOG_N), spaceComplexity = ComplexityEnum.O_N)\n public static class SolutionBySort implements FilterRestaurantsByVeganFriendlyPriceAndDistance {\n /**\n * 注意要先通过rating和id一起降序排序,如果仅排rating,然后反向add id是不行的\n */\n @Override\n public List<Integer> filterRestaurants(int[][] restaurants, int veganFriendly, int maxPrice,\n int maxDistance) {\n // 0. descendant sort by rating and id\n Arrays.sort(restaurants, (a, b) -> b[1] == a[1] ? b[0] - a[0] : b[1] - a[1]);\n // 1. filter with conditions\n List<Integer> res = new ArrayList<>(restaurants.length);\n for (int[] r : restaurants) {\n if (r[2] >= veganFriendly && r[3] <= maxPrice && r[4] <= maxDistance) {\n res.add(r[0]);\n }\n }\n return res;\n }\n }\n\n public static void main(String[] args) {\n int[][] restaurants = {{1, 4, 1, 40, 10}, {2, 8, 0, 50, 5}, {3, 8, 1, 30, 4}, {4, 10, 0, 10, 3},\n {5, 1, 1, 15, 1}};\n FilterRestaurantsByVeganFriendlyPriceAndDistance p = new SolutionBySort();\n int veganFriendly = 0, maxPrice = 50, maxDistance = 10;\n p.filterRestaurants(restaurants, veganFriendly, maxPrice, maxDistance);\n }\n}", "private int houseRobberWithMaxAmountHousesFromItoJInConstantSpace(int[] a, int i, int j) {\n\t\tif (null == a || i > j)\n\t\t\treturn 0;\n\n\t\tif (j - i == 0)\n\t\t\treturn a[i];\n\n\t\tint incl = a[i];\n\t\tint excl = 0, temp;\n\n\t\tfor (int k = i + 1; k <= j; k++) {\n\t\t\ttemp = incl;\n\t\t\tincl = Math.max(excl + a[k], incl);\n\t\t\texcl = temp;\n\t\t}\n\t\treturn incl;\n\t}", "public void union(int p, int q)\n {\n int i = root(p);\n int j = root(q);\n if ( i == j ) return;\n \n if ( sz[i] < sz[j] ) { \n // i is no longer a root, so we don't need to update the size\n id[i] = j; sz[j] += sz[i];\n }\n else {\n id[j] = i; sz[i] += sz[j]; \n } \n }", "public static void sort(Integer a[]) {\n\n int arr[] = new int[a.length];\n int x = a.length;\n\n int max_digits = String.valueOf(get_max(a)).length();\n\n for (int i = 1; i<= Math.pow(10, max_digits); i *= 10){\n\n int[] place = new int[10];\n\n for (int j = 0; j < x; j++){\n\n place [(a[j] / i) % 10]++;\n }\n for (int j = 1; j < place.length; j++){\n place[j] += place[j-1];\n }\n\n for (int j = a.length -1; j>=0; j--)\n {\n arr[place[(a[j]/ i) % 10]- 1] = a[j];\n place[(a[j]/ i) % 10] --;\n }\n for (int j = 0; j < a.length; j++){\n a[j] = arr[j];\n }\n\n }\n System.out.println(\"after radix sorted\"+Arrays.toString(a));\n System.out.println(\"\");\n\n\n }", "public int union(int u, int v) {\n int p1 = find(u), p2 = find(v);\n if (p1 == p2) {\n return p1;\n }\n int s1 = _sizes[p1], s2 = _sizes[p2];\n if (s1 > s2) {\n _sizes[p1] += s2;\n// int i = 1;\n// while (s2 > 0) {\n// if (_parents[i] == p2) {\n// _parents[i] = p1;\n// s2 -= 1;\n// }\n// i += 1;\n// }\n _parents[p2] = p1;\n return s1;\n } else {\n _sizes[p2] += s1;\n// int j = 1;\n// while (s1 > 0) {\n// if (_parents[j] == p1) {\n// _parents[j] = p2;\n// s1 -= 1;\n// }\n// j += 1;\n// }\n _parents[p1] = p2;\n return s2;\n }\n }", "void merge_hi(int pa, int na, int pb, int nb) {\n getmem(nb);\n int dest = pb + nb - 1;\n int basea = pa;\n System.arraycopy(this.data, pb, this.a, 0, nb);\n \n pb = nb - 1;\n pa += na - 1;\n \n this.data[dest--] = this.data[pa--];\n --na;\n if (na == 0)\n return;\n if (nb == 1) {\n // CopyA;\n dest -= na;\n pa -= na;\n System.arraycopy(this.data, pa+1, this.data, dest+1, na);\n this.data[dest] = this.a[pb];\n nb = 0;\n return;\n }\n \n try {\n for (;;) {\n int acount = 0; /* # of time A won in a row */\n int bcount = 0; /* # of time B won in a row */\n \n /* Do the straightforward thing until (if ever) one run\n * appears to win consistently.\n */\n for (;;) {\n boolean k = iflt(this.a[pb], this.data[pa]);\n if (k) {\n this.data[dest--] = this.data[pa--];\n ++acount;\n bcount = 0;\n --na;\n if (na == 0)\n return;\n if (acount >= MIN_GALLOP)\n break;\n } else {\n this.data[dest--] = this.a[pb--];\n ++bcount;\n acount = 0;\n --nb;\n if (nb == 1) {\n // CopyA\n dest -= na;\n pa -= na;\n System.arraycopy(this.data, pa+1, this.data, dest+1, na);\n this.data[dest] = this.a[pb];\n nb = 0;\n return;\n }\n if (bcount >= MIN_GALLOP)\n break;\n }\n }\n \n /* One run is winning so consistently that galloping may\n * be a huge win. So try that, and continue galloping until\n * (if ever) neither run appears to be winning consistently\n * anymore.\n */\n do {\n int k = gallop_right(this.a[pb], this.data, basea, na, na-1);\n acount = k = na - k;\n if (k != 0) {\n dest -= k;\n pa -= k;\n System.arraycopy(this.data, pa+1, this.data, dest+1, k);\n na -= k;\n if (na == 0)\n return;\n }\n \n this.data[dest--] = this.a[pb--];\n --nb;\n if (nb == 1) {\n // CopyA\n dest -= na;\n pa -= na;\n System.arraycopy(this.data, pa+1, this.data, dest+1, na);\n this.data[dest] = this.a[pb];\n nb = 0;\n return;\n }\n \n k = gallop_left(this.data[pa], this.a, 0, nb, nb-1);\n bcount = k = nb - k;\n if (k != 0) {\n dest -= k;\n pb -= k;\n System.arraycopy(this.a, pb+1, this.data, dest+1, k);\n nb -= k;\n if (nb == 1) {\n // CopyA\n dest -= na;\n pa -= na;\n System.arraycopy(this.data, pa+1, this.data, dest+1, na);\n this.data[dest] = this.a[pb];\n nb = 0;\n return;\n }\n /* nb==0 is impossible now if the comparison\n * function is consistent, but we can't assume\n * that it is.\n */\n if (nb == 0)\n return;\n }\n this.data[dest--] = this.data[pa--];\n --na;\n if (na == 0)\n return;\n } while (acount >= MIN_GALLOP || bcount >= MIN_GALLOP);\n }\n } finally {\n if (nb != 0)\n System.arraycopy(this.a, 0, this.data, dest-(nb-1), nb);\n \n //dump_data(\"result\", origpa, cnt);\n }\n }", "QuickUnionUF(int n) {\n count = n;\n id = new int[n];\n for (int i = 0; i < id.length; i++) { id[i] = i; }\n }", "void union(int a, int b) {\n int aParent = find(a); // find parent of a\n int bParent = find(b); // find parent of b\n\n // here we are everytime setting the parent of a_set as b_set in union\n // set the parent of all a as parent of b\n childToParentMap.put(aParent, bParent);\n }", "public static void main(String[] args) {\n\t\t\n\t\t// 10 Tests: \n\t\tList<Integer> a1 = new List<>();\n\t\tList<Integer> b1 = new List<>(1, new List<>(2, new List<>(3, new List<>())));\n\t\t\n\t\tList<Integer> a2 = new List<>(1, new List<>(2, new List<>(3, new List<>())));\n\t\tList<Integer> b2 = new List<>();\n\t\t\n\t\tList<Integer> a3 = new List<>();\n\t\tList<Integer> b3 = new List<>();\n\t\t\n\t\tList<Integer> a4 = new List<>(1, new List<>(2, new List<>(3, new List<>())));\n\t\tList<Integer> b4 = new List<>(4, new List<>(5, new List<>(6, new List<>())));\n\t\t\n\t\tList<Integer> a5 = new List<>(4, new List<>(5, new List<>(6, new List<>())));\n\t\tList<Integer> b5 = new List<>(1, new List<>(2, new List<>(3, new List<>())));\n\t\t\n\t\tList<Integer> a6 = new List<>(1, new List<>(4, new List<>(6, new List<>()))); \n\t\tList<Integer> b6 = new List<>(5, new List<>(6, new List<>(9, new List<>())));\n\t\t\n\t\tList<Integer> a7 = new List<>(-6, new List<>(-5, new List<>(-4, new List<>())));\n\t\tList<Integer> b7 = new List<>(-3, new List<>(-2, new List<>(-1, new List<>())));\n\t\t\n\t\tList<Integer> a8 = new List<>(-2, new List<>(-1, new List<>(0, new List<>())));\n\t\tList<Integer> b8 = new List<>(-1, new List<>(0, new List<>(1, new List<>(2, new List<>()))));\n\t\t\n\t\tList<Integer> a9 = new List<>(-1, new List<>(0, new List<>(1, new List<>())));\n\t\tList<Integer> b9 = new List<>(3, new List<>(4, new List<>(5, new List<>())));\n\t\t\n\t\tList<Integer> a10 = new List<>(-1, new List<>(0, new List<>(1, new List<>())));\n\t\tList<Integer> b10 = new List<>(-1, new List<>(0, new List<>(1, new List<>())));\n\t\t\n\t\tSystem.out.println(unique(a1, b1));\n\t\tSystem.out.println(unique(a2, b2));\n\t\tSystem.out.println(unique(a3, b3));\n\t\tSystem.out.println(unique(a4, b4));\n\t\tSystem.out.println(unique(a5, b5));\n\t\tSystem.out.println(unique(a6, b6));\n\t\tSystem.out.println(unique(a7, b7));\n\t\tSystem.out.println(unique(a8, b8));\n\t\tSystem.out.println(unique(a9, b9));\n\t\tSystem.out.println(unique(a10, b10));\n\t\t\n\t}", "public static void MergeArrayZigZagWay(int a[] , int b[]){\n int na[] = new int[a.length + b.length];\n\t\tint k = 0;\n\t\tfor(int i = 0; i < a.length; i++){\n\t\t\tna[k++] = a[i];\n\t\t}\n\t\tfor(int i = 0; i < b.length; i++){\n\t\t\tna[k++] = b[i];\n\t\t}\n\t\tArrays.sort(na);\n\t\tint j = na.length - 1;\n\t\tint i = 0;\n\t\twhile(i < j){\n\t\t\tint temp = na[i];\n\t\t\tna[i] = na[j];\n\t\t\tna[j] = temp;\n\t\t\ti++;\n\t\t\tj--;\n\t\t}\n\t\tfor(Integer x : na) {\n\t\t\tSystem.out.print(x + \" \");\n\t\t}\n \n }", "k value.\nFor 2nd tallest group (and the rest), insert each one of them into (S) by k value. So on and so forth.\n\npublic class Solution {\n public int[][] reconstructQueue(int[][] people) {\n Arrays.sort(people,new Comparator<int[]>() {\n @Override\n public int compare(int[] o1, int[] o2){\n return o1[0] != o2[0]? -o1[0] + o2[0]: o1[1] - o2[1];\n }\n });\n\n List<int[]> res = new ArrayList<>();\n for (int[] cur : people) {\n res.add(cur[1], cur); \n }\n return res.toArray(new int[people.length][]);\n }", "private String topologicalSortDfs(int indegree[], HashMap<Character, Set<Character>> adjList){\n \n // we ll use stringbuilder to update the characters instead of string\n // we ll insert all elements into queue who has indegree==0 initially, which means they dont have any dependency so they can come at any time//\n // so insert all indgree==0 into queu and do a stanmdard queue template\n StringBuilder sb = new StringBuilder();\n Queue<Character> q = new LinkedList();\n int totalChars = adjList.size(); // to check at end if all are present\n \n \n // loop thru all keys in graph and check the indegree of that character in indegree if its has zero , if so then add to queue initially\n // initial push to queue\n for(char c: adjList.keySet()){\n if(indegree[c-'a'] == 0){\n \n sb.append(c);\n q.offer(c);// so u need to add all orphan nodes to sb , since it contains results\n }\n \n } \n // now we need to find nodes which has dependency, take it out and reduce the indegree and check if indegreeis zero then add tio queue\n \n // stand ard queue template\n while(!q.isEmpty()){\n // take the elemnt \n char curr = q.poll();\n \n if(adjList.get(curr) == null || adjList.get(curr).size()==0 ){\n // we shud not do antthing, and pick the next nodes in the queue\n continue;\n }\n // if we have some elements in the adj list which means we have a dependency\n // So what do we do here:??\n // i think we can take it and reduce the indgree ??\n // Since we are. removing this particular current element, so we need to reduce all its neighbour indegree becios we removed aos we need to update the indegree of all its neiughbours\n for(char neighbour : adjList.get(curr)){\n indegree[neighbour-'a']--;\n //also check if it becomes zero after update we need to push to queu and sb\n if(indegree[neighbour-'a'] == 0){\n //add to q and sb\n q.offer(neighbour);\n sb.append(neighbour);\n \n }\n }\n \n }\n \n // once we are out of queue, which means we processed all nodes\n // if total chars is sb length, which means we got all chars /nodes so we can return else \"\"\n return sb.length() == totalChars ? sb.toString() : \"\";\n }", "public static Stack<Integer> topologicalKosarajuDFSRecursive(ArrayList<ArrayList<Integer>> adj,int u,Stack<Integer> stack,boolean[] visited){\r\n visited[u]=true;\r\n for(int i:adj.get(u))\r\n if(!visited[u])\r\n topologicalKosarajuDFSRecursive(adj,i,stack,visited);\r\n stack.push(u);\r\n return stack;\r\n }", "public static void main(String[] args) {\n\t\tStopwatch timer = new Stopwatch();\n\t\t//for(int i = 0; i< 10;i++) {\n\t\t\tIn in = new In(args[0]);\n\t\t\tSizeWeightedQuickUnionVisualizer q = new SizeWeightedQuickUnionVisualizer(in.readInt());\n\t\t\twhile(!in.isEmpty()) {\n\t\t\t\tint m = in.readInt();\n\t\t\t\tint n = in.readInt();\n\t\t\t\tif(q.isConnected(m, n)) continue;\n\t\t\t\tq.union(m, n);\n\t\t\t}\n\t\t//}\n\t\tdouble time = timer.elapsedTime();\n\t\t//System.out.println(\"the average time of 10 trials is : \" + time/10 + \" seconds\");\n\t\t//System.out.println(\"the number of components is \"+ q.count()+\" the number of total array accesses is \"+q.sum + \" the average nodes' depth is: \"+ q.getAvgDepth()+\" time: \"+time+\" seconds\");\n\t}", "public Set<List<String>> getCombination(int[] inHand) {\n Set<List<String>> result = new HashSet<>();\n for (int i = 0; i < inHand.length; i++) {\n if (inHand[i] < 1) continue;\n int[] copyHand = copyArray(inHand);\n //possibility of A AA AAA\n for (int j = 1; j <= inHand[i]; j++) {\n if (j == 1) {\n String cSet = \"\";\n\n for (int seq = i; seq <= i + 2; seq++) {\n if (seq >= inHand.length || copyHand[seq] < 1) continue;\n cSet += seq;\n copyHand[seq] -= 1;\n }\n// System.out.println(\"i: \" + i + \" j: \" + j+\"inhand: \" + arrayToString\n// (inHand));\n\n Set<List<String>> a = getCombination(copyHand);\n Set<List<String>> newA = new HashSet<>();\n for (List<String> s : a) {\n s.add(cSet);\n s.sort(Comparator.naturalOrder());\n if (s.equals(\"\")) continue;\n newA.add(s);\n }\n result.addAll(newA);\n continue;\n }\n\n String currentSet = \"\";\n int[] copyOfInHand = copyArray(inHand);\n for (int t = 0; t < j; t++) {\n currentSet += i;\n }\n\n copyOfInHand[i] -= j;\n Set<List<String>> after = getCombination(copyOfInHand);\n Set<List<String>> newAfter = new HashSet<>();\n for (List<String> s : after) {\n s.add(currentSet);\n s.sort(Comparator.naturalOrder());\n newAfter.add(s);\n }\n result.addAll(newAfter);\n }\n }\n if (result.isEmpty()) result.add(new ArrayList<>());\n int min = result.stream().map(set -> set.size()).min(Comparator\n .naturalOrder()).get();\n Set<List<String>> minSets = result.stream().filter(set -> set.size() == min)\n .collect(Collectors\n .toSet());\n// combinationCache.put(inHand, minSets);\n return minSets;\n }", "public static void main(String [] args){\n\t\tint [] A = {0,1,1,1}; //1110\r\n\t\tint [] B = {1,0,1,0};\r\n\t\tint [] C = new Hw2p1q4().binarySum(A, B, A.length);\r\n\t\tfor(int i=A.length; i>=0; i--){\r\n\t\t\tSystem.out.print(C[i]);\r\n\t\t}\r\n\t}", "private int merge(Comparable[] a, Comparable[] aux, int lo, int mid, int hi) {\n for (int k = lo; k <= hi; k++) {\n aux[k] = a[k];\n }\n\n int k = lo;\n int i = lo;\n int j = mid + 1;\n int count = 0;\n\n while (k < hi) {\n if (i > mid) a[k++] = aux[j++];\n else if (j > hi) a[k++] = aux[i++];\n else if (less(aux[j], aux[i])) {\n count += mid + 1 - i;\n a[k++] = aux[j++];\n }\n else a[k++] = aux[i++];\n }\n return count;\n }", "public void insertToArray()\n {\n //if the bucket size is not empty, empty out the bucket\n if(zero.size() != 0)\n {\n a[c] = zero.get(0);\n zero.remove(0);\n c++; s++;\n return;\n }\n if(one.size() != 0)\n {\n a[c] = one.get(0);\n one.remove(0);\n c++; s++;\n return;\n }\n if(two.size() != 0)\n {\n a[c] = two.get(0);\n two.remove(0);\n c++; s++;\n return;\n }\n if(three.size() != 0)\n {\n a[c] = three.get(0);\n three.remove(0);\n c++; s++;\n return;\n }\n if(four.size() != 0)\n {\n a[c] = four.get(0);\n four.remove(0);\n c++; s++;\n return;\n }\n if(five.size() != 0)\n {\n a[c] = five.get(0);\n five.remove(0);\n c++; s++;\n return;\n }\n if(six.size() != 0)\n {\n a[c] = six.get(0);\n six.remove(0);\n c++; s++;\n return;\n }\n if(seven.size() != 0)\n {\n a[c] = seven.get(0);\n seven.remove(0);\n c++; s++;\n return;\n }\n if(eight.size() != 0)\n {\n a[c] = eight.get(0);\n eight.remove(0);\n c++; s++;\n return;\n }\n if(nine.size() != 0)\n {\n a[c] = nine.get(0);\n nine.remove(0);\n c++; s++;\n return;\n }\n }", "public static void kosajaru(int u , int pass){\n\t\t\n\t\t\n\t\tdfs_num[u] = 1;\n\t\tArrayList<Pair> neighbor;\n\t\tif(pass == 1) neighbor = adjList.get(u) ;else neighbor = adjListT.get(u);\n\t\tif(pass == 2) set.add(u); \n\t\tfor(int j = 0 ; j < neighbor.size(); j++){\n\t\t\tPair v = neighbor.get(j);\n\t\t\tif( dfs_num[v.first] == UNVISITED){\n\t\t\t\tkosajaru(v.first , pass);\n\t\t\t}\n\t\t}\n\t\tS.add(u);\n\t}", "public static void main(String[] args) {\n\t\tint p[]=new int[200];\n\t\tint n;int count=0;\n\t\tint pp=0;\n\t\tfor(int i=2;i<1000;i++) {\n\t\t\tint flag=1;\n\t\t\tfor(int j=2;j<i;j++) {\n\t\t\t\tif(i%j==0) {\n\t\t\t\t\tflag++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t//checking if flag is 0 or not\t\n\t\t\t}if(flag==1) {\n\t\t\t\t\n\t\t\t\tSystem.out.println(i);\n\t\t\t \n\t\t\t\tp[pp]=i;\n\t\t\t pp++;\n\t\t\t count++;\n\t\t\t}\n\t}\n\t\tn=count;\n\t//for(int i=0;i<p.length;i++) {\n\t//if(p[i]!=0)\n\t //System.out.println(p[i]);\n\t//}\n\tint k=0;\n\tint count1=0;\n\tboolean b=false;\n\tint aa[]=new int[200];\t\n\t//calling my stack class \n\tMyStack m=new MyStack();\n\n\tfor(int i=0;i<p.length-2;i++) {\n\t\tfor(int j=i+1;j<p.length;j++) {\n\t\tif(p[i]!=0&&p[j]!=0)\n\t\t//calling check method anagram calss\t\n\t\t\tb=AnaQueue.check(p[i],p[j]);\n\t\tif(b==true) {\n\t\t\tSystem.out.println(p[i]+\" \"+p[j]);\n\t\t\taa[k]=p[i];\n\t\t\tm.push(p[i]);\n\t\t//\tSystem.out.println(aa[k]);\n\t\t\tk++; \n\t\t\taa[k]=p[j];\n\t\t\tk++;\n\t\t\tm.push(p[j]);\n\t\t\tcount1++;\n//\t\t\tif(p[i]==aa[k-2]) {\n//\t\t\t\tSystem.out.println(p[i]+\" \"+aa[k-2]);\n//\t\t\t}\n\t\t//\tSystem.out.println(aa[k]);\n\t\t//\tSystem.out.println(aa[k-1]+\" \"+aa[k-2]);\n\t\t\t\t}\n\t\t}\n\n\n\t}\n\t//for(int i=0;i<count1*2;i++)\n\t//{int a=m.popint();\n\t//if(p[i]!=0)\n\t\t//System.out.println(a);\n\t//}\n\t//for(int t=0;t<aa.length;t++) {\n\t\t//if(aa[t]!=0) {\n\t\t//\tSystem.out.println(aa[t]);\n\t\t//}\n\t//}\n\tSystem.out.println(\"this is for stack\");\n\tSystem.out.println(\" ************************\");\n\n\tm.reverse();\n\t System.out.println(count1); \n\tSystem.out.println(\"this for queue\");\n\tSystem.out.println(\" ************************\");\n\tMyQueue mq=new MyQueue(count1*2);\n\tfor(int i=0;i<p.length-2;i++) {\n\t\tfor(int j=i+1;j<p.length;j++) {\n\t\tif(p[i]!=0&&p[j]!=0)\n\t\t\tb=AnaQueue.check(p[i],p[j]);\n\t\tif(b==true) {\n\t\t\t//System.out.println(p[i]+\" \"+p[j]);\n\t\t\t//aa[k]=p[i];\n\t\t\tmq.enqueue(p[i]);\n\t\t//\tSystem.out.println(aa[k]);\n\t\t\t//k++; \n\t\t\t//aa[k]=p[j];\n\t\t\t//k++;\n\t\t\tmq.enqueue(p[j]);\n\t\t\t\n//\t\t\tif(p[i]==aa[k-2]) {\n//\t\t\t\tSystem.out.println(p[i]+\" \"+aa[k-2]);\n//\t\t\t}\n\t\t//\tSystem.out.println(aa[k]);\n\t\t//\tSystem.out.println(aa[k-1]+\" \"+aa[k-2]);\n\t\t\t\t}\n\t\t}\n\n\n\t}\n\t//for(int i=0;i<(count1*2)-1;i++);\n\t//{\n\t//int a=mq.dequeue();\n\t//System.out.println(a);\n\t//}\n\tSystem.out.println(mq);\n\n\n\t}", "public static void main(String[] args)\n {\n Scanner sc = new Scanner(System.in);\n int sum = sc.nextInt();\n int N = sc.nextInt();\n sc.nextLine();\n int [][] arr = new int[N][2];\n for(int i = 0;i<N;i++)\n {\n arr[i][0] = sc.nextInt();\n arr[i][1] = sc.nextInt();\n sc.nextLine();\n }\n //Arrays.sort(arr, new Comparator<int[]>() {\n // @Override\n // public int compare(int[] o1, int[] o2) {\n // return o1[1]-o2[1]; //按第二列价值排个序。\n // }\n //});\n int [][] dp = new int[N+1][sum+1];\n int [][] path = new int[N+1][sum+1];\n for(int i = 1;i<=N;i++)\n {\n for(int j = 1;j<=sum;j++)\n {\n if(j<arr[i-1][0])\n dp[i][j] = dp[i-1][j];\n else\n {\n if(dp[i-1][j]<dp[i-1][j-arr[i-1][0]]+arr[i-1][1])\n path[i][j] = 1;\n dp[i][j] = Math.max(dp[i-1][j],dp[i-1][j-arr[i-1][0]]+arr[i-1][1]);\n }\n }\n }\n System.out.println(dp[N][sum]);\n\n int i = N;\n int j = sum;\n while (i>0&&j>0)\n {\n if(path[i][j]==1)\n {\n System.out.print(1+\" \");\n j -=arr[i-1][0];\n }\n else\n {\n i--;\n System.out.print(0+\" \");\n }\n }\n\n\n // 改进版。只使用一维数组。\n // int [] f = new int[sum+1];\n // for(int i = 0;i<N;i++)\n // {\n // for (int j = sum;j>=0;j--)\n // {\n // if(j>=arr[i][0])\n // f[j] = Math.max(f[j], f[j-arr[i][0]]+arr[i][1]);\n // }\n // }\n // System.out.println(f[sum]);\n\n }", "private static void merge(Comparable[] a, int[] index, int[] aux, int lo, int mid, int hi){\n for(int k=lo;k<=hi;k++){\n aux[k]=index[k];\n }\n int i=lo,j=mid+1;\n for(int k=lo;k<=hi;k++){\n if(i>mid) index[k]=aux[j++];\n else if(j>hi) index[k]=aux[i++];\n else if(less(a[aux[j]],a[aux[i]])) index[k]=aux[j++];\n else index[k]=aux[i++];\n }\n }", "public int[] radixsort(int[] v) {\r\n\t int repeticionmaxima = 1; // cantidad de repeticiones\r\n\t int bytesdesplazados = 4; // numero de bytes a desplazar\r\n\t int arreglocolas = (int) Math.pow(2,bytesdesplazados) ;\r\n\t // Creación e inicialización del arreglo de colas\r\n\t Queue<Integer>[] cola = new LinkedList[arreglocolas];\r\n\t for(int i=0; i<arreglocolas; i++) cola[i]=new LinkedList<Integer>();\r\n\t \r\n\t int div = 0; // posición a comparar\r\n\t for(int i=0; i<repeticionmaxima; i++) {\r\n\t // parte 1: recorrer el vector para guardar cada elemento\r\n\t // en la cola correspondiente\r\n\t for(int numero: v) {\r\n\t // buscar el mayor número del vector\r\n\t if(i==0) if(numero>repeticionmaxima) repeticionmaxima=numero;\r\n\t // calcular en qué cola debe ir cada número\r\n\t int numCola = (numero>>div) & 0xf;\r\n\t cola[numCola].add(numero);\r\n\t }\r\n\t div = div+bytesdesplazados;\r\n\t \r\n\t // parte 2: recorrer las colas en orden para poner cada\r\n\t // elemento en el vector;\r\n\t int j=0;\r\n\t for(Queue<Integer> c: cola) {\r\n\t while(!c.isEmpty()) v[j++]=c.remove();\r\n\t }\r\n\t // la primera vez se actualiza el número de veces que se\r\n\t // debe ejecutar el proceso\r\n\t if(i==0) { repeticionmaxima = (int) (Math.log(repeticionmaxima)/Math.log(arreglocolas)) + 1; }\r\n\t }\r\n\t return v;\r\n\t }", "int minOperations(int[] arr) {\n // Write your code here\n Set<String> set = new HashSet<>();//store visited string\n Queue<String> queue = new LinkedList<>(); // store next strs\n int counter = 0;\n\n queue.offer(getKey(arr));\n set.add(getKey(arr));\n\n while (!queue.isEmpty()) {\n int size = queue.size();\n List<String> curs = new ArrayList<>();\n while (size > 0) {\n curs.add(queue.poll());\n size--;\n }\n\n for(String cur : curs) {\n if (isIncreasing(cur)) {\n return counter;\n }\n\n for(int i = 0; i < cur.length(); i++) {\n String next = reverseString(cur, i);\n if (!set.contains(next)) {\n set.add(next);\n queue.offer(next);\n }\n }\n }\n\n counter++;\n }\n\n return counter;\n }", "public final void ar(int i, byte b) {\n int i2 = this.db[0];\n int i3 = this.dc[0];\n if (i == 0) {\n i2--;\n i3++;\n }\n if (1 == i) {\n i3++;\n }\n if (i == 2) {\n i2++;\n i3++;\n }\n if (i == 3) {\n i2--;\n }\n if (4 == i) {\n i2++;\n }\n if (i == 5) {\n i2--;\n i3--;\n }\n if (6 == i) {\n i3--;\n }\n if (i == 7) {\n i2++;\n i3--;\n }\n if (-1 != this.cs * -1099198911 && gn.aq(this.cs * -1099198911, 2044910580).aa * 952452997 == 1) {\n this.cs = -1835762113;\n }\n if (this.da * -913482765 < 9) {\n this.da -= 751585989;\n }\n for (int i4 = this.da * -913482765; i4 > 0; i4--) {\n int i5 = i4 - 1;\n this.db[i4] = this.db[i5];\n this.dc[i4] = this.dc[i5];\n this.du[i4] = this.du[i5];\n }\n this.db[0] = i2;\n this.dc[0] = i3;\n this.du[0] = b;\n }", "void Union(subset [] subsets, int x , int y ){ \n\t\tint xroot = find(subsets, x); \n\t int yroot = find(subsets, y); \n\t \n\t\tif (subsets[xroot].rank < subsets[yroot].rank) \n\t\t\tsubsets[xroot].parent = yroot; \n\t\telse if (subsets[yroot].rank < subsets[xroot].rank) \n\t\t\tsubsets[yroot].parent = xroot; \n\t\telse{ \n\t\t\tsubsets[xroot].parent = yroot; \n\t\t\tsubsets[yroot].rank++; \n\t\t} \n\t}", "public static void kosajaru(int u , int pass){\n\t\tdfs_num[u] = 1;\n\t\tArrayList<Pair> neighbor;\n\t\tif(pass == 1) neighbor = adjList.get(u) ;else neighbor = adjListT.get(u);\n\t\tfor(int j = 0 ; j < neighbor.size(); j++){\n\t\t\tPair v = neighbor.get(j);\n\t\t\tif( dfs_num[v.first] == UNVISITED){\n\t\t\t\tkosajaru(v.first , pass);\n\t\t\t}\n\t\t}\n\t\tS.add(u);\n\t}", "public ArrayList<ArrayList<Integer>> fourSum(int[] num, int target) {\n //Create the dictionary of sum and list of pairs of indexes\n HashMap<Integer, ArrayList<ArrayList<Integer>>> dict = new HashMap<>();\n for (int i = 0; i < num.length - 1; i++) {\n for (int j = i + 1; j < num.length; j++) {\n int sum = num[i] + num[j];\n ArrayList<Integer> pair = new ArrayList<>();\n pair.add(i);\n pair.add(j);\n if (!dict.containsKey(sum)) {\n ArrayList<ArrayList<Integer>> value = new ArrayList<ArrayList<Integer>>();\n value.add(pair);\n dict.put(sum, value);\n } else {\n ArrayList<ArrayList<Integer>> value = dict.get(sum);\n value.add(pair);\n }\n }\n }\n //Use HashSet to prevent duplicate result.\n HashSet<ArrayList<Integer>> set = new HashSet<>();\n for (Integer sumA : dict.keySet()) {\n if (dict.containsKey(target - sumA)) {\n \n ArrayList<ArrayList<Integer>> pairsA = dict.get(sumA);\n ArrayList<ArrayList<Integer>> pairsB = dict.get(target - sumA);\n \n \n for (ArrayList<Integer> pair1 : pairsA) {\n for (ArrayList<Integer> pair2 : pairsB) {\n \n //Make sure there is no same element in two pairs.\n if (pair1.contains(pair2.get(0)) || pair1.contains(pair2.get(1)))\n continue;\n \n ArrayList<Integer> tmpResult = new ArrayList<>(4);\n tmpResult.add(num[pair1.get(0)]);\n tmpResult.add(num[pair1.get(1)]);\n tmpResult.add(num[pair2.get(0)]);\n tmpResult.add(num[pair2.get(1)]);\n //Sort the list and add it into the set.\n Collections.sort(tmpResult);\n set.add(tmpResult);\n }\n }\n }\n }\n ArrayList<ArrayList<Integer>> ret = new ArrayList<ArrayList<Integer>>();\n ret.addAll(set); // from hashset to arraylist \n return ret;\n }", "public static int example4(int[] arr) { // O(1)\r\n\t\tint n = arr.length, prefix = 0, total = 0; // O(1), O(1), (1)\r\n\t\tfor (int j = 0; j < n; j++) { // loop from 0 to n-1 // O(n)\r\n\t\t\tprefix += arr[j];\r\n\t\t\ttotal += prefix;\r\n\t\t}\r\n\t\treturn total;\r\n\r\n\t\t/*\r\n\t\t * Explanation: The method contains a (for) loop and it runs (n) times.This loop\r\n\t\t * dominates the runtime.We always aim for the worse-case and maximum time. The\r\n\t\t * answer is it is linear time of O(n) notation.\r\n\t\t * \r\n\t\t */\r\n\t}", "@Test\n @Order(1)\n void algorithms() {\n \n Combination initialComb = new Combination();\n for (int i = 0; i < assignementProblem.getAssignmentData().getLength(); i++) {\n initialComb.add((long) i + 1);\n }\n assignementProblem.setInCombination(initialComb);\n executeAlgo(SearchTestUtil.ALGO.TABU);\n executeAlgo(SearchTestUtil.ALGO.RECUIT);\n }", "private int[] sort(int arr[]) {\r\n\t\tint n = arr.length;\r\n\r\n\t\tif (n == 1) { // base case\r\n\t\t\treturn arr;\r\n\t\t}\r\n\t\t// divide\r\n\t\tint[] arrL = Arrays.copyOfRange(arr, 0, (n / 2));\r\n\t\tint[] arrR = Arrays.copyOfRange(arr, (n / 2), (n));\r\n\t\t// and conquer\r\n\t\treturn merge(sort(arrL), sort(arrR));\r\n\t}", "public static boolean union(int a, int b, int p[], int r[]){\n int pa=find(a,p,r);\r\n int pb=find(b,p,r);\r\n if(pa==pb)\r\n return true;\r\n if(pa!=pb)\r\n {\r\n if(r[pa]<r[pb])\r\n {\r\n p[pa]=pb;\r\n }\r\n else if(r[pa]>r[pb])\r\n {\r\n p[pb]=pa;\r\n }\r\n else\r\n {\r\n p[pa]=pb;\r\n r[pb]++;\r\n }\r\n }\r\n return false;\r\n }", "@Test\n public void testHyperLogLogUnion(){\n String redisKey2= \"test:hll:02\";\n for (int i = 1; i <= 10000; i++) {\n redisTemplate.opsForHyperLogLog().add(redisKey2,i);\n }\n String redisKey3= \"test:hll:03\";\n for (int i = 5001; i <= 15000; i++) {\n redisTemplate.opsForHyperLogLog().add(redisKey3,i);\n }\n String redisKey4= \"test:hll:04\";\n for (int i = 10001; i <= 20000; i++) {\n redisTemplate.opsForHyperLogLog().add(redisKey4,i);\n }\n String unionKey= \"test:hll:union\";\n redisTemplate.opsForHyperLogLog().union(unionKey,redisKey2,redisKey3,redisKey4);\n Long size = redisTemplate.opsForHyperLogLog().size(unionKey);\n System.out.println(size);\n }", "public static void main(String[] args) {\n List<Integer> li = new ArrayList<>();\n li.add(4);\n li.add(4);\n li.add(2);\n li.add(2);\n li.add(2);\n li.add(2);\n li.add(3);\n li.add(3);\n li.add(1);\n li.add(1);\n li.add(6);\n li.add(7);\n li.add(5);\n li.add(5);\n li.add(3);\n li.add(1);\n li.add(2);\n li.add(2);\n li.add(4);\n\n List<Integer> li1 = new ArrayList<>();\n li1.add(5);\n li1.add(1);\n li1.add(2);\n li1.add(3);\n li1.add(4);\n li1.add(1);\n System.out.println(li1);\n int[] array = { 4, 4, 2, 2, 2, 2, 3, 3, 1, 1, 6, 7, 5 };\n\n customSort(li1);\n//\n// missingWords(\"I am using hackerrank to improve programming\",\"am hackerrank to improve\");\n//\n// System.out.println(fourthBit(32));\n////nums\n// System.out.println(kSub(3,li1));\n\n Float f = 0.1F;\n\n System.out.println(f);;\n\n System.out.println(new BigDecimal(f.toString()));\n\n System.out.println(twoSum(new int[]{2,7,1,4}, 9));\n }", "public int solution(int[] A) {\n int l = A.length;\r\n int largest = 0;\r\n\r\n //first we sort the array using count sort\r\n //get largest\r\n for (int i : A) {\r\n if (i > largest) {\r\n largest = i;\r\n }\r\n }\r\n //set all elements of c to 0\r\n int c[] = new int[largest + 1];\r\n int b[] = new int[A.length];\r\n for (int i = 0; i < c.length; i++) {\r\n c[i] = 0;\r\n }\r\n printc(c, \"c\");\r\n // set occurences of each element in c\r\n for (int i : A) {\r\n c[i] += 1;\r\n }\r\n printc(c, \"c\");\r\n // add \r\n for (int i = 1; i < c.length; i++) {\r\n c[i] = c[i - 1] + c[i];\r\n }\r\n printc(c, \"c\");\r\n\r\n for (int i = A.length-1; i >= 0; i--) {\r\n int value = A[i];\r\n int cvalue = c[value] - 1;\r\n b[cvalue] = value;\r\n c[value] = cvalue;\r\n }\r\n printc(b, \"b\");\r\n\r\n \r\n \r\n return 0;\r\n }", "public void runAlgorithm(){\n for(int i = 0; i < graph.length;i++){\n for(int j = 0; j < graph[0].length; j++){\n TC[i][j] = graph[i][j];\n }\n }\n \n //main algo\n for(int k = 0; k < graph.length; k++ ){\n for(int i = 0; i < graph.length; i++)\n for(int j = 0; j < graph[0].length; j++){\n if( i != k && j != k){\n TC[i][j] = TC[i][j] | (TC[i][k] & TC[k][j]);\n }\n }\n }\n \n printTC();\n }", "public int minFallingPathSum(int[][] A) {\n int minpath = 999999999;\n\n int[][] cache = new int[A.length][A[0].length];\n // you need to initialise the cache.\n\n for(int i = 0; i < A.length; i++ ){\n for(int j = 0; j < A[0].length; j++){\n cache[i][j] = -1;\n //initialises the cache to a default \"Untouched\" value.\n }\n }\n\n for(int i = 0; i < A[0].length; i ++){\n\n minpath = Math.min(minpath, minFallingPathSum(A,cache, i, 0 ));\n\n }\n\n return minpath;\n }", "public void topologicalSortUtil(int v, HashSet<Integer> visited, Stack<Integer> stack) {\n visited.add(v);\n for (int n : g.getNeighbors(v)) {\n if (visited.contains(n))\n continue;\n topologicalSortUtil(n, visited, stack);\n }\n stack.add(v);\n }", "static int makeAnagram(String a, String b) {\n \n \tchar arr[] = a.toCharArray();\n char brr[] = b.toCharArray();\n Arrays.sort(arr);\n Arrays.sort(brr);\n Map<Character, Integer> aMap = new HashMap<>();\n Map<Character, Integer> bMap = new HashMap<>();\n for(int i =0 ;i <arr.length;i++){\n \tif(!aMap.containsKey(arr[i])){\n \t\taMap.put(arr[i], 1);\n \t}else{\n \t\taMap.put(arr[i], aMap.get(arr[i])+1);\n \t}\n }\n for(int i =0 ;i <brr.length;i++){\n \tif(!bMap.containsKey(brr[i])){\n \t\tbMap.put(brr[i], 1);\n \t}else{\n \t\tbMap.put(brr[i], bMap.get(brr[i])+1);\n \t}\n }\n int removeCharCount = 0;\n \n for(char ch = 'a'; ch<='z';ch++){\n \tif(aMap.containsKey(ch) && bMap.containsKey(ch)){\n \t\tif(aMap.get(ch) > bMap.get(ch)){\n \t\t\tint count = aMap.get(ch) - bMap.get(ch);\n \t\t\tremoveCharCount+=count;\n \t\t\taMap.put(ch, aMap.get(ch) - count);\n \t\t}else if(aMap.get(ch) < bMap.get(ch)){\n \t\t\tint count = bMap.get(ch) - aMap.get(ch);\n \t\t\tremoveCharCount+=count;\n \t\t\taMap.put(ch, bMap.get(ch) - count);\n \t\t}\n \t}else if(aMap.containsKey(ch) && !bMap.containsKey(ch)){\n \t\tint count = aMap.get(ch);\n \t\tremoveCharCount+=count;\n \t\taMap.remove(ch);\n \t}else if(!aMap.containsKey(ch) && bMap.containsKey(ch)){\n \t\tint count = bMap.get(ch);\n \t\tremoveCharCount+=count;\n \t\tbMap.remove(ch);\n \t}\n }\n /* if(removeCharCount == Math.min(arr.length, brr.length)){\n \treturn 0;\n }*/\n return removeCharCount;\n }", "public ArrayList<Integer> spiralOrder(final List<ArrayList<Integer>> a) {\r\n\t\t ArrayList<Integer> result = new ArrayList<Integer>();\r\n\t\t int T = 0, B = a.size()-1, L = 0, R = a.get(0).size()-1; \r\n\t\t int dir = 0;\r\n\t\t if(B <= 0){\r\n\t\t return result;\r\n\t\t }\r\n\t\t while(L <= R && T <= B){\r\n\t\t if(dir == 0){\r\n\t\t for(int k = L; k <= R; k++){\r\n\t\t result.add(a.get(T).get(k));\r\n\t\t }\r\n\t\t T++;\r\n\t\t }\r\n\t\t else if(dir == 1){\r\n\t\t for(int k = T; k <= B; k++){\r\n\t\t result.add(a.get(k).get(R));\r\n\t\t }\r\n\t\t R--;\r\n\t\t }\r\n\t\t else if(dir == 2){\r\n\t\t for(int k = R; k >= L; k--){\r\n\t\t result.add(a.get(B).get(k));\r\n\t\t }\r\n\t\t B--;\r\n\t\t }\r\n\t\t else if(dir == 3){\r\n\t\t for(int k = B; k >= T; k--){\r\n\t\t result.add(a.get(k).get(L));\r\n\t\t }\r\n\t\t L++;\r\n\t\t }\r\n\t\t dir = (dir+1) % 4;\r\n\t\t }\r\n\t\t return result;\r\n\t}", "public void union(Node a, Node b) {\n Node set1 = find(a);\n Node set2 = find(b);\n\n if (set1 != set2) {\n // Limits the worst case runtime of a find to O(log N)\n if (set1.getSize() < set2.getSize()) {\n set2.setParent(set1);\n set1.setSize(set1.getSize() + set2.getSize());\n }\n else {\n set1.setParent(set2);\n set2.setSize(set1.getSize() + set2.getSize());\n }\n }\n }", "public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new FileReader(\"superbull.in\"));\n PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(\"superbull.out\")));\n //Only in a tree is the winner condition(as stated in problem) satisfied\n int N = Integer.parseInt(br.readLine());\n \n long ret = 0;\n \n int[] nums = new int[N];\n for(int i = 0; i<N; i++) nums[i] = Integer.parseInt(br.readLine());\n int[] prims = new int[N]; //for dense graphs: N edges each. Loop thru edges anyways, so selection sort remove log factor\n Arrays.fill(prims, Integer.MIN_VALUE);\n prims[0] = -1;\n int curr = 0;\n \n for(int i = 0; i<N-1; i++){\n int max = Integer.MIN_VALUE;\n int next = -1;\n for(int j = 0; j<N; j++){\n if(prims[j] == -1) continue;\n \n int xor = nums[curr]^nums[j];\n prims[j] = Math.max(prims[j], xor);\n \n if(prims[j] > max){\n next = j;\n max = prims[j];\n }\n }\n ret += max;\n prims[next] = -1;\n curr = next;\n }\n pw.println(ret);\n pw.close();\n br.close();\n }", "int[] MinSubUnion(int x, ArrayList<Integer> vn, ArrayList<Integer> vnComp){\n\tint[] ret = new int[x];\n\t\n\t/*\n\t * Build the set for legitimate users\n\t */\n\t//ArrayList<String> L = new ArrayList<String>();\n\tArrayList<String> LComp = new ArrayList<String>();\n\t//for (int v : vn)\n\t//\tL.addAll(this.LiSet[v]);\n\tfor (int v : vnComp){\n\t\tLComp.removeAll(this.LiSet[v]);\n\t\tLComp.addAll(this.LiSet[v]);\n\t}\n\t\n\tfor(int i = 0; i < x; i ++){\n\t\tint gain = 1000000000;\n\t\tint v_min = -1;\n\t\t\n\t\tfor(int v : vn){\n\t\t\tArrayList<String> temp = this.LiSet[v];\n\t\t\ttemp.removeAll(LComp);\n\t\t\tif(gain > temp.size()){\n\t\t\t\tgain = temp.size();\n\t\t\t\tv_min = v;\n\t\t\t}\n\t\t}\n\t\tif(v_min == -1)\n\t\t\tcontinue;\n\n\t\t//L.removeAll(this.LiSet[v_max]);\n\t\tLComp.removeAll(this.LiSet[v_min]);\n\t\tLComp.addAll(this.LiSet[v_min]);\n\t\tvn.remove(vn.indexOf(v_min));\n\t\tvnComp.add(v_min);\n\t\tret[i] = v_min;\n\t}\n\treturn ret;\n}", "void merge_lo(int pa, int na, int pb, int nb) {\n getmem(na);\n System.arraycopy(this.data, pa, this.a, 0, na);\n int dest = pa;\n pa = 0;\n \n this.data[dest++] = this.data[pb++];\n --nb;\n if (nb == 0)\n return;\n if (na == 1) {\n // CopyB;\n System.arraycopy(this.data, pb, this.data, dest, nb);\n this.data[dest + nb] = this.a[pa];\n return;\n }\n \n try {\n for (;;) {\n int acount = 0; /* # of time A won in a row */\n int bcount = 0; /* # of time B won in a row */\n \n /* Do the straightforward thing until (if ever) one run\n * appears to win consistently.\n */\n for (;;) {\n boolean k = iflt(this.data[pb], this.a[pa]);\n if (k) {\n this.data[dest++] = this.data[pb++];\n ++bcount;\n acount = 0;\n --nb;\n if (nb == 0)\n return;\n if (bcount >= MIN_GALLOP)\n break;\n } else {\n this.data[dest++] = this.a[pa++];\n ++acount;\n bcount = 0;\n --na;\n if (na == 1) {\n // CopyB;\n System.arraycopy(this.data, pb, this.data, dest, nb);\n this.data[dest + nb] = this.a[pa];\n na = 0;\n return;\n }\n if (acount >= MIN_GALLOP)\n break;\n }\n }\n \n /* One run is winning so consistently that galloping may\n * be a huge win. So try that, and continue galloping until\n * (if ever) neither run appears to be winning consistently\n * anymore.\n */\n do {\n int k = gallop_right(this.data[pb], this.a, pa, na, 0);\n acount = k;\n if (k != 0) {\n System.arraycopy(this.a, pa, this.data, dest, k);\n dest += k;\n pa += k;\n na -= k;\n if (na == 1) {\n // CopyB\n System.arraycopy(this.data, pb, this.data, dest, nb);\n this.data[dest + nb] = this.a[pa];\n na = 0;\n return;\n }\n /* na==0 is impossible now if the comparison\n * function is consistent, but we can't assume\n * that it is.\n */\n if (na == 0)\n return;\n }\n \n this.data[dest++] = this.data[pb++];\n --nb;\n if (nb == 0)\n return;\n \n k = gallop_left(this.a[pa], this.data, pb, nb, 0);\n bcount = k;\n if (k != 0) {\n System.arraycopy(this.data, pb, this.data, dest, k);\n dest += k;\n pb += k;\n nb -= k;\n if (nb == 0)\n return;\n }\n this.data[dest++] = this.a[pa++];\n --na;\n if (na == 1) {\n // CopyB;\n System.arraycopy(this.data, pb, this.data, dest, nb);\n this.data[dest + nb] = this.a[pa];\n na = 0;\n return;\n }\n } while (acount >= MIN_GALLOP || bcount >= MIN_GALLOP);\n }\n } finally {\n if (na != 0)\n System.arraycopy(this.a, pa, this.data, dest, na);\n \n //dump_data(\"result\", origpa, cnt);\n }\n }", "public static int degreeOfArray(List<Integer> arr) { arr.length = n\n // num of Keys = k\n // O(n + k)\n // max value count = m\n //\n PriorityQueue<Node> pq = new PriorityQueue<>((i, j)-> j.count - i.count);\n Map<Integer, NodePosition> posMap = new HashMap<>();\n Map<Integer, Node> countMap = new HashMap<>();\n // [1, 2, 3, 4, 5, 6]\n for (int i = 0; i < arr.size(); i++) {\n int cur = arr.get(i);\n\n if (!countMap.containsKey(cur)) {\n countMap.put(cur, new Node(cur, 1));\n } else {\n Node curNode = countMap.get(cur);\n curNode.count++;\n countMap.put(cur, curNode);\n }\n\n if (!posMap.containsKey(cur)) {\n posMap.put(cur, new NodePosition(i, i));\n } else {\n NodePosition curNodePos = posMap.get(cur);\n curNodePos.endIndex = i;\n posMap.put(cur, curNodePos);\n }\n }\n //Iterator<Map.Entry<Integer, Node> it = new Iterator<>(countMap);\n for (Map.Entry<Integer, Node> e : countMap.entrySet()) {\n pq.add(e.getValue());\n }\n\n // [1, 2, 1, 3 ,2]\n // 1 , 2 , 3\n Node curNode = pq.remove();\n int maxCount = curNode.count;\n\n int minRange = posMap.get(curNode.num).endIndex - posMap.get(curNode.num).startIndex;\n\n while (!pq.isEmpty() && maxCount == pq.peek().count) {\n curNode = pq.remove();\n NodePosition nPos = posMap.get(curNode.num);\n minRange = Math.min(minRange, nPos.endIndex - nPos.startIndex);\n }\n\n return minRange + 1;\n }", "static void MergeSort(int[] A, int p, int r) {\n\t\tif (p < r) {\n\t\t\tint q = (p + r) / 2;\n\t\t\tMergeSort(A, p, q);\n\t\t\tMergeSort(A, q + 1, r);\n\t\t\tMerge(A, p, q, r);\n\t\t}\n\t}", "public static void union(int u, int v) {\n\t\tu = root(u); // optimizations\n\t\tv = root(v); // to make find faster\n\t\tif (u == v) return; // already in same component\n\t\t\n\t\tif (size[u] >= size[v]) {\n\t\t\tp[v] = u;\n\t\t\tsize[u] += size[v];\n\t\t} else {\n\t\t\tp[u] = v;\n\t\t\tsize[v] += size[u];\n\t\t}\n\t}", "public int minFallingPathSum(int[][] A, int[][] cache, int index_x, int index_y){\n if(index_y == A.length -1){\n //We are at the end of the list. So you should return 0\n return A[index_y][index_x];\n }\n\n else{\n // this is wrong.\n int minfallingPath = 999999999;\n\n for(int i = (index_x - 1 >= 0 ? index_x -1 : index_x);\n i <= (index_x < A[0].length -1 ? index_x + 1 : index_x);\n i++){\n if(cache[index_y + 1][i] != -1){minfallingPath = Math.min(minfallingPath, A[index_y][index_x] + cache[index_y + 1][i]);}\n else{\n cache[index_y + 1][i] = minFallingPathSum(A,cache, i, index_y + 1);\n minfallingPath = Math.min(minfallingPath, A[index_y][index_x] + cache[index_y + 1][i]);}\n\n }\n\n return minfallingPath;\n }\n\n }", "private TreeNode<K> combine(TreeNode<K> x, TreeNode<K> y) {\n TreeNode<K> z = new TreeNode<K>();\n z.left = x;\n z.right = y;\n z.rank = x.rank + 1;\n sift(z);\n return z;\n }", "private int[] calcBestOrderForB() {\n int cursor = mStrokeA.length() / 2;\n Point[] aPts = buildSnapshot(mStrokeA, cursor);\n Point[] bPts = buildSnapshot(mStrokeB, cursor);\n\n // Determine the best permutation of B to match points of A within these two\n // snapshots\n ArrayList<int[]> perms = buildPermutations(mStrokeA.size());\n int[] bestOrder = null;\n float minCost = 0;\n for (int[] order : perms) {\n float cost = orderCost(order, aPts, bPts);\n if (bestOrder == null || minCost > cost) {\n minCost = cost;\n bestOrder = order;\n }\n }\n return bestOrder;\n }", "public List<List<Integer>> fourSum_optimization(int[] nums, int target) {\n int len = nums.length;\n Arrays.sort(nums);\n if (len < 4)\n return Collections.emptyList();\n List<List<Integer>> arr = new ArrayList<>();\n\n for (int i = 0; i < len - 1; i++) {\n for (int j = i + 1; j < len - 1; j++) {\n int Left = j + 1;\n int Right = len - 1;\n int left_target_sum = target - nums[i] + nums[j];\n\n while (Left < Right) {\n int two_sum = nums[Left] + nums[Right];\n if (two_sum < left_target_sum)\n Left++;\n else if (two_sum > left_target_sum)\n Right--;\n else {\n List<Integer> arr2 = new ArrayList<>();\n if (left_target_sum + two_sum == target) {\n arr2.add(nums[i]);\n arr2.add(nums[j]);\n arr2.add(nums[Left]);\n arr2.add(nums[Right]);\n arr.add(arr2);\n }\n while (Left < Right && nums[Left] == arr2.get(2))\n ++Left;\n while (Left < Right && nums[Right] == arr2.get(3))\n --Right;\n }\n }\n while (i + 1 < len && nums[i + 1] == nums[i])\n ++i;\n while (j + 1 < len && nums[j + 1] == nums[j])\n ++j;\n }\n }\n\n return arr;\n }" ]
[ "0.55294716", "0.5450634", "0.5412193", "0.53228116", "0.5302135", "0.5279392", "0.52654606", "0.5264268", "0.5260891", "0.52026206", "0.51510733", "0.5131186", "0.51096576", "0.51056993", "0.5104873", "0.50979143", "0.5089511", "0.5069052", "0.50664854", "0.50182414", "0.5009133", "0.5006495", "0.50005525", "0.49937043", "0.49674022", "0.4944221", "0.493627", "0.4928889", "0.49277163", "0.4906827", "0.49010107", "0.48997644", "0.48417404", "0.48397225", "0.48347935", "0.4828478", "0.47998613", "0.47935396", "0.47568193", "0.47540894", "0.47461405", "0.4733375", "0.4731064", "0.47269782", "0.47179347", "0.471617", "0.4715215", "0.47119778", "0.4711429", "0.470883", "0.47021982", "0.469514", "0.46924102", "0.46913674", "0.46913394", "0.4689312", "0.46860987", "0.46840647", "0.4676433", "0.46728757", "0.46692902", "0.46691543", "0.46593693", "0.46538678", "0.46373376", "0.4624308", "0.4619459", "0.46190533", "0.4616983", "0.46161404", "0.46125403", "0.46122918", "0.46083412", "0.4607557", "0.4604981", "0.46044418", "0.46013787", "0.46008086", "0.4597902", "0.4595914", "0.45911604", "0.458254", "0.45687863", "0.45687476", "0.4560856", "0.45580766", "0.45538047", "0.45497265", "0.45489803", "0.45475394", "0.45461944", "0.45439255", "0.45418704", "0.45402956", "0.4536558", "0.45339757", "0.4527148", "0.45265442", "0.4524097", "0.45216104", "0.45215905" ]
0.0
-1
private static HashMap frequencyDoc = new HashMap();
@Override public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { String filename = ((FileSplit) context.getInputSplit()) .getPath().getName(); if (!value.toString().isEmpty()) { String line = value.toString().toLowerCase().replaceAll("[\\p{Punct}&&[^']&&[^-]]|(?<![a-zA-Z])'|'(?![a-zA-Z])|--|(?<![a-zA-Z])-|-(?![a-zA-Z])|\\d+"," "); for (String token : line.split("\\s+")) { if (!token.isEmpty()) { context.write(new Text(token+"#"),new Text("1")); // write # words and 1 context.write(new Text(token + "," + filename),new Text("1")); // write key and id context.write(new Text(token+"%"),new Text(filename)); // write key and id context.write(new Text(":"+filename),new Text("1")); //if (frequencyDoc.containsKey(filename)) { //frequencyDoc.put(filename, frequencyDoc.get(filename) + 1); //} //else { //frequencyDoc.put(filename, 1); //} } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static void printTable(int numberOfDocs) {\n \n Gson gs = new Gson();\n String json = gs.toJson(wor);\n // System.out.println(json);\n \n List<String> queryWords = new ArrayList();\n //to test it for other query word you can change the following two words\n //queryWords.add(\"carpet\");\n //queryWords.add(\"hous\");\n queryWords.add(\"the\");\n queryWords.add(\"crystallin\");\n queryWords.add(\"len\");\n queryWords.add(\"vertebr\");\n queryWords.add(\"includ\");\n \n \n FrequencySummary frequencySummary = new FrequencySummary();\n frequencySummary.getSummary(json,docName, queryWords);\n \n System.exit(0);\n \n Hashtable<Integer,Integer> g = new Hashtable<>();\n \n /* wor.entrySet().forEach((wordToDocument) -> {\n String currentWord = wordToDocument.getKey();\n Map<String, Integer> documentToWordCount = wordToDocument.getValue();\n freq.set(0);\n df.set(0);\n documentToWordCount.entrySet().forEach((documentToFrequency) -> {\n String document = documentToFrequency.getKey();\n Integer wordCount = documentToFrequency.getValue();\n freq.addAndGet(wordCount);\n System.out.println(\"Word \" + currentWord + \" found \" + wordCount +\n \" times in document \" + document);\n \n if(g.getOrDefault(currentWord.hashCode(), null)==null){\n g.put(currentWord.hashCode(),1);\n \n }else {\n System.out.println(\"Hello\");\n \n int i = g.get(currentWord.hashCode());\n System.out.println(\"i \"+i);\n g.put(currentWord.hashCode(), i++);\n }\n // System.out.println(currentWord+\" \"+ g.get(currentWord.hashCode()));\n // g.put(currentWord.hashCode(), g.getOrDefault(currentWord.hashCode(), 0)+wordCount);\n \n });\n // System.out.println(freq.doubleValue());\n \n // System.out.println(\"IDF for this word: \"+Math.log10( (double)(counter/freq.doubleValue())));\n });\n // System.out.println(g.get(\"plai\".hashCode()));\n //System.out.println(\"IDF for this word: \"+Math.log10( (double)(counter/(double)g.get(\"plai\".hashCode()))));\n */\n }", "public static void DocumentFrequencies() throws FileNotFoundException {\n for (Entry<String, List<Integer>> entry : dictionary.entrySet()) {\n List<Integer> termfrequency = new ArrayList<>();\n\n termfrequency = entry.getValue();\t// getting each word's termfrequency list\n int i = 0;\n termfrequency.add(0); \t\t\t//maintaining documentfrequency at the 57th index\n Integer documentFrequency = termfrequency.get(totaldocument+1);\n while(i<56) { //iterate 0 to 55 all speeches term frequency\n if(termfrequency.get(i)>0) {\t\t//increment document frequency of that word if termfrequency is greater than 0.0\n documentFrequency++;\t\t\t//increment document frequency\n }\n i++;\t\t//increment index\n }\n termfrequency.set(57, documentFrequency);\t//re-set the documentfrequency and save the current maintained document frequency from 0 to calculated value\n dictionary.put(entry.getKey(), termfrequency);\t\t// place the incremented final value of that word back to the same list in dictionary hashmap\n }\n //save();\n }", "private void scanDocuments()\n{\n document_counts = new HashMap<>();\n kgram_counts = new HashMap<>();\n for (File f : root_files) {\n addDocuments(f);\n }\n}", "public int getFreq(){ return frequency;}", "private void getFrequency(){\r\n try {\r\n BufferedReader reader = new BufferedReader(new FileReader(IConfig.FREQUENCY_PATH));\r\n String line;\r\n while((line = reader.readLine()) != null){\r\n frequency.put(line.split(\" \")[0], (Double.parseDouble(line.split(\" \")[1])/ IConfig.TOTAL_NEWS));\r\n }\r\n reader.close();\r\n }catch (Exception e){\r\n e.printStackTrace();\r\n }\r\n }", "public int getFrequency(){\n return this.frequency;\n }", "public static Map<String, Integer> getFrequencies() {\n return UNIGRAM;\n }", "@Test\n public void test1() throws IOException {\n FileSystem fs = FileSystem.getLocal(new Configuration());\n Path termsFilePath = new Path(\"etc/trec-index-terms.dat\");\n Path termIDsFilePath = new Path(\"etc/trec-index-termids.dat\");\n Path idToTermFilePath = new Path(\"etc/trec-index-termid-mapping.dat\");\n\n DefaultFrequencySortedDictionary dictionary =\n new DefaultFrequencySortedDictionary(termsFilePath, termIDsFilePath, idToTermFilePath, fs);\n\n assertEquals(312232, dictionary.size());\n assertEquals(\"page\", dictionary.getTerm(1));\n assertEquals(\"time\", dictionary.getTerm(2));\n assertEquals(\"will\", dictionary.getTerm(3));\n assertEquals(\"year\", dictionary.getTerm(4));\n assertEquals(\"nikaan\", dictionary.getTerm(100000));\n\n assertEquals(1, dictionary.getId(\"page\"));\n assertEquals(2, dictionary.getId(\"time\"));\n assertEquals(3, dictionary.getId(\"will\"));\n assertEquals(4, dictionary.getId(\"year\"));\n assertEquals(100000, dictionary.getId(\"nikaan\"));\n \n assertEquals(null, dictionary.getTerm(312233));\n\n Iterator<String> iter = dictionary.iterator();\n assertTrue(iter.hasNext());\n assertEquals(\"page\", iter.next());\n assertTrue(iter.hasNext());\n assertEquals(\"time\", iter.next());\n assertTrue(iter.hasNext());\n assertEquals(\"will\", iter.next());\n assertTrue(iter.hasNext());\n assertEquals(\"year\", iter.next());\n assertTrue(iter.hasNext());\n\n int cnt = 0;\n for (@SuppressWarnings(\"unused\") String s : dictionary) {\n cnt++;\n }\n assertEquals(dictionary.size(), cnt);\n\n cnt = 0;\n iter = dictionary.iterator();\n while(iter.hasNext()) {\n cnt++;\n iter.next();\n }\n assertEquals(dictionary.size(), cnt);\n }", "public long getFreq() {\n return freq;\n }", "private void calculateIdf(){\r\n\t\tIdf = new HashMap<>();\r\n\t\tOcc = new HashMap<>();\r\n\t\t\r\n\t\tfor (Entry<String, Document> doc : Docs.entrySet()){\r\n\t\t\tdoc.getValue().wordSet.forEach(word -> {\r\n\t\t\t\tdouble count = Idf.containsKey(word) ? Idf.get(word) : 0;\r\n \tIdf.put(word, count+1);\r\n\t\t\t});\r\n\t\t\t\r\n\t\t\tdoc.getValue().words.forEach((w, o) -> words.add(w));\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\tfor (Entry<String, Double> e : new HashMap<>(Idf).entrySet()){\r\n\t\t\tIdf.put(e.getKey(),\r\n\t\t\t\t\tMath.log(Idf.keySet().size() / e.getValue()));\r\n\t\t}\r\n\t}", "@Override\r\n\t\t\tpublic long getDocumentFrequency(String term) {\n\t\t\t\treturn 0;\r\n\t\t\t}", "public static void InvertedDocFrequency() throws FileNotFoundException {\n //int totalDoc = totaldocument;\n int i = 0;\n for(Entry<String, List<Integer>> entry: dictionary.entrySet()) {\n List<Integer> docFrequency = new ArrayList<>();\n //\tList<Double> idfValue = new ArrayList<>();\n docFrequency = entry.getValue(); //again taking the list of word terms from the same dictionary hashmap\n int df = docFrequency.get(totaldocument+1); // it will save the idf of every word term at the 57th index\n double ans = Math.log10(df);\n ans /= totaldocument;\n\n idfFinal.add(i,ans); //updatin\n i++;\n }\n saveidf();\n }", "public int getFrequency_(){\r\n\t\treturn frequency_;\r\n\t}", "int getFreq();", "float getFrequency();", "public static void pageRankmain() {\n\t\t\t\n\t\t\tstopWordStore();\n\t\t\t//File[] file_read= dir.listFiles();\n\t\t\t//textProcessor(file_read);// Will be called from LinkCrawler\n\t\t\t//queryProcess();\n\t\t\t//System.out.println(\"docsave \"+ docsave);\n\t\t\t/*for ( Map.Entry<String, ArrayList<String>> entry : docsave.entrySet()) {\n\t\t\t String key = entry.getKey();\n\t\t\t List<String> values = entry.getValue();\n\t\t\t System.out.print(\"Key = \" + key);\n\t\t\t System.out.println(\" , Values = \"+ values);\n\t\t\t}*/\n\t\t\t//########## RESPOINSIBLE FOR CREATING INVERTED INDEX OF TERMS ##########\n\t\t\tfor(int i=0;i<vocabulary.size();i++) {\n\t\t\t\tint count=1;\n\t\t\t\tMap<String, Integer> nestMap = new HashMap<String, Integer>();\n\t\t\t\tfor ( Map.Entry<String, ArrayList<String>> entry : docsave.entrySet()) {\n\t\t\t\t String keyMain = entry.getKey();\n\t\t\t\t List<String> values = entry.getValue();\n\t\t\t\t if(values.contains(vocabulary.get(i)))\n\t\t\t\t \t{\n\t\t\t\t \tentryDf.put(vocabulary.get(i), count);//entryDf stores documents frequency of vocabulary word \\\\it increase the count value for specific key\n\t\t\t\t \tcount++;\n\t\t\t\t \t}\n\t\t\t\t \n\t\t\t\t nestMap.put(keyMain, Collections.frequency(values,vocabulary.get(i)));\n\t\t\t \t\n\t\t\t \t//System.out.println(\"VOC \"+ vocabulary.get(i)+ \" KeyMain \" +keyMain+ \" \"+ Collections.frequency(values,vocabulary.get(i)));\n\t\t\t\t\t}\n\t\t\t\t\ttfList.put(vocabulary.get(i), nestMap);\n\t\t\t}\n\t\t\t//########## RESPOINSIBLE FOR CREATING A MAP \"storeIdf\" TO STORE IDF VALUES OF TERMS ##########\n\t\t\tfor ( Map.Entry<String, Integer> endf : entryDf.entrySet()) {\n\t\t\t\tString keydf = endf.getKey();\n\t\t\t\tint valdf = endf.getValue();\n\t\t\t\t//System.out.print(\"Key = \" + \"'\"+keydf+ \"'\");\n\t\t\t //System.out.print(\" , Values = \"+ valdf);\n\t\t\t double Hudai = (double) (docsave.size())/valdf;\n\t\t\t //System.out.println(\"docsave size \"+docsave.size()+ \" valdf \"+ valdf + \" Hudai \"+ Hudai+ \" log Value1 \"+ Math.log(Hudai)+ \" log Value2 \"+ Math.log(2));\n\t\t\t double idf= Math.log(Hudai)/Math.log(2);\n\t\t\t storeIdf.put(keydf, idf);\n\t\t\t //System.out.print(\" idf-> \"+ idf);\n\t\t\t //System.out.println();\n\t\t\t} \n\t\t\t\n\t\t\t//############ Just for Printing ##########NO WORK HERE########\n\t\t\tfor (Map.Entry<String, Map<String, Integer>> tokTf : tfList.entrySet()) {\n\t\t\t\tString keyTf = tokTf.getKey();\n\t\t\t\tMap<String, Integer> valTF = tokTf.getValue();\n\t\t\t\tSystem.out.println(\"Inverted Indexing by Key Word = \" + \"'\"+keyTf+ \"'\");\n\t\t\t\tfor (Map.Entry<String, Integer> nesTf : valTF.entrySet()) {\n\t\t\t\t\tString keyTF = nesTf.getKey();\n\t\t\t\t\tInteger valTf = nesTf.getValue();\n\t\t\t\t\tSystem.out.print(\" Document Consists This Key Word = \" + \"'\"+ keyTF+ \"'\");\n\t\t\t\t\tSystem.out.println(\" , Term Frequencies in This Doc = \"+ valTf);\n\t\t\t\t} \n\t\t\t}\n\t\t\t//########### FOR CALCULATING DOCUMENT LENTH #############//\n\t\t\tfor ( Map.Entry<String, ArrayList<String>> entry_new : docsave.entrySet()) // Iterating Number of Documents\n\t\t\t{\n\t\t\t\tString keyMain_new = entry_new.getKey();\n\t\t\t\t//int countStop=0;\n\t\t\t\tdouble sum=0;\n\t\t\t\t for(Map.Entry<String, Map<String, Integer>> tokTf_new : tfList.entrySet()) // Iterating through the vocabulary\n\t\t\t\t { \n\t\t\t\t\t Map<String, Integer> valTF_new = tokTf_new.getValue();\n\t\t\t\t\t for (Map.Entry<String, Integer> nesTf_new : valTF_new.entrySet()) // Iterating Through the Documents\n\t\t\t\t\t {\n\t\t\t\t\t\t if(keyMain_new.equals(nesTf_new.getKey())) // Only doc name EQUAL with docsave name can enter here\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t double val = nesTf_new.getValue()* (Double) storeIdf.get(tokTf_new.getKey());\n\t\t\t\t\t\t\t sum = sum+ Math.pow(val, 2);\n\t\t\t\t\t\t }\n\t\t\t\t\t }\n\t\t\t\t\t \n\t\t\t\t\t //countStop++;\n\t\t\t\t }\n\t\t\t\t docLength.put(keyMain_new, Math.sqrt(sum));\n\t\t\t\t sum=0;\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tSystem.out.println(\"Document Length \"+ docLength);\n\t\t\t//System.out.println(\"tfList \"+tfList);\n\t\t\t\n\t\t\t //########### FOR CALCULATING QUERY LENTH #############///\n\t\t\t\tdouble qrySum=0;\n\t\t\t\t for(String qryTerm: queryList) // Iterating through the vocabulary\n\t\t\t\t {\n\t\t\t\t\t//entryQf.put(qryTerm, Collections.frequency(queryList,qryTerm));// VUl ase\n\t\t\t\t\t \n\t\t\t\t\t\t if(storeIdf.get(qryTerm) != null) \n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t entryQf.put(qryTerm, Collections.frequency(queryList,qryTerm));\n\t\t\t\t\t\t\t double val = entryQf.get(qryTerm)* (Double) storeIdf.get(qryTerm);\n\t\t\t\t\t\t\t qrySum = qrySum+ Math.pow(val, 2);\n\t\t\t\t\t\t }\n\t\t\t\t\t System.out.println(qryTerm+\" \"+entryQf.get(qryTerm)+ \" \"+ (Double) storeIdf.get(qryTerm));\n\t\t\t\t }\n\t\t\t\t qrySum=Math.sqrt(qrySum);\n\t\t\t\t System.out.println(\"qrySum \" + qrySum);\n\t\t\t\t \n\t\t\t\t//########### FOR CALCULATING COSINE SIMILARITY #############///\n\t\t\t\t for ( Map.Entry<String, ArrayList<String>> entry_dotP : docsave.entrySet()) // Iterating Number of Documents\n\t\t\t\t\t{\n\t\t\t\t\t\tdouble sumProduct=0;\n\t\t\t\t\t\tdouble productTfIdf=0;\n\t\t\t\t\t\tString keyMain_new = entry_dotP.getKey(); //Geting Doc Name\n\t\t\t\t\t\t for(Map.Entry<String, Integer> qryTermItr : entryQf.entrySet()) // Iterating through the vocabulary\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t Map<String, Integer> matchTerm = tfList.get(qryTermItr.getKey()); // Getting a map of doc Names by a Query Term as value of tfList\n\n\t\t\t\t\t\t\t\t if(matchTerm.containsKey(keyMain_new)) // Only doc name EQUAL with docsave name can enter here\n\t\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\t\t //System.out.println(\"Test \"+ matchTerm.get(keyMain_new) +\" keyMain_new \" + keyMain_new);\n\t\t\t\t\t\t\t\t\t double docTfIdf= matchTerm.get(keyMain_new) * storeIdf.get(qryTermItr.getKey());\n\t\t\t\t\t\t\t\t\t double qryTfIdf= qryTermItr.getValue() * storeIdf.get(qryTermItr.getKey());\n\t\t\t\t\t\t\t\t\t productTfIdf = docTfIdf * qryTfIdf;\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t sumProduct= sumProduct+productTfIdf;\n\t\t\t\t\t\t\t //System.out.println(\"productTfIdf \"+productTfIdf+\" sumProduct \"+ sumProduct);\n\t\t\t\t\t\t\t productTfIdf=0;\n\t\t\t\t\t\t }\n\t\t\t\t\t\t cosineProd.put(entry_dotP.getKey(), sumProduct/(docLength.get(entry_dotP.getKey())*qrySum));\n\t\t\t\t\t\t sumProduct=0;\n\t\t\t\t\t\t //System.out.println(entry_dotP.getKey()+ \" \" + docLength.get(entry_dotP.getKey()));\n\t\t\t\t\t}\n\t\t\t\t System.out.println(\"cosineProd \"+ cosineProd);\n\t\t\t\t \n\t\t\t\t System.out.println(\"Number of Top Pages you want to see\");\n\t\t\t\t int topRank = Integer.parseInt(scan.nextLine());\n\t\t\t\t Map<String, Double> result = cosineProd.entrySet().stream()\n\t\t\t .sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).limit(topRank)\n\t\t\t .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue,\n\t\t\t (oldValue, newValue) -> oldValue, LinkedHashMap::new));\n\n\t\t\t\t scan.close();\n\t\t\t //Alternative way\n\t\t\t //Map<String, Double> result2 = new LinkedHashMap<>();\n\t\t\t //cosineProd.entrySet().stream().sorted(Map.Entry.<String, Double>comparingByValue().reversed()).limit(2).forEachOrdered(x -> result2.put(x.getKey(), x.getValue()));\n\n\t\t\t System.out.println(\"Sorted...\");\n\t\t\t System.out.println(result);\n\t\t\t //System.out.println(result2);\n\t}", "public q677() {\n hm = new HashMap<>();\n words = new HashMap<>();\n }", "private HashMap<Integer, HashMap<String,String>> getAllFrequencies() {\n HashMap<Integer,HashMap<String,String>> freq\n = dbController.getAllFrequencies();\n if (freq == null)\n return null;\n HashMap<Integer, HashMap<String, String>> response = new HashMap<Integer, HashMap<String, String>>();\n int i = 2;\n //Passing on any frequency and creates a message to send\n for (Map.Entry<Integer,HashMap<String,String>> objs : freq.entrySet()){\n HashMap<String,String> obj = objs.getValue();\n\n response.put(i, new HashMapBuilder<String, String>().put(\"name\", obj.get(\"name\"))\n .put(\"frequency\",obj.get(\"frequency\")).build());\n i++;\n }\n return response;\n }", "private void buildFreqMap() {\n\t\toriginalFreq = new HashMap<String, WordOccurence>();\n\n\t\tfor (ListIterator<Caption> itr = original.captionIterator(0); itr\n\t\t\t\t.hasNext();) {\n\t\t\tfinal Caption currentCap = itr.next();\n\t\t\tfinal String[] words = currentCap.getCaption().split(\"\\\\s+\");\n\t\t\tfor (int i = 0; i < words.length; i++) {\n\t\t\t\tfinal String lowerCasedWord = words[i].toLowerCase();\n\t\t\t\tif (originalFreq.containsKey(lowerCasedWord)) {\n\t\t\t\t\toriginalFreq.get(lowerCasedWord).addOccurence(\n\t\t\t\t\t\t\t(int) currentCap.getTime());\n\t\t\t\t} else {\n\t\t\t\t\tfinal WordOccurence occ = new WordOccurence(\n\t\t\t\t\t\t\t(int) currentCap.getTime());\n\t\t\t\t\toriginalFreq.put(lowerCasedWord, occ);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < identified.size(); i++) {\n\t\t\tResultChunk curretResult = identified.get(i);\n\t\t\tfinal String[] words = curretResult.getDetectedString().split(\n\t\t\t\t\t\"\\\\s+\");\n\t\t\tint identifiedAt = curretResult.getDetectedAt();\n\t\t\tfor (int j = 0; j < words.length; j++) {\n\t\t\t\tString currentWord = words[j].toLowerCase();\n\t\t\t\tif (originalFreq.containsKey(currentWord)) {\n\t\t\t\t\tint detectedAt = (int) (identifiedAt - (words.length - j)\n\t\t\t\t\t\t\t* AVG_WORD_TIME);\n\t\t\t\t\toriginalFreq.get(currentWord).addVoiceDetection(detectedAt);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public Occurrence(String doc, int freq) {\n\t\tdocument = doc;\n\t\tfrequency = freq;\n\t}", "public int getFrequency()\n {\n return this.frequency;\n }", "public static void docWtgArray() {\n int docCount = 0;\n\n while(docCount<totaldocument) {\n List<Double> pass = new ArrayList();\n for(Entry<String,List<Double>> entry : wtgMap.entrySet()) {\n List<Double> docList = new ArrayList();\n docList = entry.getValue();\n double temp = docList.get(docCount);\n pass.add(temp);\n }\n\n double answer = CosineSimilarity(pass,query);\n if(answer >= alpha) {\n DocID.put(docCount,answer);\n }\n docCount++;\n }\n }", "public void setFrequency(String frequency)\n {\n this.frequency = frequency;\n }", "public Double getFrequency() {\n return frequency;\n }", "abstract public int docFreq(Term t) throws IOException;", "public FrequencyAnalysis()\n {\n }", "public void setDocumentFrequency(double docFreq) {\n\t\tdocumentFrequency = docFreq;\n\t}", "public int getFrequency()\n\t{\n\t\treturn frequency;\n\t}", "public int getFreq() {\n return freq_;\n }", "private void initialize() {\n\t\tfor(String key: count_e_f.keySet()){\n\t\t\tcount_e_f.put(key, 0.0);\n\t\t}\n\t\t\n\t\tfor(Integer key: total_f.keySet()){\n\t\t\ttotal_f.put(key, 0.0);\n\t\t}\n\t\t\n\t\t//This code is not efficient.\n//\t\tfor(Entry<String, Integer> german : mainIBM.gerWordsIdx.entrySet()){\n//\t\t\tfor(Entry<String, Integer> english : mainIBM.engWordsIdx.entrySet()){\n//\t\t\t\tcount_e_f.put(english.getValue() + \"-\" + german.getValue(), 0.0);\n//\t\t\t}\n//\t\t\ttotal_f.put(german.getValue(), 0.0);\n//\t\t}\t\n\n\t}", "public ComputeTermFrequencies() { super(); }", "public HashMap<String,Occurrence> loadKeywordsFromDocument(String docFile) \n\tthrows FileNotFoundException {\n\t\t Scanner sc = new Scanner(new File(docFile));\n\t HashMap <String, Occurrence> newHash = new HashMap <String, Occurrence>();\n\t while (sc.hasNext()) {\n\t \t String word = sc.next();\n\t String output = getKeyword(word);\n\t if(output != null) {\n\t \t boolean foundDup = false;\n\t for(String e: newHash.keySet()) {\n\t \t if(output.equals(e) == true) {\n\t \t\t Occurrence occ = newHash.get(e);\n\t occ.frequency = occ.frequency + 1;\n\t foundDup = true;\n\t break;}}\n\t if(foundDup == false) {\n\t \t newHash.put(output, new Occurrence(docFile, 1));}}}\n\t sc.close();\n\t return newHash;\n\t}", "public static void main(String[] args) throws FileNotFoundException, IOException {\n \n \n File textBank = new File(\"textbank/\");\n Hashtable<Integer,Integer> frequency;\n Hashtable<Integer, String> table;\n table = new Hashtable<>();\n frequency = new Hashtable<>();\n Scanner input = new Scanner(new File(\"stoplist.txt\"));\n int max=0;\n while (input.hasNext()) {\n String next;\n next = input.next();\n if(next.length()>max)\n max=next.length();\n table.put(next.hashCode(), next); //to set up the hashmap with the wordsd\n \n }\n \n System.out.println(max);\n \n Pattern p0=Pattern.compile(\"[\\\\,\\\\=\\\\{\\\\}\\\\\\\\\\\\\\\"\\\\_\\\\+\\\\*\\\\#\\\\<\\\\>\\\\!\\\\`\\\\-\\\\?\\\\'\\\\:\\\\;\\\\~\\\\^\\\\&\\\\%\\\\$\\\\(\\\\)\\\\]\\\\[]\") \n ,p1=Pattern.compile(\"[\\\\.\\\\,\\\\@\\\\d]+(?=(?:\\\\s+|$))\");\n \n \n \n wor = new ConcurrentSkipListMap<>();\n \n ConcurrentMap<String , Map<String,Integer>> wordToDoc = new ConcurrentMap<String, Map<String, Integer>>() {\n @Override\n public Map<String, Integer> putIfAbsent(String key, Map<String, Integer> value) {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public boolean remove(Object key, Object value) {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public boolean replace(String key, Map<String, Integer> oldValue, Map<String, Integer> newValue) {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public Map<String, Integer> replace(String key, Map<String, Integer> value) {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public int size() {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public boolean isEmpty() {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public boolean containsKey(Object key) {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public boolean containsValue(Object value) {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public Map<String, Integer> get(Object key) {\n return wor.get((String)key);//To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public Map<String, Integer> put(String key, Map<String, Integer> value) {\n wor.put(key, value); // this saving me n \n //if(frequency.get(key.hashCode())== null)\n \n //frequency.put(key.hashCode(), )\n return null;\n }\n\n @Override\n public Map<String, Integer> remove(Object key) {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public void putAll(Map<? extends String, ? extends Map<String, Integer>> m) {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public void clear() {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public Set<String> keySet() {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public Collection<Map<String, Integer>> values() {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n\n @Override\n public Set<Map.Entry<String, Map<String, Integer>>> entrySet() {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }\n };\n totalFiles = textBank.listFiles().length;\n for (File textFile : textBank.listFiles()) {\n totalReadFiles++;\n //checking whether file has txt extension and file size is higher than 0\n if(textFile.getName().contains(\".txt\") && textFile.length() > 0){\n docName.add(textFile.getName().replace(\".txt\", \".stp\"));\n StopListHandler sp = new StopListHandler(textFile, table,System.currentTimeMillis(),p0,p1,wordToDoc);\n sp.setFinished(() -> {\n \n tmp++;\n \n if(tmp==counter)\n //printTable(counter);\n \n if(totalReadFiles == totalFiles)\n {\n printTable(counter);\n }\n \n });\n \n sp.start();\n counter ++;}\n \n \n }\n System.out.println(counter);\n //while(true){if(tmp==counter-1) break;}\n System.out.println(\"s\");\n \n }", "@Override\n public long getFrequencyCount() {\n return count;\n }", "public Integer getFrequency() {\n return this.frequency;\n }", "java.lang.String getFrequency();", "@Override\n public int getTermFrequencyByDocument(String term, String url) {\n return 0;\n }", "@Override\n public int getDocumentFrequencyByTerm(String term) {\n return 0;\n }", "public void setFrequency(Double frequency) {\n this.frequency = frequency;\n }", "public Frequency() {\n\n }", "public HashMap(){\n\t\tthis.numOfBins=10;\n\t\tthis.size=0;\n\t\tinitializeMap();\n\t}", "public HashMap<String, Integer> getHashMap(){\n\t\tHashMap <String, Integer> hm1 = new HashMap <String, Integer>();\n\t\t//get each line of the book and store it as an arrayList\n\t\twords = wordData.getLines();\n\t \n\t\tfor(int i =0; i<words.size(); i++){\n\t\t\t \n\t\t\tString[] aLine = words.get(i).split(\" \");\n\t\t\t\n\t\t\tfor(int j = 0; j<aLine.length; j++){\n\t\t\t\t\n\t\t\t\t// convert all upper case to lower case & remove all non-alphabetic symbols;\n\t\t\t\t\t\n\t\t\t\tsparsedWords.add(aLine[j].toLowerCase().replaceAll(\"[^\\\\w]\", \"\"));\n\t\t\t}\n\t\t}\n\t\t//put in key and value in hashmap\n\t\tfor(int key = 0; key < sparsedWords.size(); key++){\n\t\t\t\n\t\t\tif (hm1.containsKey(sparsedWords.get(key))){\n\t\t\t\tint count = hm1.get(sparsedWords.get(key));\n\t\t\t\thm1.put(sparsedWords.get(key), count + 1);\n\t\t\t}else{\n\t\t\t\thm1.put(sparsedWords.get(key), 1);\n\t\t\t}\n\t\t}\n\t\treturn hm1;\n\t\t \t\n\t\t}", "public java.lang.Integer getFrequency() {\n return frequency;\n }", "private void initiateWordCount(){\n for(String key: DataModel.bloomFilter.keySet()){\n WordCountHam.put(key, 0);\n WordCountSpam.put(key, 0);\n }\n }", "public int getFreq() {\n return freq_;\n }", "@Override\n\tpublic int showFrequency(String key) {\n\t\tint hashVal = hashFunc(key);\n\t\twhile (hashArray[hashVal] != null) {\n\t\t\tif (hashArray[hashVal].value.equals(key))\n\t\t\t\treturn hashArray[hashVal].frequency;\n\t\t\telse {\n\t\t\t\thashVal++;\n\t\t\t\thashVal = hashVal % size;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}", "public CountingMap() {\n this( new HashMap<K, Integer>() );\n }", "public void setFrequency(int f){\n this.frequency = f;\n }", "public HitCounter() {\n map = new HashMap<Integer, Integer>();\n }", "private static HashMap<String, Integer> getWordIndex()\n\t{\n\t\treturn aWordIndex;\n\t}", "public Dictionary () {\n list = new DoubleLinkedList<>();\n this.count = 0;\n }", "public WordCount2(Integer frequency) {\n emitFrequency = frequency;\n }", "public WordsInfo() {\n\t\tWordsCount = 1;\n\t\tInMailsFound = 1;\n\t\tupdated = true;\n\t}", "public java.lang.Integer getFrequency() {\n return frequency;\n }", "public void setCountsHashMap(HashMap<Integer, Integer> countsHashMap){\n\t\tthis.countsHashMap = countsHashMap;\n\t}", "private Map<String,Map<String,List<String>>> buildDictionary(Document doc){\n\t\t\n\t\tElement root = doc.getDocumentElement();\n\t\t\n\t\t\n\t\tMap<String,Map<String,List<String>>> dictionary = new HashMap<String,Map<String,List<String>>>();\n\t\tthis.termSet = new TreeSet<String>();\n\t\t\n\t\tNodeList termList = doc.getElementsByTagName(\"term\");\n\t\tfor(int i = 0; i < termList.getLength(); i++){\n\t\t\tElement termElement = (Element) termList.item(i);\n\t\t\tElement nameElement = (Element) termElement.getElementsByTagName(\"name\").item(0);\n\t\t\tString name = nameElement.getTextContent();\n\t\t\tthis.termSet.add(name);\n\n\t\t\tMap<String,List<String>> synonymGroup = new HashMap<String,List<String>>();\n\t\t\tsynonymGroup.put(\"exact\", new ArrayList<String>());\n\t\t\tsynonymGroup.put(\"related\", new ArrayList<String>());\n\t\t\tsynonymGroup.put(\"broad\", new ArrayList<String>());\n\t\t\tsynonymGroup.put(\"narrow\", new ArrayList<String>());\n\t\t\t\n\t\t\tNodeList synonyms = termElement.getElementsByTagName(\"synonym\");\n\t\t\tfor(int j=0; j<synonyms.getLength(); j++){\n\t\t\t\tElement synonymElement = (Element) synonyms.item(j);\n\t\t\t\tString synonym = synonymElement.getTextContent();\n\t\t\t\tString scope = synonymElement.getAttribute(\"scope\");\n\t\t\t\t//System.out.println(scope);\n\t\t\t\tList<String> synonymList = (List<String>) synonymGroup.get(scope);\n\t\t\t\t\n\t\t\t\t//System.out.println(synonym);\n\t\t\t\t\n\t\t\t\tsynonymList.add(synonym);\n\t\t\t}\n\t\t\t\n\t\t\tdictionary.put(name,synonymGroup);\t\t\n\t\t\t\n\t\t}\n\t\t\n\t\treturn dictionary;\n\t}", "public int getDocFreq(Term t){\n\t\tint freq = 0;\r\n\t\tfor (Map.Entry<String, IndexedDoc> set : index.entrySet()){\r\n\t\t\tif (set.getValue().containsTerm(t)){\r\n\t\t\t\tfreq++;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn freq;\r\n\t}", "public EfficientWordMarkov()\n\t{\n\t\tsuper();\n\t\tmyMap = new HashMap<WordGram , ArrayList<String>>();\n\t}", "public Q706DesignHashMap() {\n keys = new ArrayList<>();\n values = new ArrayList<>();\n\n }", "public HashMap<String,Occurrence> loadKeywordsFromDocument(String docFile) \n\tthrows FileNotFoundException {\n\t\t/** COMPLETE THIS METHOD **/\n\t\tif (docFile == null)\n\t\t\tthrow new FileNotFoundException();\n\n\t\tHashMap<String, Occurrence> answer = new HashMap<String, Occurrence>();\n\n\t\tScanner sc = new Scanner(new File(docFile));\n\n\t\twhile (sc.hasNext())\n\t\t{\n\t\t\tString key = getKeyword(sc.next());\n\t\t\tif (key != null)\n\t\t\t{\n\t\t\t\tif (answer.containsKey(key))\n\t\t\t\t{\n\t\t\t\t\tOccurrence occurance = answer.get(key);\n\t\t\t\t\toccurance.frequency++;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tOccurrence oc = new Occurrence(docFile, 1);\n\t\t\t\t\tanswer.put(key, oc);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tsc.close();\n\t\treturn answer;\n\t\t// following line is a placeholder to make the program compile\n\t\t// you should modify it as needed when you write your code\n\t}", "public FrequencyBag() {\n\t\tfirstNode = null;\n\t\tnumEntries = 0;\n\t}", "void updateFrequencyCount() {\n //Always increments by 1 so there is no need for a parameter to specify a number\n this.count++;\n }", "public void setInverseDocumentFrequency(Double arg0) {\n \n }", "public void buildWordFileMap(){\n hashWords.clear();\n DirectoryResource dr = new DirectoryResource();\n for (File f : dr.selectedFiles()){ //for all the files selected make the hashWords hashmap\n addWordsFromFile(f);\n }\n \n }", "public synchronized static ComputeTermFrequencies createComputeAndPrintTermFrequency() \n\t{\n\t\treturn new ComputeTermFrequencies();\n\t}", "public DocMap(Gedcomx doc) {\n // Build all the maps.\n update(doc);\n }", "public synchronized void register(int docid, String word, int frequency) {\n // load the hashtable for this term\n Object val = index.get(word);\n\n // define a new int[1] to store the frequency\n int[] fArray = new int[1];\n fArray[0] = frequency;\n\n if (val == null) {\n // if this term isn't in the index, create a new hashtable and store\n // it\n HashMap newList = new HashMap();\n newList.put(docid, fArray);\n index.put(word, newList);\n } else {\n // if the term exists, simply store appropriately\n ((HashMap) val).put(docid, fArray);\n }\n }", "public int getEntryCount() {\n return wordFrequency.size();\n }", "public MyHashMap() {\n map = new HashMap();\n }", "@Override\r\n public int hashCode() {\r\n return doc1.hashCode() + doc2.hashCode();\r\n }", "WordList(){\r\n\t\tm_words = new HashMap();\r\n\t}", "public WordDictionary() {\n\n }", "public WordDictionary() {\n\n }", "public WordDictionary() {\n\n }", "@Override\n protected double getTFDocument(BasicStats stats, float termFreq, float docLength) {\n return ((k1 + 1) * termFreq / (k1 * (1 - b +\n b * docLength / stats.getAvgFieldLength()) + termFreq));\n }", "public WordDictionary() {\n \n \n }", "public Set<Frequency> getFrequencies() {\n return null;\n }", "@Override\n\t public float idf(int docFreq, int numDocs) {\n\t // return (float)(Math.log(numDocs/(double)(docFreq+1)) + 1.0);\n\t\t return 1.0f;\n\t }", "SortComparator(Map<Integer, Integer> tFreqMap) { \n this.freqMap = tFreqMap; \n }", "public Dictionary () {\n\t\tsuper();\n\t\t//words = new ArrayList < String > () ;\n\t}", "public Frequency getFreq() {\n\t\treturn this.freq;\n\t}", "public WordDictionary() {\n }", "public Double getInverseDocumentFrequency() {\n return null;\n }", "public Frequency(ArrayList<LottoDay> list) {\n\n\t\tfill(list);//fill the maps\n\t}", "private Integer getFrequency(String key) {\n\t\t\n\t\ttry{\n\t\t\tif(key != null && key.trim().length() > 0)\n\t\t\t\tfrequencyMap.put(key.toString().toLowerCase(), WordplayUtil.getCount(key.toString().toLowerCase(), frequencyMap) + 1);\n\t\t\t\n\t\t\treturn WordplayUtil.getCount(key.toString().toLowerCase(), frequencyMap);\n\t\t}catch(Exception e){\n\t\t\t\n\t\t}\n\t\treturn 1;\n\t}", "private void handleDocument(String name,InputStream ins)\n{\n Map<String,Integer> words = new HashMap<>();\n Map<String,Integer> kgrams = new HashMap<>();\n \n try {\n String cnts = IvyFile.loadFile(ins);\n CompilationUnit cu = JcompAst.parseSourceFile(cnts);\n words = handleDocumentText(cnts);\n kgrams = buildKgramCounts(cnts,cu);\n }\n catch (IOException e) {\n IvyLog.logI(\"Problem reading document file \" + name + \": \" + e);\n }\n \n if (words.size() > 0) {\n ++total_documents;\n for (String s : words.keySet()) {\n Integer v = document_counts.get(s);\n if (v == null) document_counts.put(s,1);\n else document_counts.put(s,v+1);\n }\n }\n if (kgrams.size() > 0) {\n ++total_kdocuments;\n for (String s : kgrams.keySet()) {\n Integer v = kgram_counts.get(s);\n if (v == null) kgram_counts.put(s,1);\n else kgram_counts.put(s,v+1);\n }\n }\n}", "private void initIDFMap(List<List<Map<String,List<Double>>>> tfMap){\n\t\tfor (int i = 0; i < tfMap.size(); i++) {\n\t\t\tList<Map<String,List<Double>>> gestureDocument = tfMap.get(i);\n\t\t\tfor (int j = 0; j < gestureDocument.size(); j++) {\n\t\t\t\tMap<String,List<Double>> tempMap = gestureDocument.get(j);\n\t\t\t\tIterator<Entry<String, List<Double>>> it = tempMap.entrySet().iterator();\n\t\t\t\t while (it.hasNext()) {\n\t\t\t\t Map.Entry<String,Integer> pairs = (Map.Entry)it.next(); \n\t\t\t\t if(getTfIDFMapGlobal().containsKey(pairs.getKey()))\n\t\t\t\t \tgetTfIDFMapGlobal().put(pairs.getKey(), getTfIDFMapGlobal().get(pairs.getKey())+1);\n\t\t\t\t else\n\t\t\t\t \tgetTfIDFMapGlobal().put(pairs.getKey(), 1);\n\t\t\t\t }\n\t\t\t}\n\t\t}\n\t}", "private HashMap<String,String> getFrequency(String code) {\n HashMap<String,String> response = new HashMap<String,String>();\n\n HashMap<String,String> kindOfFrequency = new HashMap<String,String>();\n kindOfFrequency.put(\"name\",code);\n //Get the value of the frequency according to its name\n HashMap<Integer,HashMap<String,String>> freq\n = dbController.getFrequency(kindOfFrequency);\n if (freq == null)\n return null;\n for (Map.Entry<Integer,HashMap<String,String>> objs : freq.entrySet()){\n HashMap<String,String> obj = objs.getValue();\n\n response.put(\"name\",obj.get(\"name\"));\n response.put(\"frequency\",obj.get(\"frequency\"));\n //Returns a map containing the name frequency and its value\n return response;\n }\n return null;\n }", "@Override\n public List<Map<Frequency, DataForDetection>> getStuffReference() {\n return super.getStuffReference();\n }", "private Map<String,List<Invertedindex>> collecting() //\r\n {\r\n Map<String,List<Invertedindex>> maps = new TreeMap<>();\r\n for (Core pon:pondred){\r\n for(Map.Entry<String,Double> term:pon.allTerms.entrySet()){\r\n if (maps.containsKey(term.getKey())){\r\n List<Invertedindex> index = maps.get(term.getKey());\r\n index.add(new Invertedindex(pon.m_cle,term.getValue(),pon.getBalise(term.getKey())));\r\n maps.put(term.getKey(), index);\r\n }else {\r\n List<Invertedindex> index = new ArrayList<>();\r\n index.add(new Invertedindex(pon.m_cle,term.getValue(),pon.getBalise(term.getKey())));\r\n maps.put(term.getKey(), index);\r\n }\r\n if(cleFreq.containsKey(pon.m_cle))\r\n cleFreq.put(pon.m_cle,cleFreq.get(pon.m_cle)+term.getValue());\r\n else cleFreq.put(pon.m_cle,term.getValue());\r\n\r\n }\r\n }\r\n return maps;\r\n }", "public WordDictionary() {\n\n }", "private void loadDocStatFromFile(String path) {\n docStat = new HashMap<String, Integer>();\n List<String> stats = fu.textFileToList(path);\n int totLength = 0;\n for (String stat : stats) {\n String docID = stat.split(\" \")[0];\n int docLen = Integer.parseInt(stat.split(\" \")[1]);\n totLength += docLen;\n docStat.put(docID, docLen);\n }\n avdl = totLength / N;\n }", "@Override\n public int getTermFrequency(String term) {\n return 0;\n }", "public abstract double score(\n\t\tdouble tf,\n\t\tdouble docLength,\n\t\tdouble n_t,\n\t\tdouble F_t,\n\t\tdouble keyFrequency);", "Map<String, Long> hits();", "public void setFrequencies(Set<Frequency> arg0) {\n \n }", "private void createTermFreqVector(JCas jcas, Document doc) {\n\n String docText = doc.getText();\n // construct a vector of tokens and update the tokenList in CAS\n // use tokenize0 from above\n List<String> ls = tokenize0(docText);\n Map<String, Integer> map = new HashMap<String, Integer>();\n Collection<Token> token_collection = new ArrayList<Token>();\n for (String d : ls) {\n if (map.containsKey(d)) {\n int inc = map.get(d) + 1;\n map.put(d, inc);\n } else {\n map.put(d, 1);\n }\n }\n Iterator it = map.entrySet().iterator();\n while (it.hasNext()) {\n Map.Entry pairs = (Map.Entry) it.next();\n Token t = new Token(jcas);\n String k = pairs.getKey().toString();\n int v = Integer.parseInt(pairs.getValue().toString());\n t.setFrequency(v);\n t.setText(k);\n token_collection.add(t);\n it.remove(); // avoids a ConcurrentModificationException\n }\n // use util tool to convert to FSList\n doc.setTokenList(Utils.fromCollectionToFSList(jcas, token_collection));\n doc.addToIndexes(jcas);\n\n }", "private static double freqOfKey(int index) {\n return 440 * Math.pow(2, (double) (index - 12) / 24);\n }", "void documentFrequncy(Set<String> features,\n int index,\n int troush\n ) {\n for (String str : features) {\n switch (index) {\n case 1:\n for (int i = 0; i < count1; i++) {\n if (economydocument[i].contains(str)) {\n e++;\n }\n }\n if (e > troush) {\n documntfrequencyeco.put(str, e);\n }\n e = 0;\n break;\n case 2:\n for (int i = 0; i < count2; i++) {\n if (educationdocument[i].contains(str)) {\n e++;\n }\n }\n if (e > troush) {\n documntfrequencyedu.put(str, e);\n }\n e = 0;\n break;\n case 3:\n for (int i = 0; i < count3; i++) {\n if (sportdocument[i].contains(str)) {\n e++;\n }\n }\n if (e > troush) {\n documntfrequencyspo.put(str, e);\n }\n e = 0;\n break;\n case 4:\n for (int i = 0; i < count4; i++) {\n if (culturedocument[i].contains(str)) {\n e++;\n }\n }\n if (e > troush) {\n documntfrequencycul.put(str, e);\n }\n e = 0;\n break;\n case 5:\n for (int i = 0; i < count5; i++) {\n if (accedentdocument[i].contains(str)) {\n e++;\n }\n }\n if (e > troush) {\n documntfrequencyaccid.put(str, e);\n }\n e = 0;\n break;\n case 6:\n for (int i = 0; i < count6; i++) {\n if (environmntaldocument[i].contains(str)) {\n e++;\n }\n }\n if (e > troush) {\n documntfrequencyenv.put(str, e);\n }\n e = 0;\n break;\n case 7:\n for (int i = 0; i < count7; i++) {\n if (foreign_affairdocument[i].contains(str)) {\n e++;\n }\n }\n if (e > troush) {\n documntfrequencydep.put(str, e);\n }\n e = 0;\n break;\n case 8:\n for (int i = 0; i < count8; i++) {\n if (law_justicedocument[i].contains(str)) {\n e++;\n }\n }\n if (e > troush) {\n documntfrequencylaw.put(str, e);\n }\n e = 0;\n break;\n case 9:\n for (int i = 0; i < count9; i++) {\n if (agriculture[i].contains(str)) {\n e++;\n }\n }\n if (e > troush) {\n documntfrequencyagri.put(str, e);\n }\n e = 0;\n break;\n case 10:\n for (int i = 0; i < count10; i++) {\n if (politicsdocument[i].contains(str)) {\n e++;\n }\n }\n if (e > troush) {\n documntfrequencypoltics.put(str, e);\n }\n e = 0;\n break;\n// case 11:\n//\n// for (int i = 0; i < count11; i++) {\n// if (social_affairsdocument[i].contains(str)) {\n// e++;\n// }\n// }\n// if (e > troush) {\n// documntfrequencysocial.put(str, e);\n// }\n// e = 0;\n// break;\n case 11:\n for (int i = 0; i < count12; i++) {\n if (science_technologydocument[i].contains(str)) {\n e++;\n }\n }\n\n if (e > troush) {\n documntfrequencysci.put(str, e);\n }\n e = 0;\n break;\n case 12:\n for (int i = 0; i < count13; i++) {\n if (healthdocument[i].contains(str)) {\n e++;\n }\n }\n if (e > troush) {\n documntfrequencyhel.put(str, e);\n }\n e = 0;\n break;\n case 13:\n for (int i = 0; i < count14; i++) {\n if (army[i].contains(str)) {\n e++;\n }\n }\n\n if (e > troush) {\n documntfrequencyarmy.put(str, e);\n }\n e = 0;\n break;\n default:\n break;\n }\n\n }\n }", "int getNumFrequents() {\n return numFrequents;\n }", "void setHashMap();" ]
[ "0.70611113", "0.6810253", "0.6602351", "0.6570665", "0.6453136", "0.63392675", "0.6338879", "0.63270146", "0.62483954", "0.6245922", "0.62302953", "0.6213969", "0.6181607", "0.6165074", "0.61567813", "0.6156436", "0.6148999", "0.61466086", "0.61222136", "0.61196184", "0.61072123", "0.6087546", "0.6078981", "0.6071762", "0.6055637", "0.6031502", "0.60163087", "0.60101646", "0.59723794", "0.5968825", "0.5962888", "0.59450465", "0.59393764", "0.5934722", "0.58868665", "0.5869486", "0.5868776", "0.5865681", "0.58654344", "0.5864536", "0.5856715", "0.58432347", "0.58428365", "0.58360964", "0.5811767", "0.5809582", "0.5786784", "0.5785735", "0.5773857", "0.57539153", "0.57511234", "0.5731765", "0.57313406", "0.5727104", "0.5723778", "0.5698795", "0.56984746", "0.5698362", "0.5697558", "0.56927186", "0.56918675", "0.5690831", "0.56742525", "0.5669302", "0.56623167", "0.5661065", "0.5640461", "0.5633943", "0.5629186", "0.5628483", "0.5624972", "0.56203914", "0.56203914", "0.56203914", "0.5619624", "0.5618885", "0.5614852", "0.5608677", "0.56063074", "0.560425", "0.56036294", "0.5602774", "0.5598729", "0.55934983", "0.55877954", "0.55848837", "0.5553743", "0.5552093", "0.5532304", "0.55273944", "0.5517159", "0.55075246", "0.5504384", "0.55029505", "0.55012536", "0.5495403", "0.5491259", "0.54897594", "0.5484527", "0.5472457", "0.54723454" ]
0.0
-1
Constructor for the reader
public InstanceReader(String filename) throws FileNotFoundException{ this.reader = new FileReader(filename); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Reader(){\n\n\t}", "public MsxReader ( ) {\r\n\t\tsuper();\r\n\t}", "public StreamReader() {}", "public ConcatReader(){\r\n\t\t// Empty Constructor\r\n\t}", "private TextReader() {\n // There are no fields required to initialize\n }", "public Tass4Reader ( ) {\r\n\t\tsuper();\r\n\t}", "public PajekNetReader()\n {\n this(false, false);\n }", "Read createRead();", "public CustomerReader() {\r\n }", "private CustomerReader()\r\n\t{\r\n\t}", "private Reader (Builder builder) {\n\t\tsuper(builder);\n\t}", "public BufferedReader2(Reader in)\r\n\t{\r\n\t\tsuper(in);\r\n\t}", "public SqlCharStream(Reader r) {\n input = r;\n }", "public SensorReader() {\n\t\tinit();\n\t}", "private RawGltfDataReader() {\n // Private constructor to prevent instantiation\n }", "public TextConfigurationReader(Reader reader) {\n\n super(reader);\n }", "public DatasetReader()\n\t{\n\t\treviews = new ArrayList<Review>();\n\t\tratings = new HashMap<Double,List<Double>>();\n\t\tproducts = new HashMap<String, Map<String,Double>>();\n\t\tproductRatings = new HashMap<String, List<Double>>();\n\t\treInstanceList = new ArrayList<ReviewInstance>();\n\t\treInstanceMap = new HashMap<String, ReviewInstance>();\n\t}", "public \n PipedObjectReader() \n {}", "private ConfigReader() {\r\n\t\tsuper();\r\n\t}", "Lexico(java.io.Reader in) {\n this.zzReader = in;\n }", "private MappingReader() {\n\t}", "public FastaReader(InputStream ins) throws IOException{\n\t\tsuper(ins);\n\t}", "private DictionaryReader() {}", "public StatDataFileReader createReaderInstance() throws IOException{\n return createReaderInstance(null);\n }", "protected abstract Reader getReader() throws IOException;", "public TxtReader() {\n numberOfCharacters = getNumberOfCharacters();\n }", "@Override\n protected void initializeReader() {\n this.fileList = new ArrayList<>();\n this.fileListPosition = new AtomicInteger(0);\n this.currentTextAnnotation = new AtomicReference<>();\n }", "public FastqReader(BufferedReader in)\n\t{\n\t\ttheBufferedReader = in;\n\t}", "private BookReader() {\n\t}", "public ObjReader(String filename){\n file = filename;\n }", "private BookReader() {\r\n }", "public void init(BinaryDataReader dataReader) throws IOException\n\t{\n\t}", "public Backend(Reader r) throws IOException {\r\n GradeDataReader reader = new GradeDataReader();\r\n List<Grade> data = null;\r\n // read data\r\n try {\r\n data = reader.readDataSet(r);\r\n } catch (IOException | DataFormatException e) {\r\n System.out.println(\"Error parsing file\");\r\n }\r\n // input into rbt\r\n for (int i = 0; i < data.size(); i++) {\r\n rbt.insert(data.get(i));\r\n }\r\n }", "public SimpleDocReader() { }", "public Sql(Reader reader) throws IOException {\n \n this();\n append(reader);\n }", "public BufferedReader2(Reader in, int sz)\r\n\t{\r\n\t\tsuper(in, sz);\r\n\t}", "public JsonReader(String source) {\n this.source = source;\n }", "public JsonReader(String source) {\n this.source = source;\n }", "public JsonReader(String source) {\n this.source = source;\n }", "public JsonReader(String source) {\n this.source = source;\n }", "public Lexico(java.io.Reader in) {\n this.zzReader = in;\n }", "public Lexico(java.io.Reader in) {\n this.zzReader = in;\n }", "public ReaderInputStream(Reader reader) {\n\t\t\tthis.reader = reader;\n\t\t\tencoder = UTF8.newEncoder();\n\t\t\tcharBuffer.limit(0);\n\t\t\tbyteBuffer.limit(0);\n\t\t}", "public GenericLineByLineParser(InputStreamReader reader) {\n this.br = new BufferedReader(reader);\n }", "public ReaderInputStream(Reader reader, String encoding) {\n this(reader);\n this.encoding = encoding;\n }", "private ExecutableReader() {}", "public LookAheadReader(Reader reader) throws IOException {\n\t\tthis(reader, DEFAULT_QUEUE_SIZE);\n\t}", "public XMLReader(Reader r) {\n\t\t_tokenizer = new XMLTokenizer(r);\n\t}", "public InputReader() {\n reader = new Scanner(System.in);\n }", "@Override\n public void construct() throws IOException {\n \n }", "public DiGraphReader() {\n // Configure the graph reader here\n g = null;\n e = null;\n }", "public JavaParser(Reader r) {\n reader = r;\n classLines = new ArrayList();\n methodLines = new ArrayList();\n }", "public PropertyReader(String propertyFileName)\r\n\t{\r\n\t\tthis.propertyFileName = propertyFileName;\r\n\t}", "public InCellReader() { super(\"InCell 1000\", \"xdce\"); }", "protected abstract ReaderType newBuilder();", "protected final Reader getReader()\n {\n return _reader;\n }", "public Data (String name, int type) {\n\t\tthis.name = name;\n\t\tthis.type = type;\n\t\tstream = new MyReader();\n\t}", "public reglas(java.io.Reader in) {\n this.zzReader = in;\n }", "public JsonReader(String file) {\n this.file = file;\n }", "public InputReader(String csv){\n inputStream = new Scanner(csv);\n instantiate();\n assert(invariant());\n }", "public AnalizadorLexico2(java.io.Reader in) {\n this.zzReader = in;\n }", "private RequestReceiver(BufferedReader reader, ObjectMapper mapper) {\n this.reader = reader;\n this.mapper = mapper;\n }", "public TextfileReader() throws IOException {\n getText();\n }", "public RawReader(/*int indexArg,*/ ImageLoadedNotified clientArg) {\n System.out.println(\"____Création RawReader\");\n client = clientArg;\n \n init_decode();\n }", "public TextConfigurationReader(Reader reader, int bufferSize) {\n\n super(reader, bufferSize);\n }", "public Yylex(java.io.Reader in) {\r\n this.zzReader = in;\r\n }", "Object create(Reader reader) throws IOException, SAXException, ParserConfigurationException;", "public SqlFileParser(InputStream stream) {\n this.reader = new BufferedReader(new InputStreamReader(stream));\n }", "public SCMLReader() {}", "public RawReader(final InputStream is) throws NullPointerException {\n\t\tthis(is, DEFAULT_BUFFER_SIZE);\n\t}", "public DleseCollectionDocReader() {\n\t}", "public Reading1(BufferedReader in, PrintStream out) { // agrego al constructor conversation\n\t\tthis.in = in;\n\t\tthis.out = out;\n\t}", "public Reader getReader()\n {\n return reader;\n }", "protected StreamParser()\n {\n }", "public ModemReader (InputStream inputStream) {\n\t\t\tthis.inputStream = inputStream;\n\t\t\tsetResultStrings (null);\n\t\t}", "public BuilderMapperStage(BufferedReader reader) {\n this.reader = reader;\n }", "public ReaderInputStream(Reader reader) {\n if (reader == null) {\n throw new IllegalArgumentException(\"reader must not be null\");\n }\n in = reader;\n }", "public TranslatorReader(WikiContext context, Reader in) {\n\t\tinitialize(context, in);\n\t}", "protected abstract Reader read() throws IOException;", "public CBS(java.io.Reader in) {\n this.yy_reader = in;\n }", "public FeedReaderContract() {}", "public FeedReaderContract() {}", "public FeedReaderContract() {}", "public FeedReaderContract() {}", "Yylex(java.io.Reader in) {\n this.zzReader = in;\n }", "Yylex(java.io.Reader in) {\n this.zzReader = in;\n }", "Yylex(java.io.Reader in) {\n this.zzReader = in;\n }", "Yylex(java.io.Reader in) {\n \n this.zzReader = in;\n }", "public Object getReaderCtor(String paramString) {\n }", "public IncludeReader(BufferedReader reader) {\n\t\treaders.push(reader);\n\t\trootUri = null;\n\t\tsetupIncludePath();\n\t}", "public abstract StatDataFileReader createReaderInstance(Object extension)\n throws IOException;", "private static CSVData getReader(){\n\t\tCSVData csv = null;\n\t\ttry {\n\t\t\tcsv = new CSVData();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn csv;\n\t}", "public Analizador_Lexico(java.io.Reader in) {\n this.zzReader = in;\n }", "@Override\n\tpublic void read() {\n\n\t}", "public ReaderException( String code ){ super(code); }", "public AnalisadorLexico(java.io.Reader in) {\n this.zzReader = in;\n }", "StreamReader underlyingReader();", "Constructor() {\r\n\t\t \r\n\t }", "private TemplateReader() {\n }", "@SneakyThrows\n public Reader reader() {\n return new FileReader(this.temp);\n }" ]
[ "0.8125266", "0.76559496", "0.73486865", "0.7308103", "0.7224894", "0.7118898", "0.70668215", "0.7044846", "0.7036676", "0.68548864", "0.68392926", "0.68376213", "0.67869186", "0.6776477", "0.6763913", "0.6709829", "0.66637105", "0.6603038", "0.65970546", "0.6594335", "0.6590356", "0.65843296", "0.6542806", "0.65365773", "0.6531587", "0.650935", "0.6455638", "0.64442134", "0.6441524", "0.6432743", "0.6420232", "0.64135575", "0.6391016", "0.63772196", "0.63596535", "0.6348236", "0.63382983", "0.63382983", "0.63382983", "0.63382983", "0.6326175", "0.6326175", "0.63202244", "0.6309791", "0.62863815", "0.62811506", "0.62807703", "0.6264069", "0.62529707", "0.62061787", "0.6201156", "0.6192292", "0.618472", "0.61832947", "0.61778855", "0.6175575", "0.6169712", "0.6162552", "0.6153456", "0.61354816", "0.6135365", "0.6134066", "0.61327344", "0.6122637", "0.61196935", "0.6119098", "0.6112271", "0.6110158", "0.61075574", "0.6104061", "0.61013275", "0.6101253", "0.60941464", "0.60884017", "0.6085997", "0.6066493", "0.60530174", "0.60505825", "0.60460526", "0.60444564", "0.60399497", "0.60399497", "0.60399497", "0.60399497", "0.6034958", "0.6034958", "0.6034958", "0.60253626", "0.6022564", "0.6011764", "0.6010499", "0.5998233", "0.5996872", "0.59959435", "0.5990967", "0.5987006", "0.5973091", "0.59720606", "0.5967302", "0.5966123" ]
0.64136887
31
This function reads instances from file
public ArrayList<Instance> read() throws IOException{ ArrayList<Instance> instances; instances = new ArrayList<>(); String s; String[] c; Instance i; while(reader.ready()){ s = getInstanceFromFile(); i = new Instance(); c = s.split(","); for(int j = 0; j < c.length - 1; j++) i.addFeature(Double.parseDouble(c[j])); // The last part of a line is the class label // See dataset that is used i.setClassification(c[c.length - 1]); instances.add(i); } return instances; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public InstanceReader(String filename) throws FileNotFoundException{\n this.reader = new FileReader(filename);\n }", "private String getInstanceFromFile() throws IOException{\n StringBuilder instance = new StringBuilder();\n boolean over = false;\n while(!over){\n char c = (char) reader.read();\n if(c == '\\n')\n over = true;\n else\n instance.append(c);\n }\n return instance.toString();\n }", "private void readFile(Scanner s, List<Instance> dest) throws FileNotFoundException {\n\t\t// first, read the training data into some storage location\n\t\twhile (s.hasNextLine()) {\n\t\t\tScanner line = new Scanner(s.nextLine());\n\t\t\tif (!line.hasNext()) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tString result = line.next();\n\t\t\tboolean[] attrs = new boolean[attributeNames.size()];\n\t\t\tfor (int i = 0; line.hasNext(); i++) {\n\t\t\t\tattrs[i] = line.nextBoolean();\n\t\t\t}\n\t\t\t// print\n//\t\t\tSystem.out.print(\"Example \"+result+\" with \");\n//\t\t\tfor (int j = 0; j < attrs.length; j++) {\n//\t\t\t\tSystem.out.print(attrs[j] +\"\\t\");\n//\t\t\t}\n//\t\t\tSystem.out.print(\"\\n\");\n\t\t\t// endprint\n\t\t\tInstance a = new Instance(result,attrs);\n\t\t\tdest.add(a); // finally, add our example\n\t\t\tline.close();\n\t\t}\n\t}", "public void readFromFile() {\n\n\t}", "public void readFromFile(){\n\t\ttry {\r\n\t\t\tFile f = new File(\"E:\\\\Study\\\\Course\\\\CSE215L\\\\Project\\\\src\\\\Railway.txt\");\r\n\t\t\tScanner s = new Scanner(f);\r\n\t\t\tpersons = new Person2 [50]; \r\n\t\t\tint i = 0;\r\n\t\t\t\r\n\t\t\twhile(s.hasNextLine()){\r\n\t\t\t\tString a = s.nextLine();\r\n\t\t\t\tString b = s.nextLine();\r\n\t\t\t\tString c = s.nextLine();\r\n\t\t\t\tString d = s.nextLine();\r\n\t\t\t\tString e = s.nextLine();\r\n\t\t\t\tString g = s.nextLine();\r\n\t\t\t\tString h = s.nextLine();\r\n\t\t\t\tString j = s.nextLine();\r\n\t\t\t\tPerson2 temp = new Person2 (a,b,c,d,e,g,h,j);\r\n\t\t\t\tpersons[i] = temp;\r\n\t\t\t\ti++;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t} catch (Exception e) {\r\n\t\t\tSystem.out.println(e.getMessage());\r\n\t\t}\r\n\t}", "@SuppressWarnings(\"unchecked\")\n\tprivate void readFromFile() throws IOException, ClassNotFoundException {\n\t\ttry {\n\t\t\tInputStream file = new FileInputStream(pathName);\n\n\t\t\tInputStream buffer = new BufferedInputStream(file);\n\n\t\t\tObjectInput input = new ObjectInputStream(buffer);\n\n\t\t\ttagToImg = (Map<String, HashSet<String>>) input.readObject();\n\n\t\t\tinput.close();\n\t\t\tfile.close();\n\t\t} catch (EOFException e) {\n\t\t\ttagToImg = new HashMap<String, HashSet<String>>();\n\t\t} catch (InvalidClassException e) {\n\t\t\tSystem.out.println(\"file doesnt match the type\");\n\t\t}\n\t}", "public void readFromFile() {\n FileInputStream fis = null;\n try {\n //reaad object\n fis = new FileInputStream(file);\n ObjectInputStream ois = new ObjectInputStream(fis);\n TravelAgent travelAgent = (TravelAgent)ois.readObject();\n travelGUI.setTravelAgent(travelAgent);\n ois.close();\n }\n catch (Exception e) {\n System.out.println(e.getMessage());\n if (fis != null) {\n try {\n fis.close();\n }\n catch (IOException e2) {\n System.out.println(e2.getMessage());\n }\n }\n return;\n }\n finally {\n if (fis != null) {\n try {\n fis.close();\n }\n catch (IOException e2) {\n System.out.println(e2.getMessage());\n }\n }\n }\n if (fis != null) {\n try {\n fis.close();\n }\n catch (IOException e2) {\n System.out.println(e2.getMessage());\n }\n }\n }", "private void readFromFile(String path) throws ClassNotFoundException {\n\t\ttry {\n\t\t\tInputStream file = new FileInputStream(path);\n\t\t\tInputStream buffer = new BufferedInputStream(file);\n\t\t\tObjectInput input = new ObjectInputStream(buffer);\n\n\t\t\ttagList = (HashMap<String, Integer>) input.readObject();\n\t\t\tinput.close();\n\t\t} catch (IOException ex) {\n\t\t\tSystem.out.println(\"Cannot read from input.\");\n\t\t}\n\t}", "public ClickerCounterModel[] readObjectFromFile() {\n\t\tStringBuilder sb = new StringBuilder();\n\t\ttry {\n\t\t\tFileInputStream inputStream = openFileInput(filename);\n\t\t\tInputStreamReader isr = new InputStreamReader(inputStream);\n\t\t\tBufferedReader bufferedReader = new BufferedReader(isr);\n\t\t\tString line;\n\t\t\twhile ((line = bufferedReader.readLine()) != null) {\n\t\t\t\tsb.append(line);\n\t\t\t}\n\t\t} catch (FileNotFoundException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\t// use Gson to convert it into and object\n\t\tString json = sb.toString();\n\t\tGson gson = new Gson();\n\t\tClickerCounterModel[] object = gson.fromJson(json,\n\t\t\t\tClickerCounterModel[].class);\n\t\treturn object;\n\t}", "public void readObjectDescription(String fileName) {\n Scanner in;\n try {\n in = new Scanner(new File(fileName));\n // Read the number of vertices\n numCtrlPoints = in.nextInt();\n controlPoints = new Point[numCtrlPoints];\n \n // Read the vertices\n for (int i = 0; i < numCtrlPoints; i++) {\n // Read a vertex\n int x = in.nextInt();\n int y = in.nextInt();\n //vertexArray[i] = new Point(x, y);\n controlPoints[i] = new Point(x, y);\n }\n } catch (FileNotFoundException e) {\n System.out.println(e);\n }\n\n }", "public void getInstances(String sf) throws IOException {\r\n\t\tDatabase db = new Database();\r\n\t\tthis.database = db.loadData(sf);\r\n\t}", "public static void trainingFile(String trainFile, List<Attribute> attributes, List<Instance>instances) {\n\t\tScanner fileScanner = null;\r\n\t\ttry {\r\n\t\t\tfileScanner = new Scanner(new File(trainFile));\r\n\t\t} catch(FileNotFoundException e) {\r\n\t\t\tSystem.err.println(\"Could not find file '\" + trainFile + \r\n\t\t\t\t\t\"'.\");\r\n\t\t\tSystem.exit(1);\r\n\t\t}\r\n\r\n\t\t// Iterate through each line in the file.\r\n\t\tint numOfAtts = -1;\r\n\t\twhile(fileScanner.hasNext()) {\r\n\t\t\tString line = fileScanner.nextLine().trim();\r\n\r\n\t\t\t// Skip blank lines.\r\n\t\t\tif(line.length() == 0) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\t// Use another scanner to parse each word from the line\r\n\t\t\tScanner lineScanner = new Scanner(line);\r\n\t\t\tif (!line.contains(\"//\")) {\r\n\t\t\t\tnumOfAtts = Integer.parseInt(lineScanner.next());\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tlineScanner.close();\r\n\t\t}\r\n\t\tString line = null;\r\n\t\twhile(fileScanner.hasNext()) {\r\n\t\t\tline = fileScanner.nextLine().trim();\r\n\t\t\tif(line.length() == 0) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tif (!line.contains(\"//\")) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\t\t\t\r\n\t\t}\r\n\t\tint count = 0;\r\n\t\t//while(fileScanner.hasNext()) {\r\n\t\twhile (count < numOfAtts) {\r\n\t\t\tif (line.contains(\"//\") || line.length() == 0) {\r\n\t\t\t\tline = fileScanner.nextLine().trim();\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tScanner lineScanner = new Scanner(line);\r\n\t\t\tList<String> values = new ArrayList<String>();\r\n\t\t\tString attName = lineScanner.next();\r\n\t\t\twhile (lineScanner.hasNext()) {\r\n\t\t\t\tString value = lineScanner.next();\r\n\t\t\t\tif(!value.equals(\"-\")) {\r\n\t\t\t\t\tvalues.add(value);\r\n\t\t\t\t}\t\t\t\t\r\n\t\t\t}\r\n\t\t\tAttribute att = new Attribute(attName,values);\r\n\t\t\tattributes.add(att);\r\n\t\t\tline = fileScanner.nextLine().trim();\r\n\t\t\tlineScanner.close();\r\n\t\t\tcount++;\r\n\t\t}\r\n\t\twhile(fileScanner.hasNext()) {\r\n\t\t\tif (line.contains(\"//\") || line.length() == 0) {\r\n\t\t\t\tline = fileScanner.nextLine().trim();\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t\tbreak;\r\n\t\t\t//line = fileScanner.nextLine().trim();\r\n\t\t}\r\n\t\tList<String> values = new ArrayList<String>();\r\n\t\twhile(fileScanner.hasNext()) {\r\n\t\t\tif (line.contains(\"//\"))\r\n\t\t\t\tbreak;\r\n\t\t\tif(line.length() == 0) {\r\n\t\t\t\tline = fileScanner.nextLine().trim();\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tScanner lineScanner = new Scanner(line);\r\n\t\t\tString label = lineScanner.next();\r\n\t\t\tvalues.add(label);\r\n\t\t\tline = fileScanner.nextLine().trim();\r\n\t\t\tlineScanner.close();\r\n\t\t}\r\n\t\tAttribute label = new Attribute (\"label\", values);\r\n\t\tattributes.add(label);\r\n\t\tint numOfInstances = -1;\r\n\t\twhile(fileScanner.hasNext()) {\r\n\t\t\tif(line.length() == 0) {\r\n\t\t\t\tline = fileScanner.nextLine().trim();\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tScanner lineScanner = new Scanner(line);\r\n\t\t\tif (!line.contains(\"//\")) {\r\n\t\t\t\tnumOfInstances = Integer.parseInt(lineScanner.next());\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tline = fileScanner.nextLine().trim();\r\n\t\t\tlineScanner.close();\r\n\t\t}\r\n\t\tint i = 0;\r\n\t\twhile(fileScanner.hasNext() && i < numOfInstances) {\r\n\t\t\tline = fileScanner.nextLine().trim();\r\n\t\t\tif(line.length() == 0 || line.contains(\"//\")) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tScanner lineScanner = new Scanner(line);\r\n\t\t\tList<String> features = new ArrayList<String>();\r\n\t\t\tString tmp = lineScanner.next();\r\n\t\t\tString instLabel = lineScanner.next();\r\n\t\t\twhile (lineScanner.hasNext()) {\r\n\t\t\t\tfeatures.add(lineScanner.next());\r\n\t\t\t}\r\n\t\t\tfeatures.add(instLabel);\r\n\t\t\tInstance instance = new Instance(numOfAtts,features);\r\n\t\t\tinstances.add(instance);\r\n\t\t\ti++;\r\n\t\t\tlineScanner.close();\r\n\t\t}\r\n\t\tfileScanner.close();\r\n\r\n\t}", "public Object readObject(File file, int format) throws IOException, FileNotFoundException;", "public void readIDs() {\n try {\n FileInputStream fileIn = new FileInputStream(\"temp/ids.ser\");\n ObjectInputStream in = new ObjectInputStream(fileIn);\n ids = (HashMap<String, Member>) in.readObject();\n in.close();\n fileIn.close();\n } catch (IOException e) {\n ids = new HashMap<>();\n } catch (ClassNotFoundException c) {\n System.out.println(\"Class HashMap not found\");\n c.printStackTrace();\n return;\n }\n\n }", "public static void main(String[] args) throws IOException, ClassNotFoundException {\n FileInputStream fis =new FileInputStream(\"test.txt\");\n BufferedInputStream bis=new BufferedInputStream(fis);\n ObjectInputStream ois=new ObjectInputStream(bis);\n ArrayList<Goods> list = (ArrayList<Goods>)ois.readObject();\n for (int i = 0; i < list.size(); i++) {\n Goods goods = list.get(i);\n System.out.println(goods);\n }\n\n // Goods goods= (Goods)ois.readObject();\n // System.out.println(goods);\n ois.close();\n\n }", "@Override\n public void parse() {\n if (file == null)\n throw new IllegalStateException(\n \"File cannot be null. Call setFile() before calling parse()\");\n\n if (parseComplete)\n throw new IllegalStateException(\"File has alredy been parsed.\");\n\n FSDataInputStream fis = null;\n BufferedReader br = null;\n\n try {\n fis = fs.open(file);\n br = new BufferedReader(new InputStreamReader(fis));\n\n // Go to our offset. DFS should take care of opening a block local file\n fis.seek(readOffset);\n records = new LinkedList<T>();\n\n LineReader ln = new LineReader(fis);\n Text line = new Text();\n long read = readOffset;\n\n if (readOffset != 0)\n read += ln.readLine(line);\n\n while (read < readLength) {\n int r = ln.readLine(line);\n if (r == 0)\n break;\n\n try {\n T record = clazz.newInstance();\n record.fromString(line.toString());\n records.add(record);\n } catch (Exception ex) {\n LOG.warn(\"Unable to instantiate the updateable record type\", ex);\n }\n read += r;\n }\n\n } catch (IOException ex) {\n LOG.error(\"Encountered an error while reading from file \" + file, ex);\n } finally {\n try {\n if (br != null)\n br.close();\n\n if (fis != null)\n fis.close();\n } catch (IOException ex) {\n LOG.error(\"Can't close file\", ex);\n }\n }\n\n LOG.debug(\"Read \" + records.size() + \" records\");\n }", "void readFromFile(String file)\n {\n try\n {\n employees.clear();\n FileReader inputFile = new FileReader(fileName);\n BufferedReader input = new BufferedReader(inputFile);\n String line = input.readLine();\n \n while(line != null)\n {\n Employee worker = new Employee();\n StringTokenizer stringParser = new StringTokenizer(line, \",\");\n while(stringParser.hasMoreElements())\n {\n worker.setName(stringParser.nextElement().toString());\n worker.setHours(Integer.parseInt(stringParser.nextElement().toString()));\n worker.setRate(Float.parseFloat(stringParser.nextElement().toString()));\n }\n employees.add(worker);\n line = input.readLine();\n }\n inputFile.close();\n }\n catch(FileNotFoundException e)\n {\n e.getStackTrace();\n }\n catch(IOException e)\n {\n e.getStackTrace();\n }\n }", "private void loadData(){\n try (BufferedReader br = new BufferedReader(new FileReader(this.fileName))) {\n String line;\n while((line=br.readLine())!=null){\n E e = createEntity(line);\n super.save(e);\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "private void readFile( String fileName ) throws FileNotFoundException\n\t{\n\t\ttry\n\t\t{\n\t\t\tFile train_file = new File( fileName );\n\t\t\tScanner in;\n\t\t\tin = new Scanner( train_file );\n\n\t\t\tString[] tokens = in.nextLine().trim().split( \"\\\\s+\" ); // Parse the file\n\t\t\tthis.attribute_list.add( new Attribute( 0, \"x0\" ) );\n\n\t\t\tint i = 1;\n\t\t\twhile ( i <= tokens.length )\n\t\t\t{\n\t\t\t\tthis.attribute_list.add( new Attribute( i, tokens[ i - 1 ] ) );\n\t\t\t\ti++;\n\t\t\t}\n\n\t\t\twhile ( in.hasNextLine() )\n\t\t\t{\n\t\t\t\ttokens = in.nextLine().trim().split( \"\\\\s+\" );\n\t\t\t\tif ( tokens.length > 1 )\n\t\t\t\t{\n\t\t\t\t\tthis.addTrainData( 0, 1 );\n\n\t\t\t\t\tfor ( i = 1; i < tokens.length; i++ )\n\t\t\t\t\t\tthis.addTrainData( i, Integer.parseInt( tokens[ i - 1 ] ) );\n\n\t\t\t\t\t// Last column would be the class attribute\n\t\t\t\t\tthis.class_data.add_data( Integer.parseInt( tokens[ i - 1 ] ) );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tin.close();\n\t\t}\n\t\tcatch ( FileNotFoundException e )\n\t\t{\n\t\t\tSystem.out.println( \"Cannot find train file - \" + fileName );\n\t\t\tthrow e;\n\t\t}\n\t}", "public Instances openARFF(String path)\n\t{\n\t\ttry\n\t\t{\n\t\t\tthis.dataset = new Instances(new BufferedReader(new FileReader(path)));\n\t\t}\n\t\tcatch(IOException ex)\n\t\t{\n\t\t\tSystem.out.println(ex);\n\t\t}\n\t\treturn this.dataset;\n\t}", "public void readUserFile (){\n try {\n FileReader reader = new FileReader(fileName);\n BufferedReader bufferedReader = new BufferedReader(reader);\n String line;\n while ((line = bufferedReader.readLine()) != null) {\n Scanner s = new Scanner(line); //use of a scanner to parse the line and assign its tokens to different variables\n//each line corresponds to the values of a User object\n while(s.hasNext()){\n String usrname = s.next();\n String pass = s.next();\n User u = new User(usrname,pass);\n userlist.add(u);//added to the list\n }\n \n }\n reader.close();\n \n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "public void loadVehicles() throws IOException {\n File veFile = new File(VE_FILE);\n\n //Checks is file created\n if (!veFile.exists()) {\n veFile.createNewFile(); //If not, creates new file\n System.out.print(\"The data file vehicles.txt is not exits. \" +\n \"Creating new data file vehicles.txt... \" +\n \"Done!\");\n this.numberOfVehicle = 0; //New data file with the number of Vehicle is 0\n } else {\n //If file is existed, so loading this data file\n System.out.print(\"The data file vehicles.txt is found. \" +\n \"Data of vehicles is loading...\");\n\n //Loads text file into buffer\n try (BufferedReader br = new BufferedReader(new FileReader(VE_FILE))) {\n String line, contractId, type, licensePlate, chassisId, enginesId;\n\n //Reads number of vehicles\n line = br.readLine();\n if (line == null) return;\n this.numberOfVehicle = Integer.parseInt(line);\n\n for (int i = 0; i < this.numberOfVehicle; i++) {\n //Reads Vehicle's information\n contractId = br.readLine();\n type = br.readLine();\n licensePlate = br.readLine();\n chassisId = br.readLine();\n enginesId = br.readLine();\n\n\n //Create new instance of Vehicle and adds to Vehicle bank\n this.vehicles.add(new Vehicle(Integer.parseInt(contractId), type, licensePlate, chassisId, enginesId));\n }\n }\n System.out.print(\"Done!\");\n }\n }", "@Override\n public void loadDataFromFile(File file) {\n Gson gson = new Gson();\n try {\n Scanner scanner = new Scanner(file);\n while (scanner.hasNextLine()){\n IndividualCustomer customer =\n gson.fromJson(scanner.nextLine(),IndividualCustomer.class);\n customerList.add(customer);\n }\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n\n }", "private void loadSpaceObjects(String file){\n\t\ttry{\n\t\t\tFileReader fr = new FileReader(file);\n\t\t\tBufferedReader br = new BufferedReader(fr);\n\t\t\tScanner sc = new Scanner(br);\n\t\t\t\n\t\t\tloadFactory(sc);\n\t\t\tloadPlanets(sc);\n\n\t\t\tsc.close();\n\t\t\tbr.close();\n\t\t\tfr.close();\n\t\t\t\t\n\t\t}catch(Exception e){\n\t\t\tSystem.out.println(\"File not found: SpaceProgramPlanets.txt\");\n\t\t}\n\t}", "private void loadFromFile() {\n try {\n FileInputStream fis = openFileInput(FILENAME);\n InputStreamReader isr = new InputStreamReader(fis);\n BufferedReader reader = new BufferedReader(isr);\n Gson gson = new Gson();\n Type listFeelingType = new TypeToken<ArrayList<Feeling>>(){}.getType();\n recordedFeelings.clear();\n ArrayList<Feeling> tmp = gson.fromJson(reader, listFeelingType);\n recordedFeelings.addAll(tmp);\n fis.close();\n\n } catch (FileNotFoundException e) {\n // TODO Auto-generated catch block\n recordedFeelings = new ArrayList<Feeling>();\n e.printStackTrace();\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }", "void loadExistingInstance(String filename)\n {\n iIncomingLobsFactory = new incomingLobsFactory();\n iIncomingLobsFactory.setPackageName(\"com.loadSample\");\n \n // Load the document\n iIncomingLobs = (incomingLobs) iIncomingLobsFactory.loadDocument(filename);\n printincomingLobs();\n }", "@Override\n public InstancesContainer readData(String path, String dataSpliter, String valueSpliter)\n {\n ArrayList<ArrayList<String>> data = readFile(path, dataSpliter);\n InstancesContainer instances = Factory.getInstanceContainer(1);\n instances.setPaths(data);\n return instances;\n }", "public void readFile() {\n try\n {\n tasksList.clear();\n\n FileInputStream file = new FileInputStream(\"./tasksList.txt\");\n ObjectInputStream in = new ObjectInputStream(file);\n\n boolean cont = true;\n while(cont){\n Task readTask = null;\n try {\n readTask = (Task)in.readObject();\n } catch (Exception e) {\n }\n if(readTask != null)\n tasksList.add(readTask);\n else\n cont = false;\n }\n\n if(tasksList.isEmpty()) System.out.println(\"There are no todos.\");\n in.close();\n file.close();\n }\n\n catch(IOException ex)\n {\n ex.printStackTrace();\n }\n }", "public GObject(String fileName) throws FileNotFoundException, IOException\n {\n\t BufferedReader reader = null;\n\t try \n\t {\n\t\t File file = new File(fileName); // Get file\n\t\t reader = new BufferedReader(new FileReader(file));\n\t\t \n\t\t int vertexSize = Integer.parseInt(reader.readLine().trim()); \n\t\t vertex = new Point3D [vertexSize];\n\t\t for(int i = 0 ; i < vertexSize ; i ++)\n\t\t {\n\t\t \t\tString [] vertexArray = reader.readLine().split(\" \");\n\t\t \t\tvertex[i] = new Point3D(Double.parseDouble(vertexArray[0]),Double.parseDouble(vertexArray[1]),Double.parseDouble(vertexArray[2]));\n\t\t }\n\t\t \n\t\t reader.readLine(); // Skip a line\n\t\t \n\t\t int faceSize = Integer.parseInt(reader.readLine().trim());\n\t\t face = new Face[faceSize];//Store the faces\n\t\t for(int i = 0 ; i < faceSize ; i++)\n\t\t {\n\t\t \t\tint number_of_faces = Integer.parseInt(reader.readLine().trim());\n\t\t \t\tSystem.out.println(number_of_faces);\n\t\t \t\tString [] index = (reader.readLine().split(\" \"));\n\t\t \t\t\n\t\t \t\tint [] index_v = new int [number_of_faces];\n\t\t \t\t\n\t\t \t\tfor(int j = 0 ; j < index.length; j++)\n\t\t \t\t{\n\t\t \t\t\tindex_v[j] = Integer.parseInt(index[j]);\n\t\t \t\t}\n\t\t \t\tString [] color = reader.readLine().split(\" \");\n\t\t \t\tColor color_v = new Color(Float.parseFloat(color[0]),Float.parseFloat(color[1]),Float.parseFloat(color[2])); // Get the colours\n\t\t \t\tface[i] = new Face(index_v,color_v);\n\t\t \t\tface[i].toString();\n\t\t } \n\t\t} catch (IOException e) \n\t\t{\n\t\t e.printStackTrace();\n\t\t} finally {\n\t\t try \n\t\t {\n\t\t reader.close();\n\t\t } catch (IOException e) \n\t\t {\n\t\t e.printStackTrace();\n\t\t }\n\t\t}\n }", "public ArrayList loadItems (String file) {\n ArrayList<Item> itemList = new ArrayList<>();\n\n File itemFile = new File(file);\n\n Scanner scanner = null;\n\n try{\n scanner = new Scanner(itemFile);\n\n } catch (FileNotFoundException e){\n e.printStackTrace();\n }\n\n while(scanner.hasNextLine()){\n String line = scanner.nextLine();\n String [] oneItem = line.split(\"=\");\n itemList.add(new Item(oneItem[0],Integer.parseInt(oneItem[1])));\n }\n\n\n return itemList;\n }", "public TagManager(String filePath) throws ClassNotFoundException, IOException {\n\t\ttagList = new HashMap<String, Integer>();\n\t\tselectedTags = new ArrayList<String>();\n\t\t// Reads serializable objects from file.\n\t\t// Populates the record list using stored data, if it exists.\n\t\tFile file = new File(filePath);\n\t\tif (file.exists()) {\n\t\t\treadFromFile(filePath);\n\t\t} else {\n\t\t\tfile.createNewFile();\n\t\t}\n\t}", "public static void main(String[] args) throws IOException, ClassNotFoundException {\n\n ObjectInputStream objectInputStream = new ObjectInputStream(new FileInputStream(new File(\"D:\\\\aaa.txt\")));\n User user = (User)objectInputStream.readObject();\n System.out.println(user);\n objectInputStream.close();\n }", "private void readRacesFromFile(String racesFileName) {\n\n DateTimeFormatter formatter = DateTimeFormatter.ofPattern(\"dd.MM.yyyy\");\n\n URL url = Thread.currentThread().getContextClassLoader()\n .getResource(racesFileName);\n try (Stream<String> stream = Files.lines(Paths.get(url.getPath()))) {\n stream\n .skip(1)\n .map(s -> s.split(\";\"))\n .map(a -> new Race(Long.parseLong(a[0]), a[1], LocalDate.parse(a[2], formatter)))\n //.forEach(System.out::println);\n .forEach(em::persist);\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n }", "private void readFields() throws IOException, ClassFormatException {\n final int fields_count = dataInputStream.readUnsignedShort();\n fields = new Field[fields_count];\n for (int i = 0; i < fields_count; i++) {\n fields[i] = new Field(dataInputStream, constant_pool);\n }\n }", "public TreeNode readDataFile() {\n\t\tdata = new ArrayList<Instance>();\n\t\ttry {\n\t\t\tScanner s = new Scanner(new File(testFile));\n\t\t\t// took these lines from helper-code\n\t\t\tScanner l = new Scanner(s.nextLine());\n\t\t\tfor (int i = 0; l.hasNext(); i++) {\n\t\t\t\tif (!l.next().equals(classifierNames.get(i))) {\n\t\t\t\t\tSystem.err.println(\"This data file does not use the same category names as the training file.\");\n\t\t\t\t\tSystem.exit(-1);\n\t\t\t\t}\n\t\t\t}\n\t\t\tl.close();\n\t\t\tl = new Scanner(s.nextLine());\n\t\t\tfor (int i = 0; l.hasNext(); i++) {\n\t\t\t\tif (!l.next().equals(attributeNames.get(i))) {\n\t\t\t\t\tSystem.err.println(\"This data file does not match the attributes of the training file.\");\n\t\t\t\t\tSystem.exit(-1);\n\t\t\t\t}\n\t\t\t}\n\t\t\tl.close();\n\t\t\tSystem.out.println(\"Read attributes \"+attributeNames.toString()+\".\");\n\t\t\treadFile(s,data);\n\t\t\ts.close();\n\t\t} catch (FileNotFoundException e) {\n\t\t\tSystem.err.println(\"Training file not found, you should have put tests for this in main.\");\n\t\t\tSystem.err.println(\"Attempted to read \"+testFile+\".\");\n\t\t\tSystem.exit(-1);\n\t\t}\n\t\tArrayList<Boolean> attrs = new ArrayList<Boolean>();\n\t\tfor (int i = 0; i < attributeNames.size(); i++) {\n\t\t\tattrs.add(false);\n\t\t}\n\t\tTreeNode root = BuildTree(instances, attrs);\n\t\treturn root;\n\t}", "private void readFromFile(String filename) {\n\t\ttry {\n\t\t Scanner read = new Scanner(new File(filename));\n\t\t String line;\n\t\t int counter = 0;\n\t\t String temp;\n\t\t line = read.nextLine();\n\t\t temp = line.substring(0);\n\t\t height = convertToInt(temp);\n\n\t\t line = read.nextLine();\n\t\t temp = line.substring(0);\n\n\t\t length = convertToInt(temp);\n\t\t size = height*length;\n\t\t \n\t\t squares = new Square[size][size];\n\n\t\t while(read.hasNextLine()) {\n\t\t\t\tline = read.nextLine();\n\t\t \tfor (int i = 0; i < line.length(); i++) {\n\t\t \t temp = line.substring(i, i+1);\n\n\t\t \t if (temp.equals(\".\")) {\n\t\t \t\t\tsquares[counter][i] = new FindValue(0);\n\t\t \t } \n\t\t \t else {\n\t\t\t\t\t\tsquares[counter][i] = new PreFilled(convertToInt(temp));\n\t\t\t \t\t}\n\t\t \t}\n\t\t \tcounter++;\n\t\t }\n\t\t} catch(IOException e) {\n\t\t e.printStackTrace();\n\t\t}\n }", "private void loadFromFile(){\n try {\n FileInputStream fis = openFileInput(FILENAME);\n BufferedReader in = new BufferedReader(new InputStreamReader(fis));\n Gson gson = new Gson();\n Type listType = new TypeToken<ArrayList<Countbook>>() {}.getType();\n countbookList = gson.fromJson(in, listType);\n } catch (FileNotFoundException e) {\n countbookList = new ArrayList<Countbook>();\n }\n }", "public static void readFile(File f){\n\t\tFileInputStream fis = null;\n\t\tObjectInputStream ois = null;\n\t\ttry{\n\t\t\tPage page = null;\n\t\t\tfis = new FileInputStream(f);\n\t\t\tois = new ObjectInputStream(fis);\n\t\t\twhile(true){\n\t\t\t\ttry{\n\t\t\t\t\tObject obj = ois.readObject();\n\t\t\t\t\tpage = (Page)obj;\n\t\t\t\t\theap.add(page);\n\t\t\t\t\t//System.out.println(page.getBuildings());\n\t\t\t\t\tsearch();\n\t\t\t\t\theap.remove(page);\n\t\t\t\t}\n\t\t\t\tcatch(EOFException eoe){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcatch(FileNotFoundException fnf){\n\t\t\tSystem.out.println(fnf.getMessage());\n\t\t\tSystem.out.println(\"Terminating Program\");\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tcatch(ClassNotFoundException cnf){\n\t\t\tcnf.printStackTrace();\n\t\t}\n\t\tcatch(IOException e){\n\t\t\te.printStackTrace();\n\t\t}\n\t\tfinally{\n\t\t\ttry{\n\t\t\t\tfis.close();\n\t\t\t\tois.close();\n\t\t\t}\n\t\t\tcatch(Exception ee){\n\t\t\t}\n\t\t}\n\t}", "private void loadFromFile() {\n try {\n /* Load in the data from the file */\n FileInputStream fIn = openFileInput(FILENAME);\n BufferedReader inRead = new BufferedReader(new InputStreamReader(fIn));\n\n /*\n * access from the GSON file\n * Taken from lonelyTwitter lab code\n */\n Gson gson = new Gson();\n Type listType = new TypeToken<ArrayList<Counter>>() {}.getType();\n counters = gson.fromJson(inRead, listType);\n\n } catch (FileNotFoundException e) {\n counters = new ArrayList<Counter>();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }", "@Override\n public void load() {\n File file = new File(path + \"/\" + \"rooms.txt\"); //Hold file of the riddles. riddles.txt should be placed in the root folder.\n Scanner scanner = null; //if the scanner can't load the file.\n\n try {\n scanner = new Scanner(file); // scanner for the file\n } catch (FileNotFoundException ex) {\n try {\n //if not such file exists create it.\n file.createNewFile();\n } catch (IOException ex1) {\n Logger.getLogger(LoadRooms.class.getName()).log(Level.SEVERE, null, ex1);\n return;\n }\n }\n while (scanner.hasNextLine()) { //if scanner har fundt next line of text in the file\n switch (scanner.nextLine()) {\n case \"[Room]:\": //if scanner fundt \"[Room]:\" case, get rooms attributes\n state = LOAD_ATTRIBUTES;\n break;\n case \"[Connections]:\"://if scanner fundt \"[Connections]:\" case, get connections from file\n state = LOAD_CONNECTIONS;\n break;\n\n default:\n break;\n }\n switch (state) {\n case LOAD_ATTRIBUTES: //case, that get rooms attributes and add them to room_list\n String name = scanner.nextLine();\n int timeToTravel = Integer.parseInt(scanner.nextLine());\n boolean isLocked = Boolean.parseBoolean(scanner.nextLine());\n boolean isTransportRoom = Boolean.parseBoolean(scanner.nextLine());\n Room newRoom = new Room(name, timeToTravel, isLocked, isTransportRoom);\n if (newRoom.isTransportRoom()) {\n newRoom.setExit(\"exit\", newRoom);\n newRoom.setExitDir(\"west\", newRoom);\n }\n rooms_list.add(newRoom);\n break;\n case LOAD_CONNECTIONS: //case that get connections betweem rooms in game\n while (scanner.hasNextLine()) {\n String[] string = scanner.nextLine().split(\",\");\n Room room = this.getRoomByName(string[0]);\n room.setExit(string[1], this.getRoomByName(string[1]));\n if (!this.getRoomByName(string[1]).isTransportRoom() && !room.isTransportRoom()) {\n room.setExitDir(string[2], getRoomByName(string[1]));\n }\n }\n break;\n default:\n break;\n }\n }\n }", "public ObjReader(String filename){\n file = filename;\n }", "private void loadFromFile() {\n\t\ttry {\n\t\t\tFileInputStream fis = openFileInput(FILENAME);\n\t\t\tBufferedReader in = new BufferedReader(new InputStreamReader(fis));\n\t\t\tString line = in.readLine();\n\t\t\tGson gson = new Gson();\n\t\t\twhile (line != null) {\n\t\t\t\tCounterModel counter = gson.fromJson(line, CounterModel.class);\n\t\t\t\tif (counterModel.getCounterName().equals(counter.getCounterName())) {\n\t\t\t\t\tcounterListModel.addCounterToList(counterModel);\n\t\t\t\t\tcurrentCountTextView.setText(Integer.toString(counterModel.getCount()));\n\t\t\t\t} else {\n\t\t\t\t\tcounterListModel.addCounterToList(counter);\n\t\t\t\t}\n\t\t\t\tline = in.readLine();\n\t\t\t} \n\t\t\tfis.close();\n\t\t} catch (FileNotFoundException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "static Schedules load(String fileName) throws RBEConfigObjectException\n {\n\n try\n {\n FileReader fis = new FileReader(fileName);\n\t\t return new Schedules(fis);\n } catch (Exception ioe) {\n throw new RBEConfigObjectException(ioe.toString());\n }\n }", "public static Object readObjectFromFile(String filename)\n/* */ throws IOException, ClassNotFoundException\n/* */ {\n/* 122 */ return readObjectFromFile(new File(filename));\n/* */ }", "private void createArctic(BufferedReader in) {\n try {\n String tempRegionName = in.readLine();\n int maxStaff = Integer.parseInt(in.readLine());\n int numStaff = Integer.parseInt(in.readLine());\n \n Staff[] readStaffList = new Staff[maxStaff]; //creating a local array of Staff; later to be fed as a field to the constructor \n for (int i = 0; i < numStaff; i++) {\n int id = Integer.parseInt(in.readLine());\n //readStaffList[i] = this.searchStaffTemp(id);\n readStaffList[i] = findStaff(id, 0, this.numStaff); //id is the same thing as staffNum in the staff class \n //creates an array of initialized staff objects by searching \n //using the staffNum read from the file\n }\n \n int maxAnimals = Integer.parseInt(in.readLine());\n int numAnimals = Integer.parseInt(in.readLine());\n \n Animal[] animals = new Animal[numAnimals]; //creating a local array of Animals;\n for (int i = 0; i < numAnimals; i++) {\n animals[i] = new Animal(in.readLine(), Integer.parseInt(in.readLine()));\n }\n \n regionList[this.numRegions] = new Arctic(readStaffList, animals, tempRegionName, new RegionSpec(numStaff, maxStaff, numAnimals, maxAnimals, Integer.parseInt(in.readLine()), Double.parseDouble(in.readLine())), \n Integer.parseInt(in.readLine()), Double.parseDouble(in.readLine()), Double.parseDouble(in.readLine()), Boolean.parseBoolean(in.readLine()));\n //constructor call \n } catch (IOException iox) {\n System.out.println(\"Error reading file\");\n }\n this.numRegions++; //updates the global field numRegions\n }", "public static ArrayList<Player> readPlayersFromFile() \r\n {\r\n //Inisialize Arraylist \r\n ArrayList<Player> players = new ArrayList<Player>();\r\n //Inisialize FileInputStream\r\n FileInputStream fileIn = null;\r\n\r\n try \r\n {\r\n //Establish connection to file \r\n fileIn = new FileInputStream(\"players.txt\");\r\n while (true) \r\n {\r\n //Create an ObjectOutputStream \r\n ObjectInputStream objectIn = new ObjectInputStream(fileIn);\r\n //Read a Player object from the file and add it to the ArrayList\r\n players.add((Player)objectIn.readObject());\r\n }//end while\r\n\r\n }\r\n catch (Exception e)\r\n {\r\n //System.out.println(e);\r\n }\r\n finally \r\n {\r\n usernamesTaken.clear();\r\n\r\n for(int i = 0; i < players.size(); i++)\r\n {\r\n usernamesTaken.add(players.get(i).getUsername());\r\n }//end for\r\n\r\n //Try to close the file and return the ArrayList\r\n try\r\n {\r\n //Check if the end of the file is reached\r\n if (fileIn != null)\r\n { \r\n //Close the file \r\n fileIn.close();\r\n //Return the ArrayList of players\r\n return players;\r\n }\r\n }\r\n catch (Exception e)\r\n {\r\n //System.out.println(e)\r\n }//end try \r\n\r\n //Return null if there is an excetion \r\n return null;\r\n }//end try \r\n }", "@Override\n\tpublic boolean readFile(String filename) {\n\t\ttry {\n\t\t\tScanner input = new Scanner(new File(filename));\n\t\t\tString row = input.nextLine();\n\t\t\tString[] sarr = row.split(\",\");\n\t\t\tString ingredientsWatch = \"\";\n\t\t\t// Gets the String type of ingredients to watch\n\t\t\t// Identify the gender and create the Female or Male object\n\t\t\tif (sarr[0].equals(\"Female\")) {\n\t\t\t\tStringBuilder sBuilder =new StringBuilder();\n\t\t\t\tfor(int j =5;j<sarr.length-1;j++) {\n\t\t\t\t\tsBuilder=sBuilder.append(sarr[j].trim()+\",\");\t\n\t\t\t\t}\n\t\t\t\tsBuilder=sBuilder.append(sarr[sarr.length-1]);\n\t\t\t\tingredientsWatch = sBuilder.toString();\n\t\t\t\tFemale female=new Female(Float.parseFloat(sarr[1]), Float.parseFloat(sarr[2]), \n\t\t\t\t\t\tFloat.parseFloat(sarr[3]), Float.parseFloat(sarr[4]), ingredientsWatch);\n\t\t\t\tNutriByte.person=female;\n\t\t\t}else {\n\t\t\t\tStringBuilder sBuilder =new StringBuilder();\n\t\t\t\tfor(int j =5;j<sarr.length-1;j++) {\t\n\t\t\t\t\tsBuilder=sBuilder.append(sarr[j].trim()+\",\");\n\t\t\t\t}\n\t\t\t\tsBuilder=sBuilder.append(sarr[sarr.length-1]);\n\t\t\t\tingredientsWatch = sBuilder.toString();\n\t\t\t\t// Creates the object using its constructor\n\t\t\t\tMale male=new Male(Float.parseFloat(sarr[1]), Float.parseFloat(sarr[2]), \n\t\t\t\t\t\tFloat.parseFloat(sarr[3]), Float.parseFloat(sarr[4]), ingredientsWatch);\n\t\t\t\tNutriByte.person=male;\n\t\t\t\tinput.close();\n\t\t\t}\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t\treturn false;\n\t\t}\t\n\t\treturn true;\n\t}", "private void readFile() {\r\n\t\tcsvEntrys = new ArrayList<>();\r\n\t\tString line = \"\";\r\n\t\ttry (BufferedReader br = new BufferedReader(new FileReader(new File(filepath)))) {\r\n\t\t\twhile ((line = br.readLine()) != null) {\r\n\t\t\t\tif (!line.contains(\"id\")) {\r\n\t\t\t\t\tcsvEntrys.add(line);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public void readData() throws FileNotFoundException {\n this.plane = readPlaneDimensions();\n this.groupBookingsList = readBookingsList();\n }", "public void fileReadGameHistory(String filename)\n {\n \t//ArrayList<GameObject> gameObject = new ArrayList<>();\n\t\tFileReader file = null;\n\t\ttry {\n\t\t\tfile = new FileReader(filename);\n\t\t} catch (FileNotFoundException e) {\n\n\t\t\te.printStackTrace();\n\t\t}\n\t\tSystem.out.println(filename);\n\t\tBufferedReader br = new BufferedReader(file);\n\t\tString s = \"\";\n\t\ttry\n\t\t{\n\t\t\twhile((s = br.readLine()) != null )\n\t\t\t{\n\t\t\t\tString[] prop1 = s.split(\"#\");\n\t\t\t\tSystem.out.println(prop1[0] + \" fgdfsgfds \" + prop1[1]);\n\t\t\t\tString indexOfList = prop1[0];\n\t\t\t\tString[] prop2 = prop1[1].split(\",\");\n\t\t\t\tString[] prop3;\n\t\t\t\tString[] prop4 = indexOfList.split(\";\");\n\t\t\t\t//gameObject.add(new GameObject(indexOfList));\n\t\t\t\tcount = count +1;\n\t\t\t\texistCount = existCount + 1;\n\t\t\t\tif (indexOfList.charAt(0) == 's')//when this line is data of a swimming game\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(prop4[0]);\n\t\t\t\t\tgames.add(new Swimming(prop4[1],\"Swimming\",prop4[0]));\n\t\t\t\t\tfor(int i = 0; i < Array.getLength(prop2); i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tprop3 = prop2[i].split(\":\");\n\t\t\t\t\t\tgames.get(count - 1).addParticipant(prop3[0], Integer.parseInt(prop3[1]), 0);\n//\t\t\t\t\t\tgames.get(count-1).getResults().get(i).setId(prop3[0]);\n//\t\t\t\t\t\tgames.get(count-1).getResults().get(i).setRe(Integer.parseInt(prop3[1]));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (indexOfList.charAt(0) == 'c')//when this line is data of a cycling game\n\t\t\t\t{\n\t\t\t\t\tgames.add(new Cycling(prop4[1],\"Cycling\",prop4[0]));\n\t\t\t\t\tfor(int i = 0; i < Array.getLength(prop2); i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tprop3 = prop2[i].split(\":\");\n\t\t\t\t\t\tgames.get(count - 1).addParticipant(prop3[0], Integer.parseInt(prop3[1]), 0);\n//\t\t\t\t\t\tgames.get(count-1).getResults().get(i).setId(prop3[0]);\n//\t\t\t\t\t\tgames.get(count-1).getResults().get(i).setRe(Integer.parseInt(prop3[1]));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (indexOfList.charAt(0) == 'r')//when this line is data of a running game\n\t\t\t\t{\n\t\t\t\t\tgames.add(new Running(prop4[1],\"Running\",prop4[0]));\n\t\t\t\t\tfor(int i = 0; i < Array.getLength(prop2); i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tprop3 = prop2[i].split(\":\");\n\t\t\t\t\t\tgames.get(count - 1).addParticipant(prop3[0], Integer.parseInt(prop3[1]), 0);\n//\t\t\t\t\t\tgames.get(count-1).getResults().get(i).setId(prop3[0]);\n//\t\t\t\t\t\tgames.get(count-1).getResults().get(i).setRe(Integer.parseInt(prop3[1]));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}catch (NumberFormatException | IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n }", "private void readFromFile() {\n\t\tPath filePath = Paths.get(inputFile);\n\n\t\ttry (BufferedReader reader = Files.newBufferedReader(filePath,\n\t\t\t\tCharset.forName(\"UTF-8\"));) {\n\t\t\tString line = null;\n\n\t\t\twhile ((line = reader.readLine()) != null) {\n\t\t\t\tString[] splitLine = line.split(\",\");\n\t\t\t\tcurrentGen.setValue(Integer.parseInt(splitLine[0]),\n\t\t\t\t\t\tInteger.parseInt(splitLine[1]), true);\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\tSystem.out.println(\"Could not find file provided.\");\n\t\t}\n\t}", "public static void readInstances(ArrayList<MISPData> data, String path_folder) throws IOException {\n\t\tfinal File folder = new File(path_folder);\r\n\t\tfor (final File fileEntry : folder.listFiles()) {//recorre los files de la carpeta folder\r\n\t\t\tif (fileEntry.isDirectory()) {\r\n\t\t\t\treadInstances(data, fileEntry.getPath());\r\n\t\t\t} else {\r\n\t\t\t\tSystem.out.print(\"-\");\r\n\t\t\t\t//System.out.println(\"Leyendo: \" + fileEntry.getName());\r\n\t\t\t\tMISPData mispd = new MISPData();//Declara una nueva variable MISPData, con atributos vacios\r\n\t\t\t\treadFile(mispd.getInstance(), fileEntry.getPath());//metodo readFile, recibe un parametro instancia vacio y el nombre del file correspondiente a una instancia a leer \r\n\t\t\t\t//mispd.instance.getIndependenSet().Print_ListAdya();//Imprime por consola la lista enlazada\r\n\t\t\t\tdata.add(mispd);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public ObjModel(File file) throws FileNotFoundException {\r\n\r\n\t\tvertices = new ArrayList<>();\r\n\t\ttextureCoordinates = new ArrayList<>();\r\n\t\tfaces = new ArrayList<>();\r\n\r\n\t\tScanner scanner = new Scanner(file);\r\n\r\n\t\twhile (scanner.hasNextLine()) {\r\n\t\t\tString[] line = scanner.nextLine().split(\" \");\r\n\t\t\tif (line[0].equals(\"v\")) {\r\n\t\t\t\tfloat x = Float.parseFloat(line[1]);\r\n\t\t\t\tfloat y = Float.parseFloat(line[2]);\r\n\t\t\t\tfloat z = Float.parseFloat(line[3]);\r\n\t\t\t\tvertices.add(new Vector3f(x, y, z));\r\n\t\t\t} else if (line[0].equals(\"vt\")) {\r\n\t\t\t\tfloat x = Float.parseFloat(line[1]);\r\n\t\t\t\tfloat y = Float.parseFloat(line[2]);\r\n\t\t\t\ttextureCoordinates.add(new Vector3f(x, y));\r\n\t\t\t} else if (line[0].equals(\"f\")) {\r\n\t\t\t\tFace face = new Face();\r\n\t\t\t\tfor (int i = 1; i < line.length; i++) {\r\n\t\t\t\t\tString[] sections = line[i].split(\"/\");\r\n\t\t\t\t\tif (sections.length >= 1) {\r\n\t\t\t\t\t\tint vertex = Integer.parseInt(sections[0]);\r\n\t\t\t\t\t\tface.addVertex(vertex);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (sections.length >= 2) {\r\n\t\t\t\t\t\tint textureCoordinate = Integer.parseInt(sections[1]);\r\n\t\t\t\t\t\tface.addTextureCoordinate(textureCoordinate);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tfaces.add(face);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tscanner.close();\r\n\t}", "public Serializable readObject(){\n Serializable loadedObject = null;\n try {\n FileInputStream fileIn = new FileInputStream(name);\n ObjectInputStream in = new ObjectInputStream(fileIn);\n loadedObject = (Serializable) in.readObject();\n in.close();\n fileIn.close();\n System.out.println(\"Data loaded from: \"+ name);\n } \n catch (IOException i) {\n System.out.println(\"File not found.\");\n } \n catch (ClassNotFoundException c) {\n System.out.println(\"Class not found\");\n }\n return loadedObject;\n }", "public abstract List<T> readObj(String path);", "public Roster(String fileName){\n players = new ArrayList<>();\n try {\n Scanner input = new Scanner(new File(fileName));\n\n // Loop will cycle through all the \"words\" in the text file\n while (input.hasNext()){\n // Concatenates the first and last names\n String name = input.next();\n name += \" \" + input.next();\n double attackStat = input.nextDouble();\n double blockStat = input.nextDouble();\n // Creates a new Player object and stores it in the players ArrayList\n players.add(new Player(name, attackStat, blockStat));\n }\n }\n catch (IOException e) {\n System.out.println(\"IO Exception \" + e);\n }\n\n }", "@PostConstruct\n private void loadFiles() {\n \n\n File dir = new File(Constants.DIR_PATH);\n File[] files = dir.listFiles(); //stores list of files in given paths\n String line=\"\";\n\n for(File file : files){\n try {\n br = new BufferedReader(new FileReader(file));\n br.readLine();\n while((line=br.readLine())!=null){\n\n String []token=line.split(Constants.DELIMETER);\n String fileName=file.getName().toUpperCase();\n\n FlightData newflight = new FlightData(fileName.substring(0,fileName.lastIndexOf(\".\")),token[0],token[1],token[2],token[3],token[4],token[5],Double.parseDouble(token[6]),token[7],token[8]);\n flightDataDao.insertFlightData(newflight);\n }\n\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n }", "void fileReader(String filename) \r\n\t\t{\r\n\r\n\t\ttry (Scanner s = new Scanner(new FileReader(filename))) { \r\n\t\t while (s.hasNext()) { \r\n\t\t \tString name = s.nextLine(); // read name untill space\r\n\t\t \tString str[] = name.split(\",\");\r\n\t\t \tString nam = str[0]; \r\n\t\t \tint number = Integer.parseInt(str[1]); // read number untill space\r\n\t\t this.addContact(nam, number);\r\n\t\t\r\n\t\t }\t\t \r\n\t\t \r\n\t\t} \r\n\t\tcatch (IOException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\t}", "private void loadFromFile() {\n try {\n FileInputStream fis = openFileInput(FILENAME);\n BufferedReader in = new BufferedReader(new InputStreamReader(fis));\n\n Gson gson = new Gson();\n Type listType = new TypeToken<ArrayList<Sub>>(){}.getType();\n subList = gson.fromJson(in, listType);\n\n } catch (FileNotFoundException e) {\n subList = new ArrayList<Sub>();\n }\n }", "public static void processFile(File f) throws Exception {\n\t\ttry {\r\n\t\t\tBufferedReader bufRead = new BufferedReader(new InputStreamReader(\r\n\t\t\t\t\tnew FileInputStream(f)));\r\n\t\t\tString S1 = \"\";\r\n\t\t\twhile ((S1 = bufRead.readLine()) != null) {\r\n\t\t\t\t//System.out.println(S1);\r\n\t\t\t\tgetPubTypes(S1);\r\n\t\t\t\t//System.out.println();\r\n\t\t\t}\r\n\t\t\tbufRead.close();\r\n\t\t} catch (IOException ioe) {\r\n\t\t\tSystem.out.println(\"Something is wrong with reading file! \"\r\n\t\t\t\t\t+ \"Can't find the appropriate file!\");\r\n\t\t}\r\n\r\n\t\t// return allDiseases;\r\n\r\n\t}", "public Account load() throws IOException {\n Account account = new Account();\n try {\n FileReader fileReader = new FileReader(fileName);\n BufferedReader bufferedReader = new BufferedReader(fileReader);\n String line;\n while ((line = bufferedReader.readLine()) != null) {\n //if (line.contains(\"#\")) { continue; }\n String[] info = line.split(\" @ \");\n\n switch (info[0]) {\n case \"INIT\":\n account.setToInitialize(Boolean.parseBoolean(info[1]));\n break;\n case \"BS\":\n account.setBaseSavings(Float.parseFloat((info[1])));\n break;\n case \"INC\":\n parseIncome(info, account);\n break;\n case \"EXP\":\n parseExpenditure(info, account);\n break;\n case \"G\":\n parseGoal(info, account);\n break;\n case \"INS\":\n parseInstalment(info, account);\n break;\n case \"LOA\":\n parseLoan(info, account);\n break;\n case \"BAN\":\n parseBankAccount(info, account);\n break;\n default:\n throw new DukeException(\"OOPS!! Your file has been corrupted/ input file is invalid!\");\n }\n }\n bufferedReader.close();\n } catch (FileNotFoundException err) {\n final File parentDir = new File(\"dataFG\");\n parentDir.mkdir();\n final String hash = \"moneyAccount\";\n final String fileName = hash + \".txt\";\n final File file = new File(parentDir, fileName);\n file.createNewFile();\n } catch (IOException | DateTimeParseException | DukeException e) {\n e.printStackTrace();\n }\n return account;\n }", "TraceList read(File file) throws IOException;", "public static Instances ReadDataset(String path, int class_idx) throws IOException{\n\t\tInstances data = null;\n\t\ttry {\n\t\t\tArffLoader loader = new ArffLoader();\n\t\t\tloader.setSource(new File(path));\n\t\t\tdata = loader.getDataSet();\n\t\t\tif (class_idx ==0)\n\t\t\t\tdata.setClassIndex(class_idx);\n\t\t\telse\n\t\t\t\tdata.setClassIndex(data.numAttributes()-1);\n\t\t} catch (Exception e) {//Catch exception if any\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn data;\n\t}", "private ArrayList<Book> readBookCollection() {\n File file = new File(\"books.txt\");\n ArrayList<Book> collection = new ArrayList<Book>();\n try {\n FileReader fileReader = new FileReader(file);\n BufferedReader reader = new BufferedReader(fileReader);\n while (true) {\n String line = reader.readLine();\n if (line == null) break;\n line = line.trim();\n if (line.equals(\"\")) continue; // ignore possible blank lines\n String[] bookInfo = line.split(\" :: \");\n collection.add(new Book(bookInfo[0], bookInfo[1]));\n }\n }\n catch (IOException e) {\n System.out.println(e.getMessage());\n }\n return collection;\n }", "@SuppressWarnings(\"unchecked\")\n\tpublic static List<Transaction> readObject(String filename){\n\n\t\tlogger.finer(\" Reading object (Deserializtion) used\");\n\t\tList<Transaction> transactionList = null;\n\n\t\ttry(ObjectInputStream ois = new ObjectInputStream(new FileInputStream(filename))){\n\t\t\ttransactionList = (List<Transaction>)ois.readObject();\n\t\t}\n\t\tcatch(IOException | ClassNotFoundException ioe){\n\n\t\t\tSystem.out.println(\"Exception occurred during deserialization\");\n\t\t} \n\n\t\t//\t\tpresentFileContents(transactionList);\n\n\t\treturn (List<Transaction>) transactionList;\n\t}", "private List<Task> readFromFile() {\n if (file.exists()) {\n try {\n return objectmapper.readValue(file,TaskList.class);\n } catch (IOException e) {\n throw new IllegalStateException(e);\n }\n } else {\n return new ArrayList<>();\n }\n }", "public void loadPlayers(String filename) throws IOException {\r\n //TODO:4\r\n // 1. use try-with-resources syntax to ensure the file is closed\r\n // 2. read the number of players, then read an empty line\r\n // 3. for each player:\r\n // 3.1 read playerName, gold, sciencePoint, productionPoint, numCities and numMinisters separated by blank characters.\r\n // 3.2 create a player of corresponding values\r\n // 3.3 for (int i=1; i<numCities; i++):\r\n // read population, troops, cropYields\r\n // create a corresponding city object and add to the player's city list\r\n // 3.4 for (int i=1; i<numMinisters; i++):\r\n // read type, intelligence, experience, leadership\r\n // use switch-case to create a corresponding minister object and add to the player's minister list\r\n // check for invalid formats and throw custom exceptions.\r\n // (When there is any invalid minister type, throw InvalidMinisterTypeException.\r\n // Only \"WarGeneral\", \"Scientist\" and \"Economist\" are allowed.)\r\n // 3.5 add the player to the ArrayList<Player> players\r\n // Hint: use add() method of ArrayList.\r\n players = new ArrayList<>();\r\n File inputFile = new File(filename);\r\n try(\r\n Scanner reader = new Scanner(inputFile);\r\n ) {\r\n int numOfPlayers = reader.nextInt();\r\n String line = \"\";\r\n for (int i = 0; i < numOfPlayers; i++) {\r\n String name = reader.next();\r\n int gold = reader.nextInt();\r\n int sciencePoint = reader.nextInt();\r\n int productionPoint = reader.nextInt();\r\n Player newPlayer = new Player(name, gold, sciencePoint, productionPoint);\r\n this.players.add(newPlayer);\r\n\r\n int numOfCity = reader.nextInt();\r\n int numOfMin = reader.nextInt();\r\n\r\n for (int j = 0; j < numOfCity; j++) {\r\n int cityID = reader.nextInt();\r\n String cName = reader.next();\r\n int pop = reader.nextInt();\r\n int troops = reader.nextInt();\r\n int cropYields= reader.nextInt();\r\n\r\n City temp = new City(cityID, cName, pop, troops, cropYields);\r\n this.players.get(i).getCities().add(temp);\r\n }\r\n\r\n for (int j = 0; j < numOfMin; j++) {\r\n String mName = reader.next();\r\n int intel = reader.nextInt();\r\n int exp = reader.nextInt();\r\n int lead = reader.nextInt();\r\n\r\n if (mName.equals(\"Scientist\")) {\r\n Scientist temp = new Scientist(intel, exp, lead);\r\n this.players.get(i).getMinisters().add(temp);\r\n }\r\n else if (mName.equals(\"Economist\")) {\r\n Economist temp = new Economist(intel, exp, lead);\r\n this.players.get(i).getMinisters().add(temp);\r\n }\r\n else if (mName.equals(\"WarGeneral\")) {\r\n WarGeneral temp = new WarGeneral(intel, exp, lead);\r\n this.players.get(i).getMinisters().add(temp);\r\n }\r\n else {\r\n throw new InvalidMinisterTypeException(\"Only \\\"WarGeneral\\\", \\\"Scientist\\\" and \\\"Economist\\\" are allowed\");\r\n }\r\n }\r\n }\r\n }\r\n }", "public static void reading(String fileName)\n {\n\n }", "public void readFromFile() {\n //reading text from file\n\n try {\n Scanner scanner = new Scanner(openFileInput(\"myTextFile.txt\"));\n\n while(scanner.hasNextLine()){\n\n String line = scanner.nextLine();\n\n String[] lines = line.split(\"\\t\");\n\n System.out.println(lines[0] + \" \" + lines[1]);\n\n toDoBean newTask = new toDoBean(lines[0], lines[1], 0);\n // System.out.println(line);\n sendList.add(newTask);\n\n }\n\n\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public static ArrayList<MonitoredData> readFileData(){\n ArrayList<MonitoredData> data = new ArrayList<>();\n List<String> lines = new ArrayList<>();\n try (Stream<String> stream = Files.lines(Paths.get(\"Activities.txt\"))) {\n lines = stream\n .flatMap((line->Stream.of(line.split(\"\\t\\t\"))))\n .collect(Collectors.toList());\n for(int i=0; i<lines.size()-2; i+=3){\n MonitoredData md = new MonitoredData(lines.get(i), lines.get(i+1), lines.get(i+2));\n data.add(md);\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n //data.forEach(System.out::println);\n return data;\n }", "public void readVotes(File inFile);", "private void readFile() {\n try (BufferedReader br = new BufferedReader(new FileReader(\"../CS2820/src/production/StartingInventory.txt\"))) {\n String line = br.readLine();\n while (line != null) {\n line = br.readLine();\n this.items.add(line);\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "public static void readObject() {\r\n try {\r\n if (new File(FILE).exists()) {\r\n LoggingService.getInstance().serverLog(\"Reading cron table.\");\r\n ChunkedCharBuffer buf = new ChunkedCharBuffer();\r\n buf.append(new InputStreamReader(new FileInputStream(FILE)));\r\n String contents = buf.toString();\r\n String[] lines = contents.split(\"[\\n\\r]+\");\r\n for (String line : lines) {\r\n String[] splitLine = line.split(\"\\\\|\");\r\n int index = 0;\r\n scheduleJob(\r\n new CronJob(\r\n splitLine[index++], //identifier\r\n Long.valueOf(splitLine[index++]), //interval\r\n new Date(Long.valueOf(splitLine[index++]).longValue()), //start time\r\n splitLine[index++], //command string\r\n splitLine[index++], //user\r\n splitLine[index++] //user service\r\n )\r\n );\r\n }\r\n } else {\r\n LoggingService.getInstance().serverLog(\"No cron table\");\r\n }\r\n } catch (Exception e) {\r\n LoggingService.getInstance().serverLog(\"Error reading cron table: \" + e);\r\n }\r\n }", "protected Object readObject(String fileName) throws IOException, ClassNotFoundException {\r\n\t\tObject o = null;\r\n\t\tFileInputStream fis = new FileInputStream(fileName);\r\n\t\tObjectInputStream ois = new ObjectInputStream(fis);\r\n\t\to = ois.readObject();\r\n\t\tois.close();\r\n\t\tfis.close();\r\n\t\t\r\n\t\treturn (o);\r\n\t}", "public ArrayList<Item> loadItems(String filename) {\n ArrayList<Item> itemsList = new ArrayList<>();\n try {\n File file = new File(filename);\n BufferedReader reader= new BufferedReader(new InputStreamReader(new FileInputStream(file), \"UTF-8\"));\n String line= reader.readLine();\n while (line != null){\n String[] splitedLine = line.split(\"=\");\n String name = splitedLine[0];\n int weight = Integer.parseInt(splitedLine[1]) / 1000; // on convertit en tonnes\n itemsList.add(new Item(name,weight));\n line = reader.readLine();\n }\n reader.close(); //pour arreter la memoire tampon\n }\n catch(IOException e)\n {\n e.printStackTrace();\n }\n\n return itemsList;\n }", "public ArrayList<Event> readSerFile() {\n\n ArrayList<Event> events = new ArrayList<>();\n try {\n FileInputStream file = new FileInputStream(filename);\n ObjectInputStream storedEvents = new ObjectInputStream(file);\n\n events = (ArrayList<Event>) storedEvents.readObject();\n\n storedEvents.close();\n file.close();\n\n return events;\n\n } catch (FileNotFoundException e) {\n System.out.println(filename + \" is missing\");\n } catch (IOException | ClassNotFoundException e) {\n return events;\n }\n\n return events;\n }", "protected Regions loadFromFile() throws IOException {\n try (InputStream in = StreamUtils.getInputStream(this.localRegions)) {\n JsonObject json = Json.createReader(in).readObject();\n Regions regions = new RegionsJSON().parseRegions(json);\n // regions loaded\n LOGGER.fine(\"Loaded ANSS Authoritative Regions from \"\n + this.localRegions\n + \", last modified=\" + XmlUtils.formatDate(\n new Date(this.localRegions.lastModified())));\n return regions;\n }\n }", "public void loadRegionList(String fileName) {\n try {\n BufferedReader in = new BufferedReader(new FileReader(fileName));\n maxRegions = Integer.parseInt(in.readLine()); \n regionList = new Region[maxRegions];\n int numRegionsInFile = Integer.parseInt(in.readLine());\n \n for (int i = 0; i < numRegionsInFile; i++) {\n String type = in.readLine();\n /* createAmazonRainforest, createArctic, and createAquarium are void static\n methods which takes in the BufferedReader and initializes all Region objects \n in the RegionList array using the Regions.txt file\n */\n if (type.equals(\"Amazon Rainforest\")) {\n createAmazonRainforest(in); \n } else if (type.equals(\"Arctic\")) {\n createArctic(in);\n } else if (type.equals(\"Aquarium\")) {\n createAquarium(in);\n }\n \n if (i == 2) {\n regionList[i].toString(); //temp \n }\n }\n \n \n \n } catch (IOException iox) {\n System.out.println(\"Error reading \" + fileName);\n } catch (NumberFormatException ex) {\n System.out.println(\"Problem with file formatting. Please check the file and try again.\");\n }\n }", "private void loadFromXml(String fileName) throws IOException {\n\t\tElement root = new XmlReader().parse(Gdx.files.internal(fileName));\n\n\t\tthis.name = root.get(\"name\");\n\t\tGdx.app.log(\"Tactic\", \"Loading \" + this.name + \"...\");\n\n\t\tArray<Element> players = root.getChildrenByName(\"player\");\n\t\tint playerIndex = 0;\n\t\tfor (Element player : players) {\n\t\t\t//int shirt = player.getInt(\"shirt\"); // shirt number\n\t\t\t//Gdx.app.log(\"Tactic\", \"Location for player number \" + shirt);\n\n\t\t\t// regions\n\t\t\tArray<Element> regions = player.getChildrenByName(\"region\");\n\t\t\tfor (Element region : regions) {\n\t\t\t\tString regionName = region.get(\"name\"); // region name\n\n\t\t\t\tthis.locations[playerIndex][Location.valueOf(regionName).ordinal()] = new Vector2(region.getFloat(\"x\"), region.getFloat(\"y\"));\n\n\t\t\t\t//Gdx.app.log(\"Tactic\", locationId + \" read\");\n\t\t\t}\n\t\t\tplayerIndex++;\n\t\t}\t\n\t}", "public DataProcessor(String filename) throws FileNotFoundException{\n\tlst = new ArrayList();\n\tScanner input = new Scanner(new FileReader(filename));\n //skip the first line of the csv file\n\tString escapedLine = input.nextLine();\n \twhile(input.hasNextLine()){\n\t recordCount++;\n\t String line = input.nextLine();\n\t //CORRECTION BLOC to skip quoted commas\n\t if (line.contains(\"\\\"\")){\n\t\tint first= line.indexOf(\"\\\"\");\n\t\twhile(first >0 ){\n\t\t String problem = line.substring(first,line.indexOf(\"\\\"\",first+1)+1);\n\t\t \tint second = line.indexOf(\"\\\"\",first+1);\n\t\t\t//look for comma between quoted\n\t\t\tif(problem.contains(\",\")){\n\t\t\t //replace comma by space not to change string indices\n\t\t\t problem=problem.replace(\",\",\" \");\n\t\t\t line=line.replace(line.substring(first,line.indexOf(\"\\\"\",first+1)+1),problem);\n\t\t\t}\n\t\t\t//look for another quote symbol\n\t\t\tfirst = line.indexOf(\"\\\"\",second+1);\n\t\t}\n\t }\n\t String[] fields = line.split(\",\");\n\t //create Person object to store the suspect's data\n\t Person suspect = new Person(fields[SEX].charAt(0),fields[RACE].charAt(0),Integer.parseInt(fields[DOB]),Integer.parseInt(fields[HEIGHTFT]),fields[EYECOLOR],fields[BUILD].charAt(0));\n\t lst.add(suspect);\n\t}\n\t//close scanner\n\tinput.close();\n }", "private void createAmazonRainforest (BufferedReader in) {\n try {\n String tempRegionName = in.readLine();\n int tempMaxStaff = Integer.parseInt(in.readLine());\n int tempNumStaff = Integer.parseInt(in.readLine());\n \n Staff[] readStaffList = new Staff[tempMaxStaff]; //creating a local array of Staff; later to be fed as a field to the constructor \n \n for (int i = 0; i < tempNumStaff; i++) {\n int id = Integer.parseInt(in.readLine());\n \n //readStaffList[i] = this.searchStaffTemp(id);\n readStaffList[i] = findStaff(id, 0, this.numStaff); //id is the same thing as staffNum in the staff class \n //creates an array of initialized staff objects by searching \n //using the staffNum read from the file\n }\n \n int tempMaxAnimals = Integer.parseInt(in.readLine());\n int tempNumAnimals = Integer.parseInt(in.readLine());\n \n Animal[] readAnimalList = new Animal[tempMaxAnimals]; //creating a local array of Animals;\n \n for (int i = 0; i < tempNumAnimals; i++) {\n readAnimalList[i] = new Animal(in.readLine(), Integer.parseInt(in.readLine()));\n }\n \n RegionSpec tempSpec = new RegionSpec (tempNumStaff, tempMaxStaff, tempNumAnimals, tempMaxAnimals, Integer.parseInt(in.readLine()),\n Double.parseDouble(in.readLine()));\n \n regionList[numRegions] = new AmazonRainforest(readStaffList, readAnimalList, tempRegionName, tempSpec, Integer.parseInt(in.readLine()),\n Boolean.parseBoolean(in.readLine()), Double.parseDouble(in.readLine()), Integer.parseInt(in.readLine()),\n Integer.parseInt(in.readLine())); \n } catch (IOException iox) {\n System.out.println(\"Error reading file\");\n }\n this.numRegions++;\n }", "private void readFile(File fp)throws IOException{\n Scanner in=new Scanner(fp);\n String line,s[];\n while(in.hasNext()){\n line=in.nextLine();\n s=line.split(\"[ ]+\");\n if(s.length<3){\n payroll.addLast(new ObjectListNode(new Employee(s[1],s[0])));\n }\n else{\n payroll.addLast(new ObjectListNode(new Employee(s[1],s[0],s[2].charAt(0),s[4].charAt(0),\n Integer.parseInt(s[3]),Double.parseDouble(s[5]))));\n }\n }\n }", "public static Vector<Metadata> ReadingMetadata(File file){\n\t\tVector<Metadata> v = new Vector<Metadata>(); \n\t\ttry {\n\t\t\tObjectInputStream input = new ObjectInputStream(new BufferedInputStream(new FileInputStream(file)));\n\t\t\tv = (Vector<Metadata>)input.readObject();\n\t\t\tinput.close();\n\t\t} catch(ClassNotFoundException e) {\n\t\t\tSystem.out.println(\"List Not Found\");\n\t\t\te.printStackTrace();\n\t\t} catch(IOException e) {\n\t\t\tSystem.out.println(\"Error of I/O\");\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn v;\n\t}", "public void loadData () {\n // create an ObjectInputStream for the file we created before\n ObjectInputStream ois;\n try {\n ois = new ObjectInputStream(new FileInputStream(\"DB/Guest.ser\"));\n\n int noOfOrdRecords = ois.readInt();\n Guest.setMaxID(ois.readInt());\n System.out.println(\"GuestController: \" + noOfOrdRecords + \" Entries Loaded\");\n for (int i = 0; i < noOfOrdRecords; i++) {\n guestList.add((Guest) ois.readObject());\n //orderList.get(i).getTable().setAvailable(false);\n }\n } catch (IOException | ClassNotFoundException e1) {\n // TODO Auto-generated catch block\n e1.printStackTrace();\n }\n }", "@Override\n\tpublic void init(String file_name) { deserialize(file_name); }", "@Override\n public List<Object> readFile(File file) {\n Scanner scanner = createScanner(file);\n if (Objects.isNull(scanner)) {\n return Collections.emptyList();\n }\n List<Object> readingDTOList = new ArrayList<>();\n scanner.nextLine();\n List<List<String>> allLines = new ArrayList<>();\n while (scanner.hasNext()) {\n List<String> line = parseLine((scanner.nextLine()));\n if (!line.isEmpty()) {\n allLines.add(line);\n }\n }\n if (!allLines.isEmpty()) {\n for (List<String> line : allLines) {\n String sensorId = line.get(0);\n String dateTime = line.get(1);\n String value = line.get(2);\n String unit = line.get(3);\n LocalDateTime readingDateTime;\n if (sensorId.contains(\"RF\")) {\n LocalDate readingDate = LocalDate.parse(dateTime, DateTimeFormatter.ofPattern(\"dd/MM/uuuu\"));\n readingDateTime = readingDate.atStartOfDay();\n } else {\n ZonedDateTime zonedDateTime = ZonedDateTime.parse(dateTime);\n readingDateTime = zonedDateTime.toLocalDateTime();\n }\n double readingValue = Double.parseDouble(value);\n ReadingDTO readingDTO = ReadingMapper.mapToDTOwithIDandUnits(sensorId, readingDateTime, readingValue, unit);\n readingDTOList.add(readingDTO);\n }\n }\n return readingDTOList;\n }", "public void loadStaffList(String fileName) {\n try {\n BufferedReader in = new BufferedReader(new FileReader(fileName));\n maxStaff = Integer.parseInt(in.readLine());\n staffList = new Staff[maxStaff];\n int numStaffInFile = Integer.parseInt(in.readLine());\n \n for (int i = 0; i < numStaffInFile; i++){\n \n String staffType = in.readLine();\n if (staffType.equals(\"Labourer\")) {\n staffList[i] = new Labourer(in.readLine(), Integer.parseInt(in.readLine()), in.readLine(), Double.parseDouble(in.readLine()), Integer.parseInt(in.readLine()));\n numStaff++;\n } else if (staffType.equals(\"Manager\")) /*;*/\n {\n staffList[i] = new Manager(in.readLine(), Integer.parseInt(in.readLine()), in.readLine(), Double.parseDouble(in.readLine()));\n numStaff++;\n }\n }\n \n } catch (IOException iox) {\n System.out.println(\"Error reading \" + fileName);\n \n } catch (NumberFormatException ex) {\n System.out.println(\"Problem with file formatting. Please check the file and try again.\");\n }\n }", "private List<Task> getTasksFromFile() throws FileNotFoundException{\n List<Task> loadedTasks = new ArrayList<>();\n Ui a=new Ui();\n try {\n List<String> lines = getLine() ;\n for (String line : lines) {\n if (line.trim().isEmpty()) { //ignore empty lines\n continue;\n }\n loadedTasks.add(createTask(line)); //convert the line to a task and add to the list\n }\n System.out.println(\"File successfully loaded\");\n } catch (DukeException e1) {\n System.out.println(\"☹ OOPS!!! Problem encountered while loading data: \" +e1.getMessage());\n }\n return loadedTasks;\n }", "public static void main (String args[]) throws FileNotFoundException, \n\t\t\tIOException {\n\t\tPerson me = null;\n\n\t\tFileInputStream underlyingStream = new FileInputStream(\n\t\t\t\t\t\"./person.ser\"\n\t\t\t\t\t);\n\t\tObjectInputStream reader = new ObjectInputStream(underlyingStream);\n\t\t\n\t\t// read the person object in\n\t\ttry{\n\t\t\tme = (Person) reader.readObject();\n\t\t} catch (ClassNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\tSystem.out.println(me);\t\t\n\t}", "public abstract void readFromFile( ) throws Exception;", "public void readFile() {\r\n\t\tBufferedReader br = null;\r\n\r\n\t\ttry {\r\n\r\n\t\t\tString currentLine;\r\n\r\n\t\t\tbr = new BufferedReader(new FileReader(fileName));\r\n\r\n\t\t\twhile ((currentLine = br.readLine()) != null) {\r\n\r\n\t\t\t\tif (!currentLine.equals(\"\")) {\r\n\t\t\t\t\tString[] paragraphs = currentLine.split(\"\\\\n\\\\n\");\r\n\r\n\t\t\t\t\tfor (String paragraphEntry : paragraphs) {\r\n\t\t\t\t\t\t//process(paragraphEntry);\r\n\t\t\t\t\t\t//System.out.println(\"Para:\"+paragraphEntry);\r\n\t\t\t\t\t\tParagraph paragraph = new Paragraph();\r\n\t\t\t\t\t\tparagraph.process(paragraphEntry);\r\n\t\t\t\t\t\tthis.paragraphs.add(paragraph);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} catch (IOException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t} finally {\r\n\t\t\ttry {\r\n\t\t\t\tif (br != null)br.close();\r\n\t\t\t} catch (IOException ex) {\r\n\t\t\t\tex.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t}", "@Test\n public void testReadFile() {\n System.out.println(\"readFile\");\n String fileName = \"src/main/resources/activities.txt\";\n String line = \"Learning Magic Tricks 40min\";\n\n Activities instance = new Activities(fileName);\n List<Activity> result = null;\n try {\n result = instance.getActivities();\n } catch (IOException ex) {\n }\n List<Activity> expResult = new ArrayList<>();\n expResult.add(new Activity(line, 40));\n// Assert.assertTrue(result.contains(expResult));\n }", "public static ArrayList<Student> loadListOfStudents(String fileName) {\n ArrayList<Student> students = new ArrayList<>();\r\n String str = TextReader.StringFromFile(fileName);//Uses the method that returns a complete string with newlines for each studentline.\r\n if (validateInput(str)) {//Uses the validation method to check that the input is valid.\r\n String[] lines = str.split(\"\\n\");\r\n String[] lineParameters;\r\n int countFor = 0;\r\n for (String line : lines) {\r\n if(countFor > 1){\r\n lineParameters = line.split(\",\");\r\n Vote vote = new Vote(new Subject(lineParameters[1]), new Subject(lineParameters[2]), new Subject(lineParameters[3]), new Subject(lineParameters[4]));\r\n Student newStudent = new Student(lineParameters[0], vote);\r\n students.add(newStudent);\r\n }\r\n countFor++;\r\n }\r\n }\r\n\r\n return students;\r\n }", "private void readItems() {\n // open file\n File file = getFilesDir();\n File todoFile = new File(file, \"scores.txt\");\n // try to find items to add\n try {\n items = new ArrayList<>(FileUtils.readLines(todoFile));\n } catch (IOException e) {\n items = new ArrayList<>();\n }\n }", "public void loadData() {\n Path path= Paths.get(filename);\n Stream<String> lines;\n try {\n lines= Files.lines(path);\n lines.forEach(ln->{\n String[] s=ln.split(\";\");\n if(s.length==3){\n try {\n super.save(new Teme(Integer.parseInt(s[0]),Integer.parseInt(s[1]),s[2]));\n } catch (ValidationException e) {\n e.printStackTrace();\n } catch (SQLException e) {\n e.printStackTrace();\n }\n }else\n System.out.println(\"linie corupta in fisierul teme.txt\");});\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "public void readPatient() {\n\t\tBufferedReader br;\n\t\tString s;\n\t\ttry {\n\t\t\tbr = new BufferedReader(new FileReader(\"patients.txt\"));\n\n\t\t\twhile ((s = br.readLine()) != null) {\n\t\t\t\tString[] fields = s.split(\", \");\n\n\t\t\t\tString ssn = fields[0];\n\t\t\t\tString name = fields[1];\n\t\t\t\tString address = fields[2];\n\t\t\t\tString phoneNum = fields[3];\n\t\t\t\tString insurance = fields[4];\n\t\t\t\tString currentMeds = fields[5];\n\t\t\t\tPatient patient = new Patient(ssn, name, address, phoneNum, insurance, currentMeds);\n\t\t\t\tpat.add(patient);\n\t\t\t}\n\t\t\tbr.close();\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e1) {\n\t\t\te1.printStackTrace();\n\t\t}\n\n\t}", "public static List<Contract> readFromFile(String filename) {\n List<Contract> contracts = new ArrayList<>();\n\n InputStreamReader inputStreamReader = null;\n try {\n inputStreamReader = new InputStreamReader(new FileInputStream(new File(filename)),\"cp1251\");\n\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n } catch (UnsupportedEncodingException e) {\n e.printStackTrace();\n }\n BufferedReader bufferedReader = new BufferedReader(inputStreamReader);\n String [] lines = null;\n String line = null;\n try{\n while ((line = bufferedReader.readLine()) != null) {\n\n lines= line.split(\",\");\n\n\n LocalDate conc = LocalDate.parse(lines[1], DateTimeFormatter.ofPattern(\"dd.MM.yyyy\"));\n LocalDate start = LocalDate.parse(lines[2], DateTimeFormatter.ofPattern(\"dd.MM.yyyy\"));\n LocalDate end = LocalDate.parse(lines[3], DateTimeFormatter.ofPattern(\"dd.MM.yyyy\"));\n\n Client client=new Client(ClientType.valueOf(lines[4]),lines[5],lines[6]);\n\n ArrayList<InsuredPerson>insuredPeople=new ArrayList<>();\n for(int i=7; i<lines.length; i+=4 ){\n LocalDate d=LocalDate.parse(lines[i+2],DateTimeFormatter.ofPattern(\"dd.MM.yyyy\"));\n InsuredPerson person = new InsuredPerson(Integer.valueOf(lines[i]),lines[i+1],d,Double.valueOf(lines[i+3]));\n insuredPeople.add(person);\n\n\n }\n Contract contract=new Contract(Integer.valueOf(lines[0]),conc,start,end,client,insuredPeople);\n contracts.add(contract);\n }\n bufferedReader.close();}\n catch (IOException e){\n System.out.println(e.getMessage());\n e.printStackTrace();\n }\n return contracts;\n\n }", "public void readFile() throws NumberFormatException,FileNotFoundException {\n Scanner scanStar, scanMessier, scanPlanet;\n String raw_data;\n String[] values;\n Set<String> identifyName = new HashSet<>();\n // Create scanner to scan file\n scanStar = new Scanner(new File(filename[0]));\n scanMessier = new Scanner(new File(filename[1]));\n scanPlanet = new Scanner(new File(filename[2]));\n\n // Read data about Star and store\n Star star;\n while (scanStar.hasNext()){\n raw_data = scanStar.nextLine();\n values = processData(raw_data, 1);\n // Check whether there is the same object or the data is wrong\n if (values.length != 7 || identifyName.contains(values[0])){\n System.out.println(\"There are some mistakes in Star file\");\n System.exit(1);\n }\n star = new Star();\n star.setNumber(values[0]);\n star.setRa(Double.parseDouble(values[1]));\n star.setDecl(Double.parseDouble(values[2]));\n star.setMagn(Double.parseDouble(values[3]));\n star.setDistance(Double.parseDouble(values[4]));\n star.setType(values[5]);\n star.setConstellation(values[6]);\n // Add object to collection\n aos.add(star);\n identifyName.add(star.getNumber());\n }\n scanStar.close();\n\n // Read data about Messier and store\n Messier messier;\n while (scanMessier.hasNext()){\n raw_data = scanMessier.nextLine();\n values = processData(raw_data, 1);\n if (values.length < 6 || identifyName.contains('M' + values[0])){\n System.out.println(\"There are some mistakes in Messier file\");\n System.exit(1);\n }\n messier = new Messier();\n messier.setNumber(\"M\" + values[0]);\n messier.setRa(Double.parseDouble(values[1]));\n messier.setDecl(Double.parseDouble(values[2]));\n messier.setMagn(Double.parseDouble(values[3]));\n messier.setDistance(Double.parseDouble(values[4]));\n messier.setConstellation(values[5]);\n if (values.length == 7){\n messier.setDescription(values[6]);\n }else {\n messier.setDescription(\"-\");\n }\n // Add object to collection\n aos.add(messier);\n identifyName.add(messier.getNumber());\n }\n scanMessier.close();\n\n // Read data about Planet and store\n Planet planet;\n while (scanPlanet.hasNext()){\n raw_data = scanPlanet.nextLine();\n values = processData(raw_data, 0);\n if (values.length != 6 || identifyName.contains(values[0])){\n System.out.println(\"There are some mistakes in Planet file\");\n System.exit(1);\n }\n planet = new Planet();\n planet.setName(values[0]);\n planet.setRa(Double.parseDouble(values[1]));\n planet.setDecl(Double.parseDouble(values[2]));\n planet.setMagn(Double.parseDouble(values[3]));\n planet.setDistance(Double.parseDouble(values[4]));\n planet.setAlbedo(Double.parseDouble(values[5]));\n // Add object to collection\n aos.add(planet);\n identifyName.add(planet.getName());\n }\n scanPlanet.close();\n }", "public void load (File file) throws Exception;", "private void readNodes() throws FileNotFoundException{\n\t\tScanner sc = new Scanner(new File(\"Resources\\\\ListOfNodes.csv\"));\n\t\tsc.nextLine(); //Skip first line of headers\n\t\twhile(sc.hasNext()) { \n\t\t\tCSVdata = sc.nextLine().split(\",\"); // Add contents of each row to String[]\n\t\t\tnodes.add(new GraphNode<String>(CSVdata[0], CSVdata[1])); // Add new node to object list\n\t\t}\n\t\tsc.close();\n\t}" ]
[ "0.69525427", "0.6574856", "0.6558358", "0.65422916", "0.64511913", "0.6435313", "0.6410713", "0.6375255", "0.6300314", "0.6256028", "0.62055993", "0.6183111", "0.61573577", "0.61543125", "0.6121855", "0.6121788", "0.6094846", "0.60749805", "0.607453", "0.60640097", "0.60496336", "0.60226196", "0.6016578", "0.6004743", "0.5974399", "0.596458", "0.5950413", "0.592627", "0.58981323", "0.5896172", "0.58952206", "0.5888756", "0.5866377", "0.58598673", "0.585898", "0.58500004", "0.5849692", "0.5845933", "0.5841802", "0.58417505", "0.5839108", "0.5823504", "0.5820232", "0.5812521", "0.5809101", "0.5807477", "0.58071244", "0.57909685", "0.57875806", "0.57846564", "0.57771456", "0.5776658", "0.5774164", "0.576753", "0.57650095", "0.5759045", "0.5758135", "0.5756774", "0.5747715", "0.5743637", "0.57373476", "0.57322633", "0.5730996", "0.57257736", "0.57131714", "0.5710578", "0.57086957", "0.57068306", "0.5700182", "0.5699646", "0.5695784", "0.5692552", "0.56894296", "0.5679921", "0.56776166", "0.56757", "0.5667326", "0.56641537", "0.5659686", "0.5659552", "0.5647844", "0.56476176", "0.56473196", "0.5639859", "0.56370497", "0.56355417", "0.56329936", "0.5631307", "0.56306535", "0.562783", "0.5625419", "0.56188947", "0.5614404", "0.56125456", "0.55994135", "0.5598795", "0.55923384", "0.5591604", "0.55883634", "0.5582721" ]
0.73942804
0
This function reads a single instance, and thus a single line, from file
private String getInstanceFromFile() throws IOException{ StringBuilder instance = new StringBuilder(); boolean over = false; while(!over){ char c = (char) reader.read(); if(c == '\n') over = true; else instance.append(c); } return instance.toString(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "axiom Object readLine(Object BufferedReader(FileReaderr f)) {\n\treturn f.get(0);\n }", "public Site readone() {\r\n\t\tSite s;\r\n\r\n\t\ts = new Site();\r\n\t\ts.refcnt = 0;\r\n\t\ts.sitenbr = siteidx;\r\n\t\tsiteidx += 1;\r\n\r\n\t\tif (in.hasNextLine()) {\r\n\t\t\tString line = in.nextLine();\r\n\t\t\tStringTokenizer token = new StringTokenizer(line);\r\n\t\t\ts.coord.x = Float.valueOf(token.nextToken());\r\n\t\t\ts.coord.y = Float.valueOf(token.nextToken());\r\n\t\t}\r\n\r\n\t\treturn (s);\r\n\r\n\t}", "abstract protected T getRecordFromLine(String line) throws DataImportException ;", "public abstract T readDataFile(String fileLine);", "private Actor getActorFromData(String[] line){\n Actor actor = new Actor(line[AppVariables.actorID].trim(), \n line[AppVariables.actorName].trim());\n return actor;\n }", "public static Classification parseLine(String line) {\r\n\t\tScanner s = new Scanner(line);\r\n\t\tClassification c = new Classification();\r\n\t\tif (s.hasNext()) {\r\n\t\t\tc.imageUUID = s.nextInt();\r\n\t\t\ts.nextInt();\r\n\t\t\tc.speciesName = s.next();\r\n\t\t}\r\n\t\ts.close();\r\n\t\treturn c;\r\n\r\n\t}", "public E nextInstance() throws Exception {\n\t\tif (scanner.hasNextLine()) {\n\t\t\tString nextLine = scanner.nextLine();\n\t\t\treturn lineParseStrategy.create(nextLine);\n\t\t}\n\n\t\treturn null;\n\t}", "public InstanceReader(String filename) throws FileNotFoundException{\n this.reader = new FileReader(filename);\n }", "public String getLine()\n\t{\n\t\ttry\n\t\t{\n\t\t\tline = reader.readLine();\n\t\t} catch (IOException ioe)\n\t\t{\n\t\t\t//\n\t\t}\n\n\t\treturn line;\n\t}", "public static void main(String[] args) throws IOException, ClassNotFoundException {\n\n ObjectInputStream objectInputStream = new ObjectInputStream(new FileInputStream(new File(\"D:\\\\aaa.txt\")));\n User user = (User)objectInputStream.readObject();\n System.out.println(user);\n objectInputStream.close();\n }", "private String fileReadOneLine(String fname) {\n BufferedReader br;\n String line = null;\n\n try {\n br = new BufferedReader(new FileReader(fname), 512);\n try {\n line = br.readLine();\n } finally {\n br.close();\n }\n } catch (Exception e) {\n Log.e(TAG, \"Exception when reading /sys/* file\", e);\n }\n return line;\n }", "public String readLine() {\n\n String temp = null;\n\n try\n {\n assert this.isValid();\t\t\t//Test that we can read the file\n temp = br.readLine();\t\t\t//Read the next line and store it as temp\n }\n\n\t\t//Catch possible exceptions\n catch(java.io.IOException e) {\n System.out.println(\"Error reading file: \" + e );\n }\n\n return temp;\n }", "private String readLine() {\n\t\ttry {\n\t\t\treturn reader.nextLine();\t\n\t\t} catch (NoSuchElementException e) {\n\t\t\treturn null;\n\t\t}\n\t}", "public String getLine ()\n {\n return line;\n }", "private String readNextLine() {\n StringBuilder sb = new StringBuilder();\n\n try {\n BufferedReader br = new BufferedReader(new InputStreamReader(stream));\n sb.append(br.readLine());\n } catch (IOException e) {\n e.fillInStackTrace();\n }\n\n return sb.toString();\n }", "public abstract boolean read(String line);", "public abstract String getFirstLine();", "public String readLine(){\n\t\tString line;\n\t\ttry{\n\t\t\tline=scanner.nextLine();\n\t\t}catch (NoSuchElementException e){\n\t\t\tline=null;\n\t\t}\n\t\treturn line;\n\t}", "@Override\n\t// read registration records from dataFile\n\tpublic synchronized Info readInfoFromFile(){\n\t\tInfo new_StudInfo = null;\n\t\ttry{\n\t\t\t\tString newLine = br.readLine();\t// read a line from file\n\t\t\t\tif(newLine!=null){\n\t\t\t\t\t// split a record into 3 strings and an integer\n\t\t\t\t\tregInfoLine = newLine.split(\" \");\t\n\t\t\t\t\tnew_StudInfo = new StudentInfo(\n\t\t\t\t\t\t\t\t\t\tregInfoLine[0],\n\t\t\t\t\t\t\t\t\t\tregInfoLine[1],\n\t\t\t\t\t\t\t\t\t\tregInfoLine[2],\n\t\t\t\t\t\t\t\t\t\t(Integer.parseInt(regInfoLine[3])));\n\t\t\t\t}\n\t\t}\n\t\tcatch(IOException e)\n\t\t{\n\t\t\tSystem.out.println(e);\n\t\t\tSystem.exit(1);\n\t\t}\n\t\treturn new_StudInfo;\n\t}", "public Line getLine()\n {\n return line;\n }", "public String readLine() {\n BufferedReader input;\n String str = null;\n \n if (file == null || line < 0) {\n return null;\n }\n try {\n input = new BufferedReader(new FileReader(file));\n for (int i = 0; i < line; i++) {\n str = input.readLine();\n }\n input.close();\n } catch (IOException e) {\n return null;\n }\n return str;\n }", "public static void readObject() {\r\n try {\r\n if (new File(FILE).exists()) {\r\n LoggingService.getInstance().serverLog(\"Reading cron table.\");\r\n ChunkedCharBuffer buf = new ChunkedCharBuffer();\r\n buf.append(new InputStreamReader(new FileInputStream(FILE)));\r\n String contents = buf.toString();\r\n String[] lines = contents.split(\"[\\n\\r]+\");\r\n for (String line : lines) {\r\n String[] splitLine = line.split(\"\\\\|\");\r\n int index = 0;\r\n scheduleJob(\r\n new CronJob(\r\n splitLine[index++], //identifier\r\n Long.valueOf(splitLine[index++]), //interval\r\n new Date(Long.valueOf(splitLine[index++]).longValue()), //start time\r\n splitLine[index++], //command string\r\n splitLine[index++], //user\r\n splitLine[index++] //user service\r\n )\r\n );\r\n }\r\n } else {\r\n LoggingService.getInstance().serverLog(\"No cron table\");\r\n }\r\n } catch (Exception e) {\r\n LoggingService.getInstance().serverLog(\"Error reading cron table: \" + e);\r\n }\r\n }", "public Line getLine(String targetLine);", "public synchronized String readLineFromFile(){\n\t\tString line = null;\n\t\t\n\t\ttry{\n\n\t\t\tif((line = bufferedInput.readLine()) != null){\n\t\t\t\treturn line;\n\t\t\t}\n\t\t}\n\t\tcatch(NullPointerException ex) {\n \t\tSystem.err.println(\"File is Blank\");\t\t \n \t\tSystem.exit(1); \n\t\t}\n\t\tcatch(IOException ex) {\n System.err.println(\"Unable to read a line from file\");\t\t \n\t\t\tSystem.exit(1); \n }\n\n\t\treturn line;\n\t}", "private SensorReading extractReading(String line) {\n\t\tList<Integer> tempArray = new ArrayList<Integer>();\n\t\tString[] sr = line.split(\",\");\n\t\tfor(int i=0; i<sr.length; i++) {\n\t\t\tint num = Integer.MIN_VALUE;\n\t\t\ttry {\n\t\t\t\tnum = Integer.parseInt(sr[i]);\n\t\t\t} catch(NumberFormatException nfe) {\n\t\t\t\t// if num is not integer, skip the current line\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\ttempArray.add(num);\n\t\t}\t\t\t\n\t\tif(tempArray.size() == sr.length) {\n\t\t\treturn new SensorReading(tempArray, zeroValues);\n\t\t}\n\t\treturn null;\n\t}", "protected abstract E createEntity(String line);", "private RunnerThread getData(String line) {\n \tString name = null;\n \ttry \n \t{\n \t\tString[] lineParse = line.split(\"\\t\");\n \t\tname = lineParse[0];\n \t\tString speedString = lineParse[1];\n \t\tString restString = lineParse[2];\n \t\tint speed = Integer.parseInt(speedString);\n \t\tint rest = Integer.parseInt(restString);\n \t\treturn (new RunnerThread(name,speed,rest));\n \t}\n \tcatch (NumberFormatException num) {\n \t\tSystem.out.println(\"The data entered for the speed/rest is not correct for the runner : \" + name);\t\n \t\tSystem.exit(1);\n \t}\n \tcatch (Exception ex) {\n\t\t\tSystem.out.println(\"An error occured while reading the data from the file\");\n\t\t\tSystem.exit(1);\n \t}\n\t\treturn null; \t\n }", "public String readLine() throws IOException\r\n\t{\r\n\t\treturn file.readLine();\r\n\t}", "@Test\n public void testGetLine()\n {\n System.out.println(\"getLine\");\n final File file = new File(\"src/test/data/test.example.txt\");\n final Lexer lexer = new Lexer();\n final Token token = lexer.analyze(file);\n final Token next = token.getNext();\n assertEquals(Syntax.OPEN, next.getSyntax());\n assertEquals(2, next.getLine());\n assertEquals(1, next.getPosition());\n assertEquals(\"{\", next.getValue());\n }", "public Serializable readObject(){\n Serializable loadedObject = null;\n try {\n FileInputStream fileIn = new FileInputStream(name);\n ObjectInputStream in = new ObjectInputStream(fileIn);\n loadedObject = (Serializable) in.readObject();\n in.close();\n fileIn.close();\n System.out.println(\"Data loaded from: \"+ name);\n } \n catch (IOException i) {\n System.out.println(\"File not found.\");\n } \n catch (ClassNotFoundException c) {\n System.out.println(\"Class not found\");\n }\n return loadedObject;\n }", "void loadExistingInstance(String filename)\n {\n iIncomingLobsFactory = new incomingLobsFactory();\n iIncomingLobsFactory.setPackageName(\"com.loadSample\");\n \n // Load the document\n iIncomingLobs = (incomingLobs) iIncomingLobsFactory.loadDocument(filename);\n printincomingLobs();\n }", "public ArrayList<Instance> read() throws IOException{\n ArrayList<Instance> instances;\n instances = new ArrayList<>();\n String s;\n String[] c;\n Instance i;\n while(reader.ready()){\n s = getInstanceFromFile();\n i = new Instance();\n c = s.split(\",\");\n for(int j = 0; j < c.length - 1; j++)\n i.addFeature(Double.parseDouble(c[j]));\n // The last part of a line is the class label\n // See dataset that is used\n i.setClassification(c[c.length - 1]);\n instances.add(i);\n }\n return instances;\n }", "public Line getLine ()\r\n {\r\n if (line == null) {\r\n computeLine();\r\n }\r\n\r\n return line;\r\n }", "public Object readObject(File file, int format) throws IOException, FileNotFoundException;", "public String getLine();", "public Instances openARFF(String path)\n\t{\n\t\ttry\n\t\t{\n\t\t\tthis.dataset = new Instances(new BufferedReader(new FileReader(path)));\n\t\t}\n\t\tcatch(IOException ex)\n\t\t{\n\t\t\tSystem.out.println(ex);\n\t\t}\n\t\treturn this.dataset;\n\t}", "@Override\r\n\tpublic CEntity read(CEntity entity, String ID) {\n\t\twhile (scanner.hasNext()) {\r\n\t\t\tentity.read(scanner);\r\n\t\t\tif (entity.getID().equals(ID))\r\n\t\t\t\treturn entity;\r\n\t\t}\r\n\t\treturn null;\r\n\t}", "public PlantID(String line){\r\n\t\tScanner sc = new Scanner(line);\r\n\t\tthis.id = sc.next();\r\n\t\tthis.name = (sc.next()+\" \" +sc.next());\r\n\t\tsc.close();\r\n\t}", "public int getLine() {return _line;}", "private void readLine() throws IOException {\n line = reader.readLine(); // null at the end of the source\n currentPos = -1;\n\n if (line != null) {\n lineNum++;\n }\n\n if (line != null) {\n sendMessage(new Message(MessageType.SOURCE_LINE, new Object[]{lineNum, line}));\n }\n }", "@Override\n public Line getLine() {\n return line;\n }", "public LogRecord extractFirstLogRecord() throws IOException {\n\n InferenceMachine infMach = new InferenceMachine(logConfig.getLogFile());\n\n /* First is to find a log record header */\n String line;\n do {\n line = getNextLine();\n } while ((line != null) && !infMach.isLogRecordHeader(line));\n\n /* There was any header found? */\n if (line == null) {\n throw new IllegalArgumentException(\"The file contains no record log header\");\n }\n\n LogRecord logRecord = new LogRecord(line);\n while (((line = bufferedReader.readLine()) != null) && !infMach.isLogRecordHeader(line)) {\n logRecord.addLine(line);\n }\n\n return logRecord;\n }", "private Object readObject(String path)\n throws IOException, ClassNotFoundException {\n InputStream file = new FileInputStream(path);\n InputStream buffer = new BufferedInputStream(file);\n ObjectInput input = new ObjectInputStream(buffer);\n Object inputObj = input.readObject();\n input.close();\n return inputObj;\n }", "public Input readFromFile (String fileName) {\n\t\tFileReader fr = null;\n\t\tBufferedReader br = null;\n\t\tString sCurrentLine = \"test\";\n\t\tint numberOfProducts = 0;\n\t\tint numberOfSurveys = 0;\n\t\tList <String> products = new ArrayList<> ();\n\t\tList <String> surveyPrices = new ArrayList<> ();\n\t\tInput input = new Input ();\n\t\t\n\t\ttry {\n\t\t\tfr = new FileReader(fileName);\n\t\t\tbr = new BufferedReader(fr);\n\t\t\tint line = 1;\n\t\t\tboolean isAllProductsAdded = false;\n\t\t\twhile ((sCurrentLine = br.readLine()) != null) {\n\t\t\t\t\n\t\t\t\tif (line == 1 ) {\n\t\t\t\t\tnumberOfProducts = new Integer(sCurrentLine).intValue();\n\t\t\t\t}else {\n\t\t\t\t\tif (products.size() == numberOfProducts) {\n\t\t\t\t\t\tif (numberOfSurveys == 0) {\n\t\t\t\t\t\t\tnumberOfSurveys = new Integer(sCurrentLine).intValue();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tsurveyPrices.add(sCurrentLine);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (products.size() < numberOfProducts )\n\t\t\t\t\t\t\tproducts.add(sCurrentLine);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tline++;\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tinput.setNumberOfProducts(numberOfProducts);\n\t\tinput.setNumberofSurveyedPrices(numberOfSurveys);\n\t\tinput.setProducts(products);\n\t\tinput.setSurveys(surveyPrices);\n\t\treturn input;\n\t}", "public T load(String ServerID)\r\n\t{\r\n\t\tFile f = new File(root,ServerID+\"/\"+instances.get(ServerID).path());\r\n\t\tT obj = instances.get(ServerID);\r\n\t\tif(f.exists() && obj != null)\r\n\t\t{\r\n\t\t\ttry {\r\n\t\t\t\tScanner s = new Scanner(f,\"UTF-8\");\r\n\t\t\t\tString txt=\"\";\r\n\t\t\t\twhile(s.hasNextLine())\r\n\t\t\t\t{\r\n\t\t\t\t\ttxt = txt+s.nextLine();\r\n\t\t\t\t}\r\n\t\t\t\ts.close();\r\n\t\t\t\treturn (T) obj.fromText(txt, gson);\r\n\t\t\t} catch (FileNotFoundException e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\r\n\t}", "static void readLine(String line) {\n if (line.equals(\"\")) {\n //boş satır varsa birşey yapma\n } else {\n String[] satır = line.split(\", \");\n long id = Long.parseLong(satır[0]);//id\n String a = satır[1]; //eventType\n String b = satır[2]; //EventName\n String c = satır[3]; // date\n String c2 = satır[4];\n boolean c22 = Boolean.parseBoolean(c2); //isAllDay?\n String d = satır[5];//time from\n String e = satır[6];//time to\n String f = satır[7];//color\n String g = satır[8];//location\n String h = satır[9];//description\n String j = satır[10];//reminder\n\n Agenda agenda = new Agenda(id, a, b, c, c22, d, e, f, g, h, j);\n data.add(agenda);\n addtoReminder(j, c);\n }\n }", "private String readLine() {\r\n\t\ttry {\r\n\t\t\treturn input.readLine();\r\n\t\t} catch (IOException e) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\t}", "public void readFromFile() {\n FileInputStream fis = null;\n try {\n //reaad object\n fis = new FileInputStream(file);\n ObjectInputStream ois = new ObjectInputStream(fis);\n TravelAgent travelAgent = (TravelAgent)ois.readObject();\n travelGUI.setTravelAgent(travelAgent);\n ois.close();\n }\n catch (Exception e) {\n System.out.println(e.getMessage());\n if (fis != null) {\n try {\n fis.close();\n }\n catch (IOException e2) {\n System.out.println(e2.getMessage());\n }\n }\n return;\n }\n finally {\n if (fis != null) {\n try {\n fis.close();\n }\n catch (IOException e2) {\n System.out.println(e2.getMessage());\n }\n }\n }\n if (fis != null) {\n try {\n fis.close();\n }\n catch (IOException e2) {\n System.out.println(e2.getMessage());\n }\n }\n }", "static Employee GetEmployeeObjectFromFile(String filename)\n\t{\n\t\tEmployee e = null;\n\t try\n\t {\n\t FileInputStream fileIn = new FileInputStream(filename);\n\t ObjectInputStream in = new ObjectInputStream(fileIn);\n\t //Main read method\n\t e = (Employee) in.readObject();\n\t in.close();\n\t fileIn.close();\n\t }catch(IOException i)\n\t {\n\t i.printStackTrace();\n\t }catch(ClassNotFoundException c)\n\t {\n\t System.out.println(\"Employee class not found\");\n\t c.printStackTrace();\n\t }\n\t\treturn e;\n\t}", "String getLine (int line);", "public abstract String getLine(int lineNumber);", "@Override\r\n\tpublic Newstrategypojo getline(int id) {\n\t\treturn dao.getline(id);\r\n\t}", "public static Object readObjectFromFile(File f) {\r\n Object obj = null;\r\n try {\r\n FileInputStream fin = new FileInputStream(f);\r\n ObjectInputStream ois = new ObjectInputStream(fin);\r\n obj = ois.readObject();\r\n ois.close();\r\n } catch (Exception e) {\r\n System.out.println(\"Error reading Object from file: \"\r\n + e.getMessage());\r\n return null;\r\n }\r\n return obj;\r\n }", "public QuizPlayer serialReadFile() {\r\n File fileObject = new File(getName());\r\n QuizPlayer q = new QuizPlayer(); //If any error is caught the program will re ask the user for input.\r\n try {\r\n ObjectInputStream inputStream =\r\n new ObjectInputStream(new FileInputStream(fileObject));\r\n q = (QuizPlayer) inputStream.readObject();\r\n\r\n\r\n } catch (FileNotFoundException e) {\r\n System.out.println(\"Cannot find file. Please Enter a different file Name\");\r\n\r\n } catch (ClassNotFoundException e) {\r\n System.out.println(\"Problems with file input. Please Enter a different file name\");\r\n\r\n } catch (IOException e) {\r\n System.out.println(\"Problems with file input. Please Enter a differet file name\");\r\n }\r\n\r\n\r\n return q;\r\n }", "public String getLine() {\n return this.line;\n }", "public FastqRecord readRecord() throws IOException, RecordFormatException\n\t{\n\t\t// Read the defline from the BufferedReader. Return null if you read null, \n\t\t// indicating end of file.\n\n\t\t\n\t\t// Read the next 3 lines from the buffered reader. Construct and return\n\t\t// a FastqRecord.\n\n\t}", "private Client readClient() {\n System.out.println(\"Read client {id,name,age,membership}\");\n\n BufferedReader bufferRead = new BufferedReader(new InputStreamReader(System.in));\n try {\n Long id = Long.valueOf(bufferRead.readLine());// ...\n String name = bufferRead.readLine();\n int age = Integer.parseInt(bufferRead.readLine());\n String membership = bufferRead.readLine();\n\n Client client = new Client(name, age, membership);\n client.setId(id);\n\n return client;\n\n } catch (IOException ex) {\n ex.printStackTrace();\n }\n return null;\n }", "@Override\n public void parse() {\n if (file == null)\n throw new IllegalStateException(\n \"File cannot be null. Call setFile() before calling parse()\");\n\n if (parseComplete)\n throw new IllegalStateException(\"File has alredy been parsed.\");\n\n FSDataInputStream fis = null;\n BufferedReader br = null;\n\n try {\n fis = fs.open(file);\n br = new BufferedReader(new InputStreamReader(fis));\n\n // Go to our offset. DFS should take care of opening a block local file\n fis.seek(readOffset);\n records = new LinkedList<T>();\n\n LineReader ln = new LineReader(fis);\n Text line = new Text();\n long read = readOffset;\n\n if (readOffset != 0)\n read += ln.readLine(line);\n\n while (read < readLength) {\n int r = ln.readLine(line);\n if (r == 0)\n break;\n\n try {\n T record = clazz.newInstance();\n record.fromString(line.toString());\n records.add(record);\n } catch (Exception ex) {\n LOG.warn(\"Unable to instantiate the updateable record type\", ex);\n }\n read += r;\n }\n\n } catch (IOException ex) {\n LOG.error(\"Encountered an error while reading from file \" + file, ex);\n } finally {\n try {\n if (br != null)\n br.close();\n\n if (fis != null)\n fis.close();\n } catch (IOException ex) {\n LOG.error(\"Can't close file\", ex);\n }\n }\n\n LOG.debug(\"Read \" + records.size() + \" records\");\n }", "public String readFirstLine() {\n if ( scanner.hasNextLine() ) {\n return scanner.nextLine();\n }\n return \"\";\n }", "private ClothingItem readItem() {\n System.out.println(\"Read item {id,name,designer,price}\");\n\n BufferedReader bufferRead = new BufferedReader(new InputStreamReader(System.in));\n try {\n Long id = Long.valueOf(bufferRead.readLine());\n String name = bufferRead.readLine();\n String designer = bufferRead.readLine();\n int price = Integer.parseInt(bufferRead.readLine());\n ClothingItem item = new ClothingItem(name, designer, price);\n item.setId(id);\n\n return item;\n\n } catch (IOException ex) {\n ex.printStackTrace();\n }\n return null;\n }", "private void readFile(Scanner s, List<Instance> dest) throws FileNotFoundException {\n\t\t// first, read the training data into some storage location\n\t\twhile (s.hasNextLine()) {\n\t\t\tScanner line = new Scanner(s.nextLine());\n\t\t\tif (!line.hasNext()) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tString result = line.next();\n\t\t\tboolean[] attrs = new boolean[attributeNames.size()];\n\t\t\tfor (int i = 0; line.hasNext(); i++) {\n\t\t\t\tattrs[i] = line.nextBoolean();\n\t\t\t}\n\t\t\t// print\n//\t\t\tSystem.out.print(\"Example \"+result+\" with \");\n//\t\t\tfor (int j = 0; j < attrs.length; j++) {\n//\t\t\t\tSystem.out.print(attrs[j] +\"\\t\");\n//\t\t\t}\n//\t\t\tSystem.out.print(\"\\n\");\n\t\t\t// endprint\n\t\t\tInstance a = new Instance(result,attrs);\n\t\t\tdest.add(a); // finally, add our example\n\t\t\tline.close();\n\t\t}\n\t}", "@Override\n\tpublic String readLine() throws IOException {\n\t\tString line = super.readLine();\n\t\n\t\tif(line==null){\n\t\t\treturn null;\n\t\t}\t\n\t\tline = count+\" \"+line;\n\t\tcount++;\n\t\treturn line;\n\t}", "public void readEntityCSV(String line) {\n List<String> items = Arrays.asList(line.split(\",\"));\n this.setId(Long.valueOf(items.get(0)));\n this.noOfRounds = Integer.parseInt(items.get(1));\n this.caliber = Float.parseFloat(items.get(2));\n this.manufacturer = items.get(3);\n this.price = Float.parseFloat(items.get(4));\n }", "public static Object readObjectFromFile(String filename)\n/* */ throws IOException, ClassNotFoundException\n/* */ {\n/* 122 */ return readObjectFromFile(new File(filename));\n/* */ }", "public ExpenseEntity parse(String line);", "public String getLine1() {\n return line1;\n }", "protected Object readObject(String fileName) throws IOException, ClassNotFoundException {\r\n\t\tObject o = null;\r\n\t\tFileInputStream fis = new FileInputStream(fileName);\r\n\t\tObjectInputStream ois = new ObjectInputStream(fis);\r\n\t\to = ois.readObject();\r\n\t\tois.close();\r\n\t\tfis.close();\r\n\t\t\r\n\t\treturn (o);\r\n\t}", "public Account load() throws IOException {\n Account account = new Account();\n try {\n FileReader fileReader = new FileReader(fileName);\n BufferedReader bufferedReader = new BufferedReader(fileReader);\n String line;\n while ((line = bufferedReader.readLine()) != null) {\n //if (line.contains(\"#\")) { continue; }\n String[] info = line.split(\" @ \");\n\n switch (info[0]) {\n case \"INIT\":\n account.setToInitialize(Boolean.parseBoolean(info[1]));\n break;\n case \"BS\":\n account.setBaseSavings(Float.parseFloat((info[1])));\n break;\n case \"INC\":\n parseIncome(info, account);\n break;\n case \"EXP\":\n parseExpenditure(info, account);\n break;\n case \"G\":\n parseGoal(info, account);\n break;\n case \"INS\":\n parseInstalment(info, account);\n break;\n case \"LOA\":\n parseLoan(info, account);\n break;\n case \"BAN\":\n parseBankAccount(info, account);\n break;\n default:\n throw new DukeException(\"OOPS!! Your file has been corrupted/ input file is invalid!\");\n }\n }\n bufferedReader.close();\n } catch (FileNotFoundException err) {\n final File parentDir = new File(\"dataFG\");\n parentDir.mkdir();\n final String hash = \"moneyAccount\";\n final String fileName = hash + \".txt\";\n final File file = new File(parentDir, fileName);\n file.createNewFile();\n } catch (IOException | DateTimeParseException | DukeException e) {\n e.printStackTrace();\n }\n return account;\n }", "private void readObject() {}", "private void readObject() {}", "private void readObject() {}", "private static String readLine(String filename) throws IOException {\n\t\ttry (BufferedReader reader = new BufferedReader(\n\t\t\t\tnew FileReader(filename), 256)) {\n\t\t\treturn reader.readLine();\n\t\t}\n\t}", "public void readFromFile() {\n //reading text from file\n\n try {\n Scanner scanner = new Scanner(openFileInput(\"myTextFile.txt\"));\n\n while(scanner.hasNextLine()){\n\n String line = scanner.nextLine();\n\n String[] lines = line.split(\"\\t\");\n\n System.out.println(lines[0] + \" \" + lines[1]);\n\n toDoBean newTask = new toDoBean(lines[0], lines[1], 0);\n // System.out.println(line);\n sendList.add(newTask);\n\n }\n\n\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "private static String[] parseInstance(String line) {\n line = line.trim();\n String[] instance = line.split(\",\");\n return instance;\n }", "@Override\n public LineEntity findOne(Long id) throws IllegalArgumentException {\n return null;\n }", "public CommandLine getLine() {\n return line;\n }", "Read createRead();", "private void loadData(){\n try (BufferedReader br = new BufferedReader(new FileReader(this.fileName))) {\n String line;\n while((line=br.readLine())!=null){\n E e = createEntity(line);\n super.save(e);\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "void getNextLine()\n\t\t\tthrows IOException, FileNotFoundException {\n String nextLine = \"\";\n if (reader == null) {\n nextLine = textLineReader.readLine();\n } else {\n nextLine = reader.readLine();\n }\n if (nextLine == null) {\n atEnd = true;\n line = new StringBuffer();\n } else {\n\t\t line = new StringBuffer (nextLine);\n }\n if (context.isTextile()) {\n textilize ();\n }\n\t\tlineLength = line.length();\n\t\tlineIndex = 0;\n\t}", "public void readFromFile(){\n\t\ttry {\r\n\t\t\tFile f = new File(\"E:\\\\Study\\\\Course\\\\CSE215L\\\\Project\\\\src\\\\Railway.txt\");\r\n\t\t\tScanner s = new Scanner(f);\r\n\t\t\tpersons = new Person2 [50]; \r\n\t\t\tint i = 0;\r\n\t\t\t\r\n\t\t\twhile(s.hasNextLine()){\r\n\t\t\t\tString a = s.nextLine();\r\n\t\t\t\tString b = s.nextLine();\r\n\t\t\t\tString c = s.nextLine();\r\n\t\t\t\tString d = s.nextLine();\r\n\t\t\t\tString e = s.nextLine();\r\n\t\t\t\tString g = s.nextLine();\r\n\t\t\t\tString h = s.nextLine();\r\n\t\t\t\tString j = s.nextLine();\r\n\t\t\t\tPerson2 temp = new Person2 (a,b,c,d,e,g,h,j);\r\n\t\t\t\tpersons[i] = temp;\r\n\t\t\t\ti++;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t} catch (Exception e) {\r\n\t\t\tSystem.out.println(e.getMessage());\r\n\t\t}\r\n\t}", "public StreamReader() {}", "private SgfReader load(File file)\n {\n \tFileInputStream in;\n \ttry {\n \t in = new FileInputStream(file);\n \t}\n \tcatch(FileNotFoundException e) {\n \t showError(\"File not found!\");\n \t return null;\n \t}\n \n \tSgfReader sgf;\n \ttry {\n \t sgf = new SgfReader(in);\n \t}\n \tcatch (SgfReader.SgfError e) {\n \t showError(\"Error reading SGF file:\\n \\\"\" + e.getMessage() + \"\\\"\");\n \t return null;\n \t}\n \t\n \treturn sgf;\n }", "@Override\r\n protected void readImpl() {\r\n _recipeId = readD();\r\n }", "public Readln(String id)\n {\n this.id = id;\n }", "public static String readNextLine() {\n return sc.nextLine();\n }", "public abstract T parseLine(String inputLine);", "private ClientInfo getClientInfo(String clientID){\n\n ClientInfo clientInfo = new ClientInfo((clientID));\n\n String clientFile_name = clientID +\".txt\";\n\n File clientFile = new File(ServerInfoDir.CLIENTS_INFO_DIR, clientFile_name);\n\n try{\n //Create object of FileReader\n FileReader inputFile = new FileReader(clientFile);\n\n //Instantiate the BufferedReader Class\n BufferedReader bufferReader = new BufferedReader(inputFile);\n\n //Variable to hold the one line data\n String line = null, groupID = null, postname = null;\n String parts[], posts[];\n\n while ((line = bufferReader.readLine()) != null) {\n parts = line.split(\":\");\n\n clientInfo.subscribe(parts[0]);\n\n if(parts.length > 1) {\n posts = parts[1].split(\",\"); /*Get what the client has read in a group*/\n\n for (String str : posts)\n clientInfo.readPost(parts[0], str);\n }\n\n }\n\n bufferReader.close();\n }catch(Exception e){\n System.out.println(\"Error while reading file:\" + e.getMessage());\n }\n\n\n return clientInfo;\n }", "@Override\n public Ini read(Path path) throws IOException {\n try (Reader reader = Files.newBufferedReader(path)) {\n return read(reader);\n }\n }", "private static StoryModel getStory(File file) {\n StoryModel story = null;\n try {\n story = new StoryModel();\n\n if (!file.exists()) {\n throw new FileNotFoundException();\n }\n else{\n FileInputStream fis = new FileInputStream(file);\n ObjectInputStream ois = new ObjectInputStream(fis);\n story = (StoryModel) ois.readObject();\n ois.close();\n }\n } catch (IOException | ClassNotFoundException e) {\n e.printStackTrace();\n }\n\n return story;\n }", "protected abstract void parse(String line);", "LineReferenceType getLineReference();", "private void readFile(File fp)throws IOException{\n Scanner in=new Scanner(fp);\n String line,s[];\n while(in.hasNext()){\n line=in.nextLine();\n s=line.split(\"[ ]+\");\n if(s.length<3){\n payroll.addLast(new ObjectListNode(new Employee(s[1],s[0])));\n }\n else{\n payroll.addLast(new ObjectListNode(new Employee(s[1],s[0],s[2].charAt(0),s[4].charAt(0),\n Integer.parseInt(s[3]),Double.parseDouble(s[5]))));\n }\n }\n }", "public String readLine() throws IOException {\n\t\t// Punt on this and use BufferedReader routines.\n\t\tBufferedReader d = new BufferedReader(new InputStreamReader(this));\n\t\treturn d.readLine();\n\t}", "T readOne(int id);", "public static Reindeer PARSE(String line) {\n String[] bits = line.split(\" \");\n return new Reindeer(bits[0], Integer.parseInt(bits[3]), Integer.parseInt(bits[6]), Integer.parseInt(bits[13]));\n }", "public static Model loadModel(File f)\n\t{\n\t\ttry\n\t\t{\n\t\t\tBufferedReader reader = new BufferedReader(new FileReader(f));\n\n\t\t\tModel m = new Model(f.getPath());\n\t\t\tMaterial cur = null;\n\t\t\tList<Material> mats = new ArrayList<Material>();\n\n\t\t\tString line;\n\t\t\twhile ((line = reader.readLine()) != null)\n\t\t\t{\n\t\t\t\t//Indicates a vertex\n\t\t\t\tif (line.startsWith(\"v \")) \n\t\t\t\t{\n\t\t\t\t\tfloat x = Float.valueOf(line.split(\" \")[1]);\n\t\t\t\t\tfloat y = Float.valueOf(line.split(\" \")[2]);\n\t\t\t\t\tfloat z = Float.valueOf(line.split(\" \")[3]);\n\t\t\t\t\tm.verts.add(new Vector3f(x, y, z));\n\t\t\t\t} \n\t\t\t\t//Indicates a vertex normal\n\t\t\t\telse if (line.startsWith(\"vn \")) \n\t\t\t\t{\n\t\t\t\t\tfloat x = Float.valueOf(line.split(\" \")[1]);\n\t\t\t\t\tfloat y = Float.valueOf(line.split(\" \")[2]);\n\t\t\t\t\tfloat z = Float.valueOf(line.split(\" \")[3]);\n\t\t\t\t\tm.norms.add(new Vector3f(x, y, z));\n\t\t\t\t} \n\t\t\t\t//Indicates a texture coordinate\n\t\t\t\telse if (line.startsWith(\"vt \")) \n\t\t\t\t{\n\t\t\t\t\tfloat x = Float.valueOf(line.split(\" \")[1]);\n\t\t\t\t\tfloat y = Float.valueOf(line.split(\" \")[2]);\n\t\t\t\t\tm.textureCoords.add(new Vector2f(x, y));\n\t\t\t\t} \n\t\t\t\t//Indicates a face\n\t\t\t\telse if (line.startsWith(\"f \")) \n\t\t\t\t{\n\t\t\t\t\t//If face is triangulated\n\t\t\t\t\tif(line.split(\" \").length == 4)\n\t\t\t\t\t{\t\t\t\n\t\t\t\t\t\tVector3f vertexIndices = new Vector3f(\n\t\t\t\t\t\t\t\tFloat.valueOf(line.split(\" \")[1].split(\"/\")[0]),\n\t\t\t\t\t\t\t\tFloat.valueOf(line.split(\" \")[2].split(\"/\")[0]),\n\t\t\t\t\t\t\t\tFloat.valueOf(line.split(\" \")[3].split(\"/\")[0]));\n\n\n\t\t\t\t\t\t//Instantiate as null for scope reasons\n\t\t\t\t\t\tVector3f textureIndices = null;\n\n\t\t\t\t\t\tif(!line.split(\" \")[1].split(\"/\")[1].equals(\"\")&&!(line.split(\" \")[1].split(\"/\")[1].equals(null)))\n\t\t\t\t\t\t\ttextureIndices = new Vector3f(\n\t\t\t\t\t\t\t\t\tFloat.valueOf(line.split(\" \")[1].split(\"/\")[1]),\n\t\t\t\t\t\t\t\t\tFloat.valueOf(line.split(\" \")[2].split(\"/\")[1]),\n\t\t\t\t\t\t\t\t\tFloat.valueOf(line.split(\" \")[3].split(\"/\")[1]));\n\n\t\t\t\t\t\tVector3f normalIndices = new Vector3f(\n\t\t\t\t\t\t\t\tFloat.valueOf(line.split(\" \")[1].split(\"/\")[2]),\n\t\t\t\t\t\t\t\tFloat.valueOf(line.split(\" \")[2].split(\"/\")[2]),\n\t\t\t\t\t\t\t\tFloat.valueOf(line.split(\" \")[3].split(\"/\")[2]));\n\n\t\t\t\t\t\tFace mf = new Face();\n\n\t\t\t\t\t\t//Instantiate all the arrays\n\t\t\t\t\t\tmf.normals = new Vector3f[3];\n\t\t\t\t\t\tmf.points = new Vector3f[3];\n\n\t\t\t\t\t\t//// SETUP NORMALS ////\n\t\t\t\t\t\tVector3f n1 = m.norms.get((int)normalIndices.x - 1);\n\t\t\t\t\t\tmf.normals[0] = n1;\n\t\t\t\t\t\tVector3f n2 = m.norms.get((int)normalIndices.y - 1);\n\t\t\t\t\t\tmf.normals[1] = n2;\n\t\t\t\t\t\tVector3f n3 = m.norms.get((int)normalIndices.z - 1);\n\t\t\t\t\t\tmf.normals[2] = n3;\n\n\t\t\t\t\t\t//// SETUP VERTICIES ////\n\t\t\t\t\t\tVector3f v1 = m.verts.get((int)vertexIndices.x - 1);\n\t\t\t\t\t\tmf.points[0] = v1;\n\t\t\t\t\t\tVector3f v2 = m.verts.get((int)vertexIndices.y - 1);\n\t\t\t\t\t\tmf.points[1] = v2;\n\t\t\t\t\t\tVector3f v3 = m.verts.get((int)vertexIndices.z - 1);\n\t\t\t\t\t\tmf.points[2] = v3;\n\n\t\t\t\t\t\t//// SETUP TEXTURE COORDS ////\n\t\t\t\t\t\tif(textureIndices!=null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmf.textureCoords = new Vector2f[3];\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfloat x1 = m.textureCoords.get((int)textureIndices.x - 1).x;\n\t\t\t\t\t\t\tfloat y1 = 1 - m.textureCoords.get((int)textureIndices.x - 1).y;\n\t\t\t\t\t\t\tVector2f t1 = new Vector2f(x1, y1);\n\t\t\t\t\t\t\tmf.textureCoords[0] = t1;\n\t\t\t\t\t\t\tfloat x2 = m.textureCoords.get((int)textureIndices.y - 1).x;\n\t\t\t\t\t\t\tfloat y2 = 1 - m.textureCoords.get((int)textureIndices.y - 1).y;\n\t\t\t\t\t\t\tVector2f t2 = new Vector2f(x2, y2);\n\t\t\t\t\t\t\tmf.textureCoords[1] = t2;\n\t\t\t\t\t\t\tfloat x3 = m.textureCoords.get((int)textureIndices.z - 1).x;\n\t\t\t\t\t\t\tfloat y3 = 1 - m.textureCoords.get((int)textureIndices.z - 1).y;\n\t\t\t\t\t\t\tVector2f t3 = new Vector2f(x3, y3);\n\t\t\t\t\t\t\tmf.textureCoords[2] = t3;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t//Set the face's material to the current material\n\t\t\t\t\t\tif(cur != null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmf.material = cur;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t//Tell face to set up AABB\n\t\t\t\t\t\tmf.setUpAABB();\n\n\t\t\t\t\t\tm.faces.add(mf);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//Indicates a reference to an exterior .mtl file\n\t\t\t\telse if(line.startsWith(\"mtllib \"))\n\t\t\t\t{\n\t\t\t\t\t//The file being referenced by mtllib call\n\t\t\t\t\tFile lib = new File(f.getParentFile()+File.separator+line.split(\" \")[1]);\n\n\t\t\t\t\t//Parse it and add all generated Materials to the mats list\n\t\t\t\t\tmats.addAll(parseMTL(lib, m));\n\t\t\t\t}\n\t\t\t\t//Telling us to use a material\n\t\t\t\telse if(line.startsWith(\"usemtl \"))\n\t\t\t\t{\n\t\t\t\t\tString name = line.split(\" \")[1];\n\n\t\t\t\t\tif(mats!=null)\n\t\t\t\t\t\t//Find material with correct name and use it\n\t\t\t\t\t\tfor(Material material : mats)\n\t\t\t\t\t\t\tif(material.name.equals(name))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcur = material;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treader.close();\n\n\t\t\t//Tell model to set up AABB\n\t\t\tm.setUpAABB();\n\t\t\t\n\t\t\t//Remove the first element, because...\n\t\t\tm.faces.remove(0);\n\n\t\t\treturn m;\n\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}", "@Override\n public String readLine() throws IOException {\n checkBuffer(-1);\n this.randomAccessFile.seek(this.fileOffset + this.bufferPointer.bufferOffset);\n String line = this.randomAccessFile.readLine();\n this.fileOffset = this.randomAccessFile.getFilePointer();\n this.bufferPointer.invalidate();\n return line;\n }", "private void readObject() {\n }", "public void readFromFile() {\n\n\t}", "public Record(String line)\t// create a record from a line\n\t{\n\t\tint i;\n\t\trecordMap = new HashMap<>(); \n\t\tStringTokenizer st = new StringTokenizer(line, DELIMITER);\n\n\t\tfor (i=0; i < NUMBER_OF_FIELDS; i++)\n\t\t{\n\t\t\trecordMap.put(i, new Field(FIELD_TYPES[i], FIELD_LABELS[i], st.nextToken()));\n\t\t}\t\t\n\t}" ]
[ "0.708594", "0.6162892", "0.61428934", "0.59305316", "0.59226453", "0.5912085", "0.58915687", "0.5831551", "0.5819366", "0.57927936", "0.57459193", "0.5741549", "0.57317734", "0.57237536", "0.57206553", "0.57149017", "0.57089853", "0.5699932", "0.56990355", "0.5667939", "0.5650758", "0.5647293", "0.56438124", "0.5622193", "0.55733865", "0.5559154", "0.5546588", "0.5544175", "0.5532867", "0.5510088", "0.5489381", "0.54791296", "0.5467891", "0.5447757", "0.54434556", "0.54321665", "0.5424514", "0.54142857", "0.5409039", "0.5404628", "0.5400696", "0.5399845", "0.5391271", "0.53791386", "0.53785956", "0.53703326", "0.5360097", "0.53582627", "0.5351118", "0.5350232", "0.5349469", "0.53463405", "0.53458333", "0.53448963", "0.5340933", "0.5331885", "0.53273374", "0.5326187", "0.5311595", "0.5305925", "0.5302563", "0.52999735", "0.5298693", "0.52918106", "0.5284628", "0.52841604", "0.5282331", "0.5280526", "0.52790296", "0.52790296", "0.52790296", "0.526906", "0.52686316", "0.5265045", "0.5263382", "0.5260115", "0.52493036", "0.5248186", "0.52478033", "0.5246202", "0.5239587", "0.52390677", "0.523334", "0.5227507", "0.52272916", "0.5225062", "0.52236426", "0.5221793", "0.52212113", "0.52204424", "0.52187747", "0.521028", "0.5189373", "0.51789826", "0.5176295", "0.5166059", "0.5163577", "0.5162196", "0.5151382", "0.51507986" ]
0.65069306
1
int count = 0;
@Override public boolean isStopNode(TraversalPosition tp) { // System.out.println( "\nVisited nodes: " + count++); Stop currentStop = cache.get(tp.currentNode()); if (currentStop.getStation().equals(dest)) { return true; } else if ((currentStop.getTime() > stopTime)) return true; else return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "int count();", "int count();", "int count();", "int count();", "int count();", "int count();", "public void incrementCount(){\n count+=1;\n }", "public long count() {\n/* 154 */ return this.count;\n/* */ }", "int fillCount();", "long count();", "long count();", "long count();", "long count();", "long count();", "long count();", "long count();", "public int count() {\n\treturn 1;\n}", "void reset() {\n count = 0;\n\n }", "public int currentCount () {\n return count;\n }", "public int check(){\r\n\r\n\treturn count ++;\r\n\t\r\n}", "public int get_count();", "public static void resetCount() {\n count = 1;\n }", "public static int returnCount()\n {return counter;}", "public int count() {\r\n return count;\r\n }", "public int count() {\n return count;\n }", "public void incCount() { }", "void upCount(){\n count++;\n }", "public long count() {\n\t\treturn 0;\n\t}", "public long count() {\n\t\treturn 0;\n\t}", "public void addCount()\n {\n \tcount++;\n }", "@Override\n\tpublic void count() {\n\t\t\n\t}", "public int count();", "public int count();", "public int count();", "public int count();", "public synchronized int getCount(){\n return count;\n }", "public synchronized int getCount () {\n int c = count;\n count = 0;\n return c;\n }", "public long count() ;", "public long count() { return count.get(); }", "public void incrementCount() {\n count++;\n }", "void incrementCount();", "public void resetCount() {\n\t\tcount = 0;\n\t}", "public int count() {\n\t\treturn count;\n\t}", "private static void setCounter() {++counter;}", "private synchronized void incrementCount()\n\t{\n\t\tcount++;\n\t}", "public void resetCount() {\n count = 0;\n }", "public int count() {\n return this.count;\n }", "private synchronized static void upCount() {\r\n\t\t++count;\r\n\t}", "public static synchronized void inccount()\r\n\t{\r\n\t\tcount++;\r\n\t}", "public void increaseCount(){\n myCount++;\n }", "public int size(){\n return count;\n }", "@Override\r\n\tpublic long count() {\n\t\treturn 0;\r\n\t}", "public synchronized int getCount()\n\t{\n\t\treturn count;\n\t}", "public final native int count()/*-{\r\n\treturn this.count;\r\n\t}-*/;", "@Override\n\tpublic int count() {\n\t\treturn 0;\n\t}", "@Override\n\tpublic int count() {\n\t\treturn 0;\n\t}", "@Override\n\tpublic int count() {\n\t\treturn 0;\n\t}", "@Override\n\tpublic int count() {\n\t\treturn 0;\n\t}", "Integer count();", "Integer count();", "@Override\n\tpublic long count() {\n\t\treturn 0;\n\t}", "@Override\n\tpublic long count() {\n\t\treturn 0;\n\t}", "@Override\n\tpublic long count() {\n\t\treturn 0;\n\t}", "@Override\n\tpublic long count() {\n\t\treturn 0;\n\t}", "@Override\n\tpublic long count() {\n\t\treturn 0;\n\t}", "@Override\n\tpublic long count() {\n\t\treturn 0;\n\t}", "@Override\n\tpublic long count() {\n\t\treturn 0;\n\t}", "@Override\n\tpublic long count() {\n\t\treturn 0;\n\t}", "public void incrementCount() {\n\t\tcount++;\n\t}", "public int size() \n { \n return count; \n }", "public static int getCounter() {return counter;}", "@Override\r\n\t\tpublic int count() {\n\t\t\treturn 0;\r\n\t\t}", "public static int getCount() {\r\n\t\treturn count;\r\n\t}", "public static int getCount() {\r\n\t\treturn count;\r\n\t}", "public static int getCount() {\r\n\t\treturn count;\r\n\t}", "int getInCount();", "public void setCount(int count)\n {\n this.count = count;\n }", "public void setCount(int count)\r\n {\r\n this.count = count;\r\n }", "int findCount();", "@Override\npublic long count() {\n\treturn super.count();\n}", "public void incCounter(){\n counter++;\n }", "public int numberOfOccorrence();", "public long getCount()\n\t{\n\t\treturn count;\n\t}", "public int _count() {\n return _count(\"\");\n }", "public void setCount(int count){\n\t\tthis.count = count;\n\t}", "public void setCount(int count) {\r\n this.count = count;\r\n }", "@Override\n public void initialize() {\n counter = 0;\n }", "@Override\n public void initialize() {\n counter = 0;\n }", "public abstract int count();", "public abstract int count();", "public long count() {\n return this.count;\n }", "public long getCount() {\n return count_;\n }", "public int counter()\n {\n if(count<=825){\n return count++;\n }\n else{ \n count = 0;\n return count;\n }\n }", "public abstract long count();", "private Count() {}", "private Count() {}", "public void incCounter()\n {\n counter++;\n }", "public void set_count(int c);", "public void setCount(Integer count) {\r\n this.count = count;\r\n }", "public static int getCount() {\n\t\treturn count;\n\t}", "public long getCount() {\n return counter.get();\n }" ]
[ "0.7692074", "0.7692074", "0.7692074", "0.7692074", "0.7692074", "0.7692074", "0.764066", "0.7547732", "0.73908883", "0.7390219", "0.7390219", "0.7390219", "0.7390219", "0.7390219", "0.7390219", "0.7390219", "0.73831296", "0.73710144", "0.73618925", "0.73498636", "0.7341898", "0.73242277", "0.7302689", "0.7301312", "0.72727054", "0.7244847", "0.7244628", "0.7239794", "0.7239794", "0.72274494", "0.7225023", "0.72004545", "0.72004545", "0.72004545", "0.72004545", "0.71962297", "0.7167972", "0.7163786", "0.71503323", "0.71457034", "0.7101498", "0.708617", "0.7083355", "0.7082916", "0.7082837", "0.7070071", "0.70396084", "0.7034361", "0.702957", "0.7027416", "0.7020059", "0.701188", "0.7005853", "0.6996592", "0.6979884", "0.6979884", "0.6979884", "0.6979884", "0.69715595", "0.69715595", "0.6961257", "0.6961257", "0.6961257", "0.6961257", "0.6961257", "0.6961257", "0.6961257", "0.6961257", "0.6956519", "0.69443196", "0.690158", "0.6872838", "0.6871982", "0.6871982", "0.6871982", "0.68696195", "0.68306357", "0.6824021", "0.681622", "0.68088657", "0.6804692", "0.67926216", "0.6783297", "0.6778841", "0.6764953", "0.6762317", "0.67527485", "0.67527485", "0.6751373", "0.6751373", "0.6744294", "0.6741858", "0.67343396", "0.6733021", "0.67218524", "0.67218524", "0.6712266", "0.6694308", "0.66901183", "0.6686861", "0.6685544" ]
0.0
-1
Creates a notification object from a NOTIFICATION_TABLE row.
public static Notification fromDatabaseCursor(NotificationManager notifier, Cursor cursor) { Notification notification = new Notification(); notification.notifier = notifier; notification.nid = cursor.getInt(cursor.getColumnIndex(DatabaseHelper.NOTIFICATION_ID)); notification.key = cursor.getString(cursor.getColumnIndex(DatabaseHelper.KEY)); notification.title = cursor.getString(cursor.getColumnIndex(DatabaseHelper.TITLE)); notification.message = cursor.getString(cursor.getColumnIndex(DatabaseHelper.MESSAGE)); notification.appId = cursor.getString(cursor.getColumnIndex(DatabaseHelper.APP_ID)); notification.url = cursor.getString(cursor.getColumnIndex(DatabaseHelper.URL)); notification.emitter = cursor.getString(cursor.getColumnIndex(DatabaseHelper.EMITTER)); notification.sent_date = cursor.getString(cursor.getColumnIndex(DatabaseHelper.SENT_DATE)); return notification; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Notification createFrom(application.Notification notification) {\n Notification noti = this.create(notification);\n Set<Message> messages = this.createMessages(noti);\n noti.messages(messages);\n return noti;\n }", "@Override\n public void createNotification(Notification notification) {\n Player p = Bukkit.getPlayer(notification.getPlayer()); //TODO uuid\n if (p != null && p.isOnline()) {\n showNotification(notification, false);\n }\n try {\n notificationIntegerDao.createIfNotExists(notification);\n } catch (SQLException e) {\n logSQLError(e);\n }\n }", "private synchronized void addClientNotification(SQLiteDatabase db, ClientNotification clientNotification) {\n\n if (clientNotification != null) {\n\n // New value for one column\n ContentValues values = new ContentValues();\n\n values.put(DatabaseSQLContract.ClientNotificationEntry.COLUMN_NAME_NOTIFICATION_TYPE, clientNotification.getBaseNotificationType());\n values.put(DatabaseSQLContract.ClientNotificationEntry.COLUMN_NAME_NOTIFICATION_ID, clientNotification.getId());\n values.put(DatabaseSQLContract.ClientNotificationEntry.COLUMN_NAME_NOTIFICATION_JSON_STRING, clientNotification.getJsonString());\n\n if (clientNotification.getAcknowledgementDetail() != null) {\n values.put(DatabaseSQLContract.ClientNotificationEntry.COLUMN_NAME_ACK_NOTIFICATION_ID, clientNotification.getAcknowledgementDetail().getServerNotificationId());\n values.put(DatabaseSQLContract.ClientNotificationEntry.COLUMN_NAME_ACK_NOTIFICATION_TYPE, clientNotification.getAcknowledgementDetail().getType());\n values.put(DatabaseSQLContract.ClientNotificationEntry.COLUMN_NAME_ACK_NOTIFICATION_RESULT, clientNotification.getAcknowledgementDetail().getResult());\n values.put(DatabaseSQLContract.ClientNotificationEntry.COLUMN_NAME_ACK_NOTIFICATION_SENT_TIME, clientNotification.getAcknowledgementDetail().getSentTime());\n values.put(DatabaseSQLContract.ClientNotificationEntry.COLUMN_NAME_ACK_NOTIFICATION_CUSTOM_NOTIFICATION_TYPE, clientNotification.getAcknowledgementDetail().getCustomNotificationType());\n }\n\n // Insert the new row, returning the primary key value of the new row\n long newRowId;\n newRowId = db.insert(\n DatabaseSQLContract.ClientNotificationEntry.TABLE_NAME,\n null,\n values);\n\n if (newRowId == -1) {\n log.error(\"Error when inserting to DB client notification of type \" + clientNotification.getBaseNotificationType());\n }\n\n }\n }", "Notifiction selectByPrimaryKey(Long id);", "public boolean addNotification(Notification notification) throws SQLException{\n// connection = Db.instance().getConnection();\n try{\n ps = connection.prepareStatement(\"INSERT INTO notification(user_email, text) VALUES (?,?)\");\n ps.setString(1,notification.getUserEmail());\n ps.setString(2,notification.getText());\n int res = ps.executeUpdate();\n return res==1;\n }\n finally {\n Db.close(ps);\n }\n }", "private void addContentNotification(SQLiteDatabase db, ContentNotification contentNotification) {\n\n if (contentNotification != null) {\n\n // New value for one column\n ContentValues values = new ContentValues();\n\n values.put(DatabaseSQLContract.ClientNotificationEntry.COLUMN_NAME_NOTIFICATION_JSON_STRING, contentNotification.getJsonString());\n values.put(DatabaseSQLContract.ClientNotificationEntry.COLUMN_NAME_NOTIFICATION_TYPE, contentNotification.getBaseNotificationType());\n values.put(DatabaseSQLContract.ClientNotificationEntry.COLUMN_NAME_NOTIFICATION_ID, contentNotification.getId());\n\n // Insert the new row, returning the primary key value of the new row\n long newRowId;\n newRowId = db.insert(\n DatabaseSQLContract.ClientNotificationEntry.TABLE_NAME,\n null,\n values);\n\n if (newRowId == -1) {\n log.error(\"Error when inserting to DB content notification.\");\n }\n\n }\n }", "private void createNotification() {\n\t\tIntent notifyIntent = new Intent(this, BirthdayActivity.class);\r\n\t\t// Sets the Activity to start in a new, empty task\r\n\t\tnotifyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\r\n\t\t// Creates the PendingIntent\r\n\t\tPendingIntent pendingIntent = PendingIntent.getActivity(this,\r\n\t\t\t\t(int) System.currentTimeMillis(), notifyIntent,\r\n\t\t\t\tPendingIntent.FLAG_UPDATE_CURRENT);\r\n\r\n\t\tNotificationManagerUtil notificationManagerUtil = NotificationManagerUtil\r\n\t\t\t\t.getInstance();\r\n\t\tnotificationManagerUtil.createNotifications(this, 1, \"Message\",\r\n\t\t\t\tpendingIntent);\r\n\t}", "int insert(Notifiction record);", "Notification getNotificationById(String notificationId) throws NotificationClientException;", "private List<Notification> getNotificationsGeneric(Object parameter, String sql) {\n\t\tPreparedStatement stmt = null;\n\t\tResultSet rs = null;\n\t\tConnection connection = getConnection();\n\t\tVector notifications = new Vector();\n\n\t\ttry {\n\t\t\ttry {\n\t\t\t\tstmt = connection.prepareStatement(sql);\n\t\t\t\tBrokerFactory.getLoggingBroker().logDebug(\"sql=\" + (sql));\n\t\t\t\tif (parameter instanceof Timestamp) {\n\t\t\t\t\tstmt.setTimestamp(1, (Timestamp) parameter);\n\t\t\t\t} else {\n\t\t\t\t\tstmt.setString(1, (String) parameter);\n\t\t\t\t}\n\t\t\t\trs = stmt.executeQuery();\n\n\t\t\t\twhile (rs.next()) {\n\t\t\t\t\tString uuid = rs.getString(1);\n\t\t\t\t\tString senderClassname = rs.getString(2);\n\t\t\t\t\tString memberUuid = rs.getString(3);\n\t\t\t\t\tString confirmedBy = rs.getString(4);\n\t\t\t\t\tString subject = rs.getString(5);\n\t\t\t\t\tboolean requiresConfirmation = rs.getBoolean(6);\n\t\t\t\t\tString status = rs.getString(7);\n\t\t\t\t\tif (status == null) {\n\t\t\t\t\t\tstatus = \"\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstatus = status.toLowerCase();\n\t\t\t\t\t}\n\t\t\t\t\tTimestamp time = rs.getTimestamp(8);\n\t\t\t\t\tString owner = rs.getString(9);\n\t\t\t\t\tString parent = rs.getString(10);\n\t\t\t\t\tString[] senderVariables = new String[10];\n\t\t\t\t\tfor (int i = 0; i < 10; i++) {\n\t\t\t\t\t\tsenderVariables[i] = rs.getString(11 + i);\n\t\t\t\t\t}\n\n\t\t\t\t\tMember member = BrokerFactory.getUserMgmtBroker()\n\t\t\t\t\t\t\t.getUserByUuid(memberUuid);\n\t\t\t\t\tif (member == null)\n\t\t\t\t\t\tmember = BrokerFactory.getGroupMgmtBroker()\n\t\t\t\t\t\t\t\t.getGroupByUuid(memberUuid);\n\n\t\t\t\t\tNotification notification = new Notification(parent,\n\t\t\t\t\t\t\tmember, null, subject, new NotificationMessage[0]);\n\t\t\t\t\tnotification.setAutocommit(false);\n\t\t\t\t\tnotification.setUuid(uuid);\n\t\t\t\t\tnotification.setTime(new java.util.Date(time.getTime()));\n\t\t\t\t\tnotification.setParentUuid(parent);\n\t\t\t\t\tnotification.setOwner(owner);\n\n\t\t\t\t\tif (status == null) {\n\t\t\t\t\t\tnotification.setStatus(Notification.NORMAL);\n\t\t\t\t\t} else if (status.equals(\"expired\")) {\n\t\t\t\t\t\tnotification.setStatus(Notification.EXPIRED);\n\t\t\t\t\t} else if (status.equals(\"confirmed\")) {\n\t\t\t\t\t\tnotification.setStatus(Notification.CONFIRMED);\n\t\t\t\t\t} else if (status.equals(\"pending\")) {\n\t\t\t\t\t\tnotification.setStatus(Notification.PENDING);\n\t\t\t\t\t} else if (status.equals(\"onhold\")) {\n\t\t\t\t\t\tnotification.setStatus(Notification.ONHOLD);\n\t\t\t\t\t} else if (confirmedBy != null) {\n\t\t\t\t\t\tnotification.setStatus(Notification.CONFIRMED);\n\t\t\t\t\t} else if (requiresConfirmation) {\n\t\t\t\t\t\tnotification.setStatus(Notification.PENDING);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnotification.setStatus(Notification.NORMAL);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Load the sender\n\t\t\t\t\ttry {\n\t\t\t\t\t\tNotificationSender sender = (NotificationSender) Class\n\t\t\t\t\t\t\t\t.forName(senderClassname).newInstance();\n\t\t\t\t\t\tfor (int i = 0; i < 10; i++) {\n\t\t\t\t\t\t\tsender.addVariable(i + 1, senderVariables[i]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnotification.setSender(sender);\n\t\t\t\t\t} catch (InstantiationException e1) {\n\t\t\t\t\t\tBrokerFactory.getLoggingBroker().logError(e1);\n\t\t\t\t\t} catch (IllegalAccessException e1) {\n\t\t\t\t\t\tBrokerFactory.getLoggingBroker().logError(e1);\n\t\t\t\t\t} catch (ClassNotFoundException e1) {\n\t\t\t\t\t\tBrokerFactory.getLoggingBroker().logError(e1);\n\t\t\t\t\t}\n\n\t\t\t\t\tnotifications.addElement(notification);\n\n\t\t\t\t\t// Load the options\n\t\t\t\t\tPreparedStatement stmt2 = null;\n\t\t\t\t\tResultSet rs2 = null;\n\t\t\t\t\tString sql2 = \"SELECT optionname FROM notificationoptions WHERE notification=?\";\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tstmt2 = connection.prepareStatement(sql2);\n\t\t\t\t\t\tBrokerFactory.getLoggingBroker().logDebug(\n\t\t\t\t\t\t\t\t\"sql=\" + (sql2));\n\t\t\t\t\t\tstmt2.setString(1, uuid);\n\t\t\t\t\t\trs2 = stmt2.executeQuery();\n\n\t\t\t\t\t\twhile (rs2.next()) {\n\t\t\t\t\t\t\tnotification.addOption(rs.getString(1));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (SQLException e2) {\n\t\t\t\t\t\tBrokerFactory.getLoggingBroker().logError(e2);\n\t\t\t\t\t} finally {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tif (stmt2 != null)\n\t\t\t\t\t\t\t\tstmt2.close();\n\t\t\t\t\t\t\tif (rs2 != null)\n\t\t\t\t\t\t\t\trs2.close();\n\t\t\t\t\t\t} catch (SQLException e3) {\n\t\t\t\t\t\t\tBrokerFactory.getLoggingBroker().logError(e3);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Load the messages\n\t\t\t\t\tList<NotificationMessage> messages = getNotificationMessages(notification);\n\t\t\t\t\tfor (NotificationMessage message: messages) {\n\t\t\t\t\t\tnotification.addMessage(message, false);\n\t\t\t\t\t}\n\t\t\t\t\t// Load the providers\n\t\t\t\t\tsql2 = \"SELECT uuid,classname,status FROM notificationprovider WHERE notification=?\";\n\t\t\t\t\ttry {\n\t\t\t\t\t\tstmt2 = connection.prepareStatement(sql2);\n\t\t\t\t\t\tBrokerFactory.getLoggingBroker().logDebug(\n\t\t\t\t\t\t\t\t\"sql=\" + (sql2));\n\t\t\t\t\t\tstmt2.setString(1, uuid);\n\t\t\t\t\t\trs2 = stmt2.executeQuery();\n\n\t\t\t\t\t\twhile (rs2.next()) {\n\t\t\t\t\t\t\tString providerUuid = rs2.getString(1);\n\t\t\t\t\t\t\tString classname = rs2.getString(2);\n\t\t\t\t\t\t\tString statusOfSend = rs2.getString(3);\n\t\t\t\t\t\t\tPreparedStatement stmt3 = null;\n\t\t\t\t\t\t\tResultSet rs3 = null;\n\t\t\t\t\t\t\tString sql3 = \"SELECT name,value FROM notificationproviderinfo WHERE provider=?\";\n\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tstmt3 = connection.prepareStatement(sql3);\n\t\t\t\t\t\t\t\tBrokerFactory.getLoggingBroker().logDebug(\n\t\t\t\t\t\t\t\t\t\t\"sql=\" + (sql3));\n\t\t\t\t\t\t\t\tstmt3.setString(1, providerUuid);\n\t\t\t\t\t\t\t\trs3 = stmt3.executeQuery();\n\n\t\t\t\t\t\t\t\tHashtable params = new Hashtable();\n\t\t\t\t\t\t\t\twhile (rs3.next()) {\n\t\t\t\t\t\t\t\t\tString name = rs3.getString(1);\n\t\t\t\t\t\t\t\t\tif (name == null)\n\t\t\t\t\t\t\t\t\t\tname = \"\";\n\t\t\t\t\t\t\t\t\tString value = rs3.getString(2);\n\t\t\t\t\t\t\t\t\tif (value == null)\n\t\t\t\t\t\t\t\t\t\tvalue = \"\";\n\t\t\t\t\t\t\t\t\tparams.put(name, value);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tNotificationProvider provider = (NotificationProvider) (Class\n\t\t\t\t\t\t\t\t\t\t.forName(classname).newInstance());\n\t\t\t\t\t\t\t\tprovider.init(params);\n\t\t\t\t\t\t\t\tprovider.setStatusOfSend(notification,\n\t\t\t\t\t\t\t\t\t\tstatusOfSend);\n\t\t\t\t\t\t\t\tnotification.addNotificationProvider(provider);\n\t\t\t\t\t\t\t} catch (SQLException e3) {\n\t\t\t\t\t\t\t\tBrokerFactory.getLoggingBroker().logError(e3);\n\t\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tif (stmt3 != null)\n\t\t\t\t\t\t\t\t\t\tstmt3.close();\n\t\t\t\t\t\t\t\t\tif (rs3 != null)\n\t\t\t\t\t\t\t\t\t\trs3.close();\n\t\t\t\t\t\t\t\t} catch (SQLException e3) {\n\t\t\t\t\t\t\t\t\tBrokerFactory.getLoggingBroker().logError(\n\t\t\t\t\t\t\t\t\t\t\te3);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} catch (SQLException e2) {\n\t\t\t\t\t\tBrokerFactory.getLoggingBroker().logError(e2);\n\t\t\t\t\t} catch (NotificationException e2) {\n\t\t\t\t\t\tBrokerFactory.getLoggingBroker().logError(e2);\n\t\t\t\t\t} catch (ClassNotFoundException e2) {\n\t\t\t\t\t\tBrokerFactory.getLoggingBroker().logError(e2);\n\t\t\t\t\t} catch (InstantiationException e2) {\n\t\t\t\t\t\tBrokerFactory.getLoggingBroker().logError(e2);\n\t\t\t\t\t} catch (IllegalAccessException e2) {\n\t\t\t\t\t\tBrokerFactory.getLoggingBroker().logError(e2);\n\t\t\t\t\t} finally {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tif (stmt2 != null)\n\t\t\t\t\t\t\t\tstmt2.close();\n\t\t\t\t\t\t\tif (rs2 != null)\n\t\t\t\t\t\t\t\trs2.close();\n\t\t\t\t\t\t} catch (SQLException e3) {\n\t\t\t\t\t\t\tBrokerFactory.getLoggingBroker().logError(e3);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tnotification.setAutocommit(true);\n\t\t\t\t}\n\t\t\t} catch (SQLException e) {\n\t\t\t\tBrokerFactory.getLoggingBroker().logError(e);\n\t\t\t} finally {\n\t\t\t\ttry {\n\t\t\t\t\tif (stmt != null)\n\t\t\t\t\t\tstmt.close();\n\t\t\t\t\tif (rs != null)\n\t\t\t\t\t\trs.close();\n\t\t\t\t} catch (SQLException e1) {\n\t\t\t\t\tBrokerFactory.getLoggingBroker().logError(e1);\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tif (connection != null)\n\t\t\t\t\tconnection.close();\n\t\t\t} catch (SQLException e1) {\n\t\t\t\tBrokerFactory.getLoggingBroker().logError(e1);\n\t\t\t}\n\n\t\t}\n\t\treturn notifications;\n\t}", "public static int insert(Notification n) {\n\t\tint status=0;\n\t\ttry {\n\t\t\tConnection connection=MyDBconnectionUtil.getDBconnection();\n\t\t\tPreparedStatement ps=connection.prepareStatement(\n\t\t\t\t\t\"insert into notifications (type,specialMsg) values(?,?)\");\n\t\t\t\t\tps.setInt(1, n.getType());\n\t\t\t\t\tps.setString(2, n.getSpecialMsg());\n\t\t\t\t\tstatus=ps.executeUpdate();\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t}catch(Exception e){\n\t\t\tSystem.out.println(e);\n\t\t}\n\t\treturn status;\n\t}", "@Override\n public void saveNotification(Notification n) {\n try {\n notificationIntegerDao.createOrUpdate(n);\n } catch (SQLException e) {\n logSQLError(e);\n }\n }", "Notification createNewAppointmentNotification(Appointment appointment);", "public void createDeleteNotification (Invite inv) {\n Notification notification = new Notification();\n notification.setRelatedEvent(inv.getEvent());\n notification.setNotificatedUser(inv.getUser());\n notification.setSeen(false);\n notification.setType(NotificationType.deletedEvent);\n notification.setGenerationDate(new Date());\n em.persist(notification);\n //I send the notification mail to the user\n mailManager.sendMail(inv.getUser().getEmail(), \"Deleted Event\", \"Hi! An event for which you have received an invite has been cancelled. Join MeteoCal to discover it.\");\n }", "Row createRow();", "public void createNotification(View view) {\n Intent intent = new Intent(this, Status1.class);\r\n PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);\r\n\r\n // Build notification\r\n // Actions are just fake\r\n Notification noti = new Notification.Builder(this)\r\n .setContentTitle(\"RKC App \")\r\n .setContentText(\"Click To Enter \").setSmallIcon(R.drawable.arc)\r\n .setContentIntent(pIntent)\r\n .addAction(R.drawable.ironman, \"Back\", pIntent)\r\n .addAction(R.drawable.gun, \"More\", pIntent)\r\n .build();\r\n NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);\r\n // hide the notification after its selected\r\n noti.flags |= Notification.FLAG_AUTO_CANCEL;\r\n\r\n notificationManager.notify(0, noti);\r\n\r\n }", "public synchronized void addNotification(ClientNotification clientNotification) {\n if (clientNotification != null) {\n SQLiteDatabase db = databaseSQLHelper.getWritableDatabase();\n addClientNotification(db, clientNotification);\n }\n }", "public static com.b2b2000.agbar.historico.model.NotificationsUser createNotificationsUser(\n\t\tlong id) {\n\t\treturn getService().createNotificationsUser(id);\n\t}", "public cn.com.ho.workflow.infrastructure.db.tables.pojos.TaskDefNotification fetchOneById(String value) {\n return fetchOne(TaskDefNotification.TASK_DEF_NOTIFICATION.ID, value);\n }", "private Notifications createNotifications(JsonNode node) {\n Notifications n = new Notifications();\n for (Iterator<Map.Entry<String, JsonNode>> it = node.fields(); it.hasNext(); ) {\n Map.Entry<String, JsonNode> entry = it.next();\n n.addAll(this.createNotifications(entry.getKey(), entry.getValue()));\n }\n return n;\n }", "public void createInviteNotification(Event e, Users u) {\n Invite invite= new Invite();\n invite.setUser(u);\n invite.setStatus(Invite.InviteStatus.invited);\n invite.setEvent(e);\n em.persist(invite);\n Notification notification = new Notification();\n notification.setType(NotificationType.invite);\n notification.setNotificatedUser(u);\n notification.setRelatedEvent(e);\n notification.setSeen(false);\n notification.setGenerationDate(new Date());\n em.persist(notification);\n mailManager.sendMail(u.getEmail(), \"New Invite\", \"Hi! You have received a new invite\");\n }", "@Override\n\tpublic Notification addNotification(Notification notification, int idUser) {\n\t\treturn dao.addNotification(notification, idUser);\n\t}", "public void createRow(int playerID, int questID, QuestStateEnum state, boolean needingNotification)\n\t\t\tthrows DatabaseException\n\t{\n\t\tConnection connection = DatabaseManager.getSingleton().getConnection();\n\t\tcheckForDuplicateEntry(playerID, questID);\n\t\ttry\n\t\t{\n\t\t\tClosingPreparedStatement stmt = new ClosingPreparedStatement(connection,\n\t\t\t\t\t\"Insert INTO QuestStates SET playerID = ?, questID = ?, questState = ?, needingNotification = ?\");\n\t\t\tstmt.setInt(1, playerID);\n\t\t\tstmt.setInt(2, questID);\n\t\t\tstmt.setInt(3, state.getID());\n\t\t\tstmt.setBoolean(4, needingNotification);\n\t\t\tstmt.executeUpdate();\n\n\t\t} catch (SQLException e)\n\t\t{\n\t\t\tthrow new DatabaseException(\"Couldn't create a quest state record for player with ID \" + playerID\n\t\t\t\t\t+ \" and quest with ID \" + questID, e);\n\t\t}\n\t}", "private void createNotification(FoodEvents event) {\n Context context = getBaseContext();\n NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context).setSmallIcon(R.drawable.ic_launcher).setContentTitle(event.getTitle())\n .setContentText(event.getDescription());\n Intent resultIntent = new Intent(this, EventDetails.class);\n resultIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\n resultIntent.putExtra(EventDetails.EXTRA_EVENT, event);\n PendingIntent resultPendingIntent = PendingIntent.getActivity(getBaseContext(), 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT, null);\n mBuilder.setContentIntent(resultPendingIntent);\n NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);\n mNotificationManager.notify(MESSAGE_NOTIFICATION_ID, mBuilder.build());\n notifyMyWatch(event);\n }", "public Boolean create(Object row) {\n \t\tScheduledTask task = (ScheduledTask) row;\n \t\tGson gson = new Gson();\n \t\t// store single task in redis\n \t\tString set = jedisConn.set(PENDING_TASK(String.valueOf(task.getId())), gson.toJson(task));\n \t\t\n \t\tif (\"ok\".equals(set.toLowerCase())) {\n \t\t\t//store taskid in all tasks list and in user's tasks list\n \t\t\tjedisConn.sadd(ALL_TASKS, String.valueOf(task.getId()));\n \t\t\tjedisConn.sadd(USER_TASKS(String.valueOf(task.getUserId())), String.valueOf(task.getId()));\n \t\t\t\n \t\t\treturn true;\n \t\t}\n \t\telse \n \t\t\treturn false;\n \n \t}", "@Override\n\tpublic int storeRow(java.sql.Connection conn, com.vaadin.data.Item row) throws UnsupportedOperationException, java.sql.SQLException { \n\t String newid = null;\n\t int retval = 0;\n\t try ( java.sql.CallableStatement call = conn.prepareCall(\"{ ? = call EMAIL.EMAILTEMPLATE (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) }\")) {\n\n\t int i = 1;\n\t call.registerOutParameter(i++, java.sql.Types.VARCHAR); \n\t \n\t \t\t\n\t setString(call, i++, getString(row,\"ID\"));\n\t setString(call, i++, getString(row,\"ROWSTAMP\"));\n\n\t setString(call, i++, getString(row, \"EMAILNAME\"));\n\t setString(call, i++, getString(row, \"EMAILSUBJECT\"));\n\t setString(call, i++, getString(row, \"CONTENT\"));\n\t setString(call, i++, getString(row, \"HELPTEXT\"));\n\t setBoolean(call, i++, getOracleBoolean(row, \"ISACTIVE\"));\n\t setString(call, i++, getString(row, \"CREATEDBY\"));\n\t setTimestamp(call, i++, getOracleTimestamp(row, \"CREATED\"));\n\t setString(call, i++, User.getUser().getUserId());\n\t setTimestamp(call, i++, OracleTimestamp.now());\n\t \n\t retval = call.executeUpdate();\n\t newid = call.getString(1);\n\t if(logger.isDebugEnabled()) {\n\t logger.debug(\"newid = {} retval = {}\",newid, retval);\n\t }\n\t }\n\t setLastId(newid);\n\t return retval;\n\t}", "public static Row createRow() {\n\t\treturn new Row(fsco,criteria,columns);\n\t}", "@NonNull\n\tNotificationBuilder newNotification();", "public Notification() {\r\n }", "public Notification() {\r\n }", "public List<cn.com.ho.workflow.infrastructure.db.tables.pojos.TaskDefNotification> fetchByCreateBy(String... values) {\n return fetch(TaskDefNotification.TASK_DEF_NOTIFICATION.CREATE_BY, values);\n }", "private void createSingleReminderNotification(List<Reminder> reminders) {\n\t\tReminder reminder = reminders.get(0);\n\t\tLog.d(TAG, \"single reminder: \" + reminder.toString());\n\t\t\n\t\t// pass the reminder as an intent extra\n\t\tIntent intent = new Intent(this, ReminderActivity.class);\n\t\tintent.putExtra(ReminderActivity.EXTRA_REMINDER, reminder);\n\t\tintent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);\n\t\tPendingIntent pintent = PendingIntent.getActivity(this, 0, intent, 0);\n\t\t\n\t\tString title = getString(Event.getStringIdForType(reminder.getEventType()));\n\t\tString text = reminder.getDescription();\n\t\t\n\t\t// Build the notification\n\t\tNotification not = new NotificationCompat.Builder(this)\n\t\t\t.setContentTitle(title)\n\t\t\t.setContentText(text)\n\t\t\t.setSmallIcon(R.drawable.ic_stat_notificationlogo)\n\t\t\t.setContentIntent(pintent).build();\n\t\tnot.flags |= Notification.FLAG_AUTO_CANCEL;\n\t\t\n\t\t// get notification on screen\n\t\tNotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);\n\t\tnotificationManager.notify(0, not);\n\t}", "SimpleCombineNotifications() {\n baseDir = new File(\"./plugins/NotificationStore/\");\n if (!baseDir.exists()) {\n baseDir.mkdirs();\n }\n try {\n Class.forName(\"org.sqlite.JDBC\");\n } catch (ClassNotFoundException e) {\n log.log(Level.SEVERE, \"Can't find SQLite JDBC class, notifications won't work.\", e);\n return;\n }\n String dbUrl = \"jdbc:sqlite:\" + baseDir.getAbsolutePath() + File.separator + \"data.sqlite\";\n afk = Bukkit.getServicesManager().getRegistration(CombineAFK.class).getProvider();\n try {\n connectionSource = new JdbcConnectionSource(dbUrl);\n notificationIntegerDao = DaoManager.createDao(connectionSource, Notification.class);\n templateIntegerDao = DaoManager.createDao(connectionSource, Template.class);\n TableUtils.createTableIfNotExists(connectionSource, Notification.class);\n TableUtils.createTableIfNotExists(connectionSource, Template.class);\n } catch (SQLException e) {\n logSQLError(e);\n }\n }", "@NonNull\n @Override\n public WaiterNotificationsAdapter.NotificationViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {\n View view = LayoutInflater.from(activity).inflate(R.layout.waiter_notification_row, parent, false);\n return new WaiterNotificationsAdapter.NotificationViewHolder(view);\n }", "public INotification createNotification()\n throws OculusException;", "@Override\n\tpublic Notification getNotification(int idUser) {\n\t\treturn dao.getNotification(idUser);\n\t}", "public static NotificationBatch createEntity(EntityManager em) {\n NotificationBatch notificationBatch = new NotificationBatch()\n .notificationName(DEFAULT_NOTIFICATION_NAME)\n .currentApprover(DEFAULT_CURRENT_APPROVER)\n .parentBatch(DEFAULT_PARENT_BATCH)\n .refLevel(DEFAULT_REF_LEVEL)\n .createdBy(DEFAULT_CREATED_BY)\n .createdDate(DEFAULT_CREATED_DATE)\n .lastUpdatedBy(DEFAULT_LAST_UPDATED_BY)\n .lastUpdatedDate(DEFAULT_LAST_UPDATED_DATE);\n return notificationBatch;\n }", "@Override\n public Participant apply(Row row) {\n return new Participant(row.getString(0), row.getString(1), row.getString(2), row.getString(3), row.getString(4),\n row.getBoolean(5));\n }", "private void retrieveNotification() { =====================================================\n // Creating Notification Model\n // =====================================================\n\n// Bitmap patientAvatar1 = BitmapFactory.decodeResource(getResources(), R.drawable.avatar_18);\n// Bitmap patientAvatar2 = BitmapFactory.decodeResource(getResources(), R.drawable.avatar_19);\n// Bitmap patientAvatar3 = BitmapFactory.decodeResource(getResources(), R.drawable.avatar_20);\n//\n// Patient patient1 = new Patient(\"Garry\", \"Reese\", \"123AB456\", patientAvatar1);\n// Patient patient2 = new Patient(\"Lillian\", \"Wade\", \"987CD654\", patientAvatar2);\n// Patient patient3 = new Patient(\"Laura\", \"Freeman\", \"AV12G64\", patientAvatar3);\n//\n// Bitmap caregiverAvatar1 = BitmapFactory.decodeResource(getResources(), R.drawable.avatar_01);\n// Bitmap caregiverAvatar2 = BitmapFactory.decodeResource(getResources(), R.drawable.avatar_02);\n// Bitmap caregiverAvatar3 = BitmapFactory.decodeResource(getResources(), R.drawable.avatar_03);\n// Bitmap caregiverAvatar4 = BitmapFactory.decodeResource(getResources(), R.drawable.avatar_04);\n// Bitmap caregiverAvatar5 = BitmapFactory.decodeResource(getResources(), R.drawable.avatar_05);\n//\n// DateTime date1 = DateTime.now();\n// DateTime date2 = DateTime.now().minusDays(2).minusHours(2);\n// DateTime date3 = DateTime.now().minusDays(5).plusHours(1);\n// DateTime date4 = DateTime.now().minusDays(4).minusHours(2);\n// DateTime date5 = DateTime.now().minusDays(1).plusHours(1);\n// DateTime date6 = DateTime.now().minusDays(3).plusHours(5);\n//\n// String caregiverName1 = \"John Doe\";\n// String caregiverName2 = \"Jane Doe\";\n// String caregiverName3 = \"Tracy Lee\";\n// String caregiverName4 = \"Apple Tan\";\n// String caregiverName5 = \"Bethany Mandler\";\n//\n// String summary1 = \"Updated information of patient Garry Reese\";\n// String summary2 = \"Log new problem for patient Lilian Wade\";\n// String summary3 = \"Create new patient Laura Freeman\";\n// String summary4 = \"Recommended the game category memory to patient Garry Reese\";\n// String summary5 = \"Updated the milk allergy of patient Lillian Wade\";\n// String summary6 = \"Log new problem for patient Garry Reese\";\n//\n// Notification notification1 = new Notification(date1, caregiverName1, caregiverAvatar1, summary1, patient1, Notification.STATUS_NONE, Notification.TYPE_UPDATE_INFO_FIELD);\n// Notification notification2 = new Notification(date2, caregiverName2, caregiverAvatar2, summary2, patient2, Notification.STATUS_NONE, Notification.TYPE_NEW_INFO_OBJECT);\n// Notification notification3 = new Notification(date3, caregiverName3, caregiverAvatar3, summary3, patient3, Notification.STATUS_NONE, Notification.TYPE_NEW_PATIENT);\n// Notification notification4 = new Notification(date4, caregiverName4, caregiverAvatar4, summary4, patient1, Notification.STATUS_NONE, Notification.TYPE_GAME_RECOMMENDATION);\n// Notification notification5 = new Notification(date5, caregiverName5, caregiverAvatar5, summary5, patient2, Notification.STATUS_NONE, Notification.TYPE_UPDATE_INFO_OBJECT);\n// Notification notification6 = new Notification(date6, caregiverName3, caregiverAvatar3, summary6, patient1, Notification.STATUS_NONE, Notification.TYPE_NEW_INFO_OBJECT);\n//\n ArrayList<Notification> notificationList = new ArrayList<>();\n//// notificationList.add(notification1);\n//// notificationList.add(notification2);\n//// notificationList.add(notification3);\n//// notificationList.add(notification4);\n//// notificationList.add(notification5);\n//// notificationList.add(notification6);\n\n dbfile db = new dbfile();\n notificationList = db.prepareNotificationList(getApplicationContext());\n Log.v(\"WHY LIKE THAT\", String.valueOf(notificationList.size()));\n // =====================================================\n // Building the Notification Group based on the notification\n // =====================================================\n\n HashMap patientAndNotificationGroupMap = new HashMap();\n\n for(Notification notification:notificationList) {\n Patient currentPatient = notification.getAffectedPatient();\n String patientNric = currentPatient.getNric();\n\n if (patientAndNotificationGroupMap.containsKey(patientNric)) {\n NotificationGroup notifGroup = (NotificationGroup) patientAndNotificationGroupMap.get(patientNric);\n if(notification.getStatus() == Notification.STATUS_NONE) {\n notifGroup.getUnprocessedNotif().add(notification);\n } else {\n notifGroup.getProcessedNotif().add(notification);\n }\n } else {\n NotificationGroup newNotifGroup = new NotificationGroup();\n newNotifGroup.setAffectedPatient(currentPatient);\n if(notification.getStatus() == Notification.STATUS_NONE) {\n newNotifGroup.getUnprocessedNotif().add(notification);\n } else {\n newNotifGroup.getProcessedNotif().add(notification);\n }\n patientAndNotificationGroupMap.put(patientNric, newNotifGroup);\n }\n }\n\n ArrayList<NotificationGroup> notificationGroupList = new ArrayList<>();\n NotificationComparator comparator = new NotificationComparator();\n for (Object obj : patientAndNotificationGroupMap.values()) {\n NotificationGroup notificationGroup = (NotificationGroup) obj;\n\n // Set notification status\n UtilsUi.setNotificationGroupStatus(this, notificationGroup);\n\n // Sort the notifications by date\n Collections.sort(notificationGroup.getProcessedNotif(), comparator);\n Collections.sort(notificationGroup.getUnprocessedNotif(), comparator);\n\n // Set the summary\n UtilsUi.setNotificationGroupSummary(this, notificationGroup);\n\n notificationGroupList.add(notificationGroup);\n }\n\n DataHolder.setNotificationGroupList(notificationGroupList);\n }", "public void createDelayNotification (Invite inv) {\n Notification notification = new Notification();\n notification.setRelatedEvent(inv.getEvent());\n notification.setNotificatedUser(inv.getUser());\n notification.setSeen(false);\n notification.setType(NotificationType.delayedEvent);\n notification.setGenerationDate(new Date());\n em.persist(notification);\n \n \n }", "@Override public Notification addNotification(NotificationDto notificationDto) {\n if (notificationRepo.existsByCurrencyAndFrequencyAndSendingValueAndUserId(\n notificationDto.getCurrencyEnum(), notificationDto.getFrequency(),\n notificationDto.getCurrencyVal(), notificationDto.getUserId()\n )) {\n throw new EntityDuplicateException(\"Same notification already exists in db\");\n }\n\n var newNotification = insertNotificationToDb(notificationDto);\n\n jobManager.scheduleJob(newNotification);\n\n return newNotification;\n }", "public Notification() {\n\n }", "public List<Notification> findByUser(NormalUser user);", "public void addNotifications(String header, String message, String actionPath, String type, String imageUrl, String notifDate) throws ClirNetAppException {\n SQLiteDatabase db = this.getWritableDatabase();\n try {\n ContentValues contentValue = new ContentValues();\n\n contentValue.put(MESSAGE, message);\n contentValue.put(HEADER, header);\n contentValue.put(ACTION_PATH, actionPath);\n contentValue.put(TYPE, type);\n contentValue.put(IMAGE_URL, imageUrl);\n contentValue.put(ADDED_ON, notifDate);\n contentValue.put(FLAG, \"0\");\n\n db.insert(TABLE_NOTIFICATIONS, null, contentValue);\n //Log.e(\"notification\",\"notification added\");\n\n } catch (Exception e) {\n throw new ClirNetAppException(\"Error inserting Notifications data\");\n } finally {\n if (db != null) {\n db.close(); // Closing database connection\n }\n }\n\n }", "public TaskDefNotificationDao() {\n super(TaskDefNotification.TASK_DEF_NOTIFICATION, cn.com.ho.workflow.infrastructure.db.tables.pojos.TaskDefNotification.class);\n }", "public PCEPNotification createNotificationMessage(ComputingResponse resp,long timer ){\n\t\tlog.info(\"Timer \"+timer);\n\t\tPCEPNotification notificationMsg = new PCEPNotification();\n\t\tNotify notify=new Notify();\n\t\tNotification notif=new Notification();\n\t\tnotif.setNotificationType(ObjectParameters.PCEP_NOTIFICATION_TYPE_PRERESERVE);\n\t\tLinkedList<Notification> notificationList=new LinkedList<Notification>();\n\t\tPathReservationTLV pathReservationTLV=new PathReservationTLV();\t\t\t\n\t\tpathReservationTLV.setERO(resp.getResponseList().getFirst().getPathList().getFirst().geteRO());\t\t\t\t\t\n\t\tboolean bidirect = resp.getResponseList().getFirst().getRequestParameters().isBidirect();\t\t\n\t\tpathReservationTLV.setTime(timer);\n\t\tpathReservationTLV.setBidirectional(bidirect);\n\t\tnotif.setNotificationTLV(pathReservationTLV);\n\t\tnotificationList.add(notif);\n\t\tnotify.setNotificationList(notificationList);\n\t\tnotificationMsg.addNotify(notify);\n\t\treturn notificationMsg;\t\n\t}", "public abstract void fromProto(Message message, TARGET row);", "@Override\n\tString[] createUniqueQuery(ItemNotification item) {\n\t\treturn null;\n\t}", "public NewsNotifications getSingleNewsNotificationByNewsNotificationId(int newsNotificationId);", "int updateByPrimaryKey(Notifiction record);", "public NotificationStore(){}", "private void setUpNotification() {\n if (getIntent().getExtras() != null) {\n for (String key : getIntent().getExtras().keySet()) {\n Object value = getIntent().getExtras().get(key);\n Logger.e(\"Key: \" + key + \" Value: \" + value);\n\n if(key.equals(\"Key\")) {\n try {\n String idStr = String.valueOf(value);\n int id = Integer.parseInt(idStr);\n onOpenJobItem(id);\n }\n catch (Exception e){\n e.printStackTrace();\n }\n }\n\n }\n }\n // [END handle_data_extras]\n }", "@SuppressWarnings(\"deprecation\")\n\tprivate Notification makeNotification(){\n \tNotification notice = new Notification(R.drawable.ic_action_about, \n \t\t\tgetString(R.string.notice_ticker), System.currentTimeMillis());\n \tnotice.setLatestEventInfo(this, getString(R.string.notice_title), getString(R.string.notice_content), \n \t\t\tPendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class).\n \t\t\t\t\tsetFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP), 0));\n\n \tnotice.flags |= Notification.FLAG_NO_CLEAR;\n \t\n \treturn notice;\n\n }", "public ArrayList<Notification> getAllNotifications(){\n\n \t\tArrayList<Notification> newListofEntries = new ArrayList<Notification>();\n \t\t\n \t\tCursor cur = this.getAllEntriesNotification();\n \t\t\n \t\tif (this.cursorHasRows(cur)) {\n \t\t\tif (cur.moveToFirst()) {\n \t\t\t\tdo {\n \t\t\t\t\tNotification newObjActivity = new Notification();\n \t\t\t\t\n \t\t\t\t\t\tnewObjActivity.notificationID = (cur.getInt(cur.getColumnIndex(\"notificationID\")));\n \t\t\t\t\t\tnewObjActivity.notificationType = Notification.getNOTIFTYPEValue(cur.getInt(cur.getColumnIndex(\"notificationType\")));\n \t\t\t\t\t\tnewObjActivity.notificationState = Notification.getNOTIFSTATEValue(cur.getInt(cur.getColumnIndex(\"notificationState\")));\n \t\t\t\t\t\tnewObjActivity.ref_id = (cur.getString(cur.getColumnIndex(\"ref_id\")));\n \t\t\t\t\t\tnewObjActivity.ref_type = (cur.getString(cur.getColumnIndex(\"ref_type\")));\n \t\t\t\t\t\tnewObjActivity.coachID = (cur.getInt(cur.getColumnIndex(\"coach_id\")));\n \t\t\t\t\t\tnewObjActivity.coachAvatarURL = (cur.getString(cur.getColumnIndex(\"coach_avatar_url\")));\n \t\t\t\t\t\tnewObjActivity.mealID = (cur.getString(cur.getColumnIndex(\"meal_id\")));\n \t\t\t\t\t\tnewObjActivity.timestamp = AppUtil.toDate(new Timestamp(cur.getLong(cur.getColumnIndex(\"timestamp\"))));\n \t\t\t\t\t\tnewObjActivity.coachMessage = (cur.getString(cur.getColumnIndex(\"message\")));\n \t\t\t\t\t\n \t\t\t\t\t\t//add the meal to the array list\n \t\t\t\t\t\tnewListofEntries.add(newObjActivity);\n \t\t\t\t\t\t\n \t\t\t\t\t\t\n \t\t\t\t\t\t\n \t\t\t\t} while (cur.moveToNext());\n \t\t\t}\n \t\t}\n \t\t\n \t\tcur.close();\n \t\treturn newListofEntries;\n \t}", "public ArrayList<Notification> getNotifications(String userEmail) throws SQLException{\n// connection=Db.instance().getConnection();\n try{\n ps = connection.prepareStatement(\"SELECT * FROM notification WHERE user_email=?\");\n ps.setString(1,userEmail);\n rs = ps.executeQuery();\n ArrayList<Notification> resultat = new ArrayList<>();\n while(rs.next()){\n Notification notification = new Notification(rs.getInt(\"id\"),rs.getString(\"user_email\"),rs.getString(\"text\"),rs.getTimestamp(\"time\"));\n notification.setSeen(rs.getInt(\"seen\"));\n resultat.add(notification);\n } return resultat;\n }finally {\n Db.close(rs);\n Db.close(ps);\n }\n }", "Notification createAppointmentConfirmationNotification(Appointment appointment);", "public List<cn.com.ho.workflow.infrastructure.db.tables.pojos.TaskDefNotification> fetchByCreateTime(LocalDateTime... values) {\n return fetch(TaskDefNotification.TASK_DEF_NOTIFICATION.CREATE_TIME, values);\n }", "List<Notification> getNotifications(String lineID);", "public String generateNotificationMessage(NotificationBo notification, String userRecipientId);", "public Notification()\n\t{\n\t\t\n\t}", "private Notifications createNotifications(String type, JsonNode node) {\n Notifications notifications = new Notifications();\n if (type.equals(\"shell\")) {\n if (node.isArray()) {\n for (JsonNode hook : node) {\n notifications.add(\n new Invoke(\n Invoke.WHEN.valueOf(hook.get(\"_on\").asText()),\n hook.get(\"cmd\").asText()));\n }\n } else {\n throw new CatalogException(\"Expected an array of hooks \" + node);\n }\n } else {\n throw new CatalogException(\"Unsupported notifications of type \" + type + \" - \" + node);\n }\n return notifications;\n }", "int insertSelective(Notifiction record);", "public BaseNotificationBuilder(Notification notification) {\n this.notification = notification;\n }", "public Notification() {\n\n\t}", "public void createOrUpdateNotification(Stock stock) {\n Intent intent = new Intent(mContext, MainActivity.class);\n PendingIntent pIntent = PendingIntent.getActivity(mContext, 0, intent, 0);\n\n // Build notification\n // Actions are just fake\n\n int color = stock.getLastDelta() > 0 ? mContext.getResources().getColor(android.R.color.holo_green_light) : mContext.getResources().getColor(android.R.color.holo_red_light);\n\n int change = (int) ((stock.getLastDelta() * 100) / (stock.getPrice() - stock.getLastDelta()));\n String indicator_text = stock.getLastDelta() > 0 ? mContext.getString(R.string.risen) : mContext.getString(R.string.dropped);\n\n DecimalFormat myFormatter = new DecimalFormat(\"##0.00\");\n\n\n String contentText = mContext.getString(R.string.notification_content, stock\n .getSymbol().toUpperCase(), color, indicator_text, myFormatter.format(stock.getPrice()), \"(\" + change +\"%)\");\n\n\n SpannableStringBuilder cs = new SpannableStringBuilder(contentText);\n int start = contentText.indexOf(indicator_text);\n int end = start + indicator_text.length();\n cs.setSpan(new ForegroundColorSpan(color), start, end, Spanned.SPAN_INCLUSIVE_INCLUSIVE);\n\n\n\n Notification noti = new NotificationCompat.Builder(mContext)\n .setContentTitle(mContext.getString(R.string.title))\n .setContentText(cs)\n .setSmallIcon(R.drawable.ic_launcher)\n .setContentIntent(pIntent)\n .build();\n\n NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);\n\n // Hide the notification after its selected\n noti.flags |= Notification.FLAG_AUTO_CANCEL;\n\n notificationManager.notify(stock.getId().intValue(), noti);\n\n\n }", "public Notification()\n\t{\n\t\t// Start of user code constructor for Notification)\n\t\tsuper();\n\t\t// End of user code\n\t}", "public Notification(String message, Long date) {\n this.message = message;\n this.date = date;\n }", "protected void attachNotification(Txn txn) {\r\n }", "public TestNotification GetById(long id) {\n\t\treturn null;\n\t}", "@Override\n\tpublic Notification addNotification(Notification notification) {\n\t\treturn dao.addNotification(notification);\n\t}", "private String getSQL() {\n return \" SELECT * FROM PFEventNotification \";\n }", "public void generarNotifiacion(Context context,String tittle,String text,int icon,int notificationId){\n Intent intent = new Intent(this.context, context.getClass());\n intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);\n PendingIntent pendingIntent = PendingIntent.getActivity(this.context, 0, intent, 0);\n\n NotificationCompat.Builder builder = new NotificationCompat.Builder(this.context, CHANNEL_ID)\n .setSmallIcon(icon)\n .setContentTitle(tittle)\n .setContentText(text)\n .setPriority(NotificationCompat.PRIORITY_DEFAULT)\n .setCategory(NotificationCompat.CATEGORY_MESSAGE)\n // Set the intent that will fire when the user taps the notification\n .setContentIntent(pendingIntent)\n .setAutoCancel(true);\n\n NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this.context);\n\n // notificationId is a unique int for each notification that you must define\n notificationManager.notify(notificationId, builder.build());\n }", "public void createNotification(Context context, String msg, String msgText, String msgAlert, int notifID) {\n\n NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);\n\n Intent repeating_intent = new Intent(context, MainMenu.class);\n repeating_intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\n\n PendingIntent pendingIntent = PendingIntent.getActivity(context, notifID, repeating_intent, PendingIntent.FLAG_UPDATE_CURRENT);\n\n NotificationCompat.Builder builder = new NotificationCompat.Builder(context)\n .setContentIntent(pendingIntent)\n .setSmallIcon(R.drawable.ic_fridge_empty)\n .setContentTitle(msg)\n .setContentText(msgText)\n .setTicker(msgAlert)\n .setColor(0xFFC107) // colour of the circle backgroud\n .setVibrate(new long[]{1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000}) // Vibration\n .setLights(0xFFFF00, 100, 50) // LED\n .setAutoCancel(true);\n\n notificationManager.notify(notifID, builder.build());\n }", "static private Notification getNotificationForEvent(GGEventModel event) {\n Context ctx = SplashActivity.getAppContext();\n\n // Create an explicit intent for an Activity in your app\n Intent intent = new Intent(ctx, EventsActivity.class);\n intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);\n PendingIntent pendingIntent = PendingIntent.getActivity(ctx, 0, intent, 0);\n\n // Builder builder = new Builder(ctx, channel_id)\n Builder builder;\n builder = new Builder(ctx, ctx.getResources().getString(R.string.channel_id) )\n .setSmallIcon(R.drawable.laguilde_logo)\n .setContentTitle(event.getTitle())\n .setContentText(event.getDescription())\n .setPriority(PRIORITY_DEFAULT)\n .setGroup(\"LaGuilde\")\n // Set the intent that will fire when the user taps the notification\n .setContentIntent(pendingIntent)\n .setAutoCancel(true)\n //.setTimeoutAfter(5000)\n // .setUsesChronometer(true)\n .setShowWhen(true)\n //.setWhen( System.currentTimeMillis() - 1000*60*60 )\n .setWhen( event.getDate().getTime() )\n .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))\n ;\n\n // todo: ajouter une image\n\n return builder.build();\n }", "public static void createNotification1(Context context, Reminder reminder) {\n\n\n Intent intent = new Intent(context, SplashActivity.class);\n intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\n PendingIntent pendingIntent = PendingIntent.getActivity(context, 0 /* Request code */, intent,\n PendingIntent.FLAG_ONE_SHOT);\n\n String channelId = context.getString(R.string.default_notification_channel_id);\n Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);\n NotificationCompat.Builder notificationBuilder =\n new NotificationCompat.Builder(context, channelId)\n .setSmallIcon(R.mipmap.ic_launcher)\n .setContentTitle(reminder.getTitle())\n .setContentText(reminder.getContent())\n .setAutoCancel(true)\n .setSound(defaultSoundUri)\n .setContentIntent(pendingIntent);\n\n NotificationManager notificationManager =\n (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);\n\n // Since android Oreo notification channel is needed.\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {\n NotificationChannel channel = new NotificationChannel(channelId,\n \"Channel human readable title\",\n NotificationManager.IMPORTANCE_DEFAULT);\n notificationManager.createNotificationChannel(channel);\n }\n\n notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());\n\n DeleteNotification(reminder,context);\n }", "public String onNewRow(Recordset rs, String rowTemplate) \r\n\t\tthrows Throwable;", "public TestNotification add(TestNotification notif) {\n\t\treturn null;\n\t}", "FromTable createFromTable();", "void mo54412a(int i, Notification notification);", "@Transactional(propagation = Propagation.REQUIRED)\n public NotificationMessage createNotification(final NotificationMessageVO messageVO) {\n Assert.notNull(messageVO.getSubject(), messageHelper.getMessage(\n MessageConstants.ERROR_NOTIFICATION_SUBJECT_NOT_SPECIFIED));\n Assert.notNull(messageVO.getBody(), messageHelper.getMessage(\n MessageConstants.ERROR_NOTIFICATION_BODY_NOT_SPECIFIED));\n Assert.notNull(messageVO.getToUser(), messageHelper.getMessage(\n MessageConstants.ERROR_NOTIFICATION_RECEIVER_NOT_SPECIFIED));\n\n final NotificationMessage message = toMessage(messageVO);\n monitoringNotificationDao.createMonitoringNotification(message);\n\n return message;\n }", "TbMessage selectByPrimaryKey(Integer id);", "public void createWeatherConditionChangedNotification (Users user, Event event) {\n Notification notification = new Notification();\n notification.setGenerationDate(new Date());\n notification.setNotificatedUser(user);\n notification.setRelatedEvent(event);\n notification.setSeen(false);\n notification.setType(NotificationType.weatherConditionChanged);\n em.persist(notification);\n \n }", "@Override\n public EventNotification getEntity(Object id) throws EwpException {\n String sql = \"SELECT * From PFEventNotification where EventNotificationId= '\" + id.toString() + \"'\";\n\n return executeSqlAndGetEntity(sql);\n }", "public void buildNotificationSingle(){\n if(arraylisted.size() ==1){\n Product contact = arraylisted.get(0);\n\n String userDept = arraylisted.get(0).getDept();\n String userName = arraylisted.get(0).getName();\n String userLevel = arraylisted.get(0).getLevel();\n String userID = arraylisted.get(0).getuserID();\n String str = notifyliste.get(0).getEmail();\n if(str.length() >=200){\n int k = str.length() / 2;\n str = str.substring(0,k) + \" ...\";\n }\n String prep = userName + System.getProperty(\"line.separator\") + userLevel + \" Level - \" + userDept;\n byte[] userPics = arraylisted.get(0).getBLOB();\n\n //build the actviity intents\n Intent notificationIntent = new Intent(getApplicationContext(),viewNamsn.class);\n\n notificationIntent.putExtra(\"userName\", userName);\n notificationIntent.putExtra(\"userLevel\", userLevel);\n notificationIntent.putExtra(\"userDept\", userDept);\n notificationIntent.putExtra(\"userID\", userID);\n notificationIntent.putExtra(\"userPics\", userPics);\n\n notificationIntent.setFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY | Intent.FLAG_ACTIVITY_NEW_TASK);\n PendingIntent pend = PendingIntent.getActivity(getApplicationContext(),0,notificationIntent,PendingIntent.FLAG_UPDATE_CURRENT);\n\n //mBuilder = buildNotification(userPics,prep);\n //design the new custom view\n RemoteViews notificationView = new RemoteViews(\n getApplicationContext().getPackageName(),\n R.layout.activity_custom_notification\n );\n Bitmap bitmap = BitmapFactory.decodeByteArray(userPics,0,userPics.length);\n // notificationView.setImageViewResource(R.id.imagenotileft,R.mipmap.ic_launcher);\n notificationView.setImageViewBitmap(R.id.imagenotileft,bitmap);\n // Locate and set the Text into customnotificationtext.xml TextViews\n notificationView.setTextViewText(R.id.title, (getString(R.string.app_name)));\n notificationView.setTextViewText(R.id.text, prep);\n // notificationView.setTextViewText(R.id.qoute, str);\n\n //go and build the notification\n NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getApplicationContext());\n mBuilder.setContentIntent(pend);\n mBuilder.setContentTitle(getString(R.string.app_name));\n mBuilder.setContentText(userName + \" Recently Joined ATBU 37 NAMSSN ELITE E-YEAR BOOK !!!\");\n mBuilder.setTicker(userName + \" Recently Joined ATBU 37 NAMSSN ELITE E-YEAR BOOK !!!\");\n mBuilder.setAutoCancel(true);\n mBuilder.setContent(notificationView);\n mBuilder.setSmallIcon(R.mipmap.ic_app);\n mBuilder.setPriority(2);\n Uri alarmsound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);\n mBuilder.setSound(alarmsound);\n mBuilder.setLights(Color.RED, 3000, 3000);\n mBuilder.setVibrate(new long[]{1000, 1000, 1000, 1000, 1000 });\n //display the notification\n\n NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);\n notificationManager.notify(0123,mBuilder.build());\n }\n // arraylisted.clear();\n }", "SysNotice selectByPrimaryKey(Integer id);", "public String generateNotificationMessage(NotificationBo notification);", "Message create(MessageInvoice invoice);", "@Override\n\tpublic InterChildrenNotification prepareNotification(IntercastNotification notification)\n\t{\n\t\treturn null;\n\t}", "@Test\n public void insertNote_returnRow() throws Exception {\n // Arrange\n Note note = new Note(TestUtil.TEST_NOTE_1);\n LiveDataTestUtil<DataStateStatus<Integer>> liveDataTestUtil = new LiveDataTestUtil<>();\n final int insertedRow = 1;\n Flowable<DataStateStatus<Integer>> returnedData = SingleToFlowable.just(DataStateStatus.success(insertedRow, INSERT_SUCCESS));\n when(localRepository.insertNote(any(Note.class))).thenReturn(returnedData);\n\n // Act\n noteViewModel.setNote(note);\n DataStateStatus<Integer> returnedValue = liveDataTestUtil.getValue(noteViewModel.insertNote());\n\n // Assert\n assertEquals(DataStateStatus.success(insertedRow, INSERT_SUCCESS), returnedValue);\n }", "public void createNotificationChannel() {\n mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);\n\n // Notification channels are only available in OREO and higher.\n // So, add a check on SDK version.\n if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {\n // Create the NotificationChannel with all the parameters.\n NotificationChannel notificationChannel = new NotificationChannel(PRIMARY_CHANNEL_ID,\"Log the game!\", NotificationManager.IMPORTANCE_HIGH);\n notificationChannel.enableLights(true);\n notificationChannel.setLightColor(Color.RED);\n notificationChannel.enableVibration(true);\n notificationChannel.setDescription(\"Reminder to log your game on Friday's at 3:05 pm\");\n mNotificationManager.createNotificationChannel(notificationChannel);\n }\n }", "private void initNotification() {\n Notification.Builder notificationBuilder =\n new Notification.Builder(this).setSmallIcon(R.drawable.notification_anim)\n .setContentTitle(\"Streaming\")\n .setContentText(\"Display mode stream\")\n .setTicker(\"Stream in progress\");\n notificationBuilder.setAutoCancel(true);\n if (notificationManager != null)\n notificationManager.notify(12345, notificationBuilder.build());\n }", "public void initialize() {\n tableIDColumn.setCellValueFactory(new PropertyValueFactory<Table, String>(\"tableID\"));\n occupiedTableColumn.setCellValueFactory(new PropertyValueFactory<Table, Boolean>(\"isOccupied\"));\n\n notification = new Notification();\n notificationArea.getChildren().setAll(notification);\n\n }", "public static void createTable(Database db, boolean ifNotExists) {\n String constraint = ifNotExists? \"IF NOT EXISTS \": \"\";\n db.execSQL(\"CREATE TABLE \" + constraint + \"\\\"TB_CONVERSATION\\\" (\" + //\n \"\\\"id\\\" INTEGER PRIMARY KEY AUTOINCREMENT ,\" + // 0: ID\n \"\\\"is_notify\\\" INTEGER,\" + // 1: isNotify\n \"\\\"msg_src_no\\\" TEXT NOT NULL ,\" + // 2: msgSrcNo\n \"\\\"msg_dst_no\\\" TEXT NOT NULL ,\" + // 3: msgDstNo\n \"\\\"group_no\\\" TEXT,\" + // 4: groupNo\n \"\\\"login_no\\\" TEXT,\" + // 5: loginNo\n \"\\\"last_msg_type\\\" INTEGER,\" + // 6: lastMsgType\n \"\\\"last_msg_content\\\" TEXT,\" + // 7: lastMsgContent\n \"\\\"last_msg_time\\\" INTEGER,\" + // 8: lastMsgTime\n \"\\\"last_msg_status\\\" INTEGER,\" + // 9: lastMsgStatus\n \"\\\"last_msg_direction\\\" INTEGER,\" + // 10: lastMsgDirection\n \"\\\"unread_msg_counts\\\" INTEGER,\" + // 11: unreadMsgCounts\n \"\\\"stick_time\\\" INTEGER);\"); // 12: stickTime\n }", "private void newTask()\n {\n \t//TODO add alarm\n \tTask task = new Task(taskName.getText().toString(), taskDetails.getText().toString());\n \tdb.createTask(task);\n \t//TODO Tie notification to an alarm\n \t//Create notification\n \tIntent notifyIntent = new Intent(this, TaskNotification.class);\n \tnotifyIntent.putExtra(\"title\", task.name); //add title name\n \tnotifyIntent.putExtra(\"id\", (int) task.id); //add id\n \tstartActivity(notifyIntent); //create the intent\n \t\n \trefreshData();\n }", "public DialogNotification setNotification(NotificationModel notification) {\n this.notification = notification;\n return this;\n }", "@Override\n protected Notification loadRequestedObject(Request request) throws ResourceException {\n String notificationIdentifier = UriTemplateParameters.NOTIFICATION_IDENTIFIER.extractFrom(request);\n if (notificationIdentifier == null) {\n throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, \"No Notification Identifier in request\");\n }\n Notification notification = notificationDao.getByGridId(notificationIdentifier);\n if (notification == null) {\n throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND, \"No Notification found for given Id\");\n }\n return notification;\n }", "@Override\n\tpublic void onCreate(SQLiteDatabase db) {\n\t\tdb.execSQL(LogStorageDBInfo.DATABASE_CREATE_RSVMSG_TBL);\n\t\n\t}", "private void setupNotificationCharacteristic() {\n notificationCharacteristic =\n new BluetoothGattCharacteristic(CHARACT_NOTIFICATION_UUID,\n BluetoothGattCharacteristic.PROPERTY_READ | BluetoothGattCharacteristic.PROPERTY_WRITE | BluetoothGattCharacteristic.PROPERTY_NOTIFY,\n BluetoothGattCharacteristic.PERMISSION_READ | BluetoothGattCharacteristic.PERMISSION_WRITE);\n\n notificationCharacteristic.addDescriptor(\n Peripheral.getClientCharacteristicConfigurationDescriptor());\n\n notificationCharacteristic.addDescriptor(\n Peripheral.getCharacteristicUserDescriptionDescriptor(CHARACT_NOTIFICATION_DESC));\n\n notificationCharacteristic.setValue(notificationCharacteristic_value);\n }", "private void createNotification(int icon, String name, String auto_manual, String secondText, int color) {\n\n Intent notificationIntent = new Intent(this, SyncopyActivity.class);\n\n PendingIntent pendingIntent = PendingIntent.getActivity(this,\n 0, notificationIntent, 0);\n Notification notification = new NotificationCompat.Builder(this, CHANNEL_ID)\n .setContentTitle(name)\n .setContentText(secondText)\n .setSubText(String.format(\"(%s)\", auto_manual))\n .setSmallIcon(icon)\n .setColor(getResources().getColor(color))\n .setContentIntent(pendingIntent)\n .setVibrate(null)\n .setSound(null)\n .setPriority(NotificationManager.IMPORTANCE_LOW)\n .build();\n\n synchronized (notification){\n notification.notify();\n }\n\n startForeground(1, notification);\n\n\n }", "RowValues createRowValues();" ]
[ "0.61629945", "0.60044754", "0.57790494", "0.5691992", "0.5638757", "0.55990815", "0.5578428", "0.5455977", "0.53683615", "0.5360267", "0.5342601", "0.5341214", "0.5288853", "0.52433395", "0.52405566", "0.5223624", "0.51819503", "0.5160645", "0.51539165", "0.51295555", "0.51026165", "0.50777286", "0.5069757", "0.5052414", "0.5009549", "0.49951175", "0.4987287", "0.49823916", "0.498031", "0.498031", "0.4979174", "0.49787802", "0.49682206", "0.4966467", "0.4962744", "0.49616572", "0.49581257", "0.49568996", "0.49488315", "0.49394253", "0.4931148", "0.49068534", "0.48907793", "0.48902422", "0.48867348", "0.48793292", "0.48739916", "0.48732865", "0.48729983", "0.4861318", "0.4858758", "0.48571315", "0.4844442", "0.48369065", "0.48322806", "0.48143283", "0.48135385", "0.48033407", "0.47966498", "0.47877485", "0.4778443", "0.4778311", "0.47773668", "0.47745162", "0.4769246", "0.47576544", "0.47541535", "0.47469357", "0.47168812", "0.47063428", "0.4706027", "0.4698821", "0.46981815", "0.46926707", "0.46875376", "0.46842757", "0.46764457", "0.46742737", "0.4671483", "0.4663059", "0.46534202", "0.4645428", "0.46368936", "0.46269313", "0.4624687", "0.46077952", "0.4595303", "0.45952854", "0.4591985", "0.45897937", "0.45897803", "0.4585708", "0.45832622", "0.45787814", "0.45750636", "0.45723376", "0.45693415", "0.45684978", "0.4567859", "0.45649946" ]
0.59886175
2
/ We use a custom title so never request a window title mWindow.requestFeature(Window.FEATURE_NO_TITLE);
public void installContent() { if (mView == null || !canTextInput(mView)) { mWindow.setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM, WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); } else { mWindow.clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); } if (mResId == 0) { mWindow.setContentView(R.layout.qui_alert_dialog); } else { mWindow.setContentView(mResId); } if (mItems != null && mItems.length > 0) { setupMenus(); } else { setupView(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n protected void doBeforeSetContent() {\n \tsuper.doBeforeSetContent();\n \trequestWindowFeature(Window.FEATURE_NO_TITLE);\n }", "public void noTitle() {\n\t\trequestWindowFeature(Window.FEATURE_NO_TITLE);\n\t\tgetWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, \n\t\t\t\tWindowManager.LayoutParams.FLAG_FULLSCREEN);\n\t}", "@Override\n protected void onCreate(Bundle arg0) {\n super.onCreate(arg0);\n // 去掉标题栏\n requestWindowFeature(Window.FEATURE_NO_TITLE);\n }", "public static void removeTitle(Activity activity) {\r\n activity.requestWindowFeature(Window.FEATURE_NO_TITLE);\r\n }", "private void applyCustomTitle() {\r\n\t\tgetWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,\r\n\t\t\t\tR.layout.title_layout);\r\n\t\tmTitle = (TextView) findViewById(R.id.title);\r\n\t\ticon = (ImageView) findViewById(R.id.icon);\r\n\t}", "@Override\n\tpublic void onCreate(Bundle savedInstanceState) {\n requestWindowFeature(Window.FEATURE_NO_TITLE);\n\t\tsuper.onCreate(savedInstanceState);\n\t\t\n\t\tsetupLayout();\n\t}", "private void hideTheWindowTitle() {\n\t\tgetWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,\n\t\t\t\tWindowManager.LayoutParams.FLAG_FULLSCREEN);\n\t\trequestWindowFeature(Window.FEATURE_NO_TITLE);\n\t}", "@Override\n public Dialog onCreateDialog(Bundle savedInstanceState) {\n Dialog dialog = super.onCreateDialog(savedInstanceState);\n dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);\n return dialog;\n }", "@Override\n\tprotected void initTitle() {\n\t\tsetTitleContent(R.string.tocash);\n\t\tsetBtnBack();\n\t}", "@Override\r\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tthis.requestWindowFeature(Window.FEATURE_NO_TITLE);\r\n\t\tsuper.onCreate(savedInstanceState);\r\n\t\tsetContentView(R.layout.activity_help);\r\n\t\tinitView();\r\n\t\tgetData();\r\n\r\n\t}", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n requestWindowFeature(Window.FEATURE_NO_TITLE);\n setContentView(new Panel(this));\n }", "@Override\n\tprotected String getTitle()\n\t{\n\t\treturn null;\n\t}", "@Override\n\tpublic CharSequence getTitle() {\n\t\treturn null;\n\t}", "@Override\r\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tthis.requestWindowFeature(Window.FEATURE_NO_TITLE);\r\n\t\tsuper.onCreate(savedInstanceState);\r\n\t\tsetContentView(R.layout.activity_myinfo);\r\n\t\tinit();\r\n\t}", "@Override\n public void onItemClick(View view, Medal obj, int position) {\n TextView txt;\n final Dialog dialog = new Dialog(getContext());\n dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); // before\n dialog.setContentView(R.layout.popup_medals);\n txt = dialog.findViewById(R.id.titlePop);\n txt.setText(obj.title);\n dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));\n dialog.setCancelable(true);\n dialog.show();\n }", "@Override\r\npublic void setTitle(String title) {\n\tsuper.setTitle(title);\r\n}", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\t//requestWindowFeature(Window.FEATURE_NO_TITLE);\n\t\taddPreferencesFromResource(R.xml.setting_preference);\n\t}", "protected boolean titlePageNeeded(){\n return true;\n }", "@Override\n public void onReceivedTitle(WebView view, String title) {\n getSupportActionBar().setTitle(title);\n }", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\t// 去标题\n\t\trequestWindowFeature(Window.FEATURE_NO_TITLE);\n\t\tsetContentView(R.layout.goods_detail_info);\n\t\tinit();\n\t}", "@Override\r\n public String getTitle()\r\n {\n return null;\r\n }", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\t//this.requestWindowFeature(Window.FEATURE_NO_TITLE);\n\t\tsupportRequestWindowFeature(Window.FEATURE_NO_TITLE);\n\t\tsetContentView(R.layout.chef_dashboard);\n\t\tuserInfo = Sharepreferences.getSharePreferance(this);\n\n\n\t\tsetWidget();\n\n\t}", "@Override\n public void setDefaultActivityTitle() {\n getActivity().setTitle(R.string.app_name);\n }", "public void resetTitle();", "@Override\n public boolean isNoTitle() {\n return true;\n }", "void updateTitle() {\n leftBtn = (Button) findViewById(com.ek.mobilebapp.R.id.custom_title_btn_left);\n leftBtn.setCompoundDrawablesWithIntrinsicBounds(null,\n getResources().getDrawable(com.ek.mobilebapp.R.drawable.more_icon), null, null);\n leftBtn.setOnClickListener(clickListener);\n\n title = (TextView) findViewById(R.id.custom_title_label);\n title.setText(R.string.app_name);\n }", "private void setActivityTitle(){\n binding.actionbar.title.setText(R.string.application_guide);\n }", "private void init_titlebar() {\n\t\tbackBtn = (Button) findViewById(R.id.titlebar_back);\n\t\ttitleTv = (TextView) findViewById(R.id.titlebar_title);\n\t\totherBtn = (Button) findViewById(R.id.titlebar_other);\n\n\t\tbackBtn.setOnClickListener(this);\n\t\ttitleTv.setText(R.string.WXYT);\n\t\totherBtn.setVisibility(View.GONE);\n\t\tprogressBar = (ProgressBar) findViewById(R.id.progressbar);\n\t\tprogressBar\n\t\t\t\t.setScrollBarStyle(android.R.attr.progressBarStyleHorizontal);\n\t}", "public void prepareTitleView(int i) {\n int i2;\n setBackground(getResources().getDrawable(R.drawable.fs_gesture_back_bg, (Resources.Theme) null));\n int i3 = R.string.how_to_use_app_quick;\n switch (i) {\n case 0:\n i2 = R.string.fs_gesture_left_back_ready_summary;\n break;\n case 1:\n i2 = R.string.fs_gesture_right_back_ready_summary;\n break;\n case 2:\n i3 = R.string.how_to_back_home;\n i2 = R.string.fs_gesture_back_home_summary;\n break;\n case 3:\n i3 = R.string.how_to_switch_recents;\n i2 = R.string.fs_gesture_switch_recents_summary;\n break;\n case 4:\n i3 = R.string.how_to_use_drawer;\n i2 = R.string.how_to_use_drawer_summary;\n break;\n case 5:\n i2 = R.string.how_to_use_app_quick_summary;\n break;\n case 6:\n i2 = R.string.how_to_use_app_quick_hide_line_summary;\n break;\n default:\n i2 = 0;\n i3 = 0;\n break;\n }\n i3 = R.string.fs_gesture_back_ready_title;\n TextView textView = this.mTitleView;\n if (textView != null && this.mSummaryView != null) {\n textView.setText(i3);\n this.mSummaryView.setText(i2);\n this.mTitleView.setVisibility(0);\n }\n }", "public void setTitle(String title) {\n// toolbar.setTitle(title);\n// setSupportActionBar(toolbar);\n// resetNavigationOnClickListener();\n titleTextView.setText(title);\n }", "@Override\n\tpublic String getTitle() {\n\t\treturn null;\n\t}", "@Override\n\tpublic String getTitle() {\n\t\treturn null;\n\t}", "@Override\n\tpublic String getTitle() {\n\t\treturn null;\n\t}", "@Override\n\tpublic void InitTitle(Activity activity, TitleBarListener titleBarListener) {\n\t\tImageButton sendBtn = (ImageButton) zActivity.findViewById(R.id.thirdbtn);\n\t\tsendBtn.setVisibility(android.view.View.INVISIBLE);\n\t\t\n\t\tButton closeBtn = (Button) zActivity.findViewById(R.id.CancelBtn);\n\t\tcloseBtn.setOnClickListener(new OnClickListener(){\n\n\t\t\t@Override\n\t\t\tpublic void onClick(android.view.View v) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tzActivity.finish();\n\t\t\t}});\n\t}", "@Override\n\tpublic void setTopView() {\n\t\ttitle.setText(getResources().getString(R.string.mode));\n\t}", "@Override\n\tprotected void setTitleViews() {\n\t\ttitleIvRight.setVisibility(View.INVISIBLE);\n\t\ttitleText.setText(\"历史记录\");\n\t}", "@Override\n protected void updateTitle()\n {\n String frameName =\n SWTStringUtil.insertEllipsis(frame.getName(),\n StringUtil.NO_FRONT,\n SWTStringUtil.DEFAULT_FONT);\n\n view.setWindowTitle(modificationFlag\n + FRAME_PREFIX\n + \": \"\n + project.getName()\n + \" > \"\n + design.getName()\n + \" > \"\n + frameName\n + ((OSUtils.MACOSX) ? \"\" : UI.WINDOW_TITLE));\n }", "private void showCustomDialog() {\n final Dialog dialog = new Dialog(getContext());\n dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); //before\n // Include dialog.xml file\n dialog.setContentView(R.layout.success_dialog);\n TextView btn_home = dialog.findViewById(R.id.btn_home);\n dialog.setCanceledOnTouchOutside(false);\n dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {\n @Override\n public void onCancel(DialogInterface dialog) {\n startActivity(new Intent(getContext(), MainActivity.class));\n getActivity().finish();\n }\n });\n btn_home.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n startActivity(new Intent(getContext(), MainActivity.class));\n getActivity().finish();\n }\n });\n // Set dialog title\n\n dialog.show();\n }", "@Override\r\n\tpublic String getTitle() {\n\t\treturn null;\r\n\t}", "private void setWindowTitle(String title) {\n this.title = title;\n }", "@Override\n protected boolean isNotAddTitle() {\n return true;\n }", "private void makeFullScreen(){\n requestWindowFeature(Window.FEATURE_NO_TITLE);\n // Make it full Screen\n getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);\n }", "@Override\n public void setTitle(CharSequence title) {\n mTitle = title;\n getSupportActionBar().setTitle(mTitle);\n }", "@Override\r\n\t\tpublic String getTitle()\r\n\t\t\t{\n\t\t\t\treturn null;\r\n\t\t\t}", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n requestWindowFeature(Window.FEATURE_NO_TITLE);\n super.onCreate(savedInstanceState);\n\n addPreferencesFromResource(R.xml.preferences);\n\n // Intent intent = getIntent();\n }", "@Override\n\tpublic void setTitle(CharSequence title) {\n\t\t\n\t}", "@Override\r\n public Dialog onCreateDialog(Bundle savedInstanceState) {\r\n // The only reason you might override this method when using onCreateView() is\r\n // to modify any dialog characteristics. For example, the dialog includes a\r\n // title by default, but your custom layout might not need it. So here you can\r\n // remove the dialog title, but you must call the superclass to get the Dialog.\r\n Dialog dialog = super.onCreateDialog(savedInstanceState);\r\n dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);\r\n return dialog;\r\n }", "@Override\n public void title_()\n {\n }", "@Override\n\tpublic final native void setTitle(String title) /*-{\n this.title = title;\n\t}-*/;", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\trequestWindowFeature(Window.FEATURE_NO_TITLE);\n\t\tsetContentView(R.layout.welcome_first);\n\t\n\t init();\n\t\n\t}", "@Override\n\tpublic void setNotificationTitle(@Nullable CharSequence title) {\n\t\tif (title == null) {\n\t\t\ttitleLabel.setText(\"\");\n\t\t} else {\n\t\t\ttitleLabel.setText(title.toString());\n\t\t}\n\t}", "@Override\n\tprotected void titleBtnBack() {\n\t\tsuper.titleBtnBack();\n\t}", "@Override\n\tprotected void onConfigrationTitleBar() {\n\t\tsetTitleBarTitleText(R.string.shujuxiazai);\n setTitleBarLeftImageButtonImageResource(R.drawable.title_back);\n\t}", "@Override\n public void setTitleBar(TitleBar titleBar) {\n super.setTitleBar(titleBar);\n titleBar.hideButtons();\n titleBar.showBackButton();\n titleBar.setSubHeading(getString(R.string.signup));\n }", "@Override\n public Dialog onCreateDialog(Bundle savedInstanceState) {\n // The only reason you might override this method when using onCreateView() is\n // to modify any dialog characteristics. For example, the dialog includes a\n // title by default, but your custom layout might not need it. So here you can\n // remove the dialog title, but you must call the superclass to get the Dialog.\n Dialog dialog = super.onCreateDialog(savedInstanceState);\n dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);\n return dialog;\n }", "@Override\n\tpublic void setTitle(java.lang.String title) {\n\t\t_scienceApp.setTitle(title);\n\t}", "private void initToolbarTitle() {\n Toolbar toolbar = (Toolbar) getActivity().findViewById(R.id.toolbar);\n toolbar.setTitle(R.string.string_settings);\n }", "@Override\n\tpublic void setTitle(String title) {\n\t\t\n\t}", "public void showTitleScreen() {\n frame.showMenu();\n }", "@Override\r\npublic String getTitle() {\n\treturn super.getTitle();\r\n}", "@Override\r\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\r\n\t\trequestWindowFeature(Window.FEATURE_NO_TITLE);\r\n\t\tsetContentView(R.layout.address);\r\n\t}", "@Override\r\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\trequestWindowFeature(Window.FEATURE_NO_TITLE);\r\n\t\tsuper.onCreate(savedInstanceState);\r\n\t\tshezhi.getInstance().addActivity(this);//退出时杀死所有activity\r\n\t\tsetContentView(R.layout.procurementlistdetails);\r\n\t\tinitview();\r\n\t\tinitPopupWindow();\r\n\t\t//\t\tgetcaigoujihualist();\r\n\t}", "@Override\n public CharSequence getPageTitle(int position) {\n return null;\n }", "@Override\n public CharSequence getPageTitle(int position) {\n return null;\n }", "@Override\n public CharSequence getPageTitle(int position) {\n return null;\n }", "private void setTitleMap(String title){\n if(title!=null && titleView.getVisibility() != View.GONE) {\n if (title.length() <= 50)\n titleView.setText(title);\n else\n titleView.setText(title.substring(0, 50));\n }\n }", "@Override\n\tpublic void setTitle(int resId) {\n\t\t\n\t}", "protected void removeTitle(){\n canvas.remove(titleBorder);\n canvas.remove(titleBox);\n canvas.remove(title);\n canvas.remove(startBorder);\n canvas.remove(startBox);\n canvas.remove(startText);\n }", "@Override\n\tpublic void onTitleChanged(String newTitle) {\n\t\tif (!newTitle.matches(\"\")) {\n getSupportActionBar().setSubtitle(newTitle);\n }\n\t}", "public void setTitle(int title){\n if (getSupportActionBar() != null) {\n getSupportActionBar().setTitle(title);\n }\n }", "public void resetToTitle() {\r\n\t\tmainFrame.getContentPane().removeAll();\r\n\t\tmainFrame.getContentPane().add(titlePanel);\r\n\t\tmainFrame.repaint();\r\n\t}", "@Override\n\tprotected void onResume() {\n\t\tsuper.onResume();\n\t\tInitTitleView();\n\t}", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tthis.requestWindowFeature(Window.FEATURE_NO_TITLE);\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(R.layout.layout_wallpaper_manage);\n\t\tinitData();\n\t\tinitViews();\n\n\t}", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n requestWindowFeature(Window.FEATURE_NO_TITLE);\n getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);\n \n \n setContentView(R.layout.main);\n registerForContextMenu(findViewById(R.id.mainView));\n }", "private void setTitlePage() {\n mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {\n @Override\n public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {\n Log.d(\"onPageScrolled\", \"Khi scroll được gọi,\" + \"Mới\" + position);\n }\n\n @Override\n public void onPageSelected(int position) {\n Log.d(\"SELECT TAB\", mTabTitle[position]);\n if (position == 0) {\n if (AppSingleton.isClickDetail == false) {\n getSupportActionBar().setTitle(mTabTitle[0]);\n } else {\n getSupportActionBar().setTitle(mTitleDetail);\n }\n mCustomMenu.findItem(R.id.change_view_actionbar).setVisible(true);\n mCustomMenu.findItem(R.id.action_search).setVisible(false);\n } else if (position == 1) {\n getSupportActionBar().setTitle(mTabTitle[1]);\n if (mCustomMenu != null) {\n mCustomMenu.findItem(R.id.change_view_actionbar).setVisible(false);\n mCustomMenu.findItem(R.id.action_search).setVisible(true);\n }\n\n } else if (position == 2) {\n getSupportActionBar().setTitle(mTabTitle[2]);\n if (mCustomMenu != null) {\n mCustomMenu.findItem(R.id.change_view_actionbar).setVisible(false);\n mCustomMenu.findItem(R.id.action_search).setVisible(false);\n\n }\n\n\n } else if (position == 3) {\n getSupportActionBar().setTitle(mTabTitle[3]);\n if (mCustomMenu != null) {\n mCustomMenu.findItem(R.id.change_view_actionbar).setVisible(false);\n mCustomMenu.findItem(R.id.action_search).setVisible(false);\n }\n\n }\n// getSupportActionBar().setTitle(tabTitle[position]);\n\n }\n\n @Override\n public void onPageScrollStateChanged(int state) {\n\n }\n\n });\n\n }", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\trequestWindowFeature(Window.FEATURE_NO_TITLE);// 隐藏头部\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(R.layout.province_layout);\n\t\tintent = this.getIntent();\n\t\tinitView();\n\t\tclickOn();\n\t}", "@Override\r\n\t\tpublic void setTitle(String title)\r\n\t\t\t{\n\t\t\t\t\r\n\t\t\t}", "protected abstract void setTitle();", "@Override\r\n\tpublic void onCreate(Bundle savedInstanceState) {\r\n\t super.onCreate(savedInstanceState);\r\n\t\trequestWindowFeature(Window.FEATURE_NO_TITLE);\r\n\t\tsetContentView(R.layout.activity_setting);\t\r\n\t\tinitView();\r\n\t\tregistEvent();\r\n\t}", "@Override\n\tpublic String getTitle() {\n\t\t// TODO Auto-generated method stub\n\t\treturn null;\n\t}", "protected String getHomePageTitle() { \n return null; \n }", "@Override\n\tprotected void onCreate(Bundle savedInstanceState)\n\t{\n\t\t\n\t\t\n\t\tsuper.onCreate(savedInstanceState);\n\t\tthis.requestWindowFeature(Window.FEATURE_NO_TITLE);\n\t\tthis.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);\n setContentView(new FightSurfaceView(this));\n\t}", "@Override\r\n\tpublic void onCreate(Bundle savedInstanceState) {\r\n\t super.onCreate(savedInstanceState);\r\n\t //Set full screen\r\n requestWindowFeature(Window.FEATURE_NO_TITLE);\r\n getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);\r\n setContentView(R.layout.creditlayout);\r\n setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);\r\n\t}", "public void setNewTitle(final String title){\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n setTitle(title);\n }\n });\n }", "@Override\n\tprotected void onResume() {\n\t\tCustomTitleBar.setActivity(this);\n\t\tinitView();\n\t\tsuper.onResume();\n\t}", "public void setPrefTitle(int resId) {\n if (getActivity() == null)\n return;\n\n ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();\n if (actionBar != null) {\n actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME\n | ActionBar.DISPLAY_USE_LOGO\n | ActionBar.DISPLAY_SHOW_TITLE);\n\n actionBar.setLogo(R.drawable.ic_icon);\n actionBar.setTitle(resId);\n }\n }", "@Override\n public void title()\n {\n }", "public void setTitle(String strTitle) { m_strTitle = strTitle; }", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(R.layout.xtsz_set_attention);\n\t\ttitleLayout =(View) findViewById(R.id.titlelayout);\n\t\tinitView(titleLayout);\n\t\tsetLeftButtonAble(true, \"返回\");\n\t\tsetTitle(\"设置\");\n\t}", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\trequestWindowFeature(Window.FEATURE_NO_TITLE);\n\t\tsetContentView(R.layout.config_input_layout);\n\t}", "@Override\n public void setTheme(int resid) {\n super.setTheme(android.R.style.Theme_Translucent_NoTitleBar);\n /*String packageName = getIntent().getStringExtra(Intent.EXTRA_PACKAGE_NAME);\n if(packageName.contains(\"kaer\") || packageName.contains(\"com.android\")){\n Log.e(\"ReviewPermissionsActivity\", \"setTheme Theme_Translucent_NoTitleBar\");\n super.setTheme(android.R.style.Theme_Translucent_NoTitleBar);\n }else{\n Log.e(\"ReviewPermissionsActivity\", \"setTheme ActivityNormal\");\n super.setTheme(R.style.ActivityNormal);\n }*/\n }", "@Override\r\n\tpublic void setContentView(View view) {\r\n\t\tsuper.setContentView(view);\r\n\t\tapplyCustomTitle();\r\n\t}", "private void m403g() {\n C3433a2 a2Var = this.f857a;\n if (a2Var != null) {\n String title = a2Var.getTitle();\n String titleTextColor = this.f857a.getTitleTextColor();\n String titleBackgroundColor = this.f857a.getTitleBackgroundColor();\n if (!TextUtils.isEmpty(title)) {\n this.f848j.setText(title);\n }\n if (!TextUtils.isEmpty(titleBackgroundColor)) {\n try {\n this.f847i.setBackgroundColor(Color.parseColor(titleBackgroundColor));\n } catch (Exception unused) {\n C3490e3.m666f(\"Error on set title background color\");\n }\n }\n if (!TextUtils.isEmpty(titleTextColor)) {\n try {\n this.f848j.setTextColor(Color.parseColor(titleTextColor));\n Drawable navigationIcon = this.f847i.getNavigationIcon();\n if (navigationIcon != null) {\n navigationIcon.setColorFilter(Color.parseColor(titleTextColor), PorterDuff.Mode.MULTIPLY);\n }\n } catch (Exception unused2) {\n C3490e3.m666f(\"Error on set title text color\");\n }\n }\n }\n }", "public void setPaneTitle(@RecentlyNullable CharSequence paneTitle) {\n/* 1045 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "@Override\r\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\r\n//\t\trequestWindowFeature(Window.FEATURE_NO_TITLE);\r\n\t\t\r\n\t\tsetContentView(R.layout.multiroom_list);\r\n\t\tinitial();\r\n\t}", "@Override\n\tprotected String getHeaderTitle() {\n\t\treturn \"\";\n\t}", "@Override\r\n\tpublic void getTitle() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void setContentView(int layoutResID) {\r\n\t\tsuper.setContentView(layoutResID);\r\n\t\tapplyCustomTitle();\r\n\t}", "void setTitle(String title);", "void setTitle(String title);", "void setTitle(String title);" ]
[ "0.854192", "0.83509696", "0.8029291", "0.76789516", "0.7675539", "0.7507685", "0.7476689", "0.694515", "0.6876521", "0.674556", "0.66813725", "0.6668384", "0.66584885", "0.6629862", "0.6581953", "0.6541012", "0.653346", "0.65314925", "0.6509026", "0.65038323", "0.6489747", "0.6458713", "0.644249", "0.6375228", "0.6371983", "0.630791", "0.63060844", "0.6299742", "0.62847066", "0.6272507", "0.62709206", "0.62709206", "0.62709206", "0.62683046", "0.6264183", "0.62591875", "0.6250548", "0.62435526", "0.6217965", "0.61885434", "0.61640567", "0.61492985", "0.6148119", "0.6143258", "0.6132506", "0.6130805", "0.6130786", "0.6099161", "0.60896677", "0.60846287", "0.6079314", "0.60734594", "0.6047656", "0.6026345", "0.60205555", "0.6019887", "0.6011318", "0.6009156", "0.60070354", "0.5986636", "0.5984589", "0.5975455", "0.5962759", "0.5962759", "0.5962759", "0.59603095", "0.5956105", "0.5951008", "0.59370065", "0.5928025", "0.59249294", "0.59116316", "0.59036404", "0.5901637", "0.5899992", "0.5895208", "0.5890914", "0.5882806", "0.5881101", "0.58721006", "0.5869271", "0.5867393", "0.58648634", "0.58613527", "0.58571476", "0.58488965", "0.58468705", "0.5844725", "0.58425236", "0.5833302", "0.5824691", "0.58001775", "0.57992107", "0.57963735", "0.5774584", "0.5773528", "0.5771776", "0.57664233", "0.57620275", "0.57620275", "0.57620275" ]
0.0
-1
Set the view to display in the dialog.
public void setView(View view) { mView = view; mViewSpacingSpecified = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setView(View view);", "public void setView(View view) {\n\t\tthis.view = view;\n\t}", "@Override\n\tpublic void setView(View view) {\n\n\t}", "public void setView(View view) {\n this.view = view;\n this.model = view.getModel();\n initControl();\n }", "public void setView(AddSegmentDialog view) {\n View = view;\n }", "void setView(View v);", "public void setView(final String view) \n {\n\tthis.view = view;\n }", "public void setView(View v)\n {\n\tthis.view = v;\n\tif (this.view != null)\n\t{\n\t addActionListeners();\n\t}\n }", "protected void setView(@NonNull T view) {\n mView = view;\n }", "public void setView(CMView _view) {\n mView = _view;\n }", "void setView(PopupView<T> view);", "public void setView(IHUDView view) {\n\n this.view = view;\n stateChange(uiStateManager.getState());\n playerAttributeChange();\n }", "@Override\n\tpublic FileSelectDialog setView(View view) {\n\t\tthrow new Error(\"You cannot customize the view of a FileSelectDialog, \" +\n\t\t\t\t\"this feature would override the actual list\");\n\t}", "protected void setCurrentView( final View view )\n {\n updater.setCurrentView( view );\n }", "public void setView(java.lang.Boolean view) {\n this.view = view;\n }", "@Override\n\tpublic void show() {\n\t\tGameView.VIEW.addDialog(this);\n\t\tsuper.show();\n\t}", "protected final void setView(View v) {\n rootView.setView(v);\n painted = false;\n editor.revalidate();\n editor.repaint();\n }", "private void setUpView()\n {\n view = new DefaultDrawingView();\n DrawingEditorProxy editor = new DrawingEditorProxy();\n editor.setTarget(new DefaultDrawingEditor());\n view.addNotify(editor);\n for (Handle h : handles)\n h.setView(view);\n }", "public void setView(int view)\r\n\t{\n\t\tswitch(view)\r\n\t\t{\r\n\t\t\tcase Settings.ANONYMOUS_VIEW:\r\n\t\t\t\tbreak;\r\n\t\t\tcase Settings.WELCOME_VIEW:\r\n\t\t\t\tbreak;\r\n\t\t\tcase Settings.ACCOUNT_VIEW:\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\t\t\r\n\t}", "@Override\n\tprotected void setView() {\n\t\tsetContentView(R.layout.activity_main);\n\t}", "protected abstract void setupMvpView();", "private void setViews() {\n\n }", "public void setView(final BwView val) {\n view = val;\n }", "public void setView(Component view){\n int n=getComponentCount();\n for(int i=n-1;i>=0;i--){\n remove(getComponent(i));\n }\n isViewSizeSet=false;\n if(view!=null){\n super.addImpl(view,null,-1);\n viewListener=createViewListener();\n view.addComponentListener(viewListener);\n }\n if(hasHadValidView){\n // Only fire a change if a view has been installed.\n fireStateChanged();\n }else if(view!=null){\n hasHadValidView=true;\n }\n viewChanged=true;\n revalidate();\n repaint();\n }", "private void setContentView(View view) {\n mContentView = view;\n }", "@Override\r\n\tpublic void setView(ViewProduct v) {\n\t\tthis.view = v;\r\n\t}", "void makeDialog()\n\t{\n\t\tfDialog = new ViewOptionsDialog(this.getTopLevelAncestor());\n\t}", "public void initView() {\n\t\t view.initView(model);\t \n\t }", "public ShowView() {\n\t\tsuper(null);\n\t\tcreateActions();\n\t\taddToolBar(SWT.FLAT | SWT.WRAP);\n\t\taddMenuBar();\n\t\taddStatusLine();\n\t}", "public TournamentSetting_View(RiskStart_View start_view, boolean modality)\r\n\t{\r\n\t\tsetTitle(\"Setting Tournament Mode\");\r\n setPreferredSize(new Dimension(200, 200));\r\n setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);\r\n setResizable(false);\r\n add(tournamentSettingPanel());\r\n setLocationRelativeTo(null);\r\n pack();\r\n\t}", "private void setViews() {\n lv.setAdapter(adapter);\n\n dialog2 = new MiddleDialog2(INSTANCE, getResources().getString(R.string.title), getResources().getString(R.string.value), new MiddleDialog2.onBottonListener() {\n @Override\n public void onOk() {\n\n finish();\n }\n },R.style.registDialog);\n }", "@Override\n\tpublic void findView() {\n\t\tinitUI();\n\t}", "public void setView(FruitView newView){\n\t\tthis.view = newView;\n\t}", "@Override\n protected void initView() {\n }", "@Override\n protected void initView() {\n }", "@Override\n\tpublic void InitView() {\n\t\t\n\t}", "public Get setView(java.lang.String view) {\n this.view = view;\n return this;\n }", "@Override\r\n\tprotected void initView() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initView() {\n\t\t\r\n\t}", "public void setControlView() {\n\t\tif (mControlView != null) {\n\t\t\tmControlView.setRepeat(Const.FILTER_TEXT);\n\t\t\tmControlView.setPhotoTimeType(mLogicManager.getPageNum());\n\t\t\tmControlView.setFileName(mLogicManager\n\t\t\t\t\t.getCurrentFileName(Const.FILTER_TEXT));\n\t\t\tmControlView.setFilePosition(mLogicManager.getTextPageSize());\n\t\t}\n\t\tif(null!=mInfo && mInfo.isShowing())\n\t\t{\n\t\t\tmInfo.setTextView();\n\t\t}\n\t}", "@Override\n public void initView() {\n }", "public void setView(SimulationManagerView newView) throws SimulationException {\n try {\n theSimManagerView = newView;\n \n theSimManagerView.tick(theCoorInt.getCurrentSimulationTime()); \n theSimManagerView.setScriptStatus(theCoorInt.getScriptStatus());\n theSimManagerView.setParamicsStatus(theCoorInt.getParamicsStatus());\n \n initialize();\n }\n catch (RemoteException re) {\n simManagerLogger.logp(Level.SEVERE, \"SimulationManagerModel\", \n \"startSimulation\", \"Unable to communicate with the \" +\n \"CAD Simulator.\", re);\n \n throw new SimulationException(SimulationException.CAD_SIM_COMM, re);\n } \n \n }", "private void changeView(){\r\n\t\t\tm.changeView(Views.GAME, gameType, game);\r\n\t}", "public void showView(){\n this.addObserver(GameView.GameViewNewGame(this));\n }", "public void howtouse(View view) {\n showdialog();\n }", "@Override\r\n\tpublic void initView() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void initView() {\n\t\t\r\n\t}", "@Override\n\tpublic void setCustomView(View view) {\n\t\t\n\t}", "private void setupView() {\n view.setName(advertisement.getTitle());\n view.setPrice(advertisement.getPrice());\n view.setDescription(advertisement.getDescription());\n view.setDate(advertisement.getDatePublished());\n view.setTags(advertisement.getTags());\n setCondition();\n if (advertisement.getImageUrl() != null) { //the url here is null right after upload\n view.setImageUrl(advertisement.getImageUrl());\n }\n }", "public void showViewAddDirection(){\n JDialog dialogAddDirections = new JDialog();\n\n \n dialogAddDirections.setContentPane(addressView);\n new AddressController(addressView);\n dialogAddDirections.setLocationRelativeTo(null);\n dialogAddDirections.pack();\n dialogAddDirections.setVisible(true);\n }", "@Override\n public void setView(@NonNull final View view) {\n mNextView = view;\n }", "private void setDialog()\n {\n //this.setSize(350,500);\n this.setTitle(Constant.getTextBundle(\"ปฏิกิริยาต่อกัน\"));\n Toolkit thekit = this.getToolkit(); \n Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();\n this.setLocation((screenSize.width-this.getSize().width)/2, (screenSize.height-this.getSize().height)/2);\n }", "void setPlayerView(View v);", "public Builder setContentView(View v) {\r\n this.contentView = v;\r\n return this;\r\n }", "@Override\n\tprotected void initView() {\n\t\t\n\t}", "@Override\n\tprotected void initView() {\n\t\t\n\t}", "public void configure(T aView) { aView.setPrefSize(110,20); }", "@Override\n\tpublic void initView() {\n\t\t\n\t}", "@Override\n public void initView() {\n\n }", "private void initView() {\n\n }", "@SuppressWarnings(\"deprecation\")\n public void setDate(View view) {\n showDialog(999);\n }", "public View() {\n initComponents();\n Paypal.setVisible(false);\n MasterCard.setVisible(false);\n Visa.setVisible(false);\n setLocationRelativeTo(null);\n setResizable(false);\n setDefaultCloseOperation(DISPOSE_ON_CLOSE);\n generarFacturaBoton.setVisible(false);\n }", "public IView() {\n initComponents();\n setLocationRelativeTo(null); //Center form on screen\n }", "public void displayView(View parentView) {\n getView().displayView(parentView);\n }", "@Override\n\tprotected void initView()\n\t{\n\n\t}", "public Builder setContentView(View v) {\n this.contentView = v;\n return this;\n }", "public Builder setContentView(View v) {\n this.contentView = v;\n return this;\n }", "@Override\n\tpublic void setView(Resultado resultado, HttpServletRequest request, HttpServletResponse response) {\n\n\t}", "void showSelectedAgentView();", "public VendaComputadorView() {\n initComponents();\n this.setLocationRelativeTo(null);\n }", "public View() {\n this.view = new ViewPanel();\n //this.view.setGraph(this.graph);\n initComponents();\n this.m_algoritmos.setEnabled(false);\n this.mi_maze.setEnabled(false);\n this.mi_salvarImagem.setEnabled(false);\n }", "public void switchView(View view) {\r\n\t\tthis.currentView = view;\r\n\t\trenderView();\r\n\t}", "protected abstract void initializeView();", "public void show(View view) {\n\n showAtLocation(view, Gravity.CENTER, 0, 0);\n showAsDropDown(view);\n }", "public void initView() {\n JPanel pane= new JPanel();\n panel = new JPanel();\n this.getFile(pane);\n JScrollPane scp = new JScrollPane(pane);\n scp.setPreferredSize(new Dimension(500, 280));\n scp.setVisible(true);\n enter.setPreferredSize(new Dimension(100, 50));\n enter.setVisible(true);\n enter.setActionCommand(\"enter\");\n enter.addActionListener(this);\n send.setPreferredSize(new Dimension(80, 50));\n send.setVisible(true);\n send.setActionCommand(\"sendOptions\");\n send.addActionListener(this);\n send.setEnabled(true);\n back.setVisible(true);\n back.setActionCommand(\"back\");\n back.addActionListener(this);\n back.setPreferredSize(new Dimension(80, 50));\n \n panel.add(scp);\n panel.add(send);\n panel.add(enter);\n panel.add(back);\n Launch.frame.add(panel);\n }", "protected abstract void initView();", "@Override\n\tpublic void setCustomView(int resId) {\n\t\t\n\t}", "protected void setNotificationView(View notificationView) {\n mNotificationView = notificationView;\n }", "@Override\n public void show() {\n if (mNextView == null) {\n throw new RuntimeException(\"setView must have been called\");\n }\n\n final NotificationService service = getService();\n final ToastNotification tn = mTn;\n\n tn.mNextView = mNextView;\n service.enqueueToast(tn, tn.mDuration);\n }", "void initView();", "@Override\r\n\tprotected void setLayout() {\n\t\tsetContentView(R.layout.edit_trace_info_activity);\r\n\t}", "public abstract void initView();", "@Override\r\n\tpublic void setController(Control which) {\n\t\tthis.controller=which;\r\n\t\t\r\n\t\tthis.model=which.getModel();\r\n\t\tthis.view=which.getView();\r\n\r\n\t\t\r\n\t\tthis.view.setControl(this);\r\n\t\t//if(!this.view.isFileChoosed()){\r\n\t\t//\tthis.view.disableStartMenuItem();\r\n\t\t//}\r\n\t\tthis.view.pack();\r\n\r\n\t}", "public VBox doStartDesignView() {\n return this.initView();\n }", "@Override\n\tpublic void setCenterView() {\n\n\t}", "@Override\r\n\tpublic void setContentView(View view) {\r\n\t\tsuper.setContentView(view);\r\n\t\tapplyCustomTitle();\r\n\t}", "@Override\r\n\tpublic void addView(View v) {\r\n\t\tview = v;\r\n\t}", "@FXML\n private void viewSelected() {\n if (selectedAccount == null) {\n // Warn user if no account was selected.\n noAccountSelectedAlert(\"View DonorReceiver\");\n } else {\n ViewProfilePaneController.setAccount(selectedAccount);\n PageNav.loadNewPage(PageNav.VIEW);\n }\n }", "public void configure(T aView) { aView.setText(\"Label\"); }", "public void configure(T aView)\n {\n aView.setMinSize(120,60);\n aView.addTab(\"One\", new BoxView());\n }", "public void configure(T aView)\n {\n aView.setPrefSize(120,22);\n aView.getTextField().setPromptText(\"Spinner\");\n }", "private void initView() {\n\n SwingUtilities.invokeLater(() -> {\n view = new MainWindow();\n view.setMinimumSize(new Dimension(1080, 720));\n view.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n view.setVisible(true);\n view.aboutListener(actionEvent -> showAboutDialog());\n view.helpListener(actionEvent -> showHelpDialog());\n view.addComboBox(comboBox);\n\n });\n\n }", "public void display() {\n dialog.setVisible(true);\n }", "private void setupView(JTextArea view, int w, int h, int x, int y) {\n\n view.setSize(w,h);\n view.setLocation(x,y);\n\n add(view);\n\n }", "public void setView(JPanel panel,IRefresh cont)\n\t{\n\t\tcont.refreshView();\n\t\tthis.setView(panel);\n\t}", "public void setARView(int viewSetting) {\n // rerender the view without recreate the object\n if(currentDisplayMode==DISPLAY_PLACE_DETAIL)\n generateWorld(mWorld, mPlaceDetail,viewSetting, false);\n else\n generateWorld(mWorld, mPlaceListMain,viewSetting, false);\n\n }", "@Override\n\tprotected void initView() {\n\t\tsetContentView(R.layout.activity_money_manage);\n\t\t\n\t\tfindViewById(R.id.bt_title_left).setOnClickListener(this);\n\t\tfindViewById(R.id.bt_ok).setOnClickListener(this);\n\t}", "@Override\r\n\tpublic void initView() {\n\t\tsuper.initView();\r\n\t\tdialog = new BufferDialog(this);\r\n\t\tswitchAntiLost = (Switch) findViewById(R.id.switch_antilost);\r\n\t}", "private void setupView(JLabel view, int w, int h, int x, int y) {\n\n view.setSize(w,h);\n view.setLocation(x,y);\n\n add(view);\n\n }", "public void configure(T aView)\n {\n aView.setMinSize(120,60);\n aView.setText(\"Title\");\n }" ]
[ "0.760118", "0.73251307", "0.7257439", "0.7200664", "0.7062413", "0.7041883", "0.6962516", "0.6836446", "0.6779752", "0.6774912", "0.6633013", "0.65811914", "0.6550971", "0.6531994", "0.646248", "0.6458922", "0.64484316", "0.64342654", "0.6420893", "0.64189655", "0.63471705", "0.63454854", "0.63425124", "0.63180596", "0.6314988", "0.6284074", "0.62533695", "0.6198992", "0.6194446", "0.6186151", "0.6177061", "0.6160388", "0.615448", "0.6126981", "0.6126981", "0.6115532", "0.6111719", "0.61074", "0.61074", "0.6104392", "0.6094019", "0.6093485", "0.60889876", "0.60875505", "0.6086817", "0.60812587", "0.60812587", "0.60512245", "0.6047731", "0.60379755", "0.6037154", "0.602692", "0.6017111", "0.601409", "0.60076505", "0.60076505", "0.59930414", "0.59923285", "0.59920263", "0.59764105", "0.59749484", "0.597477", "0.5970236", "0.5962326", "0.5946693", "0.59316045", "0.59316045", "0.5927851", "0.59261703", "0.5926059", "0.5906834", "0.58917624", "0.5889179", "0.58840114", "0.58799523", "0.5866824", "0.58660597", "0.5859716", "0.5856915", "0.5853894", "0.58485097", "0.58431435", "0.5840976", "0.5839272", "0.58376145", "0.5827908", "0.5825966", "0.58140963", "0.5801967", "0.5792119", "0.5790653", "0.57895887", "0.57876885", "0.5774221", "0.57525444", "0.5749738", "0.5743241", "0.57385635", "0.5727987", "0.57161427" ]
0.6333011
23
Set the view to display in the dialog along with the spacing around that view
public void setView(View view, int viewSpacingLeft, int viewSpacingTop, int viewSpacingRight, int viewSpacingBottom) { mView = view; mViewSpacingSpecified = true; mViewSpacingLeft = viewSpacingLeft; mViewSpacingTop = viewSpacingTop; mViewSpacingRight = viewSpacingRight; mViewSpacingBottom = viewSpacingBottom; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setView(AddSegmentDialog view) {\n View = view;\n }", "public void configure(T aView) { aView.setPrefSize(110,20); }", "public void setView(View view) {\n mView = view;\n mViewSpacingSpecified = false;\n }", "private void setUpView(int width, int height){\n addKeyListener(new KeyPadListener());\n setFocusable(true);\n setLayout(null);\n setBounds(0,0,width,height);\n setBackground(new Color(0,0,0,0));\n requestFocus();\n addMouseListener(new MouseCatcher());\n }", "private void setDialog()\n {\n //this.setSize(350,500);\n this.setTitle(Constant.getTextBundle(\"ปฏิกิริยาต่อกัน\"));\n Toolkit thekit = this.getToolkit(); \n Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();\n this.setLocation((screenSize.width-this.getSize().width)/2, (screenSize.height-this.getSize().height)/2);\n }", "public void configure(T aView)\n {\n aView.setMinSize(120,60);\n aView.addTab(\"One\", new BoxView());\n }", "public ShowView() {\n\t\tsuper(null);\n\t\tcreateActions();\n\t\taddToolBar(SWT.FLAT | SWT.WRAP);\n\t\taddMenuBar();\n\t\taddStatusLine();\n\t}", "private void setViewLayout() {\n\t\tthis.setBorder(new EmptyBorder(15, 15, 15, 15));\n\t\tthis.setLayout(new GridLayout(2, 2, 15, 15));\n\t}", "public void setView(View view);", "void makeDialog()\n\t{\n\t\tfDialog = new ViewOptionsDialog(this.getTopLevelAncestor());\n\t}", "private void setUpView()\n {\n view = new DefaultDrawingView();\n DrawingEditorProxy editor = new DrawingEditorProxy();\n editor.setTarget(new DefaultDrawingEditor());\n view.addNotify(editor);\n for (Handle h : handles)\n h.setView(view);\n }", "public ViewGuaranterWindow() {\n initComponents();\n Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();\n this.setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2);\n }", "private void setViews() {\n\n }", "@Override\n\tpublic void setView(View view) {\n\n\t}", "public void configure(T aView) { aView.setMinSize(120,60); }", "public void configure(T aView) { aView.setMinSize(120,60); }", "public void configure(T aView) { aView.setMinSize(120,60); }", "public void configure(T aView) { aView.setMinSize(120,60); }", "public void configure(T aView) { aView.setMinSize(120,60); }", "public void configure(T aView) { aView.setMinSize(120,60); }", "private void setViews() {\n lv.setAdapter(adapter);\n\n dialog2 = new MiddleDialog2(INSTANCE, getResources().getString(R.string.title), getResources().getString(R.string.value), new MiddleDialog2.onBottonListener() {\n @Override\n public void onOk() {\n\n finish();\n }\n },R.style.registDialog);\n }", "public void configure(T aView) { aView.setMinSize(80,22); }", "public void configure(T aView) { aView.setMinSize(100,60); }", "public void configure(T aView) { aView.setMinSize(100,60); }", "public void showViewAddDirection(){\n JDialog dialogAddDirections = new JDialog();\n\n \n dialogAddDirections.setContentPane(addressView);\n new AddressController(addressView);\n dialogAddDirections.setLocationRelativeTo(null);\n dialogAddDirections.pack();\n dialogAddDirections.setVisible(true);\n }", "private void setupView(JLabel view, int w, int h, int x, int y) {\n\n view.setSize(w,h);\n view.setLocation(x,y);\n\n add(view);\n\n }", "void setView(View v);", "public View() {\n initComponents();\n Paypal.setVisible(false);\n MasterCard.setVisible(false);\n Visa.setVisible(false);\n setLocationRelativeTo(null);\n setResizable(false);\n setDefaultCloseOperation(DISPOSE_ON_CLOSE);\n generarFacturaBoton.setVisible(false);\n }", "private void setupView(JTextArea view, int w, int h, int x, int y) {\n\n view.setSize(w,h);\n view.setLocation(x,y);\n\n add(view);\n\n }", "public void configure(T aView) { aView.setText(\"Button\"); aView.setPadding(2,2,2,2); }", "public IView() {\n initComponents();\n setLocationRelativeTo(null); //Center form on screen\n }", "@Override\n\tpublic void setCenterView() {\n\n\t}", "@Override\n public void onResume() {\n int width = ConstraintLayout.LayoutParams.MATCH_PARENT;\n int height = ConstraintLayout.LayoutParams.WRAP_CONTENT;\n getDialog().getWindow().setLayout(width, height);\n\n super.onResume();\n }", "public void configure(T aView)\n {\n aView.setMinSize(120,60);\n aView.setText(\"Title\");\n }", "public void initView() {\n JPanel pane= new JPanel();\n panel = new JPanel();\n this.getFile(pane);\n JScrollPane scp = new JScrollPane(pane);\n scp.setPreferredSize(new Dimension(500, 280));\n scp.setVisible(true);\n enter.setPreferredSize(new Dimension(100, 50));\n enter.setVisible(true);\n enter.setActionCommand(\"enter\");\n enter.addActionListener(this);\n send.setPreferredSize(new Dimension(80, 50));\n send.setVisible(true);\n send.setActionCommand(\"sendOptions\");\n send.addActionListener(this);\n send.setEnabled(true);\n back.setVisible(true);\n back.setActionCommand(\"back\");\n back.addActionListener(this);\n back.setPreferredSize(new Dimension(80, 50));\n \n panel.add(scp);\n panel.add(send);\n panel.add(enter);\n panel.add(back);\n Launch.frame.add(panel);\n }", "public void configure(T aView)\n {\n aView.setPadding(4,4,4,4); aView.setSpacing(4); aView.setGrowHeight(true);\n }", "public void configure(T aView)\n {\n aView.setPadding(4,4,4,4); aView.setSpacing(4); aView.setGrowHeight(true);\n }", "public void overlayView(Node dialogNode) {\n\t // if the view is already overlaid we will just ignore this overlay call silently . . . todo probably not the best thing to do, but ok for now.\n\t\tif (((StackPane)browser.getParent()).getChildren().size() > 1) return;\n\t\n\t\t// record the view's parent.\n\t\tStackPane parent = (StackPane)browser.getParent();\n\t\t\n\t\tBorderPane center = new BorderPane();\n\t\tcenter.setMaxSize(300, 200);\n\t\tcenter.setCenter(dialogNode);\n\t\tbrowser.setDisable(true);\n\t\tcenter.setStyle(\"-fx-background-color: #CCCCCC\");\n\t\tparent.getChildren().add(center);\n\t}", "public void configure(T aView)\n {\n aView.setPadding(4,4,4,4); aView.setSpacing(4); aView.setGrowWidth(true);\n }", "public void configure(T aView)\n {\n aView.setPrefSize(120,22);\n aView.getTextField().setPromptText(\"Spinner\");\n }", "protected abstract void setupMvpView();", "private void setLayout() {\n\t\ttxtNickname.setId(\"txtNickname\");\n\t\ttxtPort.setId(\"txtPort\");\n\t\ttxtAdress.setId(\"txtAdress\");\n\t\tlblNickTaken.setId(\"lblNickTaken\");\n\n\t\tgrid.setPrefSize(516, 200);\n\t\tbtnLogin.setDisable(true);\n\t\ttxtNickname.setPrefSize(200, 25);\n\t\tlblNickTaken.setPrefSize(250, 10);\n\t\tlblNickTaken.setText(null);\n\t\tlblNickTaken.setTextFill(Color.RED);\n\t\tlblNick.setPrefSize(120, 50);\n\t\ttxtAdress.setText(\"localhost\");\n\t\ttxtPort.setText(\"4455\");\n\t\tlblCardDesign.setPrefSize(175, 25);\n\t\tcomboBoxCardDesign.getSelectionModel().select(0);\n\t\tbtnLogin.setGraphic(imvStart);\n\t}", "public TournamentSetting_View(RiskStart_View start_view, boolean modality)\r\n\t{\r\n\t\tsetTitle(\"Setting Tournament Mode\");\r\n setPreferredSize(new Dimension(200, 200));\r\n setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);\r\n setResizable(false);\r\n add(tournamentSettingPanel());\r\n setLocationRelativeTo(null);\r\n pack();\r\n\t}", "public StartSettingsView() {\n\n super();\n super.setTitle(\"Settings\");\n\n this.createPatientsComboBox();\n this.createButtons();\n\n super.setLayouts(0.2f, 0.2f,0,0.6f);\n\n\t}", "@Before\n public void setDimension() {\n this.view.setDimension(new Dimension(WITDH, HEIGHT));\n }", "public void setUpView() {\n\n\n\t\t//Make the components\n\t\tinputAnswer = new Button(\"Submit\");\n\t\tbegin\t\t= new Button(\"Begin level \" + gameLevel);\n\t\tblueButt\t= new Button();\n\t\tredButt = new Button();\n\t\tgreenButt = new Button();\n\t\tyellowButt = new Button();\n\t\tclear = new Button(\"Clear\");\n\t\tguessArea = new TextArea();\n\t\ttopPan = new Panel();\n\t\tinstructLab = new Label(\"Welcome to the great guessing game. Try and finish it, its fun honest!\");\n\t\treset = new Button(\"Start again?\");\n\t\tpointsLab = new Label(\"Points: \" + points);\n\t\t\n\t\t//Change the font\n\t\tFont font = new Font(\"Verdana\", Font.BOLD, 18);\n\t\tinstructLab.setFont(font);\n\t\t\n\t\t//Add the label to the top panel\n\t\ttopPan.add(instructLab);\n\t\t\n\t\t//Set layout\n\t\tsetLayout(new MigLayout());\n\t\n\t\t//Set the size of the components\n\t\tblueButt.setPreferredSize (new Dimension(60, 50));\n\t\tredButt.setPreferredSize (new Dimension(60, 50));\n\t\tgreenButt.setPreferredSize (new Dimension(60, 50));\n\t\tyellowButt.setPreferredSize(new Dimension(60, 50));\n\t\tguessArea.setPreferredSize (new Dimension(50, 10));\n\t\tpointsLab.setPreferredSize (new Dimension(100, 30));\n\t\t\n\t\t//Turn the submit button of until there is something to submit\n\t\tinputAnswer.setEnabled(false);\n\n\t\t//Set the button colour\n\t\tblueButt.setBackground (Color.blue);\n\t\tredButt.setBackground (Color.red);\n\t\tgreenButt.setBackground (Color.green);\n\t\tyellowButt.setBackground(Color.yellow);\n\t\t\n\t\t//Hide the reset button until it is needed\n\t\treset.setVisible(false);\n\n\t\t//Add the components to the applet\n\t\tadd(topPan, \"wrap\");\n\t\tadd(redButt, \"cell 0 1\");\n\t\tadd(blueButt, \"cell 0 1\");\t\t\n\t\tadd(greenButt, \"cell 0 1\");\n\t\tadd(yellowButt, \"cell 0 1\");\n\t\tadd(begin, \"wrap\");\n\t\tadd(guessArea, \"wrap\");\n\t\tadd(inputAnswer,\"split 2\");\t\n\t\tadd(clear, \"gap left 340, cell 0 2, wrap\");\n\t\tadd(reset, \t\t\"wrap\");\n\t\tadd(pointsLab);\n\n\n\n\t\t//If the status bar is present show the user there level\n\t\tshowStatus(\"You are on level: \" + gameLevel);\n\n\n\t\t//Set the size of the applet\n\t\tsetSize(new Dimension(1000, 1000));\n\n\t}", "public void setLayout() {\n\t\tpersonenListe.getItems().addAll(deck.getPersonenOrdered());\n\t\tpersonenListe.setValue(\"Täter\");\n\t\twaffenListe.getItems().addAll(deck.getWaffenOrdered());\n\t\twaffenListe.setValue(\"Waffe\");\n\t\t// zimmerListe.getItems().addAll(deck.getZimmerOrdered());\n\t\tzimmerListe.setValue(\"Raum\");\n\n\t\tanklage.setMinSize(80, 120);\n\t\tanklage.setMaxSize(80, 120);\n\t\tanklage.setTextFill(Color.BLACK);\n\t\tanklage.setStyle(\"-fx-background-color: #787878;\");\n\n\t\twurfel.setMinSize(80, 120);\n\t\twurfel.setMaxSize(80, 120);\n\t\twurfel.setTextFill(Color.BLACK);\n\t\twurfel.setStyle(\"-fx-background-color: #787878;\");\n\n\t\tgang.setMinSize(80, 120);\n\t\tgang.setMaxSize(80, 120);\n\t\tgang.setTextFill(Color.BLACK);\n\t\tgang.setStyle(\"-fx-background-color: #787878;\");\n\n\t\ttop = new HBox();\n\t\ttop.setSpacing(1);\n\t\ttop.setAlignment(Pos.CENTER);\n\n\t\tbuttons = new HBox();\n\t\tbuttons.setSpacing(20);\n\t\tbuttons.setAlignment(Pos.CENTER);\n\t\tbuttons.getChildren().addAll(anklage, wurfel, gang);\n\n\t\tbottom = new HBox();\n\t\tbottom.setSpacing(150);\n\t\tbottom.setAlignment(Pos.CENTER);\n\t\tbottom.getChildren().addAll(close);\n\n\t\tfenster = new BorderPane();\n\t\tfenster.setStyle(\"-fx-background-image: url('media/ZugFensterResized.png');\");\n\t\tfenster.setTop(top);\n\t\tfenster.setCenter(buttons);\n\t\tfenster.setBottom(bottom);\n\t}", "public void setViewPos(View view, int x, int y, int w, int h) {\n RelativeLayout.LayoutParams rl = new RelativeLayout.LayoutParams(w, h);\n rl.leftMargin = x;\n rl.topMargin = y;\n view.setLayoutParams(rl);\n this.MyRelativeLayout.addView(view);\n }", "public void SHOW_CUSTOM_DIALOG_HESO(View v) {\n\t\tdialog_heso = new Dialog_HESO(TAB_THONGTIN_HOSO.this);\n\t\tdialog_heso.show();\n\t\tWindowManager.LayoutParams lp = new WindowManager.LayoutParams();\n\t\tlp.copyFrom(dialog_heso.getWindow().getAttributes());\n\t\tlp.width = Tht_Screen.get_screen_width_percent(TAB_THONGTIN_HOSO.this, 90);\n\t\tlp.height = Tht_Screen.get_screen_heigth_percent(TAB_THONGTIN_HOSO.this, 90);\n\t\tdialog_heso.getWindow().setAttributes(lp);\n\t\tARR_MAU_HESO = mdb.get_ARR_HESO(Variables.DNV.MaDV);\n\t\tmAdapter_HESO = new Lst_HESO(ARR_MAU_HESO, TAB_THONGTIN_HOSO.this);\n\t\tDialog_HESO.lv_HESO.setAdapter(mAdapter_HESO);\n\t\tDialog_HESO.tv_PT_TT.setText(getString(R.string.PT_TT)+String.valueOf(Variables.HSCT_CHON.PT_TT));\n\t\tDialog_HESO.tv_PT_C.setText(getString(R.string.PT_C)+String.valueOf(Variables.HSCT_CHON.PT_C));\n\t\tDialog_HESO.tv_PT_TL.setText(getString(R.string.PT_TL)+String.valueOf(Variables.HSCT_CHON.PT_TL));\n\t\tDialog_HESO.tv_PT_K.setText(getString(R.string.PT_K)+String.valueOf(Variables.HSCT_CHON.PT_K));\n\t\tDialog_HESO.tv_PT_VAT.setText(getString(R.string.PT_VAT)+String.valueOf(Variables.HSCT_CHON.PT_VAT));\n\t\tDialog_HESO.tv_PT_NC.setText(getString(R.string.PT_NC)+String.valueOf(Variables.HSCT_CHON.PT_NC)+\" %\");\n\t\tDialog_HESO.tv_PT_C1.setText(getString(R.string.PT_C1)+String.valueOf(Variables.HSCT_CHON.PT_C1));\n\t\tDialog_HESO.tv_PT_NC1.setText(getString(R.string.PT_NC1)+String.valueOf(Variables.HSCT_CHON.PT_NC1)+\" %\");\n\t\t\n\n\t}", "public VendaComputadorView() {\n initComponents();\n this.setLocationRelativeTo(null);\n }", "public void setView(View view) {\n\t\tthis.view = view;\n\t}", "private void initExitView() {\n exit = new Label(\"Exit Game\");\n exit.setPrefSize(200, 100);\n exit.setFont(Font.font(null, FontWeight.BOLD, 30));\n exit.setTextFill(Color.RED);\n exit.setEffect(getDropShadow());\n }", "public void setup() {\n self.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));\n // make dialog background unselectable\n self.setCanceledOnTouchOutside(false);\n }", "@Override\n protected void initView() {\n }", "@Override\n protected void initView() {\n }", "@Override\r\n\tprotected void initView() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initView() {\n\t\t\r\n\t}", "public abstract int presentViewLayout();", "@Override\n\tpublic void show() {\n\t\tGameView.VIEW.addDialog(this);\n\t\tsuper.show();\n\t}", "public abstract View getMainDialogContainer();", "public VBox doStartDesignView() {\n return this.initView();\n }", "public void view(Frame owner, FeatureCollection fc) {\n\t\t\tJDialog dialog = new JDialog(owner, \"Replace geometry with circles centered on points\", true);\n\t\t\tContainer parent = dialog.getContentPane();\n\t\t\t\n\t\t}", "public ExitControlView() {\n this.setSize(180,560);\n initSubviews();\n }", "@Override\n\tprotected void initView() {\n\t\t\n\t}", "@Override\n\tprotected void initView() {\n\t\t\n\t}", "public void iniciar(){\r\n \r\n view.setTitle(\"MVC Proyecto\");\r\n //Indica posicion, null -> posicion 0 = centro\r\n view.setLocationRelativeTo(null);\r\n \r\n }", "@Override\r\n\tprotected void initView() {\n\t\tsetSingleLine(true);\r\n\t\tsetWillNotDraw(false);\r\n\t}", "@Override\n\tpublic void InitView() {\n\t\t\n\t}", "protected void showViewContents() {\n\t\tnoData.heightHint = 0;\n\t\tyesData.heightHint = -1;\n\n\t\tnoData.exclude = true;\n\t\tyesData.exclude = false;\n\n\t\tnoLabel.setVisible(false);\n\t\tyesComposite.setVisible(true);\n\t\tredraw();\n\t}", "private void initView() {\n\n }", "protected void createDialogSize ()\n {\n }", "public void setView(View view) {\n this.view = view;\n this.model = view.getModel();\n initControl();\n }", "@Override\n\tpublic void findView() {\n\t\tinitUI();\n\t}", "@Override\r\n\tpublic void initView() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void initView() {\n\t\t\r\n\t}", "@Override\n public void initView() {\n\n }", "public MeldingView() {\n Melding m = new Melding();\n\n this.melding = new Text();\n this.melding.setId(\"title\");\n this.melding.setFill(Color.WHITE);\n this.melding.setLayoutX(590);\n this.melding.setLayoutY(50);\n this.melding.setText(m.getMeldig());\n\n this.sluitButton = new Button(\"Ok\");\n this.sluitButton.setId(\"okButton\");\n this.sluitButton.setMinWidth(150f);\n this.sluitButton.setMinHeight(50f);\n\n this.meldingPane = new StackPane();\n this.meldingPane.setId(\"meldingview\");\n Rectangle rect = new Rectangle(1440, 900);\n this.meldingPane.setClip(rect);\n this.meldingPane.getStylesheets().add(\"Machiavelli/Resources/MeldingView.css\");\n\n VBox controlContainer = new VBox();\n controlContainer.setSpacing(50.0);\n controlContainer.setPadding(new Insets(1, 1, 1, 1));\n\n controlContainer.getChildren().addAll(melding, sluitButton);\n controlContainer.setAlignment(Pos.CENTER);\n this.meldingPane.getChildren().addAll(controlContainer);\n }", "@Override\r\n\tprotected void setLayout() {\n\t\tsetContentView(R.layout.edit_trace_info_activity);\r\n\t}", "public ControlView (SimulationController sc){\n myProperties = ResourceBundle.getBundle(\"english\");\n myStartBoolean = false;\n mySimulationController = sc;\n myRoot = new HBox();\n myPropertiesList = sc.getMyPropertiesList();\n setView();\n\n }", "public void layoutView()\n\t{\n\t\tthis.setLayout(new GridLayout(2,5));\n\t\tthis.add(expression);\n\t\tthis.add(var);\n\t\tthis.add(start);\n\t\tthis.add(end);\n\t\tthis.add(this.plot);\n\t\tthis.add(InputView.coords);\n\t\tthis.add(this.in);\n\t\tthis.add(this.out);\n\t}", "@Override\n public void initView() {\n }", "public CustomerViewDetails() {\n initComponents();\n Toolkit tk = Toolkit.getDefaultToolkit();\n int x = (int) tk.getScreenSize().getWidth();\n int y = (int) tk.getScreenSize().getHeight();\n this.setSize(x, y);\n }", "public ClientMainView() {\n initComponents();\n setLocationRelativeTo(null);\n }", "public View() {\n this.view = new ViewPanel();\n //this.view.setGraph(this.graph);\n initComponents();\n this.m_algoritmos.setEnabled(false);\n this.mi_maze.setEnabled(false);\n this.mi_salvarImagem.setEnabled(false);\n }", "@Override\n\tpublic void initView() {\n\t\t\n\t}", "public void configureGallery(T aView)\n {\n aView.setColCount(12); aView.setPromptText(\"TextField\");\n }", "@Override\n\tprotected void initView()\n\t{\n\n\t}", "private void initializePresentation() {\r\n viewRankingAttemptFX = new ViewRankingAttemptFX(this);\r\n viewRankingPlayerFX = new ViewRankingPlayerFX(this);\r\n viewLoginFX = new ViewLoginFX(this);\r\n viewRegisterFX = new ViewRegisterFX(this);\r\n viewProblemListFX = new ViewProblemListFX(this);\r\n viewLoginFX = new ViewLoginFX(this);\r\n viewRegisterFX = new ViewRegisterFX(this);\r\n viewMenuFX = new ViewMenuFX(this);\r\n viewSettingsFX = new ViewSettingsFX(this);\r\n viewGenerateFX = new ViewGenerateFX(this);\r\n viewAttemptFX = new ViewAttemptFX(this);\r\n viewAttemptListFX = new ViewAttemptListFX(this);\r\n\r\n viewsFX.add(viewLoginFX);\r\n viewsFX.add(viewRankingAttemptFX);\r\n viewsFX.add(viewRankingPlayerFX);\r\n viewsFX.add(viewRegisterFX);\r\n viewsFX.add(viewProblemListFX);\r\n viewsFX.add(viewMenuFX);\r\n viewsFX.add(viewSettingsFX);\r\n viewsFX.add(viewGenerateFX);\r\n viewsFX.add(viewAttemptFX);\r\n viewsFX.add(viewAttemptListFX);\r\n\r\n }", "public void howtouse(View view) {\n showdialog();\n }", "public void show() {\n\t\tsetLocation(\n\t\t\tgetOwner().getX() + (getOwner().getWidth() - getWidth()) / 2, \n\t\t\tgetOwner().getY() + (getOwner().getHeight() - getHeight()) / 2 );\n\n\t\tsuper.show();\n\t}", "public void configureGallery(T aView)\n {\n aView.setPadding(8,30,8,30); aView.setBorder(Color.LIGHTGRAY, 1);\n Label label = new Label(\"BoxView\"); label.setTextFill(Color.GRAY); label.setFont(Font.Arial11);\n aView.setContent(label);\n }", "void setView(PopupView<T> view);", "private void initViews() {\n\t\t\r\n\t\tTypeface face = Typeface.createFromAsset(getAssets(), \"Teko_Light.ttf\");\r\n\r\n\t\tet_pin = (EditText) findViewById(R.id.et_pin);\r\n\t\tet_pin.setTypeface(face);\r\n\t\tbtn_admin_login = (Button) findViewById(R.id.btn_admin_login);\r\n\t\tbtn_admin_login.setTypeface(face);\r\n\r\n\t\td = new DialogView();\r\n\t}", "private void enforceView()\n {\n if (!visible)\n {\n StackPane sPane = (StackPane) this.temperatureView.getParent();\n\n ObservableList<Node> list = sPane.getChildren();\n for (Node node : list)\n {\n node.setVisible(false);\n }\n\n this.temperatureView.setVisible(true);\n }\n }", "public void showCircleSizeSetup() {\n sizeArea.removeAllViewsInLayout();\n sizeArea.addView(radiusEdit);\n }", "private void initDialogView(View dialogView) {\n btnTidak = (Button) dialogView.findViewById(R.id.btnTidak);\n btnYa = (Button) dialogView.findViewById(R.id.btnYa);\n imgClosePopup = (ImageView) dialogView.findViewById(R.id.imgClosePopup);\n txtTitle = (TextView) dialogView.findViewById(R.id.txtTitle);\n iconTitle = (ImageView) dialogView.findViewById(R.id.iconTitle);\n }", "private void InitView() {\n\t\tmLinearLayout = new LinearLayout(getContext());\n\t\t//mLinearLayout.setBackgroundResource(MusicApplication.getInstance().getBgResource());\n\t\t\n\t\t//Modify by LiYongNam 2012.9.19_start\n\t\tMusicUtil.setBackgroundOfView ( mLinearLayout, getContext() );\t\t\t\t\n\t\t//Modify by LiYongNam 2012.9.19_end\n\t\t\n\t\tmLinearLayout.setOrientation(LinearLayout.VERTICAL);\n\t\tmLinearLayout.setPadding(1, 1, 1, Util.dipTopx(getContext(), 60));\n\t\t// 导航条\n\t\taddTitleBar(-1, \"编辑列表\", R.drawable.check_off, R.drawable.title_bar);\n\n\t\tmControlBar = new ControlBar(getContext());\n\t\tmControlBar.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,\n\t\t\t\tUtil.dipTopx(getContext(), 60)));\n\n//\t\taddControlButton(\"全选\", CONTROL1, 0);\n\t\taddControlButton(\"播放\", CONTROL2, 1);\n\t\taddControlButton(\"加入\", CONTROL3, 2);\n\t\taddControlButton(\"删除\", CONTROL4, 3);\n\n\t}", "@Override\n\tpublic FileSelectDialog setView(View view) {\n\t\tthrow new Error(\"You cannot customize the view of a FileSelectDialog, \" +\n\t\t\t\t\"this feature would override the actual list\");\n\t}", "protected final void setView(View v) {\n rootView.setView(v);\n painted = false;\n editor.revalidate();\n editor.repaint();\n }", "public void initView() {\n setEllipsize(TruncateAt.MARQUEE);\n setSingleLine(true);\n setMarqueeRepeatLimit(-1);\n setFocusable(true);\n setFocusableInTouchMode(false);\n }" ]
[ "0.68043154", "0.6697943", "0.65770733", "0.6555592", "0.65337265", "0.6526373", "0.6406225", "0.6391086", "0.6382713", "0.63356626", "0.63258696", "0.622838", "0.6226058", "0.619572", "0.6189692", "0.6189692", "0.6189692", "0.6189692", "0.6189692", "0.6189692", "0.617839", "0.61729366", "0.6129183", "0.6129183", "0.6128407", "0.60936606", "0.60766375", "0.6076226", "0.60522693", "0.60489094", "0.6040173", "0.603837", "0.60357016", "0.6029438", "0.6003132", "0.5948187", "0.5948187", "0.5946887", "0.5922755", "0.59080166", "0.58993423", "0.58708817", "0.58702207", "0.58699816", "0.5850829", "0.5833362", "0.58310074", "0.58262384", "0.58101505", "0.580935", "0.58016855", "0.5790758", "0.5778765", "0.57784706", "0.57784706", "0.5777094", "0.5777094", "0.5776395", "0.577193", "0.576486", "0.5763044", "0.5747002", "0.57422227", "0.5741445", "0.5741445", "0.5735366", "0.5702869", "0.5702286", "0.5693666", "0.5693542", "0.569204", "0.56877434", "0.56858194", "0.5677565", "0.5677565", "0.5675635", "0.5674652", "0.5669859", "0.5665853", "0.5665163", "0.56626594", "0.56612784", "0.56580657", "0.5650964", "0.56487966", "0.56358945", "0.5635533", "0.5617918", "0.5607666", "0.560665", "0.5605567", "0.55931294", "0.5590133", "0.558473", "0.55846643", "0.5572344", "0.5567114", "0.5563557", "0.55619985", "0.55619735" ]
0.6009249
34
Set resId to 0 if you don't want an icon.
public void setIcon(int resId) { mIconId = resId; if (mIconView != null) { if (resId > 0) { mIconView.setImageResource(mIconId); } else if (resId == 0) { mIconView.setVisibility(View.GONE); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tpublic void setIcon(int resId) {\n\t\t\n\t}", "public void setIconLiftRes(int resId) {\n\t\tif (View.VISIBLE == icon_lift.getVisibility()) {\n\t\t\ticon_lift.setImageResource(resId);\n\t\t}\n\t}", "public void setIconReightRes(int resId) {\n\t\tif (View.VISIBLE == icon_reight.getVisibility()) {\n\t\t\ticon_reight.setImageResource(resId);\n\t\t}\n\t}", "@Override\n public int getSmallIconId() throws android.os.RemoteException {\n return 0;\n }", "public Integer getIconImageResourceId() {\n return null;\n }", "public void setDeleteIcon(int resId) {\n this.mIcDelete = resId;\n if (mImgDelete != null) {\n mImgDelete.setImageResource(mIcDelete);\n }\n }", "public int getIconId(){\n return mIconId;\n }", "@Override\n\tpublic void setLogo(int resId) {\n\t\t\n\t}", "@Override\n\tpublic void setIconId(long iconId) {\n\t\t_scienceApp.setIconId(iconId);\n\t}", "public void setIconId(int iconId) {\r\n this.iconId = iconId;\r\n }", "@Override\n\tpublic long getIconId() {\n\t\treturn _scienceApp.getIconId();\n\t}", "@Override\r\n\t\tpublic void requestIcon(String arg0) {\n\t\t\t\r\n\t\t}", "public int getSmallIconId() throws android.os.RemoteException;", "public boolean getIsIconResourceID()\n\t{\n\t\tboolean value;\n\t\ttry {\n\t\t\tString[] splits = _icon.split(\"\\\\|\");\n\t\t\tvalue = splits[1].equals(\"1\");\n\n\t\t} catch (Exception e) {\n\t\t\tvalue = true;\n\t\t}\n\t\treturn value;\n\t}", "@Override\n public void setIconURI(String arg0)\n {\n \n }", "@Override\n\tpublic String getIconURI() {\n\t\treturn null;\n\t}", "public void setCustomMarker(int resourceId) {\n if(marker != null)\n marker.setIcon(BitmapDescriptorFactory.fromResource(resourceId));\n }", "public void clearMainIcon();", "@Override\n\tpublic void setCustomView(int resId) {\n\t\t\n\t}", "public void setMainIcon(IconReference ref);", "public int getMipmapResIdByName(String resName) {\n String pkgName = context.getPackageName();\n\n // Return 0 if not found.\n int resID = context.getResources().getIdentifier(resName , \"drawable\", pkgName);\n Log.i(\"CustomGridView\", \"Res Name: \"+ resName+\"==> Res ID = \"+ resID);\n return resID;\n }", "@Override\n\tprotected String iconResourceName() {\n\t\treturn \"nkv550.png\";\n\t}", "@Override\n public void setIconOnly(boolean iconOnly)\n {\n }", "public int getIconImageNumber(){return iconImageNumber;}", "public static Drawable getIcon(int param0) {\n }", "@Nullable\n // Safe as we want to provide all getters being public for POJOs\n @SuppressWarnings({\"unused\", \"WeakerAccess\"})\n public final String getIconId() {\n return iconId;\n }", "public Icon getIcon() {\n \t\treturn null;\n \t}", "@Override\n\tpublic void setTitle(int resId) {\n\t\t\n\t}", "@Override\n\tpublic String getIconFileName() {\n\t\treturn null;\n\t}", "private void setStatus(int resId) {\n Activity activity = this;\n if (null == activity) {\n return;\n }\n }", "private void m16075b() {\n this.f13513b = (ImageView) getInflater().inflate(C0633g.abc_list_menu_item_icon, this, false);\n addView(this.f13513b, 0);\n }", "@Source(\"cancel_icon.png\")\n\tpublic DataResource cancelIconResource();", "public void setMainImage(int resource) {\n this.imgMain.setImageResource(resource);\n }", "public String getIconURL()\n {\n return null; \n }", "protected void setIcon(UiAction uiAction, ResultSet rs, int rowNumber) throws SQLException{\n\t\t\n\t\tString icon = rs.getString(UiActionTable.COLUMN_ICON);\n\t\t\n\t\tif(icon == null){\n\t\t\t//do nothing when nothing found in database\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tuiAction.setIcon(icon);\n\t}", "@Override\n\tpublic void setIcon(Drawable icon) {\n\t\t\n\t}", "public void setIcon(@DrawableRes final int icon) {\n post(() -> {\n Drawable drawable = ResourcesCompat.getDrawable(getResources(),icon,null);\n int padding = (getWidth() / 2) - (drawable.getIntrinsicWidth() / 2);\n setCompoundDrawablesWithIntrinsicBounds(icon, 0, 0, 0);\n setPadding(padding, 0, 0, 0);\n });\n }", "public void setIconIndex(int value) {\n this.iconIndex = value;\n }", "@Nullable\n @Override\n public Icon getIcon(boolean unused) {\n RowIcon rowIcon = new RowIcon(2);\n\n rowIcon.setIcon(ElixirIcons.MODULE, 0);\n rowIcon.setIcon(PlatformIcons.ANONYMOUS_CLASS_ICON, 1);\n\n return rowIcon;\n }", "public Icon getIcon() {\n\t\treturn null;\n\t}", "@Source(\"update.gif\")\n\tpublic DataResource updateIconDisabledResource();", "public int getImageResource() {\n switch (id) {\n case 0: return R.drawable.aatrox_square_0;\n case 1: return R.drawable.ahri_square_0;\n case 2: return R.drawable.akali_square_0;\n case 3: return R.drawable.alistar_square_0;\n case 4: return R.drawable.amumu_square_0;\n case 5: return R.drawable.anivia_square_0;\n case 6: return R.drawable.annie_square_0;\n case 7: return R.drawable.ashe_square_0;\n case 8: return R.drawable.azir_square_0;\n case 9: return R.drawable.bard_square_0;\n case 10: return R.drawable.blitzcrank_square_0;\n case 11: return R.drawable.brand_square_0;\n case 12: return R.drawable.braum_square_0;\n case 13: return R.drawable.caitlyn_square_0;\n case 14: return R.drawable.cassiopeia_square_0;\n case 15: return R.drawable.chogath_square_0;\n case 16: return R.drawable.corki_square_0;\n case 17: return R.drawable.darius_square_0;\n case 18: return R.drawable.diana_square_0;\n case 19: return R.drawable.draven_square_0;\n case 20: return R.drawable.drmundo_square_0;\n default:\n return R.drawable.fizz_square_0;\n }\n }", "private int getIconWidth() {\n\t\treturn 0;\r\n\t}", "public static int getResId(@NonNull String name) {\n Integer resId = map.get(name);\n if(resId != null) return resId;\n else return R.drawable.ic_help_circle;\n }", "private BitmapDescriptor getMarkerIconFromDrawableForReligion() {\r\n Drawable drawable = getResources().getDrawable(R.drawable.ic_religion);\r\n Canvas canvas = new Canvas();\r\n Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);\r\n canvas.setBitmap(bitmap);\r\n drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());\r\n drawable.draw(canvas);\r\n return BitmapDescriptorFactory.fromBitmap(bitmap);\r\n }", "@SuppressLint(\"NewApi\")\n public Drawable drawable(int res){\n if (Build.VERSION.SDK_INT < 22){\n return application.getResources().getDrawable(res);\n }\n else{\n return application.getResources().getDrawable(res, null);\n }\n }", "public void setIcon(Image i) {icon = i;}", "@Override\n public int getMuteIcon() {\n return R.drawable.ic_audio_alarm_mute;\n //End modify by yeqing.lv for XR6873798 un-use frameworks resource on 2018/08/25\n }", "protected String customIconSet(Object inNode)\n\t{\n\t\treturn null;\n\t}", "@Override\r\n public int getToolbarIconResId(){\r\n return android.R.drawable.ic_menu_close_clear_cancel;\r\n }", "@Override\r\n\tpublic String resourceAddress(int augID) {\n\t\treturn Main.MODID + \":skills/novice/Rejuvenate.png\";\r\n\t}", "public void setIconMode(IconMode currentInventoryMode);", "public org.netbeans.modules.j2ee.dd.api.common.Icon getIcon(){return null;}", "@Override\r\n\tpublic Image getGameIcon() {\n\t\treturn null;\r\n\t}", "public String getIconFileName() {\n return null;\n }", "@Override\n public boolean isIcon(){\n return super.isIcon() || speciallyIconified;\n }", "@Source(\"images/deleteButton.png\")\n @ImageOptions(flipRtl = true)\n ImageResource removeIcon();", "private static IconResource initIconResource() {\n\t\tIconResource iconResource = new IconResource(Configuration.SUPERVISOR_LOGGER);\n\t\t\n\t\ticonResource.addResource(IconTypeAWMS.HOME.name(), iconPath + \"home.png\");\n\t\ticonResource.addResource(IconTypeAWMS.INPUT_ORDER.name(), iconPath + \"input-order.png\");\n\t\ticonResource.addResource(IconTypeAWMS.OUTPUT_ORDER.name(), iconPath + \"output-order.png\");\n\t\ticonResource.addResource(IconTypeAWMS.PLUS.name(), iconPath + \"plus.png\");\n\t\ticonResource.addResource(IconTypeAWMS.MINUS.name(), iconPath + \"minus.png\");\n\t\ticonResource.addResource(IconTypeAWMS.EDIT.name(), iconPath + \"edit.png\");\n\t\ticonResource.addResource(IconTypeAWMS.CONFIRM.name(), iconPath + \"confirm.png\");\n\t\ticonResource.addResource(IconTypeAWMS.CANCEL.name(), iconPath + \"cancel.png\");\n\t\ticonResource.addResource(IconTypeAWMS.USER.name(), iconPath + \"user.png\");\n\t\t\n\t\treturn iconResource;\n\t}", "public void setImageResource(String resPath) {\n \t\timageResource = resPath;\n \t\tif (resPath.contains(\"_holo\") || resPath.contains(\"_alt\")) {\n \t\t\tsetAlternateArt(true);\n \t\t}\n \t\t// setName(id);\n \t}", "public Integer _i(int res_id) {\n\t\treturn mContext.getResources().getInteger(res_id);\n\t}", "public RevealIcon() {\n this.width = getOrigWidth();\n this.height = getOrigHeight();\n\t}", "java.lang.String getIcon();", "java.lang.String getIcon();", "private BitmapDescriptor getMarkerIconFromDrawableForAdministration() {\r\n Drawable drawable = getResources().getDrawable(R.drawable.ic_administration);\r\n Canvas canvas = new Canvas();\r\n Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);\r\n canvas.setBitmap(bitmap);\r\n drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());\r\n drawable.draw(canvas);\r\n return BitmapDescriptorFactory.fromBitmap(bitmap);\r\n }", "private Drawable obtainIconFromResource(Integer id, Context context, ComponentName component)\n\t{\n\t\t\n Resources res = null;\n \n try {\n \t \n\t\t\tres = context.getPackageManager().\n\t\t\t\t\tgetResourcesForApplication(component.getPackageName());\n\t\t\n\t\t} catch (NameNotFoundException e) {\n\t\t\tres = null;\n\t\t\te.printStackTrace();\n\t\t}\n if(res != null)\n {\n return res.getDrawable(id);\n }\n\t\treturn null;\n\t}", "@SuppressLint(\"NewApi\")\n\tvoid changeIcon()\n\t{\n\n\t\tif (CropImage.isExplicitCameraPermissionRequired(this)) {\n\t\t\trequestPermissions(new String[]{Manifest.permission.CAMERA,Manifest.permission.WRITE_EXTERNAL_STORAGE}, CropImage.CAMERA_CAPTURE_PERMISSIONS_REQUEST_CODE);\n\t\t} else {\n\t\t\tCropImage.startPickImageActivity(this);\n\t\t}\n\n\n\t}", "@Override\n public void setDrawableResource(int resId) {\n ivColorSet.setBackgroundResource(resId);\n }", "@Override\r\n\t\tpublic void onLoadingCancelled(String arg0, View arg1) {\n\t\t\tholder.app_icon.setVisibility(View.VISIBLE);\r\n\t\t}", "public void changeIcon(Icon icon) {\r\n this.iconId = icon.getId();\r\n }", "private void setImageButtonImage(int typeIconId) {\n ImageButton btn = (ImageButton) findViewById(R.id.btn_typeIcon);\n\n TypeIcon typeIcon = MainActivity.getTypeIconById(typeIconId);\n\n // Gets the id of the actual image to display, using the name of the TypeIcon\n String name = typeIcon.getDrawablePath();\n final int id = getResources().getIdentifier(name, \"drawable\", getPackageName());\n btn.setImageResource(id);\n\n iconId = typeIconId;\n }", "@Override\n public int getSmallIconId() throws android.os.RemoteException {\n android.os.Parcel _data = android.os.Parcel.obtain();\n android.os.Parcel _reply = android.os.Parcel.obtain();\n int _result;\n try {\n _data.writeInterfaceToken(DESCRIPTOR);\n boolean _status =\n mRemote.transact(Stub.TRANSACTION_getSmallIconId, _data, _reply, 0);\n _reply.readException();\n _result = _reply.readInt();\n } finally {\n _reply.recycle();\n _data.recycle();\n }\n return _result;\n }", "public void setIcon(Integer icon) {\n switch (icon) {\n case 0:\n this.icon = Icon.Schutzengel;\n break;\n case 1:\n this.icon = Icon.Person;\n break;\n case 2:\n this.icon = Icon.Institution;\n break;\n case 3:\n this.icon = Icon.Krankenhaus;\n break;\n case 4:\n this.icon = Icon.Polizei;\n break;\n default:\n this.icon = Icon.Feuerwehr;\n break;\n }\n }", "@Override\n protected int layoutId() {\n return R.layout.activity_appraise_imageshow;\n }", "public void setRes(){\r\n \r\n }", "@Override\n\tpublic Icon getIcon(int width, int height) {\n\t\treturn null; // Use Display Name instead of an icon.\n\t}", "protected final XMLResourceIdentifier resourceId() {\n /***/\n fResourceId.clear();\n return fResourceId;\n}", "public ImageIcon getIcon() {\n\t\treturn null;\n\t}", "public ImageIcon getIcon() {\n\t\treturn null;\n\t}", "private void setStatus(int resId) {\n actionBar.setSubtitle(resId);\n }", "public void setIcone(String icone) {\n this.icone = icone;\n }", "private void setIcon() {\n \n setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource(\"iconabc.png\")));\n }", "public void setImageResourceTo(@DrawableRes int resId, int viewId) {\n ImageView imageView = getViewById(viewId);\n if (imageView != null) {\n imageView.setImageResource(resId);\n }\n }", "private static void setStatus(int resId, Activity activity) {\n\n\n if (null == activity) {\n return;\n }\n final ActionBar actionBar = activity.getActionBar();\n if (null == actionBar) {\n return;\n }\n actionBar.setSubtitle(resId);\n }", "private void setIcon() {\n setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource(\"podologia32x32.png\")));\n }", "public void resetMarker() {\n if(marker != null)\n marker.setIcon(BitmapDescriptorFactory.fromResource(GameSettings.getPlayerMarkerImage()));\n }", "String getIcon();", "String getIcon();", "public GifDrawable(Resources res, int id) throws NotFoundException, IOException {\n this(res.openRawResourceFd(id));\n }", "@Override\n public void onClick(View view) {\n if(view.getId() == R.id.icon1){\n if(iconId == 1){\n iconId = 0;\n findViewById(R.id.icon1).setAlpha(1);\n } else {\n iconId = 1;\n view.setAlpha(0.5f);\n }\n } else {\n findViewById(R.id.icon1).setAlpha(1);\n }\n if(view.getId() == R.id.icon2){\n if(iconId == 2){\n iconId = 0;\n findViewById(R.id.icon2).setAlpha(1);\n } else {\n iconId = 2;\n view.setAlpha(0.5f);\n }\n } else {\n findViewById(R.id.icon2).setAlpha(1);\n }\n if(view.getId() == R.id.icon3){\n if(iconId == 3){\n iconId = 0;\n findViewById(R.id.icon3).setAlpha(1);\n } else {\n iconId = 3;\n view.setAlpha(0.5f);\n }\n } else {\n findViewById(R.id.icon3).setAlpha(1);\n }\n if(view.getId() == R.id.icon4){\n if(iconId == 4){\n iconId = 0;\n findViewById(R.id.icon4).setAlpha(1);\n } else {\n iconId = 4;\n view.setAlpha(0.5f);\n }\n } else {\n findViewById(R.id.icon4).setAlpha(1);\n }\n if(view.getId() == R.id.icon5){\n if(iconId == 5) {\n iconId = 0;\n findViewById(R.id.icon5).setAlpha(1);\n } else {\n iconId = 5;\n view.setAlpha(0.5f);\n }\n } else {\n findViewById(R.id.icon5).setAlpha(1);\n }\n if(view.getId() == R.id.icon6){\n if(iconId == 6){\n iconId = 0;\n findViewById(R.id.icon6).setAlpha(1);\n } else {\n iconId = 6;\n view.setAlpha(0.5f);\n }\n } else {\n findViewById(R.id.icon6).setAlpha(1);\n }\n if(view.getId() == R.id.icon7){\n if(iconId == 7){\n iconId = 0;\n findViewById(R.id.icon7).setAlpha(1);\n } else {\n iconId = 7;\n view.setAlpha(0.5f);\n }\n } else {\n findViewById(R.id.icon7).setAlpha(1);\n }\n if(view.getId() == R.id.icon8){\n if(iconId == 8){\n iconId = 0;\n findViewById(R.id.icon8).setAlpha(1);\n } else {\n iconId = 8;\n view.setAlpha(0.5f);\n }\n } else {\n findViewById(R.id.icon8).setAlpha(1);\n }\n if(view.getId() == R.id.icon9 ){\n if(iconId == 9){\n iconId = 0;\n findViewById(R.id.icon9).setAlpha(1);\n } else {\n iconId = 9;\n view.setAlpha(0.5f);\n }\n } else {\n findViewById(R.id.icon9).setAlpha(1);\n }\n if(view.getId() == R.id.icon10){\n if(iconId == 10){\n iconId = 0;\n findViewById(R.id.icon10).setAlpha(1);\n } else {\n iconId = 10;\n view.setAlpha(0.5f);\n }\n } else {\n findViewById(R.id.icon10).setAlpha(1);\n }\n // close the keyboard\n InputMethodManager inputMethodManager =(InputMethodManager)getSystemService(Activity.INPUT_METHOD_SERVICE);\n inputMethodManager.hideSoftInputFromWindow(title.getRootView().getWindowToken(), 0);\n }", "public void becomeEaten(){\n\t\tthis.setIcon(null);\n\t}", "private int getIconInt(String icon) {\n switch (icon){\n case \"01d\": return R.drawable.w01d;\n case \"01n\": return R.drawable.w01n;\n case \"02d\": return R.drawable.w02d;\n case \"02n\": return R.drawable.w02n;\n case \"03d\": return R.drawable.w03d;\n case \"03n\": return R.drawable.w03n;\n case \"04d\": return R.drawable.w04d;\n case \"04n\": return R.drawable.w04n;\n case \"09d\": return R.drawable.w09d;\n case \"09n\": return R.drawable.w09n;\n case \"10d\": return R.drawable.w10d;\n case \"10n\": return R.drawable.w10n;\n case \"11d\": return R.drawable.w11d;\n case \"11n\": return R.drawable.w11n;\n case \"13d\": return R.drawable.w13d;\n case \"13n\": return R.drawable.w13n;\n case \"50d\": return R.drawable.w50d;\n case \"50n\": return R.drawable.w50n;\n\n }\n\n return R.drawable.w01d;\n }", "protected String getStatusIcon() {\n return isDone ? \"x\" : \" \";\n }", "public /* synthetic */ void mo38881a(int i) {\n this.f30743n0.setImageResource(i);\n }", "@Override\r\n @SideOnly(Side.CLIENT)\r\n public IIcon getIcon(int p_149691_1_, int p_149691_2_)\r\n {\r\n \treturn p_149691_2_ > 0 ? field_149935_N : field_149934_M;\r\n }", "private void SetIcon() {\n \n setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource(\"appIcon.png\")));\n }", "private BitmapDescriptor getMarkerIconFromDrawableForFood() {\r\n Drawable drawable = getResources().getDrawable(R.drawable.ic_food);\r\n Canvas canvas = new Canvas();\r\n Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);\r\n canvas.setBitmap(bitmap);\r\n drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());\r\n drawable.draw(canvas);\r\n return BitmapDescriptorFactory.fromBitmap(bitmap);\r\n }", "public int getmImageResourceId() {\n return mImageResourceId;\n }", "private String getStatusIcon() {\n return this.isDone ? \"X\" : \"\";\n }", "private void setStatus(int resId) {\n FragmentActivity activity = getActivity();\n if (null == activity) {\n return;\n }\n final ActionBar actionBar = activity.getActionBar();\n if (null == actionBar) {\n return;\n }\n actionBar.setSubtitle(resId);\n }", "private void setStatus(int resId) {\n FragmentActivity activity = getActivity();\n if (null == activity) {\n return;\n }\n final ActionBar actionBar = activity.getActionBar();\n if (null == actionBar) {\n return;\n }\n actionBar.setSubtitle(resId);\n }" ]
[ "0.8120108", "0.69641346", "0.69404954", "0.68068874", "0.67319095", "0.65623236", "0.65067023", "0.6453215", "0.64012253", "0.6400158", "0.63947076", "0.63946897", "0.6306102", "0.6175792", "0.61740637", "0.6135509", "0.6102067", "0.6053468", "0.6033997", "0.6010127", "0.6003762", "0.599548", "0.59373736", "0.59271276", "0.5906263", "0.5875405", "0.5860021", "0.58437073", "0.58371514", "0.5800026", "0.57976425", "0.5771353", "0.5763653", "0.5752598", "0.5745777", "0.57247597", "0.5723913", "0.5713746", "0.5711205", "0.5710353", "0.5692291", "0.56905544", "0.56786186", "0.5654402", "0.5648319", "0.5636458", "0.56272066", "0.56218845", "0.56175226", "0.55946785", "0.55855453", "0.5582486", "0.5581683", "0.5578679", "0.556991", "0.55618995", "0.5558268", "0.5555428", "0.5505467", "0.5504298", "0.55013067", "0.5476565", "0.5476565", "0.5470702", "0.5466621", "0.5463362", "0.5443016", "0.5436951", "0.5436293", "0.54273087", "0.5422847", "0.5421241", "0.54204553", "0.54159003", "0.54154104", "0.54114264", "0.5409985", "0.5409985", "0.54051965", "0.54035914", "0.53868484", "0.53820145", "0.5373177", "0.53695476", "0.5366111", "0.5364969", "0.5364969", "0.53616685", "0.53610724", "0.53593016", "0.53514767", "0.5344772", "0.5340319", "0.5338688", "0.5334558", "0.5328375", "0.5327034", "0.5316927", "0.5310771", "0.5310771" ]
0.7605867
1
Interface definition for a callback to be invoked before the ListView will be bound to an adapter.
public interface OnPrepareListViewListener { /** * Called before the ListView is bound to an adapter. * * @param listView The ListView that will be shown in the dialog. */ void onPrepareListView(ListView listView); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tpublic void setListNavigationCallbacks(SpinnerAdapter adapter,\n\t\t\tOnNavigationListener callback) {\n\t\t\n\t}", "public interface ListViewPopulateItemClosure\r\n{\r\n\tpublic void setPopulateItemClosure(Closure closure);\r\n}", "@Override\n\tpublic void setUpListener() {\n\t\tmListView.setOnItemClickListener(new OnItemClickListener() {\n\t\t\t@Override\n\t\t\tpublic void onItemClick(AdapterView<?> parent, View view, int position, long id) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tmAdapter.setIndex(position);\n\t\t\t\tmAdapter.notifyDataSetChanged();\n\t\t\t\tif(litener != null){\n\t\t\t\t\tlitener.onItemClick(position, mAdapter.getListItem(position), view);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}", "private void clickcallback() {\n final ListView listView = findViewById(R.id.listViewCollections);\n\n listView.setOnItemClickListener(ClickListener());\n\n if (friendID == null) {\n listView.setOnItemLongClickListener(LongClickListener());\n }\n }", "@Override\n\tpublic void onCallback() {\n\t\t\n\t}", "public interface Callback {\n public void onItemSelected(Uri uri);\n }", "public interface ListCallBack {\n\n public boolean isLoading();\n public void onLoadMore();\n\n\n}", "public interface IListviewBiz {\n\n void findItem(OnFinishedListener listener);\n\n}", "private void registerListClickCallBack() {\n\t\t\n\t\tListView myList = (ListView)findViewById(R.id.listViewFromDB);\n\t\tmyList.setOnItemClickListener(new AdapterView.OnItemClickListener() {\n\n\t\t\t@Override\n\t\t\tpublic void onItemClick(AdapterView<?> parent, View viewClicked,\n\t\t\t\t\tint position, long idInDB) {\n\t\t\t\t\n\t\t\t\tupdateItemForId(idInDB);\n\t\t\t\n\t\t\t}\n\t\t});\n\t}", "@Override\n public void addOnPropertyChangedCallback(OnPropertyChangedCallback callback) {\n }", "public interface ListItemCallBack {\r\n\r\n void onItemClick(View view, int position,Object... object);\r\n\r\n}", "public interface PeopleListView {\n void showSpinner();\n void hideSpinner();\n void onPeoplePageLoaded(List<Person> person);\n void onPersonSelected(int personId);\n}", "@Override\n\t\t\t\t\t\t\t\t\tpublic void callback(int position) {\n\n\t\t\t\t\t\t\t\t\t}", "void addLifecycleCallback(LifecycleCallbackItem lifecycleCallbackItem);", "public interface OnItemClickCallbackInterface {\n void onClickListItem(int position, int id, String qTitle);\n}", "public void callback() {\n }", "@Override\n public void onCallBack(int pos) {\n }", "void setCallback(IResponseCallback<WalletDataDecl.ListResultTmpl<Response>> cb);", "public interface onAddItemListener {\n void onAddItem(String item);\n}", "public interface LoadFriendsCallback {\n void preExecute();\n void postExecute(ArrayList<Friends> friends);\n}", "public interface LoadFriendsCallback {\n void preExecute();\n void postExecute(ArrayList<Friends> friends);\n}", "public interface AdapterItemsLoadedListener {\n\n\tvoid onListItemsLoaded(int count);\n\n\tvoid onListLoadError(@NonNull String message);\n}", "public interface CollectionListCallback {\n\n void onGetListCollectionSuccess(List<PnmDebiturModel> listItemModels);\n\n void onGetListCollectionFailed(Throwable t);\n}", "public interface Callback {\n /**\n * DetailFragmentCallback for when an item has been selected.\n */\n public void onItemSelected(Uri dateUri);\n }", "@Override\n\t\t\tpublic void callbackCall() {\n\t\t\t}", "@Override\n protected void onCallbacksInitialize() {\n ViewGroup view = (ViewGroup) findViewById(getClickedID());\n if (view != null) {\n view.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n if (callbackReference != null\n && objectReference != null\n && objectReference.get() != null\n && callbackReference.get() != null) {\n T object = objectReference.get();\n callbackReference.get().onItemClick(index, object);\n }\n }\n });\n }\n }", "public void onCompletion(Runnable callback)\n/* */ {\n/* 158 */ this.completionCallback = callback;\n/* */ }", "@Override\n\tpublic void callback(Object o) {}", "public interface Callback {\n void onExpanded(boolean z);\n\n void onInteraction();\n\n void onPrioritySettings();\n }", "public interface Callbacks {\n /**\n * Callback for when an item has been selected.\n * public modifier left for readability\n */\n public void onItemSelected(int position);\n }", "@Override\n\tpublic void callback() {\n\t}", "public void onInitialize(CompositeOnPageChangeCallback compositeOnPageChangeCallback, RecyclerView recyclerView) {\n }", "public interface Callbacks\n {\n public void onItemSelected(String id);\n }", "public interface MyCallback {\n\n void updateAdapter(Movies[] movies);\n}", "public interface DeleteCallback {\n /** Called when current item has been deleted. */\n void onItemDeleted();\n }", "public void callback();", "public interface Callbacks {\n\t\t/**\n\t\t * Callback for when an item has been selected.\n\t\t */\n\t\tpublic void onItemSelected(Long id);\n\t}", "public interface DataCallback {\n public void onData(List t);\n}", "public interface Callback {\n /**\n * Callback for setting background of mailbox list items during a drag\n */\n public void onSetDropTargetBackground(MailboxListItem listItem);\n }", "void onPrepareListView(ListView listView);", "public interface BookListView {\n void onGetBookListSuccess(List<BookModel> list);\n void onGetBookListError(String error);\n\n}", "@Override\n\tpublic void onScroll(AbsListView view, int firstVisibleItem,\n\t\t\tint visibleItemCount, int totalItemCount) {\n\n\t\tif (((firstVisibleItem + visibleItemCount) >= totalItemCount)\n\t\t\t\t&& totalItemCount != 0) {\n\t\t\tnew ListLoader().execute();\n\t\t}\n\t}", "public interface OnListFragmentInteractionListener {\n // TODO: Update argument type and name\n // void onListFragmentInteraction(DummyItem item);\n }", "public interface Callbacks {\n // Through this method is the activity notified of a selected list item\n void onAnimalSelected(Animal animal);\n }", "public interface OnListFragmentInteractionListener {\n // TODO: Update argument type and name\n void onListFragmentInteraction(DummyItem item);\n }", "public interface OnListFragmentInteractionListener {\n // TODO: Update argument type and name\n void onListFragmentInteraction(DummyItem item);\n }", "private void registerCliclCallback() {\n\t\t\n\t\tListView list=(ListView)findViewById(R.id.listView1);\n\t\t\n\t\tlist.setOnItemClickListener(new AdapterView.OnItemClickListener() {\n\n\t\t\t@Override\n\t\t\tpublic void onItemClick(AdapterView<?> arg0, View arg1, int arg2,\n\t\t\t\t\tlong arg3) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\n\t\t\t\tif(arg2==0)\n\t\t\t\t{\n\t\t\t\t\tIntent i=new Intent(setting.this,options.class);\n\t\t\t\t\tstartActivity(i);\t\n\t\t\t\t}\n\t\t\t\tif(arg2==1)\n\t\t\t\t{\n\t\t\t\t\tIntent i=new Intent(setting.this,help.class);\n\t\t\t\t\tstartActivity(i);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(arg2==2)\n\t\t\t\t{\n\t\t\t\t\tIntent i=new Intent(setting.this,aboutus.class);\n\t\t\t\t\tstartActivity(i);\n\t\t\t\t}\n\t\t\t\tif(arg2==3)\n\t\t\t\t{\n\t\t\t\t\tfinish();\t\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}", "public interface Callback {\n /**\n * Show top tracks when an item has been selected.\n */\n void onTrackItemSelected(int position, List<USpotifyObject> tracks);\n }", "public interface Callback {\n /**\n * DetailFragmentCallback for when an item has been selected.\n */\n public void onItemSelected(Uri movieUri);\n }", "public interface Callbacks {\n /**\n * Callback for when an item has been selected.\n */\n public void onItemSelected(String summary, String poster);\n }", "public interface Callbacks {\n\t\t/**\n\t\t * Callback for when an item has been selected.\n\t\t */\n\t\tpublic void onItemSelected(String id);\n\t}", "public interface Callbacks {\n\t\t/**\n\t\t * Callback for when an item has been selected.\n\t\t */\n\t\tpublic void onItemSelected(String id);\n\t}", "public interface OnListFragmentInteractionListener {\n\n void onListFragmentInteraction(DummyContent.DummyItem item);\n}", "public interface Callbacks {\n /**\n * Callback for when an item has been selected.\n */\n public void onItemSelected(String id);\n }", "public interface Callbacks {\n /**\n * Callback for when an item has been selected.\n */\n public void onItemSelected(String id);\n }", "public interface ListSurveyCallback {\n\n void onGetListSurveySuccess(List<ProspekListItemModel> listItemModels);\n\n void onGetListSurveyFailed(Throwable t);\n}", "public interface onItemClickListenter {\n void setOnItemClickListener(int position);\n}", "public interface ListListener {\n public void OnClick(int itemPosition);\n}", "public interface AutoCompleterCallback {\n /** Notification that an item is suggested. */\n void itemSuggested(String autoCompleteString, boolean keepPopupVisible, boolean triggerAction);\n }", "public interface IMoiveListView extends IWanBaseView{\n\n void onLoading();\n\n void onLoadSucess(MoiveListResponse moiveListResponse);\n\n void onLoadFail(String msg);\n}", "public interface OnItemTouchCallback {\n //数据交换\n void onItemMove(int fromPosition, int toPosition);\n\n //数据删除\n void onItemDelete(int position);\n}", "public interface LessonPluginCallback {\n\n void initPlugin(PluginViewItem item);\n\n void initState(PluginViewItem item);\n\n boolean click(View view);\n}", "public interface Callback {\n public static final int TYPE_REGULAR = 0;\n public static final int TYPE_DRAFT = 1;\n public static final int TYPE_TRASH = 2;\n\n /**\n * Called when the specified mailbox does not exist.\n */\n public void onMailboxNotFound(boolean firstLoad);\n\n /**\n * Called when the user wants to open a message.\n * Note {@code mailboxId} is of the actual mailbox of the message, which is different from\n * {@link MessageListFragment#getMailboxId} if it's magic mailboxes.\n *\n * @param messageId the message ID of the message\n * @param messageMailboxId the mailbox ID of the message.\n * This will never take values like {@link Mailbox#QUERY_ALL_INBOXES}.\n * @param listMailboxId the mailbox ID of the listbox shown on this fragment.\n * This can be that of a magic mailbox, e.g. {@link Mailbox#QUERY_ALL_INBOXES}.\n * @param type {@link #TYPE_REGULAR}, {@link #TYPE_DRAFT} or {@link #TYPE_TRASH}.\n */\n public void onMessageOpen(long messageId, long messageMailboxId, long listMailboxId,\n int type);\n\n /**\n * Called when an operation is initiated that can potentially advance the current\n * message selection (e.g. a delete operation may advance the selection).\n * @param affectedMessages the messages the operation will apply to\n */\n public void onAdvancingOpAccepted(Set<Long> affectedMessages);\n\n /**\n * Called when a drag & drop is initiated.\n *\n * @return true if drag & drop is allowed\n */\n public boolean onDragStarted();\n\n /**\n * Called when a drag & drop is ended.\n */\n public void onDragEnded();\n }", "void onRequestShowing(Runnable callback);", "@Override\r\n\tpublic void setViewCallback(ViewCallback callback) {\r\n\t\tthis.callback = callback;\r\n\t}", "public interface IItemListView extends MvpView {\n\n void onAllItemsSuccess(List<Item> itemList);\n\n void onAllItemsFailure(String errorMsg);\n\n boolean isNetworkConnected();\n}", "public interface Callback {\n /**\n * ClassFragmentCallback for when an item has been selected.\n */\n public void onItemSelected(String studentSelected);\n }", "public interface PaginationAdapterCallback {\n\n void retryPageLoad();\n}", "public interface ItemClickCallBack {\n void nItemClick(int position, Object obj);\n}", "public interface CageListView {\n void onLoadCageList(List<Cage> cages);\n\n void onCageDestroyed(Cage cage);\n\n void onAnimalTypeChanged(Cage cage);\n\n void onLoadCageListEmpty();\n\n}", "public interface PaginationAdapterCallback {\n void retryPageLoad();\n}", "public interface Callbacks {\n /**\n * Callback for when an item has been selected.\n */\n public void onItemSelected(int id);\n public void onCheckBoxChange(int id);\n }", "public interface ILoadViewCallback {\n\t\n\t/**\n\t * Invoked when the <code>view</code> is loaded.\n\t * @param link - linke that was specified in the request to load view.\n\t * @param view - loaded viwe.\n\t */\n\tpublic void onViewLoaded(XViewLink link, XView view);\n\n}", "void notifyListItemInserted(int position);", "public BookPhotosListAdapter() {\r\n super(DIFF_CALLBACK);\r\n }", "public interface PresenterListener<T extends CallbackListener> {\n void attachView(T view);\n\n void detachView();\n\n void onAutoLogin(Context context);\n}", "public interface AppUserSelectedCallback {\n /**\n * Called when user selects user(s) from a list in a dialog.\n *\n * @param appUsers the selected app users\n * @param extraText any text that user entered in dialog,\n * this will be null or empty if not shown or user didn't enter anything\n */\n void selected(Collection<AppUser> appUsers, String extraText);\n\n /**\n * Called when user taps a user in a list\n */\n void selected(AppUser appUser);\n}", "public interface Callback{\n //Required public empty constructor\n public void buttonClicked();\n }", "public interface ContactListView {\n void onContactAdded(User user);\n void onContactChanged(User user);\n void onContactRemoved(User user);\n}", "public interface OnFeedsLoadedListener {\n void onSuccess(List<FeedItem> feedItems, boolean loadedNewFeeds);\n\n void onFailure(String message);\n}", "public interface IAppListView extends IBaseView {\n /**\n * Triggered when list was updated\n * @param apps new list\n */\n void updateList(List<PackageInfo> apps);\n\n /**\n * Triggered when sync error happened\n */\n void showSyncFailMessage();\n}", "public interface IPullListener {\n /**\n * This getScreenWidth is to refreshing the listview.\n */\n public void onHeaderRefresing();\n\n /**\n * This getScreenWidth is to load more.\n */\n public void onFooterRefresing();\n }", "void onListFragmentInteraction(DummyItem item);", "void onListFragmentInteraction(DummyItem item);", "public interface CallbackItemEdit {\n public void doEdit(int position);\n\n public void doDelete(int position);\n}", "public interface AdapterCallback {\n void onMoreCallback(long id, String date);\n void onSaveCallback(long id, Book book);\n}", "public interface AddPlaceFirstOnListItemClickListener {\n public void onListItemClick(int position);\n\n}", "public interface MessageListClickCallBack {\n void itemClickAction(ArrayList<InboxListInnerModel> mList);\n}", "public interface Callback {\n void onItemSelected(Movie movie, MovieCategories movieCategory, int moviePosition);\n }", "public interface DataLoaderListener {\n\n /**\n * Invoked when the AsyncTask has completed its execution.\n *\n * @param //results The resulting object from the AsyncTask.\n */\n void onDataLoaded(int requestId, Object data);\n}", "public interface\t\tUCallbackList\n{\n /**\n * Removes all the registered callbacks.\n * <p>\n\t */\n\tpublic void\t\tremoveAll();\n\n /**\n * Removes the registered callback associated with the given tag.\n * <p>\n * @param tag The tag associated with the removed callback.\n\t */\n\tpublic void\t\tremoveUCallbackListener(String\t\ttag);\n\n /**\n * Registers a callback associated with the given tag.\n * <p>\n * @param listener The registered callback.\n * @param tag The tag associated with the registered callback.\n\t */\n\tpublic void\t\taddUCallbackListener(UCallbackListener listener,\n\t\t\t\t\t\t\t\t\t\t String tag);\n\n /**\n * Returns the callback associated with the given tag.\n * <p>\n * @param tag The tag associated with the callback.\n\t * @return The callback or null.\n\t */\n\tpublic UCallbackListener\t\tgetUCallbackListener(String tag);\n\n /**\n * Calls the actionPerformed method of all the registered callbacks.\n * <p>\n\t */\n\tpublic void\t\tnotifyUCallbackListeners();\n\n /**\n * Calls the actionPerformed method of a registered callback\n\t * associated with the given event.\n * <p>\n * @param event The event associated with the registered callback.\n\t */\n\tpublic void\t\tnotifyUCallbackListener(URBIEvent event);\n}", "public interface OnItemClickListenter {\n void onItemClickListener(View view, int position);\n}", "public interface ContactsAdapterListener {\n void onContactSelected(Contact contact);\n}", "@Override\n\t\t\t\tpublic void onScroll(AbsListView view, int firstVisibleItem,\n\t\t\t\t\t\tint visibleItemCount, int totalItemCount) {\n\n\t\t\t\t}", "public interface RequestCallbackListener {\n public void notifyToCaller(boolean isExecuted,Object obj);\n}", "public LowLevelNetworkHandler setCallback(Callback callback);", "public interface IQueryTCFZListCallback {\n void querySuccessed();\n void queryUnSuccessed();\n}", "public interface LastItemVisibleCallBack {\n void loadNextPage();\n}", "public interface IBaseListView<T> extends IBaseView<T> {\n @Override\n void onShowLoading();\n\n @Override\n void onHideLoading();\n\n @Override\n void onShowNetError();\n\n @Override\n void setPresenter(T persenter);\n\n /**\n * 绑定生命周期\n */\n @Override\n <T> LifecycleTransformer<T> bindToLife();\n\n /**\n * 设置适配器\n */\n void onSetAdapter(List<?> list);\n\n /**\n * 加载完毕\n */\n void onShowNoMore();\n}", "public interface OnLanguageSelectedCallback {\n\n /**\n * Called when language is selection is completed.\n */\n void onLanguageSelected();\n}" ]
[ "0.6549395", "0.649889", "0.6414758", "0.63391846", "0.6264177", "0.6196374", "0.61724335", "0.6150887", "0.61374134", "0.6123891", "0.61156523", "0.6111859", "0.609321", "0.60667056", "0.6063433", "0.60228246", "0.6017835", "0.59802204", "0.5975589", "0.5972273", "0.5972273", "0.5968766", "0.5961262", "0.5957514", "0.5954934", "0.59459275", "0.59426486", "0.59421545", "0.59325033", "0.5929991", "0.59252894", "0.591937", "0.5915438", "0.5906957", "0.5888699", "0.58735675", "0.58687174", "0.58637977", "0.58560354", "0.58432484", "0.5842672", "0.5837161", "0.5832452", "0.5831532", "0.5828283", "0.5828283", "0.58265364", "0.58260095", "0.5815578", "0.58079785", "0.5789566", "0.5789566", "0.57816595", "0.5772799", "0.5772799", "0.5748765", "0.5748382", "0.57481676", "0.5747784", "0.5738506", "0.57047975", "0.57044876", "0.5703316", "0.5702743", "0.57004404", "0.56977135", "0.5697146", "0.5694794", "0.56733346", "0.5663379", "0.56626743", "0.56625944", "0.56572527", "0.5640759", "0.5628227", "0.562626", "0.56232643", "0.56202203", "0.5619628", "0.5617488", "0.56161386", "0.56055677", "0.5599033", "0.5599033", "0.55920726", "0.55910414", "0.5590665", "0.5588769", "0.5583565", "0.55799884", "0.55755705", "0.55698246", "0.55569714", "0.5551178", "0.5550199", "0.55494624", "0.55476403", "0.5531536", "0.552537", "0.5518883" ]
0.71623975
0
Called before the ListView is bound to an adapter.
void onPrepareListView(ListView listView);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void initListView() {\n viewPager.setAdapter(adapter);\n }", "@Override\n\t\tpublic void initList() {\n\t\t\tadapter = new MsgItemAdapter(context);\n\t\t\tArrayList<MsgBean> datas = getData();\n\t\t\tadapter.setData(datas);\n\t\t\tmListView.setAdapter(adapter);\n\t\t\tmListView.setViewMode(true, true);\n\t\t\tif(!DataValidate.checkDataValid(datas)){\n\t\t\t\tpageView.setDefaultPage().setVisibility(View.VISIBLE);\n\t\t\t}\n\t\t}", "private void loadAdapter(){\n choices = contacts.getContacts();\n mAdapter = new MyListAdapter(this, choices);\n mListView.setAdapter(mAdapter);\n mListView.setClickListener(ContactListActivity.this);\n }", "private void initView() {\n initRefreshListView(mListview);\n }", "@Override\n\tpublic void setUpListener() {\n\t\tmListView.setOnItemClickListener(new OnItemClickListener() {\n\t\t\t@Override\n\t\t\tpublic void onItemClick(AdapterView<?> parent, View view, int position, long id) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tmAdapter.setIndex(position);\n\t\t\t\tmAdapter.notifyDataSetChanged();\n\t\t\t\tif(litener != null){\n\t\t\t\t\tlitener.onItemClick(position, mAdapter.getListItem(position), view);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}", "private void inicializaListView(){\n }", "private void init() {\n listView = (ListView) findViewById(R.id.listView);\n listView.setOnItemClickListener(this);\n activityListAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, 0);\n listView.setAdapter(activityListAdapter);\n }", "private void initListView() {\n listView = (ListView) findViewById(R.id.lv_pingpai_listview);\r\n pingpaiList = new ArrayList<>();\r\n adapter = new PingpaiAdapter(this, pingpaiList);\r\n listView.setAdapter(adapter);\r\n listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {\r\n @Override\r\n public void onItemClick(AdapterView<?> parent, View view, int position, long id) {\r\n Pingpai pingpai = (Pingpai) adapter.getItem(position);\r\n Intent intent = new Intent(PingpaiActivity.this, XinghaoActivity.class);\r\n intent.putExtra(\"pingpai\", pingpai);\r\n startActivity(intent);\r\n finish();\r\n\r\n }\r\n });\r\n// sortListView.setmOnTouchListener(new SortListView.OnTouchListener() {\r\n// @Override\r\n// public void onTouch(String s) {\r\n// Integer index = adapter.getPosition(s);\r\n// if (index != null) {\r\n// listView.setSelection(index);\r\n// }\r\n// }\r\n// });\r\n// listView.setAdapter(adapter);\r\n }", "@Override\n public void onStart()\n {\n super.onStart();\n getListView();\n }", "@Override\n\tprotected void setupListView() {\n\t\tfinal int elementLayout = R.layout.image_selectable_list_item;\n\t\tfinal int imageView = R.id.imageView1;\n\t\tfinal int textView = R.id.textView1;\n\n\t\tmQueryListener = new QueryListener() {\n\n\t\t\t@Override\n\t\t\tpublic void onError() {\n\t\t\t\tmAdapter = null;\n\t\t\t\tsetListAdapter(null);\n\t\t\t\tgetListView().invalidateViews();\n\t\t\t\tsetEmptyText(getString(R.string.retrievalError));\n\t\t\t\tmProgressBar.setVisibility(View.GONE);\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onDataChange(double data, boolean saved) {\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onDataChange(boolean data, boolean saved) {\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onDataChange(ObjectPrx data, boolean saved) {\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onDataChange(QueryModel data, boolean saved) {\n\t\t\t\tif (saved) {\n\t\t\t\t\tmQueryModel = data;\n\t\t\t\t\tArrayList<UserTypPrx> adapterData = new ArrayList<UserTypPrx>(\n\t\t\t\t\t\t\tdata.data.size());\n\t\t\t\t\tfor (ObjectPrx oprx : data.data)\n\t\t\t\t\t\tadapterData.add(UserTypPrxHelper.checkedCast(oprx));\n\t\t\t\t\tif (mAdapter == null) {\n\t\t\t\t\t\tmAdapter = new UserListAdapter(MyMessagesActivity.this,\n\t\t\t\t\t\t\t\telementLayout, imageView, textView, adapterData);\n\t\t\t\t\t\tsetListAdapter(mAdapter);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmAdapter.addAll(adapterData);\n\t\t\t\t\t}\n\t\t\t\t\tmAdapter.notifyDataSetChanged();\n\t\t\t\t\tmProgressBar.setVisibility(View.GONE);\n\t\t\t\t\tif (mAdapter.getCount() <= 0)\n\t\t\t\t\t\tsetEmptyText(getString(R.string.noMessagesFound));\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}", "private void initListView() {\n\t\trefreshListItems();\n\n\t\t/* Add Context-Menu listener to the ListView. */\n\t\tlv.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {\n\n\t\t\t@Override\n\t\t\tpublic void onCreateContextMenu(ContextMenu menu, View v,\n\t\t\t\t\tContextMenu.ContextMenuInfo menuInfo) {\n\t\t\t\tmenu.setHeaderTitle(((TextView) ((AdapterView.AdapterContextMenuInfo) menuInfo).targetView)\n\t\t\t\t\t\t.getText());\n\t\t\t\tmenu.add(0, CONTEXTMENU_EDITITEM, 0, \"Edit this VDR!\");\n\t\t\t\tmenu.add(0, CONTEXTMENU_DELETEITEM, 0, \"Delete this VDR!\");\n\t\t\t\t/* Add as many context-menu-options as you want to. */\n\n\t\t\t}\n\t\t});\n\t}", "@Override\n\tpublic void preProcess(int position, View convertView, Object... extra) {\n\n\t}", "private void updateListView() {\n adapter = new TableItemAdapter(this, tableItems);\n this.listView.setAdapter(adapter);\n }", "@Override\n\tprotected void onResume() {\n\t\tsuper.onResume();\n\t\tadapter = new SubjectListAdapter(getLayoutInflater(), filterSubjects);\n\t\tlistView.setAdapter(adapter);\n\t}", "@Override\n protected void initView() {\n mListView = (ListView) findViewById(R.id.list);\n ViewGroup.LayoutParams layoutParams = mListView.getLayoutParams();\n layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT;\n layoutParams.height = AppController.displayMetrics.heightPixels / 2;\n mListView.setLayoutParams(layoutParams);\n\n\n mSelectChatAdapter = new SelectChatAdapter(getContext());\n mListView.setAdapter(mSelectChatAdapter);\n mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {\n @Override\n public void onItemClick(AdapterView<?> parent, View view, int position, long id) {\n goToHXMain(\n HXApplication.getInstance().parseUserFromID(HXHelper.yamContactList.get(position)\n .getFirendsUserInfo().getId(), HXConstant.TAG_SHOP));\n }\n });\n }", "private void setUpList() {\n\t\tRoomItemAdapter adapter = new RoomItemAdapter(getApplicationContext(),\n\t\t\t\trName, rRate);\n\t\tlistView.setAdapter(adapter);\n\n\t\tlistView.setOnItemClickListener(new OnItemClickListener() {\n\n\t\t\t@Override\n\t\t\tpublic void onItemClick(AdapterView<?> parent, View view,\n\t\t\t\t\tint position, long id) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\thandleClick(position);\n\t\t\t}\n\t\t});\n\t}", "private void setupCustomAdapter() {\n AnimalAdapter adapter = new AnimalAdapter(this, animals);\n aListView.setAdapter(adapter);\n }", "private void initList() {\n\t\t\r\n\t\tpointArrayAdapter = new WastePointsAdapter(mContext, R.layout.list_feeds_item, mWastePointController.getWastePointsList());\r\n\t\tsetListAdapter(pointArrayAdapter);\r\n\t\ttry {\r\n\t\t\tgetListView().setDivider(null);\r\n\t\t\temptyText.setVisibility(View.GONE);\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\t\r\n\t\tgetListView().setOnItemClickListener(new OnItemClickListener() {\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void onItemClick(AdapterView<?> arg0, View arg1, int arg2,\r\n\t\t\t\t\tlong arg3) {\r\n\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\tmWastePointController.setCurrentWastePoint(mWastePointController.getWastePointsList().get(arg2));\r\n\t\t\t\t((MainActivity)PointsListFragment.this.getActivity()).showPointDetails();\r\n\r\n\t\t\t}\r\n\t\t});\r\n\t}", "public void initView() {\n ArrayAdapter<String> arrayAdapter=new ArrayAdapter<String>(getView().getContext(),android.R.layout.simple_list_item_1,tracks);\n list.setAdapter(arrayAdapter);\n }", "private void initializeAdapter() {\n }", "private void resetAdapter() {\n\n\t\tmSwipeList.discardUndo();\n\n\t\tString[] items = new String[20];\n\t\tfor (int i = 0; i < items.length; i++) {\n\t\t\titems[i] = String.format(\"Test Item %d\", i);\n\t\t}\n\n\t\tmAdapter = new ArrayAdapter<String>(this,\n\t\t\tandroid.R.layout.simple_list_item_1,\n\t\t\tandroid.R.id.text1,\n\t\t\tnew ArrayList<String>(Arrays.asList(items)));\n\t\tsetListAdapter(mAdapter);\n\n\t}", "@Override\n\tpublic void initialize() {\n\t\thideAdditionElements();\n\t//\tinitializeUserList();\n\t\t// TODO fill list with saved users\n\t\t\n//\t\tif(userList.size() > 0) {\n//\t\t\tuserListView.getSelectionModel().select(0);\n//\t\t}\n\t\t\n\t\tuserListView.getSelectionModel().selectedIndexProperty().addListener((obs, oldVal, newVal) -> selectUser());\n\t\tuserListView.setItems(userList);\n\t}", "private void supaporn() {\n\t\tlistView = (ListView) findViewById(R.id.listView1);\n\t\tlists = new ArrayList<items_list>();\n\t\tadapter=new MyAdater();\n\t\tlistView.setAdapter(adapter);\n\t}", "private void setupListView() {\n potList = loadPotList();\n arrayofpots = potList.getPotDescriptions();\n refresher(arrayofpots);\n }", "public interface OnPrepareListViewListener {\n\n /**\n * Called before the ListView is bound to an adapter.\n *\n * @param listView The ListView that will be shown in the dialog.\n */\n void onPrepareListView(ListView listView);\n }", "@Override\n public void onScroll(AbsListView view,\n int firstVisibleItem,\n int visibleItemCount,\n int totalItemCount) {\n return;\n }", "@Override\n\tvoid initialize() {\n\t\tdisplayedLabels.getItems().addAll(comboItems);\n\t\tdisplayedLabels.getSelectionModel().select(0);\n\t\tdisplayedLabels.valueProperty().addListener((oo, old, newValue) ->\n\t\t\t\tchangeLabelsInListView(newValue.getIndex())\n\t\t);\n\t\t\n\t\tfirstListView.getItems().addAll(fieldItems);\n\t\tsecondListView.getItems().addAll(fieldItems);\n\t\tpairsListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);\n\t\treadPreviousPairs();\n\t\tinitializeContextMenus();\n\t\tinitializeKeyBoardActions();\n\t\ttranslatePairFields();\n\t}", "@Override\n\tprotected void onResume() {\n\t\tsuper.onResume();\n\t\trefreshListView();\n\t}", "@Override\n protected void init() {\n REQUEST_PERMISSION_FOR_ACTIVITY = false;\n viewModel.setNavigator(this);\n viewModel.onStart(this);\n binding.welcomePager.setAdapter(adapter);\n\n addDots(0);\n binding.welcomePager.addOnPageChangeListener(viewListener);\n\n// handlingBackground();\n }", "@Override\r\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\r\n\t\t\tsetContentView(R.layout.list_pre);\r\n\t\t}", "private void initListView(View view)\n {\n\n theListView = (ListView) view.findViewById(R.id.ml_list_view);\n theListAdapter = new TextAdapter(layoutInflater);\n theListView.setAdapter((ListAdapter) theListAdapter);\n\n }", "@Override\n public void onListDataLoaded() {\n if (this.progressBar != null && !this.isListLoaded) {\n this.progressBar.setVisibility(View.GONE);\n }\n if (!this.isListLoaded) {\n addListHeader();\n this.isListLoaded = true;\n }\n }", "@Override\n public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {\n mListView = (ListView) view.findViewById(R.id.listView);\n// mTvEmpty = (TextView) view.findViewById(android.R.id.empty);\n\n Log.d(\"shan\",mController.getItem().toString());\n\n // create a new instance of adapter\n ItemAdapter adapter = new ItemAdapter(getActivity(),\n R.layout.item_list, mController.getItem());\n\n // set the adapter\n mListView.setAdapter(adapter);\n\n// if (adapter.isEmpty()) {\n// mTvEmpty.setVisibility(View.VISIBLE);\n// } else {\n// mTvEmpty.setVisibility(View.GONE);\n// }\n\n // set item click listener\n mListView.setOnItemClickListener(this);\n }", "@Override\n\tpublic void onLoaderReset(Loader<Cursor> loader) {\n\t\tsetListAdapter(null);\n\t}", "@Override\n public void initViews() {\n adapter = new PaymentAdapter(context, MainActivity.os.getPayments());\n ((ListView)views.get(\"LIST_VIEW\")).setAdapter(adapter);\n (views.get(\"ADD_BUTTON\")).setOnClickListener(this);\n }", "@Override\n public void onResume() {\n super.onResume();\n\n // put the entries back in the adapter\n if (notesList != null) {\n nAdapter = new NotesAdapter(notesList, getActivity());\n listView.setAdapter(nAdapter);\n }\n }", "@Override\r\n public void run() {\n mBinding.listView.setAdapter(new ArrayAdapter<>(mBinding.listView.getContext(),\r\n android.R.layout.simple_list_item_1, Arrays.asList(\"a\", \"b\")));\r\n }", "private void Init(Context context){\n\n if(adapter == null){\n adapter = new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1);\n }\n\n this.setAdapter(adapter);\n }", "@Override\n protected void onStart(){\n super.onStart();\n loadFromFile();\n adapter= new CustomAdapter(countbookList,getApplicationContext());\n listView.setAdapter(adapter);\n }", "private void loadItemList() {\n this.presenter.initialize();\n }", "@Override\n public void onStart() {\n super.onStart();\n showVenuesOnListview();\n }", "public void populateListView() {\n\n\n }", "@Override\r\n\tprotected ListBaseAdapter<News> getListAdapter() {\n\t\treturn null;\r\n\t}", "@Override\n protected void onResume() {\n super.onResume();\n adapter = new AdaptadorIngrediente(this, listaIngredientes);\n listview.setAdapter(adapter);\n }", "private void setListenersOnListView() {\r\n\r\n // On click listener.\r\n searchResultsList.setOnItemClickListener(new OnItemClickListener() {\r\n\r\n @Override\r\n public void onItemClick(AdapterView<?> arg00, View arg11,\r\n int arg22, long position) {\r\n\r\n handleSelectedItem((int) position);\r\n }\r\n\r\n });\r\n\r\n // On scroll listener.\r\n searchResultsList.setOnScrollListener(new OnScrollListener() {\r\n\r\n @Override\r\n public void onScrollStateChanged(AbsListView view, int scrollState) {\r\n\r\n if (scrollState == OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {\r\n\r\n AppUtils.hideKeyboard(activity);\r\n }\r\n }\r\n\r\n @Override\r\n public void onScroll(AbsListView view, int firstVisibleItem,\r\n int visibleItemCount, int totalItemCount) {\r\n\r\n }\r\n });\r\n }", "private void reloadListView() {\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n mDevicesListViewAdapter.notifyDataSetChanged();\n }\n });\n }", "public void onResume() {\n super.onResume();\n list.setAdapter(new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1,getData()));\n list.setTextFilterEnabled(true);\n\n }", "@Override\n\t\t\tpublic void onStart() {\n\t\t\t\tif (listitem != null || listitem.size() > 0) {\n\t\t\t\t\tlistitem.clear();\n\t\t\t\t}\n\t\t\t\tnew AsyncTask<Void, Void, Void>() {\n\t\t\t\t\tprotected Void doInBackground(Void... params) {\n\t\t\t\t\t\tgetdata(1);\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\n\t\t\t\t\t@Override\n\t\t\t\t\tprotected void onPostExecute(Void result) {\n\t\t\t\t\t\tif (count >= 19) {\n\t\t\t\t\t\t\txlistview.startLoadMore();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\txlistview.stopLoadMore();\n\t\t\t\t\t\t}\n\t\t\t\t\t\txlistview.setRefreshSuccess();\n\t\t\t\t\t\tadapter.notifyDataSetChanged();\n\t\t\t\t\t\tLog.d(TAG, \"jieshu\");\n\t\t\t\t\t}\n\t\t\t\t}.execute(null, null, null);\n\t\t\t}", "@Override\n public void onAdapterAboutToEmpty(int itemsInAdapter) {\n arrayAdapter.notifyDataSetChanged();\n Log.d(\"LIST\", \"notified\");\n i++;\n }", "@Override\n public void onActivityCreated (Bundle savedInstanceState){\n super.onCreate(savedInstanceState);\n\n getListView().setOnScrollListener(this);\n }", "private void initializeList() {\n findViewById(R.id.label_operation_in_progress).setVisibility(View.GONE);\n adapter = new MapPackageListAdapter();\n listView.setAdapter(adapter);\n listView.setVisibility(View.VISIBLE);\n listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {\n \n @Override\n public void onItemClick(AdapterView<?> parent, final View view, final int position, long id) {\n List<DownloadPackage> childPackages = searchByParentCode(currentPackages.get(position).getCode());\n if (childPackages.size() > 0) {\n currentPackages = searchByParentCode(currentPackages.get(position).getCode());\n adapter.notifyDataSetChanged();\n }\n }\n });\n }", "private void init() {\n\n if (shortListUserList.size()==0){\n fragmentShortlistuserListLayoutBinding.noDataAvailableTv.setVisibility(View.VISIBLE);\n fragmentShortlistuserListLayoutBinding.recyclerView.setVisibility(View.GONE);\n }else {\n fragmentShortlistuserListLayoutBinding.recyclerView.setVisibility(View.VISIBLE);\n fragmentShortlistuserListLayoutBinding.noDataAvailableTv.setVisibility(View.VISIBLE);\n ShortListedUserAdapter mAdapter = new ShortListedUserAdapter(getContext(), shortListUserList);\n RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getContext());\n fragmentShortlistuserListLayoutBinding.recyclerView.setLayoutManager(mLayoutManager);\n fragmentShortlistuserListLayoutBinding.recyclerView.setItemAnimator(new DefaultItemAnimator());\n fragmentShortlistuserListLayoutBinding.recyclerView.setAdapter(mAdapter);\n }\n }", "private void setOnListView() {\n\t\tlist.setItems(obs);\n\t\tlist.setCellFactory(new Callback<ListView<User>, ListCell<User>>(){\n\n\t\t\t@Override\n\t\t\tpublic ListCell<User> call(ListView<User> p) {\n\t\t\t\t\n\t\t\t\tListCell<User> cell = new ListCell<User>() {\n\t\t\t\t\t\n\t\t\t\t\t@Override \n\t\t\t\t\tprotected void updateItem(User s, boolean bln) {\n\t\t\t\t\t\tsuper.updateItem(s, bln);\n\t\t\t\t\t\tif(s != null) {\n\t\t\t\t\t\t\tsetText(s.getUserName());\n\t\t\t\t\t\t}else\n\t\t\t\t\t\t\tsetText(\"\");\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\treturn cell;\n\t\t\t}\n\t\t});\n\t}", "public DataPenemuanListAdapter(Context context) { mInflater = LayoutInflater.from(context); }", "@Override\n public void onScrollStateChanged(AbsListView view, int scrollState) {\n //does nothing\n }", "private void initAdaptersAndViews() {\n final Context context = getContext();\n mListViewAdapter = new FlickrHomeAdapter();\n mListLayoutManager = new LinearLayoutManager(context);\n mListLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);\n\n mViews.listView.addItemDecoration(new DividerItemDecoration(context, DividerItemDecoration.VERTICAL_LIST));\n mViews.listView.setHasFixedSize(true);\n mViews.listView.setLayoutManager(mListLayoutManager);\n mViews.listView.setAdapter(mListViewAdapter);\n }", "private void setViews() {\n try {\n mFilter = findViewById(R.id.filter);\n mPListView = findViewById(R.id.property_list_view);\n layoutManager = new LinearLayoutManager(this);\n mPListView.setLayoutManager(layoutManager);\n\n mPListView.addOnScrollListener(new RecyclerView.OnScrollListener() {\n @Override\n public void onScrolled(RecyclerView recyclerView, int dx, int dy) {\n super.onScrolled(recyclerView, dx, dy);\n totalItemCount = layoutManager.getItemCount();\n lastVisibleItem = layoutManager.findLastVisibleItemPosition();\n if (!isLoading && totalItemCount <= (lastVisibleItem + visibleThreshold)) {\n pageNo = pageNo + 1;\n getPropertyList(pageNo, applyFilter);\n isLoading = true;\n }\n }\n });\n\n mFilter.setOnClickListener(this);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "@Override\r\n protected void onStart() {\r\n super.onStart();\r\n adapter.startListening();\r\n }", "@Override\n\tprotected void onReset() {\n\t\tif (!mListViewExtrasEnabled) {\n\t\t\tsuper.onReset();\n\t\t\treturn;\n\t\t}\n\n\t\tfinal LoadingLayout originalLoadingLayout, listViewLoadingLayout;\n\t\tfinal int scrollToHeight, selection;\n\t\tfinal boolean scrollLvToEdge;\n\n\t\tswitch (getCurrentMode()) {\n\t\t\tcase MANUAL_REFRESH_ONLY:\n\t\t\tcase PULL_FROM_END:\n\t\t\t\toriginalLoadingLayout = getFooterLayout();\n\t\t\t\tlistViewLoadingLayout = mFooterLoadingView;\n\t\t\t\tselection = mRefreshableView.getCount() - 1;\n\t\t\t\tscrollToHeight = getFooterSize();\n\t\t\t\tscrollLvToEdge = Math.abs(mRefreshableView.getLastVisiblePosition() - selection) <= 1;\n\t\t\t\tbreak;\n\t\t\tcase PULL_FROM_START:\n\t\t\tdefault:\n\t\t\t\toriginalLoadingLayout = getHeaderLayout();\n\t\t\t\tlistViewLoadingLayout = mHeaderLoadingView;\n\t\t\t\tscrollToHeight = -getHeaderSize();\n\t\t\t\tselection = 0;\n\t\t\t\tscrollLvToEdge = Math.abs(mRefreshableView.getFirstVisiblePosition() - selection) <= 1;\n\t\t\t\tbreak;\n\t\t}\n\n\t\t// If the ListView header loading layout is showing, then we need to\n\t\t// flip so that the original one is showing instead\n\t\tif (listViewLoadingLayout.getVisibility() == View.VISIBLE) {\n\n\t\t\t// Set our Original View to Visible\n\t\t\toriginalLoadingLayout.showInvisibleViews();\n\n\t\t\t// Hide the ListView Header/Footer\n\t\t\tlistViewLoadingLayout.setVisibility(View.GONE);\n\n\t\t\t/**\n\t\t\t * Scroll so the View is at the same Y as the ListView\n\t\t\t * header/footer, but only scroll if: we've pulled to refresh, it's\n\t\t\t * positioned correctly\n\t\t\t */\n\t\t\tif (scrollLvToEdge && getState() != State.MANUAL_REFRESHING) {\n\t\t\t\tmRefreshableView.setSelection(selection);\n\t\t\t\tsetHeaderScroll(scrollToHeight);\n\t\t\t}\n\t\t}\n\n\t\t// Finally, call up to super\n\t\tsuper.onReset();\n\t}", "@Override\n\tpublic void initView() {\n\t\totherFee = new ArrayList<OtherFee>();\n\t\tMyApplication.addActivity(this);\n\t\trl_back_otherfee = (RelativeLayout) findViewById(R.id.rl_back_otherfee);\n\t\tlv_otherfee = (PullToRefreshListView) findViewById(R.id.lv_otherfee);\n\t\tlv_otherfee.setOnRefreshListener(this);\n\t\tlv_otherfee.setMode(Mode.BOTH);\n\t\tlvadapter = new MylVAdapter();\n\t\tlv_otherfee.setAdapter(lvadapter);\n\t\tgetData(1, pageSize);\n\t}", "@Override\n\tprotected void setViews() {\n\t\tlv = (XListView) findViewById(R.id.activity_fund_history_lv_content);\n\t\tlv.setPullRefreshEnable(false);\n\t\tlv.setPullLoadEnable(false);\n\t\tlv.setAdapter(adapter);\n\t\tgetMoneyChageRequest();\n\t}", "private void initCarsListView() {\n mCarsRecyclerView.setHasFixedSize(true);\n LinearLayoutManager mLayoutManager = new LinearLayoutManager(this);\n mCarsRecyclerView.setLayoutManager(mLayoutManager);\n getExecutor().submit(new ListCarsDbAction(getApp()));\n }", "public void setListAdapter() {\n\t\tm_dao = new ItemDao(this.getActivity());\n\t\t\n\t\tthis.m_adapter = new EditItemListAdapter(\n\t\t\t\tthis.getActivity(),\n\t\t\t\tR.layout.row,\n\t\t\t\tm_dao.getList());\n\n\n\n\t\tsetListAdapter(this.m_adapter);\n\n\t\tthis.m_adapter.setOnEditItemClickListener(\n\t\t\t\tnew EditItemListAdapter.OnEditItemClickListener() {\n\n\t\t\t\t\t/**\n\t\t\t\t\t * Update the item status in the DB table\n\t\t\t\t\t */\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void OnSelectItem(Item item) {\n\n\t\t\t\t\t\tif(!toDelete.contains(item))\n\t\t\t\t\t\t\ttoDelete.add(item);\n\t\t\t\t\t}\n\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void OnDeselectItem(Item item) {\n\t\t\t\t\t\tif(toDelete.contains(item))\n\t\t\t\t\t\t\ttoDelete.remove(item);\n\n\t\t\t\t\t}\n\n\n\t\t\t\t});\n\n\n\t\t\n\t}", "private void initView(List<PersonWrapper> listOfPersons) {\n adapter = new PersonAdapter(context, listOfPersons);\n mPersonsView.setAdapter(adapter);\n adapter.notifyDataSetChanged();\n }", "@Override\r\n public void onDataSetChanged() {\n }", "@Override\n public void setupList() {\n mSearchChildView.setupAdapter();\n mSearchChildView.setupRecyclerView();\n }", "@Override protected void onStart()\n {\n super.onStart();\n adapter.startListening();\n }", "@Override\n\t\t\t\tpublic void onScroll(AbsListView view, int firstVisibleItem,\n\t\t\t\t\t\tint visibleItemCount, int totalItemCount) {\n\n\t\t\t\t}", "@Override\n\t\t\tpublic void onScrollStateChanged(AbsListView view, int scrollState) {\n\t\t\t\tif (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_IDLE\n\t\t\t\t\t\t&& listView.getLastVisiblePosition() == listView.getCount() - 1)\n\t\t\t\t{\n\t\t\t\t\tif(list.size() != 0)\n\t\t\t\t\t\tload();\n\t\t\t\t}\n\t\t\t}", "@Override\n public void setAdapterViewBinder(final ViewBinder viewBinder) {\n if (viewBinder != null)\n CoreLogger.log(Level.ERROR, \"ignored viewBinder: \" + viewBinder, true);\n }", "@Override\n protected void onStart() {\n super.onStart();\n adapter.startListening();\n }", "private void init() {\n articleList = new ArrayList<>();\n newsAdapter = new NewsAdapter(getContext(), articleList, mListener, this);\n\n recyclerViewNews.setHasFixedSize(false);\n RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext());\n\n recyclerViewNews.setLayoutManager(layoutManager);\n recyclerViewNews.setAdapter(newsAdapter);\n }", "private void setUpBookingAdapter() {\n// mBinding.swipeRefresh.setRefreshing(false);\n if (null == mRequestAdapter) {\n mRequestAdapter = new RequestAdapter(mThis, mRequestModelList, this);\n mBinding.requestRv.setAdapter(mRequestAdapter);\n } else {\n mRequestAdapter.setmBooking_itemModelList(mRequestModelList);\n mRequestAdapter.notifyDataSetChanged();\n }\n }", "@Override\n public void notifyDataSetChanged() {\n super.notifyDataSetChanged();\n }", "public void setListView() {\n arr = inSet.toArray(new String[inSet.size()]);\n adapter = new ArrayAdapter(SetBlock.this, android.R.layout.simple_list_item_1, arr);\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n adapter.notifyDataSetChanged();\n listView.setAdapter(adapter);\n }\n });\n }", "public void redrawListView() {\n\t\tMySimpleCursorAdapter adapt = (MySimpleCursorAdapter)this.getListAdapter();\n\t\tadapt.notifyDataSetChanged();\n\t}", "@Override\r\n\tpublic void onViewCreated(View view, Bundle savedInstanceState) {\n\t\tsuper.onViewCreated(view, savedInstanceState);\r\n\t\t\r\n\t\tfinal BaseListView listView = (BaseListView) view.findViewById(R.id.listview);\r\n\t\tlistView.post(new Runnable() {\r\n\t\t\t\r\n\t\t\t@Override\r\n\t\t\tpublic void run() {\r\n\t\t\t\tsize = new Size(listView.getWidth(), null);\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t});\r\n\t\tadapter = new WallPagerListAdapter(getActivity(), list);\r\n\t\tlistView.setAdapter(adapter);\r\n\t\tlistView.setOnItemClickListener(this);\r\n\t\tlistView.setOnLoadListener(this);\r\n\t\tlistView.load(true);\r\n\t}", "@Override\r\n\tpublic void onActivityCreated(Bundle savedInstanceState) {\n\t\tinitView();\r\n\t\tgetListDataFromLocal();\r\n\t\tsuper.onActivityCreated(savedInstanceState);\r\n\t}", "@Override\n\tpublic void onScroll(AbsListView view, int firstVisibleItem,\n\t\t\tint visibleItemCount, int totalItemCount) {\n\n\t\tif (((firstVisibleItem + visibleItemCount) >= totalItemCount)\n\t\t\t\t&& totalItemCount != 0) {\n\t\t\tnew ListLoader().execute();\n\t\t}\n\t}", "@Override\n public void onNothingSelected(AdapterView<?> parent) {\n //No-op\n }", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n return initView(position, convertView, parent);\n }", "@Override\n public void onNothingSelected(AdapterView<?> adapterView) {\n\n }", "private void initView() {\n listView = (ListView)findViewById(R.id.phonesListView);\n listView.setEmptyView(findViewById(R.id.emptyElement));\n adapter = new PhonesCursorAdapter(this,cursor,false);\n listView.setAdapter(adapter);\n listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);\n listView.setMultiChoiceModeListener(new AbsListView.MultiChoiceModeListener() {\n @Override\n public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {\n\n }\n\n @Override\n public boolean onCreateActionMode(ActionMode mode, Menu menu) {\n MenuInflater menuInflater = mode.getMenuInflater();\n menuInflater.inflate(R.menu.list_menu,menu);\n return true;\n }\n\n @Override\n public boolean onPrepareActionMode(ActionMode mode, Menu menu) {\n return false;\n }\n\n @Override\n public boolean onActionItemClicked(ActionMode mode, MenuItem item) {\n switch (item.getItemId()){\n case R.id.deletePhones:\n deletePhones();\n return true;\n }\n return false;\n }\n\n @Override\n public void onDestroyActionMode(ActionMode mode) {\n\n }\n });\n listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {\n @Override\n public void onItemClick(AdapterView<?> parent, View view, int position, long id) {\n //Pobierz dane z bazy na temat wybranego obiektu i przekazuje do\n //kolejnej aktywnosci\n\n //pobieramy dane wybranego telefonu\n Cursor cursor = ResolverHelper.getData((int) id, MainListaActivity.this.getContentResolver());\n Bundle bundle = new Bundle();\n while(cursor.moveToNext()){\n bundle.putString(Constants._ID,cursor.getString(0));\n bundle.putString(Constants.PRODUCENT,cursor.getString(1));\n bundle.putString(Constants.MODEL_NAME,cursor.getString(2));\n bundle.putString(Constants.ANDR_VER,cursor.getString(3));\n bundle.putString(Constants.WWW,cursor.getString(4));\n }\n cursor.close();\n Intent intent = new Intent(MainListaActivity.this,PhoneActivity.class);\n intent.putExtras(bundle);\n startActivity(intent);\n }\n });\n }", "private void fillAdapter() {\n LoaderManager loaderManager = getSupportLoaderManager();\n Loader<String> recipesListLoader = loaderManager.getLoader(RECIPES_LIST_LOADER);\n if(recipesListLoader == null) {\n loaderManager.initLoader(RECIPES_LIST_LOADER, null, this);\n } else {\n loaderManager.restartLoader(RECIPES_LIST_LOADER, null, this);\n }\n }", "private void setListAdapter(ListAdapter adapter) {\n\n\t\t}", "protected void enableEmptyViewPolicy() {\n messageListView.setEmptyView(R.layout.empty_view, UltimateRecyclerView.EMPTY_KEEP_HEADER_AND_LOARMORE);\n }", "public void loadCategoryAdapter() {\n categoryAdapter = new CategoryAdapter(context, sectionItemsWithHeaders);\n listView.setAdapter(categoryAdapter);\n }", "private <T> void forceListRefreshOn(ListView<T> lsv) {\n\t\t//System.out.println(\"refreshing\");\n\t\tObservableList<T> items = lsv.<T>getItems();\n\t\tlsv.<T>setItems(null);\n\t\tlsv.<T>setItems(items);\n\t}", "@Override\n public void prepareView() {\n }", "@Override\n\tpublic void onActivityCreated(@Nullable Bundle savedInstanceState) {\n\t\tsuper.onActivityCreated(savedInstanceState);\n\t\tmListData = new ListData(mContext);\n\t\tmProgressBar.setVisibility(View.VISIBLE);\n\t\ttry {\n\t\t\tmListData.clear().setCallBack(\n new BaseResultListener() {\n\n @Override\n public <T> void OnComplete() {\n\n }\n\n @Override\n public <T> void OnComplete(ArrayList<T> arrayList) {\n mProgressBar.setVisibility(View.GONE);\n if(arrayList != null){\n mData = (ArrayList<ListHandler>) arrayList;\n mListAdapter = new ListAdapter(mContext, mData);\n mListView.setAdapter(mListAdapter);\n }\n\n }\n\n @Override\n public void OnError(String str) {\n mProgressBar.setVisibility(View.GONE);\n\n }\n }).setParam(\"?search=\"+ URLEncoder.encode(mSearch,\"utf-8\")).getView();\n\t\t} catch (UnsupportedEncodingException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\n\t}", "@Override\n\t\t\tpublic void onScroll(AbsListView view, int firstVisibleItem,\n\t\t\t\t\tint visibleItemCount, int totalItemCount) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onScroll(AbsListView view, int firstVisibleItem,\n\t\t\t\t\tint visibleItemCount, int totalItemCount) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onScroll(AbsListView view, int firstVisibleItem,\n\t\t\t\t\tint visibleItemCount, int totalItemCount) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onScroll(AbsListView view, int firstVisibleItem,\n\t\t\t\t\tint visibleItemCount, int totalItemCount) {\n\t\t\t\t\n\t\t\t}", "@Override\n public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {\n }", "@Override\n public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {\n }", "@Override\r\n public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {\n }", "private void initListView()\n {\n\n listViewHospital.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>()\n {\n public void changed(ObservableValue<? extends String> ov, String old_val, String new_val)\n {\n if (new_val != null)\n {\n //when a row in the listview is clicked, the listViewSelectedGeneral will be set as the content of that row\n listViewSelectedHospital = new_val;\n\n\n }\n }\n });\n\n listViewDoctor.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>()\n {\n public void changed(ObservableValue<? extends String> ov, String old_val, String new_val)\n {\n if (new_val != null)\n {\n listViewSelectedDoctor = new_val;\n\n }\n }\n });\n\n }", "@Override\n public void onNothingSelected(AdapterView<?> adapterView) {\n }", "@Override\n public void onNothingSelected(AdapterView<?> adapterView) {\n }" ]
[ "0.70021117", "0.6934602", "0.6551606", "0.65035343", "0.64083767", "0.64077014", "0.6386541", "0.6344737", "0.6321858", "0.63146967", "0.6314449", "0.62943083", "0.6285156", "0.6283871", "0.62652755", "0.6243223", "0.61941856", "0.6193928", "0.6176796", "0.6173119", "0.6157586", "0.6151141", "0.6141043", "0.6138834", "0.6127838", "0.6127316", "0.6121334", "0.6097079", "0.6089319", "0.6073663", "0.6066575", "0.60650253", "0.6061562", "0.60430956", "0.6041342", "0.603925", "0.6026448", "0.60102874", "0.6002416", "0.5987671", "0.59797853", "0.5976673", "0.59765893", "0.596612", "0.59505993", "0.5943305", "0.59406656", "0.5940294", "0.59276766", "0.59188217", "0.59167856", "0.5916595", "0.5899069", "0.58985806", "0.5898229", "0.58938414", "0.5886425", "0.58744", "0.5873456", "0.5873005", "0.5867504", "0.5844733", "0.5844335", "0.58314466", "0.5823774", "0.5817018", "0.58155125", "0.5805799", "0.5804468", "0.579463", "0.5791333", "0.5790372", "0.5788906", "0.5788654", "0.57876915", "0.5776218", "0.5775124", "0.5771222", "0.57700056", "0.57696015", "0.5768453", "0.5766747", "0.5758125", "0.5758083", "0.57549876", "0.5752574", "0.5751391", "0.57513124", "0.57506245", "0.5749784", "0.5749357", "0.5749357", "0.5749357", "0.5749357", "0.5745368", "0.5745368", "0.5741495", "0.5737485", "0.5736677", "0.5736677" ]
0.6699204
2
////////////////////////////////////////////////////////////////////// Description: Constructor internal since instances are created only by the SoRayPickAction. Use: internal
public SoPickedPoint(final SoPath _path, final SoState _state, final SbVec3f objSpacePoint) // //////////////////////////////////////////////////////////////////////// { int i, n; // Make a copy of the path since it most likely comes from the // current traversal path in an action, which will be changed soon. path = _path.copy(); path.ref(); // Save state so we can get matrices when we need them later state = _state; // Transform the object space point by the current modeling matrix // to get the world space point SoModelMatrixElement.get(state).multVecMatrix(objSpacePoint, worldPoint); // Make room in the detail list for one detail per node in the // path. Set all the detail pointers to NULL. n = ( SoFullPath.cast(path)).getLength(); details.set(n - 1, null); // Allocates space for (i = n - 2; i >= 0; --i) details.set(i, null); // Initialize material index to 0, the most common value materialIndex = 0; // Set on-geometry flag based on current pick style onGeometry = (SoPickStyleElement.get(state) != SoPickStyleElement.Style.BOUNDING_BOX); // Save the viewportRegion, we'll need it later: vpRegion.copyFrom(SoViewportRegionElement.get(state)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void\nrayPick(SoRayPickAction action)\n//\n////////////////////////////////////////////////////////////////////////\n{\n\t if (!shouldRayPick(action)) return;\n\n\t SoMaterialBindingElement.Binding binding =\n\t SoMaterialBindingElement.get(action.getState());\n\n\t boolean materialPerPart =\n\t (binding == SoMaterialBindingElement.Binding.PER_PART ||\n\t binding == SoMaterialBindingElement.Binding.PER_PART_INDEXED);\n\n\t SoPick.sopick_pick_cube(this.width.getValue(),\n\t this.height.getValue(),\n\t this.depth.getValue(),\n\t materialPerPart ? SoPick.SOPICK_MATERIAL_PER_PART : 0,\n\t this, action);\n\t}", "private SelectOSAction() {\r\n }", "protected ConvActionSelector() {\n super();\n }", "public Rook()\n {\n super();\n }", "public CreateIndividualPreAction() {\n }", "private StickFactory() {\n\t}", "public HSRCreateDraftRequestProcessorAction() {\n\t\tlogger.warn(\"***** This constructor is for Test Cases only *****\");\n\t\t\n\t}", "public SoPickedPoint( final SoPickedPoint pp)\n//\n////////////////////////////////////////////////////////////////////////\n{\n worldPoint.copyFrom(pp.worldPoint);\n worldNormal.copyFrom(pp.worldNormal);\n imageTexCoords.copyFrom(pp.imageTexCoords);\n materialIndex = pp.materialIndex;\n path = pp.path;\n onGeometry = pp.onGeometry;\n vpRegion.copyFrom(pp.vpRegion);\n\n // Copy the details - note that the copy() method for SoDetailList\n // makes copies of the detail instances. This has to be done\n // because the instances are deleted when the list is deleted.\n details.operator_equal(pp.details);\n\n // Ref the path, since we unref it when we are deleted\n path.ref();\n}", "Constructor() {\r\n\t\t \r\n\t }", "public Mouse() {}", "public Interaction() {\n }", "public Hit() {\n }", "public PlantingHarvester(int x, int y)\n {\n super(x, y);\n }", "protected void init_actions()\n {\n action_obj = new CUP$PCLParser$actions(this);\n }", "public MouseCrosstabShuttleVO()\n {\n // Documented empty block - avoid compiler warning - no super constructor\n }", "private ActionPackage() {}", "public TouchTool(IResourceChangeEditor editor, ISelection selection) {\n\tmEditor = editor;\n\tmCamera = editor.getCamera();\n\tmWorld = editor.getWorld();\n\tmInvoker = editor.getInvoker();\n\tmSelection = selection;\n}", "protected void init_actions()\r\n {\r\n action_obj = new CUP$CircuitCup$actions(this);\r\n }", "public void init()\r\n\t{\r\n\t\tm_behaviorName = \"Wander\";\r\n\t\t\r\n\t\t// Punkt auf dem Kreis festlegen\r\n\t\tRandom rand = new Random();\r\n\t\t\r\n\t\tVector2d vect = new Vector2d(rand.nextInt(),rand.nextInt());\r\n\t\t\r\n\t\t// evtl. negative Werte\r\n\t\t\r\n\t\tif (rand.nextInt() > 0.5) vect.setX(vect.getX() * (-1));\r\n\t\tif (rand.nextInt() > 0.5) vect.setY(vect.getY() * (-1));\r\n\t\t\r\n\t\t// Punkt auf dem Kreis festlegen durch Normalisierung u. Skalierung\r\n\t\tvect.normalize(); vect.scale(m_r);\r\n\t\tm_seekPoint = new Point2d(m_pos);\r\n\t\tm_seekPoint = m_seekPoint.add(vect); \r\n\t}", "public BattleWeaponsSegmentAction() {\n }", "private Road()\n\t{\n\t\t\n\t}", "protected PMBaseAction() {\r\n super();\r\n }", "public ShieldException() {\n }", "public CircleCADTool() {\r\n }", "@Override\r\n public void initAction() {\n \r\n }", "public Ov_Chipkaart() {\n\t\t\n\t}", "public OI() {\n\t\tgearShifter.whenActive(new SetShifterLowGear());\n\t\tgearShifter.whenInactive(new SetShifterHighGear());\n\n\t\t// ballIntakeForward.whenPressed(new BallIntakeSetForward());\n\t\t// ballIntakeReverse.whenPressed(new BallIntakeSetReverse());\n\t\t// ballIntakeStop.whenActive(new BallIntakeSetStop());\n\t\t//\n\t\t// feederForward.whenPressed(new FeederSetForward());\n\t\t// feederReverse.whenPressed(new FeederSetReverse());\n\t\t// feederStop.whenActive(new FeederSetStop());\n\t\t// //\n\t\t// flywheelForward.whenPressed(new FlywheelSetForward());\n\t\t// flywheelReverse.whenPressed(new FlywheelSetReverse());\n\t\t// flywheelStop.whenActive(new FlywheelSetStop());\n\t\t//\n\t\t// gearIntakeReverse.whileHeld(new IntakeInDown());\n\t\t// gearIntakeForward.whileHeld(new IntakeOutDown());\n\t\t// gearIntakeJoystickReverse.whileHeld(new IntakeInDown());\n\t\t// gearIntakeJoystickForward.whileHeld(new IntakeOutDown());\n\t\t// gearIntakeReverse.whenReleased(new IntakeInDownTimer());\n\t\t// gearIntakeForward.whenReleased(new IntakeOutDownTimer());\n\t\t// gearIntakeForward.whenReleased(new GearIntakeSetUp());\n\t\t// gearIntakeReverse.whenPressed(new GearIntakeSetReverse());\n\t\t// gearIntakeStop.whenActive(new GearIntakeSetStop());\n\t\t// gearIntakePosistionSwitch.whenPressed(new GearIntakeSetUp());\n\t\t// gearIntakePosistionSwitch.whenReleased(new GearIntakeSetDown());\n\t\t//\n\t\t// climber.whenPressed(new ClimberSetUp());\n\t\t// climber.whenReleased(new ClimberSetStop());\n\t\t//\n\t\t// otherShooter.whenPressed(new OtherShooterShoot());\n\t\t// otherShooter.whenReleased(new OtherShooterReset());\n\t}", "public MouseCatElephantClientState(){}", "public RefactoringAction(SelectedFileSet init) {\r\n super();\r\n System.out.println(\"RefactoringAction(SelectedFileSet)\");\r\n selectedFileSet = init;\r\n }", "public State(GameStateManager gameStateManager){ //constructor\n this.gameStateManager = gameStateManager;\n camera = new OrthographicCamera();\n mouse = new Vector3();\n }", "private Rekenhulp()\n\t{\n\t}", "public BoardFactory(PacManSprites spriteStore) {Collect.Hit(\"BoardFactory.java\",\"BoardFactory(PacManSprites spriteStore)\");this.sprites = spriteStore; Collect.Hit(\"BoardFactory.java\",\"BoardFactory(PacManSprites spriteStore)\", \"689\");}", "static void\n\t initClass()\n\t //\n\t ////////////////////////////////////////////////////////////////////////\n\t {\n\t enabledElements = new SoEnabledElementsList(null);\n\t methods = new SoActionMethodList(null);\n\t \n\t // Allocate a new action type id. There's no real parent id, so we\n\t // can't use the regular macro.\n\t classTypeId = SoType.createType(SoType.badType(), new SbName(\"SoAction\"), null);\n\t \n\t // Enable override element for all actions.\n\t enabledElements.enable(SoOverrideElement.getClassTypeId(SoOverrideElement.class),\n\t SoOverrideElement.getClassStackIndex(SoOverrideElement.class));\n\n\t // Profiler element may also be used from within all types of action\n\t // traversals.\n\t if (SoProfiler.isEnabled()) {\n\t /*SoAction::enabledElements*/enabledElements.enable(SoProfilerElement.getClassTypeId(SoProfilerElement.class),\n\t SoProfilerElement.getClassStackIndex(SoProfilerElement.class));\n\t }\n\n\t }", "public CarrierShape()\n {\n super();\n }", "public PlasmaSelectionTester() {\r\n\t}", "@Override\n protected void initialize() {\n if(sClimber.PreparedToClimb == true){\n sClimber.StageOneStart();\n sClimber.StageTwoStart();\n } else {\n end();\n }\n //sIntake.WristMove(mWristAngle);\n //sElevator.setHighGear(false);\n //sElevator.setPositionLowGear(mElevatorHieght);\n }", "public Agent(StateObservation so, ElapsedCpuTimer elapsedTimer)\n {\n actions = new ArrayList<> ();\n states = new ArrayList<> ();\n success = false;\n step = 0;\n }", "public JRibbonAction()\n\t{\n\t\tsuper();\n\t}", "public Resource() {\n\t\tsuper();\n\t\tfor (int i = 0; i < chopsticks.length; i++) {\n\t\t\tchopsticks[i] = 1;\n\t\t}\n\t}", "public RoadSign(int x, int y, String imageFileName) {\n super(x, y, imageFileName);\n }", "public void\nrayPickBoundingBox(SoRayPickAction action, final SbBox3f bbox)\n//\n////////////////////////////////////////////////////////////////////////\n{\n // Save the state so we don't affect the real complexity\n action.getState().push();\n\n // Change the complexity\n SoComplexityElement.set(action.getState(), 0.0f);\n SoComplexityTypeElement.set(action.getState(),\n SoComplexityTypeElement.Type.OBJECT_SPACE);\n\n // Change the current matrix to scale and translate the cube to the\n // correct spot. (We can't just use an extra matrix passed to\n // computeObjectSpaceRay(), since the points generated by\n // generatePrimitives() have to be transformed, not just the ray.)\n final SbVec3fSingle size = new SbVec3fSingle();\n bbox.getSize(size);\n\n // If any of the dimensions is 0, beef it up a little bit to avoid\n // scaling by 0\n if (size.getValueRead()[0] == 0.0)\n size.getValue()[0] = 0.00001f;\n if (size.getValueRead()[1] == 0.0)\n size.getValue()[1] = 0.00001f;\n if (size.getValueRead()[2] == 0.0)\n size.getValue()[2] = 0.00001f;\n\n SoModelMatrixElement.translateBy(action.getState(), this,\n bbox.getCenter());\n SoModelMatrixElement.scaleBy(action.getState(), this,\n size.operator_mul(0.5f));\n\n // Compute the picking ray in the space of the shape\n computeObjectSpaceRay(action);\n\n // Pick using primitive generation. Make sure we know that we are\n // picking on just a bounding box of another shape, so details\n // won't be created.\n pickingBoundingBox = true;\n generatePrimitives(action);\n\n // Restore the state\n action.getState().pop();\n}", "public PencilTool() {\n super();\n myPencil = new Path2D.Double(); \n }", "private TweetRiver() { }", "public Chick() {\n\t}", "@Override\n protected void init() {\n }", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "private IndexBitmapObject() {\n\t}", "private State5() {\n\t}", "private USI_KICKO() {}", "private CheckingTools() {\r\n super();\r\n }", "protected Shape() {}", "protected void init_actions()\n {\n action_obj = new CUP$FractalParser$actions(this);\n }", "public TileSelector(){\r\n super();\r\n \r\n }", "private PSAAClientActionFactory()\n {\n }", "public ScribbleFactoryImpl()\n {\n\t\tsuper();\n\t}", "protected void init_actions()\r\n {\r\n action_obj = new CUP$SintaxAnalysis$actions(this);\r\n }", "public CarrierShape(int x,int y)\n {\n super(x,y);\n }", "private void __sep__Constructors__() {}", "protected Reaction() {/* intentionally empty block */}", "private InternalRefactoringProcessor(List<EObject> selection){\r\n\t\t\t\tsuper(getParent(), selection, applyRefactoring());\t\t\t\t\r\n\t\t}", "protected void initialize() {\n \tif (Robot.shifters.getGear() == Shifters.Gear.HIGH) {\n \tRobot.shifters.shift(Shifters.Gear.LOW);\n \t} else {\n \tRobot.shifters.shift(Shifters.Gear.HIGH);\n \t}\n }", "public Steganography() {}", "public Shot() {\n }", "private PTypeRefSkel() {}", "private ImagingActionsParser() {\n\t\t// private constructor.\n\t}", "public XpeDccWfActionROVORowImpl() {\n }", "public TRIP_Sensor () {\n super();\n }", "public RayTracerBasic(Scene scene)\r\n\t{\r\n\t\tsuper(scene);\r\n\t}", "ROp() {super(null); _ops=new HashMap<>(); }", "public AbstractBinaryInteraction() {\n\n\t}", "@Override\r\n\tpublic final void init() {\r\n\r\n\t}", "public void init() {\r\n\t\t// to override\r\n\t}", "protected void init_actions()\n {\n action_obj = new CUP$CoolParser$actions(this);\n }", "protected void init_actions()\n {\n action_obj = new CUP$CoolParser$actions(this);\n }", "public Pleasure() {\r\n\t\t}", "@Override\r\n\tpublic void init() {}", "public Gate(){\n\n }", "protected Checkpoint() {\n super();\n }", "protected void initialize() {\n \tstartTime = System.currentTimeMillis();\n \tintake.setLeftPower(power);\n \tintake.setRightPower(power);\n }", "private Instantiation(){}", "private CircleSampler() {\n\t}", "public Soil()\n\t{\n\n\t}", "@Override\n public void init() {}", "private void _init() {\n }", "public Lane() {\n\t}", "@Override\n public void init() {\n }", "public SelectionEvent() {\n }", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "public AirAndPollen() {\n\n\t}", "@Override\n\t\tpublic void init() {\n\t\t}", "protected void _init(){}", "private ExBasicActionList(int... actionIds)\r\n\t{\r\n\t\t_actionIds = actionIds;\r\n\t}", "public void\ninit(SoState state)\n//\n////////////////////////////////////////////////////////////////////////\n{\n flags = 0;\n}", "public AirField() {\n\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}" ]
[ "0.6289943", "0.6191724", "0.6089672", "0.5961849", "0.58644354", "0.58293945", "0.58293486", "0.5784106", "0.57591814", "0.5745174", "0.572186", "0.57145417", "0.5713367", "0.5707928", "0.569062", "0.5681599", "0.5679232", "0.56721693", "0.5669542", "0.5666401", "0.56503046", "0.56502974", "0.5627611", "0.5625952", "0.560417", "0.56012684", "0.5594948", "0.5591588", "0.5589323", "0.5584781", "0.55794597", "0.55632126", "0.556232", "0.55599684", "0.555971", "0.55590445", "0.55550957", "0.55451727", "0.5544607", "0.55419195", "0.5535878", "0.5523038", "0.55228156", "0.551197", "0.5510816", "0.5500987", "0.5487359", "0.5479415", "0.547796", "0.54749686", "0.5472894", "0.54710215", "0.5468686", "0.5466648", "0.5463582", "0.54626226", "0.5461833", "0.54557997", "0.5450874", "0.54427695", "0.5441786", "0.5431167", "0.5427475", "0.5422762", "0.54122627", "0.5409002", "0.5408456", "0.5407963", "0.54025877", "0.53846204", "0.5381728", "0.537813", "0.5372688", "0.5372688", "0.537056", "0.5367675", "0.53673124", "0.536598", "0.5363043", "0.53608745", "0.5359141", "0.5354295", "0.5354265", "0.5353855", "0.53499", "0.5348732", "0.534302", "0.5340726", "0.5340726", "0.5340726", "0.5340726", "0.5340726", "0.53400385", "0.53352123", "0.53333133", "0.5331748", "0.5330198", "0.5325197", "0.53192896", "0.53192896" ]
0.55731016
31
////////////////////////////////////////////////////////////////////// Description: Copy constructor. Use: public
public SoPickedPoint( final SoPickedPoint pp) // //////////////////////////////////////////////////////////////////////// { worldPoint.copyFrom(pp.worldPoint); worldNormal.copyFrom(pp.worldNormal); imageTexCoords.copyFrom(pp.imageTexCoords); materialIndex = pp.materialIndex; path = pp.path; onGeometry = pp.onGeometry; vpRegion.copyFrom(pp.vpRegion); // Copy the details - note that the copy() method for SoDetailList // makes copies of the detail instances. This has to be done // because the instances are deleted when the list is deleted. details.operator_equal(pp.details); // Ref the path, since we unref it when we are deleted path.ref(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void copyConstructor(){\n\t}", "public void copy() {\n\n\t}", "@Override\n\tprotected void copy(Object source, Object dest) {\n\t\t\n\t}", "Prototype makeCopy();", "public CMObject copyOf();", "public Clone() {}", "@Override\r\n\tprotected Object clone() throws CloneNotSupportedException { // semi-copy\r\n\t\tthrow new CloneNotSupportedException();\r\n\t}", "public abstract INodo copy();", "public Object clone()\n/* */ {\n/* 835 */ return super.clone();\n/* */ }", "public MossClone() {\n super();\n }", "@Override\n public Object clone() {\n return super.clone();\n }", "static void setCopying(){isCopying=true;}", "public Picture(Picture copyPicture)\n {\n // let the parent class do the copy\n super(copyPicture);\n }", "public Picture(Picture copyPicture)\n {\n // let the parent class do the copy\n super(copyPicture);\n }", "protected Shingle copy() {\n return new Shingle(this);\n }", "public SceneLabelObjectState copy(){\n\n\t\t//get a copy of the generic data from the supertype\n\t\tSceneDivObjectState genericCopy = super.copy(); \n\n\t\t//then generate a copy of this specific data using it (which is easier then specifying all the fields\n\t\t//Separately like we used too)\n\t\tSceneLabelObjectState newObject = new SceneLabelObjectState(\n\t\t\t\tgenericCopy,\n\t\t\t\tObjectsCurrentText,\t\t\n\t\t\t\tCSSname,\n\t\t\t\tcursorVisible,\n\t\t\t\tTypedText,\n\t\t\t\tCustom_Key_Beep,\n\t\t\t\tCustom_Space_Beep);\n\n\t\treturn newObject;\n\n\n\t}", "@Override\r\n\tpublic Buffer copy() {\n\t\t\r\n\t\treturn null;\r\n\t}", "@Override\n\tpublic Object clone() throws CloneNotSupportedException {\n\treturn super.clone();\n\t}", "public Object clone ()\n\t{\n\t\ttry \n\t\t{\n\t\t\treturn super.clone();\n\t\t}\n\t\tcatch (CloneNotSupportedException e) \n\t\t{\n throw new InternalError(e.toString());\n\t\t}\n\t}", "public SoPickedPoint \ncopy() \n//\n////////////////////////////////////////////////////////////////////////\n{\n SoPickedPoint newCopy = new SoPickedPoint(this);\n return newCopy;\n}", "@Override\r\n\tpublic Object clone() throws CloneNotSupportedException {\n\t\t\r\n\t\treturn super.clone();\r\n\t}", "Object clone();", "Object clone();", "@Override\r\n\tprotected Object clone() throws CloneNotSupportedException {\n\t\tthrow new CloneNotSupportedException();\r\n\t}", "T copy();", "@Override\n public Object clone() throws CloneNotSupportedException{\n return super.clone();\n }", "@Override\r\n\tprotected Object clone() throws CloneNotSupportedException {\n\t\treturn super.clone();\r\n\t}", "@Override\r\n\tprotected Object clone() throws CloneNotSupportedException {\n\t\treturn super.clone();\r\n\t}", "@Override\r\n\tprotected Object clone() throws CloneNotSupportedException {\n\t\treturn super.clone();\r\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "public abstract B copy();", "public Object clone()\n {\n Object o = null;\n try\n {\n o = super.clone();\n }\n catch (CloneNotSupportedException e)\n {\n e.printStackTrace();\n }\n return o;\n}", "public abstract Object clone() ;", "public Object clone() {\n // No problems cloning here since private variables are immutable\n return super.clone();\n }", "public Card makeCopy(){\n return new Card(vimage);\n }", "public Card copy(){\n return new Card(Suits, Value);\n }", "@Override\r\n\tpublic Object clone() throws CloneNotSupportedException {\n\t\treturn super.clone();\r\n\t}", "public abstract SoftwareLight copy();", "@Override\n public Object clone() throws CloneNotSupportedException {\n throw new CloneNotSupportedException();\n }", "@Override\n\tprotected Object clone() throws CloneNotSupportedException {\n\t\treturn super.clone();\n\t}", "@Override\n\tprotected Object clone() throws CloneNotSupportedException {\n\t\treturn super.clone();\n\t}", "@Override\n\tprotected Object clone() throws CloneNotSupportedException {\n\t\treturn super.clone();\n\t}", "@Override\n\tprotected Object clone() throws CloneNotSupportedException {\n\t\treturn super.clone();\n\t}", "@Override\n\tprotected Object clone() throws CloneNotSupportedException {\n\t\treturn super.clone();\n\t}", "@Override\n\tprotected Object clone() throws CloneNotSupportedException {\n\t\treturn super.clone();\n\t}", "@Override\n\tprotected Object clone() throws CloneNotSupportedException {\n\t\treturn super.clone();\n\t}", "@Override\n\tprotected Object clone() throws CloneNotSupportedException {\n\t\treturn super.clone();\n\t}", "@Override\n\tprotected Object clone() throws CloneNotSupportedException {\n\t\treturn super.clone();\n\t}", "@Override\n public TopicObject copy() {\n return new TopicObject(this);\n }", "@Override\n protected Object clone() throws CloneNotSupportedException {\n\n return super.clone();\n }", "public Object clone(){\n \t\n \treturn this;\n \t\n }", "public Object clone() {\n return this.copy();\n }", "@Override\n public String getObjectCopy() {\n return null;\n }", "public Object clone() throws CloneNotSupportedException { return super.clone(); }", "@Override\n\tpublic Object clone() throws CloneNotSupportedException {\n\t\tthrow new CloneNotSupportedException();\n\t}", "public /*@ non_null @*/ Object clone() {\n return this;\n }", "@Test\n\tpublic void testCopyConstructor() {\n\t\tItem copy = new Item(item);\n\t\t\n\t\tassertTrue(\"Item copied using copy constructor: \",item.equals(copy)); \n\t\tassertNotSame(\"Item copied is not a reference to the same item: \",item, copy);\n\t}", "@Override\n\tpublic Object clone() throws CloneNotSupportedException {\n\t\treturn super.clone();\n\t}", "@Override\n\tpublic Object clone() throws CloneNotSupportedException {\n\t\treturn super.clone();\n\t}", "@Override\n\tpublic Object clone() throws CloneNotSupportedException {\n\t\treturn super.clone();\n\t}", "public Constructor(){\n\t\t\n\t}", "@Override\n public AbstractRelic makeCopy() {\n return new Compendium();\n }", "IUnit copy();", "public StudyClass getCopy(){\r\n String nc = className;\r\n String[] rc = roomConstraint.clone();\r\n return new StudyClass(internalId, classNum, nc, sks, rc, tConstraint.getCopy());\r\n }", "public Contenido copiar() {\n\t\tthrow new NotImplementedException();\r\n\t}", "public CFExp deepCopy(){\r\n return this;\r\n }", "public Object clone () {\n\t\t\ttry {\n\t\t\t\treturn super.clone();\n\t\t\t} catch (CloneNotSupportedException e) {\n\t\t\t\tthrow new InternalError(e.toString());\n\t\t\t}\n\t\t}", "public abstract Object clone();", "public Object clone();", "public Object clone();", "public Object clone();", "public Object clone();", "private Shop shallowCopy() {\n BookShop obj = null;\n try {\n obj = (BookShop) super.clone();\n } catch (CloneNotSupportedException exc) {\n exc.printStackTrace();\n }\n return obj;\n }", "@Override\n\tpublic SecuredRDFList copy();", "private Object copy ( Object record )\n\t{\n\t try\n {\n ByteArrayOutputStream baos = new ByteArrayOutputStream ();\n ObjectOutputStream oos = new ObjectOutputStream (baos);\n oos.writeObject (record);\n \n ByteArrayInputStream bais = new ByteArrayInputStream ( baos.toByteArray () );\n ObjectInputStream ois = new ObjectInputStream (bais);\n return ois.readObject ();\n }\n catch (Exception e)\n {\n throw new RuntimeException (\"Cannot copy record \" + record.getClass() + \" via serialization \" );\n }\n\t}", "@Override\n\tpublic Object clone() {\n\t\treturn null;\n\t}", "public Object clone() throws CloneNotSupportedException{\n\t\tthrow (new CloneNotSupportedException());\n\t}", "@Override\r\npublic int getNumcopy() {\n\treturn super.getNumcopy();\r\n}", "public Record copy() {\n\t\treturn new Record(video, numOwned, numOut, numRentals);\n\t}", "@Override\n public weighted_graph copy() {\n weighted_graph copy = new WGraph_DS(this.ga);//create the copy graph via copy constructor\n return copy;\n }", "org.omg.CORBA.Object _duplicate();", "public Object clone()\n {\n PSRelation copy = new PSRelation(new PSCollection(m_keyNames.iterator()),\n new PSCollection(m_keyValues.iterator()));\n \n copy.m_componentState = m_componentState;\n copy.m_databaseComponentId = m_databaseComponentId;\n copy.m_id = m_id;\n\n return copy;\n }", "Buffer copy();", "public Object clone() {\n FileTransfer ft = new FileTransfer();\n ft.mLogicalFile = new String(this.mLogicalFile);\n ft.mFlags = (BitSet) this.mFlags.clone();\n ft.mTransferFlag = this.mTransferFlag;\n ft.mSize = this.mSize;\n ft.mType = this.mType;\n ft.mJob = new String(this.mJob);\n ft.mPriority = this.mPriority;\n ft.mURLForRegistrationOnDestination = this.mURLForRegistrationOnDestination;\n ft.mMetadata = (Metadata) this.mMetadata.clone();\n ft.mVerifySymlinkSource = this.mVerifySymlinkSource;\n // the maps are not cloned underneath\n\n return ft;\n }", "public Object clone() throws CloneNotSupportedException\n\t{\n\t\tthrow new CloneNotSupportedException();\n\t}", "public JsonFactory copy()\n/* */ {\n/* 324 */ _checkInvalidCopy(JsonFactory.class);\n/* */ \n/* 326 */ return new JsonFactory(this, null);\n/* */ }", "public Function clone();", "static void setNotCopying(){isCopying=false;}", "public ConfabulatorObject getCopy() {\n\t\tConfabulatorObject copy = new ConfabulatorObject(getMessenger());\n\t\tlockMe(this);\n\t\tint maxD = maxLinkDistance;\n\t\tint maxC = maxLinkCount;\n\t\tList<Link> linksCopy = new ArrayList<Link>();\n\t\tfor (Link lnk: links) {\n\t\t\tlinksCopy.add(lnk.getCopy());\n\t\t}\n\t\tunlockMe(this);\n\t\tcopy.initialize(maxD,maxC,linksCopy);\n\t\treturn copy;\n\t}", "public Object clone() throws CloneNotSupportedException {\r\n\t\tthrow new CloneNotSupportedException();\r\n\t}", "public Object clone() throws CloneNotSupportedException {\n throw new CloneNotSupportedException(\"clone() is not supported in \"+this.getClass().getName());\n }", "@Override\r\npublic void setNumcopy(int numcopy) {\n\tsuper.setNumcopy(numcopy);\r\n}", "protected Factorization copy(){\n Factorization newFactor = new Factorization(this.mdc);\n //shallow copy\n newFactor.setRecipes(recipes);\n newFactor.setIngredients(ingredients);\n newFactor.setUserMap(userMap);\n newFactor.setUserMapReversed(userMap_r);\n newFactor.setRecipeMap(recipeMap);\n newFactor.setRecipeMapReversed(recipeMap_r);\n newFactor.setIngredientMap(ingredientMap);\n newFactor.setIngredientMapReversed(ingredientMap_r);\n \n //deep copy\n List<User> userCopy = new ArrayList<User>();\n for(User curr: this.users){\n userCopy.add(new User(curr.getId()));\n }\n newFactor.setUsers(userCopy);\n newFactor.setDataset(dataset.copy());\n newFactor.updateInitialSpace();\n return newFactor;\n }", "public BackupFSArchiveCopy() {\n super();\n }", "@Override\n public SharedObject clone() {\n SharedObject c;\n try {\n c = (SharedObject)super.clone();\n } catch (CloneNotSupportedException e) {\n // Should never happen.\n throw new ICUCloneNotSupportedException(e);\n }\n c.refCount = new AtomicInteger();\n return c;\n }", "@Override\n public ChatReceivePacket copy() {\n return new ChatReceivePacket(this);\n }", "public abstract Node copy();", "public ByteBuf copy()\r\n/* 685: */ {\r\n/* 686:694 */ recordLeakNonRefCountingOperation(this.leak);\r\n/* 687:695 */ return super.copy();\r\n/* 688: */ }", "@Override\n\tpublic function copy() {\n\t\tMonom M=new Monom(this.get_coefficient(),this.get_power());\n\t\t\n\t\treturn M;\n\t}", "public Object clone() {\n/* */ try {\n/* 111 */ return super.clone();\n/* */ }\n/* 113 */ catch (CloneNotSupportedException cloneNotSupportedException) {\n/* 114 */ throw new InternalError(cloneNotSupportedException.toString(), cloneNotSupportedException);\n/* */ } \n/* */ }", "public final Object clone() throws java.lang.CloneNotSupportedException {\n\t\tthrow new java.lang.CloneNotSupportedException();\n\t}" ]
[ "0.78859895", "0.75189835", "0.7358715", "0.73057216", "0.7220868", "0.7207802", "0.7010113", "0.6869025", "0.68332344", "0.6729722", "0.66971594", "0.6685392", "0.6684291", "0.6684291", "0.66621935", "0.6659776", "0.66580725", "0.6631799", "0.6617495", "0.6600115", "0.65894485", "0.6582342", "0.6582342", "0.6574661", "0.65568924", "0.6550174", "0.65458447", "0.65458447", "0.65458447", "0.65227246", "0.65027446", "0.6497616", "0.64845914", "0.6483062", "0.6458199", "0.6457768", "0.64528483", "0.64523506", "0.64458114", "0.64329994", "0.64329994", "0.64329994", "0.64329994", "0.64329994", "0.64329994", "0.64329994", "0.64329994", "0.64329994", "0.64323634", "0.64125997", "0.640749", "0.63877827", "0.6383031", "0.6372817", "0.6369656", "0.6366874", "0.63601345", "0.63573736", "0.63573736", "0.63573736", "0.6356452", "0.6351055", "0.6347689", "0.6335774", "0.6332114", "0.6326056", "0.6317425", "0.63069624", "0.63037", "0.63037", "0.63037", "0.63037", "0.6292475", "0.628006", "0.62663275", "0.62540907", "0.6247937", "0.62442815", "0.6244219", "0.62349606", "0.6232976", "0.6221515", "0.6220268", "0.6214362", "0.6165491", "0.61641747", "0.61640704", "0.61421376", "0.6136986", "0.61301416", "0.6115996", "0.6103975", "0.61003363", "0.6095438", "0.6084879", "0.60845816", "0.6084433", "0.6077318", "0.6069747", "0.60679424", "0.6062916" ]
0.0
-1
////////////////////////////////////////////////////////////////////// Description: Destructor Use: public
public void destructor() // //////////////////////////////////////////////////////////////////////// { // Free up path path.unref(); // The SoDetailList destructor deletes all details in the list, so // we don't have to do it here }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\t\n\tpublic void destroy() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void destroy() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void destroy() {\n\t\t\n\t}", "@Override\n\tpublic void destroy() {\n\t\t\n\t}", "@Override\n\tpublic void destroy() {\n\t\t\n\t}", "@Override\n\tpublic void destroy() {\n\t\t\n\t}", "@Override\n\tpublic void destroy() {\n\t\t\n\t}", "@Override\n\tpublic void destroy() {\n\t\t\n\t}", "@Override\n\tpublic void destroy() {\n\t\t\n\t}", "@Override\n\tpublic void destroy() {\n\t\t\n\t}", "@Override\n\tpublic void destroy() {\n\t\t\n\t}", "@Override\n\tpublic void destroy() {\n\t\t\n\t}", "@Override\n\tpublic void destroy() {\n\t\t\n\t}", "@Override\n\tpublic void destroy() {\n\t\t\n\t}", "@Override\n\tpublic void destroy() {\n\t\t\n\t}", "@Override\n\tpublic void destroy() {\n\t\t\n\t}", "@Override\n\tpublic void destroy() {\n\t\t\n\t}", "@Override\n\tpublic void destroy() {\n\t\t\n\t}", "@Override\n\tpublic void destroy() {\n\t\t\n\t}", "@Override\n\tpublic void destroy() {\n\t\t\n\t}", "@Override\n\tpublic void destroy() {\n\t\t\n\t}", "@Override\n\tpublic void destroy() {\n\t\t\n\t}", "@Override\n\tpublic void destroy() {\n\t\t\n\t}", "@Override\n\tpublic void destroy() {\n\t\t\n\t}", "@Override\n\tpublic void destroy(){\n\t\t\n\t}", "@Override\r\n\tpublic void destroy() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void destroy() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void destroy() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void destroy() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void destroy() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void destroy() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void destroy() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void destroy() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void destroy() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void destroy() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void destroy() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void destroy() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void destroy() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void destroy() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void destroy()\r\n\t{\n\t\t\r\n\t}", "@Override\r\n\tpublic void destroy() {\n\r\n\t}", "@Override\r\n\tpublic void destroy() {\n\r\n\t}", "@Override\r\n\tpublic void destroy() {\n\r\n\t}", "@Override\r\n\tpublic void destroy() {\n\r\n\t}", "@Override\r\n\tpublic void destroy() {\n\r\n\t}", "@Override\r\n\tpublic void destroy() {\n\r\n\t}", "@Override\r\n\tpublic void destroy() {\n\r\n\t}", "@Override\r\n public void destroy() {\n\r\n }", "@Override\n public void destroy() {\n\n }", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n\tpublic void destroy() {\n\n\t}", "@Override\n public void destroy() {\n\n }", "@Override\n public void destroy() {\n\n }", "@Override\n public void destroy() {\n\n }", "@Override\r\n public void destroy() {\n }", "@Override\r\n public void destroy() {\n }", "@Override()\r\n protected void finalize() {\r\n destroy();\r\n }", "@Override\n public void destroy() {\n }", "@Override\n public void destroy() {\n }", "@Override\n public void destroy() {\n }", "@Override\r\n\tpublic void destroy() {\n\t}", "@Override\n public void destroy() {\n \n }", "@Override\n\tpublic void detalhar() {\n\t\t\n\t}", "@Override\n public void destroy() {\n }", "@Override\n public void destroy() {\n }", "@Override\n public void destroy() {\n }", "@Override\n public void destroy() {\n }", "@Override\n public void destroy() {\n }", "@Override\n\tpublic void destroy() {\n\t}", "@Override\n\tpublic void destroy() {\n\t}", "@Override\n\tpublic void destroy() {\n\t}" ]
[ "0.7441494", "0.73766166", "0.7298055", "0.7298055", "0.7298055", "0.7298055", "0.7298055", "0.7298055", "0.7298055", "0.7298055", "0.7298055", "0.7298055", "0.7298055", "0.7298055", "0.7298055", "0.7298055", "0.7298055", "0.7298055", "0.7298055", "0.7298055", "0.7298055", "0.7298055", "0.7298055", "0.7298055", "0.7292363", "0.7258519", "0.7258519", "0.7258519", "0.7258519", "0.7258519", "0.7258519", "0.7258519", "0.7258519", "0.7258519", "0.7258519", "0.7258519", "0.7258519", "0.7258519", "0.7258519", "0.7257264", "0.72436255", "0.72436255", "0.72436255", "0.72436255", "0.72436255", "0.72436255", "0.72436255", "0.72430193", "0.72367686", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7215693", "0.7203386", "0.7203386", "0.7203386", "0.72028047", "0.72028047", "0.7196854", "0.7180821", "0.7177419", "0.71706134", "0.7169264", "0.715844", "0.7154425", "0.714981", "0.714981", "0.714981", "0.714981", "0.714981", "0.7133455", "0.7133455", "0.7133455" ]
0.0
-1
////////////////////////////////////////////////////////////////////// Description: Returns an instance that is a copy of this instance. The caller is responsible for deleting the copy when done. Use: public
public SoPickedPoint copy() // //////////////////////////////////////////////////////////////////////// { SoPickedPoint newCopy = new SoPickedPoint(this); return newCopy; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected Shingle copy() {\n return new Shingle(this);\n }", "public Object clone() {\n return this.copy();\n }", "public CopyBuilder copy() {\n return new CopyBuilder(this);\n }", "public Object clone(){\n \t\n \treturn this;\n \t\n }", "public T copy() {\n T ret = createLike();\n ret.getMatrix().setTo(this.getMatrix());\n return ret;\n }", "public abstract Instance duplicate();", "public Record copy() {\n\t\treturn new Record(video, numOwned, numOut, numRentals);\n\t}", "@Override\n public TopicObject copy() {\n return new TopicObject(this);\n }", "Prototype makeCopy();", "public Dispatchable copy() {\n return this;\n }", "public Client copy() {\n\t\tClient clone = new Client(ID, Email, PostalAddress);\n\t\treturn(clone);\n\t}", "public /*@ non_null @*/ Object clone() {\n return this;\n }", "public Object clone() {\n // No problems cloning here since private variables are immutable\n return super.clone();\n }", "@Override\n public AbstractRelic makeCopy() {\n return new Compendium();\n }", "public Record copy() {\n return new Record(\n this.id,\n this.location.copy(),\n this.score\n );\n }", "public ConfabulatorObject getCopy() {\n\t\tConfabulatorObject copy = new ConfabulatorObject(getMessenger());\n\t\tlockMe(this);\n\t\tint maxD = maxLinkDistance;\n\t\tint maxC = maxLinkCount;\n\t\tList<Link> linksCopy = new ArrayList<Link>();\n\t\tfor (Link lnk: links) {\n\t\t\tlinksCopy.add(lnk.getCopy());\n\t\t}\n\t\tunlockMe(this);\n\t\tcopy.initialize(maxD,maxC,linksCopy);\n\t\treturn copy;\n\t}", "public Instance clone() {\n Instance copy;\n try {\n copy = new Instance(getNameValue().toString());\n } catch (JNCException e) {\n copy = null;\n }\n return (Instance)cloneContent(copy);\n }", "public Card makeCopy(){\n return new Card(vimage);\n }", "public Ping dup (Ping self)\n {\n if (self == null)\n return null;\n\n Ping copy = new Ping ();\n if (self.getIdentity () != null)\n copy.setAddress (self.getIdentity ());\n copy.digest = new ArrayList <State> (self.digest);\n return copy;\n }", "public O copy() {\n return value();\n }", "public QueueEntry copy() {\n return new QueueEntry(playerName, string, loc, type);\n }", "public State dup (State self)\n {\n if (self == null)\n return null;\n\n State copy = new State ();\n if (self.getIdentity () != null)\n copy.setAddress (self.getIdentity ());\n copy.address = self.address;\n copy.addressPort = self.addressPort;\n copy.generation = self.generation;\n copy.max_version = self.max_version;\n copy.extra = new VersionedMap (self.extra);\n return copy;\n }", "@Override\n protected Object clone() throws CloneNotSupportedException {\n throw new CloneNotSupportedException();\n // return super.clone(); // OR we can return the already present :: return getInstance();\n }", "public Instance cloneShallow() {\n Instance copy;\n try {\n copy = new Instance(getNameValue().toString());\n } catch (JNCException e) {\n copy = null;\n }\n return (Instance)cloneShallowContent(copy);\n }", "protected T copy() {\n\n // Initialize.\n T copy = null;\n\n try {\n\n // Create an instance of this entity class.\n copy = this.entityClass.newInstance();\n\n // Create a copy.\n copy.setCreateTime(this.getCreateTime());\n copy.setId(this.getId());\n copy.setModifyTime(this.getModifyTime());\n }\n catch (IllegalAccessException e) {\n // Ignore.\n }\n catch (InstantiationException e) {\n // Ignore.\n }\n\n return copy;\n }", "private Shop shallowCopy() {\n BookShop obj = null;\n try {\n obj = (BookShop) super.clone();\n } catch (CloneNotSupportedException exc) {\n exc.printStackTrace();\n }\n return obj;\n }", "public /*@ non_null @*/ Object clone() { \n //@ assume owner == null;\n return this;\n }", "public Coordinates copy() {\n\t\treturn new Coordinates(this);\n\t}", "Object clone();", "Object clone();", "public CMObject copyOf();", "public FunctionLibrary copy() {\n return this;\n }", "public StateInfo copy() {\n return new StateInfo(this);\n }", "public Complex makeDeepCopy() {\r\n Complex complex2 = new Complex(this.getReal(), this.getImaginary());\r\n return complex2;\r\n }", "public Object clone() {\n try {\n return super.clone();\n } catch (Exception exception) {\n throw new InternalError(\"Clone failed\");\n }\n }", "public Object clone() {\n try {\n // clones itself\n return super.clone();\n } catch (Exception exception) {\n ;\n }\n return null;\n }", "public BufferTWeak cloneMe() {\r\n BufferTWeak ib = new BufferTWeak(uc);\r\n ib.increment = increment;\r\n ib.set(new Object[objects.length]);\r\n for (int i = 0; i < objects.length; i++) {\r\n ib.objects[i] = this.objects[i];\r\n }\r\n ib.offset = this.offset;\r\n ib.count = this.count;\r\n return ib;\r\n }", "@Override \n public Object clone() {\n try {\n Resource2Builder result = (Resource2Builder)super.clone();\n result.self = result;\n return result;\n } catch (CloneNotSupportedException e) {\n throw new InternalError(e.getMessage());\n }\n }", "public Object clone();", "public Object clone();", "public Object clone();", "public Object clone();", "@SuppressWarnings(\"unchecked\")\n\tpublic <T> T clon(){\n\t\ttry {\n\t\t\treturn (T) this.clone();\n\t\t} catch (CloneNotSupportedException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn (T) new Object();\n\t}", "public Object clone() {\n // No problems cloning here since private variables are immutable\n return (InstTexes) super.clone();\n }", "public Paper clone() \r\n\t{\r\n\t\tPaper copy = null;\r\n\t\ttry\r\n\t\t{ \r\n\t\t\tcopy = new Paper(this.getId(), new String(this.getTitle()), new String(this.getURI()),\r\n\t\t\t\tthis.year, new String(this.biblio_info), \r\n\t\t\t\tnew String(this.authors), new String(this.url) ); \r\n\t\t}\r\n\t\tcatch (Exception e) { e.printStackTrace(System.out); }\r\n\t\treturn copy;\r\n\t}", "public Game copy();", "public Results copy()\n {\n Results copy = new Results();\n for(Object object : results) {\n copy.add( object );\n }\n return copy;\n }", "private Shop deepCopy() {\n BookShop obj = null;\n try {\n obj = (BookShop) super.clone();\n List<Book> books = new ArrayList<>();\n Iterator<Book> iterator = this.getBooks().iterator();\n while(iterator.hasNext()){\n\n books.add((Book) iterator.next().clone());\n }\n obj.setBooks(books);\n } catch (CloneNotSupportedException exc) {\n exc.printStackTrace();\n }\n return obj;\n }", "public StudyClass getCopy(){\r\n String nc = className;\r\n String[] rc = roomConstraint.clone();\r\n return new StudyClass(internalId, classNum, nc, sks, rc, tConstraint.getCopy());\r\n }", "@Override\n public SharedObject clone() {\n SharedObject c;\n try {\n c = (SharedObject)super.clone();\n } catch (CloneNotSupportedException e) {\n // Should never happen.\n throw new ICUCloneNotSupportedException(e);\n }\n c.refCount = new AtomicInteger();\n return c;\n }", "public PingOk dup (PingOk self)\n {\n if (self == null)\n return null;\n\n PingOk copy = new PingOk ();\n if (self.getIdentity () != null)\n copy.setAddress (self.getIdentity ());\n copy.request = new ArrayList <State> (self.request);\n copy.response = new ArrayList <State> (self.response);\n return copy;\n }", "public Object clone() throws CloneNotSupportedException {\n // return INSTANCE\n throw new CloneNotSupportedException();\n }", "public Shout dup (Shout self)\n {\n if (self == null)\n return null;\n\n Shout copy = new Shout ();\n if (self.getIdentity () != null)\n copy.setAddress (self.getIdentity ());\n copy.group = self.group;\n copy.content = self.content.duplicate ();\n return copy;\n }", "public Tree<K, V> copy() {\n\t\tTree<K, V> copy = EmptyTree.getInstance(), t = this;\n\t\treturn copy(t, copy);\n\t}", "@Override\n public Object clone() {\n return super.clone();\n }", "@Override\n public weighted_graph copy() {\n weighted_graph copy = new WGraph_DS(this.ga);//create the copy graph via copy constructor\n return copy;\n }", "public Card copy(){\n return new Card(Suits, Value);\n }", "public HeapElt copy() {\n HeapElt newElement = new HeapElt();\n \n newElement.setHandle(this.handle);\n newElement.setRecord(this.record);\n \n return newElement;\n }", "public Object clone() throws CloneNotSupportedException {\n\tthrow new CloneNotSupportedException(\"This is a Singleton Ojbect; Buzz off\");\n }", "public Object clone() {\r\n try {\r\n return super.clone();\r\n } catch (CloneNotSupportedException e) {\r\n return null;\r\n }\r\n }", "public Sudoku copy(){\n\t\treturn (Sudoku) this.clone();\n\t}", "@Override\n public MiniMover64RNG copy() {\n return new MiniMover64RNG(state);\n }", "public Memoable copy()\n {\n return new Zuc256Engine(this);\n }", "public Address copy() {\n\t\tAddress copy = new Address(this.street, this.city, this.state, this.zipCode);\n\t\treturn copy;\n\t}", "public JsonFactory copy()\n/* */ {\n/* 324 */ _checkInvalidCopy(JsonFactory.class);\n/* */ \n/* 326 */ return new JsonFactory(this, null);\n/* */ }", "public Whisper dup (Whisper self)\n {\n if (self == null)\n return null;\n\n Whisper copy = new Whisper ();\n if (self.getIdentity () != null)\n copy.setAddress (self.getIdentity ());\n copy.content = self.content.duplicate ();\n return copy;\n }", "public Encoding copy() {\n\t\treturn new Encoding(this);\n\t}", "public Airplane copy() {\n Airplane copy = new Airplane(this.getCenter(), this.getImage());\n return copy;\n }", "@Override\n\tpublic Soldier copy() {\n\t\tSoldier newS = new Soldier(this.getControllingPlayerID(), this.getLocation(), this.getHpMax(), this.getHpCurrent(),\n\t\t\t\t\t\t\t\t\tthis.getOrientation(), this.getFieldOfViewRange(), this.getFieldOfViewAngle(), this.getAttackRange(),\n\t\t\t\t\t\t\t\t\tthis.getAttackDamage(), this.getSpecialAttackCooldown(), this.getSpawnCost(), this.getScoreWorth());\n\t\tnewS.setID(this.getID());\n\t\tnewS.updateFieldOfView(this.getFieldOfView());\n\t\treturn newS;\n\t}", "public Query copy() {\r\n\tQuery queryCopy = new Query();\r\n\tqueryCopy.terms = (LinkedList<String>) terms.clone();\r\n\tqueryCopy.weights = (LinkedList<Double>) weights.clone();\r\n\treturn queryCopy;\r\n }", "public Object clone() {\n\t\ttry {\n\t\t\treturn super.clone();\n\t\t}\n\t\tcatch(CloneNotSupportedException exc) {\n\t\t\treturn null;\n\t\t}\n\t}", "@Override\n public AbstractRelic makeCopy() {\n return new SpiritualRecovery();\n }", "@Override\n public UserProfile copy() {\n UserProfile userProfile = new UserProfile();\n copyTo(userProfile);\n return userProfile;\n }", "@Override\n public Board clone() {\n return new Board(copyOf(this.board));\n }", "@Override\n public Piece copy() {\n return new Knight(this.getSide(), this.getCoordinate());\n }", "public Weapon copy() {\r\n\t\treturn new Weapon(this.getName(), this.getDescription(), this.getType(), this.getSize(), this.getPrice(), this.getMultChanged());\r\n\t}", "public PingEnd dup (PingEnd self)\n {\n if (self == null)\n return null;\n\n PingEnd copy = new PingEnd ();\n if (self.getIdentity () != null)\n copy.setAddress (self.getIdentity ());\n copy.digest = new ArrayList <State> (self.digest);\n return copy;\n }", "public Restaurant clone() {\r\n return new Restaurant(this);\r\n }", "public Square copy() {\n\t\tSquare s = new Square(x,y);\n\t\ts.z = z;\n\t\ts.c = new Color(c.getRGB());\n\t\treturn s;\n\t}", "public User copy() {\r\n try {\r\n return (User) BeanUtils.cloneBean(this);\r\n } catch (Exception e) {\r\n throw new IllegalStateException(\"Error while copying \" + this, e);\r\n }\r\n }", "public Object clone()\n {\n PSRelation copy = new PSRelation(new PSCollection(m_keyNames.iterator()),\n new PSCollection(m_keyValues.iterator()));\n \n copy.m_componentState = m_componentState;\n copy.m_databaseComponentId = m_databaseComponentId;\n copy.m_id = m_id;\n\n return copy;\n }", "@Override\n protected T createInstance() throws Exception {\n return this.isSingleton() ? this.builder().build() : XMLObjectSupport.cloneXMLObject(this.builder().build());\n }", "public void copy() {\n\n\t}", "public Function clone();", "public EngineClass clone()\n {\n EngineClass cloneEngineClass = new EngineClass( this );\n return cloneEngineClass;\n }", "@Override\n public LocalStore<V> copy() {\n return this;\n }", "public SimpleStyle copy() {\n\t\tSimpleStyle simpleStyle = new SimpleStyle();\n\t\tcopyIn(simpleStyle);\n\t\treturn simpleStyle;\n\t}", "public Clone() {}", "@Override\n public MetaContainer clone() {\n return clone(false);\n }", "public HttpParams copy() {\n/* 268 */ return (HttpParams)this;\n/* */ }", "public T copyOnWrite() {\n T r = ref;\n if(r.getRefCount() <= 1) { return r; }\n @SuppressWarnings(\"unchecked\")\n T r2 = (T)r.clone();\n r.removeRef();\n ref = r2;\n r2.addRef();\n return r2;\n }", "private LinkgrabberFilterRule getCurrentCopy() {\r\n LinkgrabberFilterRule ret = this.rule.duplicate();\r\n save(ret);\r\n return ret;\r\n }", "org.omg.CORBA.Object _duplicate();", "@Override\n public DuelistRNG copy() {\n return new DuelistRNG(stateA, stateB);\n }", "public Field copy()\n {\n return new Field(name, type, vis);\n }", "public Object clone () {\n\t\t\ttry {\n\t\t\t\treturn super.clone();\n\t\t\t} catch (CloneNotSupportedException e) {\n\t\t\t\tthrow new InternalError(e.toString());\n\t\t\t}\n\t\t}", "public JsonMember copy() {\n return new JsonMember(name, value.copy());\n }", "public Object clone() {\n return new PointImpl( this );\n }", "public Image clone() {\r\n\t\treturn new Image(renderer, texture, textureX, textureY, textureWidth, textureHeight, width, height);\r\n\t}", "public State copy() {\n State that = new State(this.registers.length);\n for (int i=0; i<this.registers.length; ++i) {\n Object a = this.registers[i];\n if (a == null) continue;\n if (!(a instanceof Set))\n that.registers[i] = a;\n else\n that.registers[i] = NodeSet.FACTORY.makeSet((Set)a);\n }\n if(TRACE_REGISTERS) System.out.println(\"Copying state \" + Arrays.asList(that.registers));\n return that;\n }" ]
[ "0.7635504", "0.76283216", "0.75832963", "0.74325305", "0.7428149", "0.7355737", "0.7272339", "0.7238149", "0.722672", "0.71604717", "0.7148737", "0.7086693", "0.7030753", "0.7007928", "0.69870675", "0.6985767", "0.69799817", "0.69685584", "0.693428", "0.6931357", "0.6904855", "0.6882014", "0.6864002", "0.6844212", "0.68433845", "0.6838841", "0.68290603", "0.68243617", "0.68167824", "0.68167824", "0.68030673", "0.67915606", "0.6790544", "0.6777507", "0.6761645", "0.67567796", "0.67339706", "0.6704461", "0.67012537", "0.67012537", "0.67012537", "0.67012537", "0.6698121", "0.6695668", "0.669263", "0.6689442", "0.6677613", "0.66746676", "0.66688585", "0.6663787", "0.66462725", "0.6634676", "0.6628933", "0.66197336", "0.66134065", "0.661246", "0.66062844", "0.6595999", "0.6595392", "0.65810007", "0.6573109", "0.6562043", "0.6560265", "0.65578777", "0.65502703", "0.6549259", "0.6541083", "0.6538251", "0.65275264", "0.6526782", "0.652633", "0.6524837", "0.6524646", "0.65237325", "0.6517485", "0.6513468", "0.65084404", "0.65050644", "0.6498299", "0.6492205", "0.6492157", "0.6491286", "0.64905214", "0.648209", "0.6481673", "0.6470875", "0.6459816", "0.6447039", "0.6446147", "0.643794", "0.64376867", "0.6437575", "0.6437051", "0.6435039", "0.64320564", "0.6426599", "0.6409756", "0.64091766", "0.6407391", "0.6401239" ]
0.6973589
17
////////////////////////////////////////////////////////////////////// Description: Returns the detail that corresponds to the given node in the path. Use: public
public SoDetail getDetail(SoNode node) // //////////////////////////////////////////////////////////////////////// { int index; // Test for default case, corresponding to tail of path if (node == null) index = ( SoFullPath.cast ( path)).getLength() - 1; else index = getNodeIndex(node); return details.operator_square_bracket(index); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static String parseNodeDetail(ILogicRouteElementDetailItem d) {\n\n StringBuilder detailSB = new StringBuilder();\n\n Optional<INodeDepot> nodeDepotAfterOpt = d.getNodeDepotAfterVisit();\n\n if (nodeDepotAfterOpt.isPresent()) {\n INodeDepot visitedNodeDepot = nodeDepotAfterOpt.get();\n\n Optional<INodeDepot> nodeDepotBeforeOpt = d.getNodeDepotBeforeVisit();\n\n if (nodeDepotBeforeOpt.isPresent()) {\n INodeDepot intialDepot = nodeDepotBeforeOpt.get();\n detailSB.append(\"\\n\");\n detailSB.append(\n \" Depot before visit: \" + PNDReportExtractionExample.parseNodeDepot(intialDepot));\n }\n\n detailSB.append(\"\\n\");\n detailSB.append(\n \" Depot after visit : \" + PNDReportExtractionExample.parseNodeDepot(visitedNodeDepot));\n detailSB.append(\"\\n\");\n }\n\n return detailSB.toString();\n }", "private String extractNodeInfo(String path) {\n\t try {\n\t\t\tInputStream is = new FileInputStream(path);\n\t\t\tint len = is.available();\n\t\t\tbyte[] bytes = new byte[len];\n\t\t\tis.read(bytes);\n\t\t\treturn new String(bytes).trim();\n\t\t} catch (FileNotFoundException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn null;\n\t}", "public void\nsetDetail(SoDetail detail, SoNode node)\n//\n////////////////////////////////////////////////////////////////////////\n{\n int i;\n\n // Find node in path\n i = getNodeIndex(node);\n\n//#ifdef DEBUG\n// if (i < 0)\n// SoDebugError::post(\"SoPickedPoint::setDetail\",\n// \"Node %#x is not found in path\", node);\n//#endif /* DEBUG */\n\n details.set(i, detail);\n}", "public String getDetail() {\r\n return detail;\r\n }", "public String getDetail() {\r\n return detail;\r\n }", "@Override\n\tpublic Object getNodeInfo(String path) {\n\t\treentrantReadWriteLock.readLock().lock();\n\t\tObject obj = null;\n\t\ttry {\n\t\t\tbyte[] tmpByteData = zookeeper.getData(path, false,\n\t\t\t\t\tnew Stat());\n\t\t\t\n\t\t\tobj = SomeUtil.byteToJson(tmpByteData);\n\t\t\t\n\t\t} catch (Exception e) {\n\t\t\tlog.error(\"获取跟节点数据异常!\", e);\n\t\t} finally {\n\t\t\treentrantReadWriteLock.readLock().unlock();\n\t\t}\n\t\treturn obj;\n\t}", "public String getDetail()\n {\n return detail;\n }", "public String getDetail() {\n return detail;\n }", "public String getDetail() {\n return detail;\n }", "public String getDetail() {\n return detail;\n }", "public String getDetail() {\n return detail;\n }", "NodeInformationProvider getNodeInformationProvider();", "Node getNode(String path);", "public void printDetails() \r\n\t{\r\n\t\t// Print cells in path\r\n\t\tSystem.out.print(\"Path:\");\r\n\t\tfor(Cell c: path)\r\n\t\t\tSystem.out.print(\" (\" + c.getRow() + ',' + c.getColumn() + ')');\r\n\t\t\r\n\t\t// Print path length\r\n\t\tSystem.out.println(\"\\nLength of path: \" + path.size());\r\n\t\t\r\n\t\t// Print visited cell amount\r\n\t\tint lastCell = path.size() - 1;\r\n\t\tint visitedCells = path.get(lastCell).getDiscoveryTime() + 1;\r\n\t\tSystem.out.println(\"Visited cells: \" + visitedCells + '\\n');\r\n\t}", "@Override\n\tpublic java.lang.String getNode_2() {\n\t\treturn _dictData.getNode_2();\n\t}", "public String getAnotherDetail();", "void pathFound(Node node);", "public CatalogNode getNode(String node);", "@AutoEscape\n\tpublic String getNode_2();", "@Override\n public String toString() {\n return detail;\n }", "public NodeInfo getNodeInfo() throws RemoteException, Error;", "Object get(Node node);", "public static String getPath(NodeInfo node) {\n if (node == null) {\n return \"\";\n }\n String pre;\n NodeInfo parent = node.getParent();\n // System.err.println(\"node = \" + node + \" parent = \" + parent);\n \n switch (node.getNodeKind()) {\n case Type.DOCUMENT:\n return \"/\";\n case Type.ELEMENT:\n if (parent == null) {\n return node.getDisplayName();\n } else {\n pre = getPath(parent);\n if (pre.equals(\"/\")) {\n return '/' + node.getDisplayName();\n } else {\n return pre + '/' + node.getDisplayName() + '[' + getNumberSimple(node) + ']';\n }\n }\n case Type.ATTRIBUTE:\n return getPath(parent) + \"/@\" + node.getDisplayName();\n case Type.TEXT:\n pre = getPath(parent);\n return (pre.equals(\"/\") ? \"\" : pre) +\n \"/text()[\" + getNumberSimple(node) + ']';\n case Type.COMMENT:\n pre = getPath(parent);\n return (pre.equals(\"/\") ? \"\" : pre) +\n \"/comment()[\" + getNumberSimple(node) + ']';\n case Type.PROCESSING_INSTRUCTION:\n pre = getPath(parent);\n return (pre.equals(\"/\") ? \"\" : pre) +\n \"/processing-instruction()[\" + getNumberSimple(node) + ']';\n case Type.NAMESPACE:\n String test = node.getLocalPart();\n if (test.equals(\"\")) {\n // default namespace: need a node-test that selects unnamed nodes only\n test = \"*[not(local-name()]\";\n }\n return getPath(parent) + \"/namespace::\" + test;\n default:\n return \"\";\n }\n }", "protected NodePart getHelmetMoreDetails() {\n\t\treturn instance.nodes.get(0).parts.get(0);\n\t}", "public String getDescendencyPath() {\n if (isLeaf()) {\n return getName();\n }\n else {\n return getName() + \".\" + getChild().getDescendencyPath();\n }\n }", "public IContentNode getChild(String path);", "@AutoEscape\n\tpublic String getNode_1();", "java.lang.String getXpath();", "java.lang.String getEntryNode();", "PathDetail(Object value) {\n this.value = value;\n }", "private int\ngetNodeIndex(final SoNode node)\n//\n////////////////////////////////////////////////////////////////////////\n{\n int i;\n\n // Search from bottom up for node in path, since details are\n // usually examined near the bottom\n for (i = ( SoFullPath.cast ( path)).getLength() - 1; i >= 0; i--)\n if (path.getNode(i) == node)\n return i;\n\n//#ifdef DEBUG\n SoDebugError.post(\"SoPickedPoint::getNodeIndex\",\n \"Node \"+node+\" is not found in path\");\n//#endif /* DEBUG */\n\n return -1;\n}", "public String wantDetail();", "public String getRefNodeType() {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\treturn \"lfims:branchDetails\";\r\n\t\t\t\t\t}", "public Object lookup(String key){\n ListNode<String,Object> temp = getNode(key);\n if(temp != null)\n return temp.value;\n else\n return null;\n }", "public String getNodeValue ();", "@Override\n\tpublic java.lang.String getNode_1() {\n\t\treturn _dictData.getNode_1();\n\t}", "public String getNode() {\n return node;\n }", "java.lang.String getDetails();", "public String getPathInfo() {\n return pathInfo;\n }", "String getRemediationDetail();", "String getIdNode2();", "String getValueOfNode(String path)\n throws ProcessingException;", "public DataNode getNode(String path) {\n return dataTree.getNode(path);\n }", "@Override\n\tpublic void getDetail() {\n\t\t\n\t}", "protected static String describe(DataNode node) {\n DataNode current = node;\n OpenAttrBase last;\n String name = null;\n String alttext = null;\n do {\n OpenAttrBase comp = current.getSchemaComponent();\n last = comp;\n if (comp instanceof INamed) {\n String check = ((INamed)comp).getName();\n if (check != null) {\n int type = comp.type();\n if (type == SchemaBase.ATTRIBUTE_TYPE || type == SchemaBase.ELEMENT_TYPE) {\n name = check;\n } else if (alttext == null) {\n alttext = \"'\" + check + \"' \" + comp.name();\n }\n }\n }\n if (name == null && comp instanceof IReference) {\n QName ref = ((IReference)comp).getRef();\n if (ref != null) {\n name = ref.getName();\n }\n }\n if (name != null) {\n return \"'\" + name + \"' \" + comp.name();\n }\n current = current.getParent();\n } while (current != null && ((ParentNode)current).getChildren().size() == 1);\n if (alttext == null) {\n return last.name();\n } else {\n return alttext;\n }\n }", "public String getInfo()\r\n\t{\r\n\t\treturn theItem.getNote();\r\n\t}", "public String getPath() throws Exception {\n\t\t/*\n\t\t * return \"/news-oppsRecord\" + doc.selectSingleNode\n\t\t * (\"/metadataFieldInfo/field/@path\").getText();\n\t\t */\n\t\treturn doc.selectSingleNode(\"/metadataFieldInfo/field/@path\").getText();\n\t}", "Node getNode();", "public String getNode()\n {\n return node;\n }", "public String lookup(String key){\n Node N;\n N = findKey(root, key);\n return ( N == null ? null : N.item.value );\n }", "public String getDetailInfo(Object ... obj) {\n\t\treturn null;\n\t}", "abstract String getDetails();", "public void getDetail(int id) {\n\t\t\n\t}", "public String getNodeValue(Node node) throws Exception;", "public interface IASTPathPart {\n\t/**\n\t * The node child index at its parent\n\t * \n\t * @return\n\t */\n\tint index();\n\n\t/**\n\t * The unique node identifier\n\t * \n\t * @return\n\t */\n\tString id();\n}", "String getNodeMetadataValue(int node, String key);", "public Node getNode();", "private Node getNode(String resource)\r\n {\r\n return Node.getNode(resource);\r\n }", "@Override\r\n\tpublic Node getNode(String absPath) throws PathNotFoundException,\r\n\t\t\tRepositoryException {\n\t\treturn null;\r\n\t}", "public String getNode() {\n return node;\n }", "@AutoEscape\n\tpublic String getNode_3();", "public static String gettreevalue(JTree tree ) {\n //Returns the last path element of the selection.\n //This method is useful only when the selection model allows a single selection.\n DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();\nString selected=null;\n if (node == null)\n //Nothing is selected. \n return null;\n\n Object nodeInfo = node.getUserObject();\n\n \n selected = (String)nodeInfo;\n // displayURL(book.bookURL);\n \n return selected;\n\n\n }", "public String getPathName();", "public IRLocation getLocation(IRNode node);", "@Override\n\tpublic String toString() {\n\t\treturn getFullPath();\n\t}", "Information getInfo();", "String getChildId();", "@Override\r\n\tprotected String getPath() {\n\t\treturn \"/product/detail.do?param=\";\r\n\t}", "public String getXpath() { \n\t\treturn getXpathElement().getValue();\n\t}", "protected Reference queryNode(final String nodePath) {\n\n\t\ttry {\n\t\t\tQuery query = new Query(Constants.QUERY_LANG_LUCENE, String.format(\"PATH:\\\"%s\\\"\", nodePath));\n\n\t\t\tNode[] result = repositoryService.get(new Predicate(null, STORE, query));\n\t\t\tif((result != null) && (result.length == 1)) {\n\t\t\t\treturn result[0].getReference();\n\t\t\t}\n\n\t\t} catch (RemoteException e) {\n\t\t\tif(LOG.isDebugEnabled()) {\n\t\t\t\tLOG.debug(String.format(\"Failed to query node: \\\"%s\\\"\", nodePath), e);\n\t\t\t}\n\t\t}\n\n\n\t\treturn null;\n\t}", "public boolean isShowPathInfo(Object inNode)\n\t{\n\t\n\t\tObject container = inNode;\n\t\tif( getWebTree().getModel().isLeaf(container) )\n\t\t{\n\t\t\tcontainer = getWebTree().getModel().getParent(container);\n\t\t}\n\t\tif( hasBeenExpanded(container))\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\t//See if we are below the cut off. If we are below or equal then show the node (return true)\n\t\tif( fieldLastCutoffNode != null)\n\t\t{\n\t\t\tObject parent = inNode;\n\t\t\twhile( parent != null)\n\t\t\t{\n\t\t\t\tif( parent == fieldLastCutoffNode)\n\t\t\t\t{\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tparent = getWebTree().getModel().getParent(parent);\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\treturn true; //Show it since it is not expanded\n\t}", "String getIssueDetail();", "public DefaultMutableTreeNode getRequestedNode()\n {\n // Reset node to be displayed\n displayNode = root;\n \n // Iterate trough the path array\n for (int i = 0; i < pathArray.length; i++)\n {\n if (displayNode.getDepth() > 1)\n {\n displayNode = (DefaultMutableTreeNode)\n displayNode.getChildAt(pathArray[i]);\n }\n }\n \n // Return node to be displayed\n return displayNode;\n }", "public int getNodeLabel ();", "public Node getNode(Reference ref, Presentation presentation);", "public abstract String describe(int depth);", "public String getPath() { \n\t\treturn getPathElement().getValue();\n\t}", "public node_info getNode(int key)\n{\n\treturn getNodes().get(key);\n\t\n}", "@ApiModelProperty(value = \"A human-readable explanation specific to this occurrence of the problem\")\n \n public String getDetail() {\n return detail;\n }", "edu.usfca.cs.dfs.StorageMessages.StorageNodeInfo getSnInfo(int index);", "edu.usfca.cs.dfs.StorageMessages.StorageNodeInfo getSnInfo(int index);", "edu.usfca.cs.dfs.StorageMessages.StorageNodeInfo getSnInfo(int index);", "default PathItem getPathItem(String name) {\n Map<String, PathItem> map = getPathItems();\n if (map == null) {\n return null;\n }\n return map.get(name);\n }", "public String nodePath() {\r\n String path;\r\n if (this.parent == null) {\r\n path = \"(\" + this.nodeType + \"|\" + this.dataType + \"|\" + this.data + \")\";\r\n } else {\r\n path = this.parent.nodePath() + \" (\" + this.nodeType + \"|\" + this.dataType + \"|\" + this.data + \")\";\r\n }\r\n return path;\r\n }", "public Number getDetailId() {\n return (Number)getAttributeInternal(DETAILID);\n }", "entities.Torrent.NodeId getNode();", "entities.Torrent.NodeId getNode();", "public String pathOfItem(Pathable item) {\n return null; // todo: implement this method\n }", "String getIdNode1();", "Node get(URI uri);", "PathologyInfo selectByPrimaryKey(Integer id);", "public String getPath()\r\n/* 26: */ {\r\n/* 27:57 */ return this.path;\r\n/* 28: */ }", "Map<String,String> getNodeData(T node);", "public byte[] getDetail() {\r\n return detail;\r\n }", "public String lookup(String key){\n Node N = front;\n while( N != null){\n if( N.key.equals(key)){\n return N.value;\n }\n N = N.next;\n }\n return null;\n }", "@AutoEscape\n\tpublic String getNode_4();", "CMSObject getFirstNodeByPath(String path, ConnectionInfo connectionInfo) throws RepositoryAccessException;", "public Node getOne(int identifier) throws SQLException, NodeNotFoundException {\n var statement = connection.prepareStatement(\"SELECT identifier, x, y, parentx, parenty, status, owner, description FROM nodes WHERE identifier = ?\");\n statement.setInt(1, identifier);\n var result = statement.executeQuery();\n try {\n if (result.next()) {\n return new Node(\n result.getInt(\"identifier\"),\n result.getInt(\"x\"),\n result.getInt(\"y\"),\n result.getInt(\"parentx\"),\n result.getInt(\"parenty\"),\n result.getString(\"status\"),\n result.getString(\"owner\"),\n result.getString(\"description\")\n );\n } else {\n throw new NodeNotFoundException();\n }\n }\n finally {\n statement.close();\n result.close();\n }\n }", "OperationNode getNode();", "public com.amx.mexico.telcel.esb.v1_2.DetailFailType getDetailFail()\n {\n synchronized (monitor())\n {\n check_orphaned();\n com.amx.mexico.telcel.esb.v1_2.DetailFailType target = null;\n target = (com.amx.mexico.telcel.esb.v1_2.DetailFailType)get_store().find_element_user(DETAILFAIL$2, 0);\n if (target == null)\n {\n return null;\n }\n return target;\n }\n }" ]
[ "0.634264", "0.615013", "0.60277534", "0.58800733", "0.58800733", "0.58565086", "0.58444387", "0.5829071", "0.5829071", "0.5829071", "0.5829071", "0.58208925", "0.573558", "0.5729064", "0.5675166", "0.567062", "0.5645555", "0.5613335", "0.56084216", "0.56048995", "0.5558935", "0.5556851", "0.5521563", "0.5476514", "0.54501927", "0.5445098", "0.54401666", "0.5433399", "0.54163545", "0.54065984", "0.53993016", "0.5392363", "0.53856146", "0.53850126", "0.5374419", "0.53713393", "0.53600055", "0.53568226", "0.53335536", "0.53205967", "0.5303323", "0.52997166", "0.5297134", "0.52941436", "0.5279674", "0.52753323", "0.5267821", "0.52671665", "0.5266479", "0.5246723", "0.52404505", "0.52329856", "0.52222437", "0.5218524", "0.5202914", "0.51903015", "0.51862", "0.517477", "0.51652795", "0.51601154", "0.5147833", "0.51460224", "0.512626", "0.5125712", "0.5122043", "0.51195234", "0.5117836", "0.5112505", "0.51118386", "0.5094632", "0.5091972", "0.5090512", "0.5072419", "0.5068445", "0.50630015", "0.50614476", "0.50613433", "0.50606567", "0.50589937", "0.50510216", "0.50510216", "0.50510216", "0.50477684", "0.5046855", "0.5045808", "0.5041875", "0.5041875", "0.5041304", "0.5038671", "0.50309426", "0.5030374", "0.5028298", "0.5027765", "0.5020516", "0.50169224", "0.5007945", "0.49985155", "0.49920356", "0.49824086", "0.49764505" ]
0.79039705
0
////////////////////////////////////////////////////////////////////// Description: Returns the transformation matrix to go from the object space corresponding to the given node in the path to world space. Use: public
public SbMatrix getObjectToWorld(final SoNode node) // //////////////////////////////////////////////////////////////////////// { getMatrix(node); return matrixAction.getMatrix(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void\ngetMatrix( SoNode node)\n//\n////////////////////////////////////////////////////////////////////////\n{\n SoPath xfPath; // ptr\n\n // Construct a path from the root down to this node. Use the given\n // path if it's the same\n if (node == null || node == SoFullPath.cast(path).getTail())\n xfPath = path;\n\n else {\n int index = getNodeIndex(node);\n xfPath = path.copy(0, index + 1);\n xfPath.ref();\n }\n\n // Create an action instance if necessary, then apply it to the path\n if (matrixAction == null)\n matrixAction = new SoGetMatrixAction(vpRegion);\n matrixAction.apply(xfPath);\n\n if (xfPath != path)\n xfPath.unref();\n}", "public SbMatrix\ngetWorldToObject( SoNode node) \n//\n////////////////////////////////////////////////////////////////////////\n{\n getMatrix(node);\n return matrixAction.getInverse();\n}", "public mat4 getMatrix() {\n return worldMatrix;\n }", "public Matrix4f getWorldMatrix() {\n\n\t\t// First identity\n\t\tmTranformation.identity();\n\n\t\t// Translate\n\t\tmTranformation.translate(position);\n\n\t\t// Rotate object at the center of the texture\n\t\tfloat x = 0.5f * mWidth;\n\t\tfloat y = 0.5f * mHeight;\n\n\t\t// Do rotating\n\t\tmTranformation.translate(new Vector3f(x, y, 0));\n\t\tmTranformation.rotateZ((float) Math.toRadians(rotation.z));\n\t\tmTranformation.translate(new Vector3f(-x, -y, 0));\n\n\t\t// mTranformation.scale(scale, scale, 1);\n\t\tmTranformation.scaleAround(scale, x, y, 0);\n\n\t\treturn mTranformation;\n\t}", "public Matrix4 getTransformMatrix() {\n return transformMatrix;\n }", "@Override\r\n protected Matrix4f genViewMatrix() {\r\n\r\n // refreshes the position\r\n position = calcPosition();\r\n\r\n // calculate the camera's coordinate system\r\n Vector3f[] coordSys = genCoordSystem(position.subtract(center));\r\n Vector3f right, up, forward;\r\n forward = coordSys[0];\r\n right = coordSys[1];\r\n up = coordSys[2];\r\n\r\n // we move the world, not the camera\r\n Vector3f position = this.position.negate();\r\n\r\n return genViewMatrix(forward, right, up, position);\r\n }", "public Matrix getTransform()\n {\n return transform;\n }", "public static TransformMatrix translationMatrix(float x, float y) {\n\t\treturn new TransformMatrix(1,1,x,y);\n\t}", "float[] getProjectionMatrix();", "protected Matrix4f createModelMatrix(Entity entity) {\n\n //Assemble the model matrix order = SRT\n Matrix4f matrix = new Matrix4f();\n matrix.mul(entity.getTranslationMatrix());\n matrix.mul(entity.getRotation());\n matrix.mul(entity.getScaleMatrix());\n \n return matrix;\n }", "public WorldToScreenTransform getWorldToScreenTransform() { return this; }", "public org.apache.spark.mllib.linalg.Matrix toLocalMatrix () { throw new RuntimeException(); }", "private void constructTransitionTransposeMatrix() {\r\n\t\tfor(int i=0; i<getNodeCnt(); i++) {\r\n\t\t\tArrayList<NodeTransition> transitionList = new ArrayList<NodeTransition>();\r\n\t\t\tmTransitionTranspose.add( transitionList );\r\n\t\t}\r\n\t\tfor(Node node: mNodes) {\r\n\t\t\tint fromId = node.getId();\r\n\t\t\tint outDegree = node.getOutDegree();\r\n\t\t\t\r\n\t\t\tSet<Integer> outEdges = getOutEdges(fromId);\r\n\t\t\tfor(Integer edgeId: outEdges) {\r\n\t\t\t\tint toId = getEdge(edgeId).getToId();\r\n\t\t\t\tdouble pTransition = (double) getEdge(edgeId).getWeight() / (double) outDegree;\r\n\t\t\t\t\r\n\t\t\t\tArrayList<NodeTransition> transitionList = mTransitionTranspose.get(toId);\r\n\t\t\t\ttransitionList.add( new NodeTransition(fromId, pTransition) );\r\n\t\t\t}\r\n\t\t}\r\n\t}", "@Override\n\tpublic Mat GetTranslateMatrix()\n\t{\n\t\treturn mT;\n\t}", "public Transform getTransform () {\n\t\torg.jbox2d.common.Transform trans = body.getTransform();\n\t\ttransform.vals[Transform.POS_X] = trans.p.x;\n\t\ttransform.vals[Transform.POS_Y] = trans.p.y;\n\t\ttransform.vals[Transform.COS] = trans.q.c;\n\t\ttransform.vals[Transform.SIN] = trans.q.s;\n\t\treturn transform;\n\t}", "protected Matrix4 computeTransform() {\n return super.computeTransform();\n }", "public Matrix4f getTranslationMat() {\n\t\treturn m_xforms[NvCameraXformType.MAIN].m_translateMat;\n\t}", "godot.wire.Wire.Transform2D getTransform2DValue();", "public SbMatrix\ngetImageToObject(SoNode node)\n//\n////////////////////////////////////////////////////////////////////////\n{\n getMatrix(node);\n return matrixAction.getTextureInverse();\n}", "public GeneralPath transform(Matrix matrix)\n {\n float x1 = getLowerLeftX();\n float y1 = getLowerLeftY();\n float x2 = getUpperRightX();\n float y2 = getUpperRightY();\n\n Point2D.Float p0 = matrix.transformPoint(x1, y1);\n Point2D.Float p1 = matrix.transformPoint(x2, y1);\n Point2D.Float p2 = matrix.transformPoint(x2, y2);\n Point2D.Float p3 = matrix.transformPoint(x1, y2);\n\n GeneralPath path = new GeneralPath();\n path.moveTo(p0.getX(), p0.getY());\n path.lineTo(p1.getX(), p1.getY());\n path.lineTo(p2.getX(), p2.getY());\n path.lineTo(p3.getX(), p3.getY());\n path.closePath();\n return path;\n }", "public SbMatrix\ngetObjectToImage( SoNode node) \n//\n////////////////////////////////////////////////////////////////////////\n{\n getMatrix(node);\n return matrixAction.getTextureMatrix();\n}", "Matrix4f getModelMatrix();", "public abstract Matrix4f getCameraMatrix();", "public void transform(Matrix m)\n { \n\t \tfor(int i= 0 ; i < this.vertex.length ; i++)\n\t \t{\n\t \t\tthis.vertex[i] = this.vertex[i].transform(m);\n\t \t}\n\t \n }", "@Override\n public float[] getRotationMatrix(){\n float[] baseCorrection = Maths.buildRotationMatrix(new float[]{0, 1, 0, 0});\n\n float[] rotationX = {(float) Math.toDegrees(theta), 1, 0, 0};\n float[] rotationY = {(float) -Math.toDegrees(phi), 0, 1, 0};\n\n float[] rotationMatrix = new float[16];\n float[] coreMotionMatrix = Maths.buildRotationMatrix(rotationY, rotationX);\n Matrix.multiplyMM(rotationMatrix, 0, baseCorrection, 0, coreMotionMatrix, 0);\n\n return rotationMatrix;\n }", "public void translateTransform(Vector3f trans) {\r\n\t\tm[0][0] = 1.0f; m[0][1] = 0.0f; m[0][2] = 0.0f; m[0][3] = trans.x;\r\n\t\tm[1][0] = 0.0f; m[1][1] = 1.0f; m[1][2] = 0.0f; m[1][3] = trans.y;\r\n\t\tm[2][0] = 0.0f; m[2][1] = 0.0f; m[2][2] = 1.0f; m[2][3] = trans.z;\r\n\t\tm[3][0] = 0.0f; m[3][1] = 0.0f; m[3][2] = 0.0f; m[3][3] = 1.0f;\r\n\r\n\t}", "public Matrix4f getWorldMatrix(Vector3f offset, Vector3f rotation, float scale) {\n\t\tworldMatrix.identity();\n\t\tworldMatrix.translate(offset);\n\t\tworldMatrix.rotateX((float)Math.toRadians(rotation.x));\n\t\tworldMatrix.rotateY((float)Math.toRadians(rotation.y));\n\t\tworldMatrix.rotateZ((float)Math.toRadians(rotation.z));\n\t\tworldMatrix.scale(scale);\n\t\treturn worldMatrix;\n\t}", "float[] getViewMatrix();", "DMatrix3C getRotation();", "private Matrix33d getMatrix() {\n final Matrix33d m = new Matrix33d();\n m.setMatrixColumn(new Vector3d(V1), 0);\n m.setMatrixColumn(new Vector3d(V2), 1);\n m.setMatrixColumn(new Vector3d(V3), 2);\n return m;\n }", "public int[][] getTransitionMatrix() {\n\t\treturn null;\n\t}", "public AffineTransform getTransform()\r\n\t{\r\n\t\treturn _g2.getTransform();\r\n\t}", "Actor[][] toMatrix(Actor[] distArray, int nLocations, Actor[][] world) {\n int length = (int) Math.sqrt(nLocations);\n world = new Actor[length][length];\n\n int n = 0;\n for (int i = 0; i < length; i++) {\n for (int j = 0; j < length; j++) {\n world[i][j] = distArray[n];\n n++;\n }\n }\n return world;\n }", "abstract public Matrix4fc getViewMatrix();", "public Matrix getMatrix() {\n Matrix matrix2 = new Matrix();\n matrix2.set(this.matrix);\n return matrix2;\n }", "protected Matrix4 computeTransform() {\n return internalGroup.computeTransform();\n }", "private void constructTransitionMatrix() {\r\n\t\tfor(Node node: mNodes) {\r\n\t\t\tint nodeId = node.getId();\r\n\t\t\tint outDegree = node.getOutDegree();\r\n\t\t\tArrayList<NodeTransition> transitionList = new ArrayList<NodeTransition>();\r\n\t\t\t\r\n\t\t\tSet<Integer> outEdges = getOutEdges(nodeId);\r\n\t\t\tfor(Integer edgeId: outEdges) {\r\n\t\t\t\tint toId = getEdge(edgeId).getToId();\r\n\t\t\t\tdouble pTransition = (double) getEdge(edgeId).getWeight() / (double) outDegree;\r\n\t\t\t\ttransitionList.add( new NodeTransition(toId, pTransition) );\r\n\t\t\t}\r\n\t\t\tmTransition.add( transitionList );\r\n\t\t}\r\n\t}", "float[] getModelMatrix();", "public Vector3f objectToViewCoord(Matrix4f viewMatrix, Vector3f worldPosition) {\r\n\t\tVector4f objectPos4f = new Vector4f(worldPosition.x, worldPosition.y, worldPosition.z, 1f);\r\n\t\tVector4f objectWorld = Matrix4f.transform(viewMatrix, objectPos4f, null);\r\n\t\treturn new Vector3f(objectWorld.x, objectWorld.y, objectWorld.z);\r\n\t}", "public SbVec4f\ngetObjectTextureCoords(final SoNode node)\n//\n////////////////////////////////////////////////////////////////////////\n{\n return multVecMatrix4(getImageToObject(node), imageTexCoords);\n}", "public TransformationMatrix() {\n\t\ta11 = 1; a12 = 0; a13 = 0; a14 = 0;\n\t\ta21 = 0; a22 = 1; a23 = 0; a24 = 0;\n\t\ta31 = 0; a32 = 0; a33 = 1; a34 = 0;\n\t}", "public void translate( float x, float y )\n\t{\n\t\tMatrix4f opMat = new Matrix4f();\n\t\topMat.set( new Vector3f( x, y, 0 ) );\n\t\tmat.mul( opMat );\n\t}", "public float[] getProjectionMatrix() {\n\t\treturn projectionMatrix;\n\t}", "protected abstract float[] computeLeafModelMatrix();", "public Matrix getGraphMatrix(){\n\t\treturn graphMatrix;\n\t}", "public float [][] GetMatrix() {\n \n\t/*\n\tinputs--\n\t*/\n\t\n\t/*\n\toutputs--\n\t\n\tmat_f_m :\n\t The self matrix\n\t*/\n\t\n\treturn this.mat_f_m;\n \n }", "WorldCoordinate transformScreenToWorld(final DeviceCoordinate screen);", "public java.util.Iterator<com.google.maps.routing.v2.RouteMatrixElement> computeRouteMatrix(\n com.google.maps.routing.v2.ComputeRouteMatrixRequest request) {\n return io.grpc.stub.ClientCalls.blockingServerStreamingCall(\n getChannel(), getComputeRouteMatrixMethod(), getCallOptions(), request);\n }", "void applyRotationMatrix() {\n for (int i = 0; i < coors.length; i++) {\n for (int j = 0; j < coors[i].length; j++) {\n newCoors[i][j] = coors[i][0] * R[j][0] + coors[i][1] * R[j][1] + coors[i][2] * R[j][2];\n }\n // add perspective\n float scale = map(Math.abs(newCoors[i][2]), 0, (float) (halfSize * Math.sqrt(3)), 1, 1.5f);\n if (newCoors[i][2] < 0) {\n scale = 2f - scale;\n }\n for (int j = 0; j < 2; j++) {\n newCoors[i][j] *= scale;\n }\n }\n // to R2\n // just dont use Z\n setPathAndAlpha();\n }", "void calculateRotationMatrix() {\n R[0][0] = (float) (Math.cos(angle[0]) * Math.cos(angle[1]));\n R[1][0] = (float) (Math.sin(angle[0]) * Math.cos(angle[1]));\n R[0][1] = (float) (Math.cos(angle[0]) * Math.sin(angle[1]) * Math.sin(angle[2]) - Math.sin(angle[0]) * Math.cos(angle[2]));\n R[1][1] = (float) (Math.sin(angle[0]) * Math.sin(angle[1]) * Math.sin(angle[2]) + Math.cos(angle[0]) * Math.cos(angle[2]));\n R[0][2] = (float) (Math.cos(angle[0]) * Math.sin(angle[1]) * Math.cos(angle[2]) + Math.sin(angle[0]) * Math.sin(angle[2]));\n R[1][2] = (float) (Math.sin(angle[0]) * Math.sin(angle[1]) * Math.cos(angle[2]) - Math.cos(angle[0]) * Math.sin(angle[2]));\n R[2][0] = (float) - Math.sin(angle[1]);\n R[2][1] = (float) (Math.cos(angle[1]) * Math.sin(angle[2]));\n R[2][2] = (float) (Math.cos(angle[1]) * Math.cos(angle[2]));\n }", "public mat4 getRotation() {\n return worldMatrix.getRotation(pr, yr, pr);\n }", "public Transform getTransformation() {\n Transform t = Transform.newTranslation(position);\n t = t.compose(Transform.newScale(scale));\n t = t.compose(Transform.newXRotation(rotation.x));\n t = t.compose(Transform.newYRotation(rotation.y));\n t = t.compose(Transform.newZRotation(rotation.z));\n return t;\n }", "float[] getMVPMatrix();", "public Matrix4 getProjectionMatrix() {\n return projectionMatrix;\n }", "private void mouseEventToWorldSpace(MouseEvent e) {\n\n Point2D mousePoint = new Point2D.Double();\n mousePoint.setLocation(e.getPoint());\n\n Point2D newPoint = new Point2D.Double();\n this.viewModel.getViewToWorld().transform(mousePoint, newPoint);\n\n int xDiff = (int) ( newPoint.getX() - mousePoint.getX() );\n int yDiff = (int) ( newPoint.getY() - mousePoint.getY() );\n\n e.translatePoint(xDiff, yDiff);\n }", "public AffineTransform getTransform()\n/* */ {\n/* 194 */ return this.transform;\n/* */ }", "public static Matrix genTransFunction(Matrix m) {\n\t\tdouble[][] out = new double[m.getNumRows()][m.getNumCols()];\n\t\tfor(int i = 0; i < m.getNumRows(); i++) {\n\t\t\tfor(int j = 0; j < m.getNumCols(); j++) {\n\t\t\t\tif(j == 0) \n\t\t\t\t\tout[i][j] = sumRow(m.getRow(i), i);\n\t\t\t\telse if(j <= i)\n\t\t\t\t\tout[i][j] = m.get(i, i - j);\n\t\t\t\telse\n\t\t\t\t\tout[i][j] = 0;\n\t\t\t}\n\t\t}\n\t\treturn new Matrix(out);\n\t\t\n\t}", "public DistanceMatrix getDistanceMatrix() {\n\t\tsynchronized(this) {\n\t\t\treturn distanceMatrix;\n\t\t}\n\t}", "public PMVMatrix(boolean useBackingArray) {\n projectFloat = new ProjectFloat();\n \n // I Identity\n // T Texture\n // P Projection\n // Mv ModelView\n // Mvi Modelview-Inverse\n // Mvit Modelview-Inverse-Transpose\n if(useBackingArray) {\n matrixBufferArray = new float[6*16];\n matrixBuffer = null;\n // matrixBuffer = FloatBuffer.wrap(new float[12*16]);\n } else {\n matrixBufferArray = null;\n matrixBuffer = Buffers.newDirectByteBuffer(6*16 * Buffers.SIZEOF_FLOAT);\n matrixBuffer.mark();\n }\n \n matrixIdent = slice2Float(matrixBuffer, matrixBufferArray, 0*16, 1*16); // I\n matrixTex = slice2Float(matrixBuffer, matrixBufferArray, 1*16, 1*16); // T\n matrixPMvMvit = slice2Float(matrixBuffer, matrixBufferArray, 2*16, 4*16); // P + Mv + Mvi + Mvit \n matrixPMvMvi = slice2Float(matrixBuffer, matrixBufferArray, 2*16, 3*16); // P + Mv + Mvi\n matrixPMv = slice2Float(matrixBuffer, matrixBufferArray, 2*16, 2*16); // P + Mv\n matrixP = slice2Float(matrixBuffer, matrixBufferArray, 2*16, 1*16); // P\n matrixMv = slice2Float(matrixBuffer, matrixBufferArray, 3*16, 1*16); // Mv\n matrixMvi = slice2Float(matrixBuffer, matrixBufferArray, 4*16, 1*16); // Mvi\n matrixMvit = slice2Float(matrixBuffer, matrixBufferArray, 5*16, 1*16); // Mvit\n \n if(null != matrixBuffer) {\n matrixBuffer.reset();\n } \n ProjectFloat.gluMakeIdentityf(matrixIdent);\n \n vec3f = new float[3];\n matrixMult = new float[16];\n matrixTrans = new float[16];\n matrixRot = new float[16];\n matrixScale = new float[16];\n matrixOrtho = new float[16];\n matrixFrustum = new float[16];\n ProjectFloat.gluMakeIdentityf(matrixTrans, 0);\n ProjectFloat.gluMakeIdentityf(matrixRot, 0);\n ProjectFloat.gluMakeIdentityf(matrixScale, 0);\n ProjectFloat.gluMakeIdentityf(matrixOrtho, 0);\n ProjectFloat.gluMakeZero(matrixFrustum, 0);\n \n matrixPStack = new ArrayList<float[]>();\n matrixMvStack= new ArrayList<float[]>();\n \n // default values and mode\n glMatrixMode(GL_PROJECTION);\n glLoadIdentity();\n glMatrixMode(GL_MODELVIEW);\n glLoadIdentity();\n glMatrixMode(GL.GL_TEXTURE);\n glLoadIdentity();\n setDirty();\n update();\n }", "breeze.linalg.DenseMatrix<java.lang.Object> toBreeze () { throw new RuntimeException(); }", "private static Node setupMatrix()\n {\n Node thomasAnderson = graphDb.createNode();\n thomasAnderson.setProperty( \"name\", \"Thomas Anderson\" );\n thomasAnderson.setProperty( \"age\", 29 );\n \n Node trinity = graphDb.createNode();\n trinity.setProperty( \"name\", \"Trinity\" );\n Relationship rel = thomasAnderson.createRelationshipTo( trinity, \n MatrixRelationshipTypes.KNOWS );\n rel.setProperty( \"age\", \"3 days\" );\n \n Node morpheus = graphDb.createNode();\n morpheus.setProperty( \"name\", \"Morpheus\" );\n morpheus.setProperty( \"rank\", \"Captain\" );\n morpheus.setProperty( \"occupation\", \"Total badass\" );\n thomasAnderson.createRelationshipTo( morpheus, MatrixRelationshipTypes.KNOWS );\n rel = morpheus.createRelationshipTo( trinity, \n MatrixRelationshipTypes.KNOWS );\n rel.setProperty( \"age\", \"12 years\" );\n \n Node cypher = graphDb.createNode();\n cypher.setProperty( \"name\", \"Cypher\" );\n cypher.setProperty( \"last name\", \"Reagan\" );\n rel = morpheus.createRelationshipTo( cypher, \n MatrixRelationshipTypes.KNOWS );\n rel.setProperty( \"disclosure\", \"public\" );\n \n Node smith = graphDb.createNode();\n smith.setProperty( \"name\", \"Agent Smith\" );\n smith.setProperty( \"version\", \"1.0b\" );\n smith.setProperty( \"language\", \"C++\" );\n rel = cypher.createRelationshipTo( smith, MatrixRelationshipTypes.KNOWS );\n rel.setProperty( \"disclosure\", \"secret\" );\n rel.setProperty( \"age\", \"6 months\" );\n \n Node architect = graphDb.createNode();\n architect.setProperty( \"name\", \"The Architect\" );\n smith.createRelationshipTo( architect, MatrixRelationshipTypes.CODED_BY );\n \n return thomasAnderson;\n }", "public Matrix getMatrix() {\n\t\treturn matrix;\n\t}", "godot.wire.Wire.Transform getTransformValue();", "DeviceCoordinate transformWorldToScreen(final double x, final double y);", "void vectorToWorld(double px, double py, double pz, DVector3 result);", "public Matrix3f getPhysicsRotationMatrix() {\n return getPhysicsRotationMatrix(null);\n }", "public Node getNormalizedNode() {\n\t\treturn transformedNode;\n\t}", "public Matrix transpose(){\r\n \tMatrix tmat = new Matrix(this.ncol, this.nrow);\r\n \tdouble[][] tarray = tmat.getArrayReference();\r\n \tfor(int i=0; i<this.ncol; i++){\r\n \t\tfor(int j=0; j<this.nrow; j++){\r\n \t\ttarray[i][j]=this.matrix[j][i];\r\n \t\t}\r\n \t}\r\n \treturn tmat;\r\n \t}", "public int[][] getMatrix(){\n\t\treturn matrix;\n\t}", "public Matrix getCombinedTransfo(Document document,double sourcescale,double targetscale){\n\t\tElement root = XMLUtil.getRootElement(document);\n\n\n\n\n\t\tArrayList<Element> transfoElementArrayList = XMLUtil.getElements( root , \"MatrixTransformation\" );\n\n\t\tArrayList<Matrix> listoftransfo=new ArrayList<Matrix>();\n\t\tMatrix ScaleSourcetransfo=Matrix.identity(4, 4).times(1*sourcescale);\n\t\tScaleSourcetransfo.set(3,3,1.0);\n\t\tScaleSourcetransfo.set(2,2,1.0);//do not touch z\n\t\tMatrix Scaletargettransfo=Matrix.identity(4, 4).times(1.0/targetscale);\n\t\tScaletargettransfo.set(3,3,1.0);\n\t\tScaletargettransfo.set(2,2,1.0);//do not touch z\n\t\tlistoftransfo.add(ScaleSourcetransfo);\n\t\tfor ( Element transfoElement : transfoElementArrayList )\n\t\t{\n\t\t\tdouble[][] m=new double[4][4];\n\n\n\t\t\tm[0][0] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m00\" , 0 );\n\t\t\tm[0][1] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m01\" , 0 );\n\t\t\tm[0][2] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m02\" , 0 );\t\n\t\t\tm[0][3] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m03\" , 0 );\n\n\t\t\tm[1][0] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m10\" , 0 );\n\t\t\tm[1][1] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m11\" , 0 );\n\t\t\tm[1][2]= XMLUtil.getAttributeDoubleValue( transfoElement, \"m12\" , 0 );\t\n\t\t\tm[1][3] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m13\" , 0 );\n\n\t\t\tm[2][0]= XMLUtil.getAttributeDoubleValue( transfoElement, \"m20\" , 0 );\n\t\t\tm[2][1] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m21\" , 0 );\n\t\t\tm[2][2] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m22\" , 0 );\t\n\t\t\tm[2][3] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m23\" , 0 );\n\n\t\t\tm[3][0] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m30\" , 0 );\n\t\t\tm[3][1] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m31\" , 0 );\n\t\t\tm[3][2] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m32\" , 0 );\t\n\t\t\tm[3][3] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m33\" , 0 );\n\n\n\t\t\tMatrix T=new Matrix(m);\n\t\t\tlistoftransfo.add(T);\n\n\n\t\t}\n\t\tlistoftransfo.add(Scaletargettransfo);\n\t\tMatrix CombinedTransfo=Matrix.identity(4, 4);\n\t\tfor (int i=0;i<listoftransfo.size();i++){\n\t\t\tCombinedTransfo=listoftransfo.get(i).times(CombinedTransfo);\n\t\t}\n\t\t//CombinedTransfo.times(1.0/CombinedTransfo.get(3, 3));\n\t\treturn CombinedTransfo;\n\t}", "protected void applyMatrices () {\n combinedMatrix.set(projectionMatrix).mul(transformMatrix);\n getShader().setUniformMatrix(\"u_projTrans\", combinedMatrix);\n }", "public abstract Vector4fc mulProject(IMatrix4f mat);", "public int[][] getMazeMatrix(){ return maze;}", "public double[][] convert_img_mat()\n\t{\n\t\tif(orderflag)\n\t\t{\n\t\t\tputpixel_1();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//rotate the image and get the pixels as usual form\t\n \t\tputpixel_2();\n\t\t}\n\treturn matrix;\n\t}", "protected void compute_mvpMatrix(float[] VPMatrix) {\n Matrix.multiplyMM(tempMatrix, 0, modelMatrix, 0, accumulatedRotation, 0);\n\n // ... e applica la matrice che contiene il risultato della matrice view e di proiezione\n Matrix.multiplyMM(mvpMatrix, 0, VPMatrix, 0, tempMatrix, 0);\n }", "public char[][] toMatrix() {\n\t\tint tmp1 = this.player1_moves;\n\t\tint tmp2 = this.player2_moves;\n\n\t\tchar[][] matrix = new char[3][3];\n\t\tfor (int n = 0; n < 9; n++) {\n\t\t\tint i = n / 3;\n\t\t\tint j = n % 3;\n\t\t\tif ((tmp1 & 1) == 1)\n\t\t\t\tmatrix[i][j] = 'X';\n\t\t\telse if ((tmp2 & 1) == 1)\n\t\t\t\tmatrix[i][j] = 'O';\n\t\t\ttmp1 >>= 1;\n\t\t\ttmp2 >>= 1;\n\t\t}\n\n\t\treturn matrix;\n\t}", "public Transform getTransform() {return transform;}", "private Matrix toMatrix(Object o) {\n\t\tif(o instanceof String) {\n\t\t\tif(!isMatrix((String) o)) return null;\n\t\t\telse if(o.equals(\"A\")) return a;\n\t\t\telse return b;\n\t\t}\n\t\telse if(o instanceof Matrix) return (Matrix) o;\n\t\telse return null;\n\t}", "public TransformationMatrix(TransformationMatrix m) {\n\t\ta11 = m.a11; a12 = m.a12; a13 = m.a13; a14 = m.a14;\n\t\ta21 = m.a21; a22 = m.a22; a23 = m.a23; a24 = m.a24;\n\t\ta31 = m.a31; a32 = m.a32; a33 = m.a33; a34 = m.a34;\n\t}", "public void updateProjector(Matrix4f trans) {\r\n\t\tMatrix4f oldM = new Matrix4f(getProjector().getModelM());\r\n\t\tgetProjector().setModelM(trans.multiply(oldM.transpose()).transpose().toArray());\r\n\t}", "public Node getTargetSpace()\n {\n return _targetSpace;\n }", "void setOffsetWorldRotation(DMatrix3C R);", "public float[] getViewMatrix() {\n\t\treturn viewMatrix;\n\t}", "public Vector4f objectToProjectionMatrix(Vector3f vector) {\r\n\t\treturn Matrix4f.transform(this.PROJECTION_MATRIX, new Vector4f(vector.x, vector.y, vector.z, 1), null);\r\n\t}", "protected void rotateToNode() {\n\t\tPose pose = poseProvider.getPose();\n\t\tdouble bearing = pose.relativeBearing(node);\n\t\tbindTransition(pilot.rotateComplete(bearing), NavigatorState.TRAVEL);\n\t}", "public Vector3f getTranslationVec() {\n\t\treturn m_xforms[NvCameraXformType.MAIN].m_translate;\n\t}", "protected synchronized void resetModelViewMatrix()\n {\n Matrix4d transform = new Matrix4d();\n // translate so that the viewer is at the origin\n Matrix4d translation = new Matrix4d();\n translation.setTranslation(myPosition.getLocation().multiply(-1.));\n // rotate to put the viewer pointing in the -z direction with the up\n // vector along the +y axis.\n Quaternion quat = Quaternion.lookAt(myPosition.getDir().multiply(-1.), myPosition.getUp());\n Matrix4d rotation = new Matrix4d();\n rotation.setRotationQuaternion(quat);\n // set the transform.\n transform.multLocal(rotation);\n transform.multLocal(translation);\n myModelViewMatrix = transform.toFloatArray();\n setInverseModelViewMatrix(transform.invert());\n clearModelToWindowTransform();\n }", "public void cameraTransform(Vector3f targ, Vector3f up) {\r\n\t\t// First normalize the target\r\n\t\tVector3f n = targ;\r\n\t\tn.normalize();\r\n\t\t// Then normalize the up vector\r\n\t\tVector3f u = up;\r\n\t\tu.normalize();\r\n\t\t// Then cross the two together to get the right vector\r\n\t\tu = u.cross(n);\r\n\t\tVector3f v = n.cross(u);\r\n\r\n\t\t// Finally build a matrix from the result\r\n\t\tm[0][0] = u.x; m[0][1] = u.y; m[0][2] = u.z; m[0][3] = 0.0f;\r\n\t\tm[1][0] = v.x; m[1][1] = v.y; m[1][2] = v.z; m[1][3] = 0.0f;\r\n\t\tm[2][0] = n.x; m[2][1] = n.y; m[2][2] = n.z; m[2][3] = 0.0f;\r\n\t\tm[3][0] = 0.0f; m[3][1] = 0.0f; m[3][2] = 0.0f; m[3][3] = 1.0f;\r\n\r\n\t}", "private AffineTransform createTransform() {\n Dimension size = getSize();\n Rectangle2D.Float panelRect = new Rectangle2D.Float(\n BORDER,\n BORDER,\n size.width - BORDER - BORDER,\n size.height - BORDER - BORDER);\n AffineTransform tr = AffineTransform.getTranslateInstance(panelRect.getCenterX(), panelRect.getCenterY());\n double sx = panelRect.getWidth() / mapBounds.getWidth();\n double sy = panelRect.getHeight() / mapBounds.getHeight();\n double scale = min(sx, sy);\n tr.scale(scale, -scale);\n tr.translate(-mapBounds.getCenterX(), -mapBounds.getCenterY());\n return tr;\n }", "WorldDistance transformScreenDeltaToWorld(final DeviceDistance screen);", "@java.lang.Override\n public godot.wire.Wire.Transform2D getTransform2DValue() {\n if (typeCase_ == 9) {\n return (godot.wire.Wire.Transform2D) type_;\n }\n return godot.wire.Wire.Transform2D.getDefaultInstance();\n }", "public Matrix getTranspose() {\r\n double[][] jadi = new double[matrix[0].length][matrix.length];\r\n for (int i = 0; i < jadi.length; i++) {\r\n for (int j = 0; j < jadi[0].length; j++) {\r\n jadi[i][j] = matrix[j][i];\r\n }\r\n }\r\n return new Matrix(jadi);\r\n }", "void copyRotation(DMatrix3 R);", "private void transformation(GL gl)\n {\n\t\t// Make X axis face forward, Y right, Z up\n\t\t// (map ZXY to XYZ)\n\t\tgl.glRotated(-90, 1, 0, 0);\n\t\tgl.glRotated(-90, 0, 0, 1);\n\t \n\t\tif (drawBugView.value) {\n\t\t // ---- \"Bug cam\" transformation (for mainBug)\n\t\t\t// this is the inverse of the M transformation that places the bug in the scene (based on mainbug pos and vel)\n double angle = Math.atan2(mainBug.vel.y, mainBug.vel.x);\n \t\tgl.glRotated(Math.toDegrees(Math.PI - angle), 0, 0, 1);\n \t\t\n \t\t//drawing a bit above the z axis so we can see the ground\n\t\t\tgl.glTranslated(-mainBug.pos.x, -mainBug.pos.y, -mainBug.pos.z-0.2);\n\t\t} else {\n\t\t // ---- Ordinary scene transformation\n\t\n\t\t // Move camera back so that scene is visible\n\t\t gl.glTranslated(-20, 0, 0);\n\t\t \n\t\t // Translate by Zoom/Horiz/Vert\n\t\t gl.glTranslated(tZ.value, tH.value, tV.value);\n\t\t \n\t\t // Rotate by Alt/Azim\n\t\t gl.glRotated(rAlt.value, 0, 1, 0);\n\t\t gl.glRotated(rAzim.value, 0, 0, 1);\n\t\t}\n }", "void copyOffsetRotation (DMatrix3 R);", "public Vector3D getTransformedVector(Vector3D V) {\r\n\t\tVector3D rv = new Vector3D();\r\n\t\trv.x = V.x * M11 + V.y * M21 + V.z * M31 + V.w * M41;\r\n\t\trv.y = V.x * M12 + V.y * M22 + V.z * M32 + V.w * M42;\r\n\t\trv.z = V.x * M13 + V.y * M23 + V.z * M33 + V.w * M43;\r\n\t\trv.w = V.x * M14 + V.y * M24 + V.z * M34 + V.w * M44;\r\n\t\treturn rv;\r\n\t}", "public static CvMat getPerspectiveTransform(double[] src, double[] dst, CvMat map_matrix) {\n // creating and releasing matrices via NIO here in this function...\n // this can easily become a bottleneck\n CvMat A = CvMat.create(8, 8);\n CvMat b = CvMat.create(8, 1);\n CvMat x = CvMat.create(8, 1);\n\n for(int i = 0; i < 4; ++i ) {\n A.put(i*8+0, src[i*2]); A.put((i+4)*8+3, src[i*2]);\n A.put(i*8+1, src[i*2+1]); A.put((i+4)*8+4, src[i*2+1]);\n A.put(i*8+2, 1); A.put((i+4)*8+5, 1);\n A.put(i*8+3, 0); A.put(i*8+4, 0); A.put(i*8+5, 0);\n A.put((i+4)*8+0, 0); A.put((i+4)*8+1, 0); A.put((i+4)*8+2, 0);\n\n A.put(i*8+6, -src[i*2] *dst[i*2]);\n A.put(i*8+7, -src[i*2+1]*dst[i*2]);\n A.put((i+4)*8+6, -src[i*2] *dst[i*2+1]);\n A.put((i+4)*8+7, -src[i*2+1]*dst[i*2+1]);\n\n b.put(i, dst[i*2]);\n b.put(i+4, dst[i*2+1]);\n }\n cxcore.cvSolve(A, b, x, cxcore.CV_LU);\n map_matrix.put(x);\n map_matrix.put(8, 1);\n\n return map_matrix;\n }", "public Mat4x4 getMatView() {\n Mat4x4 matCameraRotX = MatrixMath.matrixMakeRotationX(cameraRot.getX());\n Mat4x4 matCameraRotY = MatrixMath.matrixMakeRotationY(cameraRot.getY());\n Mat4x4 matCameraRotZ = MatrixMath.matrixMakeRotationZ(cameraRot.getZ());\n Mat4x4 matCameraRotXY = MatrixMath.matrixMultiplyMatrix(matCameraRotX, matCameraRotY);\n Mat4x4 matCameraRot = MatrixMath.matrixMultiplyMatrix(matCameraRotXY, matCameraRotZ);\n matCamera = calculateMatCamera(up, target, matCameraRot);\n matView = MatrixMath.matrixQuickInverse(matCamera);\n return matView;\n }", "public Matrix getCurrentRotation() throws ManipulatorException;", "public AffineTransform3D() {\r\n\t\tthis.M11 = 1;\r\n\t\tthis.M12 = 0;\r\n\t\tthis.M13 = 0;\r\n\t\tthis.M14 = 0;\r\n\t\tthis.M21 = 0;\r\n\t\tthis.M22 = 1;\r\n\t\tthis.M23 = 0;\r\n\t\tthis.M24 = 0;\r\n\t\tthis.M31 = 0;\r\n\t\tthis.M32 = 0;\r\n\t\tthis.M33 = 1;\r\n\t\tthis.M34 = 0;\r\n\t\tthis.M41 = 0;\r\n\t\tthis.M42 = 0;\r\n\t\tthis.M43 = 0;\r\n\t\tthis.M44 = 1;\r\n\t}" ]
[ "0.67802674", "0.6775275", "0.6199959", "0.6131841", "0.5806495", "0.57381094", "0.5716395", "0.5541916", "0.54829395", "0.5433526", "0.5388775", "0.53691345", "0.53287846", "0.53113556", "0.53109527", "0.5266061", "0.5260541", "0.52493167", "0.5242064", "0.523254", "0.51541096", "0.51296705", "0.5095673", "0.5078471", "0.50072396", "0.49965745", "0.4987252", "0.49416885", "0.49375412", "0.4928458", "0.49147457", "0.49119604", "0.48924208", "0.4871378", "0.4856378", "0.4844555", "0.48417836", "0.48385325", "0.48349008", "0.48227796", "0.48209", "0.47940856", "0.47940683", "0.47884873", "0.47683513", "0.47655794", "0.4749235", "0.47490275", "0.47382402", "0.47342798", "0.47175238", "0.4695692", "0.4694916", "0.4679196", "0.4663486", "0.4652238", "0.46333116", "0.46225294", "0.46201843", "0.46139333", "0.4613089", "0.46093896", "0.46026483", "0.45906535", "0.45320597", "0.45276597", "0.45043308", "0.4503751", "0.45016375", "0.44996038", "0.44899854", "0.44866735", "0.448186", "0.44808424", "0.44798502", "0.44766665", "0.44680008", "0.4450627", "0.44493806", "0.4445956", "0.44413048", "0.44142568", "0.4410395", "0.4407745", "0.44010863", "0.43937865", "0.43884948", "0.43881682", "0.43799573", "0.43791673", "0.43748128", "0.4373571", "0.43680578", "0.43665347", "0.43644357", "0.43632138", "0.43607944", "0.4358641", "0.43535167", "0.43510354" ]
0.71718335
0
////////////////////////////////////////////////////////////////////// Description: Returns the transformation matrix to go from world space to the object space corresponding to the given node in the path. Use: public
public SbMatrix getWorldToObject( SoNode node) // //////////////////////////////////////////////////////////////////////// { getMatrix(node); return matrixAction.getInverse(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public SbMatrix\ngetObjectToWorld(final SoNode node)\n//\n////////////////////////////////////////////////////////////////////////\n{\n getMatrix(node);\n return matrixAction.getMatrix();\n}", "private void\ngetMatrix( SoNode node)\n//\n////////////////////////////////////////////////////////////////////////\n{\n SoPath xfPath; // ptr\n\n // Construct a path from the root down to this node. Use the given\n // path if it's the same\n if (node == null || node == SoFullPath.cast(path).getTail())\n xfPath = path;\n\n else {\n int index = getNodeIndex(node);\n xfPath = path.copy(0, index + 1);\n xfPath.ref();\n }\n\n // Create an action instance if necessary, then apply it to the path\n if (matrixAction == null)\n matrixAction = new SoGetMatrixAction(vpRegion);\n matrixAction.apply(xfPath);\n\n if (xfPath != path)\n xfPath.unref();\n}", "public Matrix4f getWorldMatrix() {\n\n\t\t// First identity\n\t\tmTranformation.identity();\n\n\t\t// Translate\n\t\tmTranformation.translate(position);\n\n\t\t// Rotate object at the center of the texture\n\t\tfloat x = 0.5f * mWidth;\n\t\tfloat y = 0.5f * mHeight;\n\n\t\t// Do rotating\n\t\tmTranformation.translate(new Vector3f(x, y, 0));\n\t\tmTranformation.rotateZ((float) Math.toRadians(rotation.z));\n\t\tmTranformation.translate(new Vector3f(-x, -y, 0));\n\n\t\t// mTranformation.scale(scale, scale, 1);\n\t\tmTranformation.scaleAround(scale, x, y, 0);\n\n\t\treturn mTranformation;\n\t}", "public mat4 getMatrix() {\n return worldMatrix;\n }", "public Matrix4 getTransformMatrix() {\n return transformMatrix;\n }", "public Matrix getTransform()\n {\n return transform;\n }", "@Override\r\n protected Matrix4f genViewMatrix() {\r\n\r\n // refreshes the position\r\n position = calcPosition();\r\n\r\n // calculate the camera's coordinate system\r\n Vector3f[] coordSys = genCoordSystem(position.subtract(center));\r\n Vector3f right, up, forward;\r\n forward = coordSys[0];\r\n right = coordSys[1];\r\n up = coordSys[2];\r\n\r\n // we move the world, not the camera\r\n Vector3f position = this.position.negate();\r\n\r\n return genViewMatrix(forward, right, up, position);\r\n }", "public static TransformMatrix translationMatrix(float x, float y) {\n\t\treturn new TransformMatrix(1,1,x,y);\n\t}", "protected Matrix4f createModelMatrix(Entity entity) {\n\n //Assemble the model matrix order = SRT\n Matrix4f matrix = new Matrix4f();\n matrix.mul(entity.getTranslationMatrix());\n matrix.mul(entity.getRotation());\n matrix.mul(entity.getScaleMatrix());\n \n return matrix;\n }", "private void constructTransitionTransposeMatrix() {\r\n\t\tfor(int i=0; i<getNodeCnt(); i++) {\r\n\t\t\tArrayList<NodeTransition> transitionList = new ArrayList<NodeTransition>();\r\n\t\t\tmTransitionTranspose.add( transitionList );\r\n\t\t}\r\n\t\tfor(Node node: mNodes) {\r\n\t\t\tint fromId = node.getId();\r\n\t\t\tint outDegree = node.getOutDegree();\r\n\t\t\t\r\n\t\t\tSet<Integer> outEdges = getOutEdges(fromId);\r\n\t\t\tfor(Integer edgeId: outEdges) {\r\n\t\t\t\tint toId = getEdge(edgeId).getToId();\r\n\t\t\t\tdouble pTransition = (double) getEdge(edgeId).getWeight() / (double) outDegree;\r\n\t\t\t\t\r\n\t\t\t\tArrayList<NodeTransition> transitionList = mTransitionTranspose.get(toId);\r\n\t\t\t\ttransitionList.add( new NodeTransition(fromId, pTransition) );\r\n\t\t\t}\r\n\t\t}\r\n\t}", "float[] getProjectionMatrix();", "public Transform getTransform () {\n\t\torg.jbox2d.common.Transform trans = body.getTransform();\n\t\ttransform.vals[Transform.POS_X] = trans.p.x;\n\t\ttransform.vals[Transform.POS_Y] = trans.p.y;\n\t\ttransform.vals[Transform.COS] = trans.q.c;\n\t\ttransform.vals[Transform.SIN] = trans.q.s;\n\t\treturn transform;\n\t}", "public GeneralPath transform(Matrix matrix)\n {\n float x1 = getLowerLeftX();\n float y1 = getLowerLeftY();\n float x2 = getUpperRightX();\n float y2 = getUpperRightY();\n\n Point2D.Float p0 = matrix.transformPoint(x1, y1);\n Point2D.Float p1 = matrix.transformPoint(x2, y1);\n Point2D.Float p2 = matrix.transformPoint(x2, y2);\n Point2D.Float p3 = matrix.transformPoint(x1, y2);\n\n GeneralPath path = new GeneralPath();\n path.moveTo(p0.getX(), p0.getY());\n path.lineTo(p1.getX(), p1.getY());\n path.lineTo(p2.getX(), p2.getY());\n path.lineTo(p3.getX(), p3.getY());\n path.closePath();\n return path;\n }", "public SbMatrix\ngetImageToObject(SoNode node)\n//\n////////////////////////////////////////////////////////////////////////\n{\n getMatrix(node);\n return matrixAction.getTextureInverse();\n}", "@Override\n\tpublic Mat GetTranslateMatrix()\n\t{\n\t\treturn mT;\n\t}", "protected Matrix4 computeTransform() {\n return super.computeTransform();\n }", "godot.wire.Wire.Transform2D getTransform2DValue();", "public SbMatrix\ngetObjectToImage( SoNode node) \n//\n////////////////////////////////////////////////////////////////////////\n{\n getMatrix(node);\n return matrixAction.getTextureMatrix();\n}", "public org.apache.spark.mllib.linalg.Matrix toLocalMatrix () { throw new RuntimeException(); }", "public WorldToScreenTransform getWorldToScreenTransform() { return this; }", "public Matrix4f getTranslationMat() {\n\t\treturn m_xforms[NvCameraXformType.MAIN].m_translateMat;\n\t}", "public void transform(Matrix m)\n { \n\t \tfor(int i= 0 ; i < this.vertex.length ; i++)\n\t \t{\n\t \t\tthis.vertex[i] = this.vertex[i].transform(m);\n\t \t}\n\t \n }", "Matrix4f getModelMatrix();", "public void translateTransform(Vector3f trans) {\r\n\t\tm[0][0] = 1.0f; m[0][1] = 0.0f; m[0][2] = 0.0f; m[0][3] = trans.x;\r\n\t\tm[1][0] = 0.0f; m[1][1] = 1.0f; m[1][2] = 0.0f; m[1][3] = trans.y;\r\n\t\tm[2][0] = 0.0f; m[2][1] = 0.0f; m[2][2] = 1.0f; m[2][3] = trans.z;\r\n\t\tm[3][0] = 0.0f; m[3][1] = 0.0f; m[3][2] = 0.0f; m[3][3] = 1.0f;\r\n\r\n\t}", "public abstract Matrix4f getCameraMatrix();", "@Override\n public float[] getRotationMatrix(){\n float[] baseCorrection = Maths.buildRotationMatrix(new float[]{0, 1, 0, 0});\n\n float[] rotationX = {(float) Math.toDegrees(theta), 1, 0, 0};\n float[] rotationY = {(float) -Math.toDegrees(phi), 0, 1, 0};\n\n float[] rotationMatrix = new float[16];\n float[] coreMotionMatrix = Maths.buildRotationMatrix(rotationY, rotationX);\n Matrix.multiplyMM(rotationMatrix, 0, baseCorrection, 0, coreMotionMatrix, 0);\n\n return rotationMatrix;\n }", "public AffineTransform getTransform()\r\n\t{\r\n\t\treturn _g2.getTransform();\r\n\t}", "DMatrix3C getRotation();", "public TransformationMatrix() {\n\t\ta11 = 1; a12 = 0; a13 = 0; a14 = 0;\n\t\ta21 = 0; a22 = 1; a23 = 0; a24 = 0;\n\t\ta31 = 0; a32 = 0; a33 = 1; a34 = 0;\n\t}", "float[] getViewMatrix();", "private void constructTransitionMatrix() {\r\n\t\tfor(Node node: mNodes) {\r\n\t\t\tint nodeId = node.getId();\r\n\t\t\tint outDegree = node.getOutDegree();\r\n\t\t\tArrayList<NodeTransition> transitionList = new ArrayList<NodeTransition>();\r\n\t\t\t\r\n\t\t\tSet<Integer> outEdges = getOutEdges(nodeId);\r\n\t\t\tfor(Integer edgeId: outEdges) {\r\n\t\t\t\tint toId = getEdge(edgeId).getToId();\r\n\t\t\t\tdouble pTransition = (double) getEdge(edgeId).getWeight() / (double) outDegree;\r\n\t\t\t\ttransitionList.add( new NodeTransition(toId, pTransition) );\r\n\t\t\t}\r\n\t\t\tmTransition.add( transitionList );\r\n\t\t}\r\n\t}", "void applyRotationMatrix() {\n for (int i = 0; i < coors.length; i++) {\n for (int j = 0; j < coors[i].length; j++) {\n newCoors[i][j] = coors[i][0] * R[j][0] + coors[i][1] * R[j][1] + coors[i][2] * R[j][2];\n }\n // add perspective\n float scale = map(Math.abs(newCoors[i][2]), 0, (float) (halfSize * Math.sqrt(3)), 1, 1.5f);\n if (newCoors[i][2] < 0) {\n scale = 2f - scale;\n }\n for (int j = 0; j < 2; j++) {\n newCoors[i][j] *= scale;\n }\n }\n // to R2\n // just dont use Z\n setPathAndAlpha();\n }", "private Matrix33d getMatrix() {\n final Matrix33d m = new Matrix33d();\n m.setMatrixColumn(new Vector3d(V1), 0);\n m.setMatrixColumn(new Vector3d(V2), 1);\n m.setMatrixColumn(new Vector3d(V3), 2);\n return m;\n }", "protected Matrix4 computeTransform() {\n return internalGroup.computeTransform();\n }", "public Matrix getMatrix() {\n Matrix matrix2 = new Matrix();\n matrix2.set(this.matrix);\n return matrix2;\n }", "abstract public Matrix4fc getViewMatrix();", "public Matrix4f getWorldMatrix(Vector3f offset, Vector3f rotation, float scale) {\n\t\tworldMatrix.identity();\n\t\tworldMatrix.translate(offset);\n\t\tworldMatrix.rotateX((float)Math.toRadians(rotation.x));\n\t\tworldMatrix.rotateY((float)Math.toRadians(rotation.y));\n\t\tworldMatrix.rotateZ((float)Math.toRadians(rotation.z));\n\t\tworldMatrix.scale(scale);\n\t\treturn worldMatrix;\n\t}", "float[] getModelMatrix();", "public int[][] getTransitionMatrix() {\n\t\treturn null;\n\t}", "public void translate( float x, float y )\n\t{\n\t\tMatrix4f opMat = new Matrix4f();\n\t\topMat.set( new Vector3f( x, y, 0 ) );\n\t\tmat.mul( opMat );\n\t}", "void calculateRotationMatrix() {\n R[0][0] = (float) (Math.cos(angle[0]) * Math.cos(angle[1]));\n R[1][0] = (float) (Math.sin(angle[0]) * Math.cos(angle[1]));\n R[0][1] = (float) (Math.cos(angle[0]) * Math.sin(angle[1]) * Math.sin(angle[2]) - Math.sin(angle[0]) * Math.cos(angle[2]));\n R[1][1] = (float) (Math.sin(angle[0]) * Math.sin(angle[1]) * Math.sin(angle[2]) + Math.cos(angle[0]) * Math.cos(angle[2]));\n R[0][2] = (float) (Math.cos(angle[0]) * Math.sin(angle[1]) * Math.cos(angle[2]) + Math.sin(angle[0]) * Math.sin(angle[2]));\n R[1][2] = (float) (Math.sin(angle[0]) * Math.sin(angle[1]) * Math.cos(angle[2]) - Math.cos(angle[0]) * Math.sin(angle[2]));\n R[2][0] = (float) - Math.sin(angle[1]);\n R[2][1] = (float) (Math.cos(angle[1]) * Math.sin(angle[2]));\n R[2][2] = (float) (Math.cos(angle[1]) * Math.cos(angle[2]));\n }", "public AffineTransform getTransform()\n/* */ {\n/* 194 */ return this.transform;\n/* */ }", "public SbVec4f\ngetObjectTextureCoords(final SoNode node)\n//\n////////////////////////////////////////////////////////////////////////\n{\n return multVecMatrix4(getImageToObject(node), imageTexCoords);\n}", "public Transform getTransformation() {\n Transform t = Transform.newTranslation(position);\n t = t.compose(Transform.newScale(scale));\n t = t.compose(Transform.newXRotation(rotation.x));\n t = t.compose(Transform.newYRotation(rotation.y));\n t = t.compose(Transform.newZRotation(rotation.z));\n return t;\n }", "protected abstract float[] computeLeafModelMatrix();", "public float[] getProjectionMatrix() {\n\t\treturn projectionMatrix;\n\t}", "public float [][] GetMatrix() {\n \n\t/*\n\tinputs--\n\t*/\n\t\n\t/*\n\toutputs--\n\t\n\tmat_f_m :\n\t The self matrix\n\t*/\n\t\n\treturn this.mat_f_m;\n \n }", "public PMVMatrix(boolean useBackingArray) {\n projectFloat = new ProjectFloat();\n \n // I Identity\n // T Texture\n // P Projection\n // Mv ModelView\n // Mvi Modelview-Inverse\n // Mvit Modelview-Inverse-Transpose\n if(useBackingArray) {\n matrixBufferArray = new float[6*16];\n matrixBuffer = null;\n // matrixBuffer = FloatBuffer.wrap(new float[12*16]);\n } else {\n matrixBufferArray = null;\n matrixBuffer = Buffers.newDirectByteBuffer(6*16 * Buffers.SIZEOF_FLOAT);\n matrixBuffer.mark();\n }\n \n matrixIdent = slice2Float(matrixBuffer, matrixBufferArray, 0*16, 1*16); // I\n matrixTex = slice2Float(matrixBuffer, matrixBufferArray, 1*16, 1*16); // T\n matrixPMvMvit = slice2Float(matrixBuffer, matrixBufferArray, 2*16, 4*16); // P + Mv + Mvi + Mvit \n matrixPMvMvi = slice2Float(matrixBuffer, matrixBufferArray, 2*16, 3*16); // P + Mv + Mvi\n matrixPMv = slice2Float(matrixBuffer, matrixBufferArray, 2*16, 2*16); // P + Mv\n matrixP = slice2Float(matrixBuffer, matrixBufferArray, 2*16, 1*16); // P\n matrixMv = slice2Float(matrixBuffer, matrixBufferArray, 3*16, 1*16); // Mv\n matrixMvi = slice2Float(matrixBuffer, matrixBufferArray, 4*16, 1*16); // Mvi\n matrixMvit = slice2Float(matrixBuffer, matrixBufferArray, 5*16, 1*16); // Mvit\n \n if(null != matrixBuffer) {\n matrixBuffer.reset();\n } \n ProjectFloat.gluMakeIdentityf(matrixIdent);\n \n vec3f = new float[3];\n matrixMult = new float[16];\n matrixTrans = new float[16];\n matrixRot = new float[16];\n matrixScale = new float[16];\n matrixOrtho = new float[16];\n matrixFrustum = new float[16];\n ProjectFloat.gluMakeIdentityf(matrixTrans, 0);\n ProjectFloat.gluMakeIdentityf(matrixRot, 0);\n ProjectFloat.gluMakeIdentityf(matrixScale, 0);\n ProjectFloat.gluMakeIdentityf(matrixOrtho, 0);\n ProjectFloat.gluMakeZero(matrixFrustum, 0);\n \n matrixPStack = new ArrayList<float[]>();\n matrixMvStack= new ArrayList<float[]>();\n \n // default values and mode\n glMatrixMode(GL_PROJECTION);\n glLoadIdentity();\n glMatrixMode(GL_MODELVIEW);\n glLoadIdentity();\n glMatrixMode(GL.GL_TEXTURE);\n glLoadIdentity();\n setDirty();\n update();\n }", "breeze.linalg.DenseMatrix<java.lang.Object> toBreeze () { throw new RuntimeException(); }", "public Matrix getGraphMatrix(){\n\t\treturn graphMatrix;\n\t}", "Actor[][] toMatrix(Actor[] distArray, int nLocations, Actor[][] world) {\n int length = (int) Math.sqrt(nLocations);\n world = new Actor[length][length];\n\n int n = 0;\n for (int i = 0; i < length; i++) {\n for (int j = 0; j < length; j++) {\n world[i][j] = distArray[n];\n n++;\n }\n }\n return world;\n }", "public Vector3f objectToViewCoord(Matrix4f viewMatrix, Vector3f worldPosition) {\r\n\t\tVector4f objectPos4f = new Vector4f(worldPosition.x, worldPosition.y, worldPosition.z, 1f);\r\n\t\tVector4f objectWorld = Matrix4f.transform(viewMatrix, objectPos4f, null);\r\n\t\treturn new Vector3f(objectWorld.x, objectWorld.y, objectWorld.z);\r\n\t}", "float[] getMVPMatrix();", "public mat4 getRotation() {\n return worldMatrix.getRotation(pr, yr, pr);\n }", "private static Node setupMatrix()\n {\n Node thomasAnderson = graphDb.createNode();\n thomasAnderson.setProperty( \"name\", \"Thomas Anderson\" );\n thomasAnderson.setProperty( \"age\", 29 );\n \n Node trinity = graphDb.createNode();\n trinity.setProperty( \"name\", \"Trinity\" );\n Relationship rel = thomasAnderson.createRelationshipTo( trinity, \n MatrixRelationshipTypes.KNOWS );\n rel.setProperty( \"age\", \"3 days\" );\n \n Node morpheus = graphDb.createNode();\n morpheus.setProperty( \"name\", \"Morpheus\" );\n morpheus.setProperty( \"rank\", \"Captain\" );\n morpheus.setProperty( \"occupation\", \"Total badass\" );\n thomasAnderson.createRelationshipTo( morpheus, MatrixRelationshipTypes.KNOWS );\n rel = morpheus.createRelationshipTo( trinity, \n MatrixRelationshipTypes.KNOWS );\n rel.setProperty( \"age\", \"12 years\" );\n \n Node cypher = graphDb.createNode();\n cypher.setProperty( \"name\", \"Cypher\" );\n cypher.setProperty( \"last name\", \"Reagan\" );\n rel = morpheus.createRelationshipTo( cypher, \n MatrixRelationshipTypes.KNOWS );\n rel.setProperty( \"disclosure\", \"public\" );\n \n Node smith = graphDb.createNode();\n smith.setProperty( \"name\", \"Agent Smith\" );\n smith.setProperty( \"version\", \"1.0b\" );\n smith.setProperty( \"language\", \"C++\" );\n rel = cypher.createRelationshipTo( smith, MatrixRelationshipTypes.KNOWS );\n rel.setProperty( \"disclosure\", \"secret\" );\n rel.setProperty( \"age\", \"6 months\" );\n \n Node architect = graphDb.createNode();\n architect.setProperty( \"name\", \"The Architect\" );\n smith.createRelationshipTo( architect, MatrixRelationshipTypes.CODED_BY );\n \n return thomasAnderson;\n }", "public Matrix transpose(){\r\n \tMatrix tmat = new Matrix(this.ncol, this.nrow);\r\n \tdouble[][] tarray = tmat.getArrayReference();\r\n \tfor(int i=0; i<this.ncol; i++){\r\n \t\tfor(int j=0; j<this.nrow; j++){\r\n \t\ttarray[i][j]=this.matrix[j][i];\r\n \t\t}\r\n \t}\r\n \treturn tmat;\r\n \t}", "public java.util.Iterator<com.google.maps.routing.v2.RouteMatrixElement> computeRouteMatrix(\n com.google.maps.routing.v2.ComputeRouteMatrixRequest request) {\n return io.grpc.stub.ClientCalls.blockingServerStreamingCall(\n getChannel(), getComputeRouteMatrixMethod(), getCallOptions(), request);\n }", "public Matrix4 getProjectionMatrix() {\n return projectionMatrix;\n }", "public Matrix getMatrix() {\n\t\treturn matrix;\n\t}", "godot.wire.Wire.Transform getTransformValue();", "WorldCoordinate transformScreenToWorld(final DeviceCoordinate screen);", "public void updateProjector(Matrix4f trans) {\r\n\t\tMatrix4f oldM = new Matrix4f(getProjector().getModelM());\r\n\t\tgetProjector().setModelM(trans.multiply(oldM.transpose()).transpose().toArray());\r\n\t}", "protected void rotateToNode() {\n\t\tPose pose = poseProvider.getPose();\n\t\tdouble bearing = pose.relativeBearing(node);\n\t\tbindTransition(pilot.rotateComplete(bearing), NavigatorState.TRAVEL);\n\t}", "public Transform getTransform() {return transform;}", "public Matrix3f getPhysicsRotationMatrix() {\n return getPhysicsRotationMatrix(null);\n }", "protected void compute_mvpMatrix(float[] VPMatrix) {\n Matrix.multiplyMM(tempMatrix, 0, modelMatrix, 0, accumulatedRotation, 0);\n\n // ... e applica la matrice che contiene il risultato della matrice view e di proiezione\n Matrix.multiplyMM(mvpMatrix, 0, VPMatrix, 0, tempMatrix, 0);\n }", "public static Matrix genTransFunction(Matrix m) {\n\t\tdouble[][] out = new double[m.getNumRows()][m.getNumCols()];\n\t\tfor(int i = 0; i < m.getNumRows(); i++) {\n\t\t\tfor(int j = 0; j < m.getNumCols(); j++) {\n\t\t\t\tif(j == 0) \n\t\t\t\t\tout[i][j] = sumRow(m.getRow(i), i);\n\t\t\t\telse if(j <= i)\n\t\t\t\t\tout[i][j] = m.get(i, i - j);\n\t\t\t\telse\n\t\t\t\t\tout[i][j] = 0;\n\t\t\t}\n\t\t}\n\t\treturn new Matrix(out);\n\t\t\n\t}", "public double[][] convert_img_mat()\n\t{\n\t\tif(orderflag)\n\t\t{\n\t\t\tputpixel_1();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//rotate the image and get the pixels as usual form\t\n \t\tputpixel_2();\n\t\t}\n\treturn matrix;\n\t}", "public abstract Vector4fc mulProject(IMatrix4f mat);", "public TransformationMatrix(TransformationMatrix m) {\n\t\ta11 = m.a11; a12 = m.a12; a13 = m.a13; a14 = m.a14;\n\t\ta21 = m.a21; a22 = m.a22; a23 = m.a23; a24 = m.a24;\n\t\ta31 = m.a31; a32 = m.a32; a33 = m.a33; a34 = m.a34;\n\t}", "private Matrix toMatrix(Object o) {\n\t\tif(o instanceof String) {\n\t\t\tif(!isMatrix((String) o)) return null;\n\t\t\telse if(o.equals(\"A\")) return a;\n\t\t\telse return b;\n\t\t}\n\t\telse if(o instanceof Matrix) return (Matrix) o;\n\t\telse return null;\n\t}", "public int[][] getMatrix(){\n\t\treturn matrix;\n\t}", "public DistanceMatrix getDistanceMatrix() {\n\t\tsynchronized(this) {\n\t\t\treturn distanceMatrix;\n\t\t}\n\t}", "public Vector4f objectToProjectionMatrix(Vector3f vector) {\r\n\t\treturn Matrix4f.transform(this.PROJECTION_MATRIX, new Vector4f(vector.x, vector.y, vector.z, 1), null);\r\n\t}", "public AffineTransform3D() {\r\n\t\tthis.M11 = 1;\r\n\t\tthis.M12 = 0;\r\n\t\tthis.M13 = 0;\r\n\t\tthis.M14 = 0;\r\n\t\tthis.M21 = 0;\r\n\t\tthis.M22 = 1;\r\n\t\tthis.M23 = 0;\r\n\t\tthis.M24 = 0;\r\n\t\tthis.M31 = 0;\r\n\t\tthis.M32 = 0;\r\n\t\tthis.M33 = 1;\r\n\t\tthis.M34 = 0;\r\n\t\tthis.M41 = 0;\r\n\t\tthis.M42 = 0;\r\n\t\tthis.M43 = 0;\r\n\t\tthis.M44 = 1;\r\n\t}", "public char[][] toMatrix() {\n\t\tint tmp1 = this.player1_moves;\n\t\tint tmp2 = this.player2_moves;\n\n\t\tchar[][] matrix = new char[3][3];\n\t\tfor (int n = 0; n < 9; n++) {\n\t\t\tint i = n / 3;\n\t\t\tint j = n % 3;\n\t\t\tif ((tmp1 & 1) == 1)\n\t\t\t\tmatrix[i][j] = 'X';\n\t\t\telse if ((tmp2 & 1) == 1)\n\t\t\t\tmatrix[i][j] = 'O';\n\t\t\ttmp1 >>= 1;\n\t\t\ttmp2 >>= 1;\n\t\t}\n\n\t\treturn matrix;\n\t}", "private AffineTransform createTransform() {\n Dimension size = getSize();\n Rectangle2D.Float panelRect = new Rectangle2D.Float(\n BORDER,\n BORDER,\n size.width - BORDER - BORDER,\n size.height - BORDER - BORDER);\n AffineTransform tr = AffineTransform.getTranslateInstance(panelRect.getCenterX(), panelRect.getCenterY());\n double sx = panelRect.getWidth() / mapBounds.getWidth();\n double sy = panelRect.getHeight() / mapBounds.getHeight();\n double scale = min(sx, sy);\n tr.scale(scale, -scale);\n tr.translate(-mapBounds.getCenterX(), -mapBounds.getCenterY());\n return tr;\n }", "DeviceCoordinate transformWorldToScreen(final double x, final double y);", "public AffineTransform getTransform() {\n return new AffineTransform(transform);\n }", "public Matrix getTranspose() {\r\n double[][] jadi = new double[matrix[0].length][matrix.length];\r\n for (int i = 0; i < jadi.length; i++) {\r\n for (int j = 0; j < jadi[0].length; j++) {\r\n jadi[i][j] = matrix[j][i];\r\n }\r\n }\r\n return new Matrix(jadi);\r\n }", "protected void applyMatrices () {\n combinedMatrix.set(projectionMatrix).mul(transformMatrix);\n getShader().setUniformMatrix(\"u_projTrans\", combinedMatrix);\n }", "public Matrix getCombinedTransfo(Document document,double sourcescale,double targetscale){\n\t\tElement root = XMLUtil.getRootElement(document);\n\n\n\n\n\t\tArrayList<Element> transfoElementArrayList = XMLUtil.getElements( root , \"MatrixTransformation\" );\n\n\t\tArrayList<Matrix> listoftransfo=new ArrayList<Matrix>();\n\t\tMatrix ScaleSourcetransfo=Matrix.identity(4, 4).times(1*sourcescale);\n\t\tScaleSourcetransfo.set(3,3,1.0);\n\t\tScaleSourcetransfo.set(2,2,1.0);//do not touch z\n\t\tMatrix Scaletargettransfo=Matrix.identity(4, 4).times(1.0/targetscale);\n\t\tScaletargettransfo.set(3,3,1.0);\n\t\tScaletargettransfo.set(2,2,1.0);//do not touch z\n\t\tlistoftransfo.add(ScaleSourcetransfo);\n\t\tfor ( Element transfoElement : transfoElementArrayList )\n\t\t{\n\t\t\tdouble[][] m=new double[4][4];\n\n\n\t\t\tm[0][0] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m00\" , 0 );\n\t\t\tm[0][1] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m01\" , 0 );\n\t\t\tm[0][2] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m02\" , 0 );\t\n\t\t\tm[0][3] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m03\" , 0 );\n\n\t\t\tm[1][0] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m10\" , 0 );\n\t\t\tm[1][1] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m11\" , 0 );\n\t\t\tm[1][2]= XMLUtil.getAttributeDoubleValue( transfoElement, \"m12\" , 0 );\t\n\t\t\tm[1][3] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m13\" , 0 );\n\n\t\t\tm[2][0]= XMLUtil.getAttributeDoubleValue( transfoElement, \"m20\" , 0 );\n\t\t\tm[2][1] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m21\" , 0 );\n\t\t\tm[2][2] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m22\" , 0 );\t\n\t\t\tm[2][3] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m23\" , 0 );\n\n\t\t\tm[3][0] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m30\" , 0 );\n\t\t\tm[3][1] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m31\" , 0 );\n\t\t\tm[3][2] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m32\" , 0 );\t\n\t\t\tm[3][3] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m33\" , 0 );\n\n\n\t\t\tMatrix T=new Matrix(m);\n\t\t\tlistoftransfo.add(T);\n\n\n\t\t}\n\t\tlistoftransfo.add(Scaletargettransfo);\n\t\tMatrix CombinedTransfo=Matrix.identity(4, 4);\n\t\tfor (int i=0;i<listoftransfo.size();i++){\n\t\t\tCombinedTransfo=listoftransfo.get(i).times(CombinedTransfo);\n\t\t}\n\t\t//CombinedTransfo.times(1.0/CombinedTransfo.get(3, 3));\n\t\treturn CombinedTransfo;\n\t}", "private void mouseEventToWorldSpace(MouseEvent e) {\n\n Point2D mousePoint = new Point2D.Double();\n mousePoint.setLocation(e.getPoint());\n\n Point2D newPoint = new Point2D.Double();\n this.viewModel.getViewToWorld().transform(mousePoint, newPoint);\n\n int xDiff = (int) ( newPoint.getX() - mousePoint.getX() );\n int yDiff = (int) ( newPoint.getY() - mousePoint.getY() );\n\n e.translatePoint(xDiff, yDiff);\n }", "public int[][] getMazeMatrix(){ return maze;}", "public void cameraTransform(Vector3f targ, Vector3f up) {\r\n\t\t// First normalize the target\r\n\t\tVector3f n = targ;\r\n\t\tn.normalize();\r\n\t\t// Then normalize the up vector\r\n\t\tVector3f u = up;\r\n\t\tu.normalize();\r\n\t\t// Then cross the two together to get the right vector\r\n\t\tu = u.cross(n);\r\n\t\tVector3f v = n.cross(u);\r\n\r\n\t\t// Finally build a matrix from the result\r\n\t\tm[0][0] = u.x; m[0][1] = u.y; m[0][2] = u.z; m[0][3] = 0.0f;\r\n\t\tm[1][0] = v.x; m[1][1] = v.y; m[1][2] = v.z; m[1][3] = 0.0f;\r\n\t\tm[2][0] = n.x; m[2][1] = n.y; m[2][2] = n.z; m[2][3] = 0.0f;\r\n\t\tm[3][0] = 0.0f; m[3][1] = 0.0f; m[3][2] = 0.0f; m[3][3] = 1.0f;\r\n\r\n\t}", "public void setTransform(float a11, float a12, float a21, float a22, float x, float y);", "@java.lang.Override\n public godot.wire.Wire.Transform2D getTransform2DValue() {\n if (typeCase_ == 9) {\n return (godot.wire.Wire.Transform2D) type_;\n }\n return godot.wire.Wire.Transform2D.getDefaultInstance();\n }", "private void setMToIdentity()\n\t\t{\n\t\t\tfor(rowNumber = 0; rowNumber < 4; rowNumber++)\n\t\t\t\tfor(int column = 0; column < 4; column++)\n\t\t\t\t{\n\t\t\t\t\tif(rowNumber == column)\n\t\t\t\t\t\tmElements[rowNumber*4 + column] = 1;\n\t\t\t\t\telse\n\t\t\t\t\t\tmElements[rowNumber*4 + column] = 0;\n\t\t\t\t}\n\t\t\ttransform = new Transform3D(mElements);\n\t\t\trowNumber = 0;\n\t\t}", "public Node getNormalizedNode() {\n\t\treturn transformedNode;\n\t}", "Matrix transpose(){\n int newMatrixSize = this.getSize();\n Matrix newM = new Matrix(newMatrixSize);\n for(int i = 1; i <= newMatrixSize; i++){\n List itRow = rows[i - 1];\n // if(!itRow[i].isEmpty()){\n itRow.moveFront();\n // itRow[i].moveFront();\n while(itRow.index() != -1){\n Entry c = (Entry)itRow.get();\n newM.changeEntry(c.column, i, c.value);\n itRow.moveNext();\n }\n }\n return newM;\n }", "public RMTransform getTransform()\n{\n return new RMTransform(getX(), getY(), getRoll(), getWidth()/2, getHeight()/2,\n getScaleX(), getScaleY(), getSkewX(), getSkewY());\n}", "public void translate( Vector3f t )\n\t{\n\t\tMatrix4f opMat = new Matrix4f();\n\t\topMat.set( t );\n\t\tmat.mul( opMat );\n\t}", "public T caseM2MTransformation(M2MTransformation object) {\n\t\treturn null;\n\t}", "void copyRotation(DMatrix3 R);", "protected synchronized void resetModelViewMatrix()\n {\n Matrix4d transform = new Matrix4d();\n // translate so that the viewer is at the origin\n Matrix4d translation = new Matrix4d();\n translation.setTranslation(myPosition.getLocation().multiply(-1.));\n // rotate to put the viewer pointing in the -z direction with the up\n // vector along the +y axis.\n Quaternion quat = Quaternion.lookAt(myPosition.getDir().multiply(-1.), myPosition.getUp());\n Matrix4d rotation = new Matrix4d();\n rotation.setRotationQuaternion(quat);\n // set the transform.\n transform.multLocal(rotation);\n transform.multLocal(translation);\n myModelViewMatrix = transform.toFloatArray();\n setInverseModelViewMatrix(transform.invert());\n clearModelToWindowTransform();\n }", "public void rotate(double deg) {\n deg = deg % 360;\n// System.out.println(\"Stopni:\" + deg);\n double e = 0;\n double f = 0;\n\n// for(int i = 0; i < pixels.length; i++) {\n// for(int j = 0; j < pixels[i].length; j++) {\n// e += pixels[i][j].getX();\n// f += pixels[i][j].getY();\n// }\n// }\n //e = e / (pixels.length * 2);\n //f = f / (pixels[0].length * 2);\n e = pixels.length / 2;\n f = pixels[0].length / 2;\n System.out.println(e);\n System.out.println(f);\n\n// System.out.println(e + \":\" + f);\n Matrix affineTransform;\n Matrix translateMinus = Matrix.translateRotate(-e, -f);\n Matrix translatePlus = Matrix.translateRotate(e, f);\n Matrix movedTransform = Matrix.multiply(translateMinus, Matrix.rotate(deg));\n //movedTransform.display();\n affineTransform = Matrix.multiply(movedTransform, translatePlus);\n //affineTransform.display();\n\n for(int i = 0; i < pixels.length; i++) {\n for(int j = 0; j < pixels[i].length; j++) {\n double[][] posMatrix1 = {{pixels[i][j].getX()}, {pixels[i][j].getY()}, {1}};\n Matrix m1 = new Matrix(posMatrix1);\n Matrix result1;\n result1 = Matrix.multiply(Matrix.transpose(affineTransform.v), m1);\n\n pixels[i][j].setX(Math.round(result1.v[0][0]));\n pixels[i][j].setY(Math.round(result1.v[1][0]));\n }\n }\n\n\n }", "public float[] getViewMatrix() {\n\t\treturn viewMatrix;\n\t}", "public PVector getTransformedPosition(){\n\t\treturn gui.getTransform().transform(position);\n\t}", "public final native Mat4 translate(double x, double y, double z) /*-{\n return $wnd.mat4.translate(this, [x, y, z]);\n }-*/;", "public Mat4x4 getMatView() {\n Mat4x4 matCameraRotX = MatrixMath.matrixMakeRotationX(cameraRot.getX());\n Mat4x4 matCameraRotY = MatrixMath.matrixMakeRotationY(cameraRot.getY());\n Mat4x4 matCameraRotZ = MatrixMath.matrixMakeRotationZ(cameraRot.getZ());\n Mat4x4 matCameraRotXY = MatrixMath.matrixMultiplyMatrix(matCameraRotX, matCameraRotY);\n Mat4x4 matCameraRot = MatrixMath.matrixMultiplyMatrix(matCameraRotXY, matCameraRotZ);\n matCamera = calculateMatCamera(up, target, matCameraRot);\n matView = MatrixMath.matrixQuickInverse(matCamera);\n return matView;\n }" ]
[ "0.70813686", "0.68160826", "0.59842485", "0.59325206", "0.58258355", "0.57817703", "0.56381595", "0.55648273", "0.5533293", "0.5408658", "0.5408172", "0.5375336", "0.5353159", "0.5308319", "0.5307344", "0.5272922", "0.5266931", "0.52351636", "0.5224849", "0.5214476", "0.5182558", "0.5124402", "0.51150477", "0.5076271", "0.50674045", "0.49924415", "0.4971933", "0.4968259", "0.4917966", "0.48999014", "0.4890635", "0.48710483", "0.4863441", "0.48542264", "0.48495367", "0.48436165", "0.48345748", "0.48325348", "0.4824738", "0.48173323", "0.4801408", "0.47598627", "0.47588593", "0.4755788", "0.47187462", "0.47098014", "0.4701142", "0.46950877", "0.46869832", "0.46834257", "0.46711522", "0.46640468", "0.4646373", "0.4631417", "0.46265396", "0.4620481", "0.46101242", "0.45985353", "0.45972466", "0.4596193", "0.45802003", "0.45732915", "0.4568024", "0.45465964", "0.45396417", "0.45242345", "0.45204824", "0.45204467", "0.4516462", "0.4514516", "0.45066315", "0.45001712", "0.4498947", "0.44956005", "0.44873166", "0.4479211", "0.44726866", "0.44686678", "0.44659394", "0.44636673", "0.4456977", "0.44538707", "0.4453021", "0.4448098", "0.4448029", "0.44377068", "0.44312835", "0.44129115", "0.44115704", "0.4379344", "0.43792263", "0.43784285", "0.43764278", "0.43753356", "0.43735534", "0.43672606", "0.43646368", "0.43628687", "0.43626016", "0.4358778" ]
0.66887516
2
////////////////////////////////////////////////////////////////////// Description: Returns the transformation matrix to go from the object space corresponding to the given node in the path to image space. Use: public
public SbMatrix getObjectToImage( SoNode node) // //////////////////////////////////////////////////////////////////////// { getMatrix(node); return matrixAction.getTextureMatrix(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void\ngetMatrix( SoNode node)\n//\n////////////////////////////////////////////////////////////////////////\n{\n SoPath xfPath; // ptr\n\n // Construct a path from the root down to this node. Use the given\n // path if it's the same\n if (node == null || node == SoFullPath.cast(path).getTail())\n xfPath = path;\n\n else {\n int index = getNodeIndex(node);\n xfPath = path.copy(0, index + 1);\n xfPath.ref();\n }\n\n // Create an action instance if necessary, then apply it to the path\n if (matrixAction == null)\n matrixAction = new SoGetMatrixAction(vpRegion);\n matrixAction.apply(xfPath);\n\n if (xfPath != path)\n xfPath.unref();\n}", "public SbMatrix\ngetImageToObject(SoNode node)\n//\n////////////////////////////////////////////////////////////////////////\n{\n getMatrix(node);\n return matrixAction.getTextureInverse();\n}", "public SbMatrix\ngetObjectToWorld(final SoNode node)\n//\n////////////////////////////////////////////////////////////////////////\n{\n getMatrix(node);\n return matrixAction.getMatrix();\n}", "public Matrix getTransform()\n {\n return transform;\n }", "public SbMatrix\ngetWorldToObject( SoNode node) \n//\n////////////////////////////////////////////////////////////////////////\n{\n getMatrix(node);\n return matrixAction.getInverse();\n}", "public Matrix4 getTransformMatrix() {\n return transformMatrix;\n }", "protected Matrix4 computeTransform() {\n return super.computeTransform();\n }", "public double[][] convert_img_mat()\n\t{\n\t\tif(orderflag)\n\t\t{\n\t\t\tputpixel_1();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//rotate the image and get the pixels as usual form\t\n \t\tputpixel_2();\n\t\t}\n\treturn matrix;\n\t}", "@Override\n\tpublic Mat GetTranslateMatrix()\n\t{\n\t\treturn mT;\n\t}", "public AffineTransform getTransform()\n/* */ {\n/* 194 */ return this.transform;\n/* */ }", "public AffineTransform getTransform()\r\n\t{\r\n\t\treturn _g2.getTransform();\r\n\t}", "public GeneralPath transform(Matrix matrix)\n {\n float x1 = getLowerLeftX();\n float y1 = getLowerLeftY();\n float x2 = getUpperRightX();\n float y2 = getUpperRightY();\n\n Point2D.Float p0 = matrix.transformPoint(x1, y1);\n Point2D.Float p1 = matrix.transformPoint(x2, y1);\n Point2D.Float p2 = matrix.transformPoint(x2, y2);\n Point2D.Float p3 = matrix.transformPoint(x1, y2);\n\n GeneralPath path = new GeneralPath();\n path.moveTo(p0.getX(), p0.getY());\n path.lineTo(p1.getX(), p1.getY());\n path.lineTo(p2.getX(), p2.getY());\n path.lineTo(p3.getX(), p3.getY());\n path.closePath();\n return path;\n }", "protected Matrix4 computeTransform() {\n return internalGroup.computeTransform();\n }", "protected Matrix4f createModelMatrix(Entity entity) {\n\n //Assemble the model matrix order = SRT\n Matrix4f matrix = new Matrix4f();\n matrix.mul(entity.getTranslationMatrix());\n matrix.mul(entity.getRotation());\n matrix.mul(entity.getScaleMatrix());\n \n return matrix;\n }", "public Matrix4f getWorldMatrix() {\n\n\t\t// First identity\n\t\tmTranformation.identity();\n\n\t\t// Translate\n\t\tmTranformation.translate(position);\n\n\t\t// Rotate object at the center of the texture\n\t\tfloat x = 0.5f * mWidth;\n\t\tfloat y = 0.5f * mHeight;\n\n\t\t// Do rotating\n\t\tmTranformation.translate(new Vector3f(x, y, 0));\n\t\tmTranformation.rotateZ((float) Math.toRadians(rotation.z));\n\t\tmTranformation.translate(new Vector3f(-x, -y, 0));\n\n\t\t// mTranformation.scale(scale, scale, 1);\n\t\tmTranformation.scaleAround(scale, x, y, 0);\n\n\t\treturn mTranformation;\n\t}", "public abstract Matrix4f getCameraMatrix();", "public Transform getTransform () {\n\t\torg.jbox2d.common.Transform trans = body.getTransform();\n\t\ttransform.vals[Transform.POS_X] = trans.p.x;\n\t\ttransform.vals[Transform.POS_Y] = trans.p.y;\n\t\ttransform.vals[Transform.COS] = trans.q.c;\n\t\ttransform.vals[Transform.SIN] = trans.q.s;\n\t\treturn transform;\n\t}", "public Matrix4f getTranslationMat() {\n\t\treturn m_xforms[NvCameraXformType.MAIN].m_translateMat;\n\t}", "private void constructTransitionTransposeMatrix() {\r\n\t\tfor(int i=0; i<getNodeCnt(); i++) {\r\n\t\t\tArrayList<NodeTransition> transitionList = new ArrayList<NodeTransition>();\r\n\t\t\tmTransitionTranspose.add( transitionList );\r\n\t\t}\r\n\t\tfor(Node node: mNodes) {\r\n\t\t\tint fromId = node.getId();\r\n\t\t\tint outDegree = node.getOutDegree();\r\n\t\t\t\r\n\t\t\tSet<Integer> outEdges = getOutEdges(fromId);\r\n\t\t\tfor(Integer edgeId: outEdges) {\r\n\t\t\t\tint toId = getEdge(edgeId).getToId();\r\n\t\t\t\tdouble pTransition = (double) getEdge(edgeId).getWeight() / (double) outDegree;\r\n\t\t\t\t\r\n\t\t\t\tArrayList<NodeTransition> transitionList = mTransitionTranspose.get(toId);\r\n\t\t\t\ttransitionList.add( new NodeTransition(fromId, pTransition) );\r\n\t\t\t}\r\n\t\t}\r\n\t}", "godot.wire.Wire.Transform2D getTransform2DValue();", "public TransformationMatrix() {\n\t\ta11 = 1; a12 = 0; a13 = 0; a14 = 0;\n\t\ta21 = 0; a22 = 1; a23 = 0; a24 = 0;\n\t\ta31 = 0; a32 = 0; a33 = 1; a34 = 0;\n\t}", "public org.apache.spark.mllib.linalg.Matrix toLocalMatrix () { throw new RuntimeException(); }", "public Transform getTransformation() {\n Transform t = Transform.newTranslation(position);\n t = t.compose(Transform.newScale(scale));\n t = t.compose(Transform.newXRotation(rotation.x));\n t = t.compose(Transform.newYRotation(rotation.y));\n t = t.compose(Transform.newZRotation(rotation.z));\n return t;\n }", "public SbVec4f\ngetObjectTextureCoords(final SoNode node)\n//\n////////////////////////////////////////////////////////////////////////\n{\n return multVecMatrix4(getImageToObject(node), imageTexCoords);\n}", "abstract public Matrix4fc getViewMatrix();", "float[] getViewMatrix();", "float[] getProjectionMatrix();", "public AffineTransform getTransform() {\n return new AffineTransform(transform);\n }", "public Matrix getCombinedTransfo(Document document,double sourcescale,double targetscale){\n\t\tElement root = XMLUtil.getRootElement(document);\n\n\n\n\n\t\tArrayList<Element> transfoElementArrayList = XMLUtil.getElements( root , \"MatrixTransformation\" );\n\n\t\tArrayList<Matrix> listoftransfo=new ArrayList<Matrix>();\n\t\tMatrix ScaleSourcetransfo=Matrix.identity(4, 4).times(1*sourcescale);\n\t\tScaleSourcetransfo.set(3,3,1.0);\n\t\tScaleSourcetransfo.set(2,2,1.0);//do not touch z\n\t\tMatrix Scaletargettransfo=Matrix.identity(4, 4).times(1.0/targetscale);\n\t\tScaletargettransfo.set(3,3,1.0);\n\t\tScaletargettransfo.set(2,2,1.0);//do not touch z\n\t\tlistoftransfo.add(ScaleSourcetransfo);\n\t\tfor ( Element transfoElement : transfoElementArrayList )\n\t\t{\n\t\t\tdouble[][] m=new double[4][4];\n\n\n\t\t\tm[0][0] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m00\" , 0 );\n\t\t\tm[0][1] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m01\" , 0 );\n\t\t\tm[0][2] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m02\" , 0 );\t\n\t\t\tm[0][3] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m03\" , 0 );\n\n\t\t\tm[1][0] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m10\" , 0 );\n\t\t\tm[1][1] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m11\" , 0 );\n\t\t\tm[1][2]= XMLUtil.getAttributeDoubleValue( transfoElement, \"m12\" , 0 );\t\n\t\t\tm[1][3] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m13\" , 0 );\n\n\t\t\tm[2][0]= XMLUtil.getAttributeDoubleValue( transfoElement, \"m20\" , 0 );\n\t\t\tm[2][1] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m21\" , 0 );\n\t\t\tm[2][2] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m22\" , 0 );\t\n\t\t\tm[2][3] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m23\" , 0 );\n\n\t\t\tm[3][0] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m30\" , 0 );\n\t\t\tm[3][1] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m31\" , 0 );\n\t\t\tm[3][2] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m32\" , 0 );\t\n\t\t\tm[3][3] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m33\" , 0 );\n\n\n\t\t\tMatrix T=new Matrix(m);\n\t\t\tlistoftransfo.add(T);\n\n\n\t\t}\n\t\tlistoftransfo.add(Scaletargettransfo);\n\t\tMatrix CombinedTransfo=Matrix.identity(4, 4);\n\t\tfor (int i=0;i<listoftransfo.size();i++){\n\t\t\tCombinedTransfo=listoftransfo.get(i).times(CombinedTransfo);\n\t\t}\n\t\t//CombinedTransfo.times(1.0/CombinedTransfo.get(3, 3));\n\t\treturn CombinedTransfo;\n\t}", "public PMVMatrix(boolean useBackingArray) {\n projectFloat = new ProjectFloat();\n \n // I Identity\n // T Texture\n // P Projection\n // Mv ModelView\n // Mvi Modelview-Inverse\n // Mvit Modelview-Inverse-Transpose\n if(useBackingArray) {\n matrixBufferArray = new float[6*16];\n matrixBuffer = null;\n // matrixBuffer = FloatBuffer.wrap(new float[12*16]);\n } else {\n matrixBufferArray = null;\n matrixBuffer = Buffers.newDirectByteBuffer(6*16 * Buffers.SIZEOF_FLOAT);\n matrixBuffer.mark();\n }\n \n matrixIdent = slice2Float(matrixBuffer, matrixBufferArray, 0*16, 1*16); // I\n matrixTex = slice2Float(matrixBuffer, matrixBufferArray, 1*16, 1*16); // T\n matrixPMvMvit = slice2Float(matrixBuffer, matrixBufferArray, 2*16, 4*16); // P + Mv + Mvi + Mvit \n matrixPMvMvi = slice2Float(matrixBuffer, matrixBufferArray, 2*16, 3*16); // P + Mv + Mvi\n matrixPMv = slice2Float(matrixBuffer, matrixBufferArray, 2*16, 2*16); // P + Mv\n matrixP = slice2Float(matrixBuffer, matrixBufferArray, 2*16, 1*16); // P\n matrixMv = slice2Float(matrixBuffer, matrixBufferArray, 3*16, 1*16); // Mv\n matrixMvi = slice2Float(matrixBuffer, matrixBufferArray, 4*16, 1*16); // Mvi\n matrixMvit = slice2Float(matrixBuffer, matrixBufferArray, 5*16, 1*16); // Mvit\n \n if(null != matrixBuffer) {\n matrixBuffer.reset();\n } \n ProjectFloat.gluMakeIdentityf(matrixIdent);\n \n vec3f = new float[3];\n matrixMult = new float[16];\n matrixTrans = new float[16];\n matrixRot = new float[16];\n matrixScale = new float[16];\n matrixOrtho = new float[16];\n matrixFrustum = new float[16];\n ProjectFloat.gluMakeIdentityf(matrixTrans, 0);\n ProjectFloat.gluMakeIdentityf(matrixRot, 0);\n ProjectFloat.gluMakeIdentityf(matrixScale, 0);\n ProjectFloat.gluMakeIdentityf(matrixOrtho, 0);\n ProjectFloat.gluMakeZero(matrixFrustum, 0);\n \n matrixPStack = new ArrayList<float[]>();\n matrixMvStack= new ArrayList<float[]>();\n \n // default values and mode\n glMatrixMode(GL_PROJECTION);\n glLoadIdentity();\n glMatrixMode(GL_MODELVIEW);\n glLoadIdentity();\n glMatrixMode(GL.GL_TEXTURE);\n glLoadIdentity();\n setDirty();\n update();\n }", "void calculateRotationMatrix() {\n R[0][0] = (float) (Math.cos(angle[0]) * Math.cos(angle[1]));\n R[1][0] = (float) (Math.sin(angle[0]) * Math.cos(angle[1]));\n R[0][1] = (float) (Math.cos(angle[0]) * Math.sin(angle[1]) * Math.sin(angle[2]) - Math.sin(angle[0]) * Math.cos(angle[2]));\n R[1][1] = (float) (Math.sin(angle[0]) * Math.sin(angle[1]) * Math.sin(angle[2]) + Math.cos(angle[0]) * Math.cos(angle[2]));\n R[0][2] = (float) (Math.cos(angle[0]) * Math.sin(angle[1]) * Math.cos(angle[2]) + Math.sin(angle[0]) * Math.sin(angle[2]));\n R[1][2] = (float) (Math.sin(angle[0]) * Math.sin(angle[1]) * Math.cos(angle[2]) - Math.cos(angle[0]) * Math.sin(angle[2]));\n R[2][0] = (float) - Math.sin(angle[1]);\n R[2][1] = (float) (Math.cos(angle[1]) * Math.sin(angle[2]));\n R[2][2] = (float) (Math.cos(angle[1]) * Math.cos(angle[2]));\n }", "public void rotate(double deg) {\n deg = deg % 360;\n// System.out.println(\"Stopni:\" + deg);\n double e = 0;\n double f = 0;\n\n// for(int i = 0; i < pixels.length; i++) {\n// for(int j = 0; j < pixels[i].length; j++) {\n// e += pixels[i][j].getX();\n// f += pixels[i][j].getY();\n// }\n// }\n //e = e / (pixels.length * 2);\n //f = f / (pixels[0].length * 2);\n e = pixels.length / 2;\n f = pixels[0].length / 2;\n System.out.println(e);\n System.out.println(f);\n\n// System.out.println(e + \":\" + f);\n Matrix affineTransform;\n Matrix translateMinus = Matrix.translateRotate(-e, -f);\n Matrix translatePlus = Matrix.translateRotate(e, f);\n Matrix movedTransform = Matrix.multiply(translateMinus, Matrix.rotate(deg));\n //movedTransform.display();\n affineTransform = Matrix.multiply(movedTransform, translatePlus);\n //affineTransform.display();\n\n for(int i = 0; i < pixels.length; i++) {\n for(int j = 0; j < pixels[i].length; j++) {\n double[][] posMatrix1 = {{pixels[i][j].getX()}, {pixels[i][j].getY()}, {1}};\n Matrix m1 = new Matrix(posMatrix1);\n Matrix result1;\n result1 = Matrix.multiply(Matrix.transpose(affineTransform.v), m1);\n\n pixels[i][j].setX(Math.round(result1.v[0][0]));\n pixels[i][j].setY(Math.round(result1.v[1][0]));\n }\n }\n\n\n }", "public void translateTransform(Vector3f trans) {\r\n\t\tm[0][0] = 1.0f; m[0][1] = 0.0f; m[0][2] = 0.0f; m[0][3] = trans.x;\r\n\t\tm[1][0] = 0.0f; m[1][1] = 1.0f; m[1][2] = 0.0f; m[1][3] = trans.y;\r\n\t\tm[2][0] = 0.0f; m[2][1] = 0.0f; m[2][2] = 1.0f; m[2][3] = trans.z;\r\n\t\tm[3][0] = 0.0f; m[3][1] = 0.0f; m[3][2] = 0.0f; m[3][3] = 1.0f;\r\n\r\n\t}", "public AffineTransform3D() {\r\n\t\tthis.M11 = 1;\r\n\t\tthis.M12 = 0;\r\n\t\tthis.M13 = 0;\r\n\t\tthis.M14 = 0;\r\n\t\tthis.M21 = 0;\r\n\t\tthis.M22 = 1;\r\n\t\tthis.M23 = 0;\r\n\t\tthis.M24 = 0;\r\n\t\tthis.M31 = 0;\r\n\t\tthis.M32 = 0;\r\n\t\tthis.M33 = 1;\r\n\t\tthis.M34 = 0;\r\n\t\tthis.M41 = 0;\r\n\t\tthis.M42 = 0;\r\n\t\tthis.M43 = 0;\r\n\t\tthis.M44 = 1;\r\n\t}", "void applyRotationMatrix() {\n for (int i = 0; i < coors.length; i++) {\n for (int j = 0; j < coors[i].length; j++) {\n newCoors[i][j] = coors[i][0] * R[j][0] + coors[i][1] * R[j][1] + coors[i][2] * R[j][2];\n }\n // add perspective\n float scale = map(Math.abs(newCoors[i][2]), 0, (float) (halfSize * Math.sqrt(3)), 1, 1.5f);\n if (newCoors[i][2] < 0) {\n scale = 2f - scale;\n }\n for (int j = 0; j < 2; j++) {\n newCoors[i][j] *= scale;\n }\n }\n // to R2\n // just dont use Z\n setPathAndAlpha();\n }", "public Transform getTransform() {return transform;}", "@Override\r\n protected Matrix4f genViewMatrix() {\r\n\r\n // refreshes the position\r\n position = calcPosition();\r\n\r\n // calculate the camera's coordinate system\r\n Vector3f[] coordSys = genCoordSystem(position.subtract(center));\r\n Vector3f right, up, forward;\r\n forward = coordSys[0];\r\n right = coordSys[1];\r\n up = coordSys[2];\r\n\r\n // we move the world, not the camera\r\n Vector3f position = this.position.negate();\r\n\r\n return genViewMatrix(forward, right, up, position);\r\n }", "public static TransformMatrix translationMatrix(float x, float y) {\n\t\treturn new TransformMatrix(1,1,x,y);\n\t}", "public void transform(Matrix m)\n { \n\t \tfor(int i= 0 ; i < this.vertex.length ; i++)\n\t \t{\n\t \t\tthis.vertex[i] = this.vertex[i].transform(m);\n\t \t}\n\t \n }", "public AffineTransform getOldAffineTransform ( )\n {\n return oldAffineTransformation;\n }", "DMatrix3C getRotation();", "Matrix4f getModelMatrix();", "public static CvMat getPerspectiveTransform(double[] src, double[] dst, CvMat map_matrix) {\n // creating and releasing matrices via NIO here in this function...\n // this can easily become a bottleneck\n CvMat A = CvMat.create(8, 8);\n CvMat b = CvMat.create(8, 1);\n CvMat x = CvMat.create(8, 1);\n\n for(int i = 0; i < 4; ++i ) {\n A.put(i*8+0, src[i*2]); A.put((i+4)*8+3, src[i*2]);\n A.put(i*8+1, src[i*2+1]); A.put((i+4)*8+4, src[i*2+1]);\n A.put(i*8+2, 1); A.put((i+4)*8+5, 1);\n A.put(i*8+3, 0); A.put(i*8+4, 0); A.put(i*8+5, 0);\n A.put((i+4)*8+0, 0); A.put((i+4)*8+1, 0); A.put((i+4)*8+2, 0);\n\n A.put(i*8+6, -src[i*2] *dst[i*2]);\n A.put(i*8+7, -src[i*2+1]*dst[i*2]);\n A.put((i+4)*8+6, -src[i*2] *dst[i*2+1]);\n A.put((i+4)*8+7, -src[i*2+1]*dst[i*2+1]);\n\n b.put(i, dst[i*2]);\n b.put(i+4, dst[i*2+1]);\n }\n cxcore.cvSolve(A, b, x, cxcore.CV_LU);\n map_matrix.put(x);\n map_matrix.put(8, 1);\n\n return map_matrix;\n }", "public mat4 getMatrix() {\n return worldMatrix;\n }", "public int[][] getTransitionMatrix() {\n\t\treturn null;\n\t}", "@Override\n public float[] getRotationMatrix(){\n float[] baseCorrection = Maths.buildRotationMatrix(new float[]{0, 1, 0, 0});\n\n float[] rotationX = {(float) Math.toDegrees(theta), 1, 0, 0};\n float[] rotationY = {(float) -Math.toDegrees(phi), 0, 1, 0};\n\n float[] rotationMatrix = new float[16];\n float[] coreMotionMatrix = Maths.buildRotationMatrix(rotationY, rotationX);\n Matrix.multiplyMM(rotationMatrix, 0, baseCorrection, 0, coreMotionMatrix, 0);\n\n return rotationMatrix;\n }", "float[] getMVPMatrix();", "public RMTransform getTransform()\n{\n return new RMTransform(getX(), getY(), getRoll(), getWidth()/2, getHeight()/2,\n getScaleX(), getScaleY(), getSkewX(), getSkewY());\n}", "float[] getModelMatrix();", "private void updateTransform() {\n Matrix matrix = new Matrix();\n float centerX = dataBinding.viewFinder.getWidth() / 2f;\n float centerY = dataBinding.viewFinder.getHeight() / 2f;\n int rotation = dataBinding.viewFinder.getDisplay().getRotation();\n int rotationDegrees = 0;\n switch (rotation) {\n case Surface.ROTATION_0:\n rotationDegrees = 0;\n break;\n case Surface.ROTATION_90:\n rotationDegrees = 90;\n break;\n case Surface.ROTATION_180:\n rotationDegrees = 180;\n break;\n case Surface.ROTATION_270:\n rotationDegrees = 270;\n break;\n default:\n }\n matrix.postRotate(-rotationDegrees, centerX, centerY);\n }", "@Override\n\tpublic Matrix getCurrentImageViewMatrix() {\n\t\treturn mContext.getMainImage().getDisplayMatrix();\n\t}", "private AffineTransform createTransform() {\n Dimension size = getSize();\n Rectangle2D.Float panelRect = new Rectangle2D.Float(\n BORDER,\n BORDER,\n size.width - BORDER - BORDER,\n size.height - BORDER - BORDER);\n AffineTransform tr = AffineTransform.getTranslateInstance(panelRect.getCenterX(), panelRect.getCenterY());\n double sx = panelRect.getWidth() / mapBounds.getWidth();\n double sy = panelRect.getHeight() / mapBounds.getHeight();\n double scale = min(sx, sy);\n tr.scale(scale, -scale);\n tr.translate(-mapBounds.getCenterX(), -mapBounds.getCenterY());\n return tr;\n }", "protected void initTransforms() {\n for (int i = 0; i < cornerCount; i++) {\n int index = cornerOffset + i;\n identityVertexMatrix[index] = new idx3d_Matrix();\n }\n\n // 0:urf\n identityVertexMatrix[cornerOffset + 0].rotate(0, -HALF_PI, 0);\n // 1:dfr\n identityVertexMatrix[cornerOffset + 1].rotate(0, 0, PI);\n // 2:ubr\n identityVertexMatrix[cornerOffset + 2].rotate(0, PI, 0);\n // 3:drb\n identityVertexMatrix[cornerOffset + 3].rotate(0, 0, PI);\n identityVertexMatrix[cornerOffset + 3].rotate(0, -HALF_PI, 0);\n // 4:ulb\n identityVertexMatrix[cornerOffset + 4].rotate(0, HALF_PI, 0);\n // 5:dbl\n identityVertexMatrix[cornerOffset + 5].rotate(PI, 0, 0);\n // 6:ufl\n //--no transformation---\n // 7:dlf\n identityVertexMatrix[cornerOffset + 7].rotate(0, HALF_PI, 0);\n identityVertexMatrix[cornerOffset + 7].rotate(PI, 0, 0);\n //\n // We can clone the normalmatrix here form the vertex matrix, because\n // the vertex matrix consists of rotations only.\n for (int i = 0; i < cornerCount; i++) {\n identityNormalMatrix[i] = identityVertexMatrix[i].getClone();\n }\n\n /**\n * Edges\n */\n // Move all edge parts to front up (fu) and then rotate them in place\n for (int i = 0; i < edgeCount; i++) {\n int index = edgeOffset + i;\n idx3d_Matrix vt = new idx3d_Matrix();\n idx3d_Matrix nt = new idx3d_Matrix();\n identityVertexMatrix[index] = vt;\n identityNormalMatrix[index] = nt;\n // The vertex matrix is the same as the normal matrix, but with\n // an additional shift, which is made before the rotation.\n if (i >= 12) {\n switch ((i - 12) % 24) {\n case 12:\n case 13:\n case 2:\n case 3:\n case 4:\n case 17:\n case 6:\n case 19:\n case 20:\n case 21:\n case 10:\n case 11:\n vt.shift(PART_LENGTH*((i+12)/24), 0f, 0f);\n break;\n default:\n vt.shift(-PART_LENGTH*((i+12)/24), 0f, 0f);\n break;\n }\n }\n // Now we do the rotation with the normal matrix only\n switch (i % 12) {\n case 0: // ur\n nt.rotate(0, HALF_PI, 0f);\n nt.rotate(0, 0, HALF_PI);\n break;\n case 1: // rf\n nt.rotate(0, -HALF_PI, 0);\n nt.rotate(HALF_PI, 0, 0);\n break;\n case 2: // dr\n nt.rotate(0, -HALF_PI, HALF_PI);\n break;\n case 3: // bu\n nt.rotate(0, PI, 0);\n break;\n case 4: // rb\n nt.rotate(0, 0, HALF_PI);\n nt.rotate(0, -HALF_PI, 0);\n break;\n case 5: // bd\n nt.rotate(PI, 0, 0);\n break;\n case 6: // ul\n nt.rotate(-HALF_PI, -HALF_PI, 0);\n break;\n case 7: // lb\n nt.rotate(0, 0, -HALF_PI);\n nt.rotate(0, HALF_PI, 0);\n break;\n case 8: // dl\n nt.rotate(HALF_PI, HALF_PI, 0);\n break;\n case 9: // fu\n //--no transformation--\n break;\n case 10: // lf\n nt.rotate(0, 0, HALF_PI);\n nt.rotate(0, HALF_PI, 0);\n break;\n case 11: // fd\n nt.rotate(0, 0, PI);\n break;\n }\n // Finally, we concatenate the rotation to the vertex matrix\n vt.transform(nt);\n }\n /* Sides\n */\n // Move all side parts to the front side and rotate them into place\n for (int i = 0; i < sideCount; i++) {\n int index = sideOffset + i;\n idx3d_Matrix vt = new idx3d_Matrix();\n idx3d_Matrix nt = new idx3d_Matrix();\n identityVertexMatrix[index] = vt;\n identityNormalMatrix[index] = nt;\n // The vertex matrix is the same as the normal matrix, but with\n // an additional shift, which is made before the rotation.\n switch (i / 6) {\n // central part\n case 0 :\n // vt.shift(0, 0, 0);\n break;\n // inner ring\n case 1:\n vt.shift(-PART_LENGTH, -PART_LENGTH, 0);\n break;\n case 2:\n vt.shift(-PART_LENGTH, PART_LENGTH, 0);\n break;\n case 3:\n vt.shift(PART_LENGTH, PART_LENGTH, 0);\n break;\n case 4:\n vt.shift(PART_LENGTH, -PART_LENGTH, 0);\n break;\n case 5:\n vt.shift(0, -PART_LENGTH, 0);\n break;\n case 6:\n vt.shift(-PART_LENGTH, 0, 0);\n break;\n case 7:\n vt.shift(0, PART_LENGTH, 0);\n break;\n case 8:\n vt.shift(PART_LENGTH, 0, 0);\n break;\n // outer ring corners\n /*\n * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+\n * | .0 | .2 | .3 | .1 |\n * + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ +\n * | |75 |129|81 |105|57 | | |62 |140|92 |116|68 | | |66 |144|96 |120|72 | | |59 |137|89 |113|65 | |\n * + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ +\n * | |123|27 |33 | 9 |135| | |110|14 |44 |20 |146| | |114|18 |48 |24 |126| | |107|11 |41 |17 |143| |\n * + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ +\n * | .3|99 |51 | 3 |39 |87 |.1 | .1|86 |38 | 2 |50 |98 |.3 | .2|90 |42 | 0 |30 |78 |.0 | .0|83 |35 | 5 |47 |95 |.2 |\n * + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ +\n * | |147|21 |45 |15 |111| | |134| 8 |32 |26 |122| | |138|12 |36 | 6 |102| | |131|29 |53 |23 |119| |\n * + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ +\n * | |69 |117|93 |141|63 | | |56 |104|80 |128|74 | | |60 |108|84 |132|54 | | |77 |125|101|149|71 | |\n * + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ +\n * | .2 | .0 | .1 | .3 |\n * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+\n */\n case 9:\n vt.shift(-2f*PART_LENGTH, -2f*PART_LENGTH, 0);\n break;\n case 10:\n vt.shift(-2f*PART_LENGTH, 2f*PART_LENGTH, 0);\n break;\n case 11:\n vt.shift(2f*PART_LENGTH, 2f*PART_LENGTH, 0);\n break;\n case 12:\n vt.shift(2f*PART_LENGTH, -2f*PART_LENGTH, 0);\n break;\n // outer ring central edges\n case 13:\n vt.shift(0, -2f*PART_LENGTH, 0);\n break;\n case 14:\n vt.shift(-2f*PART_LENGTH, 0, 0);\n break;\n case 15:\n vt.shift(0, 2f*PART_LENGTH, 0);\n break;\n case 16:\n vt.shift(2f*PART_LENGTH, 0, 0);\n break;\n // outer ring clockwise shifted edges\n case 17:\n vt.shift(-PART_LENGTH, -2f*PART_LENGTH, 0);\n break;\n case 18:\n vt.shift(-2f*PART_LENGTH, PART_LENGTH, 0);\n break;\n case 19:\n vt.shift(PART_LENGTH, 2f*PART_LENGTH, 0);\n break;\n case 20:\n vt.shift(2f*PART_LENGTH, -PART_LENGTH, 0);\n break;\n // outer ring counter-clockwise shifted edges\n case 21:\n vt.shift(PART_LENGTH, -2f*PART_LENGTH, 0);\n break;\n case 22:\n vt.shift(-2f*PART_LENGTH, -PART_LENGTH, 0);\n break;\n case 23:\n vt.shift(-PART_LENGTH, 2f*PART_LENGTH, 0);\n break;\n case 24:\n vt.shift(2f*PART_LENGTH, PART_LENGTH, 0);\n break;\n\n }\n\n switch (i % 6) {\n case 0 : // r\n nt.rotate(0f, 0f, -HALF_PI);\n nt.rotate(0f, -HALF_PI, 0f);\n break;\n case 1 : // u\n nt.rotate(0f, 0f, HALF_PI);\n nt.rotate(-HALF_PI, 0f, 0f);\n break;\n case 2 : // f\n //--no transformation--\n break;\n case 3 : // l\n nt.rotate(0f, 0f, PI);\n nt.rotate(0f, HALF_PI, 0f);\n break;\n case 4 : // d\n nt.rotate(0f, 0f, PI);\n nt.rotate(HALF_PI, 0f, 0f);\n break;\n case 5 : // b\n nt.rotate(0f, 0f, HALF_PI);\n nt.rotate(0f, PI, 0f);\n break;\n }\n // Finally, we concatenate the rotation to the vertex matrix\n vt.transform(nt);\n }\n\n\n // Center part\n identityVertexMatrix[centerOffset] = new idx3d_Matrix();\n identityNormalMatrix[centerOffset] = new idx3d_Matrix();\n\n // copy all vertex locationTransforms into the normal locationTransforms.\n // create the locationTransforms\n for (int i = 0; i < partCount; i++) {\n\n locationTransforms[i] = new idx3d_Group();\n locationTransforms[i].matrix.set(identityVertexMatrix[i]);\n locationTransforms[i].normalmatrix.set(identityNormalMatrix[i]);\n\n explosionTransforms[i] = new idx3d_Group();\n explosionTransforms[i].addChild(parts[i]);\n locationTransforms[i].addChild(explosionTransforms[i]);\n }\n }", "private void constructTransitionMatrix() {\r\n\t\tfor(Node node: mNodes) {\r\n\t\t\tint nodeId = node.getId();\r\n\t\t\tint outDegree = node.getOutDegree();\r\n\t\t\tArrayList<NodeTransition> transitionList = new ArrayList<NodeTransition>();\r\n\t\t\t\r\n\t\t\tSet<Integer> outEdges = getOutEdges(nodeId);\r\n\t\t\tfor(Integer edgeId: outEdges) {\r\n\t\t\t\tint toId = getEdge(edgeId).getToId();\r\n\t\t\t\tdouble pTransition = (double) getEdge(edgeId).getWeight() / (double) outDegree;\r\n\t\t\t\ttransitionList.add( new NodeTransition(toId, pTransition) );\r\n\t\t\t}\r\n\t\t\tmTransition.add( transitionList );\r\n\t\t}\r\n\t}", "private void getProperBaseMatrix(Matrix matrix) \r\n {\r\n \tif(mViewWidth == 0)\r\n \t\treturn;\r\n \t\r\n \tfloat w = mRoBitmap.getWidth();\r\n \tfloat h = mRoBitmap.getHeight();\r\n \t\r\n matrix.reset();\r\n // We limit up-scaling to 3x otherwise the result may look bad if it's\r\n // a small icon.\r\n float widthScale = (float)((float)mViewWidth / w);//Math.min((float)((float)mViewWidth / w), 3.0f);\r\n float heightScale = (float)((float)mViewHeight / h);//Math.min((float)((float)mViewHeight / h), 3.0f);\r\n float scale = Math.max(widthScale, heightScale);\r\n \r\n matrix.postConcat(mRoBitmap.getRotateMatrix());\r\n matrix.postScale(scale, scale);\r\n\r\n matrix.postTranslate(\r\n (mViewWidth - w * scale) / 2F,\r\n (mViewHeight - h * scale) / 2F);\r\n }", "godot.wire.Wire.Transform getTransformValue();", "public static Mat getTransformation(Mat ref, Mat ins) {\n final int warp_mode = MOTION_TRANSLATION;\n Mat warpMatrix = Mat.eye(2,3,CV_32F);\n try {\n int numIter = 50;\n double terminationEps = 1e-3;\n TermCriteria criteria = new TermCriteria(TermCriteria.COUNT + TermCriteria.EPS, numIter, terminationEps);\n double r= findTransformECC(ref, ins, warpMatrix, warp_mode, criteria, new Mat());\n if(r == -1){\n Log.e(TAG,\"Rc== -1\");\n return null;\n }\n }catch(Exception e){\n Log.e(TAG,\"Exception in FindTransformECC\");\n return null;\n }\n return warpMatrix;\n }", "public void cameraTransform(Vector3f targ, Vector3f up) {\r\n\t\t// First normalize the target\r\n\t\tVector3f n = targ;\r\n\t\tn.normalize();\r\n\t\t// Then normalize the up vector\r\n\t\tVector3f u = up;\r\n\t\tu.normalize();\r\n\t\t// Then cross the two together to get the right vector\r\n\t\tu = u.cross(n);\r\n\t\tVector3f v = n.cross(u);\r\n\r\n\t\t// Finally build a matrix from the result\r\n\t\tm[0][0] = u.x; m[0][1] = u.y; m[0][2] = u.z; m[0][3] = 0.0f;\r\n\t\tm[1][0] = v.x; m[1][1] = v.y; m[1][2] = v.z; m[1][3] = 0.0f;\r\n\t\tm[2][0] = n.x; m[2][1] = n.y; m[2][2] = n.z; m[2][3] = 0.0f;\r\n\t\tm[3][0] = 0.0f; m[3][1] = 0.0f; m[3][2] = 0.0f; m[3][3] = 1.0f;\r\n\r\n\t}", "@Override\n\tpublic GAffineTransform getTransform(GeoConicND conic, Coords M,\n\t\t\tCoords[] ev) {\n\t\ttransform.setTransform(ev[0].getX(), ev[0].getY(), ev[1].getX(),\n\t\t\t\tev[1].getY(), M.getX(), M.getY());\n\n\t\treturn transform;\n\t}", "public Matrix getGraphMatrix(){\n\t\treturn graphMatrix;\n\t}", "private SimilarityTransformation3D getCombinedTransfo3D(Document document,double sourcescale,double targetscale) {\n\t\tElement root = XMLUtil.getRootElement(document);\n\n\t\tArrayList<Element> transfoElementArrayList = XMLUtil.getElements(root,\n\t\t\t\t\"MatrixTransformation\");\n\t\t// int nbtransfo=transfoElementArrayList.size();\n\t\tArrayList<Matrix> listoftransfo = new ArrayList<Matrix>();\n\t\t\n\t\t//Matrix ScaleSourcetransfo=Matrix.identity(4, 4).times(sourcescale);\n\t\t//Matrix Scaletargettransfo=Matrix.identity(4, 4).times(1.0/targetscale);\n\t\tMatrix ScaleSourcetransfo=Matrix.identity(4, 4).times(sourcescale);\n\t\tScaleSourcetransfo.set(3,3,1.0);\n\t\tScaleSourcetransfo.set(2,2,1.0);//do not touch z\n\t\tMatrix Scaletargettransfo=Matrix.identity(4, 4).times(1.0/targetscale);\n\t\tScaletargettransfo.set(3,3,1.0);\n\t\tScaletargettransfo.set(2,2,1.0);//do not touch z\n\t\t//listoftransfo.add(ScaleSourcetransfo);\n\t\t// the default value of orisizex has to the actual pixel size:\n\t\t// otherwise during the initialisation (i.e the first tranform \n\t\t//when getcombined transform has nothing to return\n\t\tdouble orisizex=source.getValue().getPixelSizeX();\n\t\tdouble orisizey=source.getValue().getPixelSizeY();\n\t\tdouble orisizez=source.getValue().getPixelSizeZ();\n\t\tElement transfoElementf=transfoElementArrayList.get(0);\n\t\tdouble orisizexbinned=XMLUtil.getAttributeDoubleValue(transfoElementf, \"formerpixelsizeX\", 0);\n\t\t//double orisizeybinned=XMLUtil.getAttributeDoubleValue(transfoElementf, \"formerpixelsizeY\", 0);\n\t\t//double orisizezbinned=XMLUtil.getAttributeDoubleValue(transfoElementf, \"formerpixelsizeZ\", 0);\n\t\tif ((orisizex==orisizexbinned)&&(sourcescale!=1)){\n\t\t\tlistoftransfo.add(ScaleSourcetransfo);\n\t\t\tSystem.out.println(\"Warning something strange happened to your metadata. Check your binned metadata and these one.\");\n\t\t}\n\t\tfor (Element transfoElement : transfoElementArrayList) {\n\t\t\tdouble[][] m = new double[4][4];\n\t\t\t// int order = XMLUtil.getAttributeIntValue( transfoElement, \"order\"\n\t\t\t// , -1 ); //to be check for now only: has to be used!!!\n\t\t\t// the only different pixel size (i.e the orginal source size) is given only at the first transformation\n\t\t\t\n\t\t\t\n\t\t\tm[0][0] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m00\", 0);\n\t\t\tm[0][1] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m01\", 0);\n\t\t\tm[0][2] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m02\", 0);\n\t\t\tm[0][3] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m03\", 0);\n\n\t\t\tm[1][0] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m10\", 0);\n\t\t\tm[1][1] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m11\", 0);\n\t\t\tm[1][2] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m12\", 0);\n\t\t\tm[1][3] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m13\", 0);\n\n\t\t\tm[2][0] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m20\", 0);\n\t\t\tm[2][1] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m21\", 0);\n\t\t\tm[2][2] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m22\", 0);\n\t\t\tm[2][3] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m23\", 0);\n\n\t\t\tm[3][0] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m30\", 0);\n\t\t\tm[3][1] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m31\", 0);\n\t\t\tm[3][2] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m32\", 0);\n\t\t\tm[3][3] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m33\", 0);\n\t\t\t\n\t\t\tMatrix T = new Matrix(m);\n\t\t\tlistoftransfo.add(T);\n\n\t\t}\n\t\tlistoftransfo.add(Scaletargettransfo);\n\t\tMatrix CombinedTransfo = Matrix.identity(4, 4);\n\t\tfor (int i = 0; i < listoftransfo.size(); i++) {\n\t\t\tCombinedTransfo = listoftransfo.get(i).times(CombinedTransfo);\n\t\t}\n\t\t\n\t\t\n\t\tSimilarityTransformation3D resulttransfo=new SimilarityTransformation3D(CombinedTransfo,orisizex,orisizey,orisizez);\n\t\treturn resulttransfo;\n\t\n}", "public TransformationMatrix(TransformationMatrix m) {\n\t\ta11 = m.a11; a12 = m.a12; a13 = m.a13; a14 = m.a14;\n\t\ta21 = m.a21; a22 = m.a22; a23 = m.a23; a24 = m.a24;\n\t\ta31 = m.a31; a32 = m.a32; a33 = m.a33; a34 = m.a34;\n\t}", "protected abstract float[] computeLeafModelMatrix();", "public Matrix getCurrentRotation() throws ManipulatorException;", "public abstract Vector4fc mulProject(IMatrix4f mat);", "private void setMToIdentity()\n\t\t{\n\t\t\tfor(rowNumber = 0; rowNumber < 4; rowNumber++)\n\t\t\t\tfor(int column = 0; column < 4; column++)\n\t\t\t\t{\n\t\t\t\t\tif(rowNumber == column)\n\t\t\t\t\t\tmElements[rowNumber*4 + column] = 1;\n\t\t\t\t\telse\n\t\t\t\t\t\tmElements[rowNumber*4 + column] = 0;\n\t\t\t\t}\n\t\t\ttransform = new Transform3D(mElements);\n\t\t\trowNumber = 0;\n\t\t}", "public AffineTransform getInitialCtm(\n )\n {\n AffineTransform initialCtm;\n if(getScanner().getRenderContext() == null) // Device-independent.\n {\n initialCtm = new AffineTransform(); // Identity.\n }\n else // Device-dependent.\n {\n IContentContext contentContext = getScanner().getContentContext();\n Dimension2D canvasSize = getScanner().getCanvasSize();\n\n // Axes orientation.\n RotationEnum rotation = contentContext.getRotation();\n switch(rotation)\n {\n case Downward:\n initialCtm = new AffineTransform(1, 0, 0, -1, 0, canvasSize.getHeight());\n break;\n case Leftward:\n initialCtm = new AffineTransform(0, 1, 1, 0, 0, 0);\n break;\n case Upward:\n initialCtm = new AffineTransform(-1, 0, 0, 1, canvasSize.getWidth(), 0);\n break;\n case Rightward:\n initialCtm = new AffineTransform(0, -1, -1, 0, canvasSize.getWidth(), canvasSize.getHeight());\n break;\n default:\n throw new NotImplementedException();\n }\n\n // Scaling.\n Rectangle2D contentBox = contentContext.getBox();\n Dimension2D rotatedCanvasSize = rotation.transform(canvasSize);\n initialCtm.scale(\n rotatedCanvasSize.getWidth() / contentBox.getWidth(),\n rotatedCanvasSize.getHeight() / contentBox.getHeight()\n );\n\n // Origin alignment.\n initialCtm.translate(-contentBox.getMinX(), -contentBox.getMinY());\n }\n return initialCtm;\n }", "Transforms getTransforms();", "public void updateTransform() {\n \t\tif (viewBox != null) {\n \t\t\tOMSVGRect bbox = ((SVGRectElement)viewBox.getElement()).getBBox();\n //\t\t\tGWT.log(\"bbox = \" + bbox.getDescription());\n \t\t\tfloat d = (float)Math.sqrt((bbox.getWidth() * bbox.getWidth() + bbox.getHeight() * bbox.getHeight()) * 0.25) * scale * 2;\n //\t\t\tGWT.log(\"d = \" + d);\n \t\t\n \t\t\t// Compute the actual canvas size. It is the max of the window rect\n \t\t\t// and the transformed bbox.\n \t\t\tfloat width = Math.max(d, windowRect.getWidth());\n \t\t\tfloat height = Math.max(d, windowRect.getHeight());\n //\t\t\tGWT.log(\"width = \" + width);\n //\t\t\tGWT.log(\"height = \" + height);\n \n \t\t\t// Compute the display transform to center the image in the\n \t\t\t// canvas\n \t\t\tOMSVGMatrix m = svg.createSVGMatrix();\n \t\t\tfloat cx = bbox.getCenterX();\n \t\t\tfloat cy = bbox.getCenterY();\n \t\t\tm = m.translate(0.5f * (width - bbox.getWidth()) -bbox.getX(), 0.5f * (height - bbox.getHeight()) -bbox.getY())\n \t\t\t.translate(cx, cy)\n \t\t\t.rotate(angle)\n \t\t\t.scale(scale)\n \t\t\t.translate(-cx, -cy);\n \t\t\t((ISVGTransformable)xformGroup).getTransform().getBaseVal().getItem(0).setMatrix(m);\n \t\t\t((ISVGTransformable)modelGroup.getTwinWrapper()).getTransform().getBaseVal().getItem(0).setMatrix(m);\n //\t\t\tGWT.log(\"m=\" + m.getDescription());\n \t\t\tsvg.getStyle().setWidth(width, Unit.PX);\n \t\t\tsvg.getStyle().setHeight(height, Unit.PX);\n \t\t}\n \t}", "public AffineTransform3D getInverse()\r\n\t\t\tthrows NoninvertibleTransform3DException {\r\n\t\tAffineTransform3D inverseMat = new AffineTransform3D();\r\n\t\tdouble Det = getDeterminant();\r\n\r\n\t\tif (Det == 0) {\r\n\t\t\tthrow new NoninvertibleTransform3DException();\r\n\t\t}\r\n\t\tAffineTransform3D rv = new AffineTransform3D();\r\n\t\trv.M11 = (M23 * M34 * M42) - (M24 * M33 * M42) + (M24 * M32 * M43)\r\n\t\t\t\t- (M22 * M34 * M43) - (M23 * M32 * M44) + (M22 * M33 * M44);\r\n\t\trv.M12 = (M14 * M33 * M42) - (M13 * M34 * M42) - (M14 * M32 * M43)\r\n\t\t\t\t+ (M12 * M34 * M43) + (M13 * M32 * M44) - (M12 * M33 * M44);\r\n\t\trv.M13 = (M13 * M24 * M42) - (M14 * M23 * M42) + (M14 * M22 * M43)\r\n\t\t\t\t- (M12 * M24 * M43) - (M13 * M22 * M44) + (M12 * M23 * M44);\r\n\t\trv.M14 = (M14 * M23 * M32) - (M13 * M24 * M32) - (M14 * M22 * M33)\r\n\t\t\t\t+ (M12 * M24 * M33) + (M13 * M22 * M34) - (M12 * M23 * M34);\r\n\t\trv.M21 = (M24 * M33 * M41) - (M23 * M34 * M41) - (M24 * M31 * M43)\r\n\t\t\t\t+ (M21 * M34 * M43) + (M23 * M31 * M44) - (M21 * M33 * M44);\r\n\t\trv.M22 = (M13 * M34 * M41) - (M14 * M33 * M41) + (M14 * M31 * M43)\r\n\t\t\t\t- (M11 * M34 * M43) - (M13 * M31 * M44) + (M11 * M33 * M44);\r\n\t\trv.M23 = (M14 * M23 * M41) - (M13 * M24 * M41) - (M14 * M21 * M43)\r\n\t\t\t\t+ (M11 * M24 * M43) + (M13 * M21 * M44) - (M11 * M23 * M44);\r\n\t\trv.M24 = (M13 * M24 * M31) - (M14 * M23 * M31) + (M14 * M21 * M33)\r\n\t\t\t\t- (M11 * M24 * M33) - (M13 * M21 * M34) + (M11 * M23 * M34);\r\n\t\trv.M31 = (M22 * M34 * M41) - (M24 * M32 * M41) + (M24 * M31 * M42)\r\n\t\t\t\t- (M21 * M34 * M42) - (M22 * M31 * M44) + (M21 * M32 * M44);\r\n\t\trv.M32 = (M14 * M32 * M41) - (M12 * M34 * M41) - (M14 * M31 * M42)\r\n\t\t\t\t+ (M11 * M34 * M42) + (M12 * M31 * M44) - (M11 * M32 * M44);\r\n\t\trv.M33 = (M12 * M24 * M41) - (M14 * M22 * M41) + (M14 * M21 * M42)\r\n\t\t\t\t- (M11 * M24 * M42) - (M12 * M21 * M44) + (M11 * M22 * M44);\r\n\t\trv.M34 = (M14 * M22 * M31) - (M12 * M24 * M31) - (M14 * M21 * M32)\r\n\t\t\t\t+ (M11 * M24 * M32) + (M12 * M21 * M34) - (M11 * M22 * M34);\r\n\t\trv.M41 = (M23 * M32 * M41) - (M22 * M33 * M41) - (M23 * M31 * M42)\r\n\t\t\t\t+ (M21 * M33 * M42) + (M22 * M31 * M43) - (M21 * M32 * M43);\r\n\t\trv.M42 = (M12 * M33 * M41) - (M13 * M32 * M41) + (M13 * M31 * M42)\r\n\t\t\t\t- (M11 * M33 * M42) - (M12 * M31 * M43) + (M11 * M32 * M43);\r\n\t\trv.M43 = (M13 * M22 * M41) - (M12 * M23 * M41) - (M13 * M21 * M42)\r\n\t\t\t\t+ (M11 * M23 * M42) + (M12 * M21 * M43) - (M11 * M22 * M43);\r\n\t\trv.M44 = (M12 * M23 * M31) - (M13 * M22 * M31) + (M13 * M21 * M32)\r\n\t\t\t\t- (M11 * M23 * M32) - (M12 * M21 * M33) + (M11 * M22 * M33);\r\n\r\n\t\tDet = (1 / getDeterminant());\r\n\t\tinverseMat = ScalarMult(new AffineTransform3D(), Det); // MatrixScaling4(VectorInput(Det,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Det, Det),\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Det)\r\n\t\trv = MatrixMult(rv, inverseMat);\r\n\t\treturn rv;\r\n\t}", "public Matrix getMatrix() {\n Matrix matrix2 = new Matrix();\n matrix2.set(this.matrix);\n return matrix2;\n }", "public final Transformation getTransformation() {\n\t\treturn transform;\n\t}", "public float [][] GetMatrix() {\n \n\t/*\n\tinputs--\n\t*/\n\t\n\t/*\n\toutputs--\n\t\n\tmat_f_m :\n\t The self matrix\n\t*/\n\t\n\treturn this.mat_f_m;\n \n }", "public Mat4x4 getMatView() {\n Mat4x4 matCameraRotX = MatrixMath.matrixMakeRotationX(cameraRot.getX());\n Mat4x4 matCameraRotY = MatrixMath.matrixMakeRotationY(cameraRot.getY());\n Mat4x4 matCameraRotZ = MatrixMath.matrixMakeRotationZ(cameraRot.getZ());\n Mat4x4 matCameraRotXY = MatrixMath.matrixMultiplyMatrix(matCameraRotX, matCameraRotY);\n Mat4x4 matCameraRot = MatrixMath.matrixMultiplyMatrix(matCameraRotXY, matCameraRotZ);\n matCamera = calculateMatCamera(up, target, matCameraRot);\n matView = MatrixMath.matrixQuickInverse(matCamera);\n return matView;\n }", "public int[][] transform(Matrix transformation) {\n\t\tList<Matrix> matrices = new ArrayList<Matrix>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tMatrix matrix = new Matrix(new double[][]{ { x[i] },\n\t\t\t\t\t\t\t\t\t\t\t\t\t { y[i] },\n\t\t\t\t\t\t\t\t\t\t\t\t\t { 1 }});\n\t\t\t//matrix.print(3, 3);\n\t\t\t//transformation.print(3, 3);\n\t\t\tmatrices.add(transformation.times(matrix));\n\t\t}\n\t\treturn matricesToPoly(matrices);\n\t}", "@Override\n\t\tpublic GLGroupTransform transforms() { return transforms; }", "public AffineTransform getCtm(\n )\n {return ctm;}", "Transform<A, B> getTransform();", "public Matrix transpose(){\r\n \tMatrix tmat = new Matrix(this.ncol, this.nrow);\r\n \tdouble[][] tarray = tmat.getArrayReference();\r\n \tfor(int i=0; i<this.ncol; i++){\r\n \t\tfor(int j=0; j<this.nrow; j++){\r\n \t\ttarray[i][j]=this.matrix[j][i];\r\n \t\t}\r\n \t}\r\n \treturn tmat;\r\n \t}", "public void setTransform(float a11, float a12, float a21, float a22, float x, float y);", "private Matrix33d getMatrix() {\n final Matrix33d m = new Matrix33d();\n m.setMatrixColumn(new Vector3d(V1), 0);\n m.setMatrixColumn(new Vector3d(V2), 1);\n m.setMatrixColumn(new Vector3d(V3), 2);\n return m;\n }", "public Matrix getMatrix() {\n\t\treturn matrix;\n\t}", "public Transformation getTransform() {\n\t\treturn mk;\n\t}", "private static Node setupMatrix()\n {\n Node thomasAnderson = graphDb.createNode();\n thomasAnderson.setProperty( \"name\", \"Thomas Anderson\" );\n thomasAnderson.setProperty( \"age\", 29 );\n \n Node trinity = graphDb.createNode();\n trinity.setProperty( \"name\", \"Trinity\" );\n Relationship rel = thomasAnderson.createRelationshipTo( trinity, \n MatrixRelationshipTypes.KNOWS );\n rel.setProperty( \"age\", \"3 days\" );\n \n Node morpheus = graphDb.createNode();\n morpheus.setProperty( \"name\", \"Morpheus\" );\n morpheus.setProperty( \"rank\", \"Captain\" );\n morpheus.setProperty( \"occupation\", \"Total badass\" );\n thomasAnderson.createRelationshipTo( morpheus, MatrixRelationshipTypes.KNOWS );\n rel = morpheus.createRelationshipTo( trinity, \n MatrixRelationshipTypes.KNOWS );\n rel.setProperty( \"age\", \"12 years\" );\n \n Node cypher = graphDb.createNode();\n cypher.setProperty( \"name\", \"Cypher\" );\n cypher.setProperty( \"last name\", \"Reagan\" );\n rel = morpheus.createRelationshipTo( cypher, \n MatrixRelationshipTypes.KNOWS );\n rel.setProperty( \"disclosure\", \"public\" );\n \n Node smith = graphDb.createNode();\n smith.setProperty( \"name\", \"Agent Smith\" );\n smith.setProperty( \"version\", \"1.0b\" );\n smith.setProperty( \"language\", \"C++\" );\n rel = cypher.createRelationshipTo( smith, MatrixRelationshipTypes.KNOWS );\n rel.setProperty( \"disclosure\", \"secret\" );\n rel.setProperty( \"age\", \"6 months\" );\n \n Node architect = graphDb.createNode();\n architect.setProperty( \"name\", \"The Architect\" );\n smith.createRelationshipTo( architect, MatrixRelationshipTypes.CODED_BY );\n \n return thomasAnderson;\n }", "public AffineTransform getAffineTransform() {\n return affineTransform;\n }", "public abstract BufferedImage transform();", "Activity getTransformMappingActivity();", "private static AffineTransform3D MatrixMult(AffineTransform3D matLeft,\r\n\t\t\tAffineTransform3D matRight) {\r\n\r\n\t\tAffineTransform3D m = new AffineTransform3D();\r\n\t\tm.M11 = (matRight.M11 * matLeft.M11) + (matRight.M21 * matLeft.M12)\r\n\t\t\t\t+ (matRight.M31 * matLeft.M13) + (matRight.M41 * matLeft.M14);\r\n\t\tm.M12 = (matRight.M12 * matLeft.M11) + (matRight.M22 * matLeft.M12)\r\n\t\t\t\t+ (matRight.M32 * matLeft.M13) + (matRight.M42 * matLeft.M14);\r\n\t\tm.M13 = (matRight.M13 * matLeft.M11) + (matRight.M23 * matLeft.M12)\r\n\t\t\t\t+ (matRight.M33 * matLeft.M13) + (matRight.M43 * matLeft.M14);\r\n\t\tm.M14 = (matRight.M14 * matLeft.M11) + (matRight.M24 * matLeft.M12)\r\n\t\t\t\t+ (matRight.M34 * matLeft.M13) + (matRight.M44 * matLeft.M14);\r\n\t\tm.M21 = (matRight.M11 * matLeft.M21) + (matRight.M21 * matLeft.M22)\r\n\t\t\t\t+ (matRight.M31 * matLeft.M23) + (matRight.M41 * matLeft.M24);\r\n\t\tm.M22 = (matRight.M12 * matLeft.M21) + (matRight.M22 * matLeft.M22)\r\n\t\t\t\t+ (matRight.M32 * matLeft.M23) + (matRight.M42 * matLeft.M24);\r\n\t\tm.M23 = (matRight.M13 * matLeft.M21) + (matRight.M23 * matLeft.M22)\r\n\t\t\t\t+ (matRight.M33 * matLeft.M23) + (matRight.M43 * matLeft.M24);\r\n\t\tm.M24 = (matRight.M14 * matLeft.M21) + (matRight.M24 * matLeft.M22)\r\n\t\t\t\t+ (matRight.M34 * matLeft.M23) + (matRight.M44 * matLeft.M24);\r\n\t\tm.M31 = (matRight.M11 * matLeft.M31) + (matRight.M21 * matLeft.M32)\r\n\t\t\t\t+ (matRight.M31 * matLeft.M33) + (matRight.M41 * matLeft.M34);\r\n\t\tm.M32 = (matRight.M12 * matLeft.M31) + (matRight.M22 * matLeft.M32)\r\n\t\t\t\t+ (matRight.M32 * matLeft.M33) + (matRight.M42 * matLeft.M34);\r\n\t\tm.M33 = (matRight.M13 * matLeft.M31) + (matRight.M23 * matLeft.M32)\r\n\t\t\t\t+ (matRight.M33 * matLeft.M33) + (matRight.M43 * matLeft.M34);\r\n\t\tm.M34 = (matRight.M14 * matLeft.M31) + (matRight.M24 * matLeft.M32)\r\n\t\t\t\t+ (matRight.M34 * matLeft.M33) + (matRight.M44 * matLeft.M34);\r\n\t\tm.M41 = (matRight.M11 * matLeft.M41) + (matRight.M21 * matLeft.M42)\r\n\t\t\t\t+ (matRight.M31 * matLeft.M43) + (matRight.M41 * matLeft.M44);\r\n\t\tm.M42 = (matRight.M12 * matLeft.M41) + (matRight.M22 * matLeft.M42)\r\n\t\t\t\t+ (matRight.M32 * matLeft.M43) + (matRight.M42 * matLeft.M44);\r\n\t\tm.M43 = (matRight.M13 * matLeft.M41) + (matRight.M23 * matLeft.M42)\r\n\t\t\t\t+ (matRight.M33 * matLeft.M43) + (matRight.M43 * matLeft.M44);\r\n\t\tm.M44 = (matRight.M14 * matLeft.M41) + (matRight.M24 * matLeft.M42)\r\n\t\t\t\t+ (matRight.M34 * matLeft.M43) + (matRight.M44 * matLeft.M44);\r\n\r\n\t\treturn m;\r\n\t}", "public void updateProjector(Matrix4f trans) {\r\n\t\tMatrix4f oldM = new Matrix4f(getProjector().getModelM());\r\n\t\tgetProjector().setModelM(trans.multiply(oldM.transpose()).transpose().toArray());\r\n\t}", "public static Matrix getTransformMatrix(int width, int height, int rotation) {\n Matrix matrix = new Matrix();\n\n // Compute the center of the view finder\n float centerX = width / 2f;\n float centerY = height / 2f;\n\n // Correct preview output to account for display rotation\n float rotationDegrees =\n OrientationUtil.displayRotationToDegrees(rotation);\n matrix.postRotate(-rotationDegrees, centerX, centerY);\n\n return matrix;\n }", "Mat rotateMatCW(Mat src ) {\n Mat rotationMatrix = Imgproc.getRotationMatrix2D(new Point(src.cols()/2,src.rows()/2),270,1);\n\n //Rotating the given image\n Imgproc.warpAffine(src, result,rotationMatrix, new Size(src.cols(), src.rows()));\n return result;\n }", "public int[][] getMat() {\n // Note: java has no return read-only so we won't return matrix;\n // b\\c that would expose internal representation. Instead we will\n // copy each row into a new matrix, and return that.\n return Helper.cloneMatrix(matrix);\n }", "public RMTransform getTransformFromShape(RMShape aShape)\n{\n // The transform from parent is just our inverse transform, transform from child is just child's transform\n if(aShape==getParent())\n return getTransformInverse();\n if(aShape!=null && this==aShape.getParent())\n return aShape.getTransform();\n\n // Return the inverse of transform to shape\n return getTransformToShape(aShape).invert();\n}", "protected void compute_mvpMatrix(float[] VPMatrix) {\n Matrix.multiplyMM(tempMatrix, 0, modelMatrix, 0, accumulatedRotation, 0);\n\n // ... e applica la matrice che contiene il risultato della matrice view e di proiezione\n Matrix.multiplyMM(mvpMatrix, 0, VPMatrix, 0, tempMatrix, 0);\n }", "public int[][] getMatrix(){\n\t\treturn matrix;\n\t}", "public final native void transform(String transform, Element node) /*-{ this.transform(transform, node) }-*/;", "public void establishOldAffineTransform ( Graphics2D graphics2d )\n {\n oldAffineTransformation = graphics2d.getTransform ( );\n }", "public interface LinopTransform extends Transform {\r\n public double[][] getMat();\r\n}", "public Transform getRotationTransformation() {\n Transform t = Transform.newXRotation(rotation.x);\n t = t.compose(Transform.newYRotation(rotation.y));\n t = t.compose(Transform.newZRotation(rotation.z));\n return t;\n }", "private Matrix toMatrix(Object o) {\n\t\tif(o instanceof String) {\n\t\t\tif(!isMatrix((String) o)) return null;\n\t\t\telse if(o.equals(\"A\")) return a;\n\t\t\telse return b;\n\t\t}\n\t\telse if(o instanceof Matrix) return (Matrix) o;\n\t\telse return null;\n\t}" ]
[ "0.702291", "0.64020765", "0.63048834", "0.6147945", "0.5997813", "0.59874", "0.5724057", "0.572393", "0.5711888", "0.5649891", "0.56179476", "0.56027603", "0.547974", "0.5406021", "0.53804654", "0.5357043", "0.5342347", "0.53191274", "0.53066444", "0.5274409", "0.5210854", "0.5172622", "0.5147283", "0.5113549", "0.50982904", "0.5090823", "0.5070786", "0.50707144", "0.5070261", "0.5068078", "0.5050725", "0.50353646", "0.50013536", "0.49897653", "0.4984899", "0.4981547", "0.49576432", "0.4948304", "0.49420813", "0.4940442", "0.49395084", "0.4924616", "0.4902053", "0.48998752", "0.48880565", "0.4884036", "0.487454", "0.48661408", "0.48406783", "0.4839739", "0.48181897", "0.4816456", "0.48015255", "0.4797017", "0.4780333", "0.47755054", "0.476918", "0.47594595", "0.47542435", "0.47470072", "0.47192964", "0.47146377", "0.47136796", "0.47134584", "0.471076", "0.4695267", "0.46893787", "0.46797508", "0.46627545", "0.4661533", "0.46571088", "0.46469632", "0.46359247", "0.46349606", "0.4634679", "0.46251094", "0.46171615", "0.46069968", "0.45872366", "0.4558774", "0.45544332", "0.4545957", "0.4537226", "0.45343864", "0.45322892", "0.45253962", "0.45253935", "0.45231664", "0.44987908", "0.44964734", "0.44892472", "0.44881898", "0.44856948", "0.44839394", "0.44631782", "0.44614902", "0.4449632", "0.44388777", "0.4434814", "0.4421156" ]
0.65112907
1
////////////////////////////////////////////////////////////////////// Description: Returns the transformation matrix to go from image space to the object space corresponding to the given node in the path. Use: public
public SbMatrix getImageToObject(SoNode node) // //////////////////////////////////////////////////////////////////////// { getMatrix(node); return matrixAction.getTextureInverse(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void\ngetMatrix( SoNode node)\n//\n////////////////////////////////////////////////////////////////////////\n{\n SoPath xfPath; // ptr\n\n // Construct a path from the root down to this node. Use the given\n // path if it's the same\n if (node == null || node == SoFullPath.cast(path).getTail())\n xfPath = path;\n\n else {\n int index = getNodeIndex(node);\n xfPath = path.copy(0, index + 1);\n xfPath.ref();\n }\n\n // Create an action instance if necessary, then apply it to the path\n if (matrixAction == null)\n matrixAction = new SoGetMatrixAction(vpRegion);\n matrixAction.apply(xfPath);\n\n if (xfPath != path)\n xfPath.unref();\n}", "public SbMatrix\ngetObjectToImage( SoNode node) \n//\n////////////////////////////////////////////////////////////////////////\n{\n getMatrix(node);\n return matrixAction.getTextureMatrix();\n}", "public SbMatrix\ngetObjectToWorld(final SoNode node)\n//\n////////////////////////////////////////////////////////////////////////\n{\n getMatrix(node);\n return matrixAction.getMatrix();\n}", "public SbMatrix\ngetWorldToObject( SoNode node) \n//\n////////////////////////////////////////////////////////////////////////\n{\n getMatrix(node);\n return matrixAction.getInverse();\n}", "public Matrix getTransform()\n {\n return transform;\n }", "public Matrix4 getTransformMatrix() {\n return transformMatrix;\n }", "public GeneralPath transform(Matrix matrix)\n {\n float x1 = getLowerLeftX();\n float y1 = getLowerLeftY();\n float x2 = getUpperRightX();\n float y2 = getUpperRightY();\n\n Point2D.Float p0 = matrix.transformPoint(x1, y1);\n Point2D.Float p1 = matrix.transformPoint(x2, y1);\n Point2D.Float p2 = matrix.transformPoint(x2, y2);\n Point2D.Float p3 = matrix.transformPoint(x1, y2);\n\n GeneralPath path = new GeneralPath();\n path.moveTo(p0.getX(), p0.getY());\n path.lineTo(p1.getX(), p1.getY());\n path.lineTo(p2.getX(), p2.getY());\n path.lineTo(p3.getX(), p3.getY());\n path.closePath();\n return path;\n }", "public double[][] convert_img_mat()\n\t{\n\t\tif(orderflag)\n\t\t{\n\t\t\tputpixel_1();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//rotate the image and get the pixels as usual form\t\n \t\tputpixel_2();\n\t\t}\n\treturn matrix;\n\t}", "protected Matrix4 computeTransform() {\n return super.computeTransform();\n }", "@Override\n\tpublic Mat GetTranslateMatrix()\n\t{\n\t\treturn mT;\n\t}", "public AffineTransform getTransform()\n/* */ {\n/* 194 */ return this.transform;\n/* */ }", "public AffineTransform getTransform()\r\n\t{\r\n\t\treturn _g2.getTransform();\r\n\t}", "protected Matrix4f createModelMatrix(Entity entity) {\n\n //Assemble the model matrix order = SRT\n Matrix4f matrix = new Matrix4f();\n matrix.mul(entity.getTranslationMatrix());\n matrix.mul(entity.getRotation());\n matrix.mul(entity.getScaleMatrix());\n \n return matrix;\n }", "private void constructTransitionTransposeMatrix() {\r\n\t\tfor(int i=0; i<getNodeCnt(); i++) {\r\n\t\t\tArrayList<NodeTransition> transitionList = new ArrayList<NodeTransition>();\r\n\t\t\tmTransitionTranspose.add( transitionList );\r\n\t\t}\r\n\t\tfor(Node node: mNodes) {\r\n\t\t\tint fromId = node.getId();\r\n\t\t\tint outDegree = node.getOutDegree();\r\n\t\t\t\r\n\t\t\tSet<Integer> outEdges = getOutEdges(fromId);\r\n\t\t\tfor(Integer edgeId: outEdges) {\r\n\t\t\t\tint toId = getEdge(edgeId).getToId();\r\n\t\t\t\tdouble pTransition = (double) getEdge(edgeId).getWeight() / (double) outDegree;\r\n\t\t\t\t\r\n\t\t\t\tArrayList<NodeTransition> transitionList = mTransitionTranspose.get(toId);\r\n\t\t\t\ttransitionList.add( new NodeTransition(fromId, pTransition) );\r\n\t\t\t}\r\n\t\t}\r\n\t}", "protected Matrix4 computeTransform() {\n return internalGroup.computeTransform();\n }", "public Matrix4f getWorldMatrix() {\n\n\t\t// First identity\n\t\tmTranformation.identity();\n\n\t\t// Translate\n\t\tmTranformation.translate(position);\n\n\t\t// Rotate object at the center of the texture\n\t\tfloat x = 0.5f * mWidth;\n\t\tfloat y = 0.5f * mHeight;\n\n\t\t// Do rotating\n\t\tmTranformation.translate(new Vector3f(x, y, 0));\n\t\tmTranformation.rotateZ((float) Math.toRadians(rotation.z));\n\t\tmTranformation.translate(new Vector3f(-x, -y, 0));\n\n\t\t// mTranformation.scale(scale, scale, 1);\n\t\tmTranformation.scaleAround(scale, x, y, 0);\n\n\t\treturn mTranformation;\n\t}", "public Transform getTransform () {\n\t\torg.jbox2d.common.Transform trans = body.getTransform();\n\t\ttransform.vals[Transform.POS_X] = trans.p.x;\n\t\ttransform.vals[Transform.POS_Y] = trans.p.y;\n\t\ttransform.vals[Transform.COS] = trans.q.c;\n\t\ttransform.vals[Transform.SIN] = trans.q.s;\n\t\treturn transform;\n\t}", "godot.wire.Wire.Transform2D getTransform2DValue();", "public abstract Matrix4f getCameraMatrix();", "void applyRotationMatrix() {\n for (int i = 0; i < coors.length; i++) {\n for (int j = 0; j < coors[i].length; j++) {\n newCoors[i][j] = coors[i][0] * R[j][0] + coors[i][1] * R[j][1] + coors[i][2] * R[j][2];\n }\n // add perspective\n float scale = map(Math.abs(newCoors[i][2]), 0, (float) (halfSize * Math.sqrt(3)), 1, 1.5f);\n if (newCoors[i][2] < 0) {\n scale = 2f - scale;\n }\n for (int j = 0; j < 2; j++) {\n newCoors[i][j] *= scale;\n }\n }\n // to R2\n // just dont use Z\n setPathAndAlpha();\n }", "public TransformationMatrix() {\n\t\ta11 = 1; a12 = 0; a13 = 0; a14 = 0;\n\t\ta21 = 0; a22 = 1; a23 = 0; a24 = 0;\n\t\ta31 = 0; a32 = 0; a33 = 1; a34 = 0;\n\t}", "void calculateRotationMatrix() {\n R[0][0] = (float) (Math.cos(angle[0]) * Math.cos(angle[1]));\n R[1][0] = (float) (Math.sin(angle[0]) * Math.cos(angle[1]));\n R[0][1] = (float) (Math.cos(angle[0]) * Math.sin(angle[1]) * Math.sin(angle[2]) - Math.sin(angle[0]) * Math.cos(angle[2]));\n R[1][1] = (float) (Math.sin(angle[0]) * Math.sin(angle[1]) * Math.sin(angle[2]) + Math.cos(angle[0]) * Math.cos(angle[2]));\n R[0][2] = (float) (Math.cos(angle[0]) * Math.sin(angle[1]) * Math.cos(angle[2]) + Math.sin(angle[0]) * Math.sin(angle[2]));\n R[1][2] = (float) (Math.sin(angle[0]) * Math.sin(angle[1]) * Math.cos(angle[2]) - Math.cos(angle[0]) * Math.sin(angle[2]));\n R[2][0] = (float) - Math.sin(angle[1]);\n R[2][1] = (float) (Math.cos(angle[1]) * Math.sin(angle[2]));\n R[2][2] = (float) (Math.cos(angle[1]) * Math.cos(angle[2]));\n }", "public org.apache.spark.mllib.linalg.Matrix toLocalMatrix () { throw new RuntimeException(); }", "public Matrix4f getTranslationMat() {\n\t\treturn m_xforms[NvCameraXformType.MAIN].m_translateMat;\n\t}", "public void rotate(double deg) {\n deg = deg % 360;\n// System.out.println(\"Stopni:\" + deg);\n double e = 0;\n double f = 0;\n\n// for(int i = 0; i < pixels.length; i++) {\n// for(int j = 0; j < pixels[i].length; j++) {\n// e += pixels[i][j].getX();\n// f += pixels[i][j].getY();\n// }\n// }\n //e = e / (pixels.length * 2);\n //f = f / (pixels[0].length * 2);\n e = pixels.length / 2;\n f = pixels[0].length / 2;\n System.out.println(e);\n System.out.println(f);\n\n// System.out.println(e + \":\" + f);\n Matrix affineTransform;\n Matrix translateMinus = Matrix.translateRotate(-e, -f);\n Matrix translatePlus = Matrix.translateRotate(e, f);\n Matrix movedTransform = Matrix.multiply(translateMinus, Matrix.rotate(deg));\n //movedTransform.display();\n affineTransform = Matrix.multiply(movedTransform, translatePlus);\n //affineTransform.display();\n\n for(int i = 0; i < pixels.length; i++) {\n for(int j = 0; j < pixels[i].length; j++) {\n double[][] posMatrix1 = {{pixels[i][j].getX()}, {pixels[i][j].getY()}, {1}};\n Matrix m1 = new Matrix(posMatrix1);\n Matrix result1;\n result1 = Matrix.multiply(Matrix.transpose(affineTransform.v), m1);\n\n pixels[i][j].setX(Math.round(result1.v[0][0]));\n pixels[i][j].setY(Math.round(result1.v[1][0]));\n }\n }\n\n\n }", "public SbVec4f\ngetObjectTextureCoords(final SoNode node)\n//\n////////////////////////////////////////////////////////////////////////\n{\n return multVecMatrix4(getImageToObject(node), imageTexCoords);\n}", "public void transform(Matrix m)\n { \n\t \tfor(int i= 0 ; i < this.vertex.length ; i++)\n\t \t{\n\t \t\tthis.vertex[i] = this.vertex[i].transform(m);\n\t \t}\n\t \n }", "public PMVMatrix(boolean useBackingArray) {\n projectFloat = new ProjectFloat();\n \n // I Identity\n // T Texture\n // P Projection\n // Mv ModelView\n // Mvi Modelview-Inverse\n // Mvit Modelview-Inverse-Transpose\n if(useBackingArray) {\n matrixBufferArray = new float[6*16];\n matrixBuffer = null;\n // matrixBuffer = FloatBuffer.wrap(new float[12*16]);\n } else {\n matrixBufferArray = null;\n matrixBuffer = Buffers.newDirectByteBuffer(6*16 * Buffers.SIZEOF_FLOAT);\n matrixBuffer.mark();\n }\n \n matrixIdent = slice2Float(matrixBuffer, matrixBufferArray, 0*16, 1*16); // I\n matrixTex = slice2Float(matrixBuffer, matrixBufferArray, 1*16, 1*16); // T\n matrixPMvMvit = slice2Float(matrixBuffer, matrixBufferArray, 2*16, 4*16); // P + Mv + Mvi + Mvit \n matrixPMvMvi = slice2Float(matrixBuffer, matrixBufferArray, 2*16, 3*16); // P + Mv + Mvi\n matrixPMv = slice2Float(matrixBuffer, matrixBufferArray, 2*16, 2*16); // P + Mv\n matrixP = slice2Float(matrixBuffer, matrixBufferArray, 2*16, 1*16); // P\n matrixMv = slice2Float(matrixBuffer, matrixBufferArray, 3*16, 1*16); // Mv\n matrixMvi = slice2Float(matrixBuffer, matrixBufferArray, 4*16, 1*16); // Mvi\n matrixMvit = slice2Float(matrixBuffer, matrixBufferArray, 5*16, 1*16); // Mvit\n \n if(null != matrixBuffer) {\n matrixBuffer.reset();\n } \n ProjectFloat.gluMakeIdentityf(matrixIdent);\n \n vec3f = new float[3];\n matrixMult = new float[16];\n matrixTrans = new float[16];\n matrixRot = new float[16];\n matrixScale = new float[16];\n matrixOrtho = new float[16];\n matrixFrustum = new float[16];\n ProjectFloat.gluMakeIdentityf(matrixTrans, 0);\n ProjectFloat.gluMakeIdentityf(matrixRot, 0);\n ProjectFloat.gluMakeIdentityf(matrixScale, 0);\n ProjectFloat.gluMakeIdentityf(matrixOrtho, 0);\n ProjectFloat.gluMakeZero(matrixFrustum, 0);\n \n matrixPStack = new ArrayList<float[]>();\n matrixMvStack= new ArrayList<float[]>();\n \n // default values and mode\n glMatrixMode(GL_PROJECTION);\n glLoadIdentity();\n glMatrixMode(GL_MODELVIEW);\n glLoadIdentity();\n glMatrixMode(GL.GL_TEXTURE);\n glLoadIdentity();\n setDirty();\n update();\n }", "float[] getProjectionMatrix();", "float[] getViewMatrix();", "public Transform getTransformation() {\n Transform t = Transform.newTranslation(position);\n t = t.compose(Transform.newScale(scale));\n t = t.compose(Transform.newXRotation(rotation.x));\n t = t.compose(Transform.newYRotation(rotation.y));\n t = t.compose(Transform.newZRotation(rotation.z));\n return t;\n }", "abstract public Matrix4fc getViewMatrix();", "public void translateTransform(Vector3f trans) {\r\n\t\tm[0][0] = 1.0f; m[0][1] = 0.0f; m[0][2] = 0.0f; m[0][3] = trans.x;\r\n\t\tm[1][0] = 0.0f; m[1][1] = 1.0f; m[1][2] = 0.0f; m[1][3] = trans.y;\r\n\t\tm[2][0] = 0.0f; m[2][1] = 0.0f; m[2][2] = 1.0f; m[2][3] = trans.z;\r\n\t\tm[3][0] = 0.0f; m[3][1] = 0.0f; m[3][2] = 0.0f; m[3][3] = 1.0f;\r\n\r\n\t}", "private void constructTransitionMatrix() {\r\n\t\tfor(Node node: mNodes) {\r\n\t\t\tint nodeId = node.getId();\r\n\t\t\tint outDegree = node.getOutDegree();\r\n\t\t\tArrayList<NodeTransition> transitionList = new ArrayList<NodeTransition>();\r\n\t\t\t\r\n\t\t\tSet<Integer> outEdges = getOutEdges(nodeId);\r\n\t\t\tfor(Integer edgeId: outEdges) {\r\n\t\t\t\tint toId = getEdge(edgeId).getToId();\r\n\t\t\t\tdouble pTransition = (double) getEdge(edgeId).getWeight() / (double) outDegree;\r\n\t\t\t\ttransitionList.add( new NodeTransition(toId, pTransition) );\r\n\t\t\t}\r\n\t\t\tmTransition.add( transitionList );\r\n\t\t}\r\n\t}", "public AffineTransform getTransform() {\n return new AffineTransform(transform);\n }", "public static TransformMatrix translationMatrix(float x, float y) {\n\t\treturn new TransformMatrix(1,1,x,y);\n\t}", "public AffineTransform3D() {\r\n\t\tthis.M11 = 1;\r\n\t\tthis.M12 = 0;\r\n\t\tthis.M13 = 0;\r\n\t\tthis.M14 = 0;\r\n\t\tthis.M21 = 0;\r\n\t\tthis.M22 = 1;\r\n\t\tthis.M23 = 0;\r\n\t\tthis.M24 = 0;\r\n\t\tthis.M31 = 0;\r\n\t\tthis.M32 = 0;\r\n\t\tthis.M33 = 1;\r\n\t\tthis.M34 = 0;\r\n\t\tthis.M41 = 0;\r\n\t\tthis.M42 = 0;\r\n\t\tthis.M43 = 0;\r\n\t\tthis.M44 = 1;\r\n\t}", "Matrix4f getModelMatrix();", "public Matrix getCombinedTransfo(Document document,double sourcescale,double targetscale){\n\t\tElement root = XMLUtil.getRootElement(document);\n\n\n\n\n\t\tArrayList<Element> transfoElementArrayList = XMLUtil.getElements( root , \"MatrixTransformation\" );\n\n\t\tArrayList<Matrix> listoftransfo=new ArrayList<Matrix>();\n\t\tMatrix ScaleSourcetransfo=Matrix.identity(4, 4).times(1*sourcescale);\n\t\tScaleSourcetransfo.set(3,3,1.0);\n\t\tScaleSourcetransfo.set(2,2,1.0);//do not touch z\n\t\tMatrix Scaletargettransfo=Matrix.identity(4, 4).times(1.0/targetscale);\n\t\tScaletargettransfo.set(3,3,1.0);\n\t\tScaletargettransfo.set(2,2,1.0);//do not touch z\n\t\tlistoftransfo.add(ScaleSourcetransfo);\n\t\tfor ( Element transfoElement : transfoElementArrayList )\n\t\t{\n\t\t\tdouble[][] m=new double[4][4];\n\n\n\t\t\tm[0][0] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m00\" , 0 );\n\t\t\tm[0][1] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m01\" , 0 );\n\t\t\tm[0][2] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m02\" , 0 );\t\n\t\t\tm[0][3] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m03\" , 0 );\n\n\t\t\tm[1][0] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m10\" , 0 );\n\t\t\tm[1][1] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m11\" , 0 );\n\t\t\tm[1][2]= XMLUtil.getAttributeDoubleValue( transfoElement, \"m12\" , 0 );\t\n\t\t\tm[1][3] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m13\" , 0 );\n\n\t\t\tm[2][0]= XMLUtil.getAttributeDoubleValue( transfoElement, \"m20\" , 0 );\n\t\t\tm[2][1] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m21\" , 0 );\n\t\t\tm[2][2] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m22\" , 0 );\t\n\t\t\tm[2][3] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m23\" , 0 );\n\n\t\t\tm[3][0] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m30\" , 0 );\n\t\t\tm[3][1] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m31\" , 0 );\n\t\t\tm[3][2] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m32\" , 0 );\t\n\t\t\tm[3][3] = XMLUtil.getAttributeDoubleValue( transfoElement, \"m33\" , 0 );\n\n\n\t\t\tMatrix T=new Matrix(m);\n\t\t\tlistoftransfo.add(T);\n\n\n\t\t}\n\t\tlistoftransfo.add(Scaletargettransfo);\n\t\tMatrix CombinedTransfo=Matrix.identity(4, 4);\n\t\tfor (int i=0;i<listoftransfo.size();i++){\n\t\t\tCombinedTransfo=listoftransfo.get(i).times(CombinedTransfo);\n\t\t}\n\t\t//CombinedTransfo.times(1.0/CombinedTransfo.get(3, 3));\n\t\treturn CombinedTransfo;\n\t}", "public static CvMat getPerspectiveTransform(double[] src, double[] dst, CvMat map_matrix) {\n // creating and releasing matrices via NIO here in this function...\n // this can easily become a bottleneck\n CvMat A = CvMat.create(8, 8);\n CvMat b = CvMat.create(8, 1);\n CvMat x = CvMat.create(8, 1);\n\n for(int i = 0; i < 4; ++i ) {\n A.put(i*8+0, src[i*2]); A.put((i+4)*8+3, src[i*2]);\n A.put(i*8+1, src[i*2+1]); A.put((i+4)*8+4, src[i*2+1]);\n A.put(i*8+2, 1); A.put((i+4)*8+5, 1);\n A.put(i*8+3, 0); A.put(i*8+4, 0); A.put(i*8+5, 0);\n A.put((i+4)*8+0, 0); A.put((i+4)*8+1, 0); A.put((i+4)*8+2, 0);\n\n A.put(i*8+6, -src[i*2] *dst[i*2]);\n A.put(i*8+7, -src[i*2+1]*dst[i*2]);\n A.put((i+4)*8+6, -src[i*2] *dst[i*2+1]);\n A.put((i+4)*8+7, -src[i*2+1]*dst[i*2+1]);\n\n b.put(i, dst[i*2]);\n b.put(i+4, dst[i*2+1]);\n }\n cxcore.cvSolve(A, b, x, cxcore.CV_LU);\n map_matrix.put(x);\n map_matrix.put(8, 1);\n\n return map_matrix;\n }", "DMatrix3C getRotation();", "@Override\r\n protected Matrix4f genViewMatrix() {\r\n\r\n // refreshes the position\r\n position = calcPosition();\r\n\r\n // calculate the camera's coordinate system\r\n Vector3f[] coordSys = genCoordSystem(position.subtract(center));\r\n Vector3f right, up, forward;\r\n forward = coordSys[0];\r\n right = coordSys[1];\r\n up = coordSys[2];\r\n\r\n // we move the world, not the camera\r\n Vector3f position = this.position.negate();\r\n\r\n return genViewMatrix(forward, right, up, position);\r\n }", "@Override\n public float[] getRotationMatrix(){\n float[] baseCorrection = Maths.buildRotationMatrix(new float[]{0, 1, 0, 0});\n\n float[] rotationX = {(float) Math.toDegrees(theta), 1, 0, 0};\n float[] rotationY = {(float) -Math.toDegrees(phi), 0, 1, 0};\n\n float[] rotationMatrix = new float[16];\n float[] coreMotionMatrix = Maths.buildRotationMatrix(rotationY, rotationX);\n Matrix.multiplyMM(rotationMatrix, 0, baseCorrection, 0, coreMotionMatrix, 0);\n\n return rotationMatrix;\n }", "private AffineTransform createTransform() {\n Dimension size = getSize();\n Rectangle2D.Float panelRect = new Rectangle2D.Float(\n BORDER,\n BORDER,\n size.width - BORDER - BORDER,\n size.height - BORDER - BORDER);\n AffineTransform tr = AffineTransform.getTranslateInstance(panelRect.getCenterX(), panelRect.getCenterY());\n double sx = panelRect.getWidth() / mapBounds.getWidth();\n double sy = panelRect.getHeight() / mapBounds.getHeight();\n double scale = min(sx, sy);\n tr.scale(scale, -scale);\n tr.translate(-mapBounds.getCenterX(), -mapBounds.getCenterY());\n return tr;\n }", "float[] getModelMatrix();", "public Transform getTransform() {return transform;}", "public int[][] getTransitionMatrix() {\n\t\treturn null;\n\t}", "protected abstract float[] computeLeafModelMatrix();", "protected void initTransforms() {\n for (int i = 0; i < cornerCount; i++) {\n int index = cornerOffset + i;\n identityVertexMatrix[index] = new idx3d_Matrix();\n }\n\n // 0:urf\n identityVertexMatrix[cornerOffset + 0].rotate(0, -HALF_PI, 0);\n // 1:dfr\n identityVertexMatrix[cornerOffset + 1].rotate(0, 0, PI);\n // 2:ubr\n identityVertexMatrix[cornerOffset + 2].rotate(0, PI, 0);\n // 3:drb\n identityVertexMatrix[cornerOffset + 3].rotate(0, 0, PI);\n identityVertexMatrix[cornerOffset + 3].rotate(0, -HALF_PI, 0);\n // 4:ulb\n identityVertexMatrix[cornerOffset + 4].rotate(0, HALF_PI, 0);\n // 5:dbl\n identityVertexMatrix[cornerOffset + 5].rotate(PI, 0, 0);\n // 6:ufl\n //--no transformation---\n // 7:dlf\n identityVertexMatrix[cornerOffset + 7].rotate(0, HALF_PI, 0);\n identityVertexMatrix[cornerOffset + 7].rotate(PI, 0, 0);\n //\n // We can clone the normalmatrix here form the vertex matrix, because\n // the vertex matrix consists of rotations only.\n for (int i = 0; i < cornerCount; i++) {\n identityNormalMatrix[i] = identityVertexMatrix[i].getClone();\n }\n\n /**\n * Edges\n */\n // Move all edge parts to front up (fu) and then rotate them in place\n for (int i = 0; i < edgeCount; i++) {\n int index = edgeOffset + i;\n idx3d_Matrix vt = new idx3d_Matrix();\n idx3d_Matrix nt = new idx3d_Matrix();\n identityVertexMatrix[index] = vt;\n identityNormalMatrix[index] = nt;\n // The vertex matrix is the same as the normal matrix, but with\n // an additional shift, which is made before the rotation.\n if (i >= 12) {\n switch ((i - 12) % 24) {\n case 12:\n case 13:\n case 2:\n case 3:\n case 4:\n case 17:\n case 6:\n case 19:\n case 20:\n case 21:\n case 10:\n case 11:\n vt.shift(PART_LENGTH*((i+12)/24), 0f, 0f);\n break;\n default:\n vt.shift(-PART_LENGTH*((i+12)/24), 0f, 0f);\n break;\n }\n }\n // Now we do the rotation with the normal matrix only\n switch (i % 12) {\n case 0: // ur\n nt.rotate(0, HALF_PI, 0f);\n nt.rotate(0, 0, HALF_PI);\n break;\n case 1: // rf\n nt.rotate(0, -HALF_PI, 0);\n nt.rotate(HALF_PI, 0, 0);\n break;\n case 2: // dr\n nt.rotate(0, -HALF_PI, HALF_PI);\n break;\n case 3: // bu\n nt.rotate(0, PI, 0);\n break;\n case 4: // rb\n nt.rotate(0, 0, HALF_PI);\n nt.rotate(0, -HALF_PI, 0);\n break;\n case 5: // bd\n nt.rotate(PI, 0, 0);\n break;\n case 6: // ul\n nt.rotate(-HALF_PI, -HALF_PI, 0);\n break;\n case 7: // lb\n nt.rotate(0, 0, -HALF_PI);\n nt.rotate(0, HALF_PI, 0);\n break;\n case 8: // dl\n nt.rotate(HALF_PI, HALF_PI, 0);\n break;\n case 9: // fu\n //--no transformation--\n break;\n case 10: // lf\n nt.rotate(0, 0, HALF_PI);\n nt.rotate(0, HALF_PI, 0);\n break;\n case 11: // fd\n nt.rotate(0, 0, PI);\n break;\n }\n // Finally, we concatenate the rotation to the vertex matrix\n vt.transform(nt);\n }\n /* Sides\n */\n // Move all side parts to the front side and rotate them into place\n for (int i = 0; i < sideCount; i++) {\n int index = sideOffset + i;\n idx3d_Matrix vt = new idx3d_Matrix();\n idx3d_Matrix nt = new idx3d_Matrix();\n identityVertexMatrix[index] = vt;\n identityNormalMatrix[index] = nt;\n // The vertex matrix is the same as the normal matrix, but with\n // an additional shift, which is made before the rotation.\n switch (i / 6) {\n // central part\n case 0 :\n // vt.shift(0, 0, 0);\n break;\n // inner ring\n case 1:\n vt.shift(-PART_LENGTH, -PART_LENGTH, 0);\n break;\n case 2:\n vt.shift(-PART_LENGTH, PART_LENGTH, 0);\n break;\n case 3:\n vt.shift(PART_LENGTH, PART_LENGTH, 0);\n break;\n case 4:\n vt.shift(PART_LENGTH, -PART_LENGTH, 0);\n break;\n case 5:\n vt.shift(0, -PART_LENGTH, 0);\n break;\n case 6:\n vt.shift(-PART_LENGTH, 0, 0);\n break;\n case 7:\n vt.shift(0, PART_LENGTH, 0);\n break;\n case 8:\n vt.shift(PART_LENGTH, 0, 0);\n break;\n // outer ring corners\n /*\n * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+\n * | .0 | .2 | .3 | .1 |\n * + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ +\n * | |75 |129|81 |105|57 | | |62 |140|92 |116|68 | | |66 |144|96 |120|72 | | |59 |137|89 |113|65 | |\n * + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ +\n * | |123|27 |33 | 9 |135| | |110|14 |44 |20 |146| | |114|18 |48 |24 |126| | |107|11 |41 |17 |143| |\n * + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ +\n * | .3|99 |51 | 3 |39 |87 |.1 | .1|86 |38 | 2 |50 |98 |.3 | .2|90 |42 | 0 |30 |78 |.0 | .0|83 |35 | 5 |47 |95 |.2 |\n * + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ +\n * | |147|21 |45 |15 |111| | |134| 8 |32 |26 |122| | |138|12 |36 | 6 |102| | |131|29 |53 |23 |119| |\n * + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ +\n * | |69 |117|93 |141|63 | | |56 |104|80 |128|74 | | |60 |108|84 |132|54 | | |77 |125|101|149|71 | |\n * + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ +\n * | .2 | .0 | .1 | .3 |\n * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+\n */\n case 9:\n vt.shift(-2f*PART_LENGTH, -2f*PART_LENGTH, 0);\n break;\n case 10:\n vt.shift(-2f*PART_LENGTH, 2f*PART_LENGTH, 0);\n break;\n case 11:\n vt.shift(2f*PART_LENGTH, 2f*PART_LENGTH, 0);\n break;\n case 12:\n vt.shift(2f*PART_LENGTH, -2f*PART_LENGTH, 0);\n break;\n // outer ring central edges\n case 13:\n vt.shift(0, -2f*PART_LENGTH, 0);\n break;\n case 14:\n vt.shift(-2f*PART_LENGTH, 0, 0);\n break;\n case 15:\n vt.shift(0, 2f*PART_LENGTH, 0);\n break;\n case 16:\n vt.shift(2f*PART_LENGTH, 0, 0);\n break;\n // outer ring clockwise shifted edges\n case 17:\n vt.shift(-PART_LENGTH, -2f*PART_LENGTH, 0);\n break;\n case 18:\n vt.shift(-2f*PART_LENGTH, PART_LENGTH, 0);\n break;\n case 19:\n vt.shift(PART_LENGTH, 2f*PART_LENGTH, 0);\n break;\n case 20:\n vt.shift(2f*PART_LENGTH, -PART_LENGTH, 0);\n break;\n // outer ring counter-clockwise shifted edges\n case 21:\n vt.shift(PART_LENGTH, -2f*PART_LENGTH, 0);\n break;\n case 22:\n vt.shift(-2f*PART_LENGTH, -PART_LENGTH, 0);\n break;\n case 23:\n vt.shift(-PART_LENGTH, 2f*PART_LENGTH, 0);\n break;\n case 24:\n vt.shift(2f*PART_LENGTH, PART_LENGTH, 0);\n break;\n\n }\n\n switch (i % 6) {\n case 0 : // r\n nt.rotate(0f, 0f, -HALF_PI);\n nt.rotate(0f, -HALF_PI, 0f);\n break;\n case 1 : // u\n nt.rotate(0f, 0f, HALF_PI);\n nt.rotate(-HALF_PI, 0f, 0f);\n break;\n case 2 : // f\n //--no transformation--\n break;\n case 3 : // l\n nt.rotate(0f, 0f, PI);\n nt.rotate(0f, HALF_PI, 0f);\n break;\n case 4 : // d\n nt.rotate(0f, 0f, PI);\n nt.rotate(HALF_PI, 0f, 0f);\n break;\n case 5 : // b\n nt.rotate(0f, 0f, HALF_PI);\n nt.rotate(0f, PI, 0f);\n break;\n }\n // Finally, we concatenate the rotation to the vertex matrix\n vt.transform(nt);\n }\n\n\n // Center part\n identityVertexMatrix[centerOffset] = new idx3d_Matrix();\n identityNormalMatrix[centerOffset] = new idx3d_Matrix();\n\n // copy all vertex locationTransforms into the normal locationTransforms.\n // create the locationTransforms\n for (int i = 0; i < partCount; i++) {\n\n locationTransforms[i] = new idx3d_Group();\n locationTransforms[i].matrix.set(identityVertexMatrix[i]);\n locationTransforms[i].normalmatrix.set(identityNormalMatrix[i]);\n\n explosionTransforms[i] = new idx3d_Group();\n explosionTransforms[i].addChild(parts[i]);\n locationTransforms[i].addChild(explosionTransforms[i]);\n }\n }", "public AffineTransform getOldAffineTransform ( )\n {\n return oldAffineTransformation;\n }", "float[] getMVPMatrix();", "public mat4 getMatrix() {\n return worldMatrix;\n }", "public RMTransform getTransform()\n{\n return new RMTransform(getX(), getY(), getRoll(), getWidth()/2, getHeight()/2,\n getScaleX(), getScaleY(), getSkewX(), getSkewY());\n}", "public abstract Vector4fc mulProject(IMatrix4f mat);", "public int[][] transform(Matrix transformation) {\n\t\tList<Matrix> matrices = new ArrayList<Matrix>();\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tMatrix matrix = new Matrix(new double[][]{ { x[i] },\n\t\t\t\t\t\t\t\t\t\t\t\t\t { y[i] },\n\t\t\t\t\t\t\t\t\t\t\t\t\t { 1 }});\n\t\t\t//matrix.print(3, 3);\n\t\t\t//transformation.print(3, 3);\n\t\t\tmatrices.add(transformation.times(matrix));\n\t\t}\n\t\treturn matricesToPoly(matrices);\n\t}", "private void updateTransform() {\n Matrix matrix = new Matrix();\n float centerX = dataBinding.viewFinder.getWidth() / 2f;\n float centerY = dataBinding.viewFinder.getHeight() / 2f;\n int rotation = dataBinding.viewFinder.getDisplay().getRotation();\n int rotationDegrees = 0;\n switch (rotation) {\n case Surface.ROTATION_0:\n rotationDegrees = 0;\n break;\n case Surface.ROTATION_90:\n rotationDegrees = 90;\n break;\n case Surface.ROTATION_180:\n rotationDegrees = 180;\n break;\n case Surface.ROTATION_270:\n rotationDegrees = 270;\n break;\n default:\n }\n matrix.postRotate(-rotationDegrees, centerX, centerY);\n }", "public static Mat getTransformation(Mat ref, Mat ins) {\n final int warp_mode = MOTION_TRANSLATION;\n Mat warpMatrix = Mat.eye(2,3,CV_32F);\n try {\n int numIter = 50;\n double terminationEps = 1e-3;\n TermCriteria criteria = new TermCriteria(TermCriteria.COUNT + TermCriteria.EPS, numIter, terminationEps);\n double r= findTransformECC(ref, ins, warpMatrix, warp_mode, criteria, new Mat());\n if(r == -1){\n Log.e(TAG,\"Rc== -1\");\n return null;\n }\n }catch(Exception e){\n Log.e(TAG,\"Exception in FindTransformECC\");\n return null;\n }\n return warpMatrix;\n }", "private void getProperBaseMatrix(Matrix matrix) \r\n {\r\n \tif(mViewWidth == 0)\r\n \t\treturn;\r\n \t\r\n \tfloat w = mRoBitmap.getWidth();\r\n \tfloat h = mRoBitmap.getHeight();\r\n \t\r\n matrix.reset();\r\n // We limit up-scaling to 3x otherwise the result may look bad if it's\r\n // a small icon.\r\n float widthScale = (float)((float)mViewWidth / w);//Math.min((float)((float)mViewWidth / w), 3.0f);\r\n float heightScale = (float)((float)mViewHeight / h);//Math.min((float)((float)mViewHeight / h), 3.0f);\r\n float scale = Math.max(widthScale, heightScale);\r\n \r\n matrix.postConcat(mRoBitmap.getRotateMatrix());\r\n matrix.postScale(scale, scale);\r\n\r\n matrix.postTranslate(\r\n (mViewWidth - w * scale) / 2F,\r\n (mViewHeight - h * scale) / 2F);\r\n }", "private void setMToIdentity()\n\t\t{\n\t\t\tfor(rowNumber = 0; rowNumber < 4; rowNumber++)\n\t\t\t\tfor(int column = 0; column < 4; column++)\n\t\t\t\t{\n\t\t\t\t\tif(rowNumber == column)\n\t\t\t\t\t\tmElements[rowNumber*4 + column] = 1;\n\t\t\t\t\telse\n\t\t\t\t\t\tmElements[rowNumber*4 + column] = 0;\n\t\t\t\t}\n\t\t\ttransform = new Transform3D(mElements);\n\t\t\trowNumber = 0;\n\t\t}", "public void cameraTransform(Vector3f targ, Vector3f up) {\r\n\t\t// First normalize the target\r\n\t\tVector3f n = targ;\r\n\t\tn.normalize();\r\n\t\t// Then normalize the up vector\r\n\t\tVector3f u = up;\r\n\t\tu.normalize();\r\n\t\t// Then cross the two together to get the right vector\r\n\t\tu = u.cross(n);\r\n\t\tVector3f v = n.cross(u);\r\n\r\n\t\t// Finally build a matrix from the result\r\n\t\tm[0][0] = u.x; m[0][1] = u.y; m[0][2] = u.z; m[0][3] = 0.0f;\r\n\t\tm[1][0] = v.x; m[1][1] = v.y; m[1][2] = v.z; m[1][3] = 0.0f;\r\n\t\tm[2][0] = n.x; m[2][1] = n.y; m[2][2] = n.z; m[2][3] = 0.0f;\r\n\t\tm[3][0] = 0.0f; m[3][1] = 0.0f; m[3][2] = 0.0f; m[3][3] = 1.0f;\r\n\r\n\t}", "@Override\n\tpublic GAffineTransform getTransform(GeoConicND conic, Coords M,\n\t\t\tCoords[] ev) {\n\t\ttransform.setTransform(ev[0].getX(), ev[0].getY(), ev[1].getX(),\n\t\t\t\tev[1].getY(), M.getX(), M.getY());\n\n\t\treturn transform;\n\t}", "public Matrix transpose(){\r\n \tMatrix tmat = new Matrix(this.ncol, this.nrow);\r\n \tdouble[][] tarray = tmat.getArrayReference();\r\n \tfor(int i=0; i<this.ncol; i++){\r\n \t\tfor(int j=0; j<this.nrow; j++){\r\n \t\ttarray[i][j]=this.matrix[j][i];\r\n \t\t}\r\n \t}\r\n \treturn tmat;\r\n \t}", "public Matrix getGraphMatrix(){\n\t\treturn graphMatrix;\n\t}", "public TransformationMatrix(TransformationMatrix m) {\n\t\ta11 = m.a11; a12 = m.a12; a13 = m.a13; a14 = m.a14;\n\t\ta21 = m.a21; a22 = m.a22; a23 = m.a23; a24 = m.a24;\n\t\ta31 = m.a31; a32 = m.a32; a33 = m.a33; a34 = m.a34;\n\t}", "godot.wire.Wire.Transform getTransformValue();", "public void updateProjector(Matrix4f trans) {\r\n\t\tMatrix4f oldM = new Matrix4f(getProjector().getModelM());\r\n\t\tgetProjector().setModelM(trans.multiply(oldM.transpose()).transpose().toArray());\r\n\t}", "public Matrix getMatrix() {\n Matrix matrix2 = new Matrix();\n matrix2.set(this.matrix);\n return matrix2;\n }", "private static Node setupMatrix()\n {\n Node thomasAnderson = graphDb.createNode();\n thomasAnderson.setProperty( \"name\", \"Thomas Anderson\" );\n thomasAnderson.setProperty( \"age\", 29 );\n \n Node trinity = graphDb.createNode();\n trinity.setProperty( \"name\", \"Trinity\" );\n Relationship rel = thomasAnderson.createRelationshipTo( trinity, \n MatrixRelationshipTypes.KNOWS );\n rel.setProperty( \"age\", \"3 days\" );\n \n Node morpheus = graphDb.createNode();\n morpheus.setProperty( \"name\", \"Morpheus\" );\n morpheus.setProperty( \"rank\", \"Captain\" );\n morpheus.setProperty( \"occupation\", \"Total badass\" );\n thomasAnderson.createRelationshipTo( morpheus, MatrixRelationshipTypes.KNOWS );\n rel = morpheus.createRelationshipTo( trinity, \n MatrixRelationshipTypes.KNOWS );\n rel.setProperty( \"age\", \"12 years\" );\n \n Node cypher = graphDb.createNode();\n cypher.setProperty( \"name\", \"Cypher\" );\n cypher.setProperty( \"last name\", \"Reagan\" );\n rel = morpheus.createRelationshipTo( cypher, \n MatrixRelationshipTypes.KNOWS );\n rel.setProperty( \"disclosure\", \"public\" );\n \n Node smith = graphDb.createNode();\n smith.setProperty( \"name\", \"Agent Smith\" );\n smith.setProperty( \"version\", \"1.0b\" );\n smith.setProperty( \"language\", \"C++\" );\n rel = cypher.createRelationshipTo( smith, MatrixRelationshipTypes.KNOWS );\n rel.setProperty( \"disclosure\", \"secret\" );\n rel.setProperty( \"age\", \"6 months\" );\n \n Node architect = graphDb.createNode();\n architect.setProperty( \"name\", \"The Architect\" );\n smith.createRelationshipTo( architect, MatrixRelationshipTypes.CODED_BY );\n \n return thomasAnderson;\n }", "public Matrix getCurrentRotation() throws ManipulatorException;", "public AffineTransform getInitialCtm(\n )\n {\n AffineTransform initialCtm;\n if(getScanner().getRenderContext() == null) // Device-independent.\n {\n initialCtm = new AffineTransform(); // Identity.\n }\n else // Device-dependent.\n {\n IContentContext contentContext = getScanner().getContentContext();\n Dimension2D canvasSize = getScanner().getCanvasSize();\n\n // Axes orientation.\n RotationEnum rotation = contentContext.getRotation();\n switch(rotation)\n {\n case Downward:\n initialCtm = new AffineTransform(1, 0, 0, -1, 0, canvasSize.getHeight());\n break;\n case Leftward:\n initialCtm = new AffineTransform(0, 1, 1, 0, 0, 0);\n break;\n case Upward:\n initialCtm = new AffineTransform(-1, 0, 0, 1, canvasSize.getWidth(), 0);\n break;\n case Rightward:\n initialCtm = new AffineTransform(0, -1, -1, 0, canvasSize.getWidth(), canvasSize.getHeight());\n break;\n default:\n throw new NotImplementedException();\n }\n\n // Scaling.\n Rectangle2D contentBox = contentContext.getBox();\n Dimension2D rotatedCanvasSize = rotation.transform(canvasSize);\n initialCtm.scale(\n rotatedCanvasSize.getWidth() / contentBox.getWidth(),\n rotatedCanvasSize.getHeight() / contentBox.getHeight()\n );\n\n // Origin alignment.\n initialCtm.translate(-contentBox.getMinX(), -contentBox.getMinY());\n }\n return initialCtm;\n }", "Transform<A, B> getTransform();", "private SimilarityTransformation3D getCombinedTransfo3D(Document document,double sourcescale,double targetscale) {\n\t\tElement root = XMLUtil.getRootElement(document);\n\n\t\tArrayList<Element> transfoElementArrayList = XMLUtil.getElements(root,\n\t\t\t\t\"MatrixTransformation\");\n\t\t// int nbtransfo=transfoElementArrayList.size();\n\t\tArrayList<Matrix> listoftransfo = new ArrayList<Matrix>();\n\t\t\n\t\t//Matrix ScaleSourcetransfo=Matrix.identity(4, 4).times(sourcescale);\n\t\t//Matrix Scaletargettransfo=Matrix.identity(4, 4).times(1.0/targetscale);\n\t\tMatrix ScaleSourcetransfo=Matrix.identity(4, 4).times(sourcescale);\n\t\tScaleSourcetransfo.set(3,3,1.0);\n\t\tScaleSourcetransfo.set(2,2,1.0);//do not touch z\n\t\tMatrix Scaletargettransfo=Matrix.identity(4, 4).times(1.0/targetscale);\n\t\tScaletargettransfo.set(3,3,1.0);\n\t\tScaletargettransfo.set(2,2,1.0);//do not touch z\n\t\t//listoftransfo.add(ScaleSourcetransfo);\n\t\t// the default value of orisizex has to the actual pixel size:\n\t\t// otherwise during the initialisation (i.e the first tranform \n\t\t//when getcombined transform has nothing to return\n\t\tdouble orisizex=source.getValue().getPixelSizeX();\n\t\tdouble orisizey=source.getValue().getPixelSizeY();\n\t\tdouble orisizez=source.getValue().getPixelSizeZ();\n\t\tElement transfoElementf=transfoElementArrayList.get(0);\n\t\tdouble orisizexbinned=XMLUtil.getAttributeDoubleValue(transfoElementf, \"formerpixelsizeX\", 0);\n\t\t//double orisizeybinned=XMLUtil.getAttributeDoubleValue(transfoElementf, \"formerpixelsizeY\", 0);\n\t\t//double orisizezbinned=XMLUtil.getAttributeDoubleValue(transfoElementf, \"formerpixelsizeZ\", 0);\n\t\tif ((orisizex==orisizexbinned)&&(sourcescale!=1)){\n\t\t\tlistoftransfo.add(ScaleSourcetransfo);\n\t\t\tSystem.out.println(\"Warning something strange happened to your metadata. Check your binned metadata and these one.\");\n\t\t}\n\t\tfor (Element transfoElement : transfoElementArrayList) {\n\t\t\tdouble[][] m = new double[4][4];\n\t\t\t// int order = XMLUtil.getAttributeIntValue( transfoElement, \"order\"\n\t\t\t// , -1 ); //to be check for now only: has to be used!!!\n\t\t\t// the only different pixel size (i.e the orginal source size) is given only at the first transformation\n\t\t\t\n\t\t\t\n\t\t\tm[0][0] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m00\", 0);\n\t\t\tm[0][1] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m01\", 0);\n\t\t\tm[0][2] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m02\", 0);\n\t\t\tm[0][3] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m03\", 0);\n\n\t\t\tm[1][0] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m10\", 0);\n\t\t\tm[1][1] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m11\", 0);\n\t\t\tm[1][2] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m12\", 0);\n\t\t\tm[1][3] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m13\", 0);\n\n\t\t\tm[2][0] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m20\", 0);\n\t\t\tm[2][1] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m21\", 0);\n\t\t\tm[2][2] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m22\", 0);\n\t\t\tm[2][3] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m23\", 0);\n\n\t\t\tm[3][0] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m30\", 0);\n\t\t\tm[3][1] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m31\", 0);\n\t\t\tm[3][2] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m32\", 0);\n\t\t\tm[3][3] = XMLUtil.getAttributeDoubleValue(transfoElement, \"m33\", 0);\n\t\t\t\n\t\t\tMatrix T = new Matrix(m);\n\t\t\tlistoftransfo.add(T);\n\n\t\t}\n\t\tlistoftransfo.add(Scaletargettransfo);\n\t\tMatrix CombinedTransfo = Matrix.identity(4, 4);\n\t\tfor (int i = 0; i < listoftransfo.size(); i++) {\n\t\t\tCombinedTransfo = listoftransfo.get(i).times(CombinedTransfo);\n\t\t}\n\t\t\n\t\t\n\t\tSimilarityTransformation3D resulttransfo=new SimilarityTransformation3D(CombinedTransfo,orisizex,orisizey,orisizez);\n\t\treturn resulttransfo;\n\t\n}", "public void updateTransform() {\n \t\tif (viewBox != null) {\n \t\t\tOMSVGRect bbox = ((SVGRectElement)viewBox.getElement()).getBBox();\n //\t\t\tGWT.log(\"bbox = \" + bbox.getDescription());\n \t\t\tfloat d = (float)Math.sqrt((bbox.getWidth() * bbox.getWidth() + bbox.getHeight() * bbox.getHeight()) * 0.25) * scale * 2;\n //\t\t\tGWT.log(\"d = \" + d);\n \t\t\n \t\t\t// Compute the actual canvas size. It is the max of the window rect\n \t\t\t// and the transformed bbox.\n \t\t\tfloat width = Math.max(d, windowRect.getWidth());\n \t\t\tfloat height = Math.max(d, windowRect.getHeight());\n //\t\t\tGWT.log(\"width = \" + width);\n //\t\t\tGWT.log(\"height = \" + height);\n \n \t\t\t// Compute the display transform to center the image in the\n \t\t\t// canvas\n \t\t\tOMSVGMatrix m = svg.createSVGMatrix();\n \t\t\tfloat cx = bbox.getCenterX();\n \t\t\tfloat cy = bbox.getCenterY();\n \t\t\tm = m.translate(0.5f * (width - bbox.getWidth()) -bbox.getX(), 0.5f * (height - bbox.getHeight()) -bbox.getY())\n \t\t\t.translate(cx, cy)\n \t\t\t.rotate(angle)\n \t\t\t.scale(scale)\n \t\t\t.translate(-cx, -cy);\n \t\t\t((ISVGTransformable)xformGroup).getTransform().getBaseVal().getItem(0).setMatrix(m);\n \t\t\t((ISVGTransformable)modelGroup.getTwinWrapper()).getTransform().getBaseVal().getItem(0).setMatrix(m);\n //\t\t\tGWT.log(\"m=\" + m.getDescription());\n \t\t\tsvg.getStyle().setWidth(width, Unit.PX);\n \t\t\tsvg.getStyle().setHeight(height, Unit.PX);\n \t\t}\n \t}", "public AffineTransform3D getInverse()\r\n\t\t\tthrows NoninvertibleTransform3DException {\r\n\t\tAffineTransform3D inverseMat = new AffineTransform3D();\r\n\t\tdouble Det = getDeterminant();\r\n\r\n\t\tif (Det == 0) {\r\n\t\t\tthrow new NoninvertibleTransform3DException();\r\n\t\t}\r\n\t\tAffineTransform3D rv = new AffineTransform3D();\r\n\t\trv.M11 = (M23 * M34 * M42) - (M24 * M33 * M42) + (M24 * M32 * M43)\r\n\t\t\t\t- (M22 * M34 * M43) - (M23 * M32 * M44) + (M22 * M33 * M44);\r\n\t\trv.M12 = (M14 * M33 * M42) - (M13 * M34 * M42) - (M14 * M32 * M43)\r\n\t\t\t\t+ (M12 * M34 * M43) + (M13 * M32 * M44) - (M12 * M33 * M44);\r\n\t\trv.M13 = (M13 * M24 * M42) - (M14 * M23 * M42) + (M14 * M22 * M43)\r\n\t\t\t\t- (M12 * M24 * M43) - (M13 * M22 * M44) + (M12 * M23 * M44);\r\n\t\trv.M14 = (M14 * M23 * M32) - (M13 * M24 * M32) - (M14 * M22 * M33)\r\n\t\t\t\t+ (M12 * M24 * M33) + (M13 * M22 * M34) - (M12 * M23 * M34);\r\n\t\trv.M21 = (M24 * M33 * M41) - (M23 * M34 * M41) - (M24 * M31 * M43)\r\n\t\t\t\t+ (M21 * M34 * M43) + (M23 * M31 * M44) - (M21 * M33 * M44);\r\n\t\trv.M22 = (M13 * M34 * M41) - (M14 * M33 * M41) + (M14 * M31 * M43)\r\n\t\t\t\t- (M11 * M34 * M43) - (M13 * M31 * M44) + (M11 * M33 * M44);\r\n\t\trv.M23 = (M14 * M23 * M41) - (M13 * M24 * M41) - (M14 * M21 * M43)\r\n\t\t\t\t+ (M11 * M24 * M43) + (M13 * M21 * M44) - (M11 * M23 * M44);\r\n\t\trv.M24 = (M13 * M24 * M31) - (M14 * M23 * M31) + (M14 * M21 * M33)\r\n\t\t\t\t- (M11 * M24 * M33) - (M13 * M21 * M34) + (M11 * M23 * M34);\r\n\t\trv.M31 = (M22 * M34 * M41) - (M24 * M32 * M41) + (M24 * M31 * M42)\r\n\t\t\t\t- (M21 * M34 * M42) - (M22 * M31 * M44) + (M21 * M32 * M44);\r\n\t\trv.M32 = (M14 * M32 * M41) - (M12 * M34 * M41) - (M14 * M31 * M42)\r\n\t\t\t\t+ (M11 * M34 * M42) + (M12 * M31 * M44) - (M11 * M32 * M44);\r\n\t\trv.M33 = (M12 * M24 * M41) - (M14 * M22 * M41) + (M14 * M21 * M42)\r\n\t\t\t\t- (M11 * M24 * M42) - (M12 * M21 * M44) + (M11 * M22 * M44);\r\n\t\trv.M34 = (M14 * M22 * M31) - (M12 * M24 * M31) - (M14 * M21 * M32)\r\n\t\t\t\t+ (M11 * M24 * M32) + (M12 * M21 * M34) - (M11 * M22 * M34);\r\n\t\trv.M41 = (M23 * M32 * M41) - (M22 * M33 * M41) - (M23 * M31 * M42)\r\n\t\t\t\t+ (M21 * M33 * M42) + (M22 * M31 * M43) - (M21 * M32 * M43);\r\n\t\trv.M42 = (M12 * M33 * M41) - (M13 * M32 * M41) + (M13 * M31 * M42)\r\n\t\t\t\t- (M11 * M33 * M42) - (M12 * M31 * M43) + (M11 * M32 * M43);\r\n\t\trv.M43 = (M13 * M22 * M41) - (M12 * M23 * M41) - (M13 * M21 * M42)\r\n\t\t\t\t+ (M11 * M23 * M42) + (M12 * M21 * M43) - (M11 * M22 * M43);\r\n\t\trv.M44 = (M12 * M23 * M31) - (M13 * M22 * M31) + (M13 * M21 * M32)\r\n\t\t\t\t- (M11 * M23 * M32) - (M12 * M21 * M33) + (M11 * M22 * M33);\r\n\r\n\t\tDet = (1 / getDeterminant());\r\n\t\tinverseMat = ScalarMult(new AffineTransform3D(), Det); // MatrixScaling4(VectorInput(Det,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Det, Det),\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Det)\r\n\t\trv = MatrixMult(rv, inverseMat);\r\n\t\treturn rv;\r\n\t}", "public AffineTransform getCtm(\n )\n {return ctm;}", "Matrix transpose(){\n int newMatrixSize = this.getSize();\n Matrix newM = new Matrix(newMatrixSize);\n for(int i = 1; i <= newMatrixSize; i++){\n List itRow = rows[i - 1];\n // if(!itRow[i].isEmpty()){\n itRow.moveFront();\n // itRow[i].moveFront();\n while(itRow.index() != -1){\n Entry c = (Entry)itRow.get();\n newM.changeEntry(c.column, i, c.value);\n itRow.moveNext();\n }\n }\n return newM;\n }", "private Matrix toMatrix(Object o) {\n\t\tif(o instanceof String) {\n\t\t\tif(!isMatrix((String) o)) return null;\n\t\t\telse if(o.equals(\"A\")) return a;\n\t\t\telse return b;\n\t\t}\n\t\telse if(o instanceof Matrix) return (Matrix) o;\n\t\telse return null;\n\t}", "protected void establishTransformationMatrix(final AffineTransform at) {\n saveGraphicsState();\n concatenateTransformationMatrix(UnitConv.mptToPt(at));\n }", "public static long[][] rotate(long[][] matrix){\n int n = matrix[0].length;\n\n // We are going from the outside to the inside of the matrix\n for(int layer=0; layer<n/2; layer++){\n\n // The boundaries of the current layer\n int first = layer;\n int last = n - (layer + 1);\n\n // Swap each edge of the layer to the next edge\n for(int j=layer; j<last; j++){\n\n // The offset for the current pixel \n int offset = j - first;\n\n // Save the values of the pixels that will be swapped\n long pixelTop = matrix[first][j];\n long pixelRight = matrix[j][last];\n long pixelBottom = matrix[last][last-offset];\n long pixelLeft = matrix[last-offset][first];\n\n // Swap Top to Right\n matrix[j][last] = pixelTop;\n\n // Swap Right to Bottom\n matrix[last][last-offset] = pixelRight;\n\n // Swap Bottom to Left\n matrix[last-offset][first] = pixelBottom;\n\n // Swap Left to Top\n matrix[first][j] = pixelLeft;\n }\n }\n\n return matrix;\n }", "public void setTransform(float a11, float a12, float a21, float a22, float x, float y);", "public T caseM2MTransformation(M2MTransformation object) {\n\t\treturn null;\n\t}", "public float [][] GetMatrix() {\n \n\t/*\n\tinputs--\n\t*/\n\t\n\t/*\n\toutputs--\n\t\n\tmat_f_m :\n\t The self matrix\n\t*/\n\t\n\treturn this.mat_f_m;\n \n }", "Transforms getTransforms();", "@Override\n\tpublic Matrix getCurrentImageViewMatrix() {\n\t\treturn mContext.getMainImage().getDisplayMatrix();\n\t}", "Mat rotateMatCW(Mat src ) {\n Mat rotationMatrix = Imgproc.getRotationMatrix2D(new Point(src.cols()/2,src.rows()/2),270,1);\n\n //Rotating the given image\n Imgproc.warpAffine(src, result,rotationMatrix, new Size(src.cols(), src.rows()));\n return result;\n }", "@Override\n\t\tpublic GLGroupTransform transforms() { return transforms; }", "public void establishOldAffineTransform ( Graphics2D graphics2d )\n {\n oldAffineTransformation = graphics2d.getTransform ( );\n }", "protected void compute_mvpMatrix(float[] VPMatrix) {\n Matrix.multiplyMM(tempMatrix, 0, modelMatrix, 0, accumulatedRotation, 0);\n\n // ... e applica la matrice che contiene il risultato della matrice view e di proiezione\n Matrix.multiplyMM(mvpMatrix, 0, VPMatrix, 0, tempMatrix, 0);\n }", "public RMTransform getTransformFromShape(RMShape aShape)\n{\n // The transform from parent is just our inverse transform, transform from child is just child's transform\n if(aShape==getParent())\n return getTransformInverse();\n if(aShape!=null && this==aShape.getParent())\n return aShape.getTransform();\n\n // Return the inverse of transform to shape\n return getTransformToShape(aShape).invert();\n}", "public Mat4x4 getMatView() {\n Mat4x4 matCameraRotX = MatrixMath.matrixMakeRotationX(cameraRot.getX());\n Mat4x4 matCameraRotY = MatrixMath.matrixMakeRotationY(cameraRot.getY());\n Mat4x4 matCameraRotZ = MatrixMath.matrixMakeRotationZ(cameraRot.getZ());\n Mat4x4 matCameraRotXY = MatrixMath.matrixMultiplyMatrix(matCameraRotX, matCameraRotY);\n Mat4x4 matCameraRot = MatrixMath.matrixMultiplyMatrix(matCameraRotXY, matCameraRotZ);\n matCamera = calculateMatCamera(up, target, matCameraRot);\n matView = MatrixMath.matrixQuickInverse(matCamera);\n return matView;\n }", "breeze.linalg.DenseMatrix<java.lang.Object> toBreeze () { throw new RuntimeException(); }", "public final Transformation getTransformation() {\n\t\treturn transform;\n\t}", "public Tree transformTree(Tree t) {\n return QPtransform(t);\n }", "private void transformObject(int x, int y) {\n double sx, sy, l, r, nx, ny, tx, ty, alpha, origCX = 0, origCY = 0;\n Rectangle bnds;\n\n if(curr_obj == transformPointers[Action.ROTATE]) {\n /* the mouse vector 1 */\n GeoVector mouseVector = new GeoVector(x, y, this.aux_obj.getCenterX(), this.aux_obj.getCenterY());\n\n /* the rotation vector. i.e. the fixed vector that will be used as origin composed by the subtraction of the object center with the rotation point */\n GeoVector rotationVector = new GeoVector(this.lastPosition[0], this.lastPosition[1], this.aux_obj.getCenterX(), this.aux_obj.getCenterY());\n\n mouseVector.normalize();\n rotationVector.normalize();\n\n alpha = mouseVector.getAngleWith(rotationVector.getX(), rotationVector.getY());\n\n /** After passing the 180 degrees, the atan2 function returns a negative angle from 0 to PI. So this will convert the final gobal angle to 0-2PI */\n if(alpha < 0 ) {\n alpha = (2 * Math.PI) + alpha; \n }\n\n alpha -= this.currRotation;\n this.currRotation += alpha;\n\n Point c = new Point(this.aux_obj.getCenterX(), this.aux_obj.getCenterY());\n this.aux_obj.uRotate((float)(-1.0*(alpha*(180/Math.PI))), c);\n \n } else {\n alpha = this.aux_obj.getRotation();\n\n /** Here we rotate the selected Graphic Object, it's tranformation points and the mouse coordinates back to the zero angle, to permit a correct object scalling. */\n if(alpha != 0.0) {\n origCX = this.aux_obj.getCenterX();\n origCY = this.aux_obj.getCenterY();\n this.aux_obj.uRotate((float)(alpha*-1.0), this.aux_obj.getCenter());\n rotateTransformPoints(alpha);\n GeoVector mouseCoord = new GeoVector(x, y, this.aux_obj.getCenterX(), this.aux_obj.getCenterY());\n\n mouseCoord.rotate( ((alpha*-1.0) * (2.0*Math.PI))/360 );\n mouseCoord.addPoint(this.aux_obj.getCenterX(), this.aux_obj.getCenterY());\n x = (int)mouseCoord.getX();\n y = (int)mouseCoord.getY();\n\n }\n\n /** Tatami rotates the object from it's x and y point to the edges. So this means that sometimes we need to translate the object a few pixels to asure that it's upper left corner is on the same position. */\n if(curr_obj == transformPointers[Action.NORTHWEST]) {\n if(x < (transformPointers[Action.EAST].getX()-2) && y < (transformPointers[Action.SOUTH].getY()-2)) {\n l = aux_obj.getX() - (transformPointers[Action.WEST].getX()+2);\n r = (transformPointers[Action.EAST].getX()+2) - aux_obj.getX();\n nx = (transformPointers[Action.EAST].getX()+2) - x ;\n sx = nx / (l+r);\n tx = (sx*l-l) + (sx*r-r);\n\n l = aux_obj.getY() - (transformPointers[Action.NORTH].getY()+2);\n r = (transformPointers[Action.SOUTH].getY()+2) - aux_obj.getY();\n ny = (transformPointers[Action.SOUTH].getY()+2) - y;\n sy = ny / (l+r);\n ty = (sy*l-l) + (sy*r-r);\n\n aux_obj.uTranslate((int)-tx, (int)-ty);\n aux_obj.scale( (float)sx, (float)sy);\n\n if(alpha != 0.0) {\n this.aux_obj.uTranslate((int)(origCX - this.aux_obj.getCenterX()), (int)(origCY - this.aux_obj.getCenterY()));\n this.aux_obj.rotate((float)alpha);\n }\n\n canvas.remove(transformPoints);\n transformPoints.clear();\n bnds = aux_obj.getBounds();\n createTransformPoints(bnds, aux_obj);\n curr_obj = transformPointers[Action.NORTHWEST];\n }\n } else if(curr_obj == transformPointers[Action.NORTH]) {\n if(y < (transformPointers[Action.SOUTH].getY()-2)) {\n l = aux_obj.getY() - (transformPointers[Action.NORTH].getY()+2);\n r = (transformPointers[Action.SOUTH].getY()+2) - aux_obj.getY();\n ny = (transformPointers[Action.SOUTH].getY()+2) - y;\n sy = ny / (l+r);\n ty = (sy*l-l) + (sy*r-r);\n\n aux_obj.uTranslate(0, (int)-ty);\n aux_obj.scale( 1, (float)sy);\n\n if(alpha != 0.0) {\n this.aux_obj.uTranslate((int)(origCX - this.aux_obj.getCenterX()), (int)(origCY - this.aux_obj.getCenterY()));\n this.aux_obj.rotate((float)alpha);\n }\n\n canvas.remove(transformPoints);\n transformPoints.clear();\n bnds = aux_obj.getBounds();\n createTransformPoints(bnds, aux_obj);\n curr_obj = transformPointers[Action.NORTH];\n }\n } else if(curr_obj == transformPointers[Action.NORTHEAST]) {\n if(x > (transformPointers[Action.WEST].getX()+2) && y < (transformPointers[Action.SOUTH].getY()-2)) {\n l = aux_obj.getX() - (transformPointers[Action.WEST].getX()+2);\n r = (transformPointers[Action.EAST].getX()+2) - aux_obj.getX();\n nx = x - (transformPointers[Action.WEST].getX()+2);\n sx = nx / (l+r);\n tx = sx*l-l;\n\n l = aux_obj.getY() - (transformPointers[Action.NORTH].getY()+2);\n r = (transformPointers[Action.SOUTH].getY()+2) - aux_obj.getY();\n ny = (transformPointers[Action.SOUTH].getY()+2) - y;\n sy = ny / (l+r);\n ty = (sy*l-l) + (sy*r-r);\n\n aux_obj.uTranslate((int)tx, (int)-ty);\n aux_obj.scale( (float)sx, (float)sy);\n\n if(alpha != 0.0) {\n this.aux_obj.uTranslate((int)(origCX - this.aux_obj.getCenterX()), (int)(origCY - this.aux_obj.getCenterY()));\n this.aux_obj.rotate((float)alpha);\n }\n\n canvas.remove(transformPoints);\n transformPoints.clear();\n bnds = aux_obj.getBounds();\n createTransformPoints(bnds, aux_obj);\n curr_obj = transformPointers[Action.NORTHEAST];\n }\n\n } else if(curr_obj == transformPointers[Action.WEST]) {\n if(x < (transformPointers[Action.EAST].getX()-2) ) {\n l = aux_obj.getX() - (transformPointers[Action.WEST].getX()+2);\n r = (transformPointers[Action.EAST].getX()+2) - aux_obj.getX();\n nx = (transformPointers[Action.EAST].getX()+2) - x ;\n sx = nx / (l+r);\n tx = (sx*l-l) + (sx*r-r);\n\n aux_obj.uTranslate((int)-tx, 0);\n aux_obj.scale( (float)sx, 1);\n\n if(alpha != 0.0) {\n this.aux_obj.uTranslate((int)(origCX - this.aux_obj.getCenterX()), (int)(origCY - this.aux_obj.getCenterY()));\n this.aux_obj.rotate((float)alpha);\n }\n\n canvas.remove(transformPoints);\n transformPoints.clear();\n\n bnds = aux_obj.getBounds();\n createTransformPoints(bnds, aux_obj);\n curr_obj = transformPointers[Action.WEST];\n }\n } else if(curr_obj == transformPointers[Action.EAST]) {\n if(x > (transformPointers[Action.WEST].getX()+2) ) {\n l = aux_obj.getX() - (transformPointers[Action.WEST].getX()+2);\n r = (transformPointers[Action.EAST].getX()+2) - aux_obj.getX();\n nx = x - (transformPointers[Action.WEST].getX()+2);\n sx = nx / (l+r);\n tx = sx*l-l;\n\n aux_obj.uTranslate((int)tx, 0);\n aux_obj.scale( (float)sx, (float)1);\n\n if(alpha != 0.0) {\n this.aux_obj.uTranslate((int)(origCX - this.aux_obj.getCenterX()), (int)(origCY - this.aux_obj.getCenterY()));\n this.aux_obj.rotate((float)alpha);\n }\n\n canvas.remove(transformPoints);\n transformPoints.clear();\n bnds = aux_obj.getBounds();\n createTransformPoints(bnds, aux_obj);\n curr_obj = transformPointers[Action.EAST];\n }\n } else if(curr_obj == transformPointers[Action.SOUTHWEST]) {\n if(x < (transformPointers[Action.EAST].getX()-2) && y > (transformPointers[Action.NORTH].getY()+2)) {\n l = aux_obj.getX() - (transformPointers[Action.WEST].getX()+2);\n r = (transformPointers[Action.EAST].getX()+2) - aux_obj.getX();\n nx = (transformPointers[Action.EAST].getX()+2) - x ;\n sx = nx / (l+r);\n tx = (sx*l-l) + (sx*r-r);\n\n l = aux_obj.getY() - (transformPointers[Action.NORTH].getY()+2);\n r = (transformPointers[Action.SOUTH].getY()+2) - aux_obj.getY();\n ny = y - (transformPointers[Action.NORTH].getY()+2);\n sy = ny / (l+r);\n ty = sy*l-l;\n\n aux_obj.uTranslate((int)-tx, (int)ty);\n aux_obj.scale( (float)sx, (float)sy);\n\n if(alpha != 0.0) {\n this.aux_obj.uTranslate((int)(origCX - this.aux_obj.getCenterX()), (int)(origCY - this.aux_obj.getCenterY()));\n this.aux_obj.rotate((float)alpha);\n }\n\n canvas.remove(transformPoints);\n transformPoints.clear();\n bnds = aux_obj.getBounds();\n createTransformPoints(bnds, aux_obj);\n curr_obj = transformPointers[Action.SOUTHWEST];\n }\n } else if(curr_obj == transformPointers[Action.SOUTH]) {\n if(y > (transformPointers[Action.NORTH].getY()+2)) {\n l = aux_obj.getY() - (transformPointers[Action.NORTH].getY()+2);\n r = (transformPointers[Action.SOUTH].getY()+2) - aux_obj.getY();\n ny = y - (transformPointers[Action.NORTH].getY()+2);\n sy = ny / (l+r);\n ty = sy*l-l;\n\n aux_obj.uTranslate(0, (int)ty);\n aux_obj.scale( 1, (float)sy);\n\n if(alpha != 0.0) {\n this.aux_obj.uTranslate((int)(origCX - this.aux_obj.getCenterX()), (int)(origCY - this.aux_obj.getCenterY()));\n this.aux_obj.rotate((float)alpha);\n }\n\n canvas.remove(transformPoints);\n transformPoints.clear();\n bnds = aux_obj.getBounds();\n createTransformPoints(bnds, aux_obj);\n curr_obj = transformPointers[Action.SOUTH];\n }\n } else if(curr_obj == transformPointers[Action.SOUTHEAST]) {\n if(x > (transformPointers[Action.WEST].getX()+2) && y > (transformPointers[Action.NORTH].getY()+2)) {\n\n l = aux_obj.getX() - (transformPointers[Action.WEST].getX()+2);\n r = (transformPointers[Action.EAST].getX()+2) - aux_obj.getX();\n nx = x - (transformPointers[Action.WEST].getX()+2);\n sx = nx / (l+r);\n tx = sx*l-l;\n\n l = aux_obj.getY() - (transformPointers[Action.NORTH].getY()+2);\n r = (transformPointers[Action.SOUTH].getY()+2) - aux_obj.getY();\n ny = y - (transformPointers[Action.NORTH].getY()+2);\n sy = ny / (l+r);\n ty = sy*l-l;\n\n aux_obj.uTranslate((int)tx, (int)ty);\n aux_obj.scale( (float)sx, (float)sy);\n\n if(alpha != 0.0) {\n this.aux_obj.uTranslate((int)(origCX - this.aux_obj.getCenterX()), (int)(origCY - this.aux_obj.getCenterY()));\n this.aux_obj.rotate((float)alpha);\n }\n\n canvas.remove(transformPoints);\n transformPoints.clear();\n bnds = aux_obj.getBounds();\n createTransformPoints(bnds, aux_obj);\n curr_obj = transformPointers[Action.SOUTHEAST];\n }\n }\n\n\n }\n \n }", "public final native void transform(String transform, Element node) /*-{ this.transform(transform, node) }-*/;", "public static Matrix getTransformMatrix(int width, int height, int rotation) {\n Matrix matrix = new Matrix();\n\n // Compute the center of the view finder\n float centerX = width / 2f;\n float centerY = height / 2f;\n\n // Correct preview output to account for display rotation\n float rotationDegrees =\n OrientationUtil.displayRotationToDegrees(rotation);\n matrix.postRotate(-rotationDegrees, centerX, centerY);\n\n return matrix;\n }", "public Matrix getCofactor() throws InvalidMoveException {\r\n Matrix x = new Matrix(matrix.length, matrix[0].length);\r\n for (int i = 0; i < matrix.length; i++) {\r\n for (int j = 0; j < matrix.length; j++) {\r\n x.setValue(i, j, ((i + j) % 2 == 0 ? 1 : -1) * getSubmatrix(i, j).getDeterminant()\r\n );\r\n }\r\n }\r\n return x;\r\n }", "@Override\n public Matrix idct(final MatrixView in) {\n check(in);\n double[][] out = new double[in.getRows()][in.getColumns()];\n double tmp1, tmp2, tmp3, tmp4;\n double tmpm0 = 0, tmpm1 = 0, tmpm2 = 0, tmpm3 = 0, tmpm4 = 0, tmpm5 = 0, tmpm6 = 0, tmpm7 = 0;\n double tmpm20, tmpm21, tmpm22, tmpm23, tmpm24, tmpm25, tmpm26, tmpm27 = 0;\n double[] outtmpmyi = null;\n\n for (int my = 0; my < in.getRows(); my += SIZE) {\n for (int mx = 0; mx < in.getColumns(); mx += SIZE) {\n for (int i = 0; i < 8; i++) {\n outtmpmyi = out[my + i];\n\n tmpm0 = in.getDouble(my + i, mx + 0);\n tmpm1 = in.getDouble(my + i, mx + 1);\n tmpm2 = in.getDouble(my + i, mx + 2);\n tmpm3 = in.getDouble(my + i, mx + 3);\n tmpm4 = in.getDouble(my + i, mx + 4);\n tmpm5 = in.getDouble(my + i, mx + 5);\n tmpm6 = in.getDouble(my + i, mx + 6);\n tmpm7 = in.getDouble(my + i, mx + 7);\n\n tmp1 = (tmpm1 * Z7) - (tmpm7 * Z1);\n tmp4 = (tmpm7 * Z7) + (tmpm1 * Z1);\n tmp2 = (tmpm5 * Z3) - (tmpm3 * Z5);\n tmp3 = (tmpm3 * Z3) + (tmpm5 * Z5);\n\n tmpm20 = (tmpm0 + tmpm4) * Z4;\n tmpm21 = (tmpm0 - tmpm4) * Z4;\n tmpm22 = (tmpm2 * Z6) - (tmpm6 * Z2);\n tmpm23 = (tmpm6 * Z6) + (tmpm2 * Z2);\n tmpm4 = tmp1 + tmp2;\n tmpm25 = tmp1 - tmp2;\n tmpm26 = tmp4 - tmp3;\n tmpm7 = tmp4 + tmp3;\n\n tmpm5 = (tmpm26 - tmpm25) * Z0;\n tmpm6 = (tmpm26 + tmpm25) * Z0;\n tmpm0 = tmpm20 + tmpm23;\n tmpm1 = tmpm21 + tmpm22;\n tmpm2 = tmpm21 - tmpm22;\n tmpm3 = tmpm20 - tmpm23;\n\n outtmpmyi[mx + 0] = tmpm0 + tmpm7;\n outtmpmyi[mx + 7] = tmpm0 - tmpm7;\n outtmpmyi[mx + 1] = tmpm1 + tmpm6;\n outtmpmyi[mx + 6] = tmpm1 - tmpm6;\n outtmpmyi[mx + 2] = tmpm2 + tmpm5;\n outtmpmyi[mx + 5] = tmpm2 - tmpm5;\n outtmpmyi[mx + 3] = tmpm3 + tmpm4;\n outtmpmyi[mx + 4] = tmpm3 - tmpm4;\n\n }\n\n for (int i = 0; i < 8; i++) {\n\n tmpm0 = out[my + 0][mx + i];\n tmpm1 = out[my + 1][mx + i];\n tmpm2 = out[my + 2][mx + i];\n tmpm3 = out[my + 3][mx + i];\n tmpm4 = out[my + 4][mx + i];\n tmpm5 = out[my + 5][mx + i];\n tmpm6 = out[my + 6][mx + i];\n tmpm7 = out[my + 7][mx + i];\n\n tmp1 = (tmpm1 * Z7) - (tmpm7 * Z1);\n tmp4 = (tmpm7 * Z7) + (tmpm1 * Z1);\n tmp2 = (tmpm5 * Z3) - (tmpm3 * Z5);\n tmp3 = (tmpm3 * Z3) + (tmpm5 * Z5);\n\n tmpm20 = (tmpm0 + tmpm4) * Z4;\n tmpm21 = (tmpm0 - tmpm4) * Z4;\n tmpm22 = (tmpm2 * Z6) - (tmpm6 * Z2);\n tmpm23 = (tmpm6 * Z6) + (tmpm2 * Z2);\n tmpm4 = tmp1 + tmp2;\n tmpm25 = tmp1 - tmp2;\n tmpm26 = tmp4 - tmp3;\n tmpm7 = tmp4 + tmp3;\n\n tmpm5 = (tmpm26 - tmpm25) * Z0;\n tmpm6 = (tmpm26 + tmpm25) * Z0;\n tmpm0 = tmpm20 + tmpm23;\n tmpm1 = tmpm21 + tmpm22;\n tmpm2 = tmpm21 - tmpm22;\n tmpm3 = tmpm20 - tmpm23;\n\n out[my + 0][mx + i] = tmpm0 + tmpm7;\n out[my + 7][mx + i] = tmpm0 - tmpm7;\n out[my + 1][mx + i] = tmpm1 + tmpm6;\n out[my + 6][mx + i] = tmpm1 - tmpm6;\n out[my + 2][mx + i] = tmpm2 + tmpm5;\n out[my + 5][mx + i] = tmpm2 - tmpm5;\n out[my + 3][mx + i] = tmpm3 + tmpm4;\n out[my + 4][mx + i] = tmpm3 - tmpm4;\n }\n }\n }\n\n return new DoubleMatrix(in.getRows(), in.getColumns(), out);\n }", "public Matrix getMatrix() {\n\t\treturn matrix;\n\t}", "private Matrix33d getMatrix() {\n final Matrix33d m = new Matrix33d();\n m.setMatrixColumn(new Vector3d(V1), 0);\n m.setMatrixColumn(new Vector3d(V2), 1);\n m.setMatrixColumn(new Vector3d(V3), 2);\n return m;\n }" ]
[ "0.7018898", "0.641472", "0.63433087", "0.6036976", "0.5983408", "0.58233696", "0.5696849", "0.5594494", "0.55913264", "0.5516216", "0.5467459", "0.54497975", "0.5440533", "0.5418719", "0.5320094", "0.52544165", "0.5190305", "0.5177721", "0.5170624", "0.5167507", "0.5161176", "0.5066861", "0.50460774", "0.5037764", "0.4995362", "0.4994203", "0.4989753", "0.49829912", "0.49688813", "0.4962648", "0.49618635", "0.49501133", "0.49440497", "0.49369484", "0.4926818", "0.48965615", "0.48958707", "0.48930427", "0.48762962", "0.4872819", "0.48684096", "0.48551536", "0.48183152", "0.47875306", "0.47873685", "0.47864386", "0.47729835", "0.47637653", "0.4762878", "0.47628418", "0.47509074", "0.4750339", "0.47253567", "0.47093612", "0.46930087", "0.4689774", "0.46876067", "0.46872467", "0.4660155", "0.46486083", "0.4646908", "0.46404722", "0.46340868", "0.46285987", "0.45978892", "0.45491913", "0.45485383", "0.45433384", "0.45334572", "0.45306692", "0.4522448", "0.4522311", "0.45107895", "0.4509261", "0.45064375", "0.45024917", "0.4499832", "0.44857383", "0.44726503", "0.44666865", "0.44625255", "0.4461442", "0.44599488", "0.44565812", "0.44515017", "0.44501758", "0.4441525", "0.4438925", "0.4438509", "0.44349092", "0.44319984", "0.44316056", "0.44189152", "0.44065866", "0.43995115", "0.43858558", "0.4384014", "0.4383763", "0.4376391", "0.43736362" ]
0.63012767
3
////////////////////////////////////////////////////////////////////// Description: Returns the intersection point in object space that corresponds to the given node in the path. Use: public java port
public SbVec3f getObjectPoint() { return getObjectPoint(null); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Object getPoint(EastNorth intersection) {\n\t\treturn null;\n\t}", "public Point2D.Float getIntersectionPoint(Line2D.Float line,\n Point2D.Float intersection)\n {\n if (intersection == null) {\n intersection = new Point2D.Float();\n }\n float fraction = getIntersection(line);\n intersection.setLocation(\n x1 + fraction * (x2 - x1),\n y1 + fraction * (y2 - y1));\n return intersection;\n }", "public Point2D.Double\ngetLineIntersectPoint(BLine2D line)\n{\n\treturn (getSegmentIntersectPoint(line));\n}", "public Position3D getIntersect(Line3D other) {\r\n\t\tif (this.isParallel(other)) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\tdouble t = (this.d - this.norm.dot(other.getPos())) / this.norm.dot(other.getDir());\r\n\t\treturn other.getLinePoint(t);\r\n\t}", "@Override\n public Intersection getIntersectionNorth(){\n if(!mapLoaded){\n return null;\n }\n return extremIntersection[0];\n }", "@JsMethod\n public native Cartographic findIntersectionWithLatitude(double intersectionLatitude);", "public Coordinates intersection() {\n return intersection;\n }", "public float getIntersection(Line2D.Float line) {\n // The intersection point I, of two vectors, A1->A2 and\n // B1->B2, is:\n // I = A1 + Ua * (A2 - A1)\n // I = B1 + Ub * (B2 - B1)\n //\n // Solving for Ua gives us the following formula.\n // Ua is returned.\n float denominator = (line.y2 - line.y1) * (x2 - x1) -\n (line.x2 - line.x1) * (y2 - y1);\n\n // check if the two lines are parallel\n if (denominator == 0) {\n return -1;\n }\n\n float numerator = (line.x2 - line.x1) * (y1 - line.y1) -\n (line.y2 - line.y1) * (x1 - line.x1);\n\n return numerator / denominator;\n }", "public Point2D.Float getIntersectionPoint(Line2D.Float line) {\n return getIntersectionPoint(line, null);\n }", "public Intersection getIntersection() {\r\n\t\tif (intersection == null)\r\n\t\t\tcomputeIntersectionPoint();\r\n\t\treturn intersection;\r\n\t}", "public org.landxml.schema.landXML11.IntersectionDocument.Intersection getIntersection()\r\n {\r\n synchronized (monitor())\r\n {\r\n check_orphaned();\r\n org.landxml.schema.landXML11.IntersectionDocument.Intersection target = null;\r\n target = (org.landxml.schema.landXML11.IntersectionDocument.Intersection)get_store().find_element_user(INTERSECTION$0, 0);\r\n if (target == null)\r\n {\r\n return null;\r\n }\r\n return target;\r\n }\r\n }", "public Point intersection(Line l) {\n\t\tPoint p;\n\t\tp = l.intersection(new Plane(A2, B2, C2)); // A2.B2.C2.D2\n\t\tif (p == null || !contain(p)) {\n\t\t\tp = l.intersection(new Plane(A1, A2, B2)); // A1.A2.B2.B1\n\t\t\tif (p == null || !contain(p)) {\n\t\t\t\tp = l.intersection(new Plane(A1, A2, D2)); // A1.A2.D2.D1\n\t\t\t\tif (p == null || !contain(p)) {\n\t\t\t\t\tp = l.intersection(new Plane(B1, B2, C2)); // B1.B2.C2.C1\n\t\t\t\t\tif (p == null || !contain(p)) {\n\t\t\t\t\t\tp = l.intersection(new Plane(C1, D1, D2)); // C1.D1.D2.C2\n\t\t\t\t\t\tif (p == null || !contain(p)) {\n\t\t\t\t\t\t\tp = l.intersection(new Plane(A1, B1, C1)); // A1.B1.C1.D1\n\t\t\t\t\t\t\tif (p == null || !contain(p)) {\n\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn p;\n\t}", "public Point intersectionWith(Line other) {\r\n double m1 = this.lineSlope();\r\n double m2 = other.lineSlope();\r\n double b1 = this.intercept();\r\n double b2 = other.intercept();\r\n double interX, interY;\r\n if (m1 == m2) {\r\n return null;\r\n // this line is vertical\r\n } else if (m1 == Double.POSITIVE_INFINITY || m1 == Double.NEGATIVE_INFINITY) {\r\n interX = this.start.getX();\r\n if ((Math.min(other.start().getX(), other.end().getX()) <= interX\r\n && interX <= Math.max(other.end().getX(), other.start().getX()))) {\r\n // y value of intersection point\r\n interY = interX * m2 + b2;\r\n if (Math.min(this.start().getY(), this.end().getY()) <= interY\r\n && interY <= Math.max(this.start().getY(), this.end().getY())) {\r\n Point interPoint = new Point(Math.round(interX), Math.round(interY));\r\n return interPoint;\r\n }\r\n }\r\n return null;\r\n // other line is vertical\r\n } else if (m2 == Double.POSITIVE_INFINITY || m2 == Double.NEGATIVE_INFINITY) {\r\n interX = other.start.getX();\r\n if ((Math.min(this.start().getX(), this.end().getX()) <= interX\r\n && interX <= Math.max(this.end().getX(), this.start().getX()))) {\r\n // y value of intersection point\r\n interY = interX * m1 + b1;\r\n if (Math.min(other.start().getY(), other.end().getY()) <= interY\r\n && interY <= Math.max(other.start().getY(), other.end().getY())) {\r\n Point interPoint = new Point(Math.round(interX), Math.round(interY));\r\n return interPoint;\r\n }\r\n }\r\n return null;\r\n // this line is horizontal\r\n } else if (m1 == 0) {\r\n // y value of potential intersection point\r\n interY = this.start.getY();\r\n if ((Math.min(other.start().getY(), other.end().getY()) <= interY\r\n && interY <= Math.max(other.end().getY(), other.start().getY()))) {\r\n interX = ((interY - other.start.getY()) / other.lineSlope()) + other.start.getX();\r\n Point interPoint = new Point(Math.round(interX), Math.round(interY));\r\n if (Math.min(this.start().getX(), this.end().getX()) <= interX\r\n && interX <= Math.max(this.start().getX(), this.end().getX())) {\r\n return interPoint;\r\n }\r\n }\r\n return null;\r\n // other line is horizontal\r\n } else if (m2 == 0) {\r\n // y value of potential intersection point\r\n interY = this.start.getY();\r\n if ((Math.min(this.start().getY(), this.end().getY()) <= interY\r\n && interY <= Math.max(this.end().getY(), this.start().getY()))) {\r\n interX = ((interY - this.start.getY()) / this.lineSlope()) + this.start.getX();\r\n Point interPoint = new Point(Math.round(interX), Math.round(interY));\r\n if (Math.min(other.start().getX(), other.end().getX()) <= interX\r\n && interX <= Math.max(other.start().getX(), other.end().getX())) {\r\n return interPoint;\r\n }\r\n }\r\n return null;\r\n // lines are not horizontal or vertical\r\n } else {\r\n interX = (b1 - b2) / (m2 - m1);\r\n interY = (m1 * (interX - this.start.getX())) + this.start.getY();\r\n Point interPoint = new Point(Math.round(interX), Math.round(interY));\r\n if (Math.min(other.start().getX(), other.end().getX()) <= interX\r\n && interX <= Math.max(other.start().getX(), other.end().getX())\r\n || (Math.min(this.start().getX(), this.end().getX()) <= interX\r\n && interX <= Math.max(this.start().getX(), this.end().getX()))) {\r\n return interPoint;\r\n }\r\n }\r\n return null;\r\n }", "public java.util.List intersectionPoints(Line line) {\n List interPoints = new ArrayList();\n Line[] edges = new Line[4];\n edges[0] = this.getLeftLine();\n edges[1] = this.getRightLine();\n edges[2] = this.getUpperLine();\n edges[3] = this.getDownerLine();\n for (int i = 0; i < 4; i++) {\n if (line.isIntersecting(edges[i])) {\n interPoints.add(line.intersectionWith(edges[i]));\n }\n }\n if (!interPoints.isEmpty()) {\n return interPoints;\n }\n return null;\n }", "public Vector2 intersect(Line line)\n {\n // find coefficients (a,b,c) of line1\n float a = direction.y;\n float b = -direction.x;\n float c = direction.y * point.x - direction.x * point.y;\n\n // find coefficients (d,e,f) of line2\n float d = line.getDirection().y;\n float e = -line.getDirection().x;\n float f = line.getDirection().y * line.getPoint().x - line.getDirection().x * line.getPoint().y;\n\n // find determinant: ae - bd\n float determinant = a * e - b * d;\n\n // find the intersect point (x,y) if det != 0\n // if det=0, return a Vector2 with Float.NaN\n Vector2 intersectPoint = new Vector2(Float.NaN, Float.NaN); // default point with NAN\n if(determinant != 0)\n {\n intersectPoint.x = (c * e - b * f) / determinant;\n intersectPoint.y = (a * f - c * d) / determinant;\n }\n\n // return the intersected point\n return intersectPoint;\n }", "public Point2D\ngetThreePrimeHeadIntersect(double gap)\nthrows Exception\n{\n\tdouble[] uArray = new double[2];\n\tint[] sideArray = new int[2];\n\tPoint2D intersect0Pt = new Point2D.Double();\n\tPoint2D intersect1Pt = new Point2D.Double();\n\n\tNuc2D nextNuc = this.nextNuc2D();\n\n\tif (nextNuc == null)\n\t\treturn (null);\n\n\tRectangle2D rect = nextNuc.getCenteredBoundingBox();\n\n\tboolean intersects = BLine2D.getRectangleRayIntersect(\n\t\trect, this.getThreePrimeRay(),\n\t\tintersect0Pt, intersect1Pt, uArray, sideArray);\n\n\tif (!intersects)\n\t\treturn (null);\n\n\tif (gap != 0.0)\n\t{\n\t\tBLine2D tmpLine = new BLine2D(this.getThreePrimeRay().getP1(),\n\t\t\tintersect0Pt);\n\t\ttmpLine.setRayFromLength(tmpLine.length() - gap);\n\t\tintersect0Pt = tmpLine.getP2();\n\t}\n\n\treturn (intersect0Pt);\n}", "@InterestingAlgorithm\r\n public Object lineIntersect (Line2D l1, Line2D l2) {\r\n if (l1 == null || l2 == null)\r\n return (null);\r\n\r\n double slope1 = l1.getA();\r\n double slope2 = l2.getA();\r\n\r\n double offset1 = l1.getB();\r\n double offset2 = l2.getB();\r\n\r\n if (MathUtils.closeEnough(slope1, slope2)) {\r\n if (MathUtils.closeEnough(offset1, offset2))\r\n return (l1); // same\r\n else\r\n return (null); // parallel\r\n }\r\n\r\n Point2D point = new Point2D.Double((offset2 - offset1) / (slope1 - slope2), (slope1 * offset2 - slope2 * offset1) / (slope1 - slope2));\r\n\r\n return (point);\r\n }", "public org.landxml.schema.landXML11.RoadwayNameRef xgetIntersectingRoadwayRef()\r\n {\r\n synchronized (monitor())\r\n {\r\n check_orphaned();\r\n org.landxml.schema.landXML11.RoadwayNameRef target = null;\r\n target = (org.landxml.schema.landXML11.RoadwayNameRef)get_store().find_attribute_user(INTERSECTINGROADWAYREF$20);\r\n return target;\r\n }\r\n }", "public Point2D\ngetFivePrimeHeadIntersect(double gap)\nthrows Exception\n{\n\tdouble[] uArray = new double[2];\n\tint[] sideArray = new int[2];\n\tPoint2D intersect0Pt = new Point2D.Double();\n\tPoint2D intersect1Pt = new Point2D.Double();\n\n\tNuc2D lastNuc = this.lastNuc2D();\n\n\tif (lastNuc == null)\n\t\treturn (null);\n\n\tRectangle2D rect = lastNuc.getCenteredBoundingBox();\n\n\tboolean intersects = BLine2D.getRectangleRayIntersect(\n\t\trect, this.getFivePrimeRay(),\n\t\tintersect0Pt, intersect1Pt, uArray, sideArray);\n\n\tif (!intersects)\n\t\treturn (null);\n\n\tif (gap != 0.0)\n\t{\n\t\tBLine2D tmpLine = new BLine2D(this.getFivePrimeRay().getP1(),\n\t\t\tintersect0Pt);\n\t\ttmpLine.setRayFromLength(tmpLine.length() - gap);\n\t\tintersect0Pt = tmpLine.getP2();\n\t}\n\n\treturn (intersect0Pt);\n}", "private GeoPoint findClosestIntersection(Ray ray)\r\n\t{\r\n\r\n\t\tif (ray == null) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\tList<GeoPoint> intersections = scene.geometries.findGeoIntersections(ray);\r\n\t\treturn ray.findClosestGeoPoint(intersections);\r\n\t}", "public org.landxml.schema.landXML11.Station xgetIntersectRoadwayPI()\r\n {\r\n synchronized (monitor())\r\n {\r\n check_orphaned();\r\n org.landxml.schema.landXML11.Station target = null;\r\n target = (org.landxml.schema.landXML11.Station)get_store().find_attribute_user(INTERSECTROADWAYPI$22);\r\n return target;\r\n }\r\n }", "@JsMethod\n public native Cartographic findIntersectionWithLatitude(double intersectionLatitude, Cartographic result);", "private GeoPoint findClosestIntersection(Ray ray) {\r\n\t\tList<GeoPoint> temp = _scene.get_geometries().findIntersections(ray);\r\n\t\tif (temp == null)\r\n\t\t\treturn null;\r\n\t\treturn getClosestPoint(temp, ray);\r\n\t}", "@Override\n\tpublic RaySceneObjectIntersection getClosestRayIntersection(Ray ray)\n\t{\n\t\tVector3D v=Vector3D.difference(ray.getP(), pointOnAxis);\n\t\tVector3D vP = v.getDifferenceWith(v.getProjectionOnto(normalisedAxisDirection));\t// part of v that's perpendicular to a\n\t\tVector3D dP = ray.getD().getDifferenceWith(ray.getD().getProjectionOnto(normalisedAxisDirection));\t// part of ray.d that's perpendicular to a\n\t\t\n\t\t// coefficients in the quadratic equation for t\n\t\tdouble a = dP.getModSquared();\n\t\t\n\t\tif(a==0.0) return RaySceneObjectIntersection.NO_INTERSECTION;\t// would give division by zero later\n\n\t\tdouble\n\t\t\tb2 = Vector3D.scalarProduct(vP, dP),\t// b/2\n\t\t\tc = vP.getModSquared() - radius*radius,\n\t\t\tdiscriminant4 = b2*b2 - a*c;\t// discriminant/4\n\n\t\t// first check if the discriminant is >0; if it isn't, then there is no intersection at all\n\t\tif(discriminant4 < 0.0) return RaySceneObjectIntersection.NO_INTERSECTION;\n\t\t\n\t\t// okay, the discriminant is positive; take its square root, which is what we actually need\n\t\tdouble sqrtDiscriminant2 = Math.sqrt(discriminant4);\t// sqrt(discriminant)/2\n\t\t\t\n\t\t// calculate the factor t corresponding to the\n\t\t// intersection with the greater t factor;\n\t\t// the further-away intersection is then ray.p + tBigger*ray.d\n\t\tdouble tBigger=((a>0)?(-b2+sqrtDiscriminant2)/a:(-b2-sqrtDiscriminant2)/a);\n\t\t\n\t\t//if tBigger<0, then the intersection with the lesser t factor will have to be even more negative;\n\t\t// therefore, both intersections will be \"behind\" the starting point\n\t\tif(tBigger < 0.0) return RaySceneObjectIntersection.NO_INTERSECTION;\n\n\t\t// calculate the factor tSmaller corresponding to the\n\t\t// intersection with the lesser t factor\n\t\tdouble tSmaller=((a>0)?(-b2-sqrtDiscriminant2)/a:(-b2+sqrtDiscriminant2)/a);\n\n\t\tRay rayAtIntersectionPoint;\n\t\t\n\t\t// first check if the intersection point with the lesser t factor is an option\n\t\tif(tSmaller > 0.0)\n\t\t{\n\t\t\t// the intersection with the lesser t factor lies in front of the starting point, so it might correspond to the intersection point\n\t\t\t\n\t\t\t// calculate the ray advanced to the intersection point\n\t\t\trayAtIntersectionPoint = ray.getAdvancedRay(tSmaller);\n\t\t\t\n\t\t\treturn new RaySceneObjectIntersection(rayAtIntersectionPoint.getP(), this, rayAtIntersectionPoint.getT());\n\t\t}\n\t\t\n\t\t// If the program reaches this point, the intersection with the lesser t factor was not the right intersection.\n\t\t// Now try the intersection point with the greater t factor.\n\t\t\n\t\t// calculate the ray advanced to the intersection point\n\t\trayAtIntersectionPoint = ray.getAdvancedRay(tBigger);\n\n\t\treturn new RaySceneObjectIntersection(rayAtIntersectionPoint.getP(), this, rayAtIntersectionPoint.getT());\n\t}", "public Point2d intersectionWith(final Line other){\n if( this.isParallelTo(other))\n return null;\n\n // lambda coefficients\n double[][] coeff = {\n { direction.x, -other.direction.x },\n { direction.y, -other.direction.y}};\n Matrix left = new Matrix(coeff);\n\n // right side of equation system\n double[][] results = { {other.point.x - point.x}, {other.point.y - point.y}};\n Matrix right = new Matrix(results);\n\n // solution: 2x1 Matrix with 2 lambdas for 2 lines\n Matrix lambda = left.solve(right);\n\n // first entry should be our lambda\n Point2d intersection = getPointAt(lambda.get(0, 0));\n\n return intersection;\n }", "private static Point2D getIntersectionFromParallel(LineSegment A, LineSegment B)\r\n\t{\r\n\t\t// Assume two lines are parallel at this point, return the highest end point (relative) of the two lines\r\n\t\tPoint2D Alow = Utilities.isBelow(A.startPoint, A.endPoint) ? A.startPoint : A.endPoint;\r\n\t\tPoint2D Blow = Utilities.isBelow(B.startPoint, B.endPoint) ? B.startPoint : B.endPoint;\r\n\t\treturn Utilities.isBelow(Alow, Blow) ? Blow : Alow;\r\n\t\t\r\n\t}", "public double intersect(Ray3D r) {\n\t\tdouble dn = (r.d).dot(n);\n\t\tif (dn==0.0) return Double.POSITIVE_INFINITY;\n\t\tdouble t = (p.subtract(r.p)).dot(n)/dn;\n\t\tif (t > 0) return t;\n\t\telse return Double.POSITIVE_INFINITY;\n\t}", "List<GeoPoint> findGeoIntersections(Ray ray);", "private Point3D findHitPoint(Ray3D ray) {\n // We plug paramaterization of x, y, z for ray into our general quartic equation\n // to get standard form: At^2 + Bt + C = 0, then use the quadratic equation to solve for t.\n // The coefficients A, B, and C are quite ugly, and the derivation is described in the linked\n // resource\n Point3D P = ray.getPoint(); // Ray starting point\n Point3D D = ray.getDirection(); // Ray direction\n // First coefficient of quadratic equation of t\n double A = a * sq(D.getX()) + b * sq(D.getY()) + c * sq(D.getZ())\n + d * D.getY() * D.getZ() + e * D.getX() * D.getZ() + f * D.getX() * D.getY();\n // Second coefficient of quadratic equation of t\n double B = 2 * (a * P.getX() * D.getX() + b * P.getY() * D.getY() + c * P.getZ() * D.getZ())\n + d * (P.getY() * D.getZ() + P.getZ() * D.getY())\n + e * (P.getX() * D.getZ() + P.getZ() * D.getX())\n + f * (P.getX() * D.getY() + P.getY() * D.getX())\n + g * D.getX() + h * D.getY() + i * D.getZ();\n // Third coefficient of quadratic equation of t\n double C = a * sq(P.getX()) + b * sq(P.getY()) + c * sq(P.getZ()) + d * P.getY() * P.getZ()\n + e * P.getX() * P.getZ() + f * P.getX() * P.getY() + g * P.getX() + h * P.getY() + i * P.getZ() + j;\n\n double discriminant = sq(B) - 4 * A * C;\n\n // Find intersection Point\n Point3D intersection = null;\n if (discriminant >= 0) {\n double t1 = (-B - Math.sqrt(discriminant)) / (2 * A);\n double t2 = (-B + Math.sqrt(discriminant)) / (2 * A);\n Point3D p1 = ray.atTime(t1);\n Point3D p2 = ray.atTime(t2);\n if (t1 > 0 && t2 > 0 && isWithinBounds(p1) && isWithinBounds(p2)) {\n intersection = t1 <= t2 ? p1 : p2;\n } else if (t1 > 0 && isWithinBounds(p1)) {\n intersection = p1;\n } else if (t2 > 0 && isWithinBounds(p2)) {\n intersection = p2;\n }\n }\n return intersection;\n }", "private math_vector3d TwoPointGetCenterArcPoint(math_vector3d start, math_vector3d end)\n {\n\n\n ObjectPoint center2d = new ObjectPoint((start.X() + end.X()) / 2.0,(start.Y() + end.Y()) / 2.0);\n ObjectPoint orgin2d = new ObjectPoint(this.theOrigin.X(),this.theOrigin.Y());\n\n\n MathVector2D orginTocenter = new MathVector2D(orgin2d, center2d);\n\n orginTocenter = orginTocenter.GetUnit();\n orginTocenter = orginTocenter.multiply(this.theRadius);\n orgin2d.AddVector(orginTocenter);\n\n math_vector3d center = new math_vector3d(orgin2d.x,orgin2d.y,0);\n return center;\n }", "@Override\n\tpublic RaySceneObjectIntersection getClosestRayIntersection(Ray ray)\n\t{\t\t//this is calculating the \"term under the square root\"\n\t\tVector3D v=Vector3D.difference(ray.getP(), centre);\t\t\t\t\t\t//which must be greater than 0 for intersection\n\n\t\t// coefficients in the quadratic equation for t\n\t\tdouble \n\t\tquadraticA = ray.getD().getModSquared(),\n\t\tquadraticB2 = Vector3D.scalarProduct(v, ray.getD()),\t// b/2\n\t\tquadraticC = v.getModSquared() - MyMath.square(radius);\n\n\t\t// discriminant/2\n\t\tdouble discriminant2 = quadraticB2*quadraticB2-quadraticA*quadraticC;\n\n\n\t\tif(discriminant2<0.0) {\n\t\t\t//returns NaN if there is no intersection\n\t\t\treturn RaySceneObjectIntersection.NO_INTERSECTION;\n\t\t}\n\n\t\tdouble t1=(-quadraticB2+Math.sqrt(discriminant2))/quadraticA;\n\n\t\tif(t1<0.0) {\n\t\t\t//if t1<0 then t2 must be less than zero\n\t\t\treturn RaySceneObjectIntersection.NO_INTERSECTION;\n\t\t}\n\n\t\tdouble t2=(-quadraticB2-Math.sqrt(discriminant2))/quadraticA;\n\t\t\n\t\tRay rayAtIntersectionPoint = ray.getAdvancedRay((t2<0.0)?t1:t2);\n\n\t\treturn new RaySceneObjectIntersection(\n\t\t\t\trayAtIntersectionPoint.getP(),\n\t\t\t\tthis,\n\t\t\t\trayAtIntersectionPoint.getT()\n\t\t\t);\n\t}", "public Coords getFromCenterIntersectionPoint(final Coords otherPoint)\r\n {\r\n final Line line = new Line(getCenter(), otherPoint);\r\n final List<Line> edgeLines = getEdgeLines();\r\n Coords point;\r\n for(final Line edge : edgeLines)\r\n {\r\n point = line.intersection(edge);\r\n if(point != null)\r\n {\r\n return point;\r\n }\r\n }\r\n return null;\r\n }", "private Point3 _getIntersection(Point3 eye, Point3 direction) {\n int size = NORMALS.length;\n float tresult;\n Point4 norm; // normal of face hit\n Plane plane; // plane equation\n float tnear, tfar, t, vn, vd;\n int front = 0, back = 0; // front/back face # hit\n\n tnear = -1.0e+20f; // -HUGE_VAL\n tfar = +1.0e+20f; // tmax\n for (int i = 0; i < size; i++) {\n\n plane = _planes[i];\n\n vd = plane.dot(direction);\n vn = plane.distance(eye);\n if (vd == 0.0f) {\n // ray is parallel to plane -\n // check if ray origin is inside plane's\n // half-space\n if (vn < 0.0f) {\n return null;\n }\n\n } else {\n // ray not parallel - get distance to plane\n t = -vn / vd;\n if (vd > 0.0f) {\n\n if (t > tfar) {\n return null;\n }\n if (t > tnear) {\n // hit near face, update normal\n front = i;\n tnear = t;\n }\n } else {\n // back face - T is a far point\n\n if (t < tnear) {\n return null;\n }\n if (t < tfar) {\n // hit far face, update normal\n\n back = i;\n tfar = t;\n }\n }\n }\n }\n // survived all tests\n // Note: if ray originates on polyhedron,\n // may want to change 0.0 to some\n // epsilon to avoid intersecting the originating face.\n //\n if (tnear >= 0.0f) {\n // outside, hitting front face\n norm = _planes[front]._normal;\n tresult = tnear;\n return Point3.addition(eye, direction.scaled(tresult));\n } else {\n if (tfar < 1.0e+20f) {\n // inside, hitting back face\n norm = _planes[back]._normal;\n tresult = tfar;\n return Point3.addition(eye, direction.scaled(tresult));\n } else {\n // inside, but back face beyond tmax//\n return null;\n }\n }\n }", "static PointDouble intersection(Line l1, Line l2) {\n if (areParallel(l1, l2)) return null; // no intersection\n PointDouble p = new PointDouble();\n // solve system of 2 linear algebraic equations with 2 unknowns\n p.x = (l2.b * l1.c - l1.b * l2.c) / (l2.a * l1.b - l1.a * l2.b);\n // In one of the lines, the b in the equation will be 1, since if both are 0\n // the lines are parallel. We calculate y from that Line's equation\n if (Math.abs(l1.b) > EPS) {\n p.y = -(l1.a * p.x + l1.c);\n } else {\n p.y = -(l2.a * p.x + l2.c);\n }\n return p;\n }", "private GeoPoint findClosestIntersection(Ray ray) {\n if (ray == null) {\n return null;\n }\n GeoPoint closestPoint = null;\n double closestDistance = Double.MAX_VALUE;\n Point3D ray_p0 = ray.getPo();\n\n List<GeoPoint> intersections = scene.getGeometries().findGeoIntersections(ray);\n if (intersections == null)\n return null;\n\n for (GeoPoint geoPoint : intersections) {\n double distance = ray_p0.distance(geoPoint.getPoint());\n if (distance < closestDistance) {\n closestPoint = geoPoint;\n closestDistance = distance;\n }\n }\n return closestPoint;\n }", "@Override\r\n\tpublic List<GeoPoint> findIntersections(Ray ray) {\r\n\t\tList<GeoPoint> list = new ArrayList<GeoPoint>();\r\n\t\tVector rayDirection = ray.getDirection();\r\n\t\tPoint3D rayPoint = ray.getPOO();\r\n\r\n\t\t// case centerPoint same as the RayPoint\r\n\t\tif (centerPoint.equals(rayPoint)) {\r\n\t\t\tlist.add(new GeoPoint(this, rayPoint.addVector(rayDirection.scale(radius))));\r\n\t\t\treturn list;\r\n\t\t}\r\n\r\n\t\t// u = centerPoint - rayPoint\r\n\t\tVector u = centerPoint.subtract(rayPoint);\r\n\t\t// tm = u * rayDirection\r\n\t\tdouble tm = rayDirection.dotProduct(u);\r\n\t\t// distance = sqrt(|u|^2 - tm^2)\r\n\t\tdouble d = Math.sqrt(u.dotProduct(u) - tm * tm);\r\n\t\t// case the distance is bigger than radius no intersections\r\n\t\tif (d > radius)\r\n\t\t\treturn list;\r\n\r\n\t\t// th = sqrt(R^2 - d^2)\r\n\t\tdouble th = Math.sqrt(radius * radius - d * d);\r\n\r\n\t\tdouble t1 = tm - th;\r\n\t\tdouble t2 = tm + th;\r\n\r\n\t\tif (Util.isZero(t1) || Util.isZero(t2)) {\r\n\t\t\tlist.add(new GeoPoint(this, rayPoint));\r\n\t\t}\r\n\t\tif (Util.isZero(th)) {\r\n\t\t\tlist.add(new GeoPoint(this, rayPoint.addVector(rayDirection.scale(tm))));\r\n\t\t} else {\r\n\t\t\tif (t1 > 0 && !Util.isZero(t1))// one\r\n\t\t\t\tlist.add(new GeoPoint(this, rayPoint.addVector(rayDirection.scale(t1))));\r\n\t\t\tif (t2 > 0 && !Util.isZero(t2)) {// two\r\n\t\t\t\tlist.add(new GeoPoint(this, rayPoint.addVector(rayDirection.scale(t2))));\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn list;\r\n\r\n\t}", "public Ndimensional getStartPoint();", "public LineIntersect intersect(Line2D other, Vector2f intersectionPoint) {\r\n float denom = (other.pointB.y - other.pointA.y) * (this.pointB.x - this.pointA.x)\r\n - (other.pointB.x - other.pointA.x) * (this.pointB.y - this.pointA.y);\r\n float u0 = (other.pointB.x - other.pointA.x) * (this.pointA.y - other.pointA.y)\r\n - (other.pointB.y - other.pointA.y) * (this.pointA.x - other.pointA.x);\r\n float u1 = (other.pointA.x - this.pointA.x) * (this.pointB.y - this.pointA.y)\r\n - (other.pointA.y - this.pointA.y) * (this.pointB.x - this.pointA.x);\r\n\r\n //if parallel\r\n if (denom == 0.0f) {\r\n //if collinear\r\n if (u0 == 0.0f && u1 == 0.0f) {\r\n return LineIntersect.CoLinear;\r\n } else {\r\n return LineIntersect.Parallel;\r\n }\r\n } else {\r\n //check if they intersect\r\n u0 = u0 / denom;\r\n u1 = u1 / denom;\r\n\r\n float x = this.pointA.x + u0 * (this.pointB.x - this.pointA.x);\r\n float y = this.pointA.y + u0 * (this.pointB.y - this.pointA.y);\r\n\r\n if (intersectionPoint != null) {\r\n intersectionPoint.x = x; //(m_PointA.x + (FactorAB * Bx_minus_Ax));\r\n intersectionPoint.y = y; //(m_PointA.y + (FactorAB * By_minus_Ay));\r\n }\r\n\r\n // now determine the type of intersection\r\n if ((u0 >= 0.0f) && (u0 <= 1.0f) && (u1 >= 0.0f) && (u1 <= 1.0f)) {\r\n return LineIntersect.SegmentsIntersect;\r\n } else if ((u1 >= 0.0f) && (u1 <= 1.0f)) {\r\n return (LineIntersect.ABisectsB);\r\n } else if ((u0 >= 0.0f) && (u0 <= 1.0f)) {\r\n return (LineIntersect.BBisectsA);\r\n }\r\n\r\n return LineIntersect.LinesIntersect;\r\n }\r\n }", "public VectorXZ getIntersection(VectorXZ segmentP1, VectorXZ segmentP2) {\n // TODO: (performance): passing \"vector TO second point\", rather than\n // point2, would avoid having to calc it here - and that information\n // could be reused for all comparisons involving the segment\n\n return GeometryUtil.getTrueLineSegmentIntersection(\n segmentP1, segmentP2, p1, p2);\n }", "private int\ngetNodeIndex(final SoNode node)\n//\n////////////////////////////////////////////////////////////////////////\n{\n int i;\n\n // Search from bottom up for node in path, since details are\n // usually examined near the bottom\n for (i = ( SoFullPath.cast ( path)).getLength() - 1; i >= 0; i--)\n if (path.getNode(i) == node)\n return i;\n\n//#ifdef DEBUG\n SoDebugError.post(\"SoPickedPoint::getNodeIndex\",\n \"Node \"+node+\" is not found in path\");\n//#endif /* DEBUG */\n\n return -1;\n}", "default List<Point3D> findIntersections(Ray ray) {\n\tList<GeoPoint> geoList = findGeoIntersections(ray);\n\treturn geoList == null ? null\n\t: geoList .stream()\n\t.map(gp -> gp.point)\n\t.collect(Collectors.toList());\n\t}", "@JsMethod\n public native Cartographic findIntersectionWithLongitude(double intersectionLongitude);", "private ArrayList<ColorMixerModel.ColorItem> pathIntersection(){\n ArrayList<ColorMixerModel.ColorItem> toDel = new ArrayList<>();\n for(ColorMixerModel.ColorItem c: cmModel.colorSet){\n Ellipse2D.Float cobj = new Ellipse2D.Float(c.getPos().x,c.getPos().y, c.getR(),c.getR());\n if(mouseTrace.intersects(cobj.getBounds2D())){\n toDel.add(c);\n }\n }\n return toDel;\n }", "public abstract Node getBoundingNode();", "public Coordinates midPoint(Coordinates a, Coordinates b);", "protected abstract NativeSQLStatement createNativeIntersectionStatement(Geometry geom);", "private Coordinate fetchClosestIntersection (Coordinate endPoint, List<Coordinate> intersectionPoints) {\r\n\t\tif (intersectionPoints!=null ) {\r\n\t\t\tif (intersectionPoints.size()>1) {\r\n\t\t\t\treturn GeometryOperations.getNearestVertex(endPoint, intersectionPoints.toArray(new Coordinate[0]));\r\n\t\t\t}\r\n\t\t\t if (intersectionPoints.size()==1) {\r\n\t\t\t\t\treturn intersectionPoints.get(0);\r\n\t\t\t }\r\n\t\t} \r\n\t\treturn null;\r\n\t}", "IPoint intersect(Figures figures)\n { float epsilon=IPoint.epsilon;\n Vec3D e1 = figures.getP2().minus(figures.getP1());\n Vec3D e2 = figures.getP3().minus(figures.getP1());\n Vec3D p = dir.cross(e2);\n float a = e1.dot(p);\n if ((a>-epsilon) && (a<epsilon)) return new IPoint(null,null,-1);\n float f = 1/a;\n Vec3D s = start.minus(figures.getP1());\n float u = f*s.dot(p);\n if ((u<0.0) || (u>1.0)) return new IPoint(null,null,-1);\n Vec3D q = s.cross(e1);\n float v = f*dir.dot(q);\n if ((v<0.0) || (u+v>1.0)) return new IPoint(null,null,-1);\n float dist=f*e2.dot(q);\n if (dist<epsilon) return new IPoint(null,null,-1);\n Vec3D ip=figures.getP1().mult(1-u-v).add(figures.getP2().mult(u)).add(figures.getP3().mult(v));\n return new IPoint(figures,ip,dist);\n }", "public java.lang.String getIntersectingRoadwayRef()\r\n {\r\n synchronized (monitor())\r\n {\r\n check_orphaned();\r\n org.apache.xmlbeans.SimpleValue target = null;\r\n target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(INTERSECTINGROADWAYREF$20);\r\n if (target == null)\r\n {\r\n return null;\r\n }\r\n return target.getStringValue();\r\n }\r\n }", "public GPoint midpoint() {\n return(new GPoint((point1.getFirst()+point2.getFirst())/2.0,\n (point1.getSecond()+point2.getSecond())/2.0));\n }", "public Point intersection(final Ligne l2) {\n\n\t\tfinal Point l2p1 = l2.getP1();\n\t\tfinal Point l2p2 = l2.getP2();\n\t\tfinal int x1 = (int) l2p1.getX();\n\t\tfinal int y1 = (int) l2p1.getY();\n\t\tfinal int x2 = (int) l2p2.getX();\n\t\tfinal int y2 = (int) l2p2.getY();\n\n\t\tfinal int d = ((x1 - x2) * (this.p1.y - this.p2.y))\n\t\t\t\t\t\t- ((y1 - y2) * (this.p1.x - this.p2.x));\n\t\tif (d == 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\tfinal int xi = (((this.p1.x - this.p2.x) * ((x1 * y2) - (y1 * x2))) - ((x1 - x2) * ((this.p1.x * this.p2.y) - (this.p1.y * this.p2.x))))\n\t\t\t\t\t\t/ d;\n\t\tfinal int yi = (((this.p1.y - this.p2.y) * ((x1 * y2) - (y1 * x2))) - ((y1 - y2) * ((this.p1.x * this.p2.y) - (this.p1.y * this.p2.x))))\n\t\t\t\t\t\t/ d;\n\n\t\tfinal Point p = new Point(xi, yi);\n\t\tif ((xi < Math.min(x1, x2)) || (xi > Math.max(x1, x2))) {\n\t\t\treturn null;\n\t\t}\n\t\tif ((xi < Math.min(this.p1.x, this.p2.x))\n\t\t\t\t\t\t|| (xi > Math.max(this.p1.x, this.p2.x))) {\n\t\t\treturn null;\n\t\t}\n\t\treturn p;\n\t}", "private static int[] intersection(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4){\n\n\t\tdouble b1 = (y2 - y1)/(x2 - x1);\n\t\tdouble a1 = y1 - (b1*x1);\n\t\tdouble b2 = (y4 - y3)/(x4 - x3);\n\t\tdouble a2 = y3 - (b2*x3);\n\t\tif(x2-x1 == 0) //vertical\n\t\t\treturn new int[]{(int)x1,(int)(a2+(b2*x1))};\n\t\tif(x3-x4 == 0) //vertical\n\t\t\treturn new int[]{(int)x3,(int)(a1+(b1*x3))};\n\t/*\tif(Math.abs(b1-b2) < 0.001)\n\t\t\treturn null;\n\t\tdouble intX = -(a1-a2)/(b1-b2);\n\t\tdouble intY = a1+(b1*intX);*/\n\t\tdouble d = ((y4-y3)*(x2-x1) - (x4-x3)*(y2-y1));\n\t\tif(d == 0)\n\t\t\treturn null; //parallel roads\n\t\tdouble a = ((x4-x3)*(y1-y3) - (y4-y3)*(x1-x3))*1.0/d;\n\t\tint intX = (int)x1+(int)(a*(x2-x1));\n\t\tint intY = (int)y1+(int)(a*(y2-y1));\n\t\treturn new int[]{(int)intX,(int)intY};\n\t}", "public E3DVector3F getPlaneIntersectionPoint(E3DVector3F startPos, E3DVector3F endPos)\r\n {\r\n double a, b;\r\n \r\n E3DVector3F normal = getNormal();\r\n E3DVector3F direction = endPos.subtract(startPos);\r\n\r\n a = -normal.dotProduct(startPos.subtract(vertices[0].getVertexPos()));\r\n b = normal.dotProduct(direction);\r\n\r\n double r = a / b;\r\n if (r < 0.0) // ray goes away from triangle\r\n return null;\r\n \r\n direction.scaleEqual(r);\r\n direction = startPos.add(direction);\r\n \r\n return direction;\r\n/* \r\n //old\r\n E3DVector3F normal = getNormal();\r\n \r\n E3DVector3F ray = endPos.subtract(startPos);\r\n \r\n double t = -(normal.dotProduct(startPos) -\r\n getPlaneEquationCoords().getD() +\r\n normal.dotProduct(ray));\r\n //NO\r\n ray.normaliseEqual(); //NO\r\n\r\n ray.scaleEqual(t);\r\n ray.addEqual(startPos); //should be marginally faster (one less new E3DVector3F)\r\n return ray; //startPos.add(ray); */\r\n }", "public intersection(){}", "@Override\n\tpublic Point3D findFirstIntersect(Ray3D ray) {\n\t\tPoint3D p = plane.findFirstIntersect(ray);\n\t\tif(isOnSurface(p))\n\t\t\treturn p;\n\t\telse\n\t\t\treturn Point3D.nullVal;\n\t}", "public static Coordinate intersection(Coordinate[] line1, Coordinate[] line2) {\n\n if (line1.length != 2 || line2.length != 2) {\n return new Coordinate(0, 0);\n }\n float x1 = (float) line1[0].y;\n float y1 = (float) line1[0].x;\n float x2 = (float) line1[1].y;\n float y2 = (float) line1[1].x;\n float x3 = (float) line2[0].y;\n float y3 = (float) line2[0].x;\n float x4 = (float) line2[1].y;\n float y4 = (float) line2[1].x;\n float ua = (((x4 - x3) * (y1 - y3)) - ((y4 - y3) * (x1 - x3)))\n / (((y4 - y3) * (x2 - x1)) - ((x4 - x3) * (y2 - y1)));\n float y = x1 + ua * (x2 - x1);\n float x = y1 + ua * (y2 - y1);\n return new Coordinate(x, y);\n }", "TMNodeModel nodeContaining(TMNode node) {\n if (this.node == node) {\n return this;\n } else {\n return null;\n }\n }", "private static Coord findCoordinate(Coord p0, Coord p1, Coord p2, double r0, double r1, double r2){\r\n\r\n\tdouble x0, y0, x1, y1, x2, y2;\r\n\tx0 = p0.getX(); y0 = p0.getY();\r\n\tx1 = p1.getX(); y1 = p1.getY();\r\n\tx2 = p2.getX(); y2 = p2.getY();\r\n\t//core.Debug.p(\"x0:\" + x0 + \",y0:\" + y0 + \",r0:\" + r0);\r\n\t//core.Debug.p(\"x1:\" + x1 + \",y1:\" + y1 + \",r1:\" + r1);\r\n\t//core.Debug.p(\"x2:\" + x2 + \",y2:\" + y2 + \",r2:\" + r2);\r\n\tdouble a, dx, dy, d, h, rx, ry;\r\n\tdouble point2_x, point2_y;\r\n\r\n\t/* dx and dy are the vertical and horizontal distances between\r\n\t * the circle centers.\r\n\t */\t\r\n\tdx = x1 - x0;\r\n\tdy = y1 - y0;\r\n\r\n\t/* Determine the straight-line distance between the centers. */\r\n\td = Math.sqrt((dy*dy) + (dx*dx));\r\n\r\n\t/* Check for solvability. */\r\n\tif (d > (r0 + r1)){\r\n\t\t/* no solution. circles do not intersect. */\r\n\t\t//core.Debug.p(\"no solution1\");\r\n\t\treturn null;\r\n\t}\r\n\tif (d < Math.abs(r0 - r1)){\r\n\t\t/* no solution. one circle is contained in the other */\r\n\t\t//core.Debug.p(\"no solution2\");\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/* 'point 2' is the point where the line through the circle\r\n\t * intersection points crosses the line between the circle\r\n\t * centers.\r\n\t */\r\n\r\n\t/* Determine the distance from point 0 to point 2. */\r\n\ta = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ;\r\n\r\n\t/* Determine the coordinates of point 2. */\r\n\tpoint2_x = x0 + (dx * a/d);\r\n\tpoint2_y = y0 + (dy * a/d);\r\n\r\n\t/* Determine the distance from point 2 to either of the\r\n\t * intersection points.\r\n\t */\t\r\n\th = Math.sqrt((r0*r0) - (a*a));\r\n\r\n\t/* Now determine the offsets of the intersection points from\r\n\t * point 2.\r\n\t */\r\n\trx = -dy * (h/d);\r\n\try = dx * (h/d);\r\n\r\n\t/* Determine the absolute intersection points. */\r\n\tdouble intersectionPoint1_x = point2_x + rx;\r\n\tdouble intersectionPoint2_x = point2_x - rx;\r\n\tdouble intersectionPoint1_y = point2_y + ry;\r\n\tdouble intersectionPoint2_y = point2_y - ry;\r\n\r\n\t/* Lets determine if circle 3 intersects at either of the above intersection points. */\r\n\tdx = intersectionPoint1_x - x2;\r\n\tdy = intersectionPoint1_y - y2;\r\n\tdouble d1 = Math.sqrt((dy*dy) + (dx*dx));\r\n\r\n\tdx = intersectionPoint2_x - x2;\r\n\tdy = intersectionPoint2_y - y2;\r\n\tdouble d2 = Math.sqrt((dy*dy) + (dx*dx));\r\n\r\n\t//core.Debug.p(\"d1: \" + d1 + \", d2: \" + d2 + \", r2: \" + r2);\r\n\t//core.Debug.p(\"diff1: \" + Math.abs(d1-r2));\r\n\t//core.Debug.p(\"point1: (\" + intersectionPoint1_x + \", \" + intersectionPoint1_y + \")\");\r\n\t//core.Debug.p(\"diff2: \" + Math.abs(d2-r2));\r\n\t//core.Debug.p(\"point2: (\" + intersectionPoint2_x + \", \" + intersectionPoint2_y + \")\");\r\n\r\n\r\n\tif(Math.abs(d1 - r2) < EPSILON) {\r\n\t\t//core.Debug.p(\"point: (\" + intersectionPoint1_x + \", \" + intersectionPoint1_y + \")\");\r\n\t\treturn new Coord(intersectionPoint1_x, intersectionPoint1_y);\r\n\t}\r\n\telse if(Math.abs(d2 - r2) < EPSILON) {\r\n\t\t//core.Debug.p(\"point: (\" + intersectionPoint2_x + \", \" + intersectionPoint2_y + \")\");\r\n\t\treturn new Coord(intersectionPoint2_x, intersectionPoint2_y);}\r\n\telse {\r\n\t\t//core.Debug.p(\"no intersection\");\r\n\t\treturn null;\r\n\t}\r\n}", "public GeoPointND getStartPoint();", "public int indexOf(GeometricalObject object);", "public Point getPoint(final Point otherPoint)\n\t\t{\n\n\t\t\t//to get the edge point on the shape\n\t\t\tif(shape.equals(\"poly\") || shape.equals(\"ellipse\"))\n\t\t\t\treturn getCentrePoint();\n\n\t\t\tfinal Point cp = getCentrePoint();\n\t\t\tfinal int rise = otherPoint.y-cp.y;\n\t\t\tfinal int run = otherPoint.x-cp.x;\n\n\t\t\tif(shape.equals(\"rect\"))\n\t\t\t{\n\t\t\t\tif(rise == 0)\n\t\t\t\t{\n\t\t\t\t\tif(otherPoint.x >= cp.x)\n\t\t\t\t\t\treturn new Point(coords[0]+coords[2]+4,coords[1]+(coords[3]/2));\n\t\t\t\t\treturn new Point(coords[0]-2,coords[1]+(coords[3]/2));\n\t\t\t\t}\n\t\t\t\telse if(run == 0)\n\t\t\t\t{\n\t\t\t\t\tif(otherPoint.y >= cp.y)\n\t\t\t\t\t\treturn new Point(coords[0]+(coords[2]/2),coords[1]+coords[3]+4);\n\t\t\t\t\treturn new Point(coords[0]+(coords[2]/2),coords[1]-2);\n\t\t\t\t}else\n\t\t\t\t{\n\n\t\t\t\t\tfinal double m = (double)rise / (double)run;\n\t\t\t\t\tfinal double mx = (double)run / (double)rise;\n\n\t\t\t\t\tif(otherPoint.x >= cp.x && otherPoint.y >= cp.y)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal int yPoint = (int)(m*(coords[2]/2))+cp.y;\n\t\t\t\t\t\tfinal Point yInter = new Point(coords[0]+coords[2]+4,yPoint);\n\n\t\t\t\t\t\tfinal int xPoint = (int)(mx*(coords[3]/2))+cp.x;\n\t\t\t\t\t\tfinal Point xInter = new Point(xPoint,coords[1]+coords[3]+4);\n\n\t\t\t\t\t\tif(dist(xInter,cp) < dist(yInter,cp))\n\t\t\t\t\t\t\treturn xInter;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\treturn yInter;\n\n\t\t\t\t\t}else if(otherPoint.x < cp.x && otherPoint.y >= cp.y)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal int yPoint = (int)(-1*m*(coords[2]/2))+cp.y;\n\t\t\t\t\t\tfinal Point yInter = new Point(coords[0]-2,yPoint);\n\n\t\t\t\t\t\tfinal int xPoint = (int)(1*mx*(coords[3]/2))+cp.x;\n\t\t\t\t\t\tfinal Point xInter = new Point(xPoint,coords[1]+coords[3]+4);\n\n\t\t\t\t\t\tif(dist(xInter,cp) < dist(yInter,cp))\n\t\t\t\t\t\t\treturn xInter;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\treturn yInter;\n\t\t\t\t\t}else if(otherPoint.x < cp.x)\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal int yPoint = (int)(-1*m*(coords[2]/2))+cp.y;\n\t\t\t\t\t\tfinal Point yInter = new Point(coords[0]-2,yPoint);\n\n\t\t\t\t\t\tfinal int xPoint = (int)(-1*mx*(coords[3]/2))+cp.x;\n\t\t\t\t\t\tfinal Point xInter = new Point(xPoint,coords[1]-2);\n\n\t\t\t\t\t\tif(dist(xInter,cp) < dist(yInter,cp))\n\t\t\t\t\t\t\treturn xInter;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\treturn yInter;\n\t\t\t\t\t}else\n\t\t\t\t\t{\n\t\t\t\t\t\tfinal int yPoint = (int)(m*(coords[2]/2))+cp.y;\n\t\t\t\t\t\tfinal Point yInter = new Point(coords[0]+coords[2]+4,yPoint);\n\n\t\t\t\t\t\tfinal int xPoint = (int)(-1*mx*(coords[3]/2))+cp.x;\n\t\t\t\t\t\tfinal Point xInter = new Point(xPoint,coords[1]-2);\n\n\t\t\t\t\t\tif(dist(xInter,cp) < dist(yInter,cp))\n\t\t\t\t\t\t\treturn xInter;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\treturn yInter;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}else if(shape.equals(\"circle\"))\n\t\t\t{\n\t\t\t\tif(rise != 0 && run != 0)\n\t\t\t\t{\n\t\t\t\t\tfinal double ratio = (coords[2] / Math.sqrt(rise*rise+run*run));\n\n\t\t\t\t\treturn new Point(cp.x+(int)(run*ratio),cp.y+(int)(rise*ratio));\n\t\t\t\t}else\n\t\t\t\t{\n\t\t\t\t\tif(rise == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(run > 0)\n\t\t\t\t\t\t\treturn new Point(cp.x+coords[2],cp.y);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\treturn new Point(cp.x-coords[2],cp.y);\n\t\t\t\t\t}else\n\t\t\t\t\t{\n\t\t\t\t\t\tif(rise > 0)\n\t\t\t\t\t\t\treturn new Point(cp.x,cp.y+coords[2]);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\treturn new Point(cp.x,cp.y-coords[2]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t\t//return cp;\n\t\t}", "TMNodeModel nodeContaining(int x, \n \t\t\t\t\t\t int y) {\n if (area.contains(x, y)) {\n return this;\n } else {\n return null;\n }\n }", "static PT ComputeLineIntersection(PT a, PT b, PT c, PT d) {\r\n\t\tb = b.subtract(a);\r\n\t\td = c.subtract(d);\r\n\t\tc = c.subtract(a);\r\n\t\tassert (dot(b, b) > EPS && dot(d, d) > EPS);\r\n\t\treturn a.add(b.multiply(cross(c, d)).divide(cross(b, d)));\r\n\t}", "public boolean\n doIntersection(Ray inOutRay) {\n double t, min_t = Double.MAX_VALUE;\n double x2 = size.x/2; // OJO: Esto deberia venir precalculado\n double y2 = size.y/2; // OJO: Esto deberia venir precalculado\n double z2 = size.z/2; // OJO: Esto deberia venir precalculado\n Vector3D p = new Vector3D();\n GeometryIntersectionInformation info = \n new GeometryIntersectionInformation();\n\n inOutRay.direction.normalize();\n\n // (1) Plano superior: Z = size.z/2\n if ( Math.abs(inOutRay.direction.z) > VSDK.EPSILON ) {\n // El rayo no es paralelo al plano Z=size.z/2\n t = (z2-inOutRay.origin.z)/inOutRay.direction.z;\n if ( t > -VSDK.EPSILON ) {\n p = inOutRay.origin.add(inOutRay.direction.multiply(t));\n if ( p.x >= -x2 && p.x <= x2 && \n p.y >= -y2 && p.y <= y2 ) {\n info.p = new Vector3D(p);\n min_t = t;\n lastPlane = 1;\n }\n }\n }\n\n // (2) Plano inferior: Z = -size.z/2\n if ( Math.abs(inOutRay.direction.z) > VSDK.EPSILON ) {\n // El rayo no es paralelo al plano Z=-size.z/2\n t = (-z2-inOutRay.origin.z)/inOutRay.direction.z;\n if ( t > -VSDK.EPSILON && t < min_t ) {\n p = inOutRay.origin.add(inOutRay.direction.multiply(t));\n if ( p.x >= -x2 && p.x <= x2 && \n p.y >= -y2 && p.y <= y2 ) {\n info.p = p;\n min_t = t;\n lastPlane = 2;\n }\n }\n }\n\n // (3) Plano frontal: Y = size.y/2\n if ( Math.abs(inOutRay.direction.y) > VSDK.EPSILON ) {\n // El rayo no es paralelo al plano Y=size.y/2\n t = (y2-inOutRay.origin.y)/inOutRay.direction.y;\n if ( t > -VSDK.EPSILON && t < min_t ) {\n p = inOutRay.origin.add(inOutRay.direction.multiply(t));\n if ( p.x >= -x2 && p.x <= x2 && \n p.z >= -z2 && p.z <= z2 ) {\n info.p = p;\n min_t = t;\n lastPlane = 3;\n }\n }\n }\n\n // (4) Plano posterior: Y = -size.y/2\n if ( Math.abs(inOutRay.direction.y) > VSDK.EPSILON ) {\n // El rayo no es paralelo al plano Y=-size.y/2\n t = (-y2-inOutRay.origin.y)/inOutRay.direction.y;\n if ( t > -VSDK.EPSILON && t < min_t ) {\n p = inOutRay.origin.add(inOutRay.direction.multiply(t));\n if ( p.x >= -x2 && p.x <= x2 && \n p.z >= -z2 && p.z <= z2 ) {\n info.p = p;\n min_t = t;\n lastPlane = 4;\n }\n }\n }\n\n // (5) Plano X = size.x/2\n if ( Math.abs(inOutRay.direction.x) > VSDK.EPSILON ) {\n // El rayo no es paralelo al plano X=size.x/2\n t = (x2-inOutRay.origin.x)/inOutRay.direction.x;\n if ( t > -VSDK.EPSILON && t < min_t ) {\n p = inOutRay.origin.add(inOutRay.direction.multiply(t));\n if ( p.y >= -y2 && p.y <= y2 && \n p.z >= -z2 && p.z <= z2 ) {\n info.p = p;\n min_t = t;\n lastPlane = 5;\n }\n }\n }\n\n // (6) Plano X = -size.x/2\n if ( Math.abs(inOutRay.direction.x) > VSDK.EPSILON ) {\n // El rayo no es paralelo al plano X=-size.x/2\n t = (-x2-inOutRay.origin.x)/inOutRay.direction.x;\n if ( t > -VSDK.EPSILON && t < min_t ) {\n p = inOutRay.origin.add(inOutRay.direction.multiply(t));\n if ( p.y >= -y2 && p.y <= y2 && \n p.z >= -z2 && p.z <= z2 ) {\n info.p = p;\n min_t = t;\n lastPlane = 6;\n }\n }\n }\n\n if ( min_t < Double.MAX_VALUE ) {\n inOutRay.t = min_t;\n lastInfo.clone(info);\n return true;\n }\n return false;\n }", "private GeoPoint getClosestPoint(List<GeoPoint> intersectionPoints) {\n Point3D p0 = scene.getCamera().getSpo();//the point location of the camera.\n double minDist = Double.MAX_VALUE;//(meatchelim ldistance hamaximily)\n double currentDistance = 0;\n GeoPoint pt = null;\n for (GeoPoint geoPoint : intersectionPoints) {\n currentDistance = p0.distance(geoPoint.getPoint());//checks the distance from camera to point\n if (currentDistance < minDist) {\n minDist = currentDistance;\n pt = geoPoint;\n }\n }\n return pt;\n }", "static PointDouble incircleCenter(PointDouble p1, PointDouble p2, PointDouble p3) {\n // if points are collinear, triangle is degenerate => no incircle center\n if (collinear(p1, p2, p3)) return null;\n\n // Compute the angle bisectors in l1, l2\n double ratio = dist(p1, p2) / dist(p1, p3);\n PointDouble p = translate(p2, scale(vector(p2, p3), ratio / (1 + ratio)));\n Line l1 = pointsToLine(p1, p);\n\n ratio = dist(p2, p1) / dist(p2, p3);\n p = translate(p1, scale(vector(p1, p3), ratio / (1 + ratio)));\n Line l2 = pointsToLine(p2, p);\n\n // Return the intersection of the bisectors\n return intersection(l1, l2);\n }", "public Point closestIntersectionToStartOfLine(Rectangle rect) {\r\n List<Point> list = rect.intersectionPoints(this);\r\n if (list.isEmpty()) {\r\n return null;\r\n // there is only one point in list\r\n } else if (list.size() == 1) {\r\n return list.get(0);\r\n // first point in list closer than the second one\r\n } else if (this.start.distance(list.get(0)) < this.start.distance(list.get(1))) {\r\n return list.get(0);\r\n // second point in list closer than the first one\r\n } else {\r\n return list.get(1);\r\n }\r\n }", "public static <V> ListNode<V> IntersectingNode (\n\t\tfinal ListNode<V> headNode1,\n\t\tfinal ListNode<V> headNode2)\n\t{\n\t\tListNode<V> node1 = headNode1;\n\t\tListNode<V> node2 = headNode2;\n\n\t\tjava.util.HashSet<ListNode<V>> nodeHashSet = new java.util.HashSet<ListNode<V>>();\n\n\t\twhile (null != node1) {\n\t\t\tif (nodeHashSet.contains (node1)) return node1;\n\n\t\t\tnodeHashSet.add (node1);\n\n\t\t\tnode1 = node1.next();\n\t\t}\n\n\t\twhile (null != node2) {\n\t\t\tif (nodeHashSet.contains (node2)) return node2;\n\n\t\t\tnode2 = node2.next();\n\t\t}\n\n\t\treturn null;\n\t}", "public Vector end(double sweepline)\n\t{\n\t\tVector[] intersections = Utils.parabolaIntersection(siteA, siteB, sweepline);\n\n\t\tif (intersections.length == 0)\n\t\t\treturn ray.origin;\n\n\t\tif (intersections.length == 1)\n\t\t\treturn intersections[0];\n\n\t\tdouble do0 = Vector.distance(ray.origin, intersections[0]);\n\t\tdouble do1 = Vector.distance(ray.origin, intersections[1]);\n\n\t\tVector closest = do0 < do1 ? intersections[0] : intersections[1];\n\n\t\t// Determine which intersection the boundary ray intersects\n\t\tdouble dd0 = Vector.distance(ray.direction, intersections[0].sub(ray.origin).normalize());\n\t\tdouble dd1 = Vector.distance(ray.direction, intersections[1].sub(ray.origin).normalize());\n\n\t\tif (dd0 < dd1)\n\t\t{\n\t\t\tif (dd0 < Math.min(do0, do1))\n\t\t\t\tclosest = intersections[0];\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (dd1 < Math.min(do0, do1))\n\t\t\t\tclosest = intersections[1];\n\t\t}\n\n\t\treturn closest;\n\t}", "@Override\n\tpublic Intersection intersect(Ray ray) {\n\t\tdouble maxDistance = 10;\n\t\tdouble stepSize = 0.001; \n\t\tdouble t = 0;\n\t\t\n\t\twhile(t<maxDistance) {\t\t\t\n\t\t\tVector point = ray.m_Origin.add(ray.m_Direction.mul(t));\t\t\t\n\t\t\tdouble eval = torus(point);\t\t\t\n\t\t\tif(Math.abs(eval)<0.001) {\n\t\t\t\tVector normal = estimateNormal(point);\n\t\t return new Intersection(this, ray, t, normal, point);\n\t\t\t}\t\t\t\n\t\t\tt += stepSize;\n\t\t}\t\t\n\t\treturn null;\n\t}", "public TCSObjectReference<Point> getSourcePoint() {\n if (hops.isEmpty()) {\n return null;\n }\n else {\n return hops.get(0);\n }\n }", "public static S2Point getIntersection(S2Point a0, S2Point a1, S2Point b0, S2Point b1) {\n return getIntersection(a0, a1, b0, b1, new ResultError());\n }", "public Point intersection(Point v1, Point v2) {\n\t\tdouble x0,y0;\n\t\tdouble x1 = first.getX();\n\t\tdouble y1 = first.getY();\n\t\tdouble x2 = last.getX();\n\t\tdouble y2= last.getY();\n\t\tdouble x3 = v2.getX();\n\t\tdouble y3 = v2.getY();\n\t\tdouble x4 = v1.getX();\n\t\tdouble y4 = v1.getY();\n\t\t\n\t\t\n\t\t\n\t\tx0=((x1*y2-x2*y1)*(x3-x4)-(x3*y4-x4*y3)*(x1-x2))\n\t\t\t\t/((x1-x2)*(y3-y4)-(y1-y2)*(x3-x4));\n\t\ty0=((x1*y2-x2*y1)*(y3-y4)-(x3*y4-x4*y3)*(y1-y2))\n\t\t\t/((x1-x2)*(y3-y4)-(y1-y2)*(x3-x4));\n\t\treturn new Point(x0,y0);\n\t}", "static S2Point getIntersectionExact(S2Point a0, S2Point a1, S2Point b0, S2Point b1) {\n // Since we are using exact arithmetic, we don't need to worry about numerical stability.\n BigPoint aNormBp = (new BigPoint(a0)).crossProd(new BigPoint(a1));\n BigPoint bNormBp = (new BigPoint(b0)).crossProd(new BigPoint(b1));\n BigPoint xBp = aNormBp.crossProd(bNormBp);\n\n // The last two operations are done in double precision, which creates a directional error of\n // up to 2 * S2.DBL_EPSILON. (BigPoint.toS2Point() and S2Point.normalize() each contribute up to\n // S2.DBL_EPSILON of directional error.)\n S2Point x = xBp.toS2Point().normalize();\n\n if (x.equals(S2Point.ORIGIN)) {\n // The two edges are exactly collinear, but we still consider them to be \"crossing\" because of\n // simulation of simplicity. Out of the four endpoints, exactly two lie in the interior of\n // the other edge. Of those two we return the one that is lexicographically smallest.\n x = new S2Point(10, 10, 10); // Greater than any valid S2Point\n S2Point aNorm = aNormBp.toS2Point().normalize();\n S2Point bNorm = bNormBp.toS2Point().normalize();\n // Note: To support antipodal edges properly, we would need to add a crossProd() function that\n // computes the cross product using simulation of simplicity and rounds the result to the\n // nearest floating-point representation.\n Preconditions.checkArgument(\n !(aNorm.equals(S2Point.ORIGIN) || bNorm.equals(S2Point.ORIGIN)),\n \"Exactly antipodal edges not supported by getIntersectionExact\");\n x = closestAcceptableEndpoint(a0, a1, aNorm, b0, b1, bNorm, x);\n }\n // assert (S2.isUnitLength(x));\n return x;\n }", "@Override\n public RayHit rayIntersectObj(Ray3D ray) {\n // Next check if ray hits this quadric\n Point3D hitPoint = findHitPoint(ray);\n if (hitPoint == null || !isWithinBounds(hitPoint)) {\n return RayHit.NO_HIT;\n }\n double distance = hitPoint.subtract(ray.getPoint()).length();\n Point3D normal = findNormalAtPoint(hitPoint);\n return new RayHit(hitPoint, distance, normal, this, new TextureCoordinate(0, 0));\n }", "int indexOf(GeometricalObject object);", "@Override\n public int octree_function(Object... obj) //public static int\n //o_sphere(\t\t\t/* compute intersection with sphere */\n //\tOBJECT.OBJREC so,\n //\tRAY r\n //)\n {\n OBJECT.OBJREC so = (OBJECT.OBJREC) obj[0];\n RAY r = (RAY) obj[1];\n double a, b, c;\t/* coefficients for quadratic equation */\n double[] root = new double[2];\t/* quadratic roots */\n int nroots;\n double t = 0;\n double[] ap;\n int i;\n\n if (so.oargs.nfargs != 4) {\n//\t\tobjerror(so, USER, \"bad # arguments\");\n }\n ap = so.oargs.farg;\n if (ap[3] < -FVECT.FTINY) {\n//\t\tobjerror(so, WARNING, \"negative radius\");\n so.otype = (short) (so.otype == OTYPES.OBJ_SPHERE\n ? OTYPES.OBJ_BUBBLE : OTYPES.OBJ_SPHERE);\n ap[3] = -ap[3];\n } else if (ap[3] <= FVECT.FTINY) {\n//\t\tobjerror(so, USER, \"zero radius\");\n }\n /*\n *\tWe compute the intersection by substituting into\n * the surface equation for the sphere. The resulting\n * quadratic equation in t is then solved for the\n * smallest positive root, which is our point of\n * intersection.\n *\tSince the ray is normalized, a should always be\n * one. We compute it here to prevent instability in the\n * intersection calculation.\n */\n /* compute quadratic coefficients */\n a = b = c = 0.0;\n for (i = 0; i < 3; i++) {\n a += r.rdir.data[i] * r.rdir.data[i];\n t = r.rorg.data[i] - ap[i];\n b += 2.0 * r.rdir.data[i] * t;\n c += t * t;\n }\n c -= ap[3] * ap[3];\n\n nroots = ZEROES.quadratic(root, a, b, c);\t/* solve quadratic */\n\n for (i = 0; i < nroots; i++) /* get smallest positive */ {\n if ((t = root[i]) > FVECT.FTINY) {\n break;\n }\n }\n if (i >= nroots) {\n return (0);\t\t\t/* no positive root */\n }\n\n if (t >= r.rot) {\n return (0);\t\t\t/* other is closer */\n }\n\n r.ro = so;\n r.rot = t;\n /* compute normal */\n a = ap[3];\n if (so.otype == OTYPES.OBJ_BUBBLE) {\n a = -a;\t\t\t/* reverse */\n }\n for (i = 0; i < 3; i++) {\n r.rop.data[i] = r.rorg.data[i] + r.rdir.data[i] * t;\n r.ron.data[i] = (r.rop.data[i] - ap[i]) / a;\n }\n r.rod = -FVECT.DOT(r.rdir, r.ron);\n r.rox = null;\n r.pert.data[0] = r.pert.data[1] = r.pert.data[2] = 0.0;\n r.uv[0] = r.uv[1] = 0.0;\n\n return (1);\t\t\t/* hit */\n }", "public abstract Proximity2DResult getNearestVertex(Geometry geom,\n\t\t\tPoint inputPoint);", "protected Coordinates intersectionFromClosestPoints() {\n if (closestPointA != null && closestPointB != null\n && geometry.almostEqual(closestPointA, closestPointB)) {\n return closestPointA;\n } else {\n return null;\n }\n }", "public static float intersectRayOnLine(PointF rayPos, PointF rayDir,\n PointF line0, PointF line1){\n PointF v1 = Vec2D.subtract(rayPos, line0);\n PointF v2 = Vec2D.subtract(line1, line0);\n PointF v3 = Vec2D.perpendicular(rayDir);\n\n return Vec2D.dot(v1, v3) / Vec2D.dot(v2, v3);\n }", "public Object getSegment(K node);", "@Test\n public void testGetIntersect() throws Exception {\n Vector farIntersect = sphere.getIntersect(new Vector(0,0,0),new Vector(0,-6,10));\n assertTrue(farIntersect.equals(new Vector(0,-6,10)));\n }", "public native VertexNode first();", "public final void mT__81() throws RecognitionException {\n try {\n int _type = T__81;\n int _channel = DEFAULT_TOKEN_CHANNEL;\n // InternalMyDsl.g:79:7: ( 'intersect' )\n // InternalMyDsl.g:79:9: 'intersect'\n {\n match(\"intersect\"); \n\n\n }\n\n state.type = _type;\n state.channel = _channel;\n }\n finally {\n }\n }", "public ProcessVertex getInVertex() {\n\t\treturn this.inVertex;\n\t}", "public Vector begin()\n\t{\n\t\treturn ray.origin;\n\t}", "public interface Ray3 extends Path3, Serializable, Cloneable {\r\n\r\n /**\r\n * Creates a new ray from 3 coordinates for the origin point and 3 coordinates for the direction vector.\r\n *\r\n * @param xo the x-coordinate of the origin\r\n * @param yo the y-coordinate of the origin\r\n * @param zo the z-coordinate of the origin\r\n * @param xd the x-coordinate of the direction\r\n * @param yd the y-coordinate of the direction\r\n * @param zd the z-coordinate of the direction\r\n * @return a new ray\r\n */\r\n @NotNull\r\n static Ray3 fromOD(double xo, double yo, double zo, double xd, double yd, double zd) {\r\n return new Ray3Impl(xo, yo, zo, xd, yd, zd);\r\n }\r\n\r\n /**\r\n * Creates a new ray from an origin point and a direction vector.\r\n *\r\n * @param origin the origin\r\n * @param dir the direction\r\n * @return a new ray\r\n */\r\n @NotNull\r\n static Ray3 fromOD(Vector3 origin, Vector3 dir) {\r\n return new Ray3Impl(origin, dir);\r\n }\r\n\r\n /**\r\n * Creates a new ray between two points.\r\n * The origin will be a copy of the point {@code from}.\r\n * The directional vector will be a new vector from {@code from} to {@code to}.\r\n *\r\n * @param from the first point\r\n * @param to the second point\r\n * @return a new ray\r\n */\r\n @NotNull\r\n static Ray3 between(Vector3 from, Vector3 to) {\r\n return fromOD(from, Vector3.between(from, to));\r\n }\r\n\r\n /**\r\n * Creates a new ray between two points.\r\n *\r\n * @param ox the origin x\r\n * @param oy the origin x\r\n * @param oz the origin x\r\n * @param tx the target x\r\n * @param ty the target x\r\n * @param tz the target x\r\n * @return a new ray\r\n */\r\n @NotNull\r\n static Ray3 between(double ox, double oy, double oz, double tx, double ty, double tz) {\r\n return fromOD(ox, oy, oz, tx-ox, ty-oy, tz-oz);\r\n }\r\n\r\n // GETTERS\r\n\r\n /**\r\n * Returns the x-coordinate of the origin of this ray.\r\n *\r\n * @return the x-coordinate of the origin of this ray\r\n */\r\n abstract double getOrgX();\r\n\r\n /**\r\n * Returns the y-coordinate of the origin of this ray.\r\n *\r\n * @return the y-coordinate of the origin of this ray\r\n */\r\n abstract double getOrgY();\r\n\r\n /**\r\n * Returns the z-coordinate of the origin of this ray.\r\n *\r\n * @return the z-coordinate of the origin of this ray\r\n */\r\n abstract double getOrgZ();\r\n\r\n /**\r\n * Returns the x-coordinate of the direction of this ray.\r\n *\r\n * @return the x-coordinate of the direction of this ray\r\n */\r\n abstract double getDirX();\r\n\r\n /**\r\n * Returns the y-coordinate of the direction of this ray.\r\n *\r\n * @return the y-coordinate of the direction of this ray\r\n */\r\n abstract double getDirY();\r\n\r\n /**\r\n * Returns the z-coordinate of the direction of this ray.\r\n *\r\n * @return the z-coordinate of the direction of this ray\r\n */\r\n abstract double getDirZ();\r\n\r\n /**\r\n * Returns the length of this ray.\r\n *\r\n * @return the length of this ray\r\n */\r\n abstract double getLength();\r\n\r\n /**\r\n * Returns the squared length of this ray.\r\n *\r\n * @return the squared length of this ray\r\n */\r\n abstract double getLengthSquared();\r\n \r\n /**\r\n * Returns the origin of this ray in a new vector.\r\n *\r\n * @return the origin of this ray in a new vector\r\n */\r\n @Override\r\n default Vector3 getOrigin() {\r\n return Vector3.fromXYZ(getOrgX(), getOrgY(), getOrgZ());\r\n }\r\n \r\n /**\r\n * Returns the direction of this ray in a new vector.\r\n *\r\n * @return the direction of this ray in a new vector\r\n */\r\n default Vector3 getDirection() {\r\n return Vector3.fromXYZ(getDirX(), getDirY(), getDirZ());\r\n }\r\n \r\n default AxisAlignedBB getBoundaries() {\r\n return AxisAlignedBB.between(getOrigin(), getEnd());\r\n }\r\n\r\n // PATH IMPL\r\n \r\n /**\r\n * Returns the end of this ray in a new vector. This is equal to the sum of the origin and direction of the vector.\r\n *\r\n * @return the end of this ray in a new vector\r\n */\r\n @Override\r\n default Vector3 getEnd() {\r\n return Vector3.fromXYZ(getOrgX() + getDirX(), getOrgY() + getDirY(), getOrgZ() + getDirZ());\r\n }\r\n\r\n @Override\r\n default Vector3[] getControlPoints() {\r\n return new Vector3[] {getOrigin(), getEnd()};\r\n }\r\n\r\n // CHECKERS\r\n\r\n /**\r\n * Returns whether the ray is equal to the given point at any point.\r\n *\r\n * @param x the x-coordinate of the point\r\n * @param y the y-coordinate of the point\r\n * @param z the z-coordinate of the point\r\n * @return whether the ray is equal to the given point at any point\r\n */\r\n default boolean contains(double x, double y, double z) {\r\n return Vector3.between(getOrgX(), getOrgY(), getOrgZ(), x, y, z).isMultipleOf(getDirection());\r\n }\r\n\r\n /**\r\n * Returns whether the ray is equal to the given point at any point.\r\n *\r\n * @param point the point\r\n * @return whether the ray is equal to the given point at any point\r\n */\r\n default boolean contains(Vector3 point) {\r\n return contains(point.getX(), point.getY(), point.getZ());\r\n }\r\n\r\n /**\r\n * Returns whether this ray is equal to another ray. This condition is true\r\n * if both origin and direction are equal.\r\n *\r\n * @param ray the ray\r\n * @return whether this ray is equal to the ray\r\n */\r\n default boolean equals(Ray3 ray) {\r\n return\r\n getOrigin().equals(ray.getOrigin()) &&\r\n getDirection().isMultipleOf(ray.getDirection());\r\n }\r\n\r\n // SETTERS\r\n\r\n /**\r\n * Sets the origin of the ray to a given point.\r\n *\r\n * @param x the x-coordinate of the point\r\n * @param y the y-coordinate of the point\r\n * @param z the z-coordinate of the point\r\n */\r\n abstract void setOrigin(double x, double y, double z);\r\n\r\n /**\r\n * Sets the origin of the ray to a given point.\r\n *\r\n * @param point the point\r\n */\r\n default void setOrigin(Vector3 point) {\r\n setOrigin(point.getX(), point.getY(), point.getZ());\r\n }\r\n\r\n /**\r\n * Sets the direction of this ray to a given vector.\r\n *\r\n * @param x the x-coordinate of the vector\r\n * @param y the y-coordinate of the vector\r\n * @param z the z-coordinate of the vector\r\n */\r\n abstract void setDirection(double x, double y, double z);\r\n \r\n /**\r\n * Sets the direction of this ray to a given vector.\r\n *\r\n * @param v the vector\r\n */\r\n default void setDirection(Vector3 v) {\r\n setDirection(v.getX(), v.getY(), v.getZ());\r\n }\r\n\r\n /**\r\n * Sets the length of this ray to a given length.\r\n *\r\n * @param t the new hypot\r\n */\r\n default void setLength(double t) {\r\n scaleDirection(t / getLength());\r\n }\r\n\r\n default void normalize() {\r\n setLength(1);\r\n }\r\n \r\n //TRANSFORMATIONS\r\n \r\n default void scaleOrigin(double x, double y, double z) {\r\n setDirection(getOrgX()*x, getOrgY()*y, getOrgZ()*z);\r\n }\r\n \r\n default void scaleDirection(double x, double y, double z) {\r\n setDirection(getDirX()*x, getDirY()*y, getDirZ()*z);\r\n }\r\n \r\n default void scaleOrigin(double factor) {\r\n scaleOrigin(factor, factor, factor);\r\n }\r\n \r\n default void scaleDirection(double factor) {\r\n scaleDirection(factor, factor, factor);\r\n }\r\n \r\n default void scale(double x, double y, double z) {\r\n scaleOrigin(x, y, z);\r\n scaleDirection(x, y, z);\r\n }\r\n \r\n default void scale(double factor) {\r\n scale(factor, factor, factor);\r\n }\r\n \r\n /**\r\n * Translates the ray origin by a given amount on each axis.\r\n *\r\n * @param x the x-coordinate\r\n * @param y the y-coordinate\r\n * @param z the z-coordinate\r\n */\r\n abstract void translate(double x, double y, double z);\r\n\r\n // MISC\r\n\r\n /**\r\n * <p>\r\n * Returns a new interval iterator for this ray. This iterator will return all points in a given interval that\r\n * are on a ray.\r\n * </p>\r\n * <p>\r\n * For example, a ray with hypot 1 will produce an iterator that iterates over precisely 3 points if the\r\n * interval is 0.5 (or 0.4).\r\n * </p>\r\n * <p>\r\n * To get an iterator that iterates over a specified amount of points {@code x}, make use of\r\n * <blockquote>\r\n * {@code intervalIterator( getLength() / (x - 1) )}\r\n * </blockquote>\r\n * </p>\r\n *\r\n * @param interval the interval of iteration\r\n * @return a new interval iterator\r\n */\r\n default Iterator<Vector3> intervalIterator(double interval) {\r\n return new IntervalIterator(this, interval);\r\n }\r\n\r\n /**\r\n * <p>\r\n * Returns a new interval iterator for this ray. This iterator will return all points in a given interval that\r\n * are on a ray.\r\n * </p>\r\n * <p>\r\n * For example, a ray with hypot 1 will produce an iterator that iterates over precisely 3 points if the\r\n * interval is 0.5 (or 0.4).\r\n * </p>\r\n * <p>\r\n * To get an iterator that iterates over a specified amount of points {@code x}, make use of\r\n * <blockquote>\r\n * {@code intervalIterator( getLength() / (x - 1) )}\r\n * </blockquote>\r\n * </p>\r\n *\r\n * @return a new interval iterator\r\n */\r\n default Iterator<BlockVector> blockIntervalIterator() {\r\n return new BlockIntervalIterator(this);\r\n }\r\n\r\n /**\r\n * Returns a given amount of equally distributed points on this ray.\r\n *\r\n * @param amount the amount\r\n * @return an array containing points on this ray\r\n */\r\n @Override\r\n default Vector3[] getPoints(int amount) {\r\n if (amount < 0) throw new IllegalArgumentException(\"amount < 0\");\r\n if (amount == 0) return new Vector3[0];\r\n if (amount == 1) return new Vector3[] {getOrigin()};\r\n if (amount == 2) return new Vector3[] {getOrigin(), getEnd()};\r\n\r\n int t = amount - 1, i = 0;\r\n Vector3[] result = new Vector3[amount];\r\n\r\n Iterator<Vector3> iter = intervalIterator(getLengthSquared() / t*t);\r\n while (iter.hasNext())\r\n result[i++] = iter.next();\r\n\r\n return result;\r\n }\r\n\r\n abstract Ray3 clone();\r\n\r\n}", "public static float intersectRayLine(PointF rayPos, PointF rayDir,\n PointF line0, PointF line1){\n float fPosOnRay = intersectRayOnLine(line0, Vec2D.subtract(line1, line0), rayPos, Vec2D.add(rayPos, rayDir) );\n\n if(fPosOnRay < 0)\n return Float.NEGATIVE_INFINITY;\n return intersectRayOnLine(rayPos, rayDir, line0, line1);\n }", "public double pointOnLineT(int x, int y)\r\n {\r\n if (x == c0.x && y == c0.y)\r\n {\r\n return 0;\r\n }\r\n if (x == c1.x && y == c1.y)\r\n {\r\n return 1;\r\n }\r\n \r\n int dx = c1.x - c0.x;\r\n int dy = c1.y - c0.y;\r\n \r\n if (Math.abs(dx) > Math.abs(dy))\r\n {\r\n return (x - c0.x) / (double)dx;\r\n }\r\n else\r\n {\r\n return (y - c0.y) / (double)dy;\r\n }\r\n }", "public LineLineIntersector(Line2D line1, Line2D line2) {\r\n\t\tthis.line1 = line1.getBoundedRepresentation();\r\n\t\tthis.line2 = line2.getBoundedRepresentation();\r\n\t\tp0 = this.line1.getStart();\r\n\t\tp1 = this.line1.getEnd();\r\n\t\tq0 = this.line2.getStart();\r\n\t\tq1 = this.line2.getEnd();\r\n\t\t\r\n\t\tresult = establishIntersectionType();\r\n\t}", "public ListNode getIntersectionNode(ListNode headA, ListNode headB) {\r\n\t\tHashSet<ListNode> hashSet = new HashSet<ListNode>();\r\n\t\tListNode head = headA;\r\n\t\twhile (head != null) {\r\n\t\t\thashSet.add(head);\r\n\t\t\thead = head.next;\r\n\t\t}\r\n\t\thead = headB;\r\n\t\twhile (head != null) {\r\n\t\t\tif (hashSet.contains(head)) {\r\n\t\t\t\treturn head;\r\n\t\t\t}\r\n\t\t\thashSet.add(head);\r\n\t\t\thead = head.next;\r\n\t\t}\r\n\t\treturn null;\r\n\t}", "public Point3 intersects(Plane3 p) {\n // All the constants will be the position vector, i.e., some point on the line\n if (intersect.DEBUG) System.out.println(\"Constant Terms: <\" + this.pt + \">\");\n\n // λ coefficients will be all those in the direction vector of the line\n if (intersect.DEBUG) System.out.println(\"λ coefficients: \" + this);\n\n // Plane equation is each component multiplied by the respective normal\n // vector of the plane\n if (intersect.DEBUG) System.out.printf(\"Plane equation: %.1f(%.1f + %.1fλ) + %.1f(%.1f + %.1fλ) + %.1f(%.1f + %.1fλ) = %.3f\\n\", p.v.x, pt.x, this.x, p.v.y, pt.y, this.y, p.v.z, pt.z, this.z, p.d);\n\n // Gather all constant terms from the plane equation\n double constantTerm = (p.v.x * pt.x) + (p.v.y * pt.y) + (p.v.z * pt.z);\n if (intersect.DEBUG) System.out.printf(\"K: %.2f\\t\", constantTerm);\n\n // Gather all λ terms\n double lambdaCoefficient = (p.v.x * this.x) + (p.v.y * this.y) + (p.v.z * this.z);\n if (intersect.DEBUG) System.out.printf(\"K_λ: %.1f\\n\", lambdaCoefficient);\n\n // If the coefficient for lambda is zero, we have a degenerate case\n if (lambdaCoefficient == 0) {\n // If the constant is the same as the actual magnitude of the plane's\n // normal vector, the line lies on the plane\n // Within a margin of error because rounding is a pain in the ass\n if (Math.abs(constantTerm - p.d) < 1e-6)\n intersect.overlapFlag = true;\n\n return null;\n }\n\n // Solve for the unknown, λ.\n double lambda = (p.d - constantTerm) / lambdaCoefficient;\n if (intersect.DEBUG) System.out.printf(\"λ: %.2f\\n\", lambda);\n\n // Plug in λ into the parametric equations for the line to find\n // point of intersection\n double newX = lambda * this.x + pt.x;\n double newY = lambda * this.y + pt.y;\n double newZ = lambda * this.z + pt.z;\n return new Point3(newX, newY, newZ);\n }", "@Override\n public void intersect( Ray ray, IntersectResult result ) {\n \t\tVector3d e = new Vector3d(ray.eyePoint);\n \t\te.sub(this.center);\n \t\tdouble a = ray.viewDirection.dot(ray.viewDirection);\n \t\tdouble b = 2 * ray.viewDirection.dot(e);\n \t\tdouble c = e.dot(e) - this.radius * this.radius;\n \t\tdouble discriminant = b*b - 4*a*c;\n \t\t\n \t\tif (discriminant == 0.0) {\n \t\t\t\n \t\t\tdouble t_pos = -0.5 * b / a;\n \t\t\t// scale ray viewDirection to be t_pos length\n\t\t\t// point of intersection is at ray.eyePoint + scaled viewDirection vector\n\t\t\tPoint3d point_of_intersection = new Point3d(ray.viewDirection);\n\t\t\tpoint_of_intersection.scale(t_pos);\n\t\t\tpoint_of_intersection.add(ray.eyePoint);\n\t\t\t\n\t\t\t// normal is point_of_intersection - sphere.center\n\t\t\tVector3d normal = new Vector3d();\n\t\t\tnormal.add(point_of_intersection);\n\t\t\tnormal.sub(this.center);\n\t\t\tnormal.normalize();\n\t\t\t\n\t\t\tresult.p.set(point_of_intersection);\n\t\t\tresult.material = this.material;\n\t\t\tresult.t = t_pos;\n\t\t\tresult.n.set(normal);\n \t\t\t\n \t\t}\n \t\telse if (discriminant > 0.0) {\n \t\t\t\n \t\t\t// solve quadratic formula\n \t\t\tdouble q = (b > 0) ? -0.5 * (b + Math.sqrt(discriminant)) : -0.5 * (b - Math.sqrt(discriminant));\n \t\t\tdouble t_pos = q / a;\n \t\t\tdouble t_neg = c / q;\n \t\t\t\n \t\t\tif (t_pos < t_neg) {\n \t\t\t\tdouble temp = t_pos;\n \t\t\t\tt_pos = t_neg;\n \t\t\t\tt_neg = temp;\n \t\t\t}\n \t\t\t\t\n \t\t\tif (t_neg > 0) {\n \t\t\t\t// scale ray viewDirection to be t_neg length\n \t\t\t\t// point of intersection is at ray.eyePoint + scaled viewDirection vector\n \t\t\tPoint3d point_of_intersection = new Point3d(ray.viewDirection);\n \t\t\tpoint_of_intersection.scale(t_neg);\n \t\t\tpoint_of_intersection.add(ray.eyePoint);\n \t\t\t\n \t\t\t// normal is point_of_intersection - sphere.center\n \t\t\tVector3d normal = new Vector3d();\n \t\t\tnormal.add(point_of_intersection);\n \t\t\tnormal.sub(this.center);\n \t\t\tnormal.normalize();\n \t\t\t\n \t\t\tresult.p.set(point_of_intersection);\n \t\t\tresult.material = this.material;\n \t\t\tresult.t = t_neg;\n \t\t\tresult.n.set(normal);\n \t\t\t}\n\t\n \t\t}\n \t\t\n \t\t\n \t\t\n \t\t\n \t\t\n\n }", "private Type establishIntersectionType() {\n\r\n\t\tdouble Pq0 = AngleUtil.getTurn(p0, p1, q0);\r\n\t\tdouble Pq1 = AngleUtil.getTurn(p0, p1, q1);\r\n\r\n\t\tdouble Qp0 = AngleUtil.getTurn(q0, q1, p0);\r\n\t\tdouble Qp1 = AngleUtil.getTurn(q0, q1, p1);\r\n\r\n\t\t// check if all turn have none angle. In this case, lines are collinear.\r\n\t\tif (Pq0 == AngleUtil.NONE && Pq1 == AngleUtil.NONE || Qp0 == AngleUtil.NONE && Qp1 == AngleUtil.NONE) {\r\n\t\t\t// at this point, we know that lines are collinear.\r\n\t\t\t// we must check if they overlap for segments intersection\r\n\t\t\tif (q0.getDistance(p0) <= p0.getDistance(p1) && q0.getDistance(p1) <= p0.getDistance(p1)) {\r\n\t\t\t\t// then q0 is in P limits and p0 or p1 is in Q limits\r\n\t\t\t\t// TODO this check is no sufficient\r\n\t\t\t\tinPLimits = true;\r\n\t\t\t\tinQLimits = true;\r\n\t\t\t}\r\n\t\t\treturn Type.COLLINEAR;\r\n\t\t}\r\n\t\t// check if q0 and q1 lie around P AND p0 and p1 lie around Q.\r\n\t\t// in this case, the two segments intersect\r\n\t\telse if (Pq0 * Pq1 <= 0 && Qp0 * Qp1 <= 0) {\r\n\t\t\t// else if(Pq0 <= 0 && Pq1 >= 0 && Qp0 <= 0 && Qp1 >= 0 ||\r\n\t\t\t// Pq0 >= 0 && Pq1 <= 0 && Qp0 >= 0 && Qp1 <= 0){\r\n\r\n\t\t\tinPLimits = true;\r\n\t\t\tinQLimits = true;\r\n\t\t\treturn Type.INTERSECT;\r\n\t\t}\r\n\r\n\t\t// At this point, we know that segments are not crossing\r\n\t\t// check if q0 and q1 lie around P or p0 and p1 lie around Q.\r\n\t\t// in this case, a segment cross a line\r\n\t\telse if (Pq0 * Pq1 <= 0) {\r\n\t\t\tinQLimits = true;\r\n\t\t\treturn Type.INTERSECT;\r\n\t\t} else if (Qp0 * Qp1 <= 0) {\r\n\t\t\tinPLimits = true;\r\n\t\t\treturn Type.INTERSECT;\r\n\t\t}\r\n\r\n\t\t// At this point, we know that each segment lie on one side of the other\r\n\t\t// We now check the slope to know if lines are Type.PARALLEL\r\n\t\tdouble pSlope = p0.getSlope(p1);\r\n\t\tdouble qSlope = q0.getSlope(q1);\r\n\t\tif (PrecisionUtil.areEquals(pSlope, qSlope))\r\n\t\t\t// TODO check the infinity case\r\n\t\t\t// this test works even if the slopes are \"Double.infinity\" due to the verticality of the lines and division\r\n\t\t\t// by 0\r\n\t\t\treturn Type.PARALLEL;\r\n\t\telse\r\n\t\t\treturn Type.INTERSECT;\r\n\t}", "Point getPointByNodeId(Integer nodeId);", "public double findRayIntersection(Vec3 origin, Vec3 direction, Vec3 normal)\n {\n double scale = width/obj.getScale();\n double ox = origin.x*scale+0.5*width;\n double oy = origin.y*scale+0.5*width;\n double oz = origin.z*scale+0.5*width;\n double dx = direction.x;\n double dy = direction.y;\n double dz = direction.z;\n\n // Find the intersection of the ray with the bounding box.\n\n double mint = -Double.MAX_VALUE;\n double maxt = Double.MAX_VALUE;\n if (dx == 0.0)\n {\n if (ox < minx || ox > maxx)\n return 0.0;\n }\n else\n {\n double t1 = (minx-ox)/dx;\n double t2 = (maxx-ox)/dx;\n if (t1 < t2)\n {\n if (t1 > mint)\n mint = t1;\n if (t2 < maxt)\n maxt = t2;\n }\n else\n {\n if (t2 > mint)\n mint = t2;\n if (t1 < maxt)\n maxt = t1;\n }\n if (mint > maxt || maxt < 0.0)\n return 0.0;\n }\n if (dy == 0.0)\n {\n if (oy < miny || oy > maxy)\n return 0.0;\n }\n else\n {\n double t1 = (miny-oy)/dy;\n double t2 = (maxy-oy)/dy;\n if (t1 < t2)\n {\n if (t1 > mint)\n mint = t1;\n if (t2 < maxt)\n maxt = t2;\n }\n else\n {\n if (t2 > mint)\n mint = t2;\n if (t1 < maxt)\n maxt = t1;\n }\n if (mint > maxt || maxt < 0.0)\n return 0.0;\n }\n if (dz == 0.0)\n {\n if (oz < minz || oz > maxz)\n return 0.0;\n }\n else\n {\n double t1 = (minz-oz)/dz;\n double t2 = (maxz-oz)/dz;\n if (t1 < t2)\n {\n if (t1 > mint)\n mint = t1;\n if (t2 < maxt)\n maxt = t2;\n }\n else\n {\n if (t2 > mint)\n mint = t2;\n if (t1 < maxt)\n maxt = t1;\n }\n if (mint > maxt || maxt < 0.0)\n return 0.0;\n }\n if (mint < 0.0)\n mint = 0.0;\n\n // Find the first voxel and initialize variables.\n\n double xpos = ox+mint*dx;\n double ypos = oy+mint*dy;\n double zpos = oz+mint*dz;\n int x = Math.max(Math.min((int) xpos, maxx), minx);\n int y = Math.max(Math.min((int) ypos, maxy), miny);\n int z = Math.max(Math.min((int) zpos, maxz), minz);\n int stepx, stepy, stepz;\n int finalx, finaly, finalz;\n double tdeltax, tdeltay, tdeltaz;\n double tmaxx, tmaxy, tmaxz;\n if (dx < 0.0)\n {\n stepx = -1;\n finalx = minx-1;\n tdeltax = -1.0/dx;\n tmaxx = (x-ox)/dx;\n }\n else if (dx > 0.0)\n {\n stepx = 1;\n finalx = maxx+1;\n tdeltax = 1.0/dx;\n tmaxx = (x+1-ox)/dx;\n }\n else\n {\n stepx = 0;\n finalx = 0;\n tdeltax = 0.0;\n tmaxx = Double.MAX_VALUE;\n }\n if (dy < 0.0)\n {\n stepy = -1;\n finaly = miny-1;\n tdeltay = -1.0/dy;\n tmaxy = (y-oy)/dy;\n }\n else if (dy > 0.0)\n {\n stepy = 1;\n finaly = maxy+1;\n tdeltay = 1.0/dy;\n tmaxy = (y+1-oy)/dy;\n }\n else\n {\n stepy = 0;\n finaly = 0;\n tdeltay = 0.0;\n tmaxy = Double.MAX_VALUE;\n }\n if (dz < 0.0)\n {\n stepz = -1;\n finalz = minz-1;\n tdeltaz = -1.0/dz;\n tmaxz = (z-oz)/dz;\n }\n else if (dz > 0.0)\n {\n stepz = 1;\n finalz = maxz+1;\n tdeltaz = 1.0/dz;\n tmaxz = (z+1-oz)/dz;\n }\n else\n {\n stepz = 0;\n finalz = 0;\n tdeltaz = 0.0;\n tmaxz = Double.MAX_VALUE;\n }\n\n // Step through the voxels, looking for intersections.\n\n VoxelOctree voxels = obj.getVoxels();\n byte values[] = new byte[8];\n while (true)\n {\n int index = x*width*width+y*width+z;\n if ((flags[index/32]&(1<<(index%32))) != 0)\n {\n // There is a piece of the surface in this voxel, so see if the ray intersects it.\n // First find the values of t at which the ray enters and exits it.\n \n double tenter = -Double.MAX_VALUE;\n double texit = Double.MAX_VALUE;\n if (dx != 0.0)\n {\n double t1 = (x-ox)/dx;\n double t2 = (x+1-ox)/dx;\n if (t1 < t2)\n {\n if (t1 > tenter)\n tenter = t1;\n if (t2 < texit)\n texit = t2;\n }\n else\n {\n if (t2 > tenter)\n tenter = t2;\n if (t1 < texit)\n texit = t1;\n }\n }\n if (dy != 0.0)\n {\n double t1 = (y-oy)/dy;\n double t2 = (y+1-oy)/dy;\n if (t1 < t2)\n {\n if (t1 > tenter)\n tenter = t1;\n if (t2 < texit)\n texit = t2;\n }\n else\n {\n if (t2 > tenter)\n tenter = t2;\n if (t1 < texit)\n texit = t1;\n }\n }\n if (dz != 0.0)\n {\n double t1 = (z-oz)/dz;\n double t2 = (z+1-oz)/dz;\n if (t1 < t2)\n {\n if (t1 > tenter)\n tenter = t1;\n if (t2 < texit)\n texit = t2;\n }\n else\n {\n if (t2 > tenter)\n tenter = t2;\n if (t1 < texit)\n texit = t1;\n }\n }\n if (tenter < 0.0)\n continue; // Ignore intersections in the voxel containing the origin.\n\n // Look up the values at the eight corners of the voxel.\n\n values[0] = voxels.getValue(x, y, z);\n values[1] = voxels.getValue(x, y, z+1);\n values[2] = voxels.getValue(x, y+1, z);\n values[3] = voxels.getValue(x, y+1, z+1);\n values[4] = voxels.getValue(x+1, y, z);\n values[5] = voxels.getValue(x+1, y, z+1);\n values[6] = voxels.getValue(x+1, y+1, z);\n values[7] = voxels.getValue(x+1, y+1, z+1);\n\n // Find the positions within the voxel where the ray enters and exits.\n\n double xenter = ox+dx*tenter-x;\n double yenter = oy+dy*tenter-y;\n double zenter = oz+dz*tenter-z;\n double xexit = ox+dx*texit-x;\n double yexit = oy+dy*texit-y;\n double zexit = oz+dz*texit-z;\n\n // Interpolate the find the values at those points.\n\n double enterValue = values[0]*(1.0-xenter)*(1.0-yenter)*(1.0-zenter)\n +values[1]*(1.0-xenter)*(1.0-yenter)*zenter\n +values[2]*(1.0-xenter)*yenter*(1.0-zenter)\n +values[3]*(1.0-xenter)*yenter*zenter\n +values[4]*xenter*(1.0-yenter)*(1.0-zenter)\n +values[5]*xenter*(1.0-yenter)*zenter\n +values[6]*xenter*yenter*(1.0-zenter)\n +values[7]*xenter*yenter*zenter;\n double exitValue = values[0]*(1.0-xexit)*(1.0-yexit)*(1.0-zexit)\n +values[1]*(1.0-xexit)*(1.0-yexit)*zexit\n +values[2]*(1.0-xexit)*yexit*(1.0-zexit)\n +values[3]*(1.0-xexit)*yexit*zexit\n +values[4]*xexit*(1.0-yexit)*(1.0-zexit)\n +values[5]*xexit*(1.0-yexit)*zexit\n +values[6]*xexit*yexit*(1.0-zexit)\n +values[7]*xexit*yexit*zexit;\n if ((enterValue > 0 && exitValue <= 0) || (enterValue <= 0 && exitValue > 0))\n {\n // Find the intersection point.\n\n double weight1 = Math.abs(exitValue);\n double weight2 = Math.abs(enterValue);\n double d = 1.0/(weight1+weight2);\n weight1 *= d;\n weight2 *= d;\n double tintersect = (tenter*weight1 + texit*weight2)/scale;\n if (normal != null)\n {\n normal.set(values[0]+values[1]+values[2]+values[3]-values[4]-values[5]-values[6]-values[7],\n values[0]+values[1]-values[2]-values[3]+values[4]+values[5]-values[6]-values[7],\n values[0]-values[1]+values[2]-values[3]+values[4]-values[5]+values[6]-values[7]);\n normal.normalize();\n }\n return tintersect;\n }\n }\n\n // Advance to the next voxel.\n\n if (tmaxx < tmaxy)\n {\n if (tmaxx < tmaxz)\n {\n x += stepx;\n if (x == finalx)\n return 0.0;\n tmaxx += tdeltax;\n }\n else\n {\n z += stepz;\n if (z == finalz)\n return 0.0;\n tmaxz += tdeltaz;\n }\n }\n else\n {\n if (tmaxy < tmaxz)\n {\n y += stepy;\n if (y == finaly)\n return 0.0;\n tmaxy += tdeltay;\n }\n else\n {\n z += stepz;\n if (z == finalz)\n return 0.0;\n tmaxz += tdeltaz;\n }\n }\n }\n }", "public Point2D\ngetThreePrimeTailIntersect(double gap)\nthrows Exception\n{\n\tdouble[] uArray = new double[2];\n\tint[] sideArray = new int[2];\n\tPoint2D intersect0Pt = new Point2D.Double();\n\tPoint2D intersect1Pt = new Point2D.Double();\n\n\tRectangle2D rect = this.getCenteredBoundingBox();\n\n\tboolean intersects = BLine2D.getRectangleRayIntersect(\n\t\trect, this.getThreePrimeRay(),\n\t\tintersect0Pt, intersect1Pt, uArray, sideArray);\n\n\tif (!intersects)\n\t\treturn (null);\n\n\tif (gap != 0.0)\n\t{\n\t\tBLine2D tmpLine = new BLine2D(this.getThreePrimeRay().getP1(),\n\t\t\tintersect0Pt);\n\t\ttmpLine.setRayFromLength(tmpLine.length() + gap);\n\t\tintersect0Pt = tmpLine.getP2();\n\t}\n\n\treturn (intersect0Pt);\n}", "@Override\n public boolean\n doIntersection(Ray inOut_Ray) {\n // TODO!\n return false;\n }", "void shortestPath( final VertexType fromNode, Integer node );", "private Point2D calcConnectionPoint(double x1, double y1, double x2, double y2) {\n\t\t// calculating midpoint for x on the edge between obj1\n\t\t// and obj2\n\t\tif (x1 > x2) {\n\t\t\tx1 = ((x1 - x2) / 2) + x2;\n\t\t} else if (x2 > x1) {\n\t\t\tx1 = ((x2 - x1) / 2) + x1;\n\t\t}\n\n\t\t// calculating midpoint for y on the edge between obj1\n\t\t// and obj2\n\t\tif (y1 > y2) {\n\t\t\ty1 = ((y1 - y2) / 2) + y2;\n\t\t} else if (y2 > y1) {\n\t\t\ty1 = ((y2 - y1) / 2) + y1;\n\t\t}\n\n\t\treturn new Point2D.Double(x1, y1);\n\t}", "PVector _getCenter() {\n PVector cen = new PVector(_hitboxCenter.x, _hitboxCenter.y);\n cen.rotate(_rotVector.heading() - _front);\n cen.x += _x;\n cen.y += _y;\n return cen;\n }" ]
[ "0.6140765", "0.6108166", "0.6091502", "0.6088606", "0.5999066", "0.5930309", "0.59294474", "0.5851345", "0.5847873", "0.57952553", "0.57715213", "0.57354236", "0.5709597", "0.5647896", "0.56203574", "0.5616465", "0.5598661", "0.5596076", "0.5588474", "0.558786", "0.54980624", "0.54740477", "0.5471652", "0.5461736", "0.54603964", "0.544555", "0.5444732", "0.53970623", "0.53929794", "0.5378772", "0.5359109", "0.53469664", "0.5305302", "0.5296262", "0.5295122", "0.5280235", "0.5258271", "0.52357745", "0.5226864", "0.51906455", "0.516223", "0.51541126", "0.515012", "0.5128585", "0.51262146", "0.512294", "0.51228166", "0.51184034", "0.5112703", "0.51108354", "0.51069295", "0.5100698", "0.5097765", "0.5089889", "0.5086955", "0.5067559", "0.50534886", "0.50426984", "0.50324166", "0.5011147", "0.5009205", "0.50078005", "0.49958053", "0.49787477", "0.49708208", "0.49611276", "0.49574366", "0.49512857", "0.4949661", "0.4948122", "0.49477383", "0.49458218", "0.4938678", "0.49276772", "0.49131995", "0.49106485", "0.4896736", "0.48896614", "0.48892653", "0.4873226", "0.4871473", "0.48705336", "0.486709", "0.48665395", "0.48653537", "0.4864349", "0.4856833", "0.48461273", "0.48376334", "0.48329964", "0.48216417", "0.4818934", "0.48157182", "0.48151696", "0.48141727", "0.48138762", "0.4813113", "0.48006752", "0.48001236", "0.4798452", "0.4793721" ]
0.0
-1
////////////////////////////////////////////////////////////////////// Description: Returns the surface normal in object space that corresponds to the given node in the path. Use: public java port
public SbVec3f getObjectNormal() { return getObjectNormal(null); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "godot.wire.Wire.Vector3 getNormal();", "public SbVec3f getNormal() { return worldNormal; }", "@java.lang.Override\n public godot.wire.Wire.Vector3 getNormal() {\n return normal_ == null ? godot.wire.Wire.Vector3.getDefaultInstance() : normal_;\n }", "public Point4 getNormal();", "public VectorA normal()\n {\n return new VectorA(this.x/this.mag(), this.y/this.mag());\n }", "public Vector3 getNormal() {\n\t\tdouble mag = this.magnitude();\n\t\tif (mag > 0) {\n\t\t\treturn new Vector3(\n\t\t\t\t\tthis.x/mag,\n\t\t\t\t\tthis.y/mag,\n\t\t\t\t\tthis.z/mag\n\t\t\t\t\t);\n\t\t} else {\n\t\t\treturn new Vector3();\n\t\t}\n\t}", "private void computeNormal() {\n normal = getDirection();\r\n\r\n // Rotate by -90 degrees to get normal of line\r\n float oldY = normal.y;\r\n normal.y = -normal.x;\r\n normal.x = oldY;\r\n }", "@Override\n public Vector getNormal(Point3D p) {\n Vector O_P= p.subtract(_center);\n return O_P.normalize();\n // return null;\n }", "@Override\n\tpublic Vector getNormal(Point3D point) {\n\t\tdouble temp=axisRay.getDir().dotProduct(point.subtract(axisRay.getP0()));\n\t\tif(Util.isZero(temp/100))return (point.subtract(Point3D.ZERO)).normalize();\n\t\tPoint3D O=axisRay.getP0().add(axisRay.getDir().scale(temp));\n\t\treturn (point.subtract(O)).normalize();\n\n\t}", "public Vector2D normal()\n\t{\n\t\treturn this.mul(1/this.length());\n\t}", "public Point4 getNormal(int pointNr);", "private Vector normal(int[] face) {\n\t\tVector point0 = verts[face[0]];\n\t\tVector point1 = verts[face[1]];\n\t\tVector point2 = verts[face[2]];\n\t\treturn point1.subtract(point0).crossProduct(point2.subtract(point0)).normalise();\n\t}", "@Test\n void getNormal() {\n Plane pl = new Plane(new Point3D(-1,2,1), new Point3D(0,-3,2), new Point3D(1,1,-4)\n );\n\n assertEquals(new Vector(26,7,9).normalize(),\n pl.getNormal(),\n \"Bad normal to trinagle\");\n\n }", "public godot.wire.Wire.Vector3 getNormal() {\n if (normalBuilder_ == null) {\n return normal_ == null ? godot.wire.Wire.Vector3.getDefaultInstance() : normal_;\n } else {\n return normalBuilder_.getMessage();\n }\n }", "@Override\n Vector calculate_normal_vector(Point hitPoint, int surface) {\n Point origin = new Point(0, 0, 0);\n return getInternalTransformer().substraction_to_vector(hitPoint, origin);\n }", "@Override\n\tpublic Vector3D findNormalAt(Point3D point) {\n\t\treturn plane.findNormalAt(point);\n\t}", "private Vector3f calcNormal(int loopStart) throws IOException {\n\t\t// calculating the normal of the polygon using the first 3 vertices \n\t\t// of the planar face:\n\t\t//\t\t\tvec3 ab = b - a;\n\t\t// vec3 ac = c - a;\n\t\t// vec3 normal = normalize(cross(ab, ac));\n\t\tMLoop loop = loops[loopStart + 0];\n\t\tCArrayFacade<Float> a = vertices[loop.getV()].getCo();\n\t\tloop = loops[loopStart + 1];\n\t\tCArrayFacade<Float> b = vertices[loop.getV()].getCo();\n\t\tloop = loops[loopStart + 2];\n\t\tCArrayFacade<Float> c = vertices[loop.getV()].getCo();\n\t\t\n\t\tVector3f ab = new Vector3f(b.get(0)-a.get(0), b.get(1)-a.get(1), b.get(2)-a.get(2));\n\t\tVector3f ac = new Vector3f(c.get(0)-a.get(0), c.get(1)-a.get(1), c.get(2)-a.get(2));\n\t\t\n\t\treturn ab.cross(ac);\n\t}", "public Vector3 normalizeLocal () {\n return normalize(this);\n }", "@Override\n public Vector getNormal(Point3D P) {\n Point3D O = _center;\n Vector n = P.subtract(O);\n return n.normalized();\n }", "public Vector2f normalizeLocal ()\n {\n return normalize(this);\n }", "public ByteBuffer getNormalBuffer() {\n return normBuf;\n }", "public void normal(PointType n)\r\n {\r\n\t //System.out.println(\"norm: \"+n.x+\", \"+n.y+\", \"+n.z);\r\n\t\tgl.glNormal3d(n.x, n.y, n.z);\t\t\r\n\t}", "public Point3D getNormal(Point3D p){\n\t\treturn this.n;\n\t}", "private Vector3f getPlaneNormal(Vector3f directionVector) {\n\t\tVector3f up = new Vector3f(0, 0, 1);\n\t\tif (directionVector.z == 1 || directionVector.z == -1)\n\t\t\tup.set(0, 1, 0);\n\n\t\tfloat dirX = directionVector.x;\n\t\tfloat dirY = directionVector.y;\n\t\tfloat dirZ = directionVector.z;\n\t\tfloat upX = up.x;\n\t\tfloat upY = up.y;\n\t\tfloat upZ = up.z;\n\n\t\t// right = direction x up\n\t\tfloat rightX, rightY, rightZ;\n\t\trightX = dirY * upZ - dirZ * upY;\n\t\trightY = dirZ * upX - dirX * upZ;\n\t\trightZ = dirX * upY - dirY * upX;\n\t\t// normalize right\n\t\tfloat invRightLength = 1.0f / (float) Math.sqrt(rightX * rightX + rightY * rightY + rightZ * rightZ);\n\t\trightX *= invRightLength;\n\t\trightY *= invRightLength;\n\t\trightZ *= invRightLength;\n\n\t\treturn new Vector3f(rightX, rightY, rightZ);\n\t}", "@Override\r\n\tprotected Ray normalAt(double xx, double yy, double zz) {\n\t\treturn null;\r\n\t}", "public NurbsPoint getNormal(double s, double t) {\n double step2 = 0.01; // 0.1\n NurbsPoint p, p1, p2, p3;\n\n // ---this is a fix to compensate for bad models\n // ---that create deep concaves in the tail and nose\n double step3 = 0.1;\n if (s < u[0] + 2 * step3) s = u[0] + 2 * step3;\n if (s > u[nr_of_segments - 1] - 2 * step3) s = u[nr_of_segments - 1] - step3;\n if (t < v[0] + step3) t = v[0] + step3;\n if (t > v[points_per_segment - 1] - step3) t = v[points_per_segment - 1] - step3;\n // ---end fix\n\n double t1 = t - step2 / 2;\n double t2 = t + step2 / 2;\n double s1 = s - step2 / 2;\n double s2 = s + step2 / 2;\n\n Vector3f normal = new Vector3f();\n Vector3f v1 = new Vector3f();\n Vector3f v2 = new Vector3f();\n Point3f[] pts = new Point3f[3];\n\n for (int i2 = 0; i2 < 3; i2++)\n pts[i2] = new Point3f();\n\n p1 = get_point_on_surface(s1, t1);\n p2 = get_point_on_surface(s2, t1);\n p3 = get_point_on_surface(s1, t2);\n\n pts[0] = new Point3f((float) p1.x, (float) p1.y, (float) p1.z);\n pts[1] = new Point3f((float) p2.x, (float) p2.y, (float) p2.z);\n pts[2] = new Point3f((float) p3.x, (float) p3.y, (float) p3.z);\n\n v1.sub(pts[0], pts[1]);\n v2.sub(pts[0], pts[2]);\n\n v1.normalize();\n v2.normalize();\n\n normal.cross(v1, v2);\n\n normal.normalize();\n\n return new NurbsPoint(normal.x, normal.y, normal.z);\n }", "private void parseNormal(String line) {\n\n String first_float = line.substring(2);\n int second_space_index = first_float.indexOf(' ') + 1;\n String second_float = first_float.substring(second_space_index);\n int third_space_index = second_float.indexOf(' ') + 1;\n\n float vx = parseFloat(first_float.substring(0, second_space_index - 1));\n float vy = parseFloat(second_float.substring(0, third_space_index - 1));\n float vz = parseFloat(second_float.substring(third_space_index));\n\n mNormals.add(vx);\n mNormals.add(vy);\n mNormals.add(vz);\n }", "@Test\n public void getNormal_test() \n {\n\t // ============ Equivalence Partitions Tests ==============\n\t // TC01\n\t Plane pln= new Plane(new Point3D(1,0,0), new Vector(1,1,1));\n\t assertEquals(pln.getNormal(new Point3D(0,1,0)), new Vector(0.5773502691896258, 0.5773502691896258, 0.5773502691896258));\n }", "public Vector getNormal(Point3D point) {\r\n\t\treturn point.subtract(centerPoint).normalize();\r\n\t}", "godot.wire.Wire.Vector3OrBuilder getNormalOrBuilder();", "public Vector3D getNormal(Vector3D hitPos) {\n\t\tVector3D n = Vector3D.sub(pos, hitPos);\n\t\t//n.div(radius);\n\t\tn.normalize();\n\t\treturn n;\n\t}", "public abstract Vector4fc normalize3();", "@Override\n\tpublic Vecteur getNormal(Point impact, Rayon rayon) {\n\t\tassert impact != null && rayon != null;\n\t\tint indice = appartientCube(impact);\n\t\t\n\t\t//Assert pt d'impact appartient au cube\n\t\tif (indice == -1) {\n\t\t\tSystem.out.println(\"getNormal : Le point n'appartient pas au cube\");\n\t\t\treturn null;\n\t\t}\n\t\t\n\t\treturn this.plans.get(indice).getNormal(impact, rayon);\n\t}", "final public Vector3 reflectedOn(final Normal3 n){\n if(n == null){\n throw new IllegalArgumentException(\"n must not be null\");\n }\n\n Normal3 normal = n.mul(this.dot(n)).mul(2);\n //-l + 2(l * n)n\n return new Vector3(-x + normal.x, -y + normal.y, -z + normal.z);\n \n }", "public Vector normalized() {\n double size = this.length();\n return new Vector(this.getHead().getX() / size, this.getHead().getY() / size, this.getHead().getZ() / size);\n }", "boolean getNormal();", "public double norm() {\n\t\thomogenize();\n\t\treturn Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);\n\t}", "final public Normal3 asNormal(){\n return new Normal3(x, y, z);\n }", "public float[] getHitNormal();", "public Vector2f[] getNormalisedVertexPositions() {\n Vertex3D[] vertices = mesh.getModel().getVertices();\n // Get Array of X and Y offsets for all vertices\n Vector2f[] vertexPositions = new Vector2f[vertices.length];\n for (int i = 0; i < vertices.length; i++) {\n Vector3f vertexPosition = vertices[i].getPosition();\n vertexPositions[i] = new Vector2f(vertexPosition.getX(), vertexPosition.getY());\n }\n\n // Add vertex positions to position in order to get their OpenGl coordinates\n for (int i = 0; i < vertexPositions.length; i++) {\n vertexPositions[i] = Vector2f.add(position, vertexPositions[i]);\n vertexPositions[i] = Vector2f.divide(\n vertexPositions[i],\n new Vector2f(Window.getSpanX(), Window.getSpanY()));\n }\n\n return vertexPositions;\n }", "public void invertNormals() {\n mCubeNormalData = new float[]\n {\n // Front face\n 0.0f, 0.0f, -1.0f,\n 0.0f, 0.0f, -1.0f,\n 0.0f, 0.0f, -1.0f,\n 0.0f, 0.0f, -1.0f,\n 0.0f, 0.0f, -1.0f,\n 0.0f, 0.0f, -1.0f,\n // Right face\n -1.0f, 0.0f, 0.0f,\n -1.0f, 0.0f, 0.0f,\n -1.0f, 0.0f, 0.0f,\n -1.0f, 0.0f, 0.0f,\n -1.0f, 0.0f, 0.0f,\n -1.0f, 0.0f, 0.0f,\n // Back face\n 0.0f, 0.0f, 1.0f,\n 0.0f, 0.0f, 1.0f,\n 0.0f, 0.0f, 1.0f,\n 0.0f, 0.0f, 1.0f,\n 0.0f, 0.0f, 1.0f,\n 0.0f, 0.0f, 1.0f,\n // Left face\n 1.0f, 0.0f, 0.0f,\n 1.0f, 0.0f, 0.0f,\n 1.0f, 0.0f, 0.0f,\n 1.0f, 0.0f, 0.0f,\n 1.0f, 0.0f, 0.0f,\n 1.0f, 0.0f, 0.0f,\n // Top face\n 0.0f, -1.0f, 0.0f,\n 0.0f, -1.0f, 0.0f,\n 0.0f, -1.0f, 0.0f,\n 0.0f, -1.0f, 0.0f,\n 0.0f, -1.0f, 0.0f,\n 0.0f, -1.0f, 0.0f,\n // Bottom face\n 0.0f, 1.0f, 0.0f,\n 0.0f, 1.0f, 0.0f,\n 0.0f, 1.0f, 0.0f,\n 0.0f, 1.0f, 0.0f,\n 0.0f, 1.0f, 0.0f,\n 0.0f, 1.0f, 0.0f\n };\n mCubeNormals.put(mCubeNormalData).position(0);\n\n }", "public Vector getL(Point3D p){\n if (p.equals(_position)) {\n return null;\n }\n return p.subtract(_position).normalize();\n }", "private void getNormalVector(Conformer conformer, int[] atom, double[] n) {\n\t\t// calculate the three vectors leading from atom[0] to the other three atoms\n\t\tdouble[][] coords = new double[2][3];\n\t\tfor (int i=0; i<2; i++) {\n\t\t\tcoords[i][0] = conformer.getX(atom[i+1]) - conformer.getX(atom[0]);\n\t\t\tcoords[i][1] = conformer.getY(atom[i+1]) - conformer.getY(atom[0]);\n\t\t\tcoords[i][2] = conformer.getZ(atom[i+1]) - conformer.getZ(atom[0]);\n\t\t\t}\n\n\t\t// calculate the normal vector (vector product of coords[0] and coords[1])\n\t\tn[0] = coords[0][1]*coords[1][2]-coords[0][2]*coords[1][1];\n\t\tn[1] = coords[0][2]*coords[1][0]-coords[0][0]*coords[1][2];\n\t\tn[2] = coords[0][0]*coords[1][1]-coords[0][1]*coords[1][0];\n\n\t\tdouble l = Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);\n\t\tn[0] /= l;\n\t\tn[1] /= l;\n\t\tn[2] /= l;\n\t\t}", "@Override\n public double getMaterialTraversed(Hep3Vector dir) {\n double cth = Math.abs(VecOp.dot(dir, _w));\n double t = _materials.getThickness();\n return t / cth;\n }", "public Vec2double normalise() {\n\t\tdouble len = (double) (1 / Math.sqrt(x*x + y*y));\n//\t\tx *= len;\n//\t\ty *= len;\n\t\treturn new Vec2double(x*len, y*len);\n\t}", "@Override\n public double getMaterialTraversedInRL(Hep3Vector dir) {\n double cth = Math.abs(VecOp.dot(dir, _w));\n double t = _materials.getThicknessInRL();\n return t / cth;\n }", "public godot.wire.Wire.Vector3OrBuilder getNormalOrBuilder() {\n if (normalBuilder_ != null) {\n return normalBuilder_.getMessageOrBuilder();\n } else {\n return normal_ == null ?\n godot.wire.Wire.Vector3.getDefaultInstance() : normal_;\n }\n }", "public Vector2D unitVector()\n {\n if (this.getR() != 0)\n return new Vector2D(this.x / this.getR(), this.y / this.getR());\n return new Vector2D(0, 0);\n }", "public Vector[] getNormals() {\n\t\treturn this.normals;\n\t}", "final public Vector3 normalized(){\n return new Vector3(x/magnitude, y/magnitude, z/magnitude);\n }", "public Vector3 normalized() {\n float length = length();\n return new Vector3(x / length, y / length, z / length);\n }", "private Point3D findNormalAtPoint(Point3D hitPoint) {\n double x = hitPoint.getX();\n double y = hitPoint.getY();\n double z = hitPoint.getZ();\n double normalX = 2 * a * x + e * z + f * y + g;\n double normalY = 2 * b * y + d * z + f * x + h;\n double normalZ = 2 * c * z + d * y + e * x + i;\n return new Point3D(normalX, normalY, normalZ).normalize();\n }", "public Vector normalize(){\n\t\tdouble mag = magnitude();\n\t\treturn new Vector(x/mag, y/mag, z/mag);\n\t}", "public Vector getNormal(Vector v) {\n\t\tif (this.getClass() == Sphere.class) { // shape is sphere\n\t\t\tSphere sph = (Sphere) this;\n\t\t\treturn sph.getNormal(v);\n\t\t}\n\t\tif (this.getClass() == Triangle.class) { // shape is triangle\n\t\t\tTriangle trn = (Triangle) this;\n\t\t\treturn trn.getNormal(v);\n\t\t}\n\t\tif (this.getClass() == Plane.class) { // shape is plane\n\t\t\tPlane pln = (Plane) this;\n\t\t\treturn pln.getNormal(v);\n\t\t}\n\t\treturn null;\n\t}", "@java.lang.Override\n public godot.wire.Wire.Vector3OrBuilder getNormalOrBuilder() {\n return getNormal();\n }", "public Vector3 normalized() {\n\t\tif (isZeroVector(this)) {\n\t\t\treturn this;\n\t\t}\n\t\treturn new Vector3(x / norm(), y / norm(), z / norm());\n\t}", "public String getNormal() {\r\n return normal;\r\n }", "public float[] getNormals() {\r\n\t\treturn normals;\r\n\t}", "public void calcNormal() {\n nx = y2 - y1;\n ny = x1 - x2;\n }", "public Vector normalize ( );", "public Vector3f getNormalVertice(int i) {\n\t\treturn normalVertices.get(i);\n\t}", "public Vector getNormal(Point3D point) throws Exception {\n\n // Setting the U vector\n Vector vecU = new Vector(_p1.getX().getCoordinate()-_p2.getX().getCoordinate(),\n _p1.getY().getCoordinate()-_p2.getY().getCoordinate(),\n _p1.getZ().getCoordinate()-_p2.getZ().getCoordinate());\n // Setting the V vector\n Vector vecV = new Vector(_p1.getX().getCoordinate()-_p3.getX().getCoordinate(),\n _p1.getY().getCoordinate()-_p3.getY().getCoordinate(),\n _p1.getZ().getCoordinate()-_p3.getZ().getCoordinate());\n\n // Finding the normal vector and normalize it\n Vector _normal = new Vector(vecU.crossProduct(vecV));\n _normal.normalize();\n _normal.scale(-1);\n\n return _normal;\n }", "public ThreeVector unitVector() {\r\n\t\tif (this.magnitude()==0) { \r\n\t\t\treturn new ThreeVector(0,0,0);\r\n\t\t} else {\r\n\t\t\treturn new ThreeVector(this.x/this.magnitude(), this.y/this.magnitude(), this.z/this.magnitude());\r\n\t\t}\r\n\t}", "float[][] getCameraVectorsNormal(int resX, int resY){\n float vectors[][]=new float[resX*resY][3];//first vector index, second the components of the vector\n float[] vect2=rotateYVector(dir);\n vect2[1]=0;\n vect2=normalize(vect2);\n float[] vect3=normalize(vectorProduct(dir, vect2));//dir, vect2, vect3 base vectors\n float[] x={0,0,0};\n float[] y={0,0,0};\n float[] temp={0,0,0};\n for(int i=0;i<3;i++){\n x[i]=(vect2[i])/(resX/2);\n y[i]=(vect3[i])/(resY/2);\n temp[i]=vect2[i];\n }\n \n for(int j=0;j<resY;j++){\n for(int i=0;i<resX;i++){\n vectors[j*resX+i][0]=dir[0]+vect2[0]+vect3[0];\n vectors[j*resX+i][1]=dir[1]+vect2[1]+vect3[1];\n vectors[j*resX+i][2]=dir[2]+vect2[2]+vect3[2];\n vectors[j*resX+i]=normalize(vectors[j*resX+i]);\n vect2[0]-=x[0];\n vect2[1]-=x[1];\n vect2[2]-=x[2];\n if((vectorLength(vect2)>(-0.0001)&&vectorLength(vect2)<0.0001)&&(resX%2)==0){\n vect2[0]-=x[0];\n vect2[1]-=x[1];\n vect2[2]-=x[2];\n }\n }\n //printVector(temp);\n vect2[0]=temp[0];\n vect2[1]=temp[1];\n vect2[2]=temp[2];\n vect3[0]-=y[0];\n vect3[1]-=y[1];\n vect3[2]-=y[2];\n if((vectorLength(vect3)>(-0.0001)&&vectorLength(vect3)<0.0001)&&(resY%2)==0){\n vect3[0]-=y[0];\n vect3[1]-=y[1];\n vect3[2]-=y[2];\n }\n }\n \n return vectors;\n }", "godot.wire.Wire.Vector3 getOrigin();", "@Test\n void get_normal() {\n Cuboid cuboid1 = new Cuboid(4, 4, 4);\n Point3D point1 = new Point3D(0,0,2);\n Vector3D actual1 = cuboid1.get_normal(point1);\n Vector3D expected1 = new Vector3D(0,0,1);\n assertEquals(expected1, actual1);\n\n Cuboid cuboid2 = new Cuboid(4, 4, 4, new Ray(new Vector3D(0,1,0)));\n Point3D point2 = new Point3D(0,2,0);\n Vector3D actual2 = cuboid2.get_normal(point2);\n Vector3D expected2 = new Vector3D(0,1,0);\n assertEquals(expected2, actual2);\n }", "public VectorN local_grav()\n\t{\n\t\tVectorN r = this.getR();\n\t\tdouble rmag = r.mag();\n\t\tdouble muor3 = this.mu / (rmag * rmag * rmag);\n\n\t\tdouble gx = -1.0 * (muor3 * r.x[0]);\n\t\tdouble gy = -1.0 * (muor3 * r.x[1]);\n\t\tdouble gz = -1.0 * (muor3 * r.x[2]);\n\n\t\tVectorN grav = new VectorN(gx, gy, gz);\n\t\treturn grav;\n\t}", "public Vector4 normalized()\n {\n double magnitude = this.magnitude();\n\n float normalizeX = x / (float)magnitude;\n float normalizeY = y / (float)magnitude;\n float normalizeZ = z / (float)magnitude;\n float normalizeW = w / (float)magnitude;\n\n return new Vector4(normalizeX, normalizeY, normalizeZ, normalizeW);\n }", "private com.google.protobuf.SingleFieldBuilderV3<\n godot.wire.Wire.Vector3, godot.wire.Wire.Vector3.Builder, godot.wire.Wire.Vector3OrBuilder> \n getNormalFieldBuilder() {\n if (normalBuilder_ == null) {\n normalBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<\n godot.wire.Wire.Vector3, godot.wire.Wire.Vector3.Builder, godot.wire.Wire.Vector3OrBuilder>(\n getNormal(),\n getParentForChildren(),\n isClean());\n normal_ = null;\n }\n return normalBuilder_;\n }", "public double[] getNormal(int index){\n Node3D node = mesh.nodes.get(index);\n return calculateMeanNormal(node, node_to_triangle.get(node));\n }", "float norm();", "public boolean getNormal() {\n return normal_;\n }", "double getVz() { return vel[2]; }", "public Vector normalized(){\r\n\t\tfloat len = this.length();\r\n\t\tif( len != 0.0f && len != 1.0f ){\r\n\t\t\treturn new Vector( this.x / len, this.y / len, this.z / len );\r\n\t\t}\r\n\t\treturn this;\r\n\t}", "public Vector3 absLocal () {\n return abs(this);\n }", "private double[] getNormalVector(Conformer conformer, int[] atom) {\n\t\tdouble[] n = new double[3];\n\t\tgetNormalVector(conformer, atom, n);\n\t\treturn n;\n\t\t}", "public abstract Array<Mesh> toMeshesDirect(float depth);", "private static Vector3f getNormal(double[] a, double[] b)\n\t{\n\t\tfloat vectorX = (float)(a[FTContour.X] - b[FTContour.X]);\n\t\tfloat vectorY = (float)(a[FTContour.Y] - b[FTContour.Y]);\n\n\t\tfloat length = (float)Math.sqrt(vectorX * vectorX + vectorY * vectorY);\n\n\t\tif (length > 0.0f)\n\t\t{\n\t\t\tlength = 1 / length;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tlength = 0.0f;\n\t\t}\n\n\t\treturn new Vector3f((float)vectorY * length, (float)-vectorX * length, 0.0f);\n\t}", "public void calculateNormals() {\n // TODO!\n }", "public Point3D normalize() {\n\t\treturn this.divide(Math.sqrt(x*x + y*y + z*z));\n\t}", "void vectorFromWorld(double px, double py, double pz, DVector3 result);", "@Override\n\tpublic Vector3D getTangentialDirectionComponentChangeTransmissive(Vector3D surfacePosition,\n\t\t\tVector3D surfaceNormal)\n\t{\n\t\tVector2D xy = sceneObject.getSurfaceCoordinates(surfacePosition);\n\t\tdouble x = xy.x;\n\t\tdouble y = xy.y;\n\t\t\n\t\t// ... and r and phi\n\t\tdouble r2 = x*x + y*y;\n\t\tdouble r = Math.sqrt(r2);\n\t\tdouble phi = Math.atan2(y, x);\n\t\t\n\t\tdouble deltaPhi = calculateDeltaPhi(r, phi);\n\t\tdouble xDerivative = calculateXDerivative(x, y, r, r2, phi, deltaPhi);\n\t\tdouble yDerivative = calculateYDerivative(x, y, r, r2, phi, deltaPhi);\n\t\t\n\t\tArrayList<Vector3D> xHatYHat = sceneObject.getSurfaceCoordinateAxes(surfacePosition);\n\t\treturn Vector3D.sum(xHatYHat.get(0).getProductWith(xDerivative), xHatYHat.get(1).getProductWith(yDerivative)).getProductWith(-0.5/focalLength);\n\t}", "public Vector normalized() {\n Vector t=new Vector(normalize());\n return t;\n }", "public void normalize()\n {\n double magnitude = this.magnitude();\n this.x = x / (float)magnitude;\n this.y = y / (float)magnitude;\n this.z = z / (float)magnitude;\n this.w = w / (float)magnitude;\n }", "private Ray constructReflectedRay(Vector normal, Point3D point, Ray inRay){\n Vector R = inRay.get_direction();\n normal.scale(2*inRay.get_direction().dotProduct(normal));\n R.subtract(normal);\n Vector epsV = new Vector(normal);\n if (normal.dotProduct(R) < 0) {\n epsV.scale(-2);\n }\n else {\n epsV.scale(2);\n }\n //Vector epsV = new Vector(EPS, EPS, EPS);\n Point3D eps = new Point3D(point);\n\n eps.add(epsV);\n R.normalize();\n return new Ray(eps, R);\n }", "public boolean getNormal() {\n return normal_;\n }", "public Vector330Class normalize(){\n if(this.magnitude() <= EPS){\n return new Vector330Class(0, 0);\n }\n else{\n return new Vector330Class(this.x * (1/this.magnitude()), this.y * (1/this.magnitude()));\n }\n }", "public Vec3D tangentPlaneNormalAt(Vec3D q) {\n\t\tVec3D p = this.sub(q);\n\t\t// float xr2 = eR.x * eR.x;\n\t\t// float yr2 = eR.y * eR.y;\n\t\t// float zr2 = eR.z * eR.z;\n\t\tfloat r2 = 1f / (radius * radius);\n\t\treturn p.scaleSelf(r2).normalize();\n\t}", "public void normalize() {\n float length = (float)Math.sqrt(nx * nx + ny * ny);\n nx/=length;\n ny/=length;\n }", "public double getV() {\r\n return Math.sqrt(Math.pow(this.dx, 2) + Math.pow(this.dy, 2));\r\n }", "public String getNormalTexture() {\n return normalTexture;\n }", "public float getDistance(){\n\t\t\treturn s1.start.supportFinal.dot(normal);\n\t\t}", "public abstract Vector4fc normalize(float length);", "public org.landxml.schema.landXML11.SurfaceDocument.Surface getSurface()\r\n {\r\n synchronized (monitor())\r\n {\r\n check_orphaned();\r\n org.landxml.schema.landXML11.SurfaceDocument.Surface target = null;\r\n target = (org.landxml.schema.landXML11.SurfaceDocument.Surface)get_store().find_element_user(SURFACE$0, 0);\r\n if (target == null)\r\n {\r\n return null;\r\n }\r\n return target;\r\n }\r\n }", "public VectorN getR()\n\t{\n\t\tVectorN out = new VectorN(3);\n\t\tout.x[0] = this.rv.x[0];\n\t\tout.x[1] = this.rv.x[1];\n\t\tout.x[2] = this.rv.x[2];\n\t\treturn out;\n\t}", "public Optional<String> getNormal()\n {\n return m_normal;\n }", "godot.wire.Wire.Vector2 getOrigin();", "float norm2();", "public SbVec4f get(final SbVec3f point, final SbVec3f normal) \n { return texCoordElt.get(point, normal); }", "public abstract Vector3D getPointForSurfaceCoordinates(double u, double v);" ]
[ "0.69196767", "0.6431138", "0.637574", "0.62739223", "0.6115134", "0.603952", "0.6024115", "0.5949782", "0.5917472", "0.5900389", "0.59002686", "0.5898485", "0.5754481", "0.5736179", "0.5734094", "0.56798816", "0.565676", "0.5651619", "0.5649096", "0.5642188", "0.5626693", "0.5625253", "0.5622419", "0.56130725", "0.5587557", "0.55552804", "0.5544106", "0.5499629", "0.5485267", "0.5484649", "0.54824835", "0.5481524", "0.5466162", "0.54376346", "0.5430054", "0.54279935", "0.5380244", "0.53406996", "0.5309163", "0.52876014", "0.52849317", "0.5284459", "0.5277086", "0.52728176", "0.5272586", "0.52559495", "0.5250138", "0.52471024", "0.52448344", "0.5237687", "0.5234705", "0.5228312", "0.5225569", "0.5220594", "0.52034116", "0.5185887", "0.5170736", "0.5168109", "0.5148236", "0.5142665", "0.5141565", "0.51358736", "0.5132967", "0.51155347", "0.5109613", "0.51040816", "0.5082525", "0.50818187", "0.5025231", "0.5023004", "0.5011705", "0.5010071", "0.49844062", "0.49833378", "0.4982575", "0.49704587", "0.49667892", "0.4964919", "0.4963785", "0.49625206", "0.49622345", "0.49530903", "0.49526244", "0.49521542", "0.49361482", "0.49358606", "0.49327323", "0.49230608", "0.49202645", "0.4912896", "0.48841873", "0.48834178", "0.48806682", "0.48775834", "0.48771474", "0.48742607", "0.48726344", "0.48650607", "0.48643407", "0.4859556" ]
0.64534044
1
These return the intersection point and surface normal in world space, and the texture coordinates in image space.
public SbVec3f getPoint() { return worldPoint; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void computeTextureUVCoordinates()\n\t{\n\t\tthis.faceTextureUCoordinates = new float[faceCount][];\n\t\tthis.faceTextureVCoordinates = new float[faceCount][];\n\n\t\tfor (int i = 0; i < faceCount; i++)\n\t\t{\n\t\t\tint textureCoordinate;\n\t\t\tif (textureCoordinates == null)\n\t\t\t{\n\t\t\t\ttextureCoordinate = -1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ttextureCoordinate = textureCoordinates[i];\n\t\t\t}\n\n\t\t\tint textureIdx;\n\t\t\tif (faceTextures == null)\n\t\t\t{\n\t\t\t\ttextureIdx = -1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ttextureIdx = faceTextures[i] & 0xFFFF;\n\t\t\t}\n\n\t\t\tif (textureIdx != -1)\n\t\t\t{\n\t\t\t\tfloat[] u = new float[3];\n\t\t\t\tfloat[] v = new float[3];\n\n\t\t\t\tif (textureCoordinate == -1)\n\t\t\t\t{\n\t\t\t\t\tu[0] = 0.0F;\n\t\t\t\t\tv[0] = 1.0F;\n\n\t\t\t\t\tu[1] = 1.0F;\n\t\t\t\t\tv[1] = 1.0F;\n\n\t\t\t\t\tu[2] = 0.0F;\n\t\t\t\t\tv[2] = 0.0F;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\ttextureCoordinate &= 0xFF;\n\n\t\t\t\t\tbyte textureRenderType = 0;\n\t\t\t\t\tif (textureRenderTypes != null)\n\t\t\t\t\t{\n\t\t\t\t\t\ttextureRenderType = textureRenderTypes[textureCoordinate];\n\t\t\t\t\t}\n\n\t\t\t\t\tif (textureRenderType == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tint faceVertexIdx1 = faceVertexIndices1[i];\n\t\t\t\t\t\tint faceVertexIdx2 = faceVertexIndices2[i];\n\t\t\t\t\t\tint faceVertexIdx3 = faceVertexIndices3[i];\n\n\t\t\t\t\t\tshort triangleVertexIdx1 = textureTriangleVertexIndices1[textureCoordinate];\n\t\t\t\t\t\tshort triangleVertexIdx2 = textureTriangleVertexIndices2[textureCoordinate];\n\t\t\t\t\t\tshort triangleVertexIdx3 = textureTriangleVertexIndices3[textureCoordinate];\n\n\t\t\t\t\t\tfloat triangleX = (float) vertexPositionsX[triangleVertexIdx1];\n\t\t\t\t\t\tfloat triangleY = (float) vertexPositionsY[triangleVertexIdx1];\n\t\t\t\t\t\tfloat triangleZ = (float) vertexPositionsZ[triangleVertexIdx1];\n\n\t\t\t\t\t\tfloat f_882_ = (float) vertexPositionsX[triangleVertexIdx2] - triangleX;\n\t\t\t\t\t\tfloat f_883_ = (float) vertexPositionsY[triangleVertexIdx2] - triangleY;\n\t\t\t\t\t\tfloat f_884_ = (float) vertexPositionsZ[triangleVertexIdx2] - triangleZ;\n\t\t\t\t\t\tfloat f_885_ = (float) vertexPositionsX[triangleVertexIdx3] - triangleX;\n\t\t\t\t\t\tfloat f_886_ = (float) vertexPositionsY[triangleVertexIdx3] - triangleY;\n\t\t\t\t\t\tfloat f_887_ = (float) vertexPositionsZ[triangleVertexIdx3] - triangleZ;\n\t\t\t\t\t\tfloat f_888_ = (float) vertexPositionsX[faceVertexIdx1] - triangleX;\n\t\t\t\t\t\tfloat f_889_ = (float) vertexPositionsY[faceVertexIdx1] - triangleY;\n\t\t\t\t\t\tfloat f_890_ = (float) vertexPositionsZ[faceVertexIdx1] - triangleZ;\n\t\t\t\t\t\tfloat f_891_ = (float) vertexPositionsX[faceVertexIdx2] - triangleX;\n\t\t\t\t\t\tfloat f_892_ = (float) vertexPositionsY[faceVertexIdx2] - triangleY;\n\t\t\t\t\t\tfloat f_893_ = (float) vertexPositionsZ[faceVertexIdx2] - triangleZ;\n\t\t\t\t\t\tfloat f_894_ = (float) vertexPositionsX[faceVertexIdx3] - triangleX;\n\t\t\t\t\t\tfloat f_895_ = (float) vertexPositionsY[faceVertexIdx3] - triangleY;\n\t\t\t\t\t\tfloat f_896_ = (float) vertexPositionsZ[faceVertexIdx3] - triangleZ;\n\n\t\t\t\t\t\tfloat f_897_ = f_883_ * f_887_ - f_884_ * f_886_;\n\t\t\t\t\t\tfloat f_898_ = f_884_ * f_885_ - f_882_ * f_887_;\n\t\t\t\t\t\tfloat f_899_ = f_882_ * f_886_ - f_883_ * f_885_;\n\t\t\t\t\t\tfloat f_900_ = f_886_ * f_899_ - f_887_ * f_898_;\n\t\t\t\t\t\tfloat f_901_ = f_887_ * f_897_ - f_885_ * f_899_;\n\t\t\t\t\t\tfloat f_902_ = f_885_ * f_898_ - f_886_ * f_897_;\n\t\t\t\t\t\tfloat f_903_ = 1.0F / (f_900_ * f_882_ + f_901_ * f_883_ + f_902_ * f_884_);\n\n\t\t\t\t\t\tu[0] = (f_900_ * f_888_ + f_901_ * f_889_ + f_902_ * f_890_) * f_903_;\n\t\t\t\t\t\tu[1] = (f_900_ * f_891_ + f_901_ * f_892_ + f_902_ * f_893_) * f_903_;\n\t\t\t\t\t\tu[2] = (f_900_ * f_894_ + f_901_ * f_895_ + f_902_ * f_896_) * f_903_;\n\n\t\t\t\t\t\tf_900_ = f_883_ * f_899_ - f_884_ * f_898_;\n\t\t\t\t\t\tf_901_ = f_884_ * f_897_ - f_882_ * f_899_;\n\t\t\t\t\t\tf_902_ = f_882_ * f_898_ - f_883_ * f_897_;\n\t\t\t\t\t\tf_903_ = 1.0F / (f_900_ * f_885_ + f_901_ * f_886_ + f_902_ * f_887_);\n\n\t\t\t\t\t\tv[0] = (f_900_ * f_888_ + f_901_ * f_889_ + f_902_ * f_890_) * f_903_;\n\t\t\t\t\t\tv[1] = (f_900_ * f_891_ + f_901_ * f_892_ + f_902_ * f_893_) * f_903_;\n\t\t\t\t\t\tv[2] = (f_900_ * f_894_ + f_901_ * f_895_ + f_902_ * f_896_) * f_903_;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.faceTextureUCoordinates[i] = u;\n\t\t\t\tthis.faceTextureVCoordinates[i] = v;\n\t\t\t}\n\t\t}\n\t}", "public Coordinates intersection() {\n return intersection;\n }", "public E3DVector2F getTextureCoordC(){\r\n return vertices[2].getTextureCoord();\r\n }", "public float[] getTextureCoords() {\r\n\t\treturn textureCoords;\r\n\t}", "public static float[] createQuadTextureCoords() {\n float[] tex = new float[]{0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f};\n return tex;\n }", "public E3DVector2F getTextureCoordA(){\r\n return vertices[0].getTextureCoord();\r\n }", "public Intersection getIntersection() {\r\n\t\tif (intersection == null)\r\n\t\t\tcomputeIntersectionPoint();\r\n\t\treturn intersection;\r\n\t}", "public float[] getHitTexCoord();", "@Override\n public Intersection getIntersectionNorth(){\n if(!mapLoaded){\n return null;\n }\n return extremIntersection[0];\n }", "public Vector3d getModelIntersection(Vector2i screenLoc)\n {\n ScreenPosition ul = getViewOffset();\n int viewportHeight = getViewportHeight();\n int correctedX = (int)(screenLoc.getX() - ul.getX());\n int correctedY = (int)(viewportHeight - screenLoc.getY() - ul.getY());\n Vector2i correctedScreenLoc = new Vector2i(correctedX, correctedY);\n return windowToModelCoords(correctedScreenLoc);\n }", "public float[] getHitNormal();", "public SbVec4f\ngetObjectTextureCoords(final SoNode node)\n//\n////////////////////////////////////////////////////////////////////////\n{\n return multVecMatrix4(getImageToObject(node), imageTexCoords);\n}", "private static int[] intersection(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4){\n\n\t\tdouble b1 = (y2 - y1)/(x2 - x1);\n\t\tdouble a1 = y1 - (b1*x1);\n\t\tdouble b2 = (y4 - y3)/(x4 - x3);\n\t\tdouble a2 = y3 - (b2*x3);\n\t\tif(x2-x1 == 0) //vertical\n\t\t\treturn new int[]{(int)x1,(int)(a2+(b2*x1))};\n\t\tif(x3-x4 == 0) //vertical\n\t\t\treturn new int[]{(int)x3,(int)(a1+(b1*x3))};\n\t/*\tif(Math.abs(b1-b2) < 0.001)\n\t\t\treturn null;\n\t\tdouble intX = -(a1-a2)/(b1-b2);\n\t\tdouble intY = a1+(b1*intX);*/\n\t\tdouble d = ((y4-y3)*(x2-x1) - (x4-x3)*(y2-y1));\n\t\tif(d == 0)\n\t\t\treturn null; //parallel roads\n\t\tdouble a = ((x4-x3)*(y1-y3) - (y4-y3)*(x1-x3))*1.0/d;\n\t\tint intX = (int)x1+(int)(a*(x2-x1));\n\t\tint intY = (int)y1+(int)(a*(y2-y1));\n\t\treturn new int[]{(int)intX,(int)intY};\n\t}", "private Point3 _getIntersection(Point3 eye, Point3 direction) {\n int size = NORMALS.length;\n float tresult;\n Point4 norm; // normal of face hit\n Plane plane; // plane equation\n float tnear, tfar, t, vn, vd;\n int front = 0, back = 0; // front/back face # hit\n\n tnear = -1.0e+20f; // -HUGE_VAL\n tfar = +1.0e+20f; // tmax\n for (int i = 0; i < size; i++) {\n\n plane = _planes[i];\n\n vd = plane.dot(direction);\n vn = plane.distance(eye);\n if (vd == 0.0f) {\n // ray is parallel to plane -\n // check if ray origin is inside plane's\n // half-space\n if (vn < 0.0f) {\n return null;\n }\n\n } else {\n // ray not parallel - get distance to plane\n t = -vn / vd;\n if (vd > 0.0f) {\n\n if (t > tfar) {\n return null;\n }\n if (t > tnear) {\n // hit near face, update normal\n front = i;\n tnear = t;\n }\n } else {\n // back face - T is a far point\n\n if (t < tnear) {\n return null;\n }\n if (t < tfar) {\n // hit far face, update normal\n\n back = i;\n tfar = t;\n }\n }\n }\n }\n // survived all tests\n // Note: if ray originates on polyhedron,\n // may want to change 0.0 to some\n // epsilon to avoid intersecting the originating face.\n //\n if (tnear >= 0.0f) {\n // outside, hitting front face\n norm = _planes[front]._normal;\n tresult = tnear;\n return Point3.addition(eye, direction.scaled(tresult));\n } else {\n if (tfar < 1.0e+20f) {\n // inside, hitting back face\n norm = _planes[back]._normal;\n tresult = tfar;\n return Point3.addition(eye, direction.scaled(tresult));\n } else {\n // inside, but back face beyond tmax//\n return null;\n }\n }\n }", "public Intersection[] intersectWith(Point3d S, Ray3d c) {\n Intersection[] result = null;\n\n double A = c.getX() * c.getX() + c.getY() * c.getY() + c.getZ() * c.getZ();\n\n double bx = (this.x - S.getX()); //Account for the Sphere's position\n double by = (this.y - S.getY());\n double bz = (this.z - S.getZ());\n\n double B = -(c.getX() * bx + c.getY() * by + c.getZ() * bz);\n\n double r = this.radius * this.radius;\n\n double C = bx * bx + by * by + bz * bz - r;\n\n double D = (B * B - A * C);\n if (D < 0) //no intersection\n {\n return null;\n }\n\n if (D == 0) //'graze' the sphere\n {\n result = new Intersection[1];\n Point3d P = S.plus(c.times(-B / A));\n result[0] = new Intersection(-B / A, this, true, 0, P, new Ray3d(P));\n /****/return null;\n }\n\n result = new Intersection[2];\n int hit = 0;\n\n double t1 = (-B - Math.sqrt(D)) / A;\n if (t1 > 0.00001) //The first hit\n {\n Point3d P = S.plus(c.times(t1));\n Ray3d N = P.minus(new Point3d(this.x, this.y, this.z));\n result[0] = new Intersection(t1, this, true, 0, P, N);\n hit++;\n }\n\n double t2 = (-B / A) + Math.sqrt(D) / A;\n if (t2 > 0.00000001) {\n Point3d P = S.plus(c.times(t2));\n Ray3d N = P.minus(new Point3d(this.x, this.y, this.z));\n result[hit] = new Intersection(t2, this, false, 0, P, N.reverse());\n }\n\n return result;\n }", "public double findRayIntersection(Vec3 origin, Vec3 direction, Vec3 normal)\n {\n double scale = width/obj.getScale();\n double ox = origin.x*scale+0.5*width;\n double oy = origin.y*scale+0.5*width;\n double oz = origin.z*scale+0.5*width;\n double dx = direction.x;\n double dy = direction.y;\n double dz = direction.z;\n\n // Find the intersection of the ray with the bounding box.\n\n double mint = -Double.MAX_VALUE;\n double maxt = Double.MAX_VALUE;\n if (dx == 0.0)\n {\n if (ox < minx || ox > maxx)\n return 0.0;\n }\n else\n {\n double t1 = (minx-ox)/dx;\n double t2 = (maxx-ox)/dx;\n if (t1 < t2)\n {\n if (t1 > mint)\n mint = t1;\n if (t2 < maxt)\n maxt = t2;\n }\n else\n {\n if (t2 > mint)\n mint = t2;\n if (t1 < maxt)\n maxt = t1;\n }\n if (mint > maxt || maxt < 0.0)\n return 0.0;\n }\n if (dy == 0.0)\n {\n if (oy < miny || oy > maxy)\n return 0.0;\n }\n else\n {\n double t1 = (miny-oy)/dy;\n double t2 = (maxy-oy)/dy;\n if (t1 < t2)\n {\n if (t1 > mint)\n mint = t1;\n if (t2 < maxt)\n maxt = t2;\n }\n else\n {\n if (t2 > mint)\n mint = t2;\n if (t1 < maxt)\n maxt = t1;\n }\n if (mint > maxt || maxt < 0.0)\n return 0.0;\n }\n if (dz == 0.0)\n {\n if (oz < minz || oz > maxz)\n return 0.0;\n }\n else\n {\n double t1 = (minz-oz)/dz;\n double t2 = (maxz-oz)/dz;\n if (t1 < t2)\n {\n if (t1 > mint)\n mint = t1;\n if (t2 < maxt)\n maxt = t2;\n }\n else\n {\n if (t2 > mint)\n mint = t2;\n if (t1 < maxt)\n maxt = t1;\n }\n if (mint > maxt || maxt < 0.0)\n return 0.0;\n }\n if (mint < 0.0)\n mint = 0.0;\n\n // Find the first voxel and initialize variables.\n\n double xpos = ox+mint*dx;\n double ypos = oy+mint*dy;\n double zpos = oz+mint*dz;\n int x = Math.max(Math.min((int) xpos, maxx), minx);\n int y = Math.max(Math.min((int) ypos, maxy), miny);\n int z = Math.max(Math.min((int) zpos, maxz), minz);\n int stepx, stepy, stepz;\n int finalx, finaly, finalz;\n double tdeltax, tdeltay, tdeltaz;\n double tmaxx, tmaxy, tmaxz;\n if (dx < 0.0)\n {\n stepx = -1;\n finalx = minx-1;\n tdeltax = -1.0/dx;\n tmaxx = (x-ox)/dx;\n }\n else if (dx > 0.0)\n {\n stepx = 1;\n finalx = maxx+1;\n tdeltax = 1.0/dx;\n tmaxx = (x+1-ox)/dx;\n }\n else\n {\n stepx = 0;\n finalx = 0;\n tdeltax = 0.0;\n tmaxx = Double.MAX_VALUE;\n }\n if (dy < 0.0)\n {\n stepy = -1;\n finaly = miny-1;\n tdeltay = -1.0/dy;\n tmaxy = (y-oy)/dy;\n }\n else if (dy > 0.0)\n {\n stepy = 1;\n finaly = maxy+1;\n tdeltay = 1.0/dy;\n tmaxy = (y+1-oy)/dy;\n }\n else\n {\n stepy = 0;\n finaly = 0;\n tdeltay = 0.0;\n tmaxy = Double.MAX_VALUE;\n }\n if (dz < 0.0)\n {\n stepz = -1;\n finalz = minz-1;\n tdeltaz = -1.0/dz;\n tmaxz = (z-oz)/dz;\n }\n else if (dz > 0.0)\n {\n stepz = 1;\n finalz = maxz+1;\n tdeltaz = 1.0/dz;\n tmaxz = (z+1-oz)/dz;\n }\n else\n {\n stepz = 0;\n finalz = 0;\n tdeltaz = 0.0;\n tmaxz = Double.MAX_VALUE;\n }\n\n // Step through the voxels, looking for intersections.\n\n VoxelOctree voxels = obj.getVoxels();\n byte values[] = new byte[8];\n while (true)\n {\n int index = x*width*width+y*width+z;\n if ((flags[index/32]&(1<<(index%32))) != 0)\n {\n // There is a piece of the surface in this voxel, so see if the ray intersects it.\n // First find the values of t at which the ray enters and exits it.\n \n double tenter = -Double.MAX_VALUE;\n double texit = Double.MAX_VALUE;\n if (dx != 0.0)\n {\n double t1 = (x-ox)/dx;\n double t2 = (x+1-ox)/dx;\n if (t1 < t2)\n {\n if (t1 > tenter)\n tenter = t1;\n if (t2 < texit)\n texit = t2;\n }\n else\n {\n if (t2 > tenter)\n tenter = t2;\n if (t1 < texit)\n texit = t1;\n }\n }\n if (dy != 0.0)\n {\n double t1 = (y-oy)/dy;\n double t2 = (y+1-oy)/dy;\n if (t1 < t2)\n {\n if (t1 > tenter)\n tenter = t1;\n if (t2 < texit)\n texit = t2;\n }\n else\n {\n if (t2 > tenter)\n tenter = t2;\n if (t1 < texit)\n texit = t1;\n }\n }\n if (dz != 0.0)\n {\n double t1 = (z-oz)/dz;\n double t2 = (z+1-oz)/dz;\n if (t1 < t2)\n {\n if (t1 > tenter)\n tenter = t1;\n if (t2 < texit)\n texit = t2;\n }\n else\n {\n if (t2 > tenter)\n tenter = t2;\n if (t1 < texit)\n texit = t1;\n }\n }\n if (tenter < 0.0)\n continue; // Ignore intersections in the voxel containing the origin.\n\n // Look up the values at the eight corners of the voxel.\n\n values[0] = voxels.getValue(x, y, z);\n values[1] = voxels.getValue(x, y, z+1);\n values[2] = voxels.getValue(x, y+1, z);\n values[3] = voxels.getValue(x, y+1, z+1);\n values[4] = voxels.getValue(x+1, y, z);\n values[5] = voxels.getValue(x+1, y, z+1);\n values[6] = voxels.getValue(x+1, y+1, z);\n values[7] = voxels.getValue(x+1, y+1, z+1);\n\n // Find the positions within the voxel where the ray enters and exits.\n\n double xenter = ox+dx*tenter-x;\n double yenter = oy+dy*tenter-y;\n double zenter = oz+dz*tenter-z;\n double xexit = ox+dx*texit-x;\n double yexit = oy+dy*texit-y;\n double zexit = oz+dz*texit-z;\n\n // Interpolate the find the values at those points.\n\n double enterValue = values[0]*(1.0-xenter)*(1.0-yenter)*(1.0-zenter)\n +values[1]*(1.0-xenter)*(1.0-yenter)*zenter\n +values[2]*(1.0-xenter)*yenter*(1.0-zenter)\n +values[3]*(1.0-xenter)*yenter*zenter\n +values[4]*xenter*(1.0-yenter)*(1.0-zenter)\n +values[5]*xenter*(1.0-yenter)*zenter\n +values[6]*xenter*yenter*(1.0-zenter)\n +values[7]*xenter*yenter*zenter;\n double exitValue = values[0]*(1.0-xexit)*(1.0-yexit)*(1.0-zexit)\n +values[1]*(1.0-xexit)*(1.0-yexit)*zexit\n +values[2]*(1.0-xexit)*yexit*(1.0-zexit)\n +values[3]*(1.0-xexit)*yexit*zexit\n +values[4]*xexit*(1.0-yexit)*(1.0-zexit)\n +values[5]*xexit*(1.0-yexit)*zexit\n +values[6]*xexit*yexit*(1.0-zexit)\n +values[7]*xexit*yexit*zexit;\n if ((enterValue > 0 && exitValue <= 0) || (enterValue <= 0 && exitValue > 0))\n {\n // Find the intersection point.\n\n double weight1 = Math.abs(exitValue);\n double weight2 = Math.abs(enterValue);\n double d = 1.0/(weight1+weight2);\n weight1 *= d;\n weight2 *= d;\n double tintersect = (tenter*weight1 + texit*weight2)/scale;\n if (normal != null)\n {\n normal.set(values[0]+values[1]+values[2]+values[3]-values[4]-values[5]-values[6]-values[7],\n values[0]+values[1]-values[2]-values[3]+values[4]+values[5]-values[6]-values[7],\n values[0]-values[1]+values[2]-values[3]+values[4]-values[5]+values[6]-values[7]);\n normal.normalize();\n }\n return tintersect;\n }\n }\n\n // Advance to the next voxel.\n\n if (tmaxx < tmaxy)\n {\n if (tmaxx < tmaxz)\n {\n x += stepx;\n if (x == finalx)\n return 0.0;\n tmaxx += tdeltax;\n }\n else\n {\n z += stepz;\n if (z == finalz)\n return 0.0;\n tmaxz += tdeltaz;\n }\n }\n else\n {\n if (tmaxy < tmaxz)\n {\n y += stepy;\n if (y == finaly)\n return 0.0;\n tmaxy += tdeltay;\n }\n else\n {\n z += stepz;\n if (z == finalz)\n return 0.0;\n tmaxz += tdeltaz;\n }\n }\n }\n }", "@Override\n\tpublic void intersect(Ray ray, IntersectResult result) {\n\t\t\t\tdouble tmin,tmax;\n\t\t\t\tdouble xmin, xmax, ymin, ymax, zmin, zmax;\n\t\t\t\t//find which face to cross\n\n\t\t\t\tif(ray.viewDirection.x>0){\n\t\t\t\t\txmin=(min.x-ray.eyePoint.x)/ray.viewDirection.x;\n\t\t\t\t\txmax=(max.x-ray.eyePoint.x)/ray.viewDirection.x;\n\t\t\t\t}else{\n\t\t\t\t\txmin=(max.x-ray.eyePoint.x)/ray.viewDirection.x;\n\t\t\t\t\txmax=(min.x-ray.eyePoint.x)/ray.viewDirection.x;\n\t\t\t\t}\n\t\t\t\tif(ray.viewDirection.y>0){\n\t\t\t\t\tymin=(min.y-ray.eyePoint.y)/ray.viewDirection.y;\n\t\t\t\t\tymax=(max.y-ray.eyePoint.y)/ray.viewDirection.y;\n\t\t\t\t}else{\n\t\t\t\t\tymin=(max.y-ray.eyePoint.y)/ray.viewDirection.y;\n\t\t\t\t\tymax=(min.y-ray.eyePoint.y)/ray.viewDirection.y;\n\t\t\t\t}\n\t\t\t\tif(ray.viewDirection.z>0){\n\t\t\t\t\tzmin=(min.z-ray.eyePoint.z)/ray.viewDirection.z;\n\t\t\t\t\tzmax=(max.z-ray.eyePoint.z)/ray.viewDirection.z;\n\t\t\t\t}else{\n\t\t\t\t\tzmin=(max.z-ray.eyePoint.z)/ray.viewDirection.z;\n\t\t\t\t\tzmax=(min.z-ray.eyePoint.z)/ray.viewDirection.z;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\ttmin=Double.max(xmin, ymin);\n\t\t\t\ttmin=Double.max(tmin, zmin);\n\t\t\t\ttmax=Double.min(xmax, ymax);\n\t\t\t\ttmax=Double.min(tmax, zmax);\n\t\t\t\t\n\t\t\t\t \n\t\t\t\tif(tmin<tmax && tmin>0){\n\t\t\t\t\t\n\t\t\t\t\tresult.material=material;\n\t\t\t\t\tresult.t=tmin;\n\t\t\t\t\tPoint3d p=new Point3d(ray.viewDirection);\n\t\t\t\t\tp.scale(tmin);\n\t\t\t\t\tp.add(ray.eyePoint);\n\t\t\t\t\tresult.p=p;\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tfinal double epsilon=1e-9;\n\t\t\t\t\t// find face and set the normal\n\t\t\t\t\tif(Math.abs(p.x-min.x)<epsilon){\n\t\t\t\t\t\tresult.n=new Vector3d(-1,0,0);\n\t\t\t\t\t}else if(Math.abs(p.x-max.x)<epsilon){\n\t\t\t\t\t\tresult.n=new Vector3d(1,0,0);\n\t\t\t\t\t}else if(Math.abs(p.y-min.y)<epsilon){\n\t\t\t\t\t\tresult.n=new Vector3d(0,-1,0);\n\t\t\t\t\t}else if(Math.abs(p.y-max.y)<epsilon){\n\t\t\t\t\t\tresult.n=new Vector3d(0,1,0);\n\t\t\t\t\t}else if(Math.abs(p.z-min.z)<epsilon){\n\t\t\t\t\t\tresult.n=new Vector3d(0,0,-1);\n\t\t\t\t\t}else if(Math.abs(p.z-max.z)<epsilon){\n\t\t\t\t\t\tresult.n=new Vector3d(0,0,1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t}", "public float[] getHitPoint();", "public E3DVector2F getTextureCoordB(){\r\n return vertices[1].getTextureCoord();\r\n }", "public abstract Vector3D getPointForSurfaceCoordinates(double u, double v);", "public double intersect(Ray3D r) {\n\t\tdouble dn = (r.d).dot(n);\n\t\tif (dn==0.0) return Double.POSITIVE_INFINITY;\n\t\tdouble t = (p.subtract(r.p)).dot(n)/dn;\n\t\tif (t > 0) return t;\n\t\telse return Double.POSITIVE_INFINITY;\n\t}", "PVector _getCenter() {\n PVector cen = new PVector(_hitboxCenter.x, _hitboxCenter.y);\n cen.rotate(_rotVector.heading() - _front);\n cen.x += _x;\n cen.y += _y;\n return cen;\n }", "public double[] getWorldCoordinateWGS84(int screenX, int screenY);", "private Map<Geometry, List<Point3D>> getSceneRayIntersections(Ray ray){\n //Map key - geometric\n //value - a list of cut points\n Map<Geometry, List<Point3D>> sceneRayIntersectPions = new HashMap<Geometry, List<Point3D>>();\n //Iterator we can go through all the geometric shapes\n Iterator<Geometry> geometries = _scene.getGeometriesIterator();\n //for each geometry finde intersection points\n while (geometries.hasNext()){\n Geometry geometry = geometries.next();\n List<Point3D> geometryIntersectionPoints = geometry.FindIntersections(ray);\n if(!geometryIntersectionPoints.isEmpty())\n //add geometryIntersectionPoints(list) to key geometry\n sceneRayIntersectPions.put(geometry, geometryIntersectionPoints);\n }\n return sceneRayIntersectPions;\n }", "default List<Point3D> findIntersections(Ray ray) {\n\tList<GeoPoint> geoList = findGeoIntersections(ray);\n\treturn geoList == null ? null\n\t: geoList .stream()\n\t.map(gp -> gp.point)\n\t.collect(Collectors.toList());\n\t}", "public TextureCoord2D texFor (final Point3 point) {\n\n if (point == null)throw new IllegalArgumentException(\"The Point cannot be null!\");\n\n\n double teta = Math.acos(point.y);\n double phi = Math.atan2(point.x, point.z);\n\n return new TextureCoord2D(phi / (Math.PI*2), -teta/Math.PI);\n }", "@Override\n public void intersect( Ray ray, IntersectResult result ) {\n \t\tVector3d e = new Vector3d(ray.eyePoint);\n \t\te.sub(this.center);\n \t\tdouble a = ray.viewDirection.dot(ray.viewDirection);\n \t\tdouble b = 2 * ray.viewDirection.dot(e);\n \t\tdouble c = e.dot(e) - this.radius * this.radius;\n \t\tdouble discriminant = b*b - 4*a*c;\n \t\t\n \t\tif (discriminant == 0.0) {\n \t\t\t\n \t\t\tdouble t_pos = -0.5 * b / a;\n \t\t\t// scale ray viewDirection to be t_pos length\n\t\t\t// point of intersection is at ray.eyePoint + scaled viewDirection vector\n\t\t\tPoint3d point_of_intersection = new Point3d(ray.viewDirection);\n\t\t\tpoint_of_intersection.scale(t_pos);\n\t\t\tpoint_of_intersection.add(ray.eyePoint);\n\t\t\t\n\t\t\t// normal is point_of_intersection - sphere.center\n\t\t\tVector3d normal = new Vector3d();\n\t\t\tnormal.add(point_of_intersection);\n\t\t\tnormal.sub(this.center);\n\t\t\tnormal.normalize();\n\t\t\t\n\t\t\tresult.p.set(point_of_intersection);\n\t\t\tresult.material = this.material;\n\t\t\tresult.t = t_pos;\n\t\t\tresult.n.set(normal);\n \t\t\t\n \t\t}\n \t\telse if (discriminant > 0.0) {\n \t\t\t\n \t\t\t// solve quadratic formula\n \t\t\tdouble q = (b > 0) ? -0.5 * (b + Math.sqrt(discriminant)) : -0.5 * (b - Math.sqrt(discriminant));\n \t\t\tdouble t_pos = q / a;\n \t\t\tdouble t_neg = c / q;\n \t\t\t\n \t\t\tif (t_pos < t_neg) {\n \t\t\t\tdouble temp = t_pos;\n \t\t\t\tt_pos = t_neg;\n \t\t\t\tt_neg = temp;\n \t\t\t}\n \t\t\t\t\n \t\t\tif (t_neg > 0) {\n \t\t\t\t// scale ray viewDirection to be t_neg length\n \t\t\t\t// point of intersection is at ray.eyePoint + scaled viewDirection vector\n \t\t\tPoint3d point_of_intersection = new Point3d(ray.viewDirection);\n \t\t\tpoint_of_intersection.scale(t_neg);\n \t\t\tpoint_of_intersection.add(ray.eyePoint);\n \t\t\t\n \t\t\t// normal is point_of_intersection - sphere.center\n \t\t\tVector3d normal = new Vector3d();\n \t\t\tnormal.add(point_of_intersection);\n \t\t\tnormal.sub(this.center);\n \t\t\tnormal.normalize();\n \t\t\t\n \t\t\tresult.p.set(point_of_intersection);\n \t\t\tresult.material = this.material;\n \t\t\tresult.t = t_neg;\n \t\t\tresult.n.set(normal);\n \t\t\t}\n\t\n \t\t}\n \t\t\n \t\t\n \t\t\n \t\t\n \t\t\n\n }", "public E3DVector2F getTextureCoordDetail0A(){\r\n return vertices[0].getTextureCoordDetail0();\r\n }", "private Point3d lp2xyz(double line, double pixel, MetadataDoris metadata, OrbitsDoris orbits) {\n \n int MAXITER = 10;\n final double CRITERPOS = Math.pow(10, -6);\n final double SOL = Constants.lightSpeed;\n final int refHeight = 0;\n \n final double ell_a = Constants.semiMajorAxis;\n final double ell_b = Constants.semiMinorAxis;\n \n Point3d satellitePosition;\n Point3d satelliteVelocity;\n Point3d ellipsoidPosition;\n \n // put stuff that makes sense here!\n double azTime = line2ta(line, metadata);\n double rgTime = pix2tr(pixel, metadata);\n \n satellitePosition = getSatelliteXYZ(azTime, orbits);\n satelliteVelocity = getSatelliteXYZDot(azTime, orbits);\n \n ellipsoidPosition = metadata.approxXYZCentreOriginal;\n \n // allocate matrices\n // DoubleMatrix ellipsoidPositionSolution = DoubleMatrix.zeros(3,1);\n DoubleMatrix equationSet = DoubleMatrix.zeros(3);\n DoubleMatrix partialsXYZ = DoubleMatrix.zeros(3, 3);\n \n for (int iter = 0; iter <= MAXITER; iter++) {\n // update equations and slove system\n double dsat_Px = ellipsoidPosition.x - satellitePosition.x; // vector of 'satellite to P on ellipsoid'\n double dsat_Py = ellipsoidPosition.y - satellitePosition.y; // vector of 'satellite to P on ellipsoid'\n double dsat_Pz = ellipsoidPosition.z - satellitePosition.z; // vector of 'satellite to P on ellipsoid'\n \n equationSet.put(0,\n -(satelliteVelocity.x * dsat_Px +\n satelliteVelocity.y * dsat_Py +\n satelliteVelocity.z * dsat_Pz));\n \n equationSet.put(1,\n -(dsat_Px * dsat_Px +\n dsat_Py * dsat_Py +\n dsat_Pz * dsat_Pz - Math.pow(SOL * rgTime, 2)));\n \n equationSet.put(2,\n -((ellipsoidPosition.x * ellipsoidPosition.x + ellipsoidPosition.y * ellipsoidPosition.y) / (Math.pow(ell_a + refHeight, 2)) +\n Math.pow(ellipsoidPosition.z / (ell_b + refHeight), 2) - 1.0));\n \n partialsXYZ.put(0, 0, satelliteVelocity.x);\n partialsXYZ.put(0, 1, satelliteVelocity.y);\n partialsXYZ.put(0, 2, satelliteVelocity.z);\n partialsXYZ.put(1, 0, 2 * dsat_Px);\n partialsXYZ.put(1, 1, 2 * dsat_Py);\n partialsXYZ.put(1, 2, 2 * dsat_Pz);\n partialsXYZ.put(2, 0, (2 * ellipsoidPosition.x) / (Math.pow(ell_a + refHeight, 2)));\n partialsXYZ.put(2, 1, (2 * ellipsoidPosition.y) / (Math.pow(ell_a + refHeight, 2)));\n partialsXYZ.put(2, 2, (2 * ellipsoidPosition.z) / (Math.pow(ell_a + refHeight, 2)));\n \n // solve system [NOTE!] orbit has to be normalized, otherwise close to singular\n DoubleMatrix ellipsoidPositionSolution = Solve.solve(partialsXYZ, equationSet);\n // DoubleMatrix ellipsoidPositionSolution = solve33(partialsXYZ, equationSet);\n \n // update solution\n ellipsoidPosition.x = ellipsoidPosition.x + ellipsoidPositionSolution.get(0);\n ellipsoidPosition.y = ellipsoidPosition.y + ellipsoidPositionSolution.get(1);\n ellipsoidPosition.z = ellipsoidPosition.z + ellipsoidPositionSolution.get(2);\n \n // check convergence\n if (Math.abs(ellipsoidPositionSolution.get(0)) < CRITERPOS &&\n Math.abs(ellipsoidPositionSolution.get(1)) < CRITERPOS &&\n Math.abs(ellipsoidPositionSolution.get(2)) < CRITERPOS) {\n // System.out.println(\"INFO: ellipsoidPosition (converged) = \" + ellipsoidPosition);\n break;\n } else if (iter >= MAXITER) {\n MAXITER = MAXITER + 1;\n System.out.println(\"WARNING: line, pix -> x,y,z: maximum iterations (\" + MAXITER + \") reached. \" + \"Criterium (m): \" + CRITERPOS +\n \"dx,dy,dz=\" + ellipsoidPositionSolution.get(0) + \", \" + ellipsoidPositionSolution.get(1) + \", \" + ellipsoidPositionSolution.get(2, 0));\n }\n }\n \n return ellipsoidPosition;\n }", "boolean intersects( Geometry gmo );", "@Test\n public void testGetIntersect() throws Exception {\n Vector farIntersect = sphere.getIntersect(new Vector(0,0,0),new Vector(0,-6,10));\n assertTrue(farIntersect.equals(new Vector(0,-6,10)));\n }", "public org.landxml.schema.landXML11.IntersectionDocument.Intersection getIntersection()\r\n {\r\n synchronized (monitor())\r\n {\r\n check_orphaned();\r\n org.landxml.schema.landXML11.IntersectionDocument.Intersection target = null;\r\n target = (org.landxml.schema.landXML11.IntersectionDocument.Intersection)get_store().find_element_user(INTERSECTION$0, 0);\r\n if (target == null)\r\n {\r\n return null;\r\n }\r\n return target;\r\n }\r\n }", "public static boolean render(int coordX, int coordY, int coordZ, int texture, Texture[] textureMap) {\r\n GL11.glTranslatef(coordX, coordY, coordZ); // Absolute position in game\r\n// GL11.glRotatef(xrot, 1.0f, 0.0f, 0.0f); // Rotate On The X Axis\r\n// GL11.glRotatef(yrot, 0.0f, 1.0f, 0.0f); // Rotate On The Y Axis\r\n// GL11.glRotatef(zrot, 0.0f, 0.0f, 1.0f); // Rotate On The Z Axis\r\n GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureMap[texture].getTextureID()); // Select Our Texture\r\n GL11.glBegin(GL11.GL_QUADS);\r\n // Front Face\r\n GL11.glTexCoord2f(0.0f, 0.0f);\r\n GL11.glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 0.0f);\r\n GL11.glVertex3f(1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 1.0f);\r\n GL11.glVertex3f(1.0f, 1.0f, 1.0f); // Top Right Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 1.0f);\r\n GL11.glVertex3f(-1.0f, 1.0f, 1.0f); // Top Left Of The Texture and Quad\r\n // Back Face\r\n GL11.glTexCoord2f(1.0f, 0.0f);\r\n GL11.glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Right Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 1.0f);\r\n GL11.glVertex3f(-1.0f, 1.0f, -1.0f); // Top Right Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 1.0f);\r\n GL11.glVertex3f(1.0f, 1.0f, -1.0f); // Top Left Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 0.0f);\r\n GL11.glVertex3f(1.0f, -1.0f, -1.0f); // Bottom Left Of The Texture and Quad\r\n // Top Face\r\n GL11.glTexCoord2f(0.0f, 1.0f);\r\n GL11.glVertex3f(-1.0f, 1.0f, -1.0f); // Top Left Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 0.0f);\r\n GL11.glVertex3f(-1.0f, 1.0f, 1.0f); // Bottom Left Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 0.0f);\r\n GL11.glVertex3f(1.0f, 1.0f, 1.0f); // Bottom Right Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 1.0f);\r\n GL11.glVertex3f(1.0f, 1.0f, -1.0f); // Top Right Of The Texture and Quad\r\n // Bottom Face\r\n GL11.glTexCoord2f(1.0f, 1.0f);\r\n GL11.glVertex3f(-1.0f, -1.0f, -1.0f); // Top Right Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 1.0f);\r\n GL11.glVertex3f(1.0f, -1.0f, -1.0f); // Top Left Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 0.0f);\r\n GL11.glVertex3f(1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 0.0f);\r\n GL11.glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and Quad\r\n // Right face\r\n GL11.glTexCoord2f(1.0f, 0.0f);\r\n GL11.glVertex3f(1.0f, -1.0f, -1.0f); // Bottom Right Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 1.0f);\r\n GL11.glVertex3f(1.0f, 1.0f, -1.0f); // Top Right Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 1.0f);\r\n GL11.glVertex3f(1.0f, 1.0f, 1.0f); // Top Left Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 0.0f);\r\n GL11.glVertex3f(1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and Quad\r\n // Left Face\r\n GL11.glTexCoord2f(0.0f, 0.0f);\r\n GL11.glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Left Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 0.0f);\r\n GL11.glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 1.0f);\r\n GL11.glVertex3f(-1.0f, 1.0f, 1.0f); // Top Right Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 1.0f);\r\n GL11.glVertex3f(-1.0f, 1.0f, -1.0f); // Top Left Of The Texture and Quad\r\n GL11.glEnd();\r\n\r\n// xrot += 0.3f; // X Axis Rotation\r\n// yrot += 0.2f; // Y Axis Rotation\r\n// zrot += 0.4f; // Z Axis Rotation\r\n\r\n return true;\r\n }", "private Bounds getTextureBounds() {\n\t\tfinal float boundsWidth = 2 * OFFSET_X;\n\t\tfinal float boundsHeight = 2 * OFFSET_Y;\n\t\t\n\t\t//Get the center point of the player, then subtract by offset\n\t\tfinal float x = (activePlayer.getX() + activePlayer.getWidth() / 2f) \n\t\t\t\t/ activePlayer.getScaleX() - OFFSET_X;\n\t\tfinal float y = (activePlayer.getY() - activePlayer.getHeight() / 2f) \n\t\t\t\t/ activePlayer.getScaleY() + OFFSET_Y + 1;\n\t\t\n\t\treturn new Bounds(x, y, boundsWidth, boundsHeight);\n\t}", "public E3DVector2F getTextureCoordDetail0C(){\r\n return vertices[2].getTextureCoordDetail0();\r\n }", "public Point3d sampleHemisphere();", "public static InterleavedVertexBuffer createInterleavedQuadWithTextureCoords() {\n InterleavedVertexBuffer.Builder builder = new InterleavedVertexBuffer.Builder(BufferUsage.STATIC);\n builder.add(\"a_Pos\", new VerticesData(BufferTestUtil.createQuadStrip(0.5f, 0.5f, 0, 0)));\n builder.add(\"a_texCoord\", new TextureCoordData(BufferTestUtil.createQuadTextureCoords()));\n return builder.build();\n }", "public boolean\n doIntersection(Ray inOutRay) {\n double t, min_t = Double.MAX_VALUE;\n double x2 = size.x/2; // OJO: Esto deberia venir precalculado\n double y2 = size.y/2; // OJO: Esto deberia venir precalculado\n double z2 = size.z/2; // OJO: Esto deberia venir precalculado\n Vector3D p = new Vector3D();\n GeometryIntersectionInformation info = \n new GeometryIntersectionInformation();\n\n inOutRay.direction.normalize();\n\n // (1) Plano superior: Z = size.z/2\n if ( Math.abs(inOutRay.direction.z) > VSDK.EPSILON ) {\n // El rayo no es paralelo al plano Z=size.z/2\n t = (z2-inOutRay.origin.z)/inOutRay.direction.z;\n if ( t > -VSDK.EPSILON ) {\n p = inOutRay.origin.add(inOutRay.direction.multiply(t));\n if ( p.x >= -x2 && p.x <= x2 && \n p.y >= -y2 && p.y <= y2 ) {\n info.p = new Vector3D(p);\n min_t = t;\n lastPlane = 1;\n }\n }\n }\n\n // (2) Plano inferior: Z = -size.z/2\n if ( Math.abs(inOutRay.direction.z) > VSDK.EPSILON ) {\n // El rayo no es paralelo al plano Z=-size.z/2\n t = (-z2-inOutRay.origin.z)/inOutRay.direction.z;\n if ( t > -VSDK.EPSILON && t < min_t ) {\n p = inOutRay.origin.add(inOutRay.direction.multiply(t));\n if ( p.x >= -x2 && p.x <= x2 && \n p.y >= -y2 && p.y <= y2 ) {\n info.p = p;\n min_t = t;\n lastPlane = 2;\n }\n }\n }\n\n // (3) Plano frontal: Y = size.y/2\n if ( Math.abs(inOutRay.direction.y) > VSDK.EPSILON ) {\n // El rayo no es paralelo al plano Y=size.y/2\n t = (y2-inOutRay.origin.y)/inOutRay.direction.y;\n if ( t > -VSDK.EPSILON && t < min_t ) {\n p = inOutRay.origin.add(inOutRay.direction.multiply(t));\n if ( p.x >= -x2 && p.x <= x2 && \n p.z >= -z2 && p.z <= z2 ) {\n info.p = p;\n min_t = t;\n lastPlane = 3;\n }\n }\n }\n\n // (4) Plano posterior: Y = -size.y/2\n if ( Math.abs(inOutRay.direction.y) > VSDK.EPSILON ) {\n // El rayo no es paralelo al plano Y=-size.y/2\n t = (-y2-inOutRay.origin.y)/inOutRay.direction.y;\n if ( t > -VSDK.EPSILON && t < min_t ) {\n p = inOutRay.origin.add(inOutRay.direction.multiply(t));\n if ( p.x >= -x2 && p.x <= x2 && \n p.z >= -z2 && p.z <= z2 ) {\n info.p = p;\n min_t = t;\n lastPlane = 4;\n }\n }\n }\n\n // (5) Plano X = size.x/2\n if ( Math.abs(inOutRay.direction.x) > VSDK.EPSILON ) {\n // El rayo no es paralelo al plano X=size.x/2\n t = (x2-inOutRay.origin.x)/inOutRay.direction.x;\n if ( t > -VSDK.EPSILON && t < min_t ) {\n p = inOutRay.origin.add(inOutRay.direction.multiply(t));\n if ( p.y >= -y2 && p.y <= y2 && \n p.z >= -z2 && p.z <= z2 ) {\n info.p = p;\n min_t = t;\n lastPlane = 5;\n }\n }\n }\n\n // (6) Plano X = -size.x/2\n if ( Math.abs(inOutRay.direction.x) > VSDK.EPSILON ) {\n // El rayo no es paralelo al plano X=-size.x/2\n t = (-x2-inOutRay.origin.x)/inOutRay.direction.x;\n if ( t > -VSDK.EPSILON && t < min_t ) {\n p = inOutRay.origin.add(inOutRay.direction.multiply(t));\n if ( p.y >= -y2 && p.y <= y2 && \n p.z >= -z2 && p.z <= z2 ) {\n info.p = p;\n min_t = t;\n lastPlane = 6;\n }\n }\n }\n\n if ( min_t < Double.MAX_VALUE ) {\n inOutRay.t = min_t;\n lastInfo.clone(info);\n return true;\n }\n return false;\n }", "public E3DVector3F getPlaneIntersectionPoint(E3DVector3F startPos, E3DVector3F endPos)\r\n {\r\n double a, b;\r\n \r\n E3DVector3F normal = getNormal();\r\n E3DVector3F direction = endPos.subtract(startPos);\r\n\r\n a = -normal.dotProduct(startPos.subtract(vertices[0].getVertexPos()));\r\n b = normal.dotProduct(direction);\r\n\r\n double r = a / b;\r\n if (r < 0.0) // ray goes away from triangle\r\n return null;\r\n \r\n direction.scaleEqual(r);\r\n direction = startPos.add(direction);\r\n \r\n return direction;\r\n/* \r\n //old\r\n E3DVector3F normal = getNormal();\r\n \r\n E3DVector3F ray = endPos.subtract(startPos);\r\n \r\n double t = -(normal.dotProduct(startPos) -\r\n getPlaneEquationCoords().getD() +\r\n normal.dotProduct(ray));\r\n //NO\r\n ray.normaliseEqual(); //NO\r\n\r\n ray.scaleEqual(t);\r\n ray.addEqual(startPos); //should be marginally faster (one less new E3DVector3F)\r\n return ray; //startPos.add(ray); */\r\n }", "public Position3D getIntersect(Line3D other) {\r\n\t\tif (this.isParallel(other)) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\tdouble t = (this.d - this.norm.dot(other.getPos())) / this.norm.dot(other.getDir());\r\n\t\treturn other.getLinePoint(t);\r\n\t}", "public float getTextureOffsetX() {\r\n\t\treturn textureX;\r\n\t}", "public Vector3d computePlaneIntersection(\r\n\t\tVector3d\t\tpPlaneNormal\r\n\t,\tdouble\t\t\tpPlaneDot\r\n\t,\tVector3d\t\tpResult\r\n\t,\tCSGTempVars\t\tpTempVars\r\n\t,\tCSGEnvironment\tpEnvironment\r\n\t) {\r\n\t\t//Ax + By + Cz + D = 0\r\n\t\t//x = x0 + t(x1 – x0)\r\n\t\t//y = y0 + t(y1 – y0)\r\n\t\t//z = z0 + t(z1 – z0)\r\n\t\t//(x1 - x0) = dx, (y1 - y0) = dy, (z1 - z0) = dz\r\n\t\t//t = -(A*x0 + B*y0 + C*z0 )/(A*dx + B*dy + C*dz)\r\n\t\t\r\n\t\tdouble tolerance = pEnvironment.mEpsilonNearZeroDbl; // TOL;\r\n\t\t\r\n\t\tdouble A = pPlaneNormal.x;\r\n\t\tdouble B = pPlaneNormal.y;\r\n\t\tdouble C = pPlaneNormal.z;\r\n\t\tdouble D = -pPlaneDot;\r\n\t\t\t\r\n\t\tdouble numerator = A*mOrigin.x + B*mOrigin.y + C*mOrigin.z + D;\r\n\t\tdouble denominator = A*mDirection.x + B*mDirection.y + C*mDirection.z;\r\n\t\t\t\t\r\n\t\tif ( Math.abs( denominator ) < tolerance ) {\r\n\t\t\t// Line is parallel to the plane\r\n\t\t\tif( Math.abs( numerator ) < tolerance ) {\r\n\t\t\t\t// Line contained within the plane\r\n\t\t\t\tif ( pResult == null ) {\r\n\t\t\t\t\treturn( mOrigin.clone() );\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn( pResult.set( mOrigin ) );\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\t// No intersection\r\n\t\t\t\treturn( null );\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t// Line intersects the plane\r\n\t\t\tdouble t = -numerator/denominator;\r\n\t\t\tpResult = mDirection.mult( t, pResult );\r\n\t\t\tpResult.addLocal( mOrigin );\r\n\t\t\t\r\n\t\t\tif ( pEnvironment.mRationalizeValues ) {\r\n\t\t\t\t// Confirm that the magnitudes of the resultant point are rational\r\n\t\t\t\tCSGEnvironment.rationalizeVector( pResult, pEnvironment.mEpsilonMagnitudeRange );\r\n\t\t\t}\r\n\t\t\treturn pResult;\r\n\t\t}\r\n\t}", "public Object getPoint(EastNorth intersection) {\n\t\treturn null;\n\t}", "@Override\n public RayHit rayIntersectObj(Ray3D ray) {\n // Next check if ray hits this quadric\n Point3D hitPoint = findHitPoint(ray);\n if (hitPoint == null || !isWithinBounds(hitPoint)) {\n return RayHit.NO_HIT;\n }\n double distance = hitPoint.subtract(ray.getPoint()).length();\n Point3D normal = findNormalAtPoint(hitPoint);\n return new RayHit(hitPoint, distance, normal, this, new TextureCoordinate(0, 0));\n }", "public void invertNormals() {\n mCubeNormalData = new float[]\n {\n // Front face\n 0.0f, 0.0f, -1.0f,\n 0.0f, 0.0f, -1.0f,\n 0.0f, 0.0f, -1.0f,\n 0.0f, 0.0f, -1.0f,\n 0.0f, 0.0f, -1.0f,\n 0.0f, 0.0f, -1.0f,\n // Right face\n -1.0f, 0.0f, 0.0f,\n -1.0f, 0.0f, 0.0f,\n -1.0f, 0.0f, 0.0f,\n -1.0f, 0.0f, 0.0f,\n -1.0f, 0.0f, 0.0f,\n -1.0f, 0.0f, 0.0f,\n // Back face\n 0.0f, 0.0f, 1.0f,\n 0.0f, 0.0f, 1.0f,\n 0.0f, 0.0f, 1.0f,\n 0.0f, 0.0f, 1.0f,\n 0.0f, 0.0f, 1.0f,\n 0.0f, 0.0f, 1.0f,\n // Left face\n 1.0f, 0.0f, 0.0f,\n 1.0f, 0.0f, 0.0f,\n 1.0f, 0.0f, 0.0f,\n 1.0f, 0.0f, 0.0f,\n 1.0f, 0.0f, 0.0f,\n 1.0f, 0.0f, 0.0f,\n // Top face\n 0.0f, -1.0f, 0.0f,\n 0.0f, -1.0f, 0.0f,\n 0.0f, -1.0f, 0.0f,\n 0.0f, -1.0f, 0.0f,\n 0.0f, -1.0f, 0.0f,\n 0.0f, -1.0f, 0.0f,\n // Bottom face\n 0.0f, 1.0f, 0.0f,\n 0.0f, 1.0f, 0.0f,\n 0.0f, 1.0f, 0.0f,\n 0.0f, 1.0f, 0.0f,\n 0.0f, 1.0f, 0.0f,\n 0.0f, 1.0f, 0.0f\n };\n mCubeNormals.put(mCubeNormalData).position(0);\n\n }", "@gw.internal.gosu.parser.ExtendedProperty\n public java.lang.Boolean isIntersection();", "public E3DVector2F getTextureCoordDetail1C(){\r\n\t\treturn vertices[2].getTextureCoordDetail1();\r\n\t}", "public E3DVector2F getTextureCoordDetail1A(){\r\n\t\treturn vertices[0].getTextureCoordDetail1();\r\n\t}", "public Vect3d getExtent (){\r\n \r\n Vect3d extent = new Vect3d();\r\n extent.x = (max.x - min.x) / 2;\r\n extent.y = (max.y - min.y) / 2;\r\n extent.z = (max.y - min.z) / 2;\r\n return extent;\r\n }", "protected ResourceLocation getEntityTexture(Entity par1Entity)\n {\n return this.getCowTextures((EntityCow)par1Entity);\n }", "private Intersection[] getExtremIntersection(){\n if(!mapLoaded){\n return null;\n }\n Intersection northernmost = intersectionList.get(0);\n Intersection southernmost = intersectionList.get(0);\n Intersection easternmost = intersectionList.get(0);\n Intersection westernmost = intersectionList.get(0);\n\n for(int i=0 ; i<intersectionList.size() ; i++){\n Intersection testedIntersection = intersectionList.get(i);\n //north\n if(northernmost.getLatitude() < testedIntersection.getLatitude()) {\n northernmost = testedIntersection;\n }\n //south\n if(southernmost.getLatitude() > testedIntersection.getLatitude()) {\n southernmost = testedIntersection;\n }\n //east\n if(easternmost.getLongitude() < testedIntersection.getLongitude()) {\n easternmost = testedIntersection;\n }\n //west\n if(westernmost.getLongitude() > testedIntersection.getLongitude()) {\n westernmost = testedIntersection;\n }\n }\n Intersection[] extremum = {northernmost , southernmost , easternmost , westernmost};\n return extremum;\n }", "public static boolean\nraysIntersectInPlane(Point2D tail0Pt, Point2D head0Pt, Point2D tail1Pt, Point2D head1Pt,\n\tPoint2D intersect, double[] uArray)\n{\n\tdouble tmp = ((head1Pt.getY() - tail1Pt.getY())*(head0Pt.getX() - tail0Pt.getX()) - (head1Pt.getX() - tail1Pt.getX())*(head0Pt.getY() - tail0Pt.getY()));\n\tif(tmp == 0.0)\n\t\treturn(false);\n\tdouble tmpv = ((tail1Pt.getX() - tail0Pt.getX())*(head0Pt.getY() - tail0Pt.getY()) - (tail1Pt.getY() - tail0Pt.getY())*(head0Pt.getX() - tail0Pt.getX())) / tmp;\n\ttmp = (head0Pt.getX() - tail0Pt.getX())*(head1Pt.getY() - tail1Pt.getY()) - (head1Pt.getX() - tail1Pt.getX())*(head0Pt.getY() - tail0Pt.getY());\n\tif(tmp == 0.0)\n\t\treturn(false);\n\tdouble tmpu = ((tail1Pt.getX() - tail0Pt.getX())*(head1Pt.getY() - tail1Pt.getY()) + (head1Pt.getX() - tail1Pt.getX())*(tail0Pt.getY() - tail1Pt.getY()))/tmp;\n\n\tintersect.setLocation(\n\t\ttail1Pt.getX() + tmpv*(head1Pt.getX() - tail1Pt.getX()),\n\t\ttail1Pt.getY() + tmpv*(head1Pt.getY() - tail1Pt.getY()));\n\n\t// intersect[ZCoor] = tail1Pt[ZCoor] + tmpv*(head1Pt[ZCoor] - tail1Pt[ZCoor]);\n\n\tuArray[0] = tmpu; // u of first ray\n\tuArray[1] = tmpv; // u of second ray\n\n\treturn (true);\n}", "public Vector2f[] getNormalisedVertexPositions() {\n Vertex3D[] vertices = mesh.getModel().getVertices();\n // Get Array of X and Y offsets for all vertices\n Vector2f[] vertexPositions = new Vector2f[vertices.length];\n for (int i = 0; i < vertices.length; i++) {\n Vector3f vertexPosition = vertices[i].getPosition();\n vertexPositions[i] = new Vector2f(vertexPosition.getX(), vertexPosition.getY());\n }\n\n // Add vertex positions to position in order to get their OpenGl coordinates\n for (int i = 0; i < vertexPositions.length; i++) {\n vertexPositions[i] = Vector2f.add(position, vertexPositions[i]);\n vertexPositions[i] = Vector2f.divide(\n vertexPositions[i],\n new Vector2f(Window.getSpanX(), Window.getSpanY()));\n }\n\n return vertexPositions;\n }", "protected ResourceLocation getEntityTexture(Entity par1Entity)\n {\n return this.func_110914_a((EntitySpiritWolf)par1Entity);\n }", "@Override\n public Intersection getIntersectionWest(){\n if(!mapLoaded){\n return null;\n }\n return extremIntersection[3];\n }", "public double[] getHitGeoCoord();", "public List<Vec3> getIntersectionPoints(Vec3 org, Vec3 ray)\n {\n Mat4 mInv = m.getInverseSimple();\n ray = mInv.multiply(ray.toDirection()).getXYZ();\n org = mInv.multiply(org.toPoint()).getXYZ();\n\n Vec3 mext = extents.getNegated();\n ArrayList<Vec3> ps = new ArrayList<Vec3>();\n for (int i = 0; i < 3; i++)\n {\n if (org.get(i) >= extents.get(i))\n {\n if (ray.get(i) >= 0)\n {\n return new ArrayList<Vec3>(); // ray points away from box\n }\n ps.addAll(lineIntersection(i, org, ray, extents));\n } else if (org.get(i) <= mext.get(i))\n {\n if (ray.get(i) <= 0)\n {\n return new ArrayList<Vec3>(); // ray points away from box\n }\n ps.addAll(lineIntersection(i, org, ray, mext));\n }\n }\n return ps;\n }", "int getNumberOfTextureCoordinates();", "public void\n doExtraInformation(Ray inRay, double inT, \n GeometryIntersectionInformation outData) {\n outData.p = lastInfo.p;\n\n switch ( lastPlane ) {\n case 1:\n outData.n.x = 0;\n outData.n.y = 0;\n outData.n.z = 1;\n outData.u = outData.p.y / size.y - 0.5;\n outData.v = 1-(outData.p.x / size.x - 0.5);\n outData.t.x = 0;\n outData.t.y = 1;\n outData.t.z = 0;\n break;\n case 2:\n outData.n.x = 0;\n outData.n.y = 0;\n outData.n.z = -1;\n outData.u = outData.p.y / size.y - 0.5;\n outData.v = outData.p.x / size.x - 0.5;\n outData.t.x = 0;\n outData.t.y = 1;\n outData.t.z = 0;\n break;\n case 3:\n outData.n.x = 0;\n outData.n.z = 0;\n outData.n.y = 1;\n outData.u = 1-(outData.p.x / size.x - 0.5);\n outData.v = outData.p.z / size.z - 0.5;\n outData.t.x = -1;\n outData.t.y = 0;\n outData.t.z = 0;\n break;\n case 4:\n outData.n.x = 0;\n outData.n.z = 0;\n outData.n.y = -1;\n outData.u = outData.p.x / size.x - 0.5;\n outData.v = outData.p.z / size.z - 0.5;\n outData.t.x = 1;\n outData.t.y = 0;\n outData.t.z = 0;\n break;\n case 5:\n outData.n.x = 1;\n outData.n.y = 0;\n outData.n.z = 0;\n outData.u = outData.p.y / size.y - 0.5;\n outData.v = outData.p.z / size.z - 0.5;\n outData.t.x = 0;\n outData.t.y = 1;\n outData.t.z = 0;\n break;\n case 6:\n outData.n.x = -1;\n outData.n.y = 0;\n outData.n.z = 0;\n outData.u = 1-(outData.p.y / size.y - 0.5);\n outData.v = outData.p.z / size.z - 0.5;\n outData.t.x = 0;\n outData.t.y = -1;\n outData.t.z = 0;\n break;\n default:\n outData.u = 0;\n outData.v = 0;\n break;\n }\n }", "protected abstract NativeSQLStatement createNativeIntersectionStatement(Geometry geom);", "public ByteBuffer getTextureCoordsBuffer() {\n return texCoordsBuf;\n }", "public final void mT__64() throws RecognitionException {\n try {\n int _type = T__64;\n int _channel = DEFAULT_TOKEN_CHANNEL;\n // ../org.xtext.example.webgme_mtl/src-gen/org/xtext/example/webgme/parser/antlr/internal/InternalMTL.g:62:7: ( 'intersection' )\n // ../org.xtext.example.webgme_mtl/src-gen/org/xtext/example/webgme/parser/antlr/internal/InternalMTL.g:62:9: 'intersection'\n {\n match(\"intersection\"); \n\n\n }\n\n state.type = _type;\n state.channel = _channel;\n }\n finally {\n }\n }", "public static Point PointOfIntersection(final Point startA, final Point endA,\n final Point startB, final Point endB) {\n float x1 = startA.x, x2 = endA.x, x3 = startB.x, x4 = endB.x;\n float y1 = startA.y, y2 = endA.y, y3 = startB.y, y4 = endB.y;\n float denom = ((x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4));\n float intersectXNum = ((x1*y2 - y1*x2) * (x3 - x4)) - ((x1 - x2) * (x3*y4 - y3*x4));\n float intersectYNum = ((x1*y2 - y1*x2) * (y3 - y4)) - ((y1 - y2) * (x3*y4 - y3*x4));\n return new Point(intersectXNum / denom, intersectYNum / denom);\n }", "@Override\n // public Map<Geometry, List<Point3D>> findIntersections(Ray myRay) {\n public List<Point3D> FindIntersections(Ray myRay) {\n\n List<Point3D> geometryListMap = new ArrayList<>();\n List<Point3D> listOfIntersections = new ArrayList<Point3D>();\n\n // the bottom base of the cylinder\n Plane plane1 = new Plane(orientation.getPOO(), orientation.getDirection());\n\n // the top base of the cylinder\n Plane plane2 = new Plane(top, orientation.getDirection());\n\n List<Point3D> temp1 = plane1.FindIntersections(myRay);\n\n List<Point3D> temp2 = plane2.FindIntersections(myRay);\n\n // removing all points that beyond the radius\n if (temp1 != null)\n for (Point3D p1 : temp1) {\n if (new Vector(Point3D.substract(orientation.getPOO(), p1)).length() <= _radius && p1 != null)\n listOfIntersections.add(p1);\n\n }\n\n if (temp2 != null)\n for (Point3D p2 : temp2) {\n if (new Vector(Point3D.substract(orientation.getPOO(), p2)).length() <= _radius && p2 != null)\n listOfIntersections.add(p2);\n\n }\n\n // using the infinity cylinder to find all the intersections in the body of the limited cylinder\n geometryListMap = super.FindIntersections(myRay);\n\n for (Point3D p : geometryListMap) {\n if (isOnCylinder(p))\n listOfIntersections.add(p);\n\n }\n if (listOfIntersections.isEmpty())\n return null;\n //geometryListMap.put(this, listOfIntersections);\n return geometryListMap;\n }", "float[][] getCameraVectorsNormal(int resX, int resY){\n float vectors[][]=new float[resX*resY][3];//first vector index, second the components of the vector\n float[] vect2=rotateYVector(dir);\n vect2[1]=0;\n vect2=normalize(vect2);\n float[] vect3=normalize(vectorProduct(dir, vect2));//dir, vect2, vect3 base vectors\n float[] x={0,0,0};\n float[] y={0,0,0};\n float[] temp={0,0,0};\n for(int i=0;i<3;i++){\n x[i]=(vect2[i])/(resX/2);\n y[i]=(vect3[i])/(resY/2);\n temp[i]=vect2[i];\n }\n \n for(int j=0;j<resY;j++){\n for(int i=0;i<resX;i++){\n vectors[j*resX+i][0]=dir[0]+vect2[0]+vect3[0];\n vectors[j*resX+i][1]=dir[1]+vect2[1]+vect3[1];\n vectors[j*resX+i][2]=dir[2]+vect2[2]+vect3[2];\n vectors[j*resX+i]=normalize(vectors[j*resX+i]);\n vect2[0]-=x[0];\n vect2[1]-=x[1];\n vect2[2]-=x[2];\n if((vectorLength(vect2)>(-0.0001)&&vectorLength(vect2)<0.0001)&&(resX%2)==0){\n vect2[0]-=x[0];\n vect2[1]-=x[1];\n vect2[2]-=x[2];\n }\n }\n //printVector(temp);\n vect2[0]=temp[0];\n vect2[1]=temp[1];\n vect2[2]=temp[2];\n vect3[0]-=y[0];\n vect3[1]-=y[1];\n vect3[2]-=y[2];\n if((vectorLength(vect3)>(-0.0001)&&vectorLength(vect3)<0.0001)&&(resY%2)==0){\n vect3[0]-=y[0];\n vect3[1]-=y[1];\n vect3[2]-=y[2];\n }\n }\n \n return vectors;\n }", "public boolean intersects( final float tx, final float ty, final float width, final float height )\r\n {\r\n if ( this.transform.tx( ) > tx + width ) return false;\r\n if ( this.transform.tx( ) + this.width( ) < tx ) return false;\r\n if ( this.transform.ty( ) > ty + height ) return false;\r\n if ( this.transform.ty( ) + this.height( ) < ty ) return false;\r\n\r\n return true;\r\n }", "public Vector3f getSphereCenter() {\n\t\tfloat[] arr = getMinMax();\n\t\t\n\t\treturn new Vector3f((arr[0]+arr[1])/2,(arr[2]+arr[3])/2,(arr[4]+arr[5])/2);\n\t}", "public long[] getWorldCoordinate(int screenX, int screenY);", "FloatBuffer getInterleavedBuffers(float[] posDat, float[] colDat, float[]\n normDat, float[] texDat) {\n if (colDat == null && texDat == null) {\n throw new IllegalArgumentException(\"no color or texture\");\n }\n // interleaving pX,pY,pZ,r,g,b,a,nX,nY,nZ,u,v // 12*4 = 48bytes\n int posIndx = 0;\n int colIndx = 0;\n int norIndx = 0;\n int texIndx = 0;\n int size = posDat.length + normDat.length;\n size += (colDat != null) ? colDat.length : 0;\n size += (texDat != null) ? texDat.length : 0;\n int step = 3 + 3 + ((colDat != null) ? 4 : 0) + ((texDat != null) ? 2 : 0);\n float[] interleavedData = new float[size];\n// Log.e(\"InterleavedBuffers\", \"size=\" + size + \", step=\" + step);\n int i = 0;\n while(i < size){\n interleavedData[i + 0] = posDat[posIndx + 0];\n interleavedData[i + 1] = posDat[posIndx + 1];\n interleavedData[i + 2] = posDat[posIndx + 2];\n posIndx += 3;\n i += 3;\n if (colDat != null) {\n interleavedData[i + 0] = colDat[colIndx + 0];\n interleavedData[i + 1] = colDat[colIndx + 1];\n interleavedData[i + 2] = colDat[colIndx + 2];\n interleavedData[i + 3] = colDat[colIndx + 3];\n colIndx += 4;\n i += 4;\n }\n interleavedData[i + 0] = normDat[norIndx + 0];\n interleavedData[i + 1] = normDat[norIndx + 1];\n interleavedData[i + 2] = normDat[norIndx + 2];\n norIndx += 3;\n i += 3;\n if (texDat != null) {\n interleavedData[i + 0] = texDat[texIndx + 0];\n interleavedData[i + 1] = texDat[texIndx + 1];\n texIndx += 2;\n i += 2;\n }\n }\n final FloatBuffer buffer;\n\n buffer = floatArrayToFloatBuffer(interleavedData);\n\n return buffer;\n }", "public int makesurfaceTextureId() {\n int[] textures = new int[1];\n GLES20.glGenTextures(1, textures, 0);\n\n int SurfaceTextId = textures[0];\n GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, SurfaceTextId);\n\n // Can't do mipmapping with camera source\n GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER,\n GLES20.GL_NEAREST);\n GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER,\n GLES20.GL_LINEAR);\n // Clamp to edge is the only option\n GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S,\n GLES20.GL_CLAMP_TO_EDGE);\n GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T,\n GLES20.GL_CLAMP_TO_EDGE);\n BitmapFactory.Options options = new BitmapFactory.Options();\n options.inScaled = false;\n Bitmap bitmap = BitmapFactory.decodeResource(this.getContext().getResources(), R.drawable\n .grey, options);\n GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0);\n bitmap.recycle();\n // Log.d(\"MyRender\", \"SurfaceTextId is Created\");\n return SurfaceTextId;\n }", "public List<Point3D> FindIntersections(Ray ray) throws Exception\n {\n List<Point3D> ListInter = new LinkedList<Point3D>();\n\n //find P0\n Point3D P0 = new Point3D(ray.getPOO());\n\n //find the triangle's Normal\n Vector N = this.getNormal(this.getP1());\n\n //find Plane\n Plane plane = new Plane(N, this.getP3());\n\n //if the intersection between the ray and plane\n List<Point3D> ListIntersectionPlane = plane.FindIntersections(ray);\n\n if(ListIntersectionPlane.isEmpty())\n return ListInter;\n\n Point3D intersectionPlane = ListIntersectionPlane.get(0);\n\n //defin Vector P_P0\n Vector P_P0 = new Vector(P0, intersectionPlane);\n\n //checking side 1-2\n Vector V1_1 = new Vector(P0, this._p1);\n Vector V2_1 = new Vector(P0, this._p2);\n Vector N1 = new Vector(V1_1.crossProduct(V2_1));\n N1.normalize();\n double S1 = -P_P0.dotProduct(N1);\n\n //checking side 2-3\n Vector V1_2 = new Vector(P0, this._p2);\n Vector V2_2 = new Vector(P0, this._p3);\n Vector N2 = new Vector(V1_2.crossProduct(V2_2));\n N2.normalize();\n double S2 = -P_P0.dotProduct(N2);\n\n //checking side 3-1\n Vector V1_3 = new Vector(P0, this._p3);\n Vector V2_3 = new Vector(P0, this._p1);\n Vector N3 = new Vector(V1_3.crossProduct(V2_3));\n N3.normalize();\n double S3 = -P_P0.dotProduct(N3);\n\n if (((S1 > 0) && (S2 > 0) && (S3 > 0)) || ((S1 < 0) && (S2 < 0) && (S3 < 0)))\n ListInter.add(intersectionPlane);\n return ListInter;\n\n }", "List<GeoPoint> findGeoIntersections(Ray ray);", "protected ResourceLocation getEntityTexture(Entity p_110775_1_)\n {\n return this.getEntityTexture0((EntityEnderPig)p_110775_1_);\n }", "private void generateBoxGeom()\n {\n // textures all share the same array, so process separately.\n textureBuffer = createBuffer(BOX_TEX_COORDS.length);\n textureBuffer.put(BOX_TEX_COORDS);\n textureBuffer.rewind();\n\n vertexBuffer = new FloatBuffer[6];\n normalBuffer = new FloatBuffer[6];\n\n for(int i = 0; i < 6; i++)\n {\n vertexBuffer[i] = createBuffer(12);\n normalBuffer[i] = createBuffer(12);\n }\n\n vertexBuffer[POSITIVE_X].put(RIGHT_BOX_COORDS);\n normalBuffer[POSITIVE_X].put(RIGHT_BOX_NORMALS);\n\n vertexBuffer[NEGATIVE_X].put(LEFT_BOX_COORDS);\n normalBuffer[NEGATIVE_X].put(LEFT_BOX_NORMALS);\n\n vertexBuffer[POSITIVE_Y].put(TOP_BOX_COORDS);\n normalBuffer[POSITIVE_Y].put(TOP_BOX_NORMALS);\n\n vertexBuffer[NEGATIVE_Y].put(BOTTOM_BOX_COORDS);\n normalBuffer[NEGATIVE_Y].put(BOTTOM_BOX_NORMALS);\n\n vertexBuffer[POSITIVE_Z].put(BACK_BOX_COORDS);\n normalBuffer[POSITIVE_Z].put(BACK_BOX_NORMALS);\n\n vertexBuffer[NEGATIVE_Z].put(FRONT_BOX_COORDS);\n normalBuffer[NEGATIVE_Z].put(FRONT_BOX_NORMALS);\n\n for(int i = 0; i < 6; i++)\n {\n vertexBuffer[i].rewind();\n normalBuffer[i].rewind();\n }\n }", "@Override\n public Intersection getIntersectionEast(){\n if(!mapLoaded){\n return null;\n }\n return extremIntersection[2];\n }", "void vectorFromWorld(double px, double py, double pz, DVector3 result);", "public QuadMesh() {\n lastInfo = new GeometryIntersectionInformation();\n lastRay = null;\n minMax = null;\n boundingVolume = null;\n triangleMeshGroupCache = null;\n\n vertexPositions = null;\n vertexNormals = null;\n vertexBinormals = null;\n vertexTangents = null;\n vertexColors = null;\n vertexUvs = null;\n quadIndices = null;\n incidentQuadsPerVertexArray = null;\n }", "IPoint intersect(Figures figures)\n { float epsilon=IPoint.epsilon;\n Vec3D e1 = figures.getP2().minus(figures.getP1());\n Vec3D e2 = figures.getP3().minus(figures.getP1());\n Vec3D p = dir.cross(e2);\n float a = e1.dot(p);\n if ((a>-epsilon) && (a<epsilon)) return new IPoint(null,null,-1);\n float f = 1/a;\n Vec3D s = start.minus(figures.getP1());\n float u = f*s.dot(p);\n if ((u<0.0) || (u>1.0)) return new IPoint(null,null,-1);\n Vec3D q = s.cross(e1);\n float v = f*dir.dot(q);\n if ((v<0.0) || (u+v>1.0)) return new IPoint(null,null,-1);\n float dist=f*e2.dot(q);\n if (dist<epsilon) return new IPoint(null,null,-1);\n Vec3D ip=figures.getP1().mult(1-u-v).add(figures.getP2().mult(u)).add(figures.getP3().mult(v));\n return new IPoint(figures,ip,dist);\n }", "public boolean intersects(MeshObject object) {\r\n return intersects(this.getCurrentCollisionCenter(), this.boundingSphereRadius, object.getCurrentCollisionCenter(), object.boundingSphereRadius);\r\n }", "public ResourceLocation getEntityTexture(T entity) {\n return MINECART_TEXTURES;\n }", "private float[] calculateMouseRay(int mouseX, int mouseY) {\n\t\tfloat[] normalizedDeviceCoords = getNormalizedDeviceCoords(mouseX, mouseY);\r\n\t\t\r\n\t\t//Creating a 4D vector out of the normalizedDeviceCoords, defining z as -1 (clipping Plane):\r\n\t\tfloat[] clipCoords = {normalizedDeviceCoords[0], normalizedDeviceCoords[1], -1f, 1f};\r\n\t\t\r\n\t\t//4D vector containing the inverted projection\r\n\t\tfloat[] eyeCoords = toEyeCoords(clipCoords);\r\n\t\t\r\n\t\t//3D vector containing the world coords of our mouse ray\r\n\t\tfloat[] worldCoords = toWorldCoords(eyeCoords);\r\n\t\t\r\n\t\treturn worldCoords;\r\n\t}", "public void texturedSphere(float r, PImage t) {\n int v1, v11, v2;\n r = (r + 240 ) * 0.33f;\n// tint(255, 48);\n beginShape(TRIANGLE_STRIP);\n texture(t);\n float iu=(float)(t.width-1)/(sDetail);\n float iv=(float)(t.height-1)/(sDetail);\n float u=0, v=iv;\n for (int i = 0; i < sDetail; i++) {\n vertex(0, -r, 0, u, 0);\n vertex(sphereX[i]*r, sphereY[i]*r, sphereZ[i]*r, u, v);\n u+=iu;\n }\n vertex(0, -r, 0, u, 0);\n vertex(sphereX[0]*r, sphereY[0]*r, sphereZ[0]*r, u, v);\n endShape(); \n \n // Middle rings\n int voff = 0;\n for (int i = 2; i < sDetail; i++) {\n v1=v11=voff;\n voff += sDetail;\n v2=voff;\n u=0;\n// tint(255, 255);\n beginShape(TRIANGLE_STRIP);\n texture(t);\n for (int j = 0; j < sDetail; j++) {\n vertex(sphereX[v1]*r, sphereY[v1]*r, sphereZ[v1++]*r, u, v);\n vertex(sphereX[v2]*r, sphereY[v2]*r, sphereZ[v2++]*r, u, v+iv);\n u+=iu;\n }\n \n // Close each ring\n v1=v11;\n v2=voff;\n vertex(sphereX[v1]*r, sphereY[v1]*r, sphereZ[v1]*r, u, v);\n vertex(sphereX[v2]*r, sphereY[v2]*r, sphereZ[v2]*r, u, v+iv);\n endShape();\n v+=iv;\n }\n u=0;\n \n // Add the northern cap\n// tint(255, 131);\n beginShape(TRIANGLE_STRIP);\n texture(t);\n for (int i = 0; i < sDetail; i++) {\n v2 = voff + i;\n vertex(sphereX[v2]*r, sphereY[v2]*r, sphereZ[v2]*r, u, v);\n vertex(0, r, 0, u, v+iv); \n u+=iu;\n }\n vertex(sphereX[voff]*r, sphereY[voff]*r, sphereZ[voff]*r, u, v);\n endShape();\n }", "public Texture getTexture() {\n\t\treturn region;\n\t}", "public static WritableImage getSphereTexture(double[][][] noise, int width, int height) {\n\t\tWritableImage result = new WritableImage(width, height);\n\t\tPixelWriter writer = result.getPixelWriter();\n\t\t\n\t\tfor (int y = 0; y < height; y ++) {\n\t\t\tfor (int x = 0; x < width; x ++) {\n\t\t\t\tdouble u = (double)x/width;\n\t\t\t\tdouble v = (double)y/height;\n\t\t\t\t\n\t\t\t\tdouble lat = u * 2 * Math.PI;\n\t\t\t\tdouble lng = v * 2 * Math.PI;\n\t\t\t\t\n\t\t\t\tdouble xt = Math.sin(lng)*Math.cos(lat);\n\t\t\t\tdouble yt = Math.sin(lng)*Math.sin(lat);\n\t\t\t\tdouble zt = Math.cos(lng);\n\t\t\t\t\n\t\t\t\txt = MathUtils.map(xt, -1.0, 1.0, 0.0, noise.length - 1);\n\t\t\t\tyt = MathUtils.map(yt, -1.0, 1.0, 0.0, noise.length - 1);\n\t\t\t zt = MathUtils.map(zt, -1.0, 1.0, 0.0, noise.length - 1);\n\t\t\t\t\n\t\t\t\t//System.out.printf(\"%f %f\\n\", lat, lng);\n\t\t\t\t//System.out.printf(\"%d %d => %d %d %d\\n\", x, y, dX, dY, dZ);\n\t\t\t\t\n\t\t\t /* get remainders to weight values */\n\t\t\t double xrem = xt - Math.floor(xt);\n\t\t\t double yrem = yt - Math.floor(yt);\n\t\t\t double zrem = zt - Math.floor(zt);\n\t\t\t \n\t\t\t /* Weights of all adjacent cells */\n\t\t\t \n\t\t\t /* Values of all adjacent cells */\n\t\t\t double brf = noise[(int)Math.ceil(zt)][(int)Math.ceil(yt)][(int)Math.ceil(xt)];\n\t\t\t double blf = noise[(int)Math.ceil(zt)][(int)Math.ceil(yt)][(int)Math.floor(xt)];\n\t\t\t double tlf = noise[(int)Math.ceil(zt)][(int)Math.floor(yt)][(int)Math.floor(xt)];\n\t\t\t double trf = noise[(int)Math.ceil(zt)][(int)Math.floor(yt)][(int)Math.ceil(xt)];\n\t\t\t double brb = noise[(int)Math.floor(zt)][(int)Math.ceil(yt)][(int)Math.ceil(xt)];\n\t\t\t double blb = noise[(int)Math.floor(zt)][(int)Math.ceil(yt)][(int)Math.floor(xt)];\n\t\t\t double tlb = noise[(int)Math.floor(zt)][(int)Math.floor(yt)][(int)Math.floor(xt)];\n\t\t\t double trb = noise[(int)Math.floor(zt)][(int)Math.floor(yt)][(int)Math.ceil(xt)];\n\t\t\t \n\t\t\t /* weighted average of all adjacent cells */\n\t\t\t\tdouble val = 0.0;\n\t\t\t\tval += brf*xrem*yrem*zrem;\n\t\t\t\tval += blf*(1-xrem)*yrem*zrem;\n\t\t\t\tval += tlf*(1-xrem)*(1-yrem)*zrem;\n\t\t\t\tval += trf*xrem*(1-yrem)*zrem;\n\t\t\t\tval += brb*xrem*yrem*(1-zrem);\n\t\t\t\tval += blb*(1-xrem)*yrem*(1-zrem);\n\t\t\t\tval += tlb*(1-xrem)*(1-yrem)*(1-zrem);\n\t\t\t\tval += trb*xrem*(1-yrem)*(1-zrem);\n\t\t\t\t\t\t\n\t\t\t\t//val /= 8;\n\t\t\t\t\n\t\t\t\twriter.setColor(x, y, new Color(val,val,val,1.0));\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn result;\n\t}", "void addTextureCoordinate(Vector t);", "public abstract Vector computeCenter();", "public float getIntersection(Line2D.Float line) {\n // The intersection point I, of two vectors, A1->A2 and\n // B1->B2, is:\n // I = A1 + Ua * (A2 - A1)\n // I = B1 + Ub * (B2 - B1)\n //\n // Solving for Ua gives us the following formula.\n // Ua is returned.\n float denominator = (line.y2 - line.y1) * (x2 - x1) -\n (line.x2 - line.x1) * (y2 - y1);\n\n // check if the two lines are parallel\n if (denominator == 0) {\n return -1;\n }\n\n float numerator = (line.x2 - line.x1) * (y1 - line.y1) -\n (line.y2 - line.y1) * (x1 - line.x1);\n\n return numerator / denominator;\n }", "public static boolean intersectLineTriangle(Vec3 p, Vec3 q, Vec3 a, Vec3 b, Vec3 c, Vec3 r) {\r\n\t // Bring points to their respective coordinate frame\r\n\t Vec3 pq = q.subtract( p);\r\n\t Vec3 pa =a.subtract(p);\r\n\t Vec3 pb = b.subtract(p);\r\n\t Vec3 pc = c.subtract(p);\r\n\t \r\n\t Vec3 m = pq.cross(pc);\r\n\t \r\n\t float u = pb.dot(m); \r\n\t float v = -pa.dot(m);\r\n\t \r\n\t if (Math.signum(u) != Math.signum(v)) {\r\n\t return false;\r\n\t }\r\n\t \r\n\t // scalar triple product\r\n\t float w = pq.dot( pb.cross(pa));\r\n\t \r\n\t if (Math.signum(u) != Math.signum(w)) {\r\n\t return false;\r\n\t }\r\n\t \r\n\t float denom = 1.0f / (u + v + w);\r\n\t \r\n\t // r = ((u * denom) * a) + ((v * denom) * b) + ((w * denom) * c);\r\n\t Vec3 compA = a.multiply(u * denom);\r\n\t Vec3 compB = b.multiply( v * denom);\r\n\t Vec3 compC = c.multiply( w * denom);\r\n\t \r\n\t // store result in Vector r\r\n\t r.x = compA.x + compB.x + compC.x;\r\n\t r.y = compA.y + compB.y + compC.y;\r\n\t r.z = compA.z + compB.z + compC.z;\r\n\t \r\n\t return true;\r\n\t}", "SurfaceTexture mo17006a();", "@Nonnull\n Texture getWorldMap();", "public static void main(String[] args){\n Mesh3D box = Mesh3D.box(10, 20, 60);\n \n Line3D lineX = box.getLineX();\n Line3D lineY = box.getLineY();\n Line3D lineZ = box.getLineZ();\n lineX.show();\n lineY.show();\n lineZ.show();\n box.translateXYZ(100, 0.0, 0.0); \n box.show();\n Line3D line = new Line3D(); \n List<Point3D> intersects = new ArrayList<Point3D>();\n \n for(int p = 0; p < 100; p++){\n double r = 600;\n double theta = Math.toRadians(90.0);//Math.toRadians(Math.random()*180.0);\n double phi = Math.toRadians(Math.random()*360.0-180.0);\n line.set(0.0,0.0,0.0, \n Math.sin(theta)*Math.cos(phi)*r,\n Math.sin(theta)*Math.sin(phi)*r,\n Math.cos(theta)*r\n );\n intersects.clear();\n box.intersectionRay(line, intersects);\n System.out.println(\"theta/phi = \" + Math.toDegrees(theta) + \" \"\n + Math.toDegrees(phi) + \" intersects = \" + intersects.size());\n \n }\n }", "private static double[][] getEllipsoid(final ImageStack aInputStack, final int[] aLables, final double[] aResol)\r\n\t{\r\n\t\tfinal double[][] ellipsoids = GeometricMeasures3D.inertiaEllipsoid(aInputStack, aLables, aResol);\r\n\t\treturn ellipsoids;\r\n\t}", "protected ResourceLocation getEntityTexture(Entity p_110775_1_)\n {\n return this.getEntityTexture((EntityBat)p_110775_1_);\n }", "godot.wire.Wire.Vector3 getOrigin();", "public static S2Point getIntersection(S2Point a0, S2Point a1, S2Point b0, S2Point b1) {\n return getIntersection(a0, a1, b0, b1, new ResultError());\n }", "public Point2D.Float getIntersectionPoint(Line2D.Float line,\n Point2D.Float intersection)\n {\n if (intersection == null) {\n intersection = new Point2D.Float();\n }\n float fraction = getIntersection(line);\n intersection.setLocation(\n x1 + fraction * (x2 - x1),\n y1 + fraction * (y2 - y1));\n return intersection;\n }", "public SbVec3f getNormal() { return worldNormal; }", "public void calculateNormals() {\n // TODO!\n }", "godot.wire.Wire.Vector3 getNormal();", "public boolean areIntersecting() {\n return intersection != null;\n }", "public interface FrameSphere3DReadOnly extends Sphere3DReadOnly, FrameShape3DReadOnly\n{\n /** {@inheritDoc} */\n @Override\n FramePoint3DReadOnly getPosition();\n\n /**\n * {@inheritDoc}\n * <p>\n * Note that the centroid is also the position of this sphere.\n * </p>\n */\n @Override\n default FramePoint3DReadOnly getCentroid()\n {\n return getPosition();\n }\n\n /**\n * Computes the coordinates of the possible intersections between a line and this sphere.\n * <p>\n * In the case the line and this sphere do not intersect, this method returns {@code 0} and\n * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} remain unmodified.\n * </p>\n *\n * @param line the line expressed in world coordinates that may intersect this\n * sphere. Not modified.\n * @param firstIntersectionToPack the coordinate in world of the first intersection. Can be\n * {@code null}. Modified.\n * @param secondIntersectionToPack the coordinate in world of the second intersection. Can be\n * {@code null}. Modified.\n * @return the number of intersections between the line and this sphere. It is either equal to 0, 1,\n * or 2.\n * @throws ReferenceFrameMismatchException if the frame argument is not expressed in the same\n * reference frame as {@code this}.\n */\n default int intersectionWith(FrameLine3DReadOnly line, Point3DBasics firstIntersectionToPack, Point3DBasics secondIntersectionToPack)\n {\n return intersectionWith(line.getPoint(), line.getDirection(), firstIntersectionToPack, secondIntersectionToPack);\n }\n\n /**\n * Computes the coordinates of the possible intersections between a line and this sphere.\n * <p>\n * In the case the line and this sphere do not intersect, this method returns {@code 0} and\n * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} remain unmodified.\n * </p>\n *\n * @param line the line expressed in world coordinates that may intersect this\n * sphere. Not modified.\n * @param firstIntersectionToPack the coordinate in world of the first intersection. Can be\n * {@code null}. Modified.\n * @param secondIntersectionToPack the coordinate in world of the second intersection. Can be\n * {@code null}. Modified.\n * @return the number of intersections between the line and this sphere. It is either equal to 0, 1,\n * or 2.\n * @throws ReferenceFrameMismatchException if {@code line} is not expressed in the same reference\n * frame as {@code this}.\n */\n default int intersectionWith(FrameLine3DReadOnly line, FramePoint3DBasics firstIntersectionToPack, FramePoint3DBasics secondIntersectionToPack)\n {\n return intersectionWith(line.getPoint(), line.getDirection(), firstIntersectionToPack, secondIntersectionToPack);\n }\n\n /**\n * Computes the coordinates of the possible intersections between a line and this sphere.\n * <p>\n * In the case the line and this sphere do not intersect, this method returns {@code 0} and\n * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} remain unmodified.\n * </p>\n *\n * @param line the line expressed in world coordinates that may intersect this\n * sphere. Not modified.\n * @param firstIntersectionToPack the coordinate in world of the first intersection. Can be\n * {@code null}. Modified.\n * @param secondIntersectionToPack the coordinate in world of the second intersection. Can be\n * {@code null}. Modified.\n * @return the number of intersections between the line and this sphere. It is either equal to 0, 1,\n * or 2.\n */\n default int intersectionWith(Line3DReadOnly line, FramePoint3DBasics firstIntersectionToPack, FramePoint3DBasics secondIntersectionToPack)\n {\n return intersectionWith(line.getPoint(), line.getDirection(), firstIntersectionToPack, secondIntersectionToPack);\n }\n\n /**\n * Computes the coordinates of the possible intersections between a line and this sphere.\n * <p>\n * In the case the line and this sphere do not intersect, this method returns {@code 0} and\n * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} remain unmodified.\n * </p>\n *\n * @param line the line expressed in world coordinates that may intersect this\n * sphere. Not modified.\n * @param firstIntersectionToPack the coordinate in world of the first intersection. Can be\n * {@code null}. Modified.\n * @param secondIntersectionToPack the coordinate in world of the second intersection. Can be\n * {@code null}. Modified.\n * @return the number of intersections between the line and this sphere. It is either equal to 0, 1,\n * or 2.\n * @throws ReferenceFrameMismatchException if any of the frame arguments is not expressed in the\n * same reference frame as {@code this}.\n */\n default int intersectionWith(Line3DReadOnly line, FixedFramePoint3DBasics firstIntersectionToPack, FixedFramePoint3DBasics secondIntersectionToPack)\n {\n return intersectionWith(line.getPoint(), line.getDirection(), firstIntersectionToPack, secondIntersectionToPack);\n }\n\n /**\n * Computes the coordinates of the possible intersections between a line and this sphere.\n * <p>\n * In the case the line and this sphere do not intersect, this method returns {@code 0} and\n * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} remain unmodified.\n * </p>\n *\n * @param line the line expressed in world coordinates that may intersect this\n * sphere. Not modified.\n * @param firstIntersectionToPack the coordinate in world of the first intersection. Can be\n * {@code null}. Modified.\n * @param secondIntersectionToPack the coordinate in world of the second intersection. Can be\n * {@code null}. Modified.\n * @return the number of intersections between the line and this sphere. It is either equal to 0, 1,\n * or 2.\n * @throws ReferenceFrameMismatchException if any of the arguments is not expressed in the same\n * reference frame as {@code this}.\n */\n default int intersectionWith(FrameLine3DReadOnly line, FixedFramePoint3DBasics firstIntersectionToPack, FixedFramePoint3DBasics secondIntersectionToPack)\n {\n return intersectionWith(line.getPoint(), line.getDirection(), firstIntersectionToPack, secondIntersectionToPack);\n }\n\n /**\n * Computes the coordinates of the possible intersections between a line and this sphere.\n * <p>\n * In the case the line and this sphere do not intersect, this method returns {@code 0} and\n * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} are set to\n * {@link Double#NaN}.\n * </p>\n *\n * @param pointOnLine a point expressed in world located on the infinitely long line.\n * Not modified.\n * @param lineDirection the direction expressed in world of the line. Not modified.s\n * @param firstIntersectionToPack the coordinate in world of the first intersection. Can be\n * {@code null}. Modified.\n * @param secondIntersectionToPack the coordinate in world of the second intersection. Can be\n * {@code null}. Modified.\n * @return the number of intersections between the line and this sphere. It is either equal to 0, 1,\n * or 2.\n * @throws ReferenceFrameMismatchException if any of the frame arguments is not expressed in the\n * same reference frame as {@code this}.\n */\n default int intersectionWith(FramePoint3DReadOnly pointOnLine,\n FrameVector3DReadOnly lineDirection,\n Point3DBasics firstIntersectionToPack,\n Point3DBasics secondIntersectionToPack)\n {\n checkReferenceFrameMatch(pointOnLine, lineDirection);\n return Sphere3DReadOnly.super.intersectionWith(pointOnLine, lineDirection, firstIntersectionToPack, secondIntersectionToPack);\n }\n\n /**\n * Computes the coordinates of the possible intersections between a line and this sphere.\n * <p>\n * In the case the line and this sphere do not intersect, this method returns {@code 0} and\n * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} are set to\n * {@link Double#NaN}.\n * </p>\n *\n * @param pointOnLine a point expressed in world located on the infinitely long line.\n * Not modified.\n * @param lineDirection the direction expressed in world of the line. Not modified.s\n * @param firstIntersectionToPack the coordinate in world of the first intersection. Can be\n * {@code null}. Modified.\n * @param secondIntersectionToPack the coordinate in world of the second intersection. Can be\n * {@code null}. Modified.\n * @return the number of intersections between the line and this sphere. It is either equal to 0, 1,\n * or 2.\n */\n default int intersectionWith(Point3DReadOnly pointOnLine,\n Vector3DReadOnly lineDirection,\n FramePoint3DBasics firstIntersectionToPack,\n FramePoint3DBasics secondIntersectionToPack)\n {\n if (firstIntersectionToPack != null)\n firstIntersectionToPack.setReferenceFrame(getReferenceFrame());\n if (secondIntersectionToPack != null)\n secondIntersectionToPack.setReferenceFrame(getReferenceFrame());\n return Sphere3DReadOnly.super.intersectionWith(pointOnLine, lineDirection, firstIntersectionToPack, secondIntersectionToPack);\n }\n\n /**\n * Computes the coordinates of the possible intersections between a line and this sphere.\n * <p>\n * In the case the line and this sphere do not intersect, this method returns {@code 0} and\n * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} are set to\n * {@link Double#NaN}.\n * </p>\n *\n * @param pointOnLine a point expressed in world located on the infinitely long line.\n * Not modified.\n * @param lineDirection the direction expressed in world of the line. Not modified.s\n * @param firstIntersectionToPack the coordinate in world of the first intersection. Can be\n * {@code null}. Modified.\n * @param secondIntersectionToPack the coordinate in world of the second intersection. Can be\n * {@code null}. Modified.\n * @return the number of intersections between the line and this sphere. It is either equal to 0, 1,\n * or 2.\n * @throws ReferenceFrameMismatchException if any of the frame arguments is not expressed in the\n * same reference frame as {@code this}.\n */\n default int intersectionWith(Point3DReadOnly pointOnLine,\n Vector3DReadOnly lineDirection,\n FixedFramePoint3DBasics firstIntersectionToPack,\n FixedFramePoint3DBasics secondIntersectionToPack)\n {\n if (firstIntersectionToPack != null)\n checkReferenceFrameMatch(firstIntersectionToPack);\n if (secondIntersectionToPack != null)\n checkReferenceFrameMatch(secondIntersectionToPack);\n return Sphere3DReadOnly.super.intersectionWith(pointOnLine, lineDirection, firstIntersectionToPack, secondIntersectionToPack);\n }\n\n /**\n * Computes the coordinates of the possible intersections between a line and this sphere.\n * <p>\n * In the case the line and this sphere do not intersect, this method returns {@code 0} and\n * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} are set to\n * {@link Double#NaN}.\n * </p>\n *\n * @param pointOnLine a point expressed in world located on the infinitely long line.\n * Not modified.\n * @param lineDirection the direction expressed in world of the line. Not modified.s\n * @param firstIntersectionToPack the coordinate in world of the first intersection. Can be\n * {@code null}. Modified.\n * @param secondIntersectionToPack the coordinate in world of the second intersection. Can be\n * {@code null}. Modified.\n * @return the number of intersections between the line and this sphere. It is either equal to 0, 1,\n * or 2.\n * @throws ReferenceFrameMismatchException if either {@code pointOnLine} or {@code lineDirection} is\n * not expressed in the same reference frame as\n * {@code this}.\n */\n default int intersectionWith(FramePoint3DReadOnly pointOnLine,\n FrameVector3DReadOnly lineDirection,\n FramePoint3DBasics firstIntersectionToPack,\n FramePoint3DBasics secondIntersectionToPack)\n {\n checkReferenceFrameMatch(pointOnLine, lineDirection);\n if (firstIntersectionToPack != null)\n firstIntersectionToPack.setReferenceFrame(getReferenceFrame());\n if (secondIntersectionToPack != null)\n secondIntersectionToPack.setReferenceFrame(getReferenceFrame());\n return Sphere3DReadOnly.super.intersectionWith(pointOnLine, lineDirection, firstIntersectionToPack, secondIntersectionToPack);\n }\n\n /**\n * Computes the coordinates of the possible intersections between a line and this sphere.\n * <p>\n * In the case the line and this sphere do not intersect, this method returns {@code 0} and\n * {@code firstIntersectionToPack} and {@code secondIntersectionToPack} are set to\n * {@link Double#NaN}.\n * </p>\n *\n * @param pointOnLine a point expressed in world located on the infinitely long line.\n * Not modified.\n * @param lineDirection the direction expressed in world of the line. Not modified.s\n * @param firstIntersectionToPack the coordinate in world of the first intersection. Can be\n * {@code null}. Modified.\n * @param secondIntersectionToPack the coordinate in world of the second intersection. Can be\n * {@code null}. Modified.\n * @return the number of intersections between the line and this sphere. It is either equal to 0, 1,\n * or 2.\n * @throws ReferenceFrameMismatchException if any of the arguments is not expressed in the same\n * reference frame as {@code this}.\n */\n default int intersectionWith(FramePoint3DReadOnly pointOnLine,\n FrameVector3DReadOnly lineDirection,\n FixedFramePoint3DBasics firstIntersectionToPack,\n FixedFramePoint3DBasics secondIntersectionToPack)\n {\n checkReferenceFrameMatch(pointOnLine, lineDirection);\n if (firstIntersectionToPack != null)\n checkReferenceFrameMatch(firstIntersectionToPack);\n if (secondIntersectionToPack != null)\n checkReferenceFrameMatch(secondIntersectionToPack);\n return Sphere3DReadOnly.super.intersectionWith(pointOnLine, lineDirection, firstIntersectionToPack, secondIntersectionToPack);\n }\n\n /** {@inheritDoc} */\n @Override\n default void getBoundingBox(BoundingBox3DBasics boundingBoxToPack)\n {\n Sphere3DReadOnly.super.getBoundingBox(boundingBoxToPack);\n }\n\n /** {@inheritDoc} */\n @Override\n default void getBoundingBox(ReferenceFrame destinationFrame, BoundingBox3DBasics boundingBoxToPack)\n {\n EuclidFrameShapeTools.boundingBoxSphere3D(this, destinationFrame, boundingBoxToPack);\n }\n\n /** {@inheritDoc} */\n @Override\n default FrameShape3DPoseReadOnly getPose()\n {\n return null;\n }\n\n /** {@inheritDoc} */\n @Override\n FixedFrameSphere3DBasics copy();\n\n /**\n * Gets a representative {@code String} of this frame sphere 3D given a specific format to use.\n * <p>\n * Using the default format {@link EuclidCoreIOTools#DEFAULT_FORMAT}, this provides a {@code String}\n * as follows:\n *\n * <pre>\n * Sphere 3D: [position: (-0.362, -0.617, 0.066 ), radius: 0.906] - worldFrame\n * </pre>\n * </p>\n */\n @Override\n default String toString(String format)\n {\n return EuclidFrameShapeIOTools.getFrameSphere3DString(format, this);\n }\n}" ]
[ "0.5808213", "0.5787569", "0.575315", "0.5703355", "0.566494", "0.566272", "0.56366324", "0.5576684", "0.554826", "0.54882884", "0.54739565", "0.5350145", "0.5329815", "0.52926934", "0.52729774", "0.51925105", "0.5169737", "0.51678085", "0.51332104", "0.5100885", "0.5081969", "0.5059159", "0.5033983", "0.50162685", "0.50092685", "0.4966615", "0.49358708", "0.49202824", "0.49043632", "0.4881647", "0.48811778", "0.488044", "0.48691177", "0.48656476", "0.48637676", "0.4822709", "0.48196197", "0.48005897", "0.4796205", "0.47917464", "0.47828537", "0.47817385", "0.4781006", "0.47789258", "0.47774094", "0.4776979", "0.4774215", "0.47688684", "0.47524345", "0.47430474", "0.4742994", "0.47386134", "0.47338703", "0.4727391", "0.47267905", "0.4720582", "0.47071922", "0.46956426", "0.4687682", "0.46861702", "0.4682724", "0.46774632", "0.46774375", "0.4675532", "0.46753925", "0.4672593", "0.4667893", "0.46672073", "0.46560094", "0.46541896", "0.46527833", "0.4652324", "0.46516612", "0.46462008", "0.46447873", "0.46323514", "0.46313494", "0.4626425", "0.4622011", "0.46178043", "0.4614278", "0.46124825", "0.46036536", "0.4603597", "0.45930362", "0.4592744", "0.45729345", "0.4571103", "0.45634156", "0.45584553", "0.45548794", "0.45500922", "0.45478263", "0.45470938", "0.45466512", "0.45462936", "0.45433727", "0.4542269", "0.45402974", "0.45364425", "0.4534618" ]
0.0
-1
! These return the intersection point and surface normal in world space, ! and the texture coordinates in image space.
public SbVec3f getNormal() { return worldNormal; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public Intersection getIntersectionNorth(){\n if(!mapLoaded){\n return null;\n }\n return extremIntersection[0];\n }", "public Coordinates intersection() {\n return intersection;\n }", "private Point3 _getIntersection(Point3 eye, Point3 direction) {\n int size = NORMALS.length;\n float tresult;\n Point4 norm; // normal of face hit\n Plane plane; // plane equation\n float tnear, tfar, t, vn, vd;\n int front = 0, back = 0; // front/back face # hit\n\n tnear = -1.0e+20f; // -HUGE_VAL\n tfar = +1.0e+20f; // tmax\n for (int i = 0; i < size; i++) {\n\n plane = _planes[i];\n\n vd = plane.dot(direction);\n vn = plane.distance(eye);\n if (vd == 0.0f) {\n // ray is parallel to plane -\n // check if ray origin is inside plane's\n // half-space\n if (vn < 0.0f) {\n return null;\n }\n\n } else {\n // ray not parallel - get distance to plane\n t = -vn / vd;\n if (vd > 0.0f) {\n\n if (t > tfar) {\n return null;\n }\n if (t > tnear) {\n // hit near face, update normal\n front = i;\n tnear = t;\n }\n } else {\n // back face - T is a far point\n\n if (t < tnear) {\n return null;\n }\n if (t < tfar) {\n // hit far face, update normal\n\n back = i;\n tfar = t;\n }\n }\n }\n }\n // survived all tests\n // Note: if ray originates on polyhedron,\n // may want to change 0.0 to some\n // epsilon to avoid intersecting the originating face.\n //\n if (tnear >= 0.0f) {\n // outside, hitting front face\n norm = _planes[front]._normal;\n tresult = tnear;\n return Point3.addition(eye, direction.scaled(tresult));\n } else {\n if (tfar < 1.0e+20f) {\n // inside, hitting back face\n norm = _planes[back]._normal;\n tresult = tfar;\n return Point3.addition(eye, direction.scaled(tresult));\n } else {\n // inside, but back face beyond tmax//\n return null;\n }\n }\n }", "public void computeTextureUVCoordinates()\n\t{\n\t\tthis.faceTextureUCoordinates = new float[faceCount][];\n\t\tthis.faceTextureVCoordinates = new float[faceCount][];\n\n\t\tfor (int i = 0; i < faceCount; i++)\n\t\t{\n\t\t\tint textureCoordinate;\n\t\t\tif (textureCoordinates == null)\n\t\t\t{\n\t\t\t\ttextureCoordinate = -1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ttextureCoordinate = textureCoordinates[i];\n\t\t\t}\n\n\t\t\tint textureIdx;\n\t\t\tif (faceTextures == null)\n\t\t\t{\n\t\t\t\ttextureIdx = -1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ttextureIdx = faceTextures[i] & 0xFFFF;\n\t\t\t}\n\n\t\t\tif (textureIdx != -1)\n\t\t\t{\n\t\t\t\tfloat[] u = new float[3];\n\t\t\t\tfloat[] v = new float[3];\n\n\t\t\t\tif (textureCoordinate == -1)\n\t\t\t\t{\n\t\t\t\t\tu[0] = 0.0F;\n\t\t\t\t\tv[0] = 1.0F;\n\n\t\t\t\t\tu[1] = 1.0F;\n\t\t\t\t\tv[1] = 1.0F;\n\n\t\t\t\t\tu[2] = 0.0F;\n\t\t\t\t\tv[2] = 0.0F;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\ttextureCoordinate &= 0xFF;\n\n\t\t\t\t\tbyte textureRenderType = 0;\n\t\t\t\t\tif (textureRenderTypes != null)\n\t\t\t\t\t{\n\t\t\t\t\t\ttextureRenderType = textureRenderTypes[textureCoordinate];\n\t\t\t\t\t}\n\n\t\t\t\t\tif (textureRenderType == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tint faceVertexIdx1 = faceVertexIndices1[i];\n\t\t\t\t\t\tint faceVertexIdx2 = faceVertexIndices2[i];\n\t\t\t\t\t\tint faceVertexIdx3 = faceVertexIndices3[i];\n\n\t\t\t\t\t\tshort triangleVertexIdx1 = textureTriangleVertexIndices1[textureCoordinate];\n\t\t\t\t\t\tshort triangleVertexIdx2 = textureTriangleVertexIndices2[textureCoordinate];\n\t\t\t\t\t\tshort triangleVertexIdx3 = textureTriangleVertexIndices3[textureCoordinate];\n\n\t\t\t\t\t\tfloat triangleX = (float) vertexPositionsX[triangleVertexIdx1];\n\t\t\t\t\t\tfloat triangleY = (float) vertexPositionsY[triangleVertexIdx1];\n\t\t\t\t\t\tfloat triangleZ = (float) vertexPositionsZ[triangleVertexIdx1];\n\n\t\t\t\t\t\tfloat f_882_ = (float) vertexPositionsX[triangleVertexIdx2] - triangleX;\n\t\t\t\t\t\tfloat f_883_ = (float) vertexPositionsY[triangleVertexIdx2] - triangleY;\n\t\t\t\t\t\tfloat f_884_ = (float) vertexPositionsZ[triangleVertexIdx2] - triangleZ;\n\t\t\t\t\t\tfloat f_885_ = (float) vertexPositionsX[triangleVertexIdx3] - triangleX;\n\t\t\t\t\t\tfloat f_886_ = (float) vertexPositionsY[triangleVertexIdx3] - triangleY;\n\t\t\t\t\t\tfloat f_887_ = (float) vertexPositionsZ[triangleVertexIdx3] - triangleZ;\n\t\t\t\t\t\tfloat f_888_ = (float) vertexPositionsX[faceVertexIdx1] - triangleX;\n\t\t\t\t\t\tfloat f_889_ = (float) vertexPositionsY[faceVertexIdx1] - triangleY;\n\t\t\t\t\t\tfloat f_890_ = (float) vertexPositionsZ[faceVertexIdx1] - triangleZ;\n\t\t\t\t\t\tfloat f_891_ = (float) vertexPositionsX[faceVertexIdx2] - triangleX;\n\t\t\t\t\t\tfloat f_892_ = (float) vertexPositionsY[faceVertexIdx2] - triangleY;\n\t\t\t\t\t\tfloat f_893_ = (float) vertexPositionsZ[faceVertexIdx2] - triangleZ;\n\t\t\t\t\t\tfloat f_894_ = (float) vertexPositionsX[faceVertexIdx3] - triangleX;\n\t\t\t\t\t\tfloat f_895_ = (float) vertexPositionsY[faceVertexIdx3] - triangleY;\n\t\t\t\t\t\tfloat f_896_ = (float) vertexPositionsZ[faceVertexIdx3] - triangleZ;\n\n\t\t\t\t\t\tfloat f_897_ = f_883_ * f_887_ - f_884_ * f_886_;\n\t\t\t\t\t\tfloat f_898_ = f_884_ * f_885_ - f_882_ * f_887_;\n\t\t\t\t\t\tfloat f_899_ = f_882_ * f_886_ - f_883_ * f_885_;\n\t\t\t\t\t\tfloat f_900_ = f_886_ * f_899_ - f_887_ * f_898_;\n\t\t\t\t\t\tfloat f_901_ = f_887_ * f_897_ - f_885_ * f_899_;\n\t\t\t\t\t\tfloat f_902_ = f_885_ * f_898_ - f_886_ * f_897_;\n\t\t\t\t\t\tfloat f_903_ = 1.0F / (f_900_ * f_882_ + f_901_ * f_883_ + f_902_ * f_884_);\n\n\t\t\t\t\t\tu[0] = (f_900_ * f_888_ + f_901_ * f_889_ + f_902_ * f_890_) * f_903_;\n\t\t\t\t\t\tu[1] = (f_900_ * f_891_ + f_901_ * f_892_ + f_902_ * f_893_) * f_903_;\n\t\t\t\t\t\tu[2] = (f_900_ * f_894_ + f_901_ * f_895_ + f_902_ * f_896_) * f_903_;\n\n\t\t\t\t\t\tf_900_ = f_883_ * f_899_ - f_884_ * f_898_;\n\t\t\t\t\t\tf_901_ = f_884_ * f_897_ - f_882_ * f_899_;\n\t\t\t\t\t\tf_902_ = f_882_ * f_898_ - f_883_ * f_897_;\n\t\t\t\t\t\tf_903_ = 1.0F / (f_900_ * f_885_ + f_901_ * f_886_ + f_902_ * f_887_);\n\n\t\t\t\t\t\tv[0] = (f_900_ * f_888_ + f_901_ * f_889_ + f_902_ * f_890_) * f_903_;\n\t\t\t\t\t\tv[1] = (f_900_ * f_891_ + f_901_ * f_892_ + f_902_ * f_893_) * f_903_;\n\t\t\t\t\t\tv[2] = (f_900_ * f_894_ + f_901_ * f_895_ + f_902_ * f_896_) * f_903_;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.faceTextureUCoordinates[i] = u;\n\t\t\t\tthis.faceTextureVCoordinates[i] = v;\n\t\t\t}\n\t\t}\n\t}", "private static int[] intersection(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4){\n\n\t\tdouble b1 = (y2 - y1)/(x2 - x1);\n\t\tdouble a1 = y1 - (b1*x1);\n\t\tdouble b2 = (y4 - y3)/(x4 - x3);\n\t\tdouble a2 = y3 - (b2*x3);\n\t\tif(x2-x1 == 0) //vertical\n\t\t\treturn new int[]{(int)x1,(int)(a2+(b2*x1))};\n\t\tif(x3-x4 == 0) //vertical\n\t\t\treturn new int[]{(int)x3,(int)(a1+(b1*x3))};\n\t/*\tif(Math.abs(b1-b2) < 0.001)\n\t\t\treturn null;\n\t\tdouble intX = -(a1-a2)/(b1-b2);\n\t\tdouble intY = a1+(b1*intX);*/\n\t\tdouble d = ((y4-y3)*(x2-x1) - (x4-x3)*(y2-y1));\n\t\tif(d == 0)\n\t\t\treturn null; //parallel roads\n\t\tdouble a = ((x4-x3)*(y1-y3) - (y4-y3)*(x1-x3))*1.0/d;\n\t\tint intX = (int)x1+(int)(a*(x2-x1));\n\t\tint intY = (int)y1+(int)(a*(y2-y1));\n\t\treturn new int[]{(int)intX,(int)intY};\n\t}", "public double findRayIntersection(Vec3 origin, Vec3 direction, Vec3 normal)\n {\n double scale = width/obj.getScale();\n double ox = origin.x*scale+0.5*width;\n double oy = origin.y*scale+0.5*width;\n double oz = origin.z*scale+0.5*width;\n double dx = direction.x;\n double dy = direction.y;\n double dz = direction.z;\n\n // Find the intersection of the ray with the bounding box.\n\n double mint = -Double.MAX_VALUE;\n double maxt = Double.MAX_VALUE;\n if (dx == 0.0)\n {\n if (ox < minx || ox > maxx)\n return 0.0;\n }\n else\n {\n double t1 = (minx-ox)/dx;\n double t2 = (maxx-ox)/dx;\n if (t1 < t2)\n {\n if (t1 > mint)\n mint = t1;\n if (t2 < maxt)\n maxt = t2;\n }\n else\n {\n if (t2 > mint)\n mint = t2;\n if (t1 < maxt)\n maxt = t1;\n }\n if (mint > maxt || maxt < 0.0)\n return 0.0;\n }\n if (dy == 0.0)\n {\n if (oy < miny || oy > maxy)\n return 0.0;\n }\n else\n {\n double t1 = (miny-oy)/dy;\n double t2 = (maxy-oy)/dy;\n if (t1 < t2)\n {\n if (t1 > mint)\n mint = t1;\n if (t2 < maxt)\n maxt = t2;\n }\n else\n {\n if (t2 > mint)\n mint = t2;\n if (t1 < maxt)\n maxt = t1;\n }\n if (mint > maxt || maxt < 0.0)\n return 0.0;\n }\n if (dz == 0.0)\n {\n if (oz < minz || oz > maxz)\n return 0.0;\n }\n else\n {\n double t1 = (minz-oz)/dz;\n double t2 = (maxz-oz)/dz;\n if (t1 < t2)\n {\n if (t1 > mint)\n mint = t1;\n if (t2 < maxt)\n maxt = t2;\n }\n else\n {\n if (t2 > mint)\n mint = t2;\n if (t1 < maxt)\n maxt = t1;\n }\n if (mint > maxt || maxt < 0.0)\n return 0.0;\n }\n if (mint < 0.0)\n mint = 0.0;\n\n // Find the first voxel and initialize variables.\n\n double xpos = ox+mint*dx;\n double ypos = oy+mint*dy;\n double zpos = oz+mint*dz;\n int x = Math.max(Math.min((int) xpos, maxx), minx);\n int y = Math.max(Math.min((int) ypos, maxy), miny);\n int z = Math.max(Math.min((int) zpos, maxz), minz);\n int stepx, stepy, stepz;\n int finalx, finaly, finalz;\n double tdeltax, tdeltay, tdeltaz;\n double tmaxx, tmaxy, tmaxz;\n if (dx < 0.0)\n {\n stepx = -1;\n finalx = minx-1;\n tdeltax = -1.0/dx;\n tmaxx = (x-ox)/dx;\n }\n else if (dx > 0.0)\n {\n stepx = 1;\n finalx = maxx+1;\n tdeltax = 1.0/dx;\n tmaxx = (x+1-ox)/dx;\n }\n else\n {\n stepx = 0;\n finalx = 0;\n tdeltax = 0.0;\n tmaxx = Double.MAX_VALUE;\n }\n if (dy < 0.0)\n {\n stepy = -1;\n finaly = miny-1;\n tdeltay = -1.0/dy;\n tmaxy = (y-oy)/dy;\n }\n else if (dy > 0.0)\n {\n stepy = 1;\n finaly = maxy+1;\n tdeltay = 1.0/dy;\n tmaxy = (y+1-oy)/dy;\n }\n else\n {\n stepy = 0;\n finaly = 0;\n tdeltay = 0.0;\n tmaxy = Double.MAX_VALUE;\n }\n if (dz < 0.0)\n {\n stepz = -1;\n finalz = minz-1;\n tdeltaz = -1.0/dz;\n tmaxz = (z-oz)/dz;\n }\n else if (dz > 0.0)\n {\n stepz = 1;\n finalz = maxz+1;\n tdeltaz = 1.0/dz;\n tmaxz = (z+1-oz)/dz;\n }\n else\n {\n stepz = 0;\n finalz = 0;\n tdeltaz = 0.0;\n tmaxz = Double.MAX_VALUE;\n }\n\n // Step through the voxels, looking for intersections.\n\n VoxelOctree voxels = obj.getVoxels();\n byte values[] = new byte[8];\n while (true)\n {\n int index = x*width*width+y*width+z;\n if ((flags[index/32]&(1<<(index%32))) != 0)\n {\n // There is a piece of the surface in this voxel, so see if the ray intersects it.\n // First find the values of t at which the ray enters and exits it.\n \n double tenter = -Double.MAX_VALUE;\n double texit = Double.MAX_VALUE;\n if (dx != 0.0)\n {\n double t1 = (x-ox)/dx;\n double t2 = (x+1-ox)/dx;\n if (t1 < t2)\n {\n if (t1 > tenter)\n tenter = t1;\n if (t2 < texit)\n texit = t2;\n }\n else\n {\n if (t2 > tenter)\n tenter = t2;\n if (t1 < texit)\n texit = t1;\n }\n }\n if (dy != 0.0)\n {\n double t1 = (y-oy)/dy;\n double t2 = (y+1-oy)/dy;\n if (t1 < t2)\n {\n if (t1 > tenter)\n tenter = t1;\n if (t2 < texit)\n texit = t2;\n }\n else\n {\n if (t2 > tenter)\n tenter = t2;\n if (t1 < texit)\n texit = t1;\n }\n }\n if (dz != 0.0)\n {\n double t1 = (z-oz)/dz;\n double t2 = (z+1-oz)/dz;\n if (t1 < t2)\n {\n if (t1 > tenter)\n tenter = t1;\n if (t2 < texit)\n texit = t2;\n }\n else\n {\n if (t2 > tenter)\n tenter = t2;\n if (t1 < texit)\n texit = t1;\n }\n }\n if (tenter < 0.0)\n continue; // Ignore intersections in the voxel containing the origin.\n\n // Look up the values at the eight corners of the voxel.\n\n values[0] = voxels.getValue(x, y, z);\n values[1] = voxels.getValue(x, y, z+1);\n values[2] = voxels.getValue(x, y+1, z);\n values[3] = voxels.getValue(x, y+1, z+1);\n values[4] = voxels.getValue(x+1, y, z);\n values[5] = voxels.getValue(x+1, y, z+1);\n values[6] = voxels.getValue(x+1, y+1, z);\n values[7] = voxels.getValue(x+1, y+1, z+1);\n\n // Find the positions within the voxel where the ray enters and exits.\n\n double xenter = ox+dx*tenter-x;\n double yenter = oy+dy*tenter-y;\n double zenter = oz+dz*tenter-z;\n double xexit = ox+dx*texit-x;\n double yexit = oy+dy*texit-y;\n double zexit = oz+dz*texit-z;\n\n // Interpolate the find the values at those points.\n\n double enterValue = values[0]*(1.0-xenter)*(1.0-yenter)*(1.0-zenter)\n +values[1]*(1.0-xenter)*(1.0-yenter)*zenter\n +values[2]*(1.0-xenter)*yenter*(1.0-zenter)\n +values[3]*(1.0-xenter)*yenter*zenter\n +values[4]*xenter*(1.0-yenter)*(1.0-zenter)\n +values[5]*xenter*(1.0-yenter)*zenter\n +values[6]*xenter*yenter*(1.0-zenter)\n +values[7]*xenter*yenter*zenter;\n double exitValue = values[0]*(1.0-xexit)*(1.0-yexit)*(1.0-zexit)\n +values[1]*(1.0-xexit)*(1.0-yexit)*zexit\n +values[2]*(1.0-xexit)*yexit*(1.0-zexit)\n +values[3]*(1.0-xexit)*yexit*zexit\n +values[4]*xexit*(1.0-yexit)*(1.0-zexit)\n +values[5]*xexit*(1.0-yexit)*zexit\n +values[6]*xexit*yexit*(1.0-zexit)\n +values[7]*xexit*yexit*zexit;\n if ((enterValue > 0 && exitValue <= 0) || (enterValue <= 0 && exitValue > 0))\n {\n // Find the intersection point.\n\n double weight1 = Math.abs(exitValue);\n double weight2 = Math.abs(enterValue);\n double d = 1.0/(weight1+weight2);\n weight1 *= d;\n weight2 *= d;\n double tintersect = (tenter*weight1 + texit*weight2)/scale;\n if (normal != null)\n {\n normal.set(values[0]+values[1]+values[2]+values[3]-values[4]-values[5]-values[6]-values[7],\n values[0]+values[1]-values[2]-values[3]+values[4]+values[5]-values[6]-values[7],\n values[0]-values[1]+values[2]-values[3]+values[4]-values[5]+values[6]-values[7]);\n normal.normalize();\n }\n return tintersect;\n }\n }\n\n // Advance to the next voxel.\n\n if (tmaxx < tmaxy)\n {\n if (tmaxx < tmaxz)\n {\n x += stepx;\n if (x == finalx)\n return 0.0;\n tmaxx += tdeltax;\n }\n else\n {\n z += stepz;\n if (z == finalz)\n return 0.0;\n tmaxz += tdeltaz;\n }\n }\n else\n {\n if (tmaxy < tmaxz)\n {\n y += stepy;\n if (y == finaly)\n return 0.0;\n tmaxy += tdeltay;\n }\n else\n {\n z += stepz;\n if (z == finalz)\n return 0.0;\n tmaxz += tdeltaz;\n }\n }\n }\n }", "public Intersection getIntersection() {\r\n\t\tif (intersection == null)\r\n\t\t\tcomputeIntersectionPoint();\r\n\t\treturn intersection;\r\n\t}", "public float[] getHitNormal();", "public E3DVector2F getTextureCoordC(){\r\n return vertices[2].getTextureCoord();\r\n }", "public Vector3d getModelIntersection(Vector2i screenLoc)\n {\n ScreenPosition ul = getViewOffset();\n int viewportHeight = getViewportHeight();\n int correctedX = (int)(screenLoc.getX() - ul.getX());\n int correctedY = (int)(viewportHeight - screenLoc.getY() - ul.getY());\n Vector2i correctedScreenLoc = new Vector2i(correctedX, correctedY);\n return windowToModelCoords(correctedScreenLoc);\n }", "@Override\n\tpublic void intersect(Ray ray, IntersectResult result) {\n\t\t\t\tdouble tmin,tmax;\n\t\t\t\tdouble xmin, xmax, ymin, ymax, zmin, zmax;\n\t\t\t\t//find which face to cross\n\n\t\t\t\tif(ray.viewDirection.x>0){\n\t\t\t\t\txmin=(min.x-ray.eyePoint.x)/ray.viewDirection.x;\n\t\t\t\t\txmax=(max.x-ray.eyePoint.x)/ray.viewDirection.x;\n\t\t\t\t}else{\n\t\t\t\t\txmin=(max.x-ray.eyePoint.x)/ray.viewDirection.x;\n\t\t\t\t\txmax=(min.x-ray.eyePoint.x)/ray.viewDirection.x;\n\t\t\t\t}\n\t\t\t\tif(ray.viewDirection.y>0){\n\t\t\t\t\tymin=(min.y-ray.eyePoint.y)/ray.viewDirection.y;\n\t\t\t\t\tymax=(max.y-ray.eyePoint.y)/ray.viewDirection.y;\n\t\t\t\t}else{\n\t\t\t\t\tymin=(max.y-ray.eyePoint.y)/ray.viewDirection.y;\n\t\t\t\t\tymax=(min.y-ray.eyePoint.y)/ray.viewDirection.y;\n\t\t\t\t}\n\t\t\t\tif(ray.viewDirection.z>0){\n\t\t\t\t\tzmin=(min.z-ray.eyePoint.z)/ray.viewDirection.z;\n\t\t\t\t\tzmax=(max.z-ray.eyePoint.z)/ray.viewDirection.z;\n\t\t\t\t}else{\n\t\t\t\t\tzmin=(max.z-ray.eyePoint.z)/ray.viewDirection.z;\n\t\t\t\t\tzmax=(min.z-ray.eyePoint.z)/ray.viewDirection.z;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\ttmin=Double.max(xmin, ymin);\n\t\t\t\ttmin=Double.max(tmin, zmin);\n\t\t\t\ttmax=Double.min(xmax, ymax);\n\t\t\t\ttmax=Double.min(tmax, zmax);\n\t\t\t\t\n\t\t\t\t \n\t\t\t\tif(tmin<tmax && tmin>0){\n\t\t\t\t\t\n\t\t\t\t\tresult.material=material;\n\t\t\t\t\tresult.t=tmin;\n\t\t\t\t\tPoint3d p=new Point3d(ray.viewDirection);\n\t\t\t\t\tp.scale(tmin);\n\t\t\t\t\tp.add(ray.eyePoint);\n\t\t\t\t\tresult.p=p;\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tfinal double epsilon=1e-9;\n\t\t\t\t\t// find face and set the normal\n\t\t\t\t\tif(Math.abs(p.x-min.x)<epsilon){\n\t\t\t\t\t\tresult.n=new Vector3d(-1,0,0);\n\t\t\t\t\t}else if(Math.abs(p.x-max.x)<epsilon){\n\t\t\t\t\t\tresult.n=new Vector3d(1,0,0);\n\t\t\t\t\t}else if(Math.abs(p.y-min.y)<epsilon){\n\t\t\t\t\t\tresult.n=new Vector3d(0,-1,0);\n\t\t\t\t\t}else if(Math.abs(p.y-max.y)<epsilon){\n\t\t\t\t\t\tresult.n=new Vector3d(0,1,0);\n\t\t\t\t\t}else if(Math.abs(p.z-min.z)<epsilon){\n\t\t\t\t\t\tresult.n=new Vector3d(0,0,-1);\n\t\t\t\t\t}else if(Math.abs(p.z-max.z)<epsilon){\n\t\t\t\t\t\tresult.n=new Vector3d(0,0,1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t}", "public E3DVector2F getTextureCoordA(){\r\n return vertices[0].getTextureCoord();\r\n }", "public float[] getHitTexCoord();", "public Intersection[] intersectWith(Point3d S, Ray3d c) {\n Intersection[] result = null;\n\n double A = c.getX() * c.getX() + c.getY() * c.getY() + c.getZ() * c.getZ();\n\n double bx = (this.x - S.getX()); //Account for the Sphere's position\n double by = (this.y - S.getY());\n double bz = (this.z - S.getZ());\n\n double B = -(c.getX() * bx + c.getY() * by + c.getZ() * bz);\n\n double r = this.radius * this.radius;\n\n double C = bx * bx + by * by + bz * bz - r;\n\n double D = (B * B - A * C);\n if (D < 0) //no intersection\n {\n return null;\n }\n\n if (D == 0) //'graze' the sphere\n {\n result = new Intersection[1];\n Point3d P = S.plus(c.times(-B / A));\n result[0] = new Intersection(-B / A, this, true, 0, P, new Ray3d(P));\n /****/return null;\n }\n\n result = new Intersection[2];\n int hit = 0;\n\n double t1 = (-B - Math.sqrt(D)) / A;\n if (t1 > 0.00001) //The first hit\n {\n Point3d P = S.plus(c.times(t1));\n Ray3d N = P.minus(new Point3d(this.x, this.y, this.z));\n result[0] = new Intersection(t1, this, true, 0, P, N);\n hit++;\n }\n\n double t2 = (-B / A) + Math.sqrt(D) / A;\n if (t2 > 0.00000001) {\n Point3d P = S.plus(c.times(t2));\n Ray3d N = P.minus(new Point3d(this.x, this.y, this.z));\n result[hit] = new Intersection(t2, this, false, 0, P, N.reverse());\n }\n\n return result;\n }", "@Override\n public void intersect( Ray ray, IntersectResult result ) {\n \t\tVector3d e = new Vector3d(ray.eyePoint);\n \t\te.sub(this.center);\n \t\tdouble a = ray.viewDirection.dot(ray.viewDirection);\n \t\tdouble b = 2 * ray.viewDirection.dot(e);\n \t\tdouble c = e.dot(e) - this.radius * this.radius;\n \t\tdouble discriminant = b*b - 4*a*c;\n \t\t\n \t\tif (discriminant == 0.0) {\n \t\t\t\n \t\t\tdouble t_pos = -0.5 * b / a;\n \t\t\t// scale ray viewDirection to be t_pos length\n\t\t\t// point of intersection is at ray.eyePoint + scaled viewDirection vector\n\t\t\tPoint3d point_of_intersection = new Point3d(ray.viewDirection);\n\t\t\tpoint_of_intersection.scale(t_pos);\n\t\t\tpoint_of_intersection.add(ray.eyePoint);\n\t\t\t\n\t\t\t// normal is point_of_intersection - sphere.center\n\t\t\tVector3d normal = new Vector3d();\n\t\t\tnormal.add(point_of_intersection);\n\t\t\tnormal.sub(this.center);\n\t\t\tnormal.normalize();\n\t\t\t\n\t\t\tresult.p.set(point_of_intersection);\n\t\t\tresult.material = this.material;\n\t\t\tresult.t = t_pos;\n\t\t\tresult.n.set(normal);\n \t\t\t\n \t\t}\n \t\telse if (discriminant > 0.0) {\n \t\t\t\n \t\t\t// solve quadratic formula\n \t\t\tdouble q = (b > 0) ? -0.5 * (b + Math.sqrt(discriminant)) : -0.5 * (b - Math.sqrt(discriminant));\n \t\t\tdouble t_pos = q / a;\n \t\t\tdouble t_neg = c / q;\n \t\t\t\n \t\t\tif (t_pos < t_neg) {\n \t\t\t\tdouble temp = t_pos;\n \t\t\t\tt_pos = t_neg;\n \t\t\t\tt_neg = temp;\n \t\t\t}\n \t\t\t\t\n \t\t\tif (t_neg > 0) {\n \t\t\t\t// scale ray viewDirection to be t_neg length\n \t\t\t\t// point of intersection is at ray.eyePoint + scaled viewDirection vector\n \t\t\tPoint3d point_of_intersection = new Point3d(ray.viewDirection);\n \t\t\tpoint_of_intersection.scale(t_neg);\n \t\t\tpoint_of_intersection.add(ray.eyePoint);\n \t\t\t\n \t\t\t// normal is point_of_intersection - sphere.center\n \t\t\tVector3d normal = new Vector3d();\n \t\t\tnormal.add(point_of_intersection);\n \t\t\tnormal.sub(this.center);\n \t\t\tnormal.normalize();\n \t\t\t\n \t\t\tresult.p.set(point_of_intersection);\n \t\t\tresult.material = this.material;\n \t\t\tresult.t = t_neg;\n \t\t\tresult.n.set(normal);\n \t\t\t}\n\t\n \t\t}\n \t\t\n \t\t\n \t\t\n \t\t\n \t\t\n\n }", "public boolean\n doIntersection(Ray inOutRay) {\n double t, min_t = Double.MAX_VALUE;\n double x2 = size.x/2; // OJO: Esto deberia venir precalculado\n double y2 = size.y/2; // OJO: Esto deberia venir precalculado\n double z2 = size.z/2; // OJO: Esto deberia venir precalculado\n Vector3D p = new Vector3D();\n GeometryIntersectionInformation info = \n new GeometryIntersectionInformation();\n\n inOutRay.direction.normalize();\n\n // (1) Plano superior: Z = size.z/2\n if ( Math.abs(inOutRay.direction.z) > VSDK.EPSILON ) {\n // El rayo no es paralelo al plano Z=size.z/2\n t = (z2-inOutRay.origin.z)/inOutRay.direction.z;\n if ( t > -VSDK.EPSILON ) {\n p = inOutRay.origin.add(inOutRay.direction.multiply(t));\n if ( p.x >= -x2 && p.x <= x2 && \n p.y >= -y2 && p.y <= y2 ) {\n info.p = new Vector3D(p);\n min_t = t;\n lastPlane = 1;\n }\n }\n }\n\n // (2) Plano inferior: Z = -size.z/2\n if ( Math.abs(inOutRay.direction.z) > VSDK.EPSILON ) {\n // El rayo no es paralelo al plano Z=-size.z/2\n t = (-z2-inOutRay.origin.z)/inOutRay.direction.z;\n if ( t > -VSDK.EPSILON && t < min_t ) {\n p = inOutRay.origin.add(inOutRay.direction.multiply(t));\n if ( p.x >= -x2 && p.x <= x2 && \n p.y >= -y2 && p.y <= y2 ) {\n info.p = p;\n min_t = t;\n lastPlane = 2;\n }\n }\n }\n\n // (3) Plano frontal: Y = size.y/2\n if ( Math.abs(inOutRay.direction.y) > VSDK.EPSILON ) {\n // El rayo no es paralelo al plano Y=size.y/2\n t = (y2-inOutRay.origin.y)/inOutRay.direction.y;\n if ( t > -VSDK.EPSILON && t < min_t ) {\n p = inOutRay.origin.add(inOutRay.direction.multiply(t));\n if ( p.x >= -x2 && p.x <= x2 && \n p.z >= -z2 && p.z <= z2 ) {\n info.p = p;\n min_t = t;\n lastPlane = 3;\n }\n }\n }\n\n // (4) Plano posterior: Y = -size.y/2\n if ( Math.abs(inOutRay.direction.y) > VSDK.EPSILON ) {\n // El rayo no es paralelo al plano Y=-size.y/2\n t = (-y2-inOutRay.origin.y)/inOutRay.direction.y;\n if ( t > -VSDK.EPSILON && t < min_t ) {\n p = inOutRay.origin.add(inOutRay.direction.multiply(t));\n if ( p.x >= -x2 && p.x <= x2 && \n p.z >= -z2 && p.z <= z2 ) {\n info.p = p;\n min_t = t;\n lastPlane = 4;\n }\n }\n }\n\n // (5) Plano X = size.x/2\n if ( Math.abs(inOutRay.direction.x) > VSDK.EPSILON ) {\n // El rayo no es paralelo al plano X=size.x/2\n t = (x2-inOutRay.origin.x)/inOutRay.direction.x;\n if ( t > -VSDK.EPSILON && t < min_t ) {\n p = inOutRay.origin.add(inOutRay.direction.multiply(t));\n if ( p.y >= -y2 && p.y <= y2 && \n p.z >= -z2 && p.z <= z2 ) {\n info.p = p;\n min_t = t;\n lastPlane = 5;\n }\n }\n }\n\n // (6) Plano X = -size.x/2\n if ( Math.abs(inOutRay.direction.x) > VSDK.EPSILON ) {\n // El rayo no es paralelo al plano X=-size.x/2\n t = (-x2-inOutRay.origin.x)/inOutRay.direction.x;\n if ( t > -VSDK.EPSILON && t < min_t ) {\n p = inOutRay.origin.add(inOutRay.direction.multiply(t));\n if ( p.y >= -y2 && p.y <= y2 && \n p.z >= -z2 && p.z <= z2 ) {\n info.p = p;\n min_t = t;\n lastPlane = 6;\n }\n }\n }\n\n if ( min_t < Double.MAX_VALUE ) {\n inOutRay.t = min_t;\n lastInfo.clone(info);\n return true;\n }\n return false;\n }", "public static float[] createQuadTextureCoords() {\n float[] tex = new float[]{0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f};\n return tex;\n }", "default List<Point3D> findIntersections(Ray ray) {\n\tList<GeoPoint> geoList = findGeoIntersections(ray);\n\treturn geoList == null ? null\n\t: geoList .stream()\n\t.map(gp -> gp.point)\n\t.collect(Collectors.toList());\n\t}", "public double intersect(Ray3D r) {\n\t\tdouble dn = (r.d).dot(n);\n\t\tif (dn==0.0) return Double.POSITIVE_INFINITY;\n\t\tdouble t = (p.subtract(r.p)).dot(n)/dn;\n\t\tif (t > 0) return t;\n\t\telse return Double.POSITIVE_INFINITY;\n\t}", "public abstract Vector3D getPointForSurfaceCoordinates(double u, double v);", "public SbVec4f\ngetObjectTextureCoords(final SoNode node)\n//\n////////////////////////////////////////////////////////////////////////\n{\n return multVecMatrix4(getImageToObject(node), imageTexCoords);\n}", "public float[] getHitPoint();", "public float[] getTextureCoords() {\r\n\t\treturn textureCoords;\r\n\t}", "private Map<Geometry, List<Point3D>> getSceneRayIntersections(Ray ray){\n //Map key - geometric\n //value - a list of cut points\n Map<Geometry, List<Point3D>> sceneRayIntersectPions = new HashMap<Geometry, List<Point3D>>();\n //Iterator we can go through all the geometric shapes\n Iterator<Geometry> geometries = _scene.getGeometriesIterator();\n //for each geometry finde intersection points\n while (geometries.hasNext()){\n Geometry geometry = geometries.next();\n List<Point3D> geometryIntersectionPoints = geometry.FindIntersections(ray);\n if(!geometryIntersectionPoints.isEmpty())\n //add geometryIntersectionPoints(list) to key geometry\n sceneRayIntersectPions.put(geometry, geometryIntersectionPoints);\n }\n return sceneRayIntersectPions;\n }", "@Test\n public void testGetIntersect() throws Exception {\n Vector farIntersect = sphere.getIntersect(new Vector(0,0,0),new Vector(0,-6,10));\n assertTrue(farIntersect.equals(new Vector(0,-6,10)));\n }", "PVector _getCenter() {\n PVector cen = new PVector(_hitboxCenter.x, _hitboxCenter.y);\n cen.rotate(_rotVector.heading() - _front);\n cen.x += _x;\n cen.y += _y;\n return cen;\n }", "public static boolean\nraysIntersectInPlane(Point2D tail0Pt, Point2D head0Pt, Point2D tail1Pt, Point2D head1Pt,\n\tPoint2D intersect, double[] uArray)\n{\n\tdouble tmp = ((head1Pt.getY() - tail1Pt.getY())*(head0Pt.getX() - tail0Pt.getX()) - (head1Pt.getX() - tail1Pt.getX())*(head0Pt.getY() - tail0Pt.getY()));\n\tif(tmp == 0.0)\n\t\treturn(false);\n\tdouble tmpv = ((tail1Pt.getX() - tail0Pt.getX())*(head0Pt.getY() - tail0Pt.getY()) - (tail1Pt.getY() - tail0Pt.getY())*(head0Pt.getX() - tail0Pt.getX())) / tmp;\n\ttmp = (head0Pt.getX() - tail0Pt.getX())*(head1Pt.getY() - tail1Pt.getY()) - (head1Pt.getX() - tail1Pt.getX())*(head0Pt.getY() - tail0Pt.getY());\n\tif(tmp == 0.0)\n\t\treturn(false);\n\tdouble tmpu = ((tail1Pt.getX() - tail0Pt.getX())*(head1Pt.getY() - tail1Pt.getY()) + (head1Pt.getX() - tail1Pt.getX())*(tail0Pt.getY() - tail1Pt.getY()))/tmp;\n\n\tintersect.setLocation(\n\t\ttail1Pt.getX() + tmpv*(head1Pt.getX() - tail1Pt.getX()),\n\t\ttail1Pt.getY() + tmpv*(head1Pt.getY() - tail1Pt.getY()));\n\n\t// intersect[ZCoor] = tail1Pt[ZCoor] + tmpv*(head1Pt[ZCoor] - tail1Pt[ZCoor]);\n\n\tuArray[0] = tmpu; // u of first ray\n\tuArray[1] = tmpv; // u of second ray\n\n\treturn (true);\n}", "boolean intersects( Geometry gmo );", "@Override\n // public Map<Geometry, List<Point3D>> findIntersections(Ray myRay) {\n public List<Point3D> FindIntersections(Ray myRay) {\n\n List<Point3D> geometryListMap = new ArrayList<>();\n List<Point3D> listOfIntersections = new ArrayList<Point3D>();\n\n // the bottom base of the cylinder\n Plane plane1 = new Plane(orientation.getPOO(), orientation.getDirection());\n\n // the top base of the cylinder\n Plane plane2 = new Plane(top, orientation.getDirection());\n\n List<Point3D> temp1 = plane1.FindIntersections(myRay);\n\n List<Point3D> temp2 = plane2.FindIntersections(myRay);\n\n // removing all points that beyond the radius\n if (temp1 != null)\n for (Point3D p1 : temp1) {\n if (new Vector(Point3D.substract(orientation.getPOO(), p1)).length() <= _radius && p1 != null)\n listOfIntersections.add(p1);\n\n }\n\n if (temp2 != null)\n for (Point3D p2 : temp2) {\n if (new Vector(Point3D.substract(orientation.getPOO(), p2)).length() <= _radius && p2 != null)\n listOfIntersections.add(p2);\n\n }\n\n // using the infinity cylinder to find all the intersections in the body of the limited cylinder\n geometryListMap = super.FindIntersections(myRay);\n\n for (Point3D p : geometryListMap) {\n if (isOnCylinder(p))\n listOfIntersections.add(p);\n\n }\n if (listOfIntersections.isEmpty())\n return null;\n //geometryListMap.put(this, listOfIntersections);\n return geometryListMap;\n }", "private Point3d lp2xyz(double line, double pixel, MetadataDoris metadata, OrbitsDoris orbits) {\n \n int MAXITER = 10;\n final double CRITERPOS = Math.pow(10, -6);\n final double SOL = Constants.lightSpeed;\n final int refHeight = 0;\n \n final double ell_a = Constants.semiMajorAxis;\n final double ell_b = Constants.semiMinorAxis;\n \n Point3d satellitePosition;\n Point3d satelliteVelocity;\n Point3d ellipsoidPosition;\n \n // put stuff that makes sense here!\n double azTime = line2ta(line, metadata);\n double rgTime = pix2tr(pixel, metadata);\n \n satellitePosition = getSatelliteXYZ(azTime, orbits);\n satelliteVelocity = getSatelliteXYZDot(azTime, orbits);\n \n ellipsoidPosition = metadata.approxXYZCentreOriginal;\n \n // allocate matrices\n // DoubleMatrix ellipsoidPositionSolution = DoubleMatrix.zeros(3,1);\n DoubleMatrix equationSet = DoubleMatrix.zeros(3);\n DoubleMatrix partialsXYZ = DoubleMatrix.zeros(3, 3);\n \n for (int iter = 0; iter <= MAXITER; iter++) {\n // update equations and slove system\n double dsat_Px = ellipsoidPosition.x - satellitePosition.x; // vector of 'satellite to P on ellipsoid'\n double dsat_Py = ellipsoidPosition.y - satellitePosition.y; // vector of 'satellite to P on ellipsoid'\n double dsat_Pz = ellipsoidPosition.z - satellitePosition.z; // vector of 'satellite to P on ellipsoid'\n \n equationSet.put(0,\n -(satelliteVelocity.x * dsat_Px +\n satelliteVelocity.y * dsat_Py +\n satelliteVelocity.z * dsat_Pz));\n \n equationSet.put(1,\n -(dsat_Px * dsat_Px +\n dsat_Py * dsat_Py +\n dsat_Pz * dsat_Pz - Math.pow(SOL * rgTime, 2)));\n \n equationSet.put(2,\n -((ellipsoidPosition.x * ellipsoidPosition.x + ellipsoidPosition.y * ellipsoidPosition.y) / (Math.pow(ell_a + refHeight, 2)) +\n Math.pow(ellipsoidPosition.z / (ell_b + refHeight), 2) - 1.0));\n \n partialsXYZ.put(0, 0, satelliteVelocity.x);\n partialsXYZ.put(0, 1, satelliteVelocity.y);\n partialsXYZ.put(0, 2, satelliteVelocity.z);\n partialsXYZ.put(1, 0, 2 * dsat_Px);\n partialsXYZ.put(1, 1, 2 * dsat_Py);\n partialsXYZ.put(1, 2, 2 * dsat_Pz);\n partialsXYZ.put(2, 0, (2 * ellipsoidPosition.x) / (Math.pow(ell_a + refHeight, 2)));\n partialsXYZ.put(2, 1, (2 * ellipsoidPosition.y) / (Math.pow(ell_a + refHeight, 2)));\n partialsXYZ.put(2, 2, (2 * ellipsoidPosition.z) / (Math.pow(ell_a + refHeight, 2)));\n \n // solve system [NOTE!] orbit has to be normalized, otherwise close to singular\n DoubleMatrix ellipsoidPositionSolution = Solve.solve(partialsXYZ, equationSet);\n // DoubleMatrix ellipsoidPositionSolution = solve33(partialsXYZ, equationSet);\n \n // update solution\n ellipsoidPosition.x = ellipsoidPosition.x + ellipsoidPositionSolution.get(0);\n ellipsoidPosition.y = ellipsoidPosition.y + ellipsoidPositionSolution.get(1);\n ellipsoidPosition.z = ellipsoidPosition.z + ellipsoidPositionSolution.get(2);\n \n // check convergence\n if (Math.abs(ellipsoidPositionSolution.get(0)) < CRITERPOS &&\n Math.abs(ellipsoidPositionSolution.get(1)) < CRITERPOS &&\n Math.abs(ellipsoidPositionSolution.get(2)) < CRITERPOS) {\n // System.out.println(\"INFO: ellipsoidPosition (converged) = \" + ellipsoidPosition);\n break;\n } else if (iter >= MAXITER) {\n MAXITER = MAXITER + 1;\n System.out.println(\"WARNING: line, pix -> x,y,z: maximum iterations (\" + MAXITER + \") reached. \" + \"Criterium (m): \" + CRITERPOS +\n \"dx,dy,dz=\" + ellipsoidPositionSolution.get(0) + \", \" + ellipsoidPositionSolution.get(1) + \", \" + ellipsoidPositionSolution.get(2, 0));\n }\n }\n \n return ellipsoidPosition;\n }", "public List<Point3D> FindIntersections(Ray ray) throws Exception\n {\n List<Point3D> ListInter = new LinkedList<Point3D>();\n\n //find P0\n Point3D P0 = new Point3D(ray.getPOO());\n\n //find the triangle's Normal\n Vector N = this.getNormal(this.getP1());\n\n //find Plane\n Plane plane = new Plane(N, this.getP3());\n\n //if the intersection between the ray and plane\n List<Point3D> ListIntersectionPlane = plane.FindIntersections(ray);\n\n if(ListIntersectionPlane.isEmpty())\n return ListInter;\n\n Point3D intersectionPlane = ListIntersectionPlane.get(0);\n\n //defin Vector P_P0\n Vector P_P0 = new Vector(P0, intersectionPlane);\n\n //checking side 1-2\n Vector V1_1 = new Vector(P0, this._p1);\n Vector V2_1 = new Vector(P0, this._p2);\n Vector N1 = new Vector(V1_1.crossProduct(V2_1));\n N1.normalize();\n double S1 = -P_P0.dotProduct(N1);\n\n //checking side 2-3\n Vector V1_2 = new Vector(P0, this._p2);\n Vector V2_2 = new Vector(P0, this._p3);\n Vector N2 = new Vector(V1_2.crossProduct(V2_2));\n N2.normalize();\n double S2 = -P_P0.dotProduct(N2);\n\n //checking side 3-1\n Vector V1_3 = new Vector(P0, this._p3);\n Vector V2_3 = new Vector(P0, this._p1);\n Vector N3 = new Vector(V1_3.crossProduct(V2_3));\n N3.normalize();\n double S3 = -P_P0.dotProduct(N3);\n\n if (((S1 > 0) && (S2 > 0) && (S3 > 0)) || ((S1 < 0) && (S2 < 0) && (S3 < 0)))\n ListInter.add(intersectionPlane);\n return ListInter;\n\n }", "List<GeoPoint> findGeoIntersections(Ray ray);", "public double[] getWorldCoordinateWGS84(int screenX, int screenY);", "public E3DVector2F getTextureCoordB(){\r\n return vertices[1].getTextureCoord();\r\n }", "private Intersection[] getExtremIntersection(){\n if(!mapLoaded){\n return null;\n }\n Intersection northernmost = intersectionList.get(0);\n Intersection southernmost = intersectionList.get(0);\n Intersection easternmost = intersectionList.get(0);\n Intersection westernmost = intersectionList.get(0);\n\n for(int i=0 ; i<intersectionList.size() ; i++){\n Intersection testedIntersection = intersectionList.get(i);\n //north\n if(northernmost.getLatitude() < testedIntersection.getLatitude()) {\n northernmost = testedIntersection;\n }\n //south\n if(southernmost.getLatitude() > testedIntersection.getLatitude()) {\n southernmost = testedIntersection;\n }\n //east\n if(easternmost.getLongitude() < testedIntersection.getLongitude()) {\n easternmost = testedIntersection;\n }\n //west\n if(westernmost.getLongitude() > testedIntersection.getLongitude()) {\n westernmost = testedIntersection;\n }\n }\n Intersection[] extremum = {northernmost , southernmost , easternmost , westernmost};\n return extremum;\n }", "public Vector3d computePlaneIntersection(\r\n\t\tVector3d\t\tpPlaneNormal\r\n\t,\tdouble\t\t\tpPlaneDot\r\n\t,\tVector3d\t\tpResult\r\n\t,\tCSGTempVars\t\tpTempVars\r\n\t,\tCSGEnvironment\tpEnvironment\r\n\t) {\r\n\t\t//Ax + By + Cz + D = 0\r\n\t\t//x = x0 + t(x1 – x0)\r\n\t\t//y = y0 + t(y1 – y0)\r\n\t\t//z = z0 + t(z1 – z0)\r\n\t\t//(x1 - x0) = dx, (y1 - y0) = dy, (z1 - z0) = dz\r\n\t\t//t = -(A*x0 + B*y0 + C*z0 )/(A*dx + B*dy + C*dz)\r\n\t\t\r\n\t\tdouble tolerance = pEnvironment.mEpsilonNearZeroDbl; // TOL;\r\n\t\t\r\n\t\tdouble A = pPlaneNormal.x;\r\n\t\tdouble B = pPlaneNormal.y;\r\n\t\tdouble C = pPlaneNormal.z;\r\n\t\tdouble D = -pPlaneDot;\r\n\t\t\t\r\n\t\tdouble numerator = A*mOrigin.x + B*mOrigin.y + C*mOrigin.z + D;\r\n\t\tdouble denominator = A*mDirection.x + B*mDirection.y + C*mDirection.z;\r\n\t\t\t\t\r\n\t\tif ( Math.abs( denominator ) < tolerance ) {\r\n\t\t\t// Line is parallel to the plane\r\n\t\t\tif( Math.abs( numerator ) < tolerance ) {\r\n\t\t\t\t// Line contained within the plane\r\n\t\t\t\tif ( pResult == null ) {\r\n\t\t\t\t\treturn( mOrigin.clone() );\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn( pResult.set( mOrigin ) );\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\t// No intersection\r\n\t\t\t\treturn( null );\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t// Line intersects the plane\r\n\t\t\tdouble t = -numerator/denominator;\r\n\t\t\tpResult = mDirection.mult( t, pResult );\r\n\t\t\tpResult.addLocal( mOrigin );\r\n\t\t\t\r\n\t\t\tif ( pEnvironment.mRationalizeValues ) {\r\n\t\t\t\t// Confirm that the magnitudes of the resultant point are rational\r\n\t\t\t\tCSGEnvironment.rationalizeVector( pResult, pEnvironment.mEpsilonMagnitudeRange );\r\n\t\t\t}\r\n\t\t\treturn pResult;\r\n\t\t}\r\n\t}", "public org.landxml.schema.landXML11.IntersectionDocument.Intersection getIntersection()\r\n {\r\n synchronized (monitor())\r\n {\r\n check_orphaned();\r\n org.landxml.schema.landXML11.IntersectionDocument.Intersection target = null;\r\n target = (org.landxml.schema.landXML11.IntersectionDocument.Intersection)get_store().find_element_user(INTERSECTION$0, 0);\r\n if (target == null)\r\n {\r\n return null;\r\n }\r\n return target;\r\n }\r\n }", "@Override\n public RayHit rayIntersectObj(Ray3D ray) {\n // Next check if ray hits this quadric\n Point3D hitPoint = findHitPoint(ray);\n if (hitPoint == null || !isWithinBounds(hitPoint)) {\n return RayHit.NO_HIT;\n }\n double distance = hitPoint.subtract(ray.getPoint()).length();\n Point3D normal = findNormalAtPoint(hitPoint);\n return new RayHit(hitPoint, distance, normal, this, new TextureCoordinate(0, 0));\n }", "@gw.internal.gosu.parser.ExtendedProperty\n public java.lang.Boolean isIntersection();", "@Override\n public Intersection getIntersectionWest(){\n if(!mapLoaded){\n return null;\n }\n return extremIntersection[3];\n }", "public Object getPoint(EastNorth intersection) {\n\t\treturn null;\n\t}", "public E3DVector3F getPlaneIntersectionPoint(E3DVector3F startPos, E3DVector3F endPos)\r\n {\r\n double a, b;\r\n \r\n E3DVector3F normal = getNormal();\r\n E3DVector3F direction = endPos.subtract(startPos);\r\n\r\n a = -normal.dotProduct(startPos.subtract(vertices[0].getVertexPos()));\r\n b = normal.dotProduct(direction);\r\n\r\n double r = a / b;\r\n if (r < 0.0) // ray goes away from triangle\r\n return null;\r\n \r\n direction.scaleEqual(r);\r\n direction = startPos.add(direction);\r\n \r\n return direction;\r\n/* \r\n //old\r\n E3DVector3F normal = getNormal();\r\n \r\n E3DVector3F ray = endPos.subtract(startPos);\r\n \r\n double t = -(normal.dotProduct(startPos) -\r\n getPlaneEquationCoords().getD() +\r\n normal.dotProduct(ray));\r\n //NO\r\n ray.normaliseEqual(); //NO\r\n\r\n ray.scaleEqual(t);\r\n ray.addEqual(startPos); //should be marginally faster (one less new E3DVector3F)\r\n return ray; //startPos.add(ray); */\r\n }", "public void\n doExtraInformation(Ray inRay, double inT, \n GeometryIntersectionInformation outData) {\n outData.p = lastInfo.p;\n\n switch ( lastPlane ) {\n case 1:\n outData.n.x = 0;\n outData.n.y = 0;\n outData.n.z = 1;\n outData.u = outData.p.y / size.y - 0.5;\n outData.v = 1-(outData.p.x / size.x - 0.5);\n outData.t.x = 0;\n outData.t.y = 1;\n outData.t.z = 0;\n break;\n case 2:\n outData.n.x = 0;\n outData.n.y = 0;\n outData.n.z = -1;\n outData.u = outData.p.y / size.y - 0.5;\n outData.v = outData.p.x / size.x - 0.5;\n outData.t.x = 0;\n outData.t.y = 1;\n outData.t.z = 0;\n break;\n case 3:\n outData.n.x = 0;\n outData.n.z = 0;\n outData.n.y = 1;\n outData.u = 1-(outData.p.x / size.x - 0.5);\n outData.v = outData.p.z / size.z - 0.5;\n outData.t.x = -1;\n outData.t.y = 0;\n outData.t.z = 0;\n break;\n case 4:\n outData.n.x = 0;\n outData.n.z = 0;\n outData.n.y = -1;\n outData.u = outData.p.x / size.x - 0.5;\n outData.v = outData.p.z / size.z - 0.5;\n outData.t.x = 1;\n outData.t.y = 0;\n outData.t.z = 0;\n break;\n case 5:\n outData.n.x = 1;\n outData.n.y = 0;\n outData.n.z = 0;\n outData.u = outData.p.y / size.y - 0.5;\n outData.v = outData.p.z / size.z - 0.5;\n outData.t.x = 0;\n outData.t.y = 1;\n outData.t.z = 0;\n break;\n case 6:\n outData.n.x = -1;\n outData.n.y = 0;\n outData.n.z = 0;\n outData.u = 1-(outData.p.y / size.y - 0.5);\n outData.v = outData.p.z / size.z - 0.5;\n outData.t.x = 0;\n outData.t.y = -1;\n outData.t.z = 0;\n break;\n default:\n outData.u = 0;\n outData.v = 0;\n break;\n }\n }", "public Point3d sampleHemisphere();", "public Position3D getIntersect(Line3D other) {\r\n\t\tif (this.isParallel(other)) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\tdouble t = (this.d - this.norm.dot(other.getPos())) / this.norm.dot(other.getDir());\r\n\t\treturn other.getLinePoint(t);\r\n\t}", "public static void main(String[] args){\n Mesh3D box = Mesh3D.box(10, 20, 60);\n \n Line3D lineX = box.getLineX();\n Line3D lineY = box.getLineY();\n Line3D lineZ = box.getLineZ();\n lineX.show();\n lineY.show();\n lineZ.show();\n box.translateXYZ(100, 0.0, 0.0); \n box.show();\n Line3D line = new Line3D(); \n List<Point3D> intersects = new ArrayList<Point3D>();\n \n for(int p = 0; p < 100; p++){\n double r = 600;\n double theta = Math.toRadians(90.0);//Math.toRadians(Math.random()*180.0);\n double phi = Math.toRadians(Math.random()*360.0-180.0);\n line.set(0.0,0.0,0.0, \n Math.sin(theta)*Math.cos(phi)*r,\n Math.sin(theta)*Math.sin(phi)*r,\n Math.cos(theta)*r\n );\n intersects.clear();\n box.intersectionRay(line, intersects);\n System.out.println(\"theta/phi = \" + Math.toDegrees(theta) + \" \"\n + Math.toDegrees(phi) + \" intersects = \" + intersects.size());\n \n }\n }", "float[][] getCameraVectorsNormal(int resX, int resY){\n float vectors[][]=new float[resX*resY][3];//first vector index, second the components of the vector\n float[] vect2=rotateYVector(dir);\n vect2[1]=0;\n vect2=normalize(vect2);\n float[] vect3=normalize(vectorProduct(dir, vect2));//dir, vect2, vect3 base vectors\n float[] x={0,0,0};\n float[] y={0,0,0};\n float[] temp={0,0,0};\n for(int i=0;i<3;i++){\n x[i]=(vect2[i])/(resX/2);\n y[i]=(vect3[i])/(resY/2);\n temp[i]=vect2[i];\n }\n \n for(int j=0;j<resY;j++){\n for(int i=0;i<resX;i++){\n vectors[j*resX+i][0]=dir[0]+vect2[0]+vect3[0];\n vectors[j*resX+i][1]=dir[1]+vect2[1]+vect3[1];\n vectors[j*resX+i][2]=dir[2]+vect2[2]+vect3[2];\n vectors[j*resX+i]=normalize(vectors[j*resX+i]);\n vect2[0]-=x[0];\n vect2[1]-=x[1];\n vect2[2]-=x[2];\n if((vectorLength(vect2)>(-0.0001)&&vectorLength(vect2)<0.0001)&&(resX%2)==0){\n vect2[0]-=x[0];\n vect2[1]-=x[1];\n vect2[2]-=x[2];\n }\n }\n //printVector(temp);\n vect2[0]=temp[0];\n vect2[1]=temp[1];\n vect2[2]=temp[2];\n vect3[0]-=y[0];\n vect3[1]-=y[1];\n vect3[2]-=y[2];\n if((vectorLength(vect3)>(-0.0001)&&vectorLength(vect3)<0.0001)&&(resY%2)==0){\n vect3[0]-=y[0];\n vect3[1]-=y[1];\n vect3[2]-=y[2];\n }\n }\n \n return vectors;\n }", "protected abstract NativeSQLStatement createNativeIntersectionStatement(Geometry geom);", "public TextureCoord2D texFor (final Point3 point) {\n\n if (point == null)throw new IllegalArgumentException(\"The Point cannot be null!\");\n\n\n double teta = Math.acos(point.y);\n double phi = Math.atan2(point.x, point.z);\n\n return new TextureCoord2D(phi / (Math.PI*2), -teta/Math.PI);\n }", "IPoint intersect(Figures figures)\n { float epsilon=IPoint.epsilon;\n Vec3D e1 = figures.getP2().minus(figures.getP1());\n Vec3D e2 = figures.getP3().minus(figures.getP1());\n Vec3D p = dir.cross(e2);\n float a = e1.dot(p);\n if ((a>-epsilon) && (a<epsilon)) return new IPoint(null,null,-1);\n float f = 1/a;\n Vec3D s = start.minus(figures.getP1());\n float u = f*s.dot(p);\n if ((u<0.0) || (u>1.0)) return new IPoint(null,null,-1);\n Vec3D q = s.cross(e1);\n float v = f*dir.dot(q);\n if ((v<0.0) || (u+v>1.0)) return new IPoint(null,null,-1);\n float dist=f*e2.dot(q);\n if (dist<epsilon) return new IPoint(null,null,-1);\n Vec3D ip=figures.getP1().mult(1-u-v).add(figures.getP2().mult(u)).add(figures.getP3().mult(v));\n return new IPoint(figures,ip,dist);\n }", "public List<Vec3> getIntersectionPoints(Vec3 org, Vec3 ray)\n {\n Mat4 mInv = m.getInverseSimple();\n ray = mInv.multiply(ray.toDirection()).getXYZ();\n org = mInv.multiply(org.toPoint()).getXYZ();\n\n Vec3 mext = extents.getNegated();\n ArrayList<Vec3> ps = new ArrayList<Vec3>();\n for (int i = 0; i < 3; i++)\n {\n if (org.get(i) >= extents.get(i))\n {\n if (ray.get(i) >= 0)\n {\n return new ArrayList<Vec3>(); // ray points away from box\n }\n ps.addAll(lineIntersection(i, org, ray, extents));\n } else if (org.get(i) <= mext.get(i))\n {\n if (ray.get(i) <= 0)\n {\n return new ArrayList<Vec3>(); // ray points away from box\n }\n ps.addAll(lineIntersection(i, org, ray, mext));\n }\n }\n return ps;\n }", "public E3DVector2F getTextureCoordDetail0A(){\r\n return vertices[0].getTextureCoordDetail0();\r\n }", "@Override\r\n\tpublic List<GeoPoint> findIntersections(Ray ray) {\r\n\t\tList<GeoPoint> list = new ArrayList<GeoPoint>();\r\n\t\tVector rayDirection = ray.getDirection();\r\n\t\tPoint3D rayPoint = ray.getPOO();\r\n\r\n\t\t// case centerPoint same as the RayPoint\r\n\t\tif (centerPoint.equals(rayPoint)) {\r\n\t\t\tlist.add(new GeoPoint(this, rayPoint.addVector(rayDirection.scale(radius))));\r\n\t\t\treturn list;\r\n\t\t}\r\n\r\n\t\t// u = centerPoint - rayPoint\r\n\t\tVector u = centerPoint.subtract(rayPoint);\r\n\t\t// tm = u * rayDirection\r\n\t\tdouble tm = rayDirection.dotProduct(u);\r\n\t\t// distance = sqrt(|u|^2 - tm^2)\r\n\t\tdouble d = Math.sqrt(u.dotProduct(u) - tm * tm);\r\n\t\t// case the distance is bigger than radius no intersections\r\n\t\tif (d > radius)\r\n\t\t\treturn list;\r\n\r\n\t\t// th = sqrt(R^2 - d^2)\r\n\t\tdouble th = Math.sqrt(radius * radius - d * d);\r\n\r\n\t\tdouble t1 = tm - th;\r\n\t\tdouble t2 = tm + th;\r\n\r\n\t\tif (Util.isZero(t1) || Util.isZero(t2)) {\r\n\t\t\tlist.add(new GeoPoint(this, rayPoint));\r\n\t\t}\r\n\t\tif (Util.isZero(th)) {\r\n\t\t\tlist.add(new GeoPoint(this, rayPoint.addVector(rayDirection.scale(tm))));\r\n\t\t} else {\r\n\t\t\tif (t1 > 0 && !Util.isZero(t1))// one\r\n\t\t\t\tlist.add(new GeoPoint(this, rayPoint.addVector(rayDirection.scale(t1))));\r\n\t\t\tif (t2 > 0 && !Util.isZero(t2)) {// two\r\n\t\t\t\tlist.add(new GeoPoint(this, rayPoint.addVector(rayDirection.scale(t2))));\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn list;\r\n\r\n\t}", "public double[] getHitGeoCoord();", "public static boolean render(int coordX, int coordY, int coordZ, int texture, Texture[] textureMap) {\r\n GL11.glTranslatef(coordX, coordY, coordZ); // Absolute position in game\r\n// GL11.glRotatef(xrot, 1.0f, 0.0f, 0.0f); // Rotate On The X Axis\r\n// GL11.glRotatef(yrot, 0.0f, 1.0f, 0.0f); // Rotate On The Y Axis\r\n// GL11.glRotatef(zrot, 0.0f, 0.0f, 1.0f); // Rotate On The Z Axis\r\n GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureMap[texture].getTextureID()); // Select Our Texture\r\n GL11.glBegin(GL11.GL_QUADS);\r\n // Front Face\r\n GL11.glTexCoord2f(0.0f, 0.0f);\r\n GL11.glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 0.0f);\r\n GL11.glVertex3f(1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 1.0f);\r\n GL11.glVertex3f(1.0f, 1.0f, 1.0f); // Top Right Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 1.0f);\r\n GL11.glVertex3f(-1.0f, 1.0f, 1.0f); // Top Left Of The Texture and Quad\r\n // Back Face\r\n GL11.glTexCoord2f(1.0f, 0.0f);\r\n GL11.glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Right Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 1.0f);\r\n GL11.glVertex3f(-1.0f, 1.0f, -1.0f); // Top Right Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 1.0f);\r\n GL11.glVertex3f(1.0f, 1.0f, -1.0f); // Top Left Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 0.0f);\r\n GL11.glVertex3f(1.0f, -1.0f, -1.0f); // Bottom Left Of The Texture and Quad\r\n // Top Face\r\n GL11.glTexCoord2f(0.0f, 1.0f);\r\n GL11.glVertex3f(-1.0f, 1.0f, -1.0f); // Top Left Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 0.0f);\r\n GL11.glVertex3f(-1.0f, 1.0f, 1.0f); // Bottom Left Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 0.0f);\r\n GL11.glVertex3f(1.0f, 1.0f, 1.0f); // Bottom Right Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 1.0f);\r\n GL11.glVertex3f(1.0f, 1.0f, -1.0f); // Top Right Of The Texture and Quad\r\n // Bottom Face\r\n GL11.glTexCoord2f(1.0f, 1.0f);\r\n GL11.glVertex3f(-1.0f, -1.0f, -1.0f); // Top Right Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 1.0f);\r\n GL11.glVertex3f(1.0f, -1.0f, -1.0f); // Top Left Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 0.0f);\r\n GL11.glVertex3f(1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 0.0f);\r\n GL11.glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and Quad\r\n // Right face\r\n GL11.glTexCoord2f(1.0f, 0.0f);\r\n GL11.glVertex3f(1.0f, -1.0f, -1.0f); // Bottom Right Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 1.0f);\r\n GL11.glVertex3f(1.0f, 1.0f, -1.0f); // Top Right Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 1.0f);\r\n GL11.glVertex3f(1.0f, 1.0f, 1.0f); // Top Left Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 0.0f);\r\n GL11.glVertex3f(1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and Quad\r\n // Left Face\r\n GL11.glTexCoord2f(0.0f, 0.0f);\r\n GL11.glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Left Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 0.0f);\r\n GL11.glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 1.0f);\r\n GL11.glVertex3f(-1.0f, 1.0f, 1.0f); // Top Right Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 1.0f);\r\n GL11.glVertex3f(-1.0f, 1.0f, -1.0f); // Top Left Of The Texture and Quad\r\n GL11.glEnd();\r\n\r\n// xrot += 0.3f; // X Axis Rotation\r\n// yrot += 0.2f; // Y Axis Rotation\r\n// zrot += 0.4f; // Z Axis Rotation\r\n\r\n return true;\r\n }", "void vectorFromWorld(double px, double py, double pz, DVector3 result);", "public static boolean intersectLineTriangle(Vec3 p, Vec3 q, Vec3 a, Vec3 b, Vec3 c, Vec3 r) {\r\n\t // Bring points to their respective coordinate frame\r\n\t Vec3 pq = q.subtract( p);\r\n\t Vec3 pa =a.subtract(p);\r\n\t Vec3 pb = b.subtract(p);\r\n\t Vec3 pc = c.subtract(p);\r\n\t \r\n\t Vec3 m = pq.cross(pc);\r\n\t \r\n\t float u = pb.dot(m); \r\n\t float v = -pa.dot(m);\r\n\t \r\n\t if (Math.signum(u) != Math.signum(v)) {\r\n\t return false;\r\n\t }\r\n\t \r\n\t // scalar triple product\r\n\t float w = pq.dot( pb.cross(pa));\r\n\t \r\n\t if (Math.signum(u) != Math.signum(w)) {\r\n\t return false;\r\n\t }\r\n\t \r\n\t float denom = 1.0f / (u + v + w);\r\n\t \r\n\t // r = ((u * denom) * a) + ((v * denom) * b) + ((w * denom) * c);\r\n\t Vec3 compA = a.multiply(u * denom);\r\n\t Vec3 compB = b.multiply( v * denom);\r\n\t Vec3 compC = c.multiply( w * denom);\r\n\t \r\n\t // store result in Vector r\r\n\t r.x = compA.x + compB.x + compC.x;\r\n\t r.y = compA.y + compB.y + compC.y;\r\n\t r.z = compA.z + compB.z + compC.z;\r\n\t \r\n\t return true;\r\n\t}", "@Override\n public Intersection getIntersectionEast(){\n if(!mapLoaded){\n return null;\n }\n return extremIntersection[2];\n }", "public boolean intersect(IntersectionRecord outRecord, Ray rayIn) {\n\t// TODO: Process rayIn so that it is in the same coordinates as the object.\n // This should be a single line.\n\trayIn = untransformRay(rayIn);\n Ray ray = rayIn;\n\n // Rename the common vectors so I don't have to type so much\n Vector3 d = ray.direction;\n Point3 c = center;\n Point3 o = ray.origin;\n\n double tMin = ray.start, tMax = ray.end;\n // Compute some factors used in computation\n double qx = o.x - c.x;\n double qy = o.y - c.y;\n //double qz = o.z - c.z;\n double rr = radius * radius;\n\n double dd = d.x * d.x + d.y *d.y;\n double qd = d.x * qx + d.y * qy;\n double qq = qx * qx + qy * qy;\n\n double t = 0, td1=0, td2=0;\n double zMin = c.z - height/2;\n double zMax = c.z + height/2;\n\n // z-plane cap calculations\n if (d.z >= 0) {\n td1 = (zMin- o.z) / d.z;\n td2 = (zMax - o.z) / d.z;\n }\n else {\n td1 = (zMax - o.z) / d.z;\n td2 = (zMin - o.z) / d.z;\n }\n if (tMin > td2 || td1 > tMax)\n return false;\n if (td1 > tMin)\n tMin = td1;\n if (td2 < tMax)\n tMax = td2;\n\n // solving the quadratic equation for t at the pts of intersection\n // dd*t^2 + (2*qd)*t + (qq-r^2) = 0\n double discriminantsqr = (qd * qd - dd * (qq - rr));\n\n // If the discriminant is less than zero, there is no intersection\n if (discriminantsqr < 0) {\n return false;\n }\n\n // Otherwise check and make sure that the intersections occur on the ray (t\n // > 0) and return the closer one\n double discriminant = Math.sqrt(discriminantsqr);\n double t1 = (-qd - discriminant) / dd;\n double t2 = (-qd + discriminant) / dd;\n\n if (t1 > ray.start && t1 < ray.end) {\n t = t1;\n }\n else if (t2 > ray.start && t2 < ray.end) {\n t = t2;\n }\n\n Point3 thit1 = new Point3(0,0,0); \n ray.evaluate(thit1, tMin);\n Point3 thit2 = new Point3(0,0,0); \n ray.evaluate(thit2, tMax);\n\n double dx1 = thit1.x-c.x; \n double dy1 = thit1.y-c.y; \n double dx2 = thit2.x-c.x; \n double dy2 = thit2.y-c.y; \n\n if ((t < tMin || t > tMax) && dx1 * dx1 + dy1 * dy1 > rr && dx2 * dx2 + dy2 * dy2 > rr) {\n return false;\n }\n\n // There was an intersection, fill out the intersection record\n if (outRecord != null) {\n double tside =Math.min( td1, td2);\n\n if (t <tside) {\n outRecord.t = tside;\n ray.evaluate(outRecord.location, tside);\n outRecord.normal.set(0, 0, 1);\n }\n else {\n outRecord.t = t;\n ray.evaluate(outRecord.location, t);\n outRecord.normal.sub(new Point3(outRecord.location.x,outRecord.location.y,0), new Point3(c.x,c.y,0));\n }\n\n if (outRecord.normal.dot(ray.direction) > 0)\n outRecord.normal.scale(-1);\n\n outRecord.surface = this;\n // TODO: Transform the location and normal back into world coordinates.\n // Transform the location by tMat\n tMat.rightMultiply(outRecord.location);\n // Transform the normal by tMatTInv\n tMatTInv.rightMultiply(outRecord.normal);\n \n outRecord.normal.normalize();\n }\n\n return true;\n }", "public E3DVector2F getTextureCoordDetail0C(){\r\n return vertices[2].getTextureCoordDetail0();\r\n }", "public void invertNormals() {\n mCubeNormalData = new float[]\n {\n // Front face\n 0.0f, 0.0f, -1.0f,\n 0.0f, 0.0f, -1.0f,\n 0.0f, 0.0f, -1.0f,\n 0.0f, 0.0f, -1.0f,\n 0.0f, 0.0f, -1.0f,\n 0.0f, 0.0f, -1.0f,\n // Right face\n -1.0f, 0.0f, 0.0f,\n -1.0f, 0.0f, 0.0f,\n -1.0f, 0.0f, 0.0f,\n -1.0f, 0.0f, 0.0f,\n -1.0f, 0.0f, 0.0f,\n -1.0f, 0.0f, 0.0f,\n // Back face\n 0.0f, 0.0f, 1.0f,\n 0.0f, 0.0f, 1.0f,\n 0.0f, 0.0f, 1.0f,\n 0.0f, 0.0f, 1.0f,\n 0.0f, 0.0f, 1.0f,\n 0.0f, 0.0f, 1.0f,\n // Left face\n 1.0f, 0.0f, 0.0f,\n 1.0f, 0.0f, 0.0f,\n 1.0f, 0.0f, 0.0f,\n 1.0f, 0.0f, 0.0f,\n 1.0f, 0.0f, 0.0f,\n 1.0f, 0.0f, 0.0f,\n // Top face\n 0.0f, -1.0f, 0.0f,\n 0.0f, -1.0f, 0.0f,\n 0.0f, -1.0f, 0.0f,\n 0.0f, -1.0f, 0.0f,\n 0.0f, -1.0f, 0.0f,\n 0.0f, -1.0f, 0.0f,\n // Bottom face\n 0.0f, 1.0f, 0.0f,\n 0.0f, 1.0f, 0.0f,\n 0.0f, 1.0f, 0.0f,\n 0.0f, 1.0f, 0.0f,\n 0.0f, 1.0f, 0.0f,\n 0.0f, 1.0f, 0.0f\n };\n mCubeNormals.put(mCubeNormalData).position(0);\n\n }", "private float[] calculateMouseRay(int mouseX, int mouseY) {\n\t\tfloat[] normalizedDeviceCoords = getNormalizedDeviceCoords(mouseX, mouseY);\r\n\t\t\r\n\t\t//Creating a 4D vector out of the normalizedDeviceCoords, defining z as -1 (clipping Plane):\r\n\t\tfloat[] clipCoords = {normalizedDeviceCoords[0], normalizedDeviceCoords[1], -1f, 1f};\r\n\t\t\r\n\t\t//4D vector containing the inverted projection\r\n\t\tfloat[] eyeCoords = toEyeCoords(clipCoords);\r\n\t\t\r\n\t\t//3D vector containing the world coords of our mouse ray\r\n\t\tfloat[] worldCoords = toWorldCoords(eyeCoords);\r\n\t\t\r\n\t\treturn worldCoords;\r\n\t}", "public float getIntersection(Line2D.Float line) {\n // The intersection point I, of two vectors, A1->A2 and\n // B1->B2, is:\n // I = A1 + Ua * (A2 - A1)\n // I = B1 + Ub * (B2 - B1)\n //\n // Solving for Ua gives us the following formula.\n // Ua is returned.\n float denominator = (line.y2 - line.y1) * (x2 - x1) -\n (line.x2 - line.x1) * (y2 - y1);\n\n // check if the two lines are parallel\n if (denominator == 0) {\n return -1;\n }\n\n float numerator = (line.x2 - line.x1) * (y1 - line.y1) -\n (line.y2 - line.y1) * (x1 - line.x1);\n\n return numerator / denominator;\n }", "@Test\n void findIntersections() {\n Cuboid cuboid1 = new Cuboid(4,4,4);\n Ray ray1 = new Ray(new Point3D(-3,0,0), new Vector3D(1,0,0));\n ArrayList<GeoPoint> actual1 = cuboid1.findIntersections(ray1);\n ArrayList<GeoPoint> expected1 = new ArrayList<>();\n expected1.add(new GeoPoint(cuboid1, new Point3D(2,0,0)));\n expected1.add(new GeoPoint(cuboid1, new Point3D(-2,0,0)));\n\n assertTrue(Util.intersectionsEqual(expected1, actual1));\n\n //Aligned with Y axis but have different dimensions\n Cuboid cuboid2 = new Cuboid(2,4,3);\n Ray ray2 = new Ray(new Point3D(0,100,0), new Vector3D(0,-1,0));\n ArrayList<GeoPoint> actual2 = cuboid2.findIntersections(ray2);\n ArrayList<GeoPoint> expected2 = new ArrayList<>();\n expected2.add(new GeoPoint(cuboid1, new Point3D(0,2,0)));\n assertEquals(expected2.get(0).point, actual2.get(0).point);\n\n Cuboid cuboid3 = new Cuboid(2,4,3, new Ray(new Point3D(1,1,1), new Vector3D(0,0,1)));\n Ray ray3 = new Ray(new Point3D(0,100,0), new Vector3D(0,-1,0));\n ArrayList<GeoPoint> actual3 = cuboid3.findIntersections(ray3);\n ArrayList<GeoPoint> expected3 = new ArrayList<>();\n expected3.add(new GeoPoint(cuboid1, new Point3D(0,3,0)));\n assertEquals(expected3.get(0).point, actual3.get(0).point);\n\n Ray ray = new Ray(new Point3D(0,0,-200), Vector3D.zAxis);\n ArrayList<GeoPoint> interesections = cuboid1.findIntersections(ray);\n }", "private Vec3 trace(Ray ray) {\n\t\tSphere sphere = null;\n\n\t\tfor (int i = 0; i < spheres.size(); i++) {\n\t\t\tif (spheres.get(i).intersect(ray)) {\n\t\t\t\tsphere = spheres.get(i);\n\t\t\t}\n\t\t}\n\n\t\tif (sphere == null) {\n\t\t\treturn new Vec3(0.0f); // Background color.\n\t\t}\n\n\t\tVec3 p = ray.getIntersection(); // Intersection point.\n\t\tVec3 n = sphere.normal(p); // Normal at intersection.\n\n\t\treturn light.phong(sphere, p, n);\n\t}", "private Bounds getTextureBounds() {\n\t\tfinal float boundsWidth = 2 * OFFSET_X;\n\t\tfinal float boundsHeight = 2 * OFFSET_Y;\n\t\t\n\t\t//Get the center point of the player, then subtract by offset\n\t\tfinal float x = (activePlayer.getX() + activePlayer.getWidth() / 2f) \n\t\t\t\t/ activePlayer.getScaleX() - OFFSET_X;\n\t\tfinal float y = (activePlayer.getY() - activePlayer.getHeight() / 2f) \n\t\t\t\t/ activePlayer.getScaleY() + OFFSET_Y + 1;\n\t\t\n\t\treturn new Bounds(x, y, boundsWidth, boundsHeight);\n\t}", "public Vect3d getExtent (){\r\n \r\n Vect3d extent = new Vect3d();\r\n extent.x = (max.x - min.x) / 2;\r\n extent.y = (max.y - min.y) / 2;\r\n extent.z = (max.y - min.z) / 2;\r\n return extent;\r\n }", "public void texturedSphere(float r, PImage t) {\n int v1, v11, v2;\n r = (r + 240 ) * 0.33f;\n// tint(255, 48);\n beginShape(TRIANGLE_STRIP);\n texture(t);\n float iu=(float)(t.width-1)/(sDetail);\n float iv=(float)(t.height-1)/(sDetail);\n float u=0, v=iv;\n for (int i = 0; i < sDetail; i++) {\n vertex(0, -r, 0, u, 0);\n vertex(sphereX[i]*r, sphereY[i]*r, sphereZ[i]*r, u, v);\n u+=iu;\n }\n vertex(0, -r, 0, u, 0);\n vertex(sphereX[0]*r, sphereY[0]*r, sphereZ[0]*r, u, v);\n endShape(); \n \n // Middle rings\n int voff = 0;\n for (int i = 2; i < sDetail; i++) {\n v1=v11=voff;\n voff += sDetail;\n v2=voff;\n u=0;\n// tint(255, 255);\n beginShape(TRIANGLE_STRIP);\n texture(t);\n for (int j = 0; j < sDetail; j++) {\n vertex(sphereX[v1]*r, sphereY[v1]*r, sphereZ[v1++]*r, u, v);\n vertex(sphereX[v2]*r, sphereY[v2]*r, sphereZ[v2++]*r, u, v+iv);\n u+=iu;\n }\n \n // Close each ring\n v1=v11;\n v2=voff;\n vertex(sphereX[v1]*r, sphereY[v1]*r, sphereZ[v1]*r, u, v);\n vertex(sphereX[v2]*r, sphereY[v2]*r, sphereZ[v2]*r, u, v+iv);\n endShape();\n v+=iv;\n }\n u=0;\n \n // Add the northern cap\n// tint(255, 131);\n beginShape(TRIANGLE_STRIP);\n texture(t);\n for (int i = 0; i < sDetail; i++) {\n v2 = voff + i;\n vertex(sphereX[v2]*r, sphereY[v2]*r, sphereZ[v2]*r, u, v);\n vertex(0, r, 0, u, v+iv); \n u+=iu;\n }\n vertex(sphereX[voff]*r, sphereY[voff]*r, sphereZ[voff]*r, u, v);\n endShape();\n }", "public Point3 intersects(Plane3 p) {\n // All the constants will be the position vector, i.e., some point on the line\n if (intersect.DEBUG) System.out.println(\"Constant Terms: <\" + this.pt + \">\");\n\n // λ coefficients will be all those in the direction vector of the line\n if (intersect.DEBUG) System.out.println(\"λ coefficients: \" + this);\n\n // Plane equation is each component multiplied by the respective normal\n // vector of the plane\n if (intersect.DEBUG) System.out.printf(\"Plane equation: %.1f(%.1f + %.1fλ) + %.1f(%.1f + %.1fλ) + %.1f(%.1f + %.1fλ) = %.3f\\n\", p.v.x, pt.x, this.x, p.v.y, pt.y, this.y, p.v.z, pt.z, this.z, p.d);\n\n // Gather all constant terms from the plane equation\n double constantTerm = (p.v.x * pt.x) + (p.v.y * pt.y) + (p.v.z * pt.z);\n if (intersect.DEBUG) System.out.printf(\"K: %.2f\\t\", constantTerm);\n\n // Gather all λ terms\n double lambdaCoefficient = (p.v.x * this.x) + (p.v.y * this.y) + (p.v.z * this.z);\n if (intersect.DEBUG) System.out.printf(\"K_λ: %.1f\\n\", lambdaCoefficient);\n\n // If the coefficient for lambda is zero, we have a degenerate case\n if (lambdaCoefficient == 0) {\n // If the constant is the same as the actual magnitude of the plane's\n // normal vector, the line lies on the plane\n // Within a margin of error because rounding is a pain in the ass\n if (Math.abs(constantTerm - p.d) < 1e-6)\n intersect.overlapFlag = true;\n\n return null;\n }\n\n // Solve for the unknown, λ.\n double lambda = (p.d - constantTerm) / lambdaCoefficient;\n if (intersect.DEBUG) System.out.printf(\"λ: %.2f\\n\", lambda);\n\n // Plug in λ into the parametric equations for the line to find\n // point of intersection\n double newX = lambda * this.x + pt.x;\n double newY = lambda * this.y + pt.y;\n double newZ = lambda * this.z + pt.z;\n return new Point3(newX, newY, newZ);\n }", "@Override\n public boolean\n doIntersection(Ray inOut_Ray) {\n // TODO!\n return false;\n }", "public E3DVector2F getTextureCoordDetail1C(){\r\n\t\treturn vertices[2].getTextureCoordDetail1();\r\n\t}", "godot.wire.Wire.Vector3 getOrigin();", "public abstract Vector computeCenter();", "public E3DVector2F getTextureCoordDetail1A(){\r\n\t\treturn vertices[0].getTextureCoordDetail1();\r\n\t}", "godot.wire.Wire.Vector3 getNormal();", "public Filter doIntersection(Filter f);", "public Point2D.Float getIntersectionPoint(Line2D.Float line,\n Point2D.Float intersection)\n {\n if (intersection == null) {\n intersection = new Point2D.Float();\n }\n float fraction = getIntersection(line);\n intersection.setLocation(\n x1 + fraction * (x2 - x1),\n y1 + fraction * (y2 - y1));\n return intersection;\n }", "@Override\n public int octree_function(Object... obj) //public static int\n //o_sphere(\t\t\t/* compute intersection with sphere */\n //\tOBJECT.OBJREC so,\n //\tRAY r\n //)\n {\n OBJECT.OBJREC so = (OBJECT.OBJREC) obj[0];\n RAY r = (RAY) obj[1];\n double a, b, c;\t/* coefficients for quadratic equation */\n double[] root = new double[2];\t/* quadratic roots */\n int nroots;\n double t = 0;\n double[] ap;\n int i;\n\n if (so.oargs.nfargs != 4) {\n//\t\tobjerror(so, USER, \"bad # arguments\");\n }\n ap = so.oargs.farg;\n if (ap[3] < -FVECT.FTINY) {\n//\t\tobjerror(so, WARNING, \"negative radius\");\n so.otype = (short) (so.otype == OTYPES.OBJ_SPHERE\n ? OTYPES.OBJ_BUBBLE : OTYPES.OBJ_SPHERE);\n ap[3] = -ap[3];\n } else if (ap[3] <= FVECT.FTINY) {\n//\t\tobjerror(so, USER, \"zero radius\");\n }\n /*\n *\tWe compute the intersection by substituting into\n * the surface equation for the sphere. The resulting\n * quadratic equation in t is then solved for the\n * smallest positive root, which is our point of\n * intersection.\n *\tSince the ray is normalized, a should always be\n * one. We compute it here to prevent instability in the\n * intersection calculation.\n */\n /* compute quadratic coefficients */\n a = b = c = 0.0;\n for (i = 0; i < 3; i++) {\n a += r.rdir.data[i] * r.rdir.data[i];\n t = r.rorg.data[i] - ap[i];\n b += 2.0 * r.rdir.data[i] * t;\n c += t * t;\n }\n c -= ap[3] * ap[3];\n\n nroots = ZEROES.quadratic(root, a, b, c);\t/* solve quadratic */\n\n for (i = 0; i < nroots; i++) /* get smallest positive */ {\n if ((t = root[i]) > FVECT.FTINY) {\n break;\n }\n }\n if (i >= nroots) {\n return (0);\t\t\t/* no positive root */\n }\n\n if (t >= r.rot) {\n return (0);\t\t\t/* other is closer */\n }\n\n r.ro = so;\n r.rot = t;\n /* compute normal */\n a = ap[3];\n if (so.otype == OTYPES.OBJ_BUBBLE) {\n a = -a;\t\t\t/* reverse */\n }\n for (i = 0; i < 3; i++) {\n r.rop.data[i] = r.rorg.data[i] + r.rdir.data[i] * t;\n r.ron.data[i] = (r.rop.data[i] - ap[i]) / a;\n }\n r.rod = -FVECT.DOT(r.rdir, r.ron);\n r.rox = null;\n r.pert.data[0] = r.pert.data[1] = r.pert.data[2] = 0.0;\n r.uv[0] = r.uv[1] = 0.0;\n\n return (1);\t\t\t/* hit */\n }", "public final void mT__64() throws RecognitionException {\n try {\n int _type = T__64;\n int _channel = DEFAULT_TOKEN_CHANNEL;\n // ../org.xtext.example.webgme_mtl/src-gen/org/xtext/example/webgme/parser/antlr/internal/InternalMTL.g:62:7: ( 'intersection' )\n // ../org.xtext.example.webgme_mtl/src-gen/org/xtext/example/webgme/parser/antlr/internal/InternalMTL.g:62:9: 'intersection'\n {\n match(\"intersection\"); \n\n\n }\n\n state.type = _type;\n state.channel = _channel;\n }\n finally {\n }\n }", "public int getMouseSeismicLine2dIntersect(double[][] mouseLine, double[] intersectionXYZF)\n {\n double mouseLineLenSq;\n double[] lineVector;\n double[] pointVector0, pointVector1;\n double x0, y0, x1, y1;\n\n if(nCols < 1)\n {\n intersectionXYZF[3] = StsParameters.largeDouble;\n return -1;\n }\n try\n {\n mouseLineLenSq = StsMath.distanceSq(mouseLine[0], mouseLine[1], 2);\n lineVector = StsMath.subtract(mouseLine[1], mouseLine[0]);\n pointVector1 = StsMath.vector2(mouseLine[0][0], mouseLine[0][1], cdpX[0], cdpY[0]);\n y1 = computePointCoordinatesY(pointVector1, lineVector, mouseLineLenSq);\n int nPointNearest = 0;\n double fLineNearest = StsParameters.largeDouble;\n for(int n = 1; n < nCols; n++)\n {\n pointVector0 = pointVector1;\n pointVector1 = StsMath.vector2(mouseLine[0][0], mouseLine[0][1], cdpX[n], cdpY[n]);\n y0 = y1;\n y1 = computePointCoordinatesY(pointVector1, lineVector, mouseLineLenSq);\n\n if(y1 * y0 < 0.0)\n {\n x0 = computePointCoordinatesX(pointVector0, lineVector, mouseLineLenSq);\n x1 = computePointCoordinatesX(pointVector1, lineVector, mouseLineLenSq);\n\n double fPoint = -y0 / (y1 - y0);\n double fLine = x0 + fPoint * (x1 - x0);\n double z = mouseLine[0][2] + fLine * (mouseLine[1][2] - mouseLine[0][2]);\n if(fLine < fLineNearest && StsMath.betweenInclusive(z, zMin, zMax))\n {\n fLineNearest = fLine;\n\n if(fPoint <= 0.5)\n nPointNearest = n - 1;\n else\n nPointNearest = n;\n }\n }\n }\n if(!StsMath.interpolate(mouseLine[0], mouseLine[1], fLineNearest, 3, intersectionXYZF))\n return -1;\n intersectionXYZF[3] = fLineNearest;\n return nPointNearest;\n }\n catch(Exception e)\n {\n return -1;\n }\n }", "public Point centeroid ()\r\n {\r\n return new Point ((v1.getX()+v2.getX()+v3.getX())/3,(v1.getY()+v2.getY()+v3.getY())/3);\r\n }", "static PointDouble intersection(Line l1, Line l2) {\n if (areParallel(l1, l2)) return null; // no intersection\n PointDouble p = new PointDouble();\n // solve system of 2 linear algebraic equations with 2 unknowns\n p.x = (l2.b * l1.c - l1.b * l2.c) / (l2.a * l1.b - l1.a * l2.b);\n // In one of the lines, the b in the equation will be 1, since if both are 0\n // the lines are parallel. We calculate y from that Line's equation\n if (Math.abs(l1.b) > EPS) {\n p.y = -(l1.a * p.x + l1.c);\n } else {\n p.y = -(l2.a * p.x + l2.c);\n }\n return p;\n }", "@JsMethod\n public native Cartographic findIntersectionWithLatitude(double intersectionLatitude);", "public static Point PointOfIntersection(final Point startA, final Point endA,\n final Point startB, final Point endB) {\n float x1 = startA.x, x2 = endA.x, x3 = startB.x, x4 = endB.x;\n float y1 = startA.y, y2 = endA.y, y3 = startB.y, y4 = endB.y;\n float denom = ((x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4));\n float intersectXNum = ((x1*y2 - y1*x2) * (x3 - x4)) - ((x1 - x2) * (x3*y4 - y3*x4));\n float intersectYNum = ((x1*y2 - y1*x2) * (y3 - y4)) - ((y1 - y2) * (x3*y4 - y3*x4));\n return new Point(intersectXNum / denom, intersectYNum / denom);\n }", "public ArrayList<Point> intersection(Camera camera) {\n\t\tArrayList<Point> arrayPoint = new ArrayList<>();\n\n\t\tarrayPoint.add(A2);\n\t\tarrayPoint.addAll(camera.intersection(A2, B2));\n\n\t\tarrayPoint.add(B2);\n\t\tarrayPoint.addAll(camera.intersection(B2, C2));\n\n\t\tarrayPoint.add(C2);\n\t\tarrayPoint.addAll(camera.intersection(C2, D2));\n\n\t\tarrayPoint.add(D2);\n\t\tarrayPoint.addAll(camera.intersection(D2, A2));\n\n\t\tarrayPoint.add(A2);\n\n\t\treturn arrayPoint;\n\t}", "public Pair<Boolean, Float> intersects(Plane plane) {\r\n\t\treturn SecaMath.intersect(this, plane);\r\n\t}", "public Point2D.Double getImageCenter();", "private Point3D findHitPoint(Ray3D ray) {\n // We plug paramaterization of x, y, z for ray into our general quartic equation\n // to get standard form: At^2 + Bt + C = 0, then use the quadratic equation to solve for t.\n // The coefficients A, B, and C are quite ugly, and the derivation is described in the linked\n // resource\n Point3D P = ray.getPoint(); // Ray starting point\n Point3D D = ray.getDirection(); // Ray direction\n // First coefficient of quadratic equation of t\n double A = a * sq(D.getX()) + b * sq(D.getY()) + c * sq(D.getZ())\n + d * D.getY() * D.getZ() + e * D.getX() * D.getZ() + f * D.getX() * D.getY();\n // Second coefficient of quadratic equation of t\n double B = 2 * (a * P.getX() * D.getX() + b * P.getY() * D.getY() + c * P.getZ() * D.getZ())\n + d * (P.getY() * D.getZ() + P.getZ() * D.getY())\n + e * (P.getX() * D.getZ() + P.getZ() * D.getX())\n + f * (P.getX() * D.getY() + P.getY() * D.getX())\n + g * D.getX() + h * D.getY() + i * D.getZ();\n // Third coefficient of quadratic equation of t\n double C = a * sq(P.getX()) + b * sq(P.getY()) + c * sq(P.getZ()) + d * P.getY() * P.getZ()\n + e * P.getX() * P.getZ() + f * P.getX() * P.getY() + g * P.getX() + h * P.getY() + i * P.getZ() + j;\n\n double discriminant = sq(B) - 4 * A * C;\n\n // Find intersection Point\n Point3D intersection = null;\n if (discriminant >= 0) {\n double t1 = (-B - Math.sqrt(discriminant)) / (2 * A);\n double t2 = (-B + Math.sqrt(discriminant)) / (2 * A);\n Point3D p1 = ray.atTime(t1);\n Point3D p2 = ray.atTime(t2);\n if (t1 > 0 && t2 > 0 && isWithinBounds(p1) && isWithinBounds(p2)) {\n intersection = t1 <= t2 ? p1 : p2;\n } else if (t1 > 0 && isWithinBounds(p1)) {\n intersection = p1;\n } else if (t2 > 0 && isWithinBounds(p2)) {\n intersection = p2;\n }\n }\n return intersection;\n }", "@Override\n\tpublic Point3D findFirstIntersect(Ray3D ray) {\n\t\tPoint3D p = plane.findFirstIntersect(ray);\n\t\tif(isOnSurface(p))\n\t\t\treturn p;\n\t\telse\n\t\t\treturn Point3D.nullVal;\n\t}", "private ArrayList<ColorMixerModel.ColorItem> pathIntersection(){\n ArrayList<ColorMixerModel.ColorItem> toDel = new ArrayList<>();\n for(ColorMixerModel.ColorItem c: cmModel.colorSet){\n Ellipse2D.Float cobj = new Ellipse2D.Float(c.getPos().x,c.getPos().y, c.getR(),c.getR());\n if(mouseTrace.intersects(cobj.getBounds2D())){\n toDel.add(c);\n }\n }\n return toDel;\n }", "SurfaceTexture mo17006a();", "public Vector3f getSphereCenter() {\n\t\tfloat[] arr = getMinMax();\n\t\t\n\t\treturn new Vector3f((arr[0]+arr[1])/2,(arr[2]+arr[3])/2,(arr[4]+arr[5])/2);\n\t}", "public Point intersection(Point v1, Point v2) {\n\t\tdouble x0,y0;\n\t\tdouble x1 = first.getX();\n\t\tdouble y1 = first.getY();\n\t\tdouble x2 = last.getX();\n\t\tdouble y2= last.getY();\n\t\tdouble x3 = v2.getX();\n\t\tdouble y3 = v2.getY();\n\t\tdouble x4 = v1.getX();\n\t\tdouble y4 = v1.getY();\n\t\t\n\t\t\n\t\t\n\t\tx0=((x1*y2-x2*y1)*(x3-x4)-(x3*y4-x4*y3)*(x1-x2))\n\t\t\t\t/((x1-x2)*(y3-y4)-(y1-y2)*(x3-x4));\n\t\ty0=((x1*y2-x2*y1)*(y3-y4)-(x3*y4-x4*y3)*(y1-y2))\n\t\t\t/((x1-x2)*(y3-y4)-(y1-y2)*(x3-x4));\n\t\treturn new Point(x0,y0);\n\t}", "public WCRectangle intersection(WCRectangle r) {\n float tx1 = this.x;\n float ty1 = this.y;\n float rx1 = r.x;\n float ry1 = r.y;\n float tx2 = tx1; tx2 += this.w;\n float ty2 = ty1; ty2 += this.h;\n float rx2 = rx1; rx2 += r.w;\n float ry2 = ry1; ry2 += r.h;\n if (tx1 < rx1) tx1 = rx1;\n if (ty1 < ry1) ty1 = ry1;\n if (tx2 > rx2) tx2 = rx2;\n if (ty2 > ry2) ty2 = ry2;\n tx2 -= tx1;\n ty2 -= ty1;\n // tx2,ty2 will never overflow (they will never be\n // larger than the smallest of the two source w,h)\n // they might underflow, though...\n if (tx2 < Float.MIN_VALUE) tx2 = Float.MIN_VALUE;\n if (ty2 < Float.MIN_VALUE) ty2 = Float.MIN_VALUE;\n return new WCRectangle(tx1, ty1, tx2, ty2);\n }", "public intersection(){}", "godot.wire.Wire.Vector2 getOrigin();", "public static InterleavedVertexBuffer createInterleavedQuadWithTextureCoords() {\n InterleavedVertexBuffer.Builder builder = new InterleavedVertexBuffer.Builder(BufferUsage.STATIC);\n builder.add(\"a_Pos\", new VerticesData(BufferTestUtil.createQuadStrip(0.5f, 0.5f, 0, 0)));\n builder.add(\"a_texCoord\", new TextureCoordData(BufferTestUtil.createQuadTextureCoords()));\n return builder.build();\n }", "public static void main(String[] args) {\n\t\tint x1=1, y1=1, z1=1;\n\t\tint x2=8, y2=-7, z2=1;\n\t\t//Points describing the plane\n\t\tint x3=3, y3=9, z3=0;\n\t\tint x4=-1, y4=3, z4=0;\n\t\tint x5=4, y5=5, z5=0;\n\t\t//No intersection with this co-ords\n\t\tintersect(x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4,x5,y5,z5);\n\t}", "protected ResourceLocation getEntityTexture(Entity par1Entity)\n {\n return this.func_110914_a((EntitySpiritWolf)par1Entity);\n }", "public boolean intersects(MeshObject object) {\r\n return intersects(this.getCurrentCollisionCenter(), this.boundingSphereRadius, object.getCurrentCollisionCenter(), object.boundingSphereRadius);\r\n }", "public long[] getWorldCoordinate(int screenX, int screenY);" ]
[ "0.5965102", "0.59569955", "0.5936894", "0.587825", "0.5776746", "0.5772303", "0.57713795", "0.57478166", "0.5727426", "0.5716097", "0.5703722", "0.56838363", "0.56785405", "0.5668612", "0.5568943", "0.55596626", "0.5546596", "0.55223817", "0.5518415", "0.5493059", "0.5468421", "0.5459867", "0.5437069", "0.54344153", "0.5431228", "0.5387413", "0.53698206", "0.5355482", "0.5339948", "0.5324222", "0.5282564", "0.52362615", "0.5218618", "0.521747", "0.51909924", "0.51902187", "0.51797163", "0.5175633", "0.51649475", "0.51579326", "0.51532245", "0.5151274", "0.5143806", "0.51399726", "0.5131513", "0.51180315", "0.51038355", "0.50966716", "0.5096278", "0.50785166", "0.50526375", "0.5050646", "0.5050344", "0.50473326", "0.50438017", "0.50365055", "0.50282747", "0.5028134", "0.5014864", "0.4999107", "0.4979447", "0.49760252", "0.4975136", "0.4972778", "0.4968472", "0.4965022", "0.49531853", "0.4951674", "0.49425045", "0.49408138", "0.49340737", "0.49309397", "0.49235883", "0.4921112", "0.49171624", "0.49127477", "0.49036768", "0.48916012", "0.48913905", "0.488417", "0.48838958", "0.48807248", "0.48758593", "0.48614413", "0.48526865", "0.4850263", "0.48490974", "0.4848795", "0.4845575", "0.48432246", "0.48379415", "0.48316225", "0.48304957", "0.48226896", "0.48220283", "0.48178276", "0.48166212", "0.4813338", "0.48125434", "0.48070782", "0.4805754" ]
0.0
-1
Returns the path to the object that was intersected.
public SoPath getPath() { return path; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public java.lang.String getIntersectingRoadwayRef()\r\n {\r\n synchronized (monitor())\r\n {\r\n check_orphaned();\r\n org.apache.xmlbeans.SimpleValue target = null;\r\n target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(INTERSECTINGROADWAYREF$20);\r\n if (target == null)\r\n {\r\n return null;\r\n }\r\n return target.getStringValue();\r\n }\r\n }", "public Path getPath();", "IPath getPath();", "public String getPath() \r\n\t{\r\n\t\tStringBuilder pathBuilder = new StringBuilder();\r\n\t\tfor(Cell c: path)\r\n\t\t\tpathBuilder.append(\" (\" + c.getRow() + ',' + c.getColumn() + ')');\r\n\t\t\r\n\t\treturn pathBuilder.toString();\r\n\t}", "public String getPath()\n {\n StringBuilder buff = new StringBuilder();\n Resource r = this;\n while(r != null)\n {\n if(r.getId() != 1)\n {\n buff.insert(0, r.getName());\n }\n r = r.getParent();\n if(r != null || this.getId() == 1)\n {\n buff.insert(0, '/');\n }\n }\n return buff.toString();\n }", "public String getPath() { \n\t\treturn getPathElement().getValue();\n\t}", "PathSegments getPath();", "public final String getPath() {\n\t\treturn this.path.toString();\n\t}", "CtPath getPath();", "Path getPath();", "private ArrayList<ColorMixerModel.ColorItem> pathIntersection(){\n ArrayList<ColorMixerModel.ColorItem> toDel = new ArrayList<>();\n for(ColorMixerModel.ColorItem c: cmModel.colorSet){\n Ellipse2D.Float cobj = new Ellipse2D.Float(c.getPos().x,c.getPos().y, c.getR(),c.getR());\n if(mouseTrace.intersects(cobj.getBounds2D())){\n toDel.add(c);\n }\n }\n return toDel;\n }", "public String getPath() {\n\t\treturn getString(\"path\");\n\t}", "public org.landxml.schema.landXML11.RoadwayNameRef xgetIntersectingRoadwayRef()\r\n {\r\n synchronized (monitor())\r\n {\r\n check_orphaned();\r\n org.landxml.schema.landXML11.RoadwayNameRef target = null;\r\n target = (org.landxml.schema.landXML11.RoadwayNameRef)get_store().find_attribute_user(INTERSECTINGROADWAYREF$20);\r\n return target;\r\n }\r\n }", "public BlockPath getPath() {\n BlockPath path = new BlockPath();\n path.addPathNodeToPathFront(this);\n CourseComponent nodeAbove = parent;\n while (nodeAbove != null) {\n path.addPathNodeToPathFront(nodeAbove);\n nodeAbove = nodeAbove.getParent();\n }\n return path;\n }", "public String getIdenticalPath() {\n return ipath;\n }", "public Path getPath(){\n return this.path;\n }", "public String getPath() {\n\n\t\treturn this.path;\n\n\t}", "@Override\r\n\tpublic ArrayList<String> getPath(String actor1, String actor2)\r\n\t{\r\n\t\tActor act1 = new Actor(actor1);\r\n\t\tActor act2 = new Actor(actor2);\r\n\t\t\r\n\t\tif(graph.containsEdge(act1,act2 ))\r\n\t\t{\r\n\t\t\treturn graph.shortestPath(act1, act2);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\treturn null;\r\n\t\t}\r\n\t}", "public String toPathString() {\n return path();\n }", "@Override\n\tpublic String toString() {\n\t\treturn path.toString();\n\t}", "String getPath();", "String getPath();", "String getPath();", "String getPath();", "String getPath();", "public Path getPath() {\n return p;\n }", "public String getPath() {\n\t\treturn this.path;\n\t}", "public ExecRegionPath getPath() {\n return getPath(null);\n }", "public static Path getPathForObject(Object obj) {\r\n ReportsDirectory constant = fromObject(obj);\r\n return getTargetPath().resolve(constant.folder);\r\n }", "public AtomicVertex[] getPaths()\n {\n return _paths;\n }", "public String getPath();", "public String getPath();", "public String getPath();", "public Path getPath() {\n return this.path;\n }", "public List<Shape> path()\n\t{\n\t\t// Output path list\n\t\tList<Shape> path = new ArrayList<>();\n\n\t\t// Add the callee to the list\n\t\tpath.add(this);\n\n\t\t// Go up the full hierarchy and add the shapes to the\n\t\t// path\n\t\tShape currentShape = parent;\n\n\t\twhile(currentShape!=null)\n\t\t{\n\t\t\tpath.add(currentShape);\n\t\t\tcurrentShape = currentShape.parent;\n\t\t}\n\n\t\t// Reverse the list to put it into the required order\n\t\tCollections.reverse(path);\n\n\t\treturn path;\n\t}", "public String getPath(){\n\t\t\treturn this.path;\n\t\t}", "public Tile getPath() {\n\t\treturn path;\n\t}", "public String getPath()\r\n/* 26: */ {\r\n/* 27:57 */ return this.path;\r\n/* 28: */ }", "public CustomPath getPath() {\n\t\treturn path;\n\t}", "public String getPath() {\n return this.path;\n }", "public final String getPath() {\n\t return m_path;\n\t}", "public Path getPath() {\n return path;\n }", "public String getPath() {\n \tStringBuilder path = new StringBuilder();\n \tint s = this.getSelectedIndex();\n \tif (s <= 0 ) s = 0;\n \tJPiereIADTabpanel p = tabPanelList.get(s);\n \tfor (int i = 0; i <= s; i++) {\n \t\tString n = null;\n \t\tif (i == s)\n \t\t\tn = p.getTitle();\n \t\telse {\n \t\t\tJPiereIADTabpanel t = tabPanelList.get(i);\n \t\t\tif (t.getTabLevel() < p.getTabLevel())\n \t\t\t\tn = t.getTitle();\n \t\t}\n \t\tif (n != null) {\n \t\t\tif (path.length() > 0) {\n \t\t\t\tpath.append(\" > \");\n \t\t\t}\n \t\t\tpath.append(n);\n \t\t}\n \t}\n\n \treturn path.toString();\n }", "public Path getPath() {\n return mPath;\n }", "public String getPath() {\r\n\t\t\treturn path;\r\n\t\t}", "public String getPath() {\n\t\treturn path;\n\t}", "public String getSearchPath() {\n String path = null;\n if (parent != null) {\n path = parent.getSearchPath();\n path = String.format(\"%s/%s\", path, name);\n } else {\n path = String.format(\"%s\", name);\n }\n return path;\n }", "public String getPathName();", "public String getPath()\n {\n\n return _path;\n }", "public String getPath() {\n return this.path;\n }", "public String getPath() {\n return this.path;\n }", "public String getPath() {\n return this.path;\n }", "public String getPath() {\n return this.path;\n }", "public String getPath() {\n return this.path;\n }", "public String getPath() {\n return this.path;\n }", "public String getPath() {\n return this.path;\n }", "public String getPath() {\n return this.path;\n }", "public String getPath() {\n return this.path;\n }", "public String getPath() {\n return this.path;\n }", "public String getPath() {\n return this.path;\n }", "public String getPath() {\n return this.path;\n }", "public String getPath() {\n return this.path;\n }", "public String getPath() {\r\n\t\treturn path;\r\n\t}", "public String getPath() {\r\n\t\treturn path;\r\n\t}", "public String getPath() {\r\n\t\treturn path;\r\n\t}", "public Path getPath() {\n return path;\n }", "public ObjectNode resolvePaths();", "@Override\n public boolean equals(\n Object object\n ){\n \tif(this == object) {\n \t\treturn true;\n \t}\n \tif(object instanceof Path) {\n \t\tPath that = (Path) object;\n \t\tif(this.size == that.size) {\n \t\t\tif(this.size == 0) {\n \t\t\t\treturn true;\n \t\t\t}\n \t\t\tif(this.base.equals(that.base)) {\n \t\t\t return \n \t\t\t this.parent == that.parent ||\n \t\t\t this.parent.equals(that.parent);\n \t\t\t}\n \t\t}\n \t}\n\t\treturn false;\n }", "public RMPath getPathInBounds() { return getPath().getPathInRect(getBoundsInside()); }", "public boolean equals(Object obj) {\n return obj instanceof Path &&\n index == ((Path) obj).index &&\n Arrays.equals(parts, ((Path) obj).parts);\n }", "@Override\n\tpublic String toString() {\n\t\tString path = \"\";\n\tfor (int i = 0; i < paths.size(); i ++) {\n\t\tfor (int j = 0; j < paths.get(i).size(); j++)\n\t\t\tpath += paths.get(i).get(j) + \", \";\n\t\tpath += \"\\n\";\n\t}\n\treturn path;\n\t\t\n\t}", "public String getPath(){\r\n\t\treturn path;\r\n\t}", "String getPath() {\r\n\t\treturn path;\r\n\t}", "public String getPath() {\n return path;\n }", "public String getPath() {\n return path;\n }", "public String getPath() {\n return path;\n }", "public String getPath() {\n return path;\n }", "public String getPath() {\n return path;\n }", "public String getPath() {\n return path;\n }", "public String getPath() {\n return path;\n }", "public String getPath() {\n return path;\n }", "public String getPath() {\n return path;\n }", "public String getPath() {\n return path;\n }", "public String getPath() {\n return path;\n }", "public String getPath() {\n return path;\n }", "public String getPath() {\n return path;\n }", "public String getPath() {\n return path;\n }", "public String getPath() {\n return path;\n }", "@Nonnull\n Path getPath();", "public String getPath() {\r\n return path;\r\n }", "public String getPath() {\r\n return path;\r\n }", "public String toString() {\n\t\tString pathString = \"\";\n\t\tfor(Point point : path) {\n\t\t\tpathString = pathString + \"[ \" + point.getX() + \", \" + point.getY() + \" ]\";\n\t\t}\n\t\treturn pathString;\n\t}", "@Override\n\t\tpublic List<String> getPathTo(InJarResourceImpl resource) {\n\t\t\t// TODO FD4SG la ligne ci-dessous est vraiment bizarre (getChildren renvoie une liste de RepositoryFolder alors que resource est\n\t\t\t// une ressource\n\t\t\tif (!getRootFolder().getChildren().contains(resource)) {\n\t\t\t\tList<String> pathTo = new ArrayList<>();\n\t\t\t\tStringTokenizer string = new StringTokenizer(/*resource.getURI()*/resource.getEntry().getName(),\n\t\t\t\t\t\tCharacter.toString(ClasspathResourceLocatorImpl.PATH_SEP.toCharArray()[0]));\n\t\t\t\twhile (string.hasMoreTokens()) {\n\t\t\t\t\tString next = string.nextToken();\n\t\t\t\t\tif (string.hasMoreTokens()) {\n\t\t\t\t\t\tpathTo.add(next);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn pathTo;\n\t\t\t}\n\t\t\treturn null;\n\t\t}", "Path getPath() {\n return this.path;\n }", "@Override\n\tpublic String toString() {\n\t\treturn this.f.getPath();\n\t}", "public final String getPath()\n {\n return path;\n }", "public Position[] getPath() {\n\t\treturn path;\n\t}", "public String getPathExpression() {\n return getProperty(PATH_EXPRESSION);\n }", "String getPath() {\n return this.path;\n }", "public String getPath()\n {\n return path;\n }" ]
[ "0.58523226", "0.57484657", "0.57428634", "0.57119596", "0.56011105", "0.55642915", "0.55601174", "0.554232", "0.55299646", "0.5519641", "0.5497888", "0.54921836", "0.5476214", "0.5438503", "0.54186237", "0.54178923", "0.5365647", "0.5351091", "0.534643", "0.5344564", "0.5331434", "0.5331434", "0.5331434", "0.5331434", "0.5331434", "0.5315983", "0.5312884", "0.53048044", "0.5299539", "0.5294227", "0.52811986", "0.52811986", "0.52811986", "0.5279555", "0.52790666", "0.5267575", "0.5266695", "0.5260765", "0.5237512", "0.52372205", "0.5229245", "0.52263516", "0.52226603", "0.5222229", "0.52074915", "0.5201438", "0.5200415", "0.51975375", "0.5195066", "0.51924956", "0.51924956", "0.51924956", "0.51924956", "0.51924956", "0.51924956", "0.51924956", "0.51924956", "0.51924956", "0.51924956", "0.51924956", "0.51924956", "0.51924956", "0.51856035", "0.51856035", "0.51856035", "0.5171653", "0.5157841", "0.5153118", "0.5150507", "0.5150328", "0.5138053", "0.5122711", "0.5121736", "0.51199895", "0.51199895", "0.51199895", "0.51199895", "0.51199895", "0.51199895", "0.51199895", "0.51199895", "0.51199895", "0.51199895", "0.51199895", "0.51199895", "0.51199895", "0.51199895", "0.51199895", "0.5116318", "0.51140106", "0.51140106", "0.5109619", "0.5109521", "0.50950533", "0.50933796", "0.5086908", "0.50866735", "0.50843745", "0.5082861", "0.5078521" ]
0.5145893
70
////////////////////////////////////////////////////////////////////// Description: Sets the objectspace normal. Use: extender
public void setObjectNormal(final SbVec3f normal) // //////////////////////////////////////////////////////////////////////// { // Transform the object space normal by the current modeling // matrix o get the world space normal. Use the inverse transpose // of the odel matrix so that normals are not scaled incorrectly. SbMatrix normalMatrix = SoModelMatrixElement.get(state).inverse().transpose(); normalMatrix.multDirMatrix(normal, worldNormal); worldNormal.normalize(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setNormal(String normal) {\r\n String old = this.normal;\r\n this.normal = normal;\r\n this.changeSupport.firePropertyChange(\"normal\", old, normal );\r\n }", "protected void setForceNormalVector() {\n\t\tvn = forceNormalVector(v1, v2);\n\t}", "public void setNormalBuffer(ByteBuffer normBuf) {\n this.normBuf = normBuf;\n }", "public void setAttributes(ShapeAttributes normalAttrs)\n {\n this.normalAttrs = normalAttrs;\n }", "private void computeNormal() {\n normal = getDirection();\r\n\r\n // Rotate by -90 degrees to get normal of line\r\n float oldY = normal.y;\r\n normal.y = -normal.x;\r\n normal.x = oldY;\r\n }", "public void normalize()\n\t{\n\t\tif (this.getDenom() < 0)\n\t\t{\n\t\t\tthis.setDenom(this.getDenom() * (-1));\n\t\t\tthis.setNumer(this.getNumer() * (-1));\n\t\t}\n\t}", "public void normal(PointType n)\r\n {\r\n\t //System.out.println(\"norm: \"+n.x+\", \"+n.y+\", \"+n.z);\r\n\t\tgl.glNormal3d(n.x, n.y, n.z);\t\t\r\n\t}", "public WB_Normal3d() {\r\n\t\tsuper();\r\n\t}", "public String getNormal() {\r\n return normal;\r\n }", "public SbVec3f getNormal() { return worldNormal; }", "public void normalize()\n {\n double magnitude = this.magnitude();\n this.x = x / (float)magnitude;\n this.y = y / (float)magnitude;\n this.z = z / (float)magnitude;\n this.w = w / (float)magnitude;\n }", "public void normalize() {\n\t\tdouble norm = norm();\n\t\tif (DoubleComparison.eq(norm, 0)) {\n\t\t\tthrow new RuntimeException(\"Failed to normalize: length is zero\");\n\t\t}\n\t\tthis.x = this.x / norm;\n\t\tthis.y = this.y / norm;\n\t\tthis.z = this.z / norm;\n\t}", "public final synchronized void setActiveNormalization(Normalization obj)\n { /* setActiveNormalization */\n /* turn off whichever normalization is on now */\n if (activeNormalization != null)\n {\n activeNormalization.setState(false);\n }\n \n /* Change to the parameter and then turn on null value indicates that \n * we are dumping the Normalization plugin that is current.\n */\n activeNormalization= obj;\n if (activeNormalization != null)\n { /* set this normalization method as active */\n activeNormalization.setState(true);\n \n /* Do a quick double check and set the NormStateFromPLugin */\n if ( obj instanceof NormalizationPlugin)\n { /* notify built-in radio-button code for this normalization */\n /* This is required so that there is only one normalization method. \n * It then figures out which plugin is active by using \n * getActiveNormalization() and calling this Normalize method\n * as required.\n */\n String pluginName= ((NormalizationPlugin) obj).getPluginName();\n getMAEStub().setNormalizationStateFromPlugin(pluginName);\n }\n else\n getMAEStub().setNormalizationStateFromPlugin(null);\n } /* set this normalization method as active */\n else\n { /* disable this normalization method */\n getMAEStub().setNormalizationStateFromPlugin(null);\n }\n \n }", "public void normaliza() {\n switch (o) {\n case SurEste:\n setPos(getX()+1, getY());\n o = OrientacionArista.NorOeste;\n break;\n case SurOeste: \n setPos(getX(), getY()+1);\n o = OrientacionArista.NorEste;\n break;\n case Oeste: \n setPos(getX()-1, getY()+1);\n o = OrientacionArista.Este;\n break;\n }\n }", "public void normalize(){\n\t_defense = originalDefense;\n\t_strength = originalStrength;\n }", "private void renderToNormalMap() {\n\t\tGL11.glColorMask(true, true, true, true);\n\t\tGL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT\n\t\t\t\t| GL11.GL_STENCIL_BUFFER_BIT);\n\n\t\tfor (PhysicsEntity<? extends RenderEntity> e : entities) {\n\t\t\tRenderEntity re = e.getWorldEntity();\n\t\t\tre.render(screenSpaceNormalDepthContext);\n\t\t}\n\n\t\tnormalBuffer.copyPixels();\n\t}", "public void normalize(){\n\tstrength = 50;\n\tdefense = 55;\n\tattRating = 0.4\t;\n }", "@Override\n\tpublic void setOrientation(Vector o)\n\t{\n\t\tsuper.setOrientation(o);\n\t\tif (position != null && normal != null)\n\t\t{\n\t\t\toX = o.dup().norm();\n\t\t\toY = normal.cross(oX).norm();\n\t\t\toX = oY.cross(normal).norm();\n\t\t}\n\t}", "public void setNormalValue(java.lang.String normalValue) {\n\t\tthis.normalValue = normalValue;\n\t}", "public VectorA normal()\n {\n return new VectorA(this.x/this.mag(), this.y/this.mag());\n }", "public void normalize() {}", "public void normalize() {\r\n\t\tfloat length = (float) this.lenght();\r\n\t\tif (length > 0) {\r\n\t\t\tx /= length;\r\n\t\t\ty /= length;\r\n\t\t\tz /= length;\r\n\t\t}\r\n\t}", "public void resetWorld() {\n \t\tmyForces.clear();\n \t\t\n \t\tfor (CollidableObject obj : myObjects) {\n \t\t\tobj.detach();\n \t\t}\n \t\tmyObjects.clear();\n \t\t\n \t\taddHalfspaces();\n \t}", "public static void setMesh(){\n if(sMesh){\n sMesh = false;\n }else{\n sMesh = true;\n }\n }", "public boolean getNormal() {\n return normal_;\n }", "public void setNormalVertice(int i, Vector3f normal) {\n\t\t(normalVertices.get(i)).set(normal);\n\t}", "@java.lang.Override\n public godot.wire.Wire.Vector3 getNormal() {\n return normal_ == null ? godot.wire.Wire.Vector3.getDefaultInstance() : normal_;\n }", "public void normalize()\n {\n\tdef += 200*counter;\n\tdmg -= 0.5*counter;\n\tcounter = 0;\n }", "public boolean getNormal() {\n return normal_;\n }", "public Vector2D normal()\n\t{\n\t\treturn this.mul(1/this.length());\n\t}", "public SbVec3f\ngetObjectNormal() {\n\treturn getObjectNormal(null);\n}", "public Builder setNormal(boolean value) {\n \n normal_ = value;\n onChanged();\n return this;\n }", "@BrowserSupport({BrowserType.FIREFOX_2P})\r\n\t@DOMSupport(DomLevel.THREE)\r\n\t@Function void normalizeDocument();", "void setNormalSpeed () {\n if (stepDelay == normalSpeed)\n return;\n stepDelay = normalSpeed;\n resetLoop();\n }", "public void setVectorNorm(double normb) {\n this.normb = normb;\n }", "public void setExtents(Rectangle2D new_extents) {\n this.extents = new_extents; transform(); getRTComponent().render();\n }", "@Override\r\n\t\tpublic void normalize()\r\n\t\t\t{\n\t\t\t\t\r\n\t\t\t}", "public Builder setNormal(godot.wire.Wire.Vector3 value) {\n if (normalBuilder_ == null) {\n if (value == null) {\n throw new NullPointerException();\n }\n normal_ = value;\n onChanged();\n } else {\n normalBuilder_.setMessage(value);\n }\n\n return this;\n }", "public final static void disableNormalizationPlugin()\n { /* disableNormalizationPlugin */\n activeNormalization= null;\n }", "public void normalize(){\r\n \tif(!normal){\r\n\t attack/=2;\r\n\t defense*=2;\r\n\t normal=true;\r\n\t}\r\n }", "public void normalize(){\r\n \tif(!normal){\r\n\t attack/=2;\r\n\t defense*=2;\r\n\t normal=true;\r\n\t}\r\n }", "@Override\r\n\tprotected Ray normalAt(double xx, double yy, double zz) {\n\t\treturn null;\r\n\t}", "public ByteBuffer getNormalBuffer() {\n return normBuf;\n }", "public Vector normalize(){\n\t\tdouble mag = magnitude();\n\t\treturn new Vector(x/mag, y/mag, z/mag);\n\t}", "public boolean usesNormals() {\r\n return false;\r\n }", "public WB_Normal3d(final double x, final double y) {\r\n\t\tsuper(x, y);\r\n\t}", "public void setMagnitude()\n {\n magnitude = (float) Math.sqrt(Math.pow(fx, 2) + Math.pow(fy, 2) + Math.pow(fz, 2));\n }", "private void setNorms (double temperatureX, double temperatureY) {\n \t\tvNormX = Math.sqrt(2 * k * temperatureX / 0.5);\n \t\tvNormY = Math.sqrt(2 * k * temperatureY / 0.5);\n \t}", "public Builder clearNormal() {\n \n normal_ = false;\n onChanged();\n return this;\n }", "public void setStd_Base (String Std_Base);", "public Vector normalized(){\r\n\t\tfloat len = this.length();\r\n\t\tif( len != 0.0f && len != 1.0f ){\r\n\t\t\treturn new Vector( this.x / len, this.y / len, this.z / len );\r\n\t\t}\r\n\t\treturn this;\r\n\t}", "godot.wire.Wire.Vector3 getNormal();", "public static final synchronized Normalization getActiveNormalization()\n { return(activeNormalization); }", "private void setGeometry() {\n this.setCullHint(Spatial.CullHint.Dynamic);\n this.setLocalTranslation(realPosition);\n //attach geometry to this object\n // mat.setColor(\"Color\", colors[r.nextInt(colors.length)]);\n if (!companyTextures.containsKey(this.company)) {\n mat.setTexture(\"ColorMap\", Colors.get(r.nextInt(Colors.size())));\n } else {\n mat.setTexture(\"ColorMap\", companyTextures.get(this.company));\n }\n geom.setMaterial(mat);\n this.attachChild(geom.clone());\n }", "private void designMU(MeaningUnit meaningUnit) {\n\t\tint start = meaningUnit.getConstitutiveWord().getStartPosition();\n\t\tint end = meaningUnit.getConstitutiveWord().getEndPosition();\n\t\tStyleConstants.setBackground(STYLE, designer\n\t\t\t\t.getBackgroundColor(meaningUnit));\n\t\tdoc.setCharacterAttributes(start, end - start + 1, STYLE, true);\n\t\ttry {\n\t\t\tint s = meaningUnit.getFunctionWord().getStartPosition();\n\t\t\tint e = meaningUnit.getFunctionWord().getEndPosition();\n\t\t\tStyleConstants.setBackground(STYLE, designer\n\t\t\t\t\t.getBackgroundColor(meaningUnit));\n\t\t\tdoc.setCharacterAttributes(s, e - s + 1, STYLE, true);\n\t\t} catch (NullPointerException npe) {\n\t\t\t// MeaningUnit besteht nur aus cw\n\t\t}\n\t}", "boolean getNormal();", "public void normalize() {\n // determine the maximum value\n \n Double max = getMaxValue();\n \n if(max!=null) {\n normalize(max);\n }\n }", "@java.lang.Override\n public boolean hasNormal() {\n return normal_ != null;\n }", "public\t\tvoid\t\tsetNormalizedValue(double value)\n\t\t{\n\t\tif (value > 1.0)\n\t\t\tvalue = 1.0;\n\t\telse if (value < 0.0)\n\t\t\tvalue = 0.0;\n\n\t\tthis.value = value;\n\t\taddNormalizedTick(value);\n\t\tsetValueDisplay(\"\" + (minimumValue + value * (maximumValue - minimumValue)));\n\t\tdispatchAction(Mi_VALUE_CHANGED_ACTION);\n\t\t}", "public void invertNormals() {\n mCubeNormalData = new float[]\n {\n // Front face\n 0.0f, 0.0f, -1.0f,\n 0.0f, 0.0f, -1.0f,\n 0.0f, 0.0f, -1.0f,\n 0.0f, 0.0f, -1.0f,\n 0.0f, 0.0f, -1.0f,\n 0.0f, 0.0f, -1.0f,\n // Right face\n -1.0f, 0.0f, 0.0f,\n -1.0f, 0.0f, 0.0f,\n -1.0f, 0.0f, 0.0f,\n -1.0f, 0.0f, 0.0f,\n -1.0f, 0.0f, 0.0f,\n -1.0f, 0.0f, 0.0f,\n // Back face\n 0.0f, 0.0f, 1.0f,\n 0.0f, 0.0f, 1.0f,\n 0.0f, 0.0f, 1.0f,\n 0.0f, 0.0f, 1.0f,\n 0.0f, 0.0f, 1.0f,\n 0.0f, 0.0f, 1.0f,\n // Left face\n 1.0f, 0.0f, 0.0f,\n 1.0f, 0.0f, 0.0f,\n 1.0f, 0.0f, 0.0f,\n 1.0f, 0.0f, 0.0f,\n 1.0f, 0.0f, 0.0f,\n 1.0f, 0.0f, 0.0f,\n // Top face\n 0.0f, -1.0f, 0.0f,\n 0.0f, -1.0f, 0.0f,\n 0.0f, -1.0f, 0.0f,\n 0.0f, -1.0f, 0.0f,\n 0.0f, -1.0f, 0.0f,\n 0.0f, -1.0f, 0.0f,\n // Bottom face\n 0.0f, 1.0f, 0.0f,\n 0.0f, 1.0f, 0.0f,\n 0.0f, 1.0f, 0.0f,\n 0.0f, 1.0f, 0.0f,\n 0.0f, 1.0f, 0.0f,\n 0.0f, 1.0f, 0.0f\n };\n mCubeNormals.put(mCubeNormalData).position(0);\n\n }", "private void setMu1(MeaningUnit mu) {\n\t\t// falls die MU aus CW und FW besteht\n\t\tif (mu.getFunctionWord() != null) {\n\t\t\tmodel.getSGCreatingMenu().setMU1(\n\t\t\t\t\tmu.getFunctionWord() + \" \"\n\t\t\t\t\t\t\t+ mu.getConstitutiveWord());\n\t\t}\n\t\t// falls die MU nur aus CW besteht\n\t\telse {\n\t\t\tmodel.getSGCreatingMenu().setMU1(\n\t\t\t\tmu.getConstitutiveWord().toString());\n\t\t}\n\t\tmodel.getView().design(mu, true);\n\t\tmu1 = mu;\n\t}", "public void enterNormalState() {\n\n\t}", "private void setDirectionalMomentumTo(AdvancedPhysicDrawnObject other, \n\t\t\tdouble direction, double newMomentum, \n\t\t\tdouble energyLossModifier, double frictionModifier, double steps, \n\t\t\tPoint2D.Double absoluteEffectPoint)\n\t{\n\t\tdouble momentumStart = getDirectionalMomentum(direction);\n\t\t// F = dp / dt\n\t\tdouble momentumDifference = newMomentum * (1 - energyLossModifier) - momentumStart;\n\t\tMovement normalForce = Movement.createMovement(direction, momentumDifference / steps);\n\t\t\n\t\t// If the force would push the object into the wrong direction, stops\n\t\t//double normalForceDirectionalSpeed = normalForce.getDirectionalSpeed(direction);\n\t\t// TODO: Removing this causes problems when the other object's route is \n\t\t// blocked but needs to be removed otherwise\n\t\t// TODO: So add a check for that\n\t\t//if (normalForce.getDirectionalSpeed(direction) > 0)\n\t\t//{\n\t\t\t// Applies the force and adds friction as well\n\t\t\taddImpulse(normalForce, absoluteEffectPoint, steps);\n\t\t\taddCollisionFriction(other, normalForce, frictionModifier, \n\t\t\t\t\tabsoluteEffectPoint, steps);\n\t\t\t/*\n\t\t\tif (this.rotationAllowed)\n\t\t\t\taddCollisionRotationFriction(other, normalForce, frictionModifier, \n\t\t\t\t\t\tabsoluteEffectPoint, steps);\n\t\t\t*/\n\t\t\t// Also adds compensation movement\n\t\t\t//addPosition(Movement.getMultipliedMovement(normalForce, 1.0 / getMass()));\n\t\t//}\n\t}", "@Override\r\n public void setVspace(String vspace) {\n }", "public String getNormalTexture() {\n return normalTexture;\n }", "public void normalise(Vector2 normVector) {\n\t\tposition.subtract(normVector);\n\t\tsetX(getX() - normVector.getX());\n\t\tsetY(getY() - normVector.getY());\n\t}", "public void setEspace ( boolean espace ) {\n\n\tthis.espace = espace;\n }", "public void setDgNormalValues(\n\t\t\tjava.util.Set<jkt.hms.masters.business.DgNormalValue> dgNormalValues) {\n\t\tthis.dgNormalValues = dgNormalValues;\n\t}", "public Vector3D normalize()\r\n {\r\n float oneOverMagnitude = 0;\r\n float mag = magnitude();\r\n \r\n if (mag!=0) {\r\n oneOverMagnitude = 1 / mag;\r\n }\r\n\r\n return this.product(oneOverMagnitude);\r\n }", "public void setMatrixNorm(double normA) {\n this.normA = normA;\n }", "protected void func_110147_ax()\n {\n super.applyEntityAttributes();\n this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(16.0D);\n this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.20000000298023224D);\n }", "public void setNormalizationState(boolean flag);", "public void normalize() { sets length to 1\n //\n double length = Math.sqrt(x * x + y * y);\n\n if (length != 0.0) {\n float s = 1.0f / (float) length;\n x = x * s;\n y = y * s;\n }\n }", "private void normalize() {\n this.x = (this.x - RobocodeRunner.width / 2) / RobocodeRunner.width;\n this.y = (this.y - RobocodeRunner.height / 2) / RobocodeRunner.height;\n this.distance /= Math.sqrt(RobocodeRunner.width * RobocodeRunner.width + RobocodeRunner.height * RobocodeRunner.height);\n this.enemyHeading /= 90;\n this.enemyDx /= 8;\n this.enemyDy /= 8;\n this.gunToTurn /= 180;\n this.angle /= 180;\n }", "public void set_standard_format () {\n\t\tf_friendly_format = false;\n\n\t\tmainshock_time = 0L;\n\t\tmainshock_mag = 0.0;\n\t\tmainshock_lat = 0.0;\n\t\tmainshock_lon = 0.0;\n\t\tmainshock_depth = 0.0;\n\n\t\treturn;\n\t}", "public boolean isNormal() {\r\n\t\ttry {\r\n\t\t\treturn \"NORMAL\".equals(getOperationMode());\r\n\t\t} catch (Exception ex) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "public void setMinMagnitude(double magnitude);", "private void setMu2(MeaningUnit mu) {\n\t\t// falls die MU aus CW und FW besteht\n\t\tif (mu.getFunctionWord() != null) {\n\t\t\tmodel.getSGCreatingMenu().setMU2(mu.getFunctionWord() + \" \" + mu.getConstitutiveWord());\n\t\t}\n\t\t// falls die MU nur aus CW besteht\n\t\telse {\n\t\t\tmodel.getSGCreatingMenu().setMU2(mu.getConstitutiveWord().toString());\n\t\t}\n\t\tmodel.getView().design(mu, true);\n\t\tmu2 = mu;\t\t\t\t\t\t\t\t\n\t}", "private void resetRotationAxisToOrigin()\n\t{\n\t\tdouble newSpeed = this.currentMomentMass * getRotation() /\n\t\t\t\tthis.defaultMomentMass;\n\t\t\n\t\t// Changes back to normal rotation\n\t\tthis.currentRotationAxis = new Point2D.Double(getOriginX(), getOriginY());\n\t\tsetRotation(newSpeed);\n\t}", "public boolean isNormal()\n {\n return Native.fpaIsNumeralNormal(getContext().nCtx(), getNativeObject());\n }", "public void calculateNormals() {\n // TODO!\n }", "public static RuntimeValue normal(RuntimeValue m, RuntimeValue sd) throws RuntimeException {\n if (isDiscreteFloatSample(m) && hasSingleValue(m.getDiscreteFloatSample()) &&\n isDiscreteFloatSample(sd) && hasSingleValue(sd.getDiscreteFloatSample())) {\n return new RuntimeValue(\n RuntimeValue.Type.DISTRIBUTION,\n new NormalDistribution(m.getDiscreteFloatSample().single(), sd.getDiscreteFloatSample().single())\n );\n }\n\n throw new RuntimeException(\"Unable to create Normal distribution\");\n }", "@Raw\n protected void setMass(double mass){\n \tthis.mass = mass;\n }", "public Vector normalize ( );", "public boolean isNormal()\n\t{\n\t\treturn !( isBold || isItalic );\n\t}", "public void setMoles(Component nu, double N) {\n int index = nu.index();\n NT += N - this.N[index];\n this.N[index] = N;\n }", "public Vector2D normalize() \n {\n \tfloat length = getLength();\n if (length != 0.0f) \n {\n this.setX(this.getX() / length);\n this.setY(this.getY() / length);\n } \n else \n {\n this.setX(0.0f);\n this.setY(0.0f);\n }\n return this;\n }", "public void setMass(Bounds[] bounds)\n\t{\n\t\tfloat mass = 0;\n\t\tfor (Bounds b : bounds) {\n\t\t\tmass += b.getOvalArea();\n\t\t}\n\t\tthis.mass = mass;\n\t}", "public NormalGen (RandomStream s, double mu, double sigma) {\n super (s, new NormalDist(mu, sigma));\n setParams (mu, sigma);\n }", "private void parseNormal(String line) {\n\n String first_float = line.substring(2);\n int second_space_index = first_float.indexOf(' ') + 1;\n String second_float = first_float.substring(second_space_index);\n int third_space_index = second_float.indexOf(' ') + 1;\n\n float vx = parseFloat(first_float.substring(0, second_space_index - 1));\n float vy = parseFloat(second_float.substring(0, third_space_index - 1));\n float vz = parseFloat(second_float.substring(third_space_index));\n\n mNormals.add(vx);\n mNormals.add(vy);\n mNormals.add(vz);\n }", "public void makeOrthnormalBasisWithProvided(Vector3 a, Vector3 b, Vector3 c) {\n\t\ta.normalize();\n\t\tc.setAsSelf(a.vectorProduct(b));\n\t\tif(c.squareMagnitude() == 0) return;\n\t\tc.normalize();\n\t\tb.setAsSelf(c.vectorProduct(a));\n\t}", "public void beginScaling() {\n xScale = 1.0f;\n yScale = 1.0f;\n }", "public Vector3 getNormal() {\n\t\tdouble mag = this.magnitude();\n\t\tif (mag > 0) {\n\t\t\treturn new Vector3(\n\t\t\t\t\tthis.x/mag,\n\t\t\t\t\tthis.y/mag,\n\t\t\t\t\tthis.z/mag\n\t\t\t\t\t);\n\t\t} else {\n\t\t\treturn new Vector3();\n\t\t}\n\t}", "public void calcNormal() {\n nx = y2 - y1;\n ny = x1 - x2;\n }", "void unsetNextrun();", "@Override\n\tpublic void setRam() {\n\t\tcom.setRam(\"16g\");\n\t}", "public java.lang.String getNormalValue() {\n\t\treturn normalValue;\n\t}", "public Vector330Class normalize(){\n if(this.magnitude() <= EPS){\n return new Vector330Class(0, 0);\n }\n else{\n return new Vector330Class(this.x * (1/this.magnitude()), this.y * (1/this.magnitude()));\n }\n }", "public void resetWorld(){\r\n\t\tSystem.out.println(\"Resetting world\");\r\n\t\tengine.removeAllEntities();\r\n\t\tlvlFactory.resetWorld();\r\n\t\t\r\n\t\tplayer = lvlFactory.createPlayer(cam);\r\n\t\tlvlFactory.createFloor();\r\n lvlFactory.createWaterFloor();\r\n \r\n int wallWidth = (int) (1*RenderingSystem.PPM);\r\n int wallHeight = (int) (60*RenderingSystem.PPM);\r\n TextureRegion wallRegion = DFUtils.makeTextureRegion(wallWidth, wallHeight, \"222222FF\");\r\n lvlFactory.createWalls(wallRegion); //TODO make some damn images for this stuff \r\n \r\n // reset controller controls (fixes bug where controller stuck on directrion if died in that position)\r\n controller.left = false;\r\n controller.right = false;\r\n controller.up = false;\r\n controller.down = false;\r\n controller.isMouse1Down = false;\r\n controller.isMouse2Down = false;\r\n controller.isMouse3Down = false;\r\n\t\t\r\n\t}", "public void setSpacing(double space) {\n\tthis.space = space;\n }" ]
[ "0.6370962", "0.6340847", "0.619102", "0.59531355", "0.56331074", "0.56122154", "0.55573285", "0.55284035", "0.550791", "0.54759514", "0.54586816", "0.54183656", "0.5399614", "0.53654873", "0.53090125", "0.5304543", "0.5298762", "0.5252776", "0.5248543", "0.5216083", "0.5214511", "0.51896745", "0.51689637", "0.5166386", "0.51544994", "0.5154022", "0.51456237", "0.5143381", "0.51272905", "0.51255375", "0.51242656", "0.51065034", "0.50844234", "0.50785846", "0.50582", "0.50333375", "0.50314116", "0.50250983", "0.50124055", "0.5009869", "0.5009869", "0.49994802", "0.49815622", "0.4980985", "0.49640563", "0.49503857", "0.49389702", "0.49185154", "0.488307", "0.48572806", "0.48456857", "0.48428625", "0.48377913", "0.4800235", "0.47928825", "0.47837144", "0.4779804", "0.47574985", "0.4752672", "0.47476745", "0.47445357", "0.4741208", "0.47358698", "0.4734644", "0.47243252", "0.4721555", "0.471398", "0.47128725", "0.47122338", "0.4709997", "0.4697435", "0.4696561", "0.46949208", "0.46922123", "0.46851358", "0.4684825", "0.46823582", "0.46806693", "0.46800995", "0.46612117", "0.46607283", "0.46592033", "0.46565682", "0.4656148", "0.46516088", "0.46486884", "0.4646003", "0.4641438", "0.46362573", "0.46302968", "0.46297783", "0.4628267", "0.46282178", "0.46217936", "0.4616168", "0.4607261", "0.46061862", "0.4598997", "0.45941243", "0.45908433" ]
0.69033456
0
////////////////////////////////////////////////////////////////////// Description: Sets the objectspace texture coordinates. Use: extender
public void setObjectTextureCoords(final SbVec4f texCoords) // //////////////////////////////////////////////////////////////////////// { // Transform the object space coords by the current texture matrix // to get the image space texture coords imageTexCoords.copyFrom( multVecMatrix4(SoMultiTextureMatrixElement.get(state,0), texCoords)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setTexture(TextureRegion region) {\n \ttexture = region;\n \torigin = new Vector2(texture.getRegionWidth()/2.0f,texture.getRegionHeight()/2.0f);\n }", "public void setTextureCoordC(E3DVector2F textureCoord){\r\n this.vertices[2].setTextureCoord(textureCoord);\r\n }", "public void setTextureCoordA(E3DVector2F textureCoord){\r\n this.vertices[0].setTextureCoord(textureCoord);\r\n }", "public void setTextureCoordB(E3DVector2F textureCoord){\r\n this.vertices[1].setTextureCoord(textureCoord);\r\n }", "public void setTextureCoordsBuffer(ByteBuffer coords) {\n this.texCoordsBuf = coords;\n }", "@Override\n\tpublic void setTexture(int texID) {\n\n\t}", "public void setTextureCoord(E3DVector2F textureCoordA, E3DVector2F textureCoordB, E3DVector2F textureCoordC)\r\n {\r\n vertices[0].setTextureCoord(textureCoordA);\r\n vertices[1].setTextureCoord(textureCoordB);\r\n vertices[2].setTextureCoord(textureCoordC);\r\n }", "void addTextureCoordinate(Vector t);", "public void onUpdateTextureCoordinates() {\n getVertexBufferObject().onUpdateTextureCoordinates(this);\n }", "public void setTexture(PImage image) {\n //m_tImage = image;\n m_texture = image.pixels;\n TEX_WIDTH = image.width;\n TEX_HEIGHT = image.height;\n F_TEX_WIDTH = TEX_WIDTH-1;\n F_TEX_HEIGHT = TEX_HEIGHT-1;\n INTERPOLATE_UV = true;\n \n if (image.format == ARGB) {\n m_drawFlags |= R_TEXTURE32;\n } else if (image.format == RGB) {\n m_drawFlags |= R_TEXTURE24;\n } else if (image.format == ALPHA) {\n m_drawFlags |= R_TEXTURE8;\n }\n }", "public void setTextureCoordDetail0A(E3DVector2F textureCoord){\r\n this.vertices[0].setTextureCoordDetail0(textureCoord);\r\n }", "private void renderTex() {\n final float\n w = xdim(),\n h = ydim(),\n x = xpos(),\n y = ypos() ;\n GL11.glBegin(GL11.GL_QUADS) ;\n GL11.glTexCoord2f(0, 0) ;\n GL11.glVertex2f(x, y + (h / 2)) ;\n GL11.glTexCoord2f(0, 1) ;\n GL11.glVertex2f(x + (w / 2), y + h) ;\n GL11.glTexCoord2f(1, 1) ;\n GL11.glVertex2f(x + w, y + (h / 2)) ;\n GL11.glTexCoord2f(1, 0) ;\n GL11.glVertex2f(x + (w / 2), y) ;\n GL11.glEnd() ;\n }", "public void setTextureCoordDetail0C(E3DVector2F textureCoord){\r\n this.vertices[2].setTextureCoordDetail0(textureCoord);\r\n }", "public void setTexture(String texture) {\n this.texture = texture;\n }", "public void setTexture(int index, Texture texture)\n\t{\n\t\tif (tmpReg == null)\n\t\t\ttmpReg = new TextureRegion[textures.length];\n\t\tif (tmpReg[index] == null) //minimize object creation since a lot of users will use this every frame\n\t\t\ttmpReg[index] = new TextureRegion();\n\t\ttmpReg[index].setRegion(texture);\n\t\tsetTexture(index, tmpReg[index]);\n\t}", "public void setTexture(int set_texture) {\n\t\ttexture = set_texture;\n\t}", "public void setTextureCoordDetail0B(E3DVector2F textureCoord){\r\n this.vertices[1].setTextureCoordDetail0(textureCoord);\r\n }", "void glBindTexture(int target, int texture);", "public native void setTexturePath ( String texturePath );", "private void setupTexture() {\n GLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n GLES20.glGenTextures(1, textures, 0);\n checkGlError(\"Texture generate\");\n\n GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, textures[0]);\n checkGlError(\"Texture bind\");\n\n videoTexture = new SurfaceTexture(textures[0]);\n videoTexture.setOnFrameAvailableListener(this);\n }", "public void setTextureCoordDetail0(E3DVector2F textureCoordA, E3DVector2F textureCoordB, E3DVector2F textureCoordC)\r\n {\r\n vertices[0].setTextureCoordDetail0(textureCoordA);\r\n vertices[1].setTextureCoordDetail0(textureCoordB);\r\n vertices[2].setTextureCoordDetail0(textureCoordC);\r\n }", "public static boolean render(int coordX, int coordY, int coordZ, int texture, Texture[] textureMap) {\r\n GL11.glTranslatef(coordX, coordY, coordZ); // Absolute position in game\r\n// GL11.glRotatef(xrot, 1.0f, 0.0f, 0.0f); // Rotate On The X Axis\r\n// GL11.glRotatef(yrot, 0.0f, 1.0f, 0.0f); // Rotate On The Y Axis\r\n// GL11.glRotatef(zrot, 0.0f, 0.0f, 1.0f); // Rotate On The Z Axis\r\n GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureMap[texture].getTextureID()); // Select Our Texture\r\n GL11.glBegin(GL11.GL_QUADS);\r\n // Front Face\r\n GL11.glTexCoord2f(0.0f, 0.0f);\r\n GL11.glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 0.0f);\r\n GL11.glVertex3f(1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 1.0f);\r\n GL11.glVertex3f(1.0f, 1.0f, 1.0f); // Top Right Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 1.0f);\r\n GL11.glVertex3f(-1.0f, 1.0f, 1.0f); // Top Left Of The Texture and Quad\r\n // Back Face\r\n GL11.glTexCoord2f(1.0f, 0.0f);\r\n GL11.glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Right Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 1.0f);\r\n GL11.glVertex3f(-1.0f, 1.0f, -1.0f); // Top Right Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 1.0f);\r\n GL11.glVertex3f(1.0f, 1.0f, -1.0f); // Top Left Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 0.0f);\r\n GL11.glVertex3f(1.0f, -1.0f, -1.0f); // Bottom Left Of The Texture and Quad\r\n // Top Face\r\n GL11.glTexCoord2f(0.0f, 1.0f);\r\n GL11.glVertex3f(-1.0f, 1.0f, -1.0f); // Top Left Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 0.0f);\r\n GL11.glVertex3f(-1.0f, 1.0f, 1.0f); // Bottom Left Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 0.0f);\r\n GL11.glVertex3f(1.0f, 1.0f, 1.0f); // Bottom Right Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 1.0f);\r\n GL11.glVertex3f(1.0f, 1.0f, -1.0f); // Top Right Of The Texture and Quad\r\n // Bottom Face\r\n GL11.glTexCoord2f(1.0f, 1.0f);\r\n GL11.glVertex3f(-1.0f, -1.0f, -1.0f); // Top Right Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 1.0f);\r\n GL11.glVertex3f(1.0f, -1.0f, -1.0f); // Top Left Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 0.0f);\r\n GL11.glVertex3f(1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 0.0f);\r\n GL11.glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and Quad\r\n // Right face\r\n GL11.glTexCoord2f(1.0f, 0.0f);\r\n GL11.glVertex3f(1.0f, -1.0f, -1.0f); // Bottom Right Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 1.0f);\r\n GL11.glVertex3f(1.0f, 1.0f, -1.0f); // Top Right Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 1.0f);\r\n GL11.glVertex3f(1.0f, 1.0f, 1.0f); // Top Left Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 0.0f);\r\n GL11.glVertex3f(1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and Quad\r\n // Left Face\r\n GL11.glTexCoord2f(0.0f, 0.0f);\r\n GL11.glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Left Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 0.0f);\r\n GL11.glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and Quad\r\n GL11.glTexCoord2f(1.0f, 1.0f);\r\n GL11.glVertex3f(-1.0f, 1.0f, 1.0f); // Top Right Of The Texture and Quad\r\n GL11.glTexCoord2f(0.0f, 1.0f);\r\n GL11.glVertex3f(-1.0f, 1.0f, -1.0f); // Top Left Of The Texture and Quad\r\n GL11.glEnd();\r\n\r\n// xrot += 0.3f; // X Axis Rotation\r\n// yrot += 0.2f; // Y Axis Rotation\r\n// zrot += 0.4f; // Z Axis Rotation\r\n\r\n return true;\r\n }", "public float[] getTextureCoords() {\r\n\t\treturn textureCoords;\r\n\t}", "public void testGetSetTexCoords() {\r\n\r\n SXRMesh sxrMesh = TestDefaultSXRViewManager.mSXRContext.getAssetLoader().loadMesh(UtilResource.androidResource(TestDefaultSXRViewManager.mSXRContext,R.raw.cylinder3));\r\n float[] coords = {0.5f, 0.5f, 0.0f, 0.5f};\r\n sxrMesh.setTexCoords(coords);\r\n assertEquals(4,sxrMesh.getTexCoords().length);\r\n float[] coords2 = {0.5f, 0.5f, 0.0f, 0.5f,0.5f};\r\n try {\r\n sxrMesh.setTexCoords(coords2);\r\n fail(\"should throws IllegalArgumentException\");\r\n }catch (IllegalArgumentException e){}\r\n }", "public ModelTexture(int textureID) {\n this.textureID = textureID;\n }", "public void setTexture(int index, TextureRegion coords)\n\t{\n\t\t//if we are drawing and the new texcoords TEXTURE doesn't match the old one\n\t\tif (drawing && this.textures[index] != null && this.textures[index].getTexture() != coords.getTexture())\n\t\t\tflush();\n\t\tthis.textures[index] = coords;\n\t}", "@ThreadOpenGL\n public void glTexCoord2f()\n {\n GL11.glTexCoord2f(this.x, this.y);\n }", "private void\nsetUpDefaultCoordSpace(SoAction action)\n//\n////////////////////////////////////////////////////////////////////////\n{\n SoNode tail = action.getCurPathTail();\n//#ifdef DEBUG\n// if (!tail->isOfType(SoShape::getClassTypeId())) {\n// SoDebugError::post(\n// \"SoTextureCoordinateBundle::setUpDefaultCoordSpace\",\n// \"Tail of path is not a shape node!\");\n// }\n//#endif\n SoShape shape = (SoShape )tail;\n\n final SbBox3f box = new SbBox3f();\n final SbVec3f center = new SbVec3f();\n shape.computeBBox(action, box, center);\n\n final SbVec3f min = box.getMin();\n final SbVec3f boxSize = box.getMax().operator_minus(min);\n\n // Look for the largest two dimensions of the box\n if (boxSize.getValueRead()[0] > boxSize.getValueRead()[1] && boxSize.getValueRead()[0] > boxSize.getValueRead()[2]) {\n coordS = 0;\n coordT = boxSize.getValueRead()[1] > boxSize.getValueRead()[2] ? 1 : 2;\n }\n else if (boxSize.getValueRead()[1] > boxSize.getValueRead()[2]) {\n coordS = 1;\n coordT = boxSize.getValueRead()[0] > boxSize.getValueRead()[2] ? 0 : 2;\n }\n else {\n coordS = 2;\n coordT = boxSize.getValueRead()[0] > boxSize.getValueRead()[1] ? 0 : 1;\n }\n\n // Set up vectors for S and T coordinates. The length of the\n // vectors should be the size of the box in that dimension. Since\n // we want the texture to remain square, we use the same length\n // for both dimensions.\n float tmp = 1.0f / boxSize.getValueRead()[coordS];\n sVector.setValue(0.0f, 0.0f, 0.0f, -min.getValueRead()[coordS] * tmp);\n tVector.setValue(0.0f, 0.0f, 0.0f, -min.getValueRead()[coordT] * tmp);\n sVector.getValue()[coordS] = tVector.getValue()[coordT] = tmp;\n}", "public void texCoord(TexCoordType p)\r\n\t{\r\n\t // System.out.println(\"tex: \"+p.x+\", \"+p.y);\r\n\t\tgl.glTexCoord2d(p.x, p.y);\t\t\r\n\t}", "private void\nsetUpForGLRender(SoAction action)\n//\n////////////////////////////////////////////////////////////////////////\n{\n int unit = SoTextureUnitElement.get(action.getState()); // COIN 3D YB\t\n\t\n if (! SoGLMultiTextureEnabledElement.get(action.getState(),unit))\n needCoords = isFunc = false;\n\n else {\n // Access a GL version of the element for sending texture\n // coordinates to GL\n texCoordElt = SoMultiTextureCoordinateElement.getInstance(state);\n GLTexCoordElt = ( SoGLMultiTextureCoordinateElement ) texCoordElt;\n\n switch (GLTexCoordElt.getType(unit)) {\n\n \tcase DEFAULT:\n this.initDefault(action);\n break;\n case EXPLICIT:\n if (GLTexCoordElt.getNum(unit) > 0) {\n needCoords = true;\n isFunc = false;\n } else {\n // Set up the default coordinate function before it is\n // used by the SoGLTextureCoordinateElement\n setUpDefaultCoordSpace(action);\n\n // Set up a texture coordinate function that will do the\n // correct tex gen stuff. We need to do this through the\n // element so the state can be restored correctly.\n state.push();\n setFunction = true;\n SoNode currentNode = action.getCurPathTail();\n SoGLMultiTextureCoordinateElement.\n setTexGen(state, currentNode, setUpTexGenCB, this,\n generateCoordCB, this);\n\n // Get the new instance in here\n texCoordElt = SoMultiTextureCoordinateElement.getInstance(state);\n GLTexCoordElt = ( SoGLMultiTextureCoordinateElement )\n texCoordElt;\n\n\n // No longer need coordinates, since texgen does the job\n needCoords = false;\n\n // Set this flag to true so that if we are using primitive\n // generation to do the rendering, we can tell that we\n // have a function to use\n isFunc = true;\n }\n break;\n\n case FUNCTION:\n//#ifdef DEBUG\n// SoDebugError.post(\n// \"SoTextureCoordinateBundle.setUpForGLRender\",\n// \"GLTextureCoordinateElement is FUNCTION!\");\n//#endif\n needCoords = isFunc = false;\n break;\n }\n }\n}", "public void setParticleTextureIndex(int p_70536_1_) {\n/* 232 */ if (getFXLayer() != 0)\n/* */ {\n/* 234 */ throw new RuntimeException(\"Invalid call to Particle.setMiscTex\");\n/* */ }\n/* */ \n/* */ \n/* 238 */ this.particleTextureIndexX = p_70536_1_ % 16;\n/* 239 */ this.particleTextureIndexY = p_70536_1_ / 16;\n/* */ }", "public void setTextureCoordDetail1A(E3DVector2F textureCoord){\r\n\t\tthis.vertices[0].setTextureCoordDetail1(textureCoord);\r\n\t}", "@Override\n\tpublic void draw(Batch batch) {\n\t\tbatch.draw(textureRegion, super.getPosition().x, super.getPosition().y);\n\t}", "public void setTextureVertice(int i, Vertice uv) {\n\t\t(textureVertices.get(i)).set(uv);\n\t}", "public ModelTexture(int id) {\r\n\t\tthis.textureID = id;\r\n\t}", "public void setTextureCoordDetail1(E3DVector2F textureCoordA, E3DVector2F textureCoordB, E3DVector2F textureCoordC)\r\n\t{\r\n vertices[0].setTextureCoordDetail1(textureCoordA);\r\n vertices[1].setTextureCoordDetail1(textureCoordB);\r\n vertices[2].setTextureCoordDetail1(textureCoordC);\r\n\t}", "public static float[] createQuadTextureCoords() {\n float[] tex = new float[]{0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f};\n return tex;\n }", "public void backBufferIntoTexture()\r\n\t{\r\n\t\tgl.glEnable(GL_TEXTURE_2D);\r\n\t\tgl.glShadeModel(GL_FLAT);\r\n\t\tif (InternalTexture[0] == 0) {\r\n\t\t\tgl.glGenTextures(1,InternalTexture);\r\n\t\t\tSystem.out.print(\"Initializing internal texture \"+InternalTexture[0]+\":[\"+getWidth()+\",\"+getHeight()+\"]\\n\");\r\n\t\t\tgl.glBindTexture(GL_TEXTURE_2D, InternalTexture[0]);\r\n\t\t\tgl.glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, this.getWidth(), this.getHeight(), 0);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tgl.glBindTexture(GL_TEXTURE_2D, InternalTexture[0]);\r\n\t\t\tgl.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, this.getWidth(), this.getHeight());\r\n\t\t}\r\n\t\tglut.glutReportErrors();\r\n\t}", "public void setTextureCoordDetail1C(E3DVector2F textureCoord){\r\n\t\tthis.vertices[2].setTextureCoordDetail1(textureCoord);\r\n\t}", "public void setTextureCoordDetail1B(E3DVector2F textureCoord){\r\n\t\tthis.vertices[1].setTextureCoordDetail1(textureCoord);\r\n\t}", "@Override\n\tpublic void render(Vector2 position, float rotation, Vector2 scale) {\n glPushMatrix();\n // bind to the appropriate texture for this sprite\n texture.bind();\n \n // translate to the right location and prepare to draw\n renderFullScale.set(scale).mul(internalScale);\n renderOffset.set(halfSize).mul(renderFullScale);\n \n glTranslatef(position.x - topLeft.x * renderFullScale.x - renderOffset.x, position.y + topLeft.y * renderFullScale.y + renderOffset.y, 0);\n glScalef(renderFullScale.x, -renderFullScale.y, 1.0f);\n glRotatef(rotation, 0, 0, 1.0f);\n \n // draw a quad textured to match the sprite\n glBegin(GL_QUADS);\n {\n glTexCoord2f(topLeft.x, topLeft.y);\n glVertex2f(topLeft.x, topLeft.y);\n \n glTexCoord2f(topLeft.x, botRight.y);\n glVertex2f(topLeft.x, botRight.y);\n \n glTexCoord2f(botRight.x, botRight.y);\n glVertex2f(botRight.x, botRight.y);\n \n glTexCoord2f(botRight.x, topLeft.y);\n glVertex2f(botRight.x, topLeft.y); \n }\n glEnd();\n \n // restore the model view matrix to prevent contamination\n glPopMatrix();\n\t}", "void glActiveTexture(int texture);", "void glActiveTexture(int texture);", "public void SetID(int id) {\n TextureID = id;\n }", "public void setUV(float u0, float v0,\n float u1, float v1,\n float u2, float v2) {\n // sets & scales uv texture coordinates to center of the pixel\n u_array[0] = (u0 * F_TEX_WIDTH + 0.5f) * 65536f;\n u_array[1] = (u1 * F_TEX_WIDTH + 0.5f) * 65536f;\n u_array[2] = (u2 * F_TEX_WIDTH + 0.5f) * 65536f;\n v_array[0] = (v0 * F_TEX_HEIGHT + 0.5f) * 65536f;\n v_array[1] = (v1 * F_TEX_HEIGHT + 0.5f) * 65536f;\n v_array[2] = (v2 * F_TEX_HEIGHT + 0.5f) * 65536f;\n }", "public void setTexture(Bitmap texture) {\n photo = texture;\n int alt = texture.getWidth();\n int ample = texture.getHeight();\n int max = Math.max(alt, ample);\n float ratio = (float) ample / (float) alt;\n if (max > limit) {\n if (max == ample) {\n photoWidth = limit;\n photoHeight = (int) (limit * ratio);\n } else if (max == alt) {\n photoWidth = (int) (limit / ratio);\n photoHeight = limit;\n }\n }\n }", "public SbVec4f\ngetObjectTextureCoords(final SoNode node)\n//\n////////////////////////////////////////////////////////////////////////\n{\n return multVecMatrix4(getImageToObject(node), imageTexCoords);\n}", "@Override\n\tprotected ResourceLocation getEntityTexture(Entity entity) {\n\t\treturn texture;\n\t}", "public void renderTexture(GuiTexture texture, float minX, float minY, float maxX, float maxY) {\n\t\t\tif (minX <= 1 && minY <= 1 && maxX >= 0 && maxY >= 0)\n\t\t\t\tparent.renderTexture(texture, this.minX + minX * deltaX, this.minY + minY * deltaY, this.minX + maxX * deltaX, this.minY + maxY * deltaY);\n\t\t}", "public void func_180435_a(TextureAtlasSprite p_180435_1_) {\n/* 215 */ int var2 = getFXLayer();\n/* */ \n/* 217 */ if (var2 == 1) {\n/* */ \n/* 219 */ this.particleIcon = p_180435_1_;\n/* */ }\n/* */ else {\n/* */ \n/* 223 */ throw new RuntimeException(\"Invalid call to Particle.setTex, use coordinate methods\");\n/* */ } \n/* */ }", "public void setSurfaceTexture(SurfaceTexture surfaceTexture) {\r\n Surface surface = null;\r\n mSurfaceTexture = surfaceTexture;\r\n if (surfaceTexture != null)\r\n surface = new Surface(mSurfaceTexture);\r\n setSurface(surface);\r\n }", "public void setTransform(float a11, float a12, float a21, float a22, float x, float y);", "public ResourceLocation getEntityTexture(T entity) {\n return MINECART_TEXTURES;\n }", "public void bind()\n {\n glBindTexture(GL_TEXTURE_2D, texture);\n }", "@Override\n public void loadTexture() {\n\n }", "public void draw(int texture){\n\t\tGLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);\n\t\tGLES20.glUseProgram(program);\n\t\tGLES20.glDisable(GLES20.GL_BLEND);\n\n\t\tint positionHandle = GLES20.glGetAttribLocation(program, \"aPosition\");\n\t\tint textureHandle = GLES20.glGetUniformLocation(program, \"uTexture\");\n\t\tint texturePositionHandle = GLES20.glGetAttribLocation(program, \"aTexPosition\");\n\n\t\tGLES20.glVertexAttribPointer(texturePositionHandle, 2, GLES20.GL_FLOAT, false, 0, textureBuffer);\n\t\tGLES20.glEnableVertexAttribArray(texturePositionHandle);\n\n\t\tGLES20.glActiveTexture(GLES20.GL_TEXTURE0);\n\t\tGLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texture);\n\t\tGLES20.glUniform1i(textureHandle, 0);\n\n\t\tGLES20.glVertexAttribPointer(positionHandle, 2, GLES20.GL_FLOAT, false, 0, verticesBuffer);\n\t\tGLES20.glEnableVertexAttribArray(positionHandle);\n\n\t\tGLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);\n\t\tGLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);\n\t}", "public void renderTexture(GuiTexture texture, float minX, float minY, float maxX, float maxY) {\n\t\t\tif (minX <= 1 && minY <= 1 && maxX >= 0 && maxY >= 0)\n\t\t\t\tstate.parent().renderTexture(texture, state.minX() + state.deltaX() * minX, state.minY() + state.deltaY() * minY, state.minX() + state.deltaX() * maxX, state.minY() + state.deltaY() * maxY);\n\t\t}", "public void setPosition(float x, float y);", "public void setLocation(float x, float y);", "protected void updateUniforms()\n\t{\n\t\tsuper.updateUniforms();\n\t\tfor (int i = 0; i < getTexCoordCount(); i++)\n\t\t{\n\t\t\tint loc = shader.getUniformLocation(U_TEXTURE + i);\n\t\t\tif (loc != -1)\n\t\t\t\tshader.setUniformi(loc, i);\n\t\t}\n\t}", "public void setUpTextures(int program, GL2 gl2) {\n\t\t// sets the parameters for texture\n\t\tgl2.glGenTextures(1, buffer);\n\t\tgl2.glActiveTexture(gl2.GL_TEXTURE0);\n\t\tgl2.glBindTexture(gl2.GL_TEXTURE_2D,\n\t\t\t\tgl2.glGetUniformLocation(program, \"abc\"));\n\t\tgl2.glTexParameteri(gl2.GL_TEXTURE_2D, gl2.GL_TEXTURE_MIN_FILTER,\n\t\t\t\tgl2.GL_LINEAR);\n\t\tgl2.glTexParameteri(gl2.GL_TEXTURE_2D, gl2.GL_TEXTURE_MAG_FILTER,\n\t\t\t\tgl2.GL_LINEAR);\n\t\tgl2.glTexImage2D(gl2.GL_TEXTURE_2D, 0, gl2.GL_RGBA,\n\t\t\t\tbufferimage.getWidth(), bufferimage.getHeight(), 0,\n\t\t\t\tgl2.GL_BGRA, gl2.GL_UNSIGNED_BYTE, buffer);\n\t}", "public Texture(int target, int textureID) {\n\tthis.target = target;\n\tthis.textureID = textureID;\n }", "void texImage2D(int target, int level, int resourceId, int border);", "public void setTexture(int side, TextureComponent2D srcImage)\n throws InvalidWriteTimingException\n {\n if(isLive() && updateHandler != null &&\n !updateHandler.isDataWritePermitted(this))\n throw new InvalidWriteTimingException(getDataWriteTimingMessage());\n\n texture[side] = srcImage;\n stateChanged = true;\n }", "private void setSpritesPosition()\r\n\t{\r\n\t\tfloat w = Gdx.graphics.getWidth();\r\n\t\tfloat h = Gdx.graphics.getHeight();\r\n\t\t\r\n\t\tsetX(camera.position.x-camera.viewportWidth/2 + 0.1f * camera.viewportWidth/2);\r\n\t\tsetY(camera.position.y + camera.viewportHeight/2 - 0.15f*w/h* camera.viewportHeight/2);\r\n\t\theroHealth.setX(getX());\r\n\t\theroHealth.setY(getY());\r\n\t\t\r\n\t\tcover.setX(getX() + 10f/270f * heroHealth.getWidth());\r\n\t\tcover.setY(getY());\r\n\t\t\r\n\t}", "public void setTextureWidth(int texWidth) {\n\tthis.texWidth = texWidth;\n\tcalculateWidthRatio();\n }", "public void setTextureHeight(int texHeight) {\n\tthis.texHeight = texHeight;\n\tcalculateHeightRatio();\n }", "public void setPosition(float x, float y){\n\t\t\n\t\tsprite.setPosition(x, y);\n\t}", "public final native void setTexturePath(String path)/*-{\r\n\tthis.setTexturePath(path);\r\n\t}-*/;", "public void loadGLTexture(GL10 gl, Location location)\n\t{\n\t\tgl.glGenTextures(2, textures, 0);\n\n\t\t// loading texture\n\t\tBitmap bitmap;\n\t\tfloat width;\n\t\tfloat height;\n\n\n\t\t// ...and bind it to our array\n\t\tgl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]);\n\n\t\t// create nearest filtered texture\n\t\tgl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST);\n\t\tgl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);\n\n\t\t// loading texture\n\t\tif (location != null){\n\t\t\tdouble longitude = location.getLongitude();\n\t\t\tif (longitude > 0)\n\t\t\t\tbitmap = GraphicUtil.getLngLatBitmap(\"LON\" + \" E\" + df.format(Math.abs(longitude)) );\n\t\t\telse if (longitude < 0)\n\t\t\t\tbitmap = GraphicUtil.getLngLatBitmap(\"LON\" + \" W\" + df.format(Math.abs(longitude)) );\n\t\t\telse\n\t\t\t\tbitmap = GraphicUtil.getLngLatBitmap(\"LON\" + \" \" + \"000.0000\" );\n\t\t}\n\t\telse\n\t\t\tbitmap = GraphicUtil.getLngLatBitmap(\"LON\" + \" \" + \"000.0000\");\n\n\t\t// Use Android GLUtils to specify a two-dimensional texture image from our bitmap\n\t\tGLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);\n\n\t\t// calculate the bitmap's size respectively to the size of the screen \n\t\twidth = bitmap.getWidth() / 1000f * FONT_SIZE;\n\t\theight = bitmap.getHeight() / 1000f * FONT_SIZE;\n\n\t\t//Log.v(TAG , \"width : \" + width + \" , height : \" + height );\n\n\t\t// resize the vertices according to the size of the bitmap\n\t\tvertices_long[0] = LONGITUDE_POINT - width; // left\n\t\tvertices_long[3] = LONGITUDE_POINT - width; // left\n\t\tvertices_long[1] = VERTICAL_POINT - height;// bottom\n\t\tvertices_long[7] = VERTICAL_POINT - height;// bottom\n\n\t\t// Clean up\n\t\tbitmap.recycle();\n\n\t\t// ...and bind it to our array\n\t\tgl.glBindTexture(GL10.GL_TEXTURE_2D, textures[1]);\n\n\t\t// create nearest filtered texture\n\t\tgl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST);\n\t\tgl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);\n\n\t\t// loading texture\n\t\tif (location != null){\n\t\t\tdouble latitude = location.getLatitude();\n\t\t\tif (latitude > 0)\n\t\t\t\tbitmap = GraphicUtil.getLngLatBitmap(\"LAT\" + \" N\" + df.format(Math.abs(latitude)) );\n\t\t\telse if (latitude < 0)\n\t\t\t\tbitmap = GraphicUtil.getLngLatBitmap(\"LAT\" + \" S\" + df.format(Math.abs(latitude)) );\n\t\t\telse\n\t\t\t\tbitmap = GraphicUtil.getLngLatBitmap(\"LAT\" + \" \" + \"000.0000\" );\n\t\t}\n\t\telse\n\t\t\tbitmap = GraphicUtil.getLngLatBitmap(\"LAT\" + \" \" + \"000.0000\");\n\n\t\t// Use Android GLUtils to specify a two-dimensional texture image from our bitmap\n\t\tGLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);\n\n\t\t// calculate the bitmap's size respectively to the size of the screen \n\t\twidth = bitmap.getWidth() / 1000f * FONT_SIZE;\n\t\theight = bitmap.getHeight() / 1000f * FONT_SIZE;\n\n\t\t//Log.v(TAG , \"width : \" + width + \" , height : \" + height );\n\n\t\t// resize the vertices according to the size of the bitmap\n\t\tvertices_lat[6] = LATITUDE_POINT + width; // right\n\t\tvertices_lat[9] = LATITUDE_POINT + width; // right\n\t\tvertices_lat[1] = VERTICAL_POINT - height;// bottom\n\t\tvertices_lat[7] = VERTICAL_POINT - height;// bottom\n\n\t\t// Clean up\n\t\tbitmap.recycle(); \n\t}", "public void bind() {\n if (isTextureLoaded()) {\n glBindTexture(GL_TEXTURE_2D, texId.getId());\n } else {\n System.err.println(\"[Error] texture::bind() Binding a unloaded texture.\");\n }\n }", "Actor(int x, int y, Texture image) {\n this.setX(x);\n this.setY(y);\n setImage(image);\n }", "void setXandY(double x, double y){\r\n\t\tthis.x=x;\r\n\t\tthis.y=y;\r\n\t}", "public ByteBuffer getTextureCoordsBuffer() {\n return texCoordsBuf;\n }", "public Texture set(Texture src) {\n memCopy(src.address(), address(), SIZEOF);\n return this;\n }", "public void draw() {\t\t\n\t\ttexture.draw(x, y);\n\t\tstructure.getTexture().draw(x,y);\n\t}", "protected void initRender() {\n glActiveTexture(GL_TEXTURE0);\n // Bind the texture\n glBindTexture(GL_TEXTURE_2D, texture.getId());\n\n // Draw the mesh\n glBindVertexArray(vaoId);\n glEnableVertexAttribArray(0);\n glEnableVertexAttribArray(1);\n }", "private void setParam(int param, int value) {\n bind();\n glTexParameteri(GL_TEXTURE_2D, param, value);\n }", "@Override\n\t\tprotected ResourceLocation getEntityTexture(EntityLivingBase entity) {\n\t\t\treturn texture;\n\t\t}", "@Override\n\tpublic void SetCoord(double x, double y) {\n\t\t// TODO Auto-generated method stub\n\t\t\n\t}", "public void setTargetPosition(float x, float y){\r\n this.targetX = x;\r\n this.targetY = y;\r\n }", "void setPosition (DVector3C xyz);", "private void setGeometry() {\n this.setCullHint(Spatial.CullHint.Dynamic);\n this.setLocalTranslation(realPosition);\n //attach geometry to this object\n // mat.setColor(\"Color\", colors[r.nextInt(colors.length)]);\n if (!companyTextures.containsKey(this.company)) {\n mat.setTexture(\"ColorMap\", Colors.get(r.nextInt(Colors.size())));\n } else {\n mat.setTexture(\"ColorMap\", companyTextures.get(this.company));\n }\n geom.setMaterial(mat);\n this.attachChild(geom.clone());\n }", "public void setCoord(short xPos , short yPos ){\n this.xPos = xPos;\n this.yPos = yPos;\n }", "private void rotateSkybox() {\n\t\tthis.mc.getTextureManager().bindTexture(this.field_110351_G);\n\t\tGL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);\n\t\tGL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);\n\t\tGL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256);\n\t\tGlStateManager.enableBlend();\n\t\tGlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);\n\t\tGlStateManager.colorMask(true, true, true, false);\n\t\tTessellator var2 = Tessellator.getInstance();\n\t\tWorldRenderer var3 = var2.getWorldRenderer();\n\t\tvar3.startDrawingQuads();\n\t\tGlStateManager.disableAlpha();\n\t\tbyte var4 = 3;\n\n\t\tvar2.draw();\n\t\tGlStateManager.enableAlpha();\n\t\tGlStateManager.colorMask(true, true, true, true);\n\t}", "public Texture() {\n }", "public void setUnitVector(double x, double y)\n {\n unitVector.setVector(new double [] {x,y}, true);\n }", "@Override\n\tpublic int getTexture() {\n\t\treturn 0;\n\t}", "@Override\n\tpublic void initialize(int textMapWidth, int textMapHeight,\n\t\t\tint textureBlockPixWidth, int textureBlockPixHeight,\n\t\t\tint textureWidth, int textureHeight, final MapScroller ms) {\n\t\tthis.gl = ms.getGl();\n\t\tint mx = textMapWidth/textureBlockPixWidth;\n\t\tint my = textMapHeight/(textureBlockPixHeight);\n\t\t\n\t\tfinal float distance = ms.getDistance();\n\t\tblockWidth = ms.getBlockWidth();\n\t\tblockHeight = ms.getBlockHeight();\n\n\t\tfloat pctx = (float)textureBlockPixWidth/(float) textureWidth;\n\t\tfloat pcty = (float)textureBlockPixHeight/(float) textureHeight;\n\t\t\n\t\t// initialisation des coordonnées des textures\n\t\tint nbMap = mx*my;\n\t\ttextCoords = new float[nbMap-1][];\n\t\tfloat px, py, px2, py2;\n\t\tfor(int i=1;i<nbMap;i++) {\n\t\t\tint cx = (i%mx)*(textureBlockPixWidth) ;\n\t\t\tint cy = (i/mx)*(textureBlockPixHeight);\n\t\t\tpx = (float)cx/(float)textureWidth;\n\t\t\tpy = (float)cy/(float)textureHeight;\n\t\t\tpx2 = px+pctx; // -pctx/100f;\n\t\t\tpy2 = py+pcty; // -pcty/100f;\n\t\t\tSystem.out.format(\"(%d, %d) ->[(%f, %f), (%f,%f), (%f, %f)]\\n\", cx, cy, px, py,px2,py2,(px2-px),(py2-py) );\n\t\t\ttextCoords[i-1] = new float[] {px, py, px2, py2};\n\t\t}\n\t\t\n\t\t// preparation du cache des buffer VBO\n\t\tint[][] mapIndexBands = new int[ms.getNbBlocksWidth()+2][];\n\t\tfinal int empty[] = {0}; // vbo vide \n\t\tfor(int i=0; i<mapIndexBands.length;i++) mapIndexBands[i] = empty;\n\t\t\n\t\tcacheBands = new CacheIndex<int[]>(new CacheIndexManager<int[]>() {\n\t\t\t@Override\n\t\t\tpublic void setUpData(int index, int[][] data, int dataSetupIndex) {\n\t\t\t\t// preparation d'une nouvelle bande\n\t\t\t\tint[] vboIds = data[dataSetupIndex];\n\t\t\t\tif(vboIds[0]!=0) { // le nombre de point\n\t\t\t\t\t// suppression des buffer inutilisés\n\t\t\t\t\tgl.glDeleteBuffers(vboIds.length-1, vboIds,1);\n\t\t\t\t}\n\t\t\t\t// création de deux nouveaux buffer\n\t\t\t\tvboIds = new int[] {0,0,0,0}; // nbPoints, vertex + texture\n//\t\t\t\tSystem.out.println(\"vboIds \"+vboIds[0]+\" \"+vboIds[1]+\" \"+vboIds[2]);\n\t\t\t\t\n\t\t\t\tgl.glGenBuffers(3, vboIds, 1);\n\t\t\t\tdata[dataSetupIndex] = vboIds;\n//\t\t\t\tSystem.out.println(\"vboIds \"+vboIds[0]+\" \"+vboIds[1]+\" \"+vboIds[2]);\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t// les points\n\t\t\t\tFloatBuffer vertices = Buffers.newDirectFloatBuffer(nbHeight*4*3); // 4 points de 3 coordonnées\n\t\t\t\tFloatBuffer text = Buffers.newDirectFloatBuffer(nbHeight*4*2);\n\t\t\t\tFloatBuffer normals = Buffers.newDirectFloatBuffer(nbHeight*4*3); // 4 points de 3 coordonnées\n\t\t\t\t\n\t\t\t\tfloat positiony=0;\n\t\t\t\tfor(int j = 0;j<nbHeight; j++) {\n\t\t\t\t\tint val = ms.getTheMap()[j][index]; \n\t\t\t\t\tif(val>0){\n\t\t\t\t\t\t// points BL, BR, UR, RL\n\t\t\t\t\t\tvertices.put(0f); vertices.put(positiony-blockHeight); vertices.put(-distance);\n\t\t\t\t\t\tvertices.put(blockWidth); vertices.put(positiony-blockHeight); vertices.put(-distance);\n\t\t\t\t\t\tvertices.put(blockWidth); vertices.put(positiony); vertices.put(-distance);\n\t\t\t\t\t\tvertices.put(0f); vertices.put(positiony); vertices.put(-distance);\n\t\t\t\t\t\t\n\t\t\t\t\t\tnormals.put(0f);normals.put(0f);normals.put(1f);\n\t\t\t\t\t\tnormals.put(0f);normals.put(0f);normals.put(1f);\n\t\t\t\t\t\tnormals.put(0f);normals.put(0f);normals.put(1f);\n\t\t\t\t\t\tnormals.put(0f);normals.put(0f);normals.put(1f);\n\t\t\t\t\t\t\n\t\t\t\t\t\t// texture\n\t\t\t\t\t\tfloat[] coords = textCoords[val-1];\n\t\t\t\t\t\ttext.put(coords[0]); text.put(coords[3]);\n\t\t\t\t\t\ttext.put(coords[2]); text.put(coords[3]);\n\t\t\t\t\t\ttext.put(coords[2]); text.put(coords[1]);\n\t\t\t\t\t\ttext.put(coords[0]); text.put(coords[1]);\n\t\t\t\t\t}\n\t\t\t\t\tpositiony-=blockHeight;\n\t\t\t\t}\n\t\t\t\tvertices.flip();\n\t\t\t\ttext.flip();\n\t\t\t\tnormals.flip();\n\t\t\t\tvboIds[0] = vertices.limit() / 3; // nb points\n//\t\t\t\tSystem.out.println(\"vboIds \"+vboIds[0]+\" \"+vboIds[1]+\" \"+vboIds[2]);\n\n\t\t\t\t// les points\n\t\t\t\tgl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboIds[1]);\n//\t\t\t\tSystem.out.println(\"vboIds \"+vboIds[0]+\" \"+vboIds[1]+\" \"+vboIds[2]);\n\t\t gl.glBufferData(GL.GL_ARRAY_BUFFER, vertices.limit() * Buffers.SIZEOF_FLOAT, vertices, GL.GL_STATIC_DRAW);\n\t\t gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);\n\t\t\t\t\n\t\t // les textures\n\t\t gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, vboIds[2]);\n//\t\t\t\tSystem.out.println(\"vboIds \"+vboIds[0]+\" \"+vboIds[1]+\" \"+vboIds[2]);\n\t\t gl.glBufferData(GL2.GL_ARRAY_BUFFER, text.limit() * Buffers.SIZEOF_FLOAT, text, GL.GL_STATIC_DRAW);\n\t\t gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0);\n\t\t \n\t\t // normals\n\t\t\t\tgl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboIds[3]);\n//\t\t\t\tSystem.out.println(\"vboIds \"+vboIds[0]+\" \"+vboIds[1]+\" \"+vboIds[2]);\n\t\t gl.glBufferData(GL.GL_ARRAY_BUFFER, normals.limit() * Buffers.SIZEOF_FLOAT, normals, GL.GL_STATIC_DRAW);\n\t\t gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);\n\t\t \n\t\t\t}\n\t\t} , mapIndexBands);\n\t}", "@Override\n public void setPosition(float x, float y) {\n }", "protected ResourceLocation getEntityTexture(T entity) {\n\t\treturn ORECART_TEXTURES;\n\t}", "public void setStuff(int x, int y, int w, int h)\n {\n\t xPos = x;\n\t yPos = y;\n\t width = w;\n\t height = h;\n }", "public void setColorTexture(String name) {\n this.colorTexture = name;\n }", "void setPosition(double xPos, double yPos);", "public void setPosition(Vector2 position);", "@Override\n\tpublic void rebind () {\n\t\tsetParams(Param.Texture, u_texture0);\n\t\tsetParams(Param.ViewportInverse, viewportInverse);\n\t\tendParams();\n\t}", "public void addTexture(TextureRegion texture) {\n int width = texture.getRegionWidth();\n if (width > maxWidth) {\n maxWidth = width;\n }\n int height = texture.getRegionHeight();\n if (height > maxHeight) {\n maxHeight = height;\n }\n // Ajout de la texture\n textures.add(texture);\n }", "abstract void setOrigin(double x, double y, double z);", "public void changeBodyTexture(String aTextureName)\n {\n // If you want, you can target a specific part of the robot\n // and only change the texture of this part by using the getChildByName(\"\")\n \t/* Passing through all the children of the robot\n \t * and applying a new texture on them */\n for(int i = 0;i<androidRobot3DObject.numChildren();i++)\n {\n String name = androidRobot3DObject.getChildAt(i).name();\n Log.d(\"min3d\", \"Texture name: \" + name);\n\n if(name.indexOf(\"body\")!=-1)\n {\n androidRobot3DObject.getChildAt(i).textures().clear();\n androidRobot3DObject.getChildAt(i).textures().addById(aTextureName);\n }\n }\n }", "public TextureDisplay() {\n initComponents();\n\n setPreferredSize(new Dimension(size, size));\n\n backImg = createBackImg();\n }" ]
[ "0.7206333", "0.702709", "0.69404155", "0.6809737", "0.6630061", "0.65006554", "0.6399624", "0.6350048", "0.6328391", "0.62139946", "0.6165383", "0.61369425", "0.6130234", "0.6121283", "0.611083", "0.61106414", "0.6009083", "0.6008073", "0.59914255", "0.5988149", "0.59271204", "0.5897474", "0.58666885", "0.5813921", "0.5798988", "0.57973945", "0.57742995", "0.5735778", "0.5729005", "0.56912774", "0.56562793", "0.56507623", "0.56325024", "0.56227", "0.5610892", "0.5585927", "0.5583305", "0.5552638", "0.55460167", "0.55335474", "0.55148345", "0.55126977", "0.55126977", "0.54976356", "0.5489439", "0.54672784", "0.54218423", "0.5416293", "0.5411287", "0.53919846", "0.5386161", "0.53831005", "0.53700954", "0.53611845", "0.5356613", "0.53345585", "0.53335226", "0.5328806", "0.5322381", "0.5310909", "0.5309415", "0.5308292", "0.5303965", "0.5297382", "0.5280146", "0.527984", "0.52704275", "0.5264222", "0.5263027", "0.52419657", "0.5240113", "0.52307016", "0.5228375", "0.5215322", "0.5210294", "0.5199932", "0.5195709", "0.51910466", "0.5190605", "0.5185595", "0.5184738", "0.51649153", "0.5164818", "0.51540583", "0.5152315", "0.5151471", "0.5150664", "0.5147313", "0.5144134", "0.5142944", "0.51417446", "0.5126643", "0.51226985", "0.51194185", "0.5115582", "0.51109666", "0.5107969", "0.5104364", "0.5103893", "0.51037556" ]
0.7475273
0