id
stringlengths
36
36
text
stringlengths
1
1.25M
cf60b7c5-d22c-424f-bd6d-5208570ceecd
public void setServiceRequestType(java.lang.String serviceRequestType) { this.serviceRequestType = serviceRequestType; }
42ae2fd9-fb2c-4fa1-8e3d-ca652619e7e8
public void test_plusDays_overflowTooSmall() { LocalDate.of(Year.MIN_YEAR, 1, 1).plusDays(Long.MIN_VALUE); } // ----------------------------------------------------------------------- // minus(Period) // ----------------------------------------------------------------------- @Test(groups = { "tck" }
513a6804-f698-472f-b949-e11872008ef4
public void setCustomBoolean5(crmondemand.xml.customobject3.query.QueryType customBoolean5) { this.customBoolean5 = customBoolean5; }
327653e6-6294-4986-ae5f-7091ee5e6e25
public void setCustomCurrency14(crmondemand.xml.customobject6.query.QueryType customCurrency14) { this.customCurrency14 = customCurrency14; }
afc8daf0-1f42-4610-908d-3e4d6e278911
public void setCustomNumber2(crmondemand.xml.customobject6.query.QueryType customNumber2) { this.customNumber2 = customNumber2; }
e74db697-213d-4ca9-9d33-a57646f4782d
public crmondemand.xml.customobject6.query.QueryType getObjectiveType() { return this.objectiveType; }
d5936e39-ad8a-40cd-9c12-80c65f397da9
public void setProduct(crmondemand.xml.contact.query.QueryType product) { this.product = product; }
d7045d73-56db-486e-9e6f-862061d0713a
public void setCustomDate7(crmondemand.xml.contact.query.QueryType customDate7) { this.customDate7 = customDate7; }
521e2c38-4ea3-4363-9895-6f476b97bbee
public void setCustomText9(crmondemand.xml.contact.query.QueryType customText9) { this.customText9 = customText9; }
2e04b90d-0f10-4448-b165-2f5d7a476acb
public crmondemand.xml.opportunity.query.QueryType getCustomPickList47() { return this.customPickList47; }
d3057d44-155f-4175-b954-cd9432e70838
void setId(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000001; id_ = value; onChanged(); }
c4ba9b95-4f84-478d-a005-7ee90bd03687
public java.lang.String getCustomText85() { return this.customText85; }
7699370c-3ad3-448a-8de2-b9d4df107f96
@Override public void move(int x, int y) { super.move(x, y); }
9acdb7a3-b71e-4ce6-a39f-8e0c624fb8e3
public void setLastName(java.lang.String lastName) { this.lastName = lastName; }
db74af9c-c8ab-4895-ae8a-39ef6b9e89d4
public crmondemand.xml.customobject6.query.QueryType getCustomObject7Name() { return this.customObject7Name; }
e58fecc1-a851-4991-bd08-904320212cd2
public void setCustomBoolean22(crmondemand.xml.customobject3.query.QueryType customBoolean22) { this.customBoolean22 = customBoolean22; }
fb9a5c13-33fc-433b-9b62-950db240c02d
@Override public void possiblyBumpAchievement(final MOB mob, final Event E, int bumpNum, Object... parms) { if((mob != null)&&(E!=null)&&(!mob.isMonster())&&(CMProps.getBoolVar(CMProps.Bool.MUDSTARTED))) { ensureAchievementsLoaded(); final PlayerStats pStats = mob.playerStats(); if(pStats != null) { if(eventMap.containsKey(E)) { final PlayerAccount account = pStats.getAccount(); for(final Achievement A : eventMap.get(E)) { switch(A.getAgent()) { case PLAYER: possiblyBumpPlayerAchievement(mob, A, pStats, E, bumpNum, parms); break; case ACCOUNT: possiblyBumpAccountAchievement(mob, A, account, E, bumpNum, parms); break; } } } } } }
a48ac31e-4573-47fa-ab84-7a8e5893597f
public TextField(String text) { setOpaque(false); setCaretColor(Color.DARK_GRAY); setForeground(Color.DARK_GRAY); setText(text); setBorder(new EmptyBorder(0, 10, 0, 10)); }
7c81a0f0-9342-46a4-a0ad-2fa0498c3b79
public java.lang.Boolean getCustomBoolean26() { return this.customBoolean26; }
868b4896-bac7-49ea-896b-4cff4308bf9f
public void moveDelta(double x, double y) { Point to=new Point(this.x+x,this.y+y); move(to); }
5bfedd67-eee6-439f-b936-f1fc6065d128
public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof main.Messages.ExecutionEndingRequest) { return mergeFrom((main.Messages.ExecutionEndingRequest)other); } else { super.mergeFrom(other); return this; } }
a8de9290-bcd5-4240-97db-942eeb97583e
@Override public boolean removeFaction(String factionID) { Faction F; if(factionID==null) { for(final Enumeration<Faction> e=factionSet.elements();e.hasMoreElements();) { F=e.nextElement(); if(F!=null) removeFaction(F.factionID()); } return true; } F=getFactionByName(factionID); if(F==null) F=getFaction(factionID); if(F==null) return false; Resources.removeResource(F.factionID()); factionSet.remove(F.factionID().toUpperCase()); return true; }
44013444-633d-4a8e-9425-2c11ec158d50
public static com.google.protobuf.DescriptorProtos.EnumValueOptions parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); }
de6aaf7e-58fc-4bfe-8b8a-fcdc53137368
public void setCustomDate6(crmondemand.xml.customobject6.query.QueryType customDate6) { this.customDate6 = customDate6; }
ed2e03b3-5fce-4c15-9b49-17850c3aa983
public crmondemand.xml.customobject3.query.QueryType getCustomText80() { return this.customText80; }
c8cbf7c4-1208-49d3-b5f0-88c9df82f9b7
public void setCustomPhone10(java.lang.String customPhone10) { this.customPhone10 = customPhone10; }
10dcde02-7bb2-4c89-85fb-362cd9826205
public void setPolicyCurrencyCode(java.lang.String policyCurrencyCode) { this.policyCurrencyCode = policyCurrencyCode; }
556ed90a-5f6f-445e-817a-8f682fe26168
public void setOwnerUserSignInId(java.lang.String ownerUserSignInId) { this.ownerUserSignInId = ownerUserSignInId; }
118e1344-9787-4611-96f2-31b152932e35
public void setCustomPickList43(java.lang.String customPickList43) { this.customPickList43 = customPickList43; }
3a7e25e9-d50c-473f-b3ee-a90a45324e70
public void setTransactionId(java.lang.String transactionId) { this.transactionId = transactionId; }
78032321-726c-4830-9ed0-55215195be61
public void setCustomCurrency22(crmondemand.xml.contact.query.QueryType customCurrency22) { this.customCurrency22 = customCurrency22; }
296fb307-1484-4b43-972e-a4ce1ea7213b
public java.lang.String getCustomText59() { return this.customText59; }
3872254c-8e6d-40fb-be1f-3009595a9c59
public void setFinancialAccountId(crmondemand.xml.customobject6.query.QueryType financialAccountId) { this.financialAccountId = financialAccountId; }
df2120b6-2caf-449a-9cf8-ca3ad0f8bc3c
private void initializeRocks() { for(int i = 0; i < 250; i++) { Point point = getRandomLocationOnGrid(525); if(getElements().contains(new Rectangle(point.x, point.y, GameModel.getUnit(), GameModel.getUnit()))) { i++; continue; } else { addRock(point); } } int UNIT4 = GameModel.getUnit() * 4; // Should be 100 if UNIT is 25 addRock(new Point(UNIT4 * 3, UNIT4 * 2)); // Below the Shop addRock(new Point(UNIT4 * 3 + GameModel.getUnit(), UNIT4 * 2)); addRock(new Point(UNIT4 * 3 + GameModel.getUnit() * 2, UNIT4 * 2)); }
61a2383d-0047-470f-85ab-05e136156911
public void setCustomObject13IntegrationId(crmondemand.xml.opportunity.query.QueryType customObject13IntegrationId) { this.customObject13IntegrationId = customObject13IntegrationId; }
15d10346-0963-4581-adae-bcaa9e19afb1
public java.math.BigDecimal getCustomNumber3() { return this.customNumber3; }
0fff41b1-8649-4ce3-bab0-6d2f2a3cfacc
public void setCustomDate12(crmondemand.xml.customobject3.query.QueryType customDate12) { this.customDate12 = customDate12; }
0a7b16ba-5b4b-47e9-8221-b45d03789299
public java.util.Calendar getCustomDate9() { return this.customDate9; }
40134389-76a6-41d7-b7ed-b792d34ce7ce
public crmondemand.xml.contact.query.QueryType getCustomPickList74() { return this.customPickList74; }
f01bcf9e-3eee-4782-b9e6-de4dae6d5a2f
public void setCustomDate32(crmondemand.xml.customobject3.query.QueryType customDate32) { this.customDate32 = customDate32; }
e98863e2-aa56-4474-867c-21c0214ff81b
public java.lang.String getName() { return this.name; }
5c26fd61-3e69-4793-8d6e-3663c21af714
public void test_get_OffsetDate(int y, int m, int d, ZoneOffset offset) { LocalDate localDate = LocalDate.of(y, m, d); OffsetDate a = OffsetDate.of(localDate, offset); assertEquals(a.getDate(), localDate); assertEquals(a.getOffset(), offset); assertEquals(a.toString(), localDate.toString() + offset.toString()); assertEquals(a.getYear(), localDate.getYear()); assertEquals(a.getMonth(), localDate.getMonth()); assertEquals(a.getDayOfMonth(), localDate.getDayOfMonth()); assertEquals(a.getDayOfYear(), localDate.getDayOfYear()); assertEquals(a.getDayOfWeek(), localDate.getDayOfWeek()); }
58c7919e-e083-4792-9dd7-031daae1997f
public List<User> getAllUser() { return this.userDao.getAllUser(); }
026c3b55-b303-42ef-b94e-756fa3a57b1e
public void setCustomText29(java.lang.String customText29) { this.customText29 = customText29; }
192ef2b0-cd76-4c13-be21-4bf0fc43148f
public void setCustomDate24(crmondemand.xml.customobject3.query.QueryType customDate24) { this.customDate24 = customDate24; }
ddc556e8-3a2d-46e2-aff5-17a8761bc014
public java.lang.String getOwnerId() { return this.ownerId; }
0ea56643-4f7f-4ba6-8a8b-0efa1530a009
public void setCustomCurrency17(java.math.BigDecimal customCurrency17) { this.customCurrency17 = customCurrency17; }
47981123-6a50-4688-87f8-c3ec8cd5c559
private static boolean isPalindrome(int i) { String s = i + ""; for (int j = 0; j < s.length() / 2; j++) { if(s.charAt(j) != s.charAt(s.length() - j - 1)) { return false; } } return true; }
862529cf-e5fc-420d-a959-7f86037d518a
public void setCustomPickList16(java.lang.String customPickList16) { this.customPickList16 = customPickList16; }
f1e6c505-a36b-46cb-a5c4-07c1ff505c27
public void setPolicyExpirationDate(crmondemand.xml.contact.query.QueryType policyExpirationDate) { this.policyExpirationDate = policyExpirationDate; }
8385a70c-d6c7-4e9b-a6a4-97b257bc6314
public static void main(String args[]) { Client client=new Client("ChatRoom!"); client.setVisible(true); client.getSocket(); }
8eb140e8-f598-4f1f-9b17-759f0d964091
@Test public void testEasy7() throws Exception { String start = "hit"; String end = "hit"; String[] words = {}; Set<String> dict = Utils.stringArrayToSet(words); WordLadderII wordLadderII = new WordLadderII(); List<List<String>> result = wordLadderII.findLadders(start, end, dict); Utils.printListListString(result); }
b9cd1e43-9376-4685-8a87-3a160aa10799
public java.lang.String getShippingPrimaryAddressLine1() { return this.shippingPrimaryAddressLine1; }
28e3faa8-8634-423a-927e-366285cf92fd
public void deHide() { if (this.getBuffedValue(MapleBuffStat.GM_HIDE) != null) { this.cancelBuffStats(MapleBuffStat.GM_HIDE); } }
7e48b817-5986-46fe-9025-bc86550fb22e
public void setFinancialAccountPrimaryAccount(crmondemand.xml.contact.query.QueryType financialAccountPrimaryAccount) { this.financialAccountPrimaryAccount = financialAccountPrimaryAccount; }
70c0e86e-3db1-4c12-a05c-caf4b9c1596e
public void setCustomPickList41(java.lang.String customPickList41) { this.customPickList41 = customPickList41; }
c0e9393c-a4cd-44fa-b0d2-115931ccc7ee
@Override public Item findFirstInventory(Enumeration<Room> rooms, MOB mob, String srchStr, int timePct) { final List<Item> found=findInventory(rooms,mob,srchStr,true,timePct); if(found.size()>0) return found.get(0); return null; }
f1956af2-fa85-41a7-a4b5-fbcff8a6cf8f
public void actionPerformed(java.awt.event.ActionEvent evt) { jButton14ActionPerformed(evt); }
d6b79dec-adca-44e2-8bff-8bb889a9bae1
public void setCustomPickList46(java.lang.String customPickList46) { this.customPickList46 = customPickList46; }
4621480c-b5cf-4a61-81a6-409eb80525f2
public void setOwnerId(crmondemand.xml.customobject6.query.QueryType ownerId) { this.ownerId = ownerId; }
c3e9ede8-c8c3-41b0-bc78-9697cccc900e
public void setCustomObject11Name(java.lang.String customObject11Name) { this.customObject11Name = customObject11Name; }
97a1f9cf-0583-443a-b230-a071bba76980
public java.util.Calendar getCustomDate37() { return this.customDate37; }
3554b194-294f-48b5-bb36-3df73784319b
public void setCustomText72(java.lang.String customText72) { this.customText72 = customText72; }
66410964-e1e6-4c44-a0f8-36af1b8525ce
private void initFields() { name_ = ""; method_ = java.util.Collections.emptyList(); options_ = com.google.protobuf.DescriptorProtos.ServiceOptions.getDefaultInstance(); }
ce94d6d8-85c6-4ff1-a2db-5598ce0fd80f
public void setCustomPickList26(java.lang.String customPickList26) { this.customPickList26 = customPickList26; }
f4012513-fb78-4004-b7dc-3c1a7479ef1c
public java.lang.String getBusinessPlanType() { return this.businessPlanType; }
22ba897b-6431-4744-b5bf-e0c080896e0d
public void setCustomNumber6(java.math.BigDecimal customNumber6) { this.customNumber6 = customNumber6; }
4c221ea7-8515-4354-afc6-646b0173a5fd
public void setZCustomNumber37(crmondemand.xml.customobject6.query.QueryType zCustomNumber37) { this.zCustomNumber37 = zCustomNumber37; }
bc1abac4-815e-4cdc-8a2b-3fb3c751b017
public void setCustomDate39(java.util.Calendar customDate39) { this.customDate39 = customDate39; }
8940fde6-f33d-47c0-8bad-c29e6ca69506
public boolean mobCollision(int xa, int ya){ Mob m = dungeon.getMob(xa, ya, this); if(m != null){ if(this.knockback > 0) m.knockback = this.knockback / 2; else m.knockback = 2f; m.knockDir = dir; return true; } return false; }
12e8d2b8-9fb0-4e28-b97f-65314da2e89f
public void setCustomDate11(java.util.Calendar customDate11) { this.customDate11 = customDate11; }
9c940cd7-11b3-45b2-8d1a-5f6b56136825
public void setCustomObject13IntegrationId(java.lang.String customObject13IntegrationId) { this.customObject13IntegrationId = customObject13IntegrationId; }
80e77333-ed47-4abd-b696-6c25c4090ae2
public java.lang.String getServiceRequestIntegrationId() { return this.serviceRequestIntegrationId; }
cc1130fb-813d-4426-91c2-eaa795016185
void qwe() { }
24d0b717-5fd5-40c9-b6dd-a6b09aa74d69
public java.lang.String getFinancialAccountFinancialAccount() { return this.financialAccountFinancialAccount; }
77d03511-930d-44b5-ac9e-03323c281966
public void setCustomPickList14(java.lang.String customPickList14) { this.customPickList14 = customPickList14; }
15ceb376-5f5b-4b2d-8cc6-0daa0899a390
public void setCustomText11(java.lang.String customText11) { this.customText11 = customText11; }
0efdbc0a-6249-43d7-8c26-ddee5dcafe01
public void setParentFinancialAccountIntegrationId(crmondemand.xml.customobject3.query.QueryType parentFinancialAccountIntegrationId) { this.parentFinancialAccountIntegrationId = parentFinancialAccountIntegrationId; }
45ffff11-7956-456e-98c7-468e493c1a98
public crmondemand.xml.customobject6.query.QueryType getCustomPickList27() { return this.customPickList27; }
3b1de8ae-0378-4401-83b6-2f65546871d5
public void read(BufferedReader buff) { try { while(buff.ready()) { line = buff.readLine(); piecePlace = pattern[0].matcher(line); pieceMove = pattern[2].matcher(line); castle = pattern[1].matcher(line); if(piecePlace.find()) { String chessPiece = piecePlace.group("ChessPiece"); String chessColor = piecePlace.group("ChessColor"); String chessLetter = piecePlace.group("Column"); String chessNum = piecePlace.group("Row"); if(chessColor.equals("d")) { chessPiece = chessPiece.toLowerCase(); } placePiece(numberTranslation(chessNum),letterTranslation(chessLetter), chessPiece); System.out.println("Chess piece "+ chessPiece +" has been placed"); } else if(castle.find()) { String kingSpaceLetter1 = castle.group("KingOriginColumn"); String kingSpaceNum1 = castle.group("KingOriginRow"); String kingSpaceLetter2 = castle.group("KingNewColumn"); String kingSpaceNum2 = castle.group("KingNewRow"); String rookSpaceLetter1 = castle.group("RookOriginColumn"); String rookSpaceNum1 = castle.group("RookOriginRow"); String rookSpaceLetter2 = castle.group("RookNewColumn"); String rookSpaceNum2 = castle.group("RookNewRow"); moveTwoPieces(letterTranslation(kingSpaceLetter1), numberTranslation(kingSpaceNum1), letterTranslation(kingSpaceLetter2), numberTranslation(kingSpaceNum2), letterTranslation(rookSpaceLetter1), numberTranslation(rookSpaceNum1), letterTranslation(rookSpaceLetter2), numberTranslation(rookSpaceNum2)); System.out.println("Castling has occured"); } else if(pieceMove.find()) { String firstSpaceLetter = pieceMove.group("OriginColumn"); String firstSpaceNum = pieceMove.group("OriginRow"); String secondSpaceLetter = pieceMove.group("NewColumn"); String secondSpaceNum = pieceMove.group("NewRow"); moveChessPiece(letterTranslation(firstSpaceLetter), numberTranslation(firstSpaceNum), letterTranslation(secondSpaceLetter), numberTranslation(secondSpaceNum)); System.out.println("Piece "+ b.checkBoard(numberTranslation(secondSpaceNum),letterTranslation(secondSpaceLetter)) +" has been moved"); } else { System.err.println(line + " is not a valid input"); } } } catch (IOException e) { System.err.println("IO exception"); } }
d4e3fd4a-4a57-41b9-8a08-cc417bdbef52
public java.lang.String getCustomPickList3() { return this.customPickList3; }
5dbc7fe5-8c20-4143-85c1-045f78c59140
public void fillTableWithList(JTable tableAllTask, ArrayList<Task> fillList) throws IOException, SQLException { DefaultTableModel modelTable = (DefaultTableModel) tableAllTask.getModel(); modelTable.setRowCount(0); for (int i = 0; i < fillList.size(); i++) { Object[] data = {fillList.get(i).getTaskID(), fillList.get(i).getParentID(), fillList.get(i).getTaskName(), fillList.get(i).getType(), fillList.get(i).getStatus(), fillList.get(i).getCustomer(), fillList.get(i).getUser(), fillList.get(i).getStartDate(), fillList.get(i).getEndDate(), fillList.get(i).getEstimatedtime(), fillList.get(i).getPriority(), fillList.get(i).getDescription()}; modelTable.addRow(data); } }
795f3afa-e01e-432b-a8b8-6340445c97ff
public void print(int l) { print(l, "ThereExists SchemaExpression"); m_schemaText.print(l + 1); m_schemaExpression.print(l + 1); } } public class AstThereExists1S extends AstSchemaExpression { AstSchemaText m_schemaText; AstSchemaExpression m_schemaExpression; public void print(int l) { print(l, "ThereExists1 SchemaExpression"); m_schemaText.print(l + 1); m_schemaExpression.print(l + 1); } } public class AstSchemaTextS extends AstSchemaExpression { AstSchemaText m_schemaText; public void print(int l) { print(l, "SchemaText SchemaExpression"); m_schemaText.print(l + 1); } } public class AstSchemaReferenceS extends AstSchemaExpression { AstSchemaReference m_schemaReference; public void print(int l) { print(l, "SchemaReference SchemaExpression"); m_schemaReference.print(l + 1); } } public class AstNotS extends AstSchemaExpression { AstSchemaExpression m_schemaExpression; public void print(int l) { print(l, "Not SchemaExpression"); m_schemaExpression.print(l + 1); } } public class AstPreS extends AstSchemaExpression { AstSchemaExpression m_schemaExpression; public void print(int l) { print(l, "pre SchemaExpression"); m_schemaExpression.print(l + 1); } } public class AstAndS extends AstSchemaExpression { AstSchemaExpression m_schemaExpressionL; AstSchemaExpression m_schemaExpressionR; public void print(int l) { print(l, "AND SchemaExpression"); m_schemaExpressionL.print(l + 1); m_schemaExpressionR.print(l + 1); } } public class AstOrS extends AstSchemaExpression { AstSchemaExpression m_schemaExpressionL; AstSchemaExpression m_schemaExpressionR; public void print(int l) { print(l, "OR SchemaExpression"); m_schemaExpressionL.print(l + 1); m_schemaExpressionR.print(l + 1); } } public class AstImpliesS extends AstSchemaExpression { AstSchemaExpression m_schemaExpressionL; AstSchemaExpression m_schemaExpressionR; public void print(int l) { print(l, "IMPLIES SchemaExpression"); m_schemaExpressionL.print(l + 1); m_schemaExpressionR.print(l + 1); } } public class AstBiimpliesS extends AstSchemaExpression { AstSchemaExpression m_schemaExpressionL; AstSchemaExpression m_schemaExpressionR; public void print(int l) { print(l, "BIIMPLIES SchemaExpression"); m_schemaExpressionL.print(l + 1); m_schemaExpressionR.print(l + 1); } } public class AstProjS extends AstSchemaExpression { AstSchemaExpression m_schemaExpressionL; AstSchemaExpression m_schemaExpressionR; public void print(int l) { print(l, "PROJ SchemaExpression"); m_schemaExpressionL.print(l + 1); m_schemaExpressionR.print(l + 1); } } public class AstBslashS extends AstSchemaExpression { AstSchemaExpression m_schemaExpression; AstDeclarationNameList m_declarationNameList; public void print(int l) { print(l, "BSLASH SchemaExpression"); m_schemaExpression.print(l + 1); m_declarationNameList.print(l + 1); } } public class AstCompS extends AstSchemaExpression { AstSchemaExpression m_schemaExpressionL; AstSchemaExpression m_schemaExpressionR; public void print(int l) { print(l, "COMP SchemaExpression"); m_schemaExpressionL.print(l + 1); m_schemaExpressionR.print(l + 1); } } public class AstMgtS extends AstSchemaExpression { AstSchemaExpression m_schemaExpressionL; AstSchemaExpression m_schemaExpressionR; public void print(int l) { print(l, ">> SchemaExpression"); m_schemaExpressionL.print(l + 1); m_schemaExpressionR.print(l + 1); } } public class AstParenS extends AstSchemaExpression { AstSchemaExpression m_schemaExpression; public void print(int l) { print(l, "() SchemaExpression"); m_schemaExpression.print(l + 1); } } /* * Expression */ public class AstExpression extends AstBase { SpecObject specObject; String property; public AstExpression(SpecObject specObject, String property) { this.specObject = specObject; this.property = property; } public void checkType() { getType(); } } public class AstBinaryOpX extends AstExpression { AstExpression m_expressionL; AstExpression m_expressionR; public AstBinaryOpX(SpecObject specObject, String property) { super(specObject, property); } public void print(int l) { m_expressionL.print(l); m_expressionR.print(l); } public void populateTypeTable(AstSymbolTable stable) { m_stable = stable; m_expressionL.populateTypeTable(m_stable); m_expressionR.populateTypeTable(m_stable); } public void populateSymbolTable() { m_expressionL.populateSymbolTable(); m_expressionR.populateSymbolTable(); } public AstType getType() { AstType typeL = m_expressionL.getType(); AstType typeR = m_expressionR.getType(); if ((typeL.isUndefined()) || (typeR.isUndefined())) { return new AstType(); } if (!typeL.isCompatible(typeR)) { reportTypeError("Type mismatch", m_token, specObject, property ); } return typeL.resultantType(typeR); } } public class AstIfThenElseX extends AstExpression { AstPredicate m_predicate; AstExpression m_then; AstExpression m_else; public AstIfThenElseX(SpecObject specObject, String property) { super(specObject, property); } public void print(int l) { print(l, "IfThenElse"); m_predicate.print(l + 1); m_then.print(l + 1); m_else.print(l + 1); } public void populateTypeTable(AstSymbolTable stable) { m_stable = stable; m_predicate.populateTypeTable(m_stable); } public void populateSymbolTable() { m_predicate.populateSymbolTable(); m_then.populateSymbolTable(); m_else.populateSymbolTable(); } public AstType getType() { AstType t1 = m_then.getType(); AstType t2 = m_else.getType(); if ((t1.isUndefined()) || (t2.isUndefined())) { return new AstType(); } if (!t1.isCompatible(t2)) { reportTypeError( "The expression used for the then clause is a different type than the one used for the else clause", m_then.m_token, specObject, property ); } return t1.resultantType(t2); } } public class AstCrossProductX extends AstBinaryOpX { public AstCrossProductX(SpecObject specObject, String property) { super(specObject, property); } public void print(int l) { print(l, "CrossProduct"); super.print(l + 1); } public AstType getType() { AstType typeL = m_expressionL.getType(); AstType typeR = m_expressionR.getType(); if ((typeL.isUndefined()) || (typeR.isUndefined())) { return new AstType(); } typeL = typeL.getSetType(); typeR = typeR.getSetType(); if ((typeL == null) || (typeR == null)) { reportTypeError("Both expressions of a cross-product must evaluate to a set", m_token, specObject, property ); return new AstType(); } AstType result = new AstType(AstType.TYPE_SET); result.m_setType = new AstType(AstType.TYPE_TUPLE); result.m_setType.newTuple(typeL, typeR); return result; } } public class AstInfixGenericNameX extends AstBinaryOpX { AstInfixGenericName m_infixGenericName = new AstInfixGenericName(); public AstInfixGenericNameX(SpecObject specObject, String property) { super(specObject, property); } public void print(int l) { m_infixGenericName.print(l); super.print(l + 1); } public String getName() { return m_infixGenericName.getName(); } public AstType getType() { AstType typeL = m_expressionL.getType(); AstType typeR = m_expressionR.getType(); if ((typeL.isUndefined()) || (typeR.isUndefined())) { return new AstType(); } if ((!typeL.isSet() || !typeR.isSet())) { reportTypeError("Both sides of an infix generic operator must be sets", m_infixGenericName.m_token, specObject, property ); return new AstType(); } AstType type = new AstType(AstType.TYPE_SET); type.m_setType = new AstType(AstType.TYPE_SET); type.m_setType.m_setType = new AstType(AstType.TYPE_TUPLE); type.m_setType.m_setType.newTuple(typeL.getSetType(), typeR.getSetType()); return type; } } public class AstInfixFunctionNameX extends AstBinaryOpX { AstInfixFunctionName m_infixFunctionName = new AstInfixFunctionName(); public AstInfixFunctionNameX(SpecObject specObject, String property) { super(specObject, property); } public void print(int l) { m_infixFunctionName.print(l); super.print(l + 1); } public AstType getType() { boolean bad = false; int tid = m_infixFunctionName.m_token.m_id; String tname = m_infixFunctionName.m_token.m_value; AstType typeL = m_expressionL.getType(); AstType typeR = m_expressionR.getType(); if ((typeL.isUndefined()) || (typeR.isUndefined())) { return new AstType(); } if (tid == TozeTokenizer.TOKEN_MAP) { AstType type = new AstType(AstType.TYPE_TUPLE); type.m_tupleTypes.add(typeL); type.m_tupleTypes.add(typeR); return type; } if ((tid == TozeTokenizer.TOKEN_PLUS) || (tid == TozeTokenizer.TOKEN_MINUS) || (tid == TozeTokenizer.TOKEN_DIV) || (tid == TozeTokenizer.TOKEN_MOD) || (tid == TozeTokenizer.TOKEN_FSLASH) || (tid == TozeTokenizer.TOKEN_TIMES)) { AstType rtype = typeL.resultantType(typeR); if (!rtype.isANumber()) { reportTypeError("The expressions for the " + tname + " operator must be numbers", m_infixFunctionName.m_token, specObject, property ); return new AstType(); } return rtype; } if ((tid == TozeTokenizer.TOKEN_UNI) || (tid == TozeTokenizer.TOKEN_SETMINUS) || (tid == TozeTokenizer.TOKEN_INT) || (tid == TozeTokenizer.TOKEN_BSLASH)) { if (!typeL.isSet() || !typeR.isSet()) { reportTypeError("Expressions for the " + tname + " operator must be sets", m_infixFunctionName.m_token, specObject, property ); return new AstType(); } if (!typeL.isEqual(typeR)) { reportTypeError("Sets must be the same type for the operator " + tname, m_infixFunctionName.m_token, specObject, property ); return new AstType(); } return typeL; } if ((tid == TozeTokenizer.TOKEN_CAT) || (tid == TozeTokenizer.TOKEN_DCAT) || (tid == TozeTokenizer.TOKEN_PREFIX) || (tid == TozeTokenizer.TOKEN_SUFFIX)) { if (!typeL.isSequence() || !typeR.isSequence()) { reportTypeError("Expressions for the " + tname + " operator must be sequences", m_infixFunctionName.m_token, specObject, property ); return new AstType(); } return typeL; } if (tid == TozeTokenizer.TOKEN_UPTO) { if (!typeL.isANumber() || !typeR.isANumber()) { reportTypeError("Expressions for " + tname + " must be numbers", m_infixFunctionName.m_token, specObject, property ); return new AstType(); } AstType type = new AstType(AstType.TYPE_SET); type.m_setType = typeL; return type; } if ((tid == TozeTokenizer.TOKEN_FOVR) || (tid == TozeTokenizer.TOKEN_FCMP) || (tid == TozeTokenizer.TOKEN_CIRC)) { if (!typeL.isRelation() || !typeR.isRelation()) { reportTypeError("Expressions for " + tname + " must be relations", m_infixFunctionName.m_token, specObject, property ); return new AstType(); } if (!typeL.isEqual(typeR)) { reportTypeError("Relations used in " + tname + " must be of the same type", m_infixFunctionName.m_token, specObject, property ); return new AstType(); } return typeL; } if ((tid == TozeTokenizer.TOKEN_DRES) || (tid == TozeTokenizer.TOKEN_DSUB)) { if (!typeL.isSet()) { reportTypeError("Left-hand argument to " + tname + " must be a set", m_infixFunctionName.m_token, specObject, property ); bad = true; } if (!typeR.isRelation()) { reportTypeError("Right-hand argument to " + tname + " must be a relation", m_infixFunctionName.m_token, specObject, property ); bad = true; } if (bad) { return new AstType(); } if (!((AstType) typeR.getSetType().m_tupleTypes.get(0)).isEqual(typeL.getSetType())) { reportTypeError("Type of set must be the same as the domain type of the range", m_infixFunctionName.m_token, specObject, property ); return new AstType(); } return typeR; } if ((tid == TozeTokenizer.TOKEN_RRES) || (tid == TozeTokenizer.TOKEN_RSUB)) { if (!typeR.isSet()) { reportTypeError("Right-hand argument to " + tname + " must be a set", m_infixFunctionName.m_token, specObject, property ); bad = true; } if (!typeL.isRelation()) { reportTypeError("Left-hand argument to " + tname + " must be a relation", m_infixFunctionName.m_token, specObject, property ); bad = true; } if (bad) { return new AstType(); } if (!((AstType) typeL.getSetType().m_tupleTypes.get(1)).isEqual(typeR.getSetType())) { reportTypeError("Type of set must be the same as the range type of the relation", m_infixFunctionName.m_token, specObject, property ); return new AstType(); } return typeL; } if ((tid == TozeTokenizer.TOKEN_PROJECT)) { if (!typeL.isSequence()) { reportTypeError("Left-hand expression for a projection must be a sequence", m_infixFunctionName.m_token, specObject, property ); bad = true; } if (!typeR.isSet()) { reportTypeError("Right-hand expression for a projection must be a set", m_infixFunctionName.m_token, specObject, property ); bad = true; } if (bad) { return new AstType(); } AstType tl = (AstType) typeL.getSetType().m_tupleTypes.get(1); AstType tr = typeR.getSetType(); if (!tl.isCompatible(tr)) { reportTypeError("Type of set must be the same as the sequence type.", m_infixFunctionName.m_token, specObject, property ); } return typeL; } if ((tid == TozeTokenizer.TOKEN_EXTRACT)) { if (!typeL.isSet()) { reportTypeError("Left-hand expression must be a set", m_infixFunctionName.m_token, specObject, property ); bad = true; } else { } if (!typeR.isSequence()) { reportTypeError("Right-hand expression for a projection must be a sequence", m_infixFunctionName.m_token, specObject, property ); bad = true; } if (bad) { return new AstType(); } AstType tl = typeL.getSetType(); /* * Check that the set contains natural numbers. */ if (!tl.isANumber()) { reportTypeError("The set must contain numbers", m_infixFunctionName.m_token, specObject, property ); } return typeR; } if (tid == TozeTokenizer.TOKEN_HASH) { if (!typeL.isBag()) { reportTypeError("Left-hand expression for '#' must be a bag", m_infixFunctionName.m_token, specObject, property ); return new AstType(); } if (!((AstType) typeL.getSetType().m_tupleTypes.get(0)).isEqual(typeR)) { reportTypeError("Right-hand expression for '#' must be the same type as contained in the bag", m_infixFunctionName.m_token, specObject, property ); return new AstType(); } return new AstType(AstType.TYPE_NATURAL); } if (tid == TozeTokenizer.TOKEN_UPLUS) { if (!typeL.isBag() || !typeR.isBag()) { reportTypeError("Expressions for bag union must be bags", m_infixFunctionName.m_token, specObject, property ); return new AstType(); } if (!typeL.isEqual(typeR)) { reportTypeError("Both sides of bag union must be the same type", m_infixFunctionName.m_token, specObject, property ); } } return new AstType(); } } public class AstPowerX extends AstExpression { AstExpression m_expression; public AstPowerX(SpecObject specObject, String property) { super(specObject, property); } public void populateTypeTable(AstSymbolTable stable) { m_stable = stable; m_expression.populateTypeTable(m_stable); } public void populateSymbolTable() { m_expression.populateSymbolTable(); } public AstType getType() { AstType ttype = m_expression.getType(); if (ttype.isUndefined()) { return new AstType(); } if (ttype.getSetType() == null) { reportTypeError("Power set must be applied to a set", m_token, specObject, property ); return new AstType(); } AstType type = new AstType(AstType.TYPE_SET); type.m_setType = ttype; return type; } } public class AstUnaryOpX extends AstExpression { AstExpression m_expression; public AstUnaryOpX(SpecObject specObject, String property) { super(specObject, property); } public void print(int l) { print(l, m_token.m_value); m_expression.print(l + 1); } public void populateTypeTable(AstSymbolTable stable) { m_stable = stable; m_expression.populateTypeTable(stable); } public void populateSymbolTable() { m_expression.populateSymbolTable(); } public AstType getType() { return m_expression.getType(); } } public class AstPrefixGenericNameX extends AstUnaryOpX { AstPrefixGenericName m_prefixGenericName = new AstPrefixGenericName(); public AstPrefixGenericNameX(SpecObject specObject, String property) { super(specObject, property); } public void print(int l) { m_prefixGenericName.print(l); } public AstType getType() { switch (m_prefixGenericName.m_token.m_id) { case TozeTokenizer.TOKEN_SEQ: case TozeTokenizer.TOKEN_SEQONE: case TozeTokenizer.TOKEN_ISEQ: AstType t = m_expression.getType(); if (t.isUndefined()) { return new AstType(); } // AstType type = new AstType(AstType.TYPE_SET); // type.m_setType = new AstType(AstType.TYPE_SEQUENCE); if (t.isSet()) { t = t.getSetType(); } AstType rtype = new AstType(AstType.TYPE_SET); rtype.m_setType = new AstType(AstType.TYPE_SEQUENCE); rtype.m_setType.m_setType = new AstType(AstType.TYPE_TUPLE); rtype.m_setType.m_setType.newTuple(new AstType(AstType.TYPE_NATURAL1), t ); rtype.m_setType.m_setType.m_tupleIsSeq = true; return rtype; case TozeTokenizer.TOKEN_BAG: t = m_expression.getType(); if (t.isUndefined()) { return new AstType(); } // type = new AstType(AstType.TYPE_SET); // type.m_setType = new AstType(AstType.TYPE_BAG); if (t.isSet()) { t = t.getSetType(); } rtype = new AstType(AstType.TYPE_SET); rtype.m_setType = new AstType(AstType.TYPE_BAG); rtype.m_setType.m_setType = new AstType(AstType.TYPE_TUPLE); rtype.m_setType.m_setType.newTuple(t, new AstType(AstType.TYPE_NATURAL1) ); rtype.m_setType.m_setType.m_tupleIsSeq = true; return rtype; } return new AstType(); } } public class AstHyphenX extends AstUnaryOpX { AstDecorations m_decoration; public AstHyphenX(SpecObject specObject, String property) { super(specObject, property); } public void populateTypeTable(AstSymbolTable stable) { m_stable = stable; m_expression.populateTypeTable(m_stable); } public void populateSymbolTable() { m_expression.populateSymbolTable(); } public AstType getType() { AstType t = m_expression.getType(); if (!t.isANumber()) { reportTypeError("The expression for - must be a number", m_token, specObject, property ); return new AstType(); } return t; } } public class AstImageX extends AstExpression // (| |) { AstExpression m_expression1; AstExpression m_expression0; AstDecorations m_decoration; public AstImageX(SpecObject specObject, String property) { super(specObject, property); } public void populateTypeTable(AstSymbolTable stable) { m_stable = stable; m_expression1.populateTypeTable(m_stable); m_expression0.populateTypeTable(m_stable); } public void populateSymbolTable() { m_expression1.populateSymbolTable(); m_expression0.populateSymbolTable(); } public AstType getType() { boolean bad = false; AstType typeL = m_expression1.getType(); AstType typeM = m_expression0.getType(); if ((typeL.isUndefined()) || (typeM.isUndefined())) { return new AstType(); } if (!typeL.isRelation()) { reportTypeError("Left-hand expression to the image operator must be a relation", m_token, specObject, property ); bad = true; } if (!typeM.isSet()) { reportTypeError("Inside expression of the image operator must be a set", m_token, specObject, property ); bad = true; } if (bad) { return new AstType(); } if (!typeM.getSetType().isEqual((AstType) typeL.getSetType().m_tupleTypes.get(0))) { reportTypeError( "The type of the inside set expression must the the same type as the domain type of the relation for the image operator", m_token, specObject, property ); return new AstType(); } AstType type = new AstType(AstType.TYPE_SET); type.m_setType = (AstType) typeL.getSetType().m_tupleTypes.get(1); return type; } } public class AstExpressionListX extends AstExpression { List m_expressions = new ArrayList(); public AstExpressionListX(SpecObject specObject, String property) { super(specObject, property); } public void populateTypeTable(AstSymbolTable stable) { m_stable = stable; int i; for (i = 0; i < m_expressions.size(); i++) { ((AstBase) m_expressions.get(i)).populateTypeTable(m_stable); } } public void populateSymbolTable() { int i; for (i = 0; i < m_expressions.size(); i++) { ((AstBase) m_expressions.get(i)).populateSymbolTable(); } } public AstType getType() { AstType type = new AstType(AstType.TYPE_TUPLE); int i; for (i = 0; i < m_expressions.size(); i++) { AstType t = ((AstBase) m_expressions.get(i)).getType(); type.m_tupleTypes.add(t); } /* * Special case where a tuple is surrounded by parenthesis */ if (m_expressions.size() == 1) { AstType t = (AstType) type.m_tupleTypes.get(0); if (t.getType() == AstType.TYPE_TUPLE) { return t; } } return type; } } public class AstDistUnionX extends AstExpression { AstExpression m_expression = null; public AstDistUnionX(SpecObject specObject, String property) { super(specObject, property); } public void populateTypeTable(AstSymbolTable stable) { m_stable = stable; m_expression.populateTypeTable(m_stable); } public void populateSymbolTable() { m_expression.populateSymbolTable(); } public AstType getType() { AstType type = m_expression.getType(); if (type.isUndefined()) { return new AstType(); } if (type.getType() != AstType.TYPE_SET) { reportTypeError("Expression used in distributed union must be a set of sets.", m_token, specObject, property ); return new AstType(); } /* * If the set is a tuple, then we need to make sure that each tuple * is of the same type. */ if (type.getSetType().getType() == AstType.TYPE_TUPLE) { int i; AstType stype = type.getSetType(); if (stype.m_tupleTypes.size() == 0) { return new AstType(AstType.TYPE_EMPTY); } AstType type1 = (AstType) stype.m_tupleTypes.get(0); for (i = 1; i < stype.m_tupleTypes.size(); i++) { AstType type2 = (AstType) stype.m_tupleTypes.get(i); if (!type1.isCompatible(type2)) { reportTypeError("All sets used in a distributed union must be of the same type.", m_token, specObject, property ); return new AstType(); } } return type1; } else { if (type.getSetType().getType() != AstType.TYPE_SET) { reportTypeError("Expression used in distributed union must be a set of sets.", m_token, specObject, property ); return new AstType(); } return type.getSetType(); } } } public class AstDistIntersectionX extends AstExpression { AstExpression m_expression = null; public AstDistIntersectionX(SpecObject specObject, String property) { super(specObject, property); } public void populateTypeTable(AstSymbolTable stable) { m_stable = stable; m_expression.populateTypeTable(m_stable); } public void populateSymbolTable() { m_expression.populateSymbolTable(); } public AstType getType() { AstType type = m_expression.getType(); if (type.isUndefined()) { return new AstType(); } if (type.getType() != AstType.TYPE_SET) { reportTypeError("Expression used in distributed intersection must be a set of sets.", m_token, specObject, property ); return new AstType(); } /* * If the set is a tuple, then we need to make sure that each tuple * is of the same type. */ if (type.getSetType().getType() == AstType.TYPE_TUPLE) { int i; AstType stype = type.getSetType(); if (stype.m_tupleTypes.size() == 0) { return new AstType(AstType.TYPE_EMPTY); } AstType type1 = (AstType) stype.m_tupleTypes.get(0); for (i = 1; i < stype.m_tupleTypes.size(); i++) { AstType type2 = (AstType) stype.m_tupleTypes.get(i); if (!type1.isCompatible(type2)) { reportTypeError("All sets used in a distributed intersection must be of the same type.", m_token, specObject, property ); return new AstType(); } } return type1; } else { if (type.getSetType().getType() != AstType.TYPE_SET) { reportTypeError("Expression used in distributed intersection must be a set of sets.", m_token, specObject, property ); return new AstType(); } return type.getSetType(); } } } public class AstVariableX extends AstExpression { AstVariableName m_variable; AstActualParameters m_actualParameters; public AstVariableX(SpecObject specObject, String property) { super(specObject, property); } } public class AstSelfX extends AstExpression { public AstSelfX(SpecObject specObject, String property) { super(specObject, property); } } public class AstNumberX extends AstExpression { public AstNumberX(SpecObject specObject, String property) { super(specObject, property); } public void print(int l) { print(l, m_token.m_value); } public AstType getType() { AstType type = new AstType(); if (m_token.m_value.indexOf('.') >= 0) { type.m_type = AstType.TYPE_REAL; } else { type.m_type = AstType.TYPE_NATURAL; } return type; } } public class AstSchemaReferenceX extends AstExpression { AstSchemaReference m_schemaReference; public AstSchemaReferenceX(SpecObject specObject, String property) { super(specObject, property); } } public class AstClassNameX extends AstExpression { AstClassName m_className; AstActualParameters m_actualParameters; AstRenameList m_renameList; public AstClassNameX(SpecObject specObject, String property) { super(specObject, property); } } public class AstDownArrowX extends AstExpression { AstExpression m_expression; public AstDownArrowX(SpecObject specObject, String property) { super(specObject, property); } public void populateTypeTable(AstSymbolTable stable) { m_stable = stable; m_expression.populateTypeTable(m_stable); } public void populateSymbolTable() { m_expression.populateSymbolTable(); } public AstType getType() { if (m_expression == null) { return new AstType(); } return m_expression.getType(); } } public class AstUnionX extends AstBinaryOpX { public void print(int l) { print(l, "Union"); super.print(l + 1); } public AstUnionX(SpecObject specObject, String property) { super(specObject, property); } public AstType getType() { AstType typeL = m_expressionL.getType(); AstType typeR = m_expressionR.getType(); if ((typeL.isUndefined()) || (typeR.isUndefined())) { return new AstType(); } if (!typeL.isSet() || !typeR.isSet()) { reportTypeError( "Expressions for the " + Character.toString(TozeFontMap.CHAR_CUP) + " operator must be sets", m_token, specObject, property ); return new AstType(); } if (!typeL.isEqual(typeR)) { reportTypeError( "Sets must be the same type for the operator " + Character.toString(TozeFontMap.CHAR_CUP), m_token, specObject, property ); return new AstType(); } return typeL; } } public class AstCopyrightX extends AstUnaryOpX { public AstCopyrightX(SpecObject specObject, String property) { super(specObject, property); } } public class AstAngleX extends AstExpression { List m_expressions = new ArrayList(); public AstAngleX(SpecObject specObject, String property) { super(specObject, property); } } public class AstBagX extends AstExpression { List m_expressions = new ArrayList(); public AstBagX(SpecObject specObject, String property) { super(specObject, property); } public void print(int l) { int i; print(l, "BagExpression"); for (i = 0; i < m_expressions.size(); i++) { ((AstExpression) m_expressions.get(i)).print(l + 1); } } public void populateTypeTable(AstSymbolTable stable) { m_stable = stable; int i; for (i = 0; i < m_expressions.size(); i++) { ((AstBase) m_expressions.get(i)).populateTypeTable(m_stable); } } public void populateSymbolTable() { int i; for (i = 0; i < m_expressions.size(); i++) { ((AstBase) m_expressions.get(i)).populateSymbolTable(); } } public AstType getType() { int i; boolean wasUndefined = false; AstType type = new AstType(AstType.TYPE_BAG); if (m_expressions.size() == 0) { return new AstType(AstType.TYPE_EMPTY); } AstType stype = ((AstBase) m_expressions.get(0)).getType(); if (stype.isUndefined()) { return new AstType(); } for (i = 1; i < m_expressions.size(); i++) { AstType ttype = ((AstBase) m_expressions.get(i)).getType(); if (ttype.isUndefined()) { wasUndefined = true; } else { if (!ttype.isEqual(stype)) { reportTypeError("All expressions of a bag must be of the same type", m_token, specObject, property ); } } } if (wasUndefined) { return new AstType(); } AstType rtype = new AstType(AstType.TYPE_BAG); rtype.m_setType = new AstType(AstType.TYPE_TUPLE); rtype.m_setType.newTuple(stype, new AstType(AstType.TYPE_NATURAL1) ); rtype.m_setType.m_tupleIsSeq = false; return rtype; } } public class AstThetaX extends AstExpression { AstSchemaName m_schemaName; AstDecorations m_decorations; AstRenameList m_renameList; public AstThetaX(SpecObject specObject, String property) { super(specObject, property); } } public class AstMemberX extends AstExpression { AstExpression m_expression; AstVariableName m_variableName; public AstMemberX(SpecObject specObject, String property) { super(specObject, property); } public void print(int l) { print(l, "AstMember"); m_expression.print(l + 1); m_variableName.print(l + 1); } public void populateTypeTable(AstSymbolTable stable) { m_stable = stable; m_expression.populateTypeTable(m_stable); } public void populateSymbolTable() { m_expression.populateSymbolTable(); } public AstType getType() { AstType ctype = m_expression.getType(); if (ctype.isUndefined()) { return new AstType(); } if (ctype == null) { reportTypeError("Undefined class variable", m_expression.m_token, specObject, property ); return new AstType(); } if (ctype.getType() != AstType.TYPE_CLASS) { reportTypeError("Member access must be from a class type", m_expression.m_token, specObject, property ); return new AstType(); } AstType type = null; if (m_variableName != null) { type = ctype.getClassMembers().getTypeVisible(m_variableName.getName()); } if (type == null) { // the variable name may be null after a class.member syntax // where member is blank, handle as a null and use a unique // TozeToken String member = "<null>"; TozeToken token = null; if (m_variableName != null) { member = m_variableName.getName(); token = m_variableName.m_token; } if (token == null) { token = new TozeToken(-1, member, -1, -1); } reportTypeError("The member " + member + " is not visible", token, specObject, property ); return new AstType(); } if (type.isUndefined()) { reportTypeError("The member " + m_variableName.getName() + " is undefined", m_variableName.m_token, specObject, property ); return new AstType(); } return type; } } public class AstPostfixFunctionNameX extends AstUnaryOpX { AstPostfixFunctionName m_postfixFunctionName; public AstPostfixFunctionNameX(SpecObject specObject, String property) { super(specObject, property); } public AstType getType() { AstType type = m_expression.getType(); if (type.isUndefined()) { return new AstType(); } if ((m_postfixFunctionName.m_token.m_id == TozeTokenizer.TOKEN_TILDE) || (m_postfixFunctionName.m_token.m_id == TozeTokenizer.TOKEN_INV)) { if (!type.isRelation()) { reportTypeError("The argument to '~' must be a relation", m_postfixFunctionName.m_token, specObject, property ); return new AstType(); } AstType rtype = new AstType(AstType.TYPE_SET); rtype.m_setType = new AstType(AstType.TYPE_TUPLE); rtype.m_setType.newTuple((AstType) type.m_setType.m_tupleTypes.get(1), (AstType) type.m_setType.m_tupleTypes.get(0) ); return rtype; } if ((m_postfixFunctionName.m_token.m_id == TozeTokenizer.TOKEN_TCL) || (m_postfixFunctionName.m_token.m_id == TozeTokenizer.TOKEN_RTCL)) { if (!type.isRelation()) { reportTypeError( "The argument to '" + m_postfixFunctionName.m_token.m_value + "' must be a relation", m_postfixFunctionName.m_token, specObject, property ); return new AstType(); } } return type; } } public class AstParenX extends AstExpression { public AstParenX(SpecObject specObject, String property) { super(specObject, property); } public void print(int l) { print(l, "Parenthesis"); super.print(l + 1); } } public class AstLambdaX extends AstExpression { AstSchemaText m_schemaText; AstExpression m_expression; public AstLambdaX(SpecObject specObject, String property) { super(specObject, property); } public void print(int l) { print(l, "Lambda"); m_schemaText.print(l + 1); m_expression.print(l + 1); } public void populateTypeTable(AstSymbolTable stable) { m_stable = stable; m_schemaText.populateTypeTable(m_stable); m_expression.populateTypeTable(m_stable); } public void populateSymbolTable() { m_schemaText.populateSymbolTable(); m_expression.populateSymbolTable(); } public AstType getType() { m_schemaText.checkType(); List decls = m_schemaText.m_declaration.m_decls; AstType ttype = new AstType(AstType.TYPE_TUPLE); int i; for (i = 0; i < decls.size(); i++) { if (decls.get(i) instanceof AstBasicDeclaration1) { AstBasicDeclaration1 dec = (AstBasicDeclaration1) decls.get(i); List names = dec.m_declarationNameList.m_declarationNameList; int j; for (j = 0; j < names.size(); j++) { AstDeclarationName name = (AstDeclarationName) names.get(j); AstType nt = m_stable.getType(name.getName()); ttype.m_tupleTypes.add(nt); } } } AstType et = m_expression.getType(); if (et.isUndefined()) { return new AstType(); } ttype.m_tupleTypes.add(et); AstType type = new AstType(AstType.TYPE_SET); type.m_setType = ttype; return type; } } public class AstMuX extends AstExpression { AstSchemaText m_schemaText; AstExpression m_expression; public AstMuX(SpecObject specObject, String property) { super(specObject, property); } } public class AstLetX extends AstExpression { List m_letDefinitions = new ArrayList(); AstExpression m_expression; public AstLetX(SpecObject specObject, String property) { super(specObject, property); } } /* * This class is a merging of a variable (V), Schema Reference (S), and * class (C). * This is done because sometimes it is not possible to know at the time of * parsing whether something is either of the three. * * Word -> VSC * Word, Decoration -> VS * Word, ActualParameters -> VSC * Word, RenameList -> SC * Word, ActualParameters, RenameList -> SC * Word, Decoration, ActualParameters -> VS * Word, Decoration, RenameList -> S * Word, Decoration, ActualParameters, RenameList -> S */ public class AstVSCX extends AstExpression { // The Word will be stored in the token in the base class. AstDecorations m_decorations; AstActualParameters m_actualParameters; AstRenameList m_renameList; public AstVSCX(SpecObject specObject, String property) { super(specObject, property); } public void print(int l) { print(l, "VSC"); print(l + 1, m_token.m_value); if (m_decorations != null) { m_decorations.print(l + 1); } if (m_actualParameters != null) { m_actualParameters.print(l + 1); } if (m_renameList != null) { m_renameList.print(l + 1); } } public AstType getType() { AstType type = m_stable.getTypeDef(getName()); if (type == null) { type = m_stable.getType(getName()); if (type == null) { reportTypeError(getName() + " is undefined", m_token, specObject, property ); return new AstType(); } if (type.isUndefined()) { reportTypeError(getName() + " is undefined", m_token, specObject, property ); return new AstType(); } } return type; } public String getName() { if (m_decorations == null) { return m_token.m_value; } return m_token.m_value + m_decorations.getName(); } } public class AstSetExpressionX extends AstExpression { public AstSetExpressionX(SpecObject specObject, String property) { super(specObject, property); } } public class AstSetExpressionX1 extends AstSetExpressionX { List m_expressions = new ArrayList(); public AstSetExpressionX1(SpecObject specObject, String property) { super(specObject, property); } public void print(int l) { int i; print(l, "SetExpression"); for (i = 0; i < m_expressions.size(); i++) { ((AstExpression) m_expressions.get(i)).print(l + 1); } } public void populateTypeTable(AstSymbolTable stable) { m_stable = stable; int i; for (i = 0; i < m_expressions.size(); i++) { ((AstBase) m_expressions.get(i)).populateTypeTable(m_stable); } } public void populateSymbolTable() { int i; for (i = 0; i < m_expressions.size(); i++) { ((AstBase) m_expressions.get(i)).populateSymbolTable(); } } public AstType getType() { AstType type; int i; boolean wasUndefined = false; //ttp /* * if (m_expressions.size() > 1) * { * AstType ttype = new AstType(); * ttype.m_type = AstType.TYPE_TUPLE; * for (i=0; i<m_expressions.size(); i++) * { * type = ((AstBase)m_expressions.get(i)).getType(); * ttype.m_tupleTypes.add(type); * if (type.isUndefined()) wasUndefined = true; * } * if (wasUndefined) return new AstType(); * type = new AstType(AstType.TYPE_SET); * type.m_setType = ttype; * } * else if (m_expressions.size() == 1) */ if (m_expressions.size() != 0) { type = new AstType(AstType.TYPE_SET); type.m_setType = ((AstBase) m_expressions.get(0)).getType(); if (type.m_setType.isUndefined()) { return new AstType(); } } else { type = new AstType(AstType.TYPE_SET); type.m_setType = new AstType(AstType.TYPE_EMPTY); if (type.m_setType.isUndefined()) { return new AstType(); } } return type; } } public class AstSetExpressionX2 extends AstSetExpressionX { AstSchemaText m_schemaText; AstExpression m_expression; public AstSetExpressionX2(SpecObject specObject, String property) { super(specObject, property); } public void print(int l) { print(l, "SetExpression"); if (m_schemaText != null) { m_schemaText.print(l + 1); } m_expression.print(l + 1); } public void populateTypeTable(AstSymbolTable stable) { m_stable = new AstSymbolTable(stable); stable.addKid(m_stable); if (m_schemaText != null) { m_schemaText.populateTypeTable(m_stable); } if (m_expression != null) { m_expression.populateTypeTable(m_stable); } } public void populateSymbolTable() { if (m_schemaText != null) { m_schemaText.populateSymbolTable(); } if (m_expression != null) { m_expression.populateSymbolTable(); } } public AstType getType() { if (m_schemaText != null) { m_schemaText.checkType(); } if (m_expression == null) { return m_schemaText.getType(); } AstType type = new AstType(AstType.TYPE_SET); type.m_setType = m_expression.getType(); if (type.m_setType.isUndefined()) { return new AstType(); } return type; } } public class AstSetExpressionX3 extends AstSetExpressionX { public AstSetExpressionX3(SpecObject specObject, String property) { super(specObject, property); } public void print(int l) { print(l, "SetExpression - " + m_token.m_value); } public AstType getType() { AstType type = new AstType(); if (m_token.m_id == TozeTokenizer.TOKEN_NAT) { return m_stable.getTypeDef(m_token.m_value); } else if (m_token.m_id == TozeTokenizer.TOKEN_NATONE) { return m_stable.getTypeDef(m_token.m_value); } else if (m_token.m_id == TozeTokenizer.TOKEN_INTEGER) { return m_stable.getTypeDef(m_token.m_value); } else if (m_token.m_id == TozeTokenizer.TOKEN_REAL) { return m_stable.getTypeDef(m_token.m_value); } else if (m_token.m_id == TozeTokenizer.TOKEN_BOOL) { return m_stable.getTypeDef(m_token.m_value); } return m_stable.getTypeDef(m_token.m_value); } } public class AstSequenceX extends AstExpression { List m_expressions = new ArrayList(); public AstSequenceX(SpecObject specObject, String property) { super(specObject, property); } public void print(int l) { print(l, "Sequence"); } public void populateTypeTable(AstSymbolTable stable) { m_stable = stable; int i; for (i = 0; i < m_expressions.size(); i++) { ((AstBase) m_expressions.get(i)).populateTypeTable(m_stable); } } public void populateSymbolTable() { int i; for (i = 0; i < m_expressions.size(); i++) { ((AstBase) m_expressions.get(i)).populateSymbolTable(); } } public AstType getType() { int i; boolean wasUndefined = false; AstType type = new AstType(AstType.TYPE_SEQUENCE); if (m_expressions.size() == 0) { type.m_setType = new AstType(AstType.TYPE_EMPTY); return type; } AstType stype = ((AstBase) m_expressions.get(0)).getType(); if (stype.isUndefined()) { return new AstType(); } for (i = 1; i < m_expressions.size(); i++) { AstType ttype = ((AstBase) m_expressions.get(i)).getType(); if (ttype.isUndefined()) { wasUndefined = true; } else { if (!ttype.isEqual(stype)) { reportTypeError("All expressions of a sequence must be of the same type", m_token, specObject, property ); } } } if (wasUndefined) { return new AstType(); } AstType rtype = new AstType(AstType.TYPE_SEQUENCE); rtype.m_setType = new AstType(AstType.TYPE_TUPLE); rtype.m_setType.newTuple(new AstType(AstType.TYPE_NATURAL1), stype ); rtype.m_setType.m_tupleIsSeq = true; return rtype; } } public class AstBuiltInFunctionX extends AstUnaryOpX { public AstBuiltInFunctionX(SpecObject specObject, String property) { super(specObject, property); } public AstType getType() { AstType type = m_expression.getType(); if (type.isUndefined()) { return new AstType(); } if (m_token.m_id == TozeTokenizer.TOKEN_DOM) { if (type.getType() != AstType.TYPE_SET) { reportTypeError("The argument to the function 'dom' must be a set of tuples", m_token, specObject, property ); return new AstType(); } if (type.getSetType().getType() != AstType.TYPE_TUPLE) { reportTypeError("The argument to the function 'dom' must be a set of tuples", m_token, specObject, property ); return new AstType(); } if (type.getSetType().m_tupleTypes.size() != 2) { reportTypeError("The argument to the function 'dom' must be a tuple of size 2", m_token, specObject, property ); return new AstType(); } AstType rtype = new AstType(AstType.TYPE_SET); rtype.m_setType = (AstType) type.getSetType().m_tupleTypes.get(0); return rtype; } if (m_token.m_id == TozeTokenizer.TOKEN_RAN) { if (type.getType() != AstType.TYPE_SET) { reportTypeError("The argument to the function 'ran' must be a set of tuples", m_token, specObject, property ); return new AstType(); } if (type.getSetType().getType() != AstType.TYPE_TUPLE) { reportTypeError("The argument to the function 'ran' must be a set of tuples", m_token, specObject, property ); return new AstType(); } if (type.getSetType().m_tupleTypes.size() != 2) { reportTypeError("The argument to the function 'ran' must be a tuple of size 2", m_token, specObject, property ); return new AstType(); } AstType rtype = new AstType(AstType.TYPE_SET); rtype.m_setType = (AstType) type.getSetType().m_tupleTypes.get(1); return rtype; } if (m_token.m_id == TozeTokenizer.TOKEN_REV) { if (type.getType() != AstType.TYPE_SEQUENCE) { reportTypeError("The argument to the function 'rev' must be a sequence", m_token, specObject, property ); return new AstType(); } return type; } if (m_token.m_id == TozeTokenizer.TOKEN_HEAD) { if (type.getType() != AstType.TYPE_SEQUENCE) { reportTypeError("The argument to the function 'head' must be a sequence", m_token, specObject, property ); return new AstType(); } return (AstType) type.getSetType().m_tupleTypes.get(1); // return type.m_setType; } if (m_token.m_id == TozeTokenizer.TOKEN_LAST) { if (type.getType() != AstType.TYPE_SEQUENCE) { reportTypeError("The argument to the function 'last' must be a sequence", m_token, specObject, property ); return new AstType(); } return (AstType) type.getSetType().m_tupleTypes.get(1); // return type.m_setType; } if (m_token.m_id == TozeTokenizer.TOKEN_TAIL) { if (type.getType() != AstType.TYPE_SEQUENCE) { reportTypeError("The argument to the function 'tail' must be a sequence", m_token, specObject, property ); return new AstType(); } return type; } if (m_token.m_id == TozeTokenizer.TOKEN_FRONT) { if (type.getType() != AstType.TYPE_SEQUENCE) { reportTypeError("The argument to the function 'front' must be a sequence", m_token, specObject, property ); return new AstType(); } return type; } if ((m_token.m_id == TozeTokenizer.TOKEN_FIRST) || (m_token.m_id == TozeTokenizer.TOKEN_SECOND)) { if ((type.getType() != AstType.TYPE_TUPLE) || (type.m_tupleTypes.size() != 2)) { reportTypeError("The argument to " + m_token.m_value + " must be a tuple of size 2", m_token, specObject, property ); return new AstType(); } if (m_token.m_id == TozeTokenizer.TOKEN_FIRST) { return (AstType) type.m_tupleTypes.get(0); } return (AstType) type.m_tupleTypes.get(1); } if (m_token.m_id == TozeTokenizer.TOKEN_HASH) { if (!type.isSet() && !type.isSequence()) { reportTypeError("Argument to '#' must be either a set or a sequence", m_token, specObject, property ); } return new AstType(AstType.TYPE_NATURAL); } return new AstType(); } } public class AstFunctionX extends AstExpression { AstExpression m_fexpression; AstExpression m_pexpression; public AstFunctionX(SpecObject specObject, String property) { super(specObject, property); } public void populateTypeTable(AstSymbolTable stable) { m_stable = stable; m_fexpression.populateTypeTable(m_stable); m_pexpression.populateTypeTable(m_stable); } public void populateSymbolTable() { m_fexpression.populateSymbolTable(); m_pexpression.populateSymbolTable(); } public AstType getType() { AstType ftype = m_fexpression.getType(); AstType ptype = m_pexpression.getType(); if ((ftype.isUndefined()) || (ptype.isUndefined())) { return new AstType(); } /* * Check the special case where it looks like an expression function * but it is really where a single element of a sequence is being * referenced. */ if (ftype.getType() == AstType.TYPE_SEQUENCE) { if (!ptype.isANumber()) { reportTypeError("Subscript to a sequence must be a number", m_token, specObject, property ); } return (AstType) ftype.getSetType().m_tupleTypes.get(1); } if ((ftype.getType() != AstType.TYPE_SET) && (ftype.getType() != AstType.TYPE_SEQUENCE)) { reportTypeError("Expression used as a function must evaluate to a set of a tuple", m_token, specObject, property ); return new AstType(); } if (ftype.getSetType().getType() != AstType.TYPE_TUPLE) { reportTypeError("Expression used as a function must evaluate to a tuple", m_token, specObject, property ); return new AstType(); } if (ftype.getSetType().m_tupleTypes.size() < 2) { reportTypeError("The tuple must be a binary relation", m_token, specObject, property ); return new AstType(); } //if (ptype.getType() == AstType.TYPE_TUPLE) if (ptype.isTuple()) { if ((ptype.m_tupleTypes.size() + 1) != ftype.m_setType.m_tupleTypes.size()) { reportTypeError("Number of parameters for the function do not match definition.", m_token, specObject, property ); } int i; for (i = 0; i < ptype.m_tupleTypes.size(); i++) { AstType t1 = (AstType) ptype.m_tupleTypes.get(i); AstType t2 = (AstType) ftype.m_setType.m_tupleTypes.get(i); if (!t1.isCompatible(t2)) { reportTypeError("Parameter " + (i + 1) + " does not match definition.", m_token, specObject, property ); } } } else { if (!ptype.isEqual((AstType) ftype.getSetType().m_tupleTypes.get(0))) { reportTypeError("Parameter types do not match function parameters", m_token, specObject, property ); } } List vtmp = ftype.getSetType().m_tupleTypes; return (AstType) vtmp.get(vtmp.size() - 1); } } public class AstPredicateX extends AstExpression { AstPredicate m_predicate; public AstPredicateX(SpecObject specObject, String property) { super(specObject, property); } public void populateTypeTable(AstSymbolTable stable) { m_stable = stable; m_predicate.populateTypeTable(stable); } public void populateSymbolTable() { m_predicate.populateSymbolTable(); } public AstType getType() { boolean bad = false; return new AstType(AstType.TYPE_BOOL); } } /* * Infix, Postfix, Prefix */ public class AstPrefixGenericName extends AstBase { AstDecorations m_decoration; public void print(int l) { print(l, "PrefixGenericName = " + m_token.m_value); if (m_decoration != null) { m_decoration.print(l + 1); } } } public class AstInfixGenericName extends AstBase { AstDecorations m_decoration; public void print(int l) { print(l, "InfixGenericName = " + getName()); if (m_decoration != null) { m_decoration.print(l + 1); } } public String getName() { return m_token.m_value; } } public class AstInfixFunctionName extends AstBase { AstDecorations m_decoration; public void print(int l) { print(l, m_token.m_value); if (m_decoration != null) { m_decoration.print(l + 1); } } } public class AstInfixRelationName extends AstBase { AstDecorations m_decoration; public void print(int l) { print(l, "InfixRelationName = " + m_token.m_value); if (m_decoration != null) { m_decoration.print(l + 1); } } } public class AstPrefixRelationName extends AstBase { public void print(int l) { print(l, "PrefixRelationName = " + getName()); } public String getName() { return m_token.m_value; } } public class AstPostfixFunctionName extends AstBase { AstDecorations m_decoration; public void print(int l) { print(l, "PrefixFunctionName = " + m_token.m_value); m_decoration.print(l + 1); }
c2550e80-ea71-4035-84b5-242a71d100a9
public crmondemand.xml.customobject6.query.QueryType getCustomCurrency19() { return this.customCurrency19; }
004b1310-8c24-4eea-aca9-786147b86df7
public crmondemand.xml.customobject3.query.QueryType getCustomText3() { return this.customText3; }
c64f95d1-a490-4a73-be69-91347c35e53a
public void setCreatedByLastName(java.lang.String createdByLastName) { this.createdByLastName = createdByLastName; }
d86b9275-dfc0-4c17-9191-ffeb74627a68
public void run() { AboutDialog ad = new AboutDialog(viewer, messageBundle, true, AboutDialog.OK, AboutDialog.NO_TIMER); ad.setVisible(true); }
4b3ddaac-6987-4697-a6d0-c4225630f8d9
public void setCustomPickList8(crmondemand.xml.opportunity.query.QueryType customPickList8) { this.customPickList8 = customPickList8; }
a320f36a-a822-4c78-8729-a310ff79d2a7
public void setCustomPickList11(java.lang.String customPickList11) { this.customPickList11 = customPickList11; }
07cdd1ce-e061-4aab-bb51-bf6243a569dd
public java.lang.String getCustomText3() { return this.customText3; }
8ab236df-783b-4fc2-b2e2-4188188484c1
public java.math.BigDecimal getCustomCurrency19() { return this.customCurrency19; }
9455ab55-4d9a-48d2-b78e-cda572c715b9
public void setCustomText78(crmondemand.xml.opportunity.query.QueryType customText78) { this.customText78 = customText78; }
2676988b-ab06-49d7-a194-efe8eab032b7
public java.lang.String getSearchspec() { return this.searchspec; }
c15a964f-02ff-4c77-a768-c2e4c6723e37
public java.util.Calendar getCustomDate33() { return this.customDate33; }
b55dbbdb-f940-48e9-ae2d-57ae03bb11db
public static Cons computeExternalBindings(Vector externalarguments) { { Cons externalbindings = Stella.NIL; if (externalarguments == null) { return (Stella.NIL); } { Stella_Object arg = null; Vector vector000 = externalarguments; int index000 = 0; int length000 = vector000.length(); Cons collect000 = null; for (;index000 < length000; index000 = index000 + 1) { arg = (vector000.theArray)[index000]; if (collect000 == null) { { collect000 = Cons.cons(Logic.instantiateExternalBindings(Logic.safeArgumentBoundTo(arg)), Stella.NIL); if (externalbindings == Stella.NIL) { externalbindings = collect000; } else { Cons.addConsToEndOfConsList(externalbindings, collect000); } } } else { { collect000.rest = Cons.cons(Logic.instantiateExternalBindings(Logic.safeArgumentBoundTo(arg)), Stella.NIL); collect000 = collect000.rest; } } } } return (externalbindings); } }
50efa6ed-27ce-4e34-8d82-cb1d2d4466aa
public static void main(String[] args) throws IOException { float tempoChegadas = 0; float tempoAtendimento = 0; float qtdCarrosAtendidos = 0; float qtdCarrosPerdidos = 0; float qtdTotalCarros = 0; float tempoEspera = 0; ArrayList<Integer> horariosPicoInicio = new ArrayList<Integer>(); ArrayList<Integer> horariosPicoFim = new ArrayList<Integer>(); //CENARIO 3a //Das 08:00 as 08:30 horariosPicoInicio.add(600); horariosPicoFim.add(530); //Das 12:00 as 13:00 horariosPicoInicio.add(360); horariosPicoFim.add(300); //Das 16:00 as 18:00 horariosPicoInicio.add(60); horariosPicoFim.add(0); // //CENARIO 3b // //Das 10:00 as 14:00 // horariosPicoInicio.add(480); // horariosPicoFim.add(240); // // //Das 16:00 as 18:00 // horariosPicoInicio.add(120); // horariosPicoFim.add(0); FileWriter fw = new FileWriter("resultados_cenario_3a_solucao2.txt", true); BufferedWriter out = new BufferedWriter( fw ); DecimalFormat df = new DecimalFormat(); df.setMaximumFractionDigits(2); for( int i = 0; i < 30; i++ ) { //Cria um posto com 1 lava jato e que trabalha //600 minutos por dia(10 horas) Posto myPosto = new Posto( 2, 600 ); Random rand = new Random(); //Começar casos /** * Caso 1: * Será que a área de espera disponível (para no máximo quatro * automóveis) é suficiente? — * Será que o tempo de serviço é aceitável? — * Será que a produtividade do operador é adequada? */ //Quantidade de carros que foram embora por não ter mais vaga na área de espera float carrosPerdidos = 0; //Quantidade de carros lavados float carrosLavados = 0; //Quantidade de carros que chegaram float qtdCarros = 0; //Define area de espera para 4 carros myPosto.setMaxTamFila(4); //Cada máquina tem um tempo de lavagem diferente? myPosto.getMeusLavaJatos().get(0).setTempoSujo(9); myPosto.getMeusLavaJatos().get(0).setTempoQuaseLimpo(5); myPosto.getMeusLavaJatos().get(0).setTempoBemSujo(13); while( myPosto.getTempoDeOperacao() > 0 ) { Carro carro = new Carro( geraEstadoDeSujeira() ); int tempoChegada = 0; //Atributo que verifica se o carro que chegou conseguiu ir direto pra máquina ou vai para a fila boolean isLavando = false; for( int h=0; h<horariosPicoInicio.size(); h++ ) { if( myPosto.getTempoDeOperacao() <= horariosPicoInicio.get(h) && myPosto.getTempoDeOperacao() >= horariosPicoFim.get(h)) { //tempo de chegada entre 5 e 10 unidades de tempo tempoChegada = 5 + rand.nextInt( 6 ); break; } //tempo de chegada entre 10 e 15 unidades de tempo tempoChegada = 10 + rand.nextInt( 6 ); } if ( ( myPosto.getTempoDeOperacao() - tempoChegada ) < 0 ) { break; } tempoChegadas += tempoChegada; qtdCarros++; qtdTotalCarros++; //Passa o tempo na simulação myPosto.diminuirTempo( tempoChegada ); //Verifica se tem algum lava jato disponível no momento for( LavaJato lj : myPosto.getMeusLavaJatos() ) { //Verifica se o carro que estava usando o lava jato já foi lavado if( lj.getTempoFinalLavagem() != 0 && myPosto.getTempoDeOperacao() <= lj.getTempoFinalLavagem() ) { lj.setEmUso( false ); } //Se não estiver em uso, verifica se existe algum carro na fila. Se não existir, começa o processo para o carro que chegou. if( !lj.isEmUso() ) { if( myPosto.getAreaDeEspera().isEmpty() ) { tempoAtendimento += myPosto.lavar( carro, lj ); isLavando = true; }else{ tempoAtendimento += myPosto.lavar( myPosto.getAreaDeEspera().pegaPrimeiroDaFila(), lj ); tempoEspera += myPosto.getTempoEspera( myPosto.getAreaDeEspera().pegaPrimeiroDaFila() ); myPosto.getAreaDeEspera().removeDaFila( myPosto.getAreaDeEspera().pegaPrimeiroDaFila() ); isLavando = false; } carrosLavados++; break; } } //Não conseguiu vaga na área de espera if( !isLavando && !myPosto.getAreaDeEspera().temVaga() ) { System.out.println( "Carro foi embora por não ter mais vagas!" ); carrosPerdidos++; } //Se não conseguiu ir direto para o lava jato, verifica se tem vaga disponível na area de espera. if ( !isLavando && myPosto.getAreaDeEspera().temVaga() ) { myPosto.getAreaDeEspera().adicionaNaFila( carro, myPosto.getTempoDeOperacao() ); } } //incrementa atributos que são usados na média qtdCarrosAtendidos += carrosLavados; qtdCarrosPerdidos += carrosPerdidos; //escreve em um arquivo os resultados obtidos out.write( "Simulacao " + (i + 1) + ":\n" ); out.write( "A quantidade de carros lavados foi de: " + carrosLavados + "\n" ); out.write( "A quantidade de carros perdidos foi de: " + carrosPerdidos + "\n" ); out.write( "A quantidade de carros que ficaram na fila foi de: " + myPosto.getAreaDeEspera().getMyList().size() + "\n" ); out.write( "A quantidade de carros que chegaram foi: " + qtdCarros + "\n" ); out.write( "------------------------------------------------------------------\n" ); } //Escreve ao final do arquivo, a média das 30 simulações out.write( "A media de carros atendidos e de: " + df.format( qtdCarrosAtendidos/30 ) + "\n" ); out.write( "A media de carros perdidos e de: " + df.format( qtdCarrosPerdidos/30 ) + "\n" ); out.write( "Tempo medio de atendimento: " + df.format( tempoAtendimento/qtdCarrosAtendidos ) + "\n" ); out.write( "Tempo medio de chegadas: " + df.format( tempoChegadas/qtdTotalCarros ) + "\n" ); out.write( "Tempo medio de espera: " + df.format( tempoEspera/qtdCarrosAtendidos ) + "\n" ); out.close(); }
5a36fbbf-6e92-4b61-970d-4d25a6ed5882
public void setCustomObject14Id(java.lang.String customObject14Id) { this.customObject14Id = customObject14Id; }
449ad7a3-9fa5-43d5-a71a-813bb42dce55
public InsurancePolicy getInsurancePolicy() { return insurancePolicy; }
510d6994-8e16-4571-aa19-52ecbe98e774
public java.lang.String getCustomPickList18() { return this.customPickList18; }
992831f4-139d-44e6-ae57-6dca84ea6976
public static String askHash(String msg) { String res = null; while (res == null || !Draft.isHash(res) ) { res = ask(msg); if ( !Draft.isHash(res) ) System.out.println("\n!!! Not an implemented hash function !!!"); } return res; }