method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
73005b58-bec6-4bfd-b643-2edca4608646 | 0 | public int hashCode() {
return myRHS.hashCode() ^ myLHS.hashCode();
} |
c97df6a6-4a3a-46fc-bf20-faa4aae43106 | 1 | private String generateString(String symbol, int lenght){
char[] word = new char[lenght];
for(int i=0; i<lenght; i++){
word[i] = symbol.charAt(random.nextInt(symbol.length()));
}
return new String(word);
} |
149cbb9c-50e9-4b30-9fdb-143720598aa5 | 8 | public void createShowTimes() {
int cineplexCode;
String cinemaCode;
int movieCode;
String showTimeDate;
String showTimesString;
System.out.println("Create ShowTimes");
System.out.println("================");
System.out.println("CINEPLEX CODE\tCINEPLEX NAME");
System.out.println("....................... |
a12ac169-352e-491f-aabe-c9be2f12e72a | 0 | public void clearBreakpoint(int lineNumber) {
sourceLines.get(lineNumber).clearBreakpoint();
} |
cf29067e-4fd1-4bf1-8f59-b81a6c76a173 | 7 | public void buildARFF(String filename) {
try {
ARFFWriter writer = new ARFFWriter(filename, "index");
String docClasses = "{";
boolean first = true;
for (String className : classes) {
if (first) {
docClasses += className;
first = false;
}
else {
docClasses += ", " + className;
... |
16e74a7e-c1af-4392-8194-da132db946c5 | 2 | public boolean canAccess(String key) {
if (permissions.containsKey(key) && permissions.get(key).equals(true)) { return true; }
return false;
} |
a19c3795-d1a5-44a4-9745-05b52a858b8f | 3 | private static String getSuppressedString(Exception e) {
String str = "";
Throwable[] suppressed = e.getSuppressed();
if (suppressed.length == 0)
return null;
else if (suppressed.length == 1) {
return suppressed[0].toString();
} else {
str = suppressed[0].toString();
for (int i = 1; i < suppres... |
1a8892d5-54dc-4f95-8c17-a1f9588f9f45 | 5 | @Test
public void test() {
//Output file
File outputFile = new File("e:\\temp\\debug\\XmlVariableFileTest.xml");
if (outputFile.exists())
assertTrue(outputFile.delete());
//Create variables
// V1
StringVariable v1 = new StringVariable("v1");
v1.setCaption("c1");
v1.setDescription("v1");
v1.s... |
87f9d133-dbbd-495a-9fad-b8745fa82364 | 4 | @Override
public boolean checkGrammarTree(GrammarTree grammarTree,
SyntaxAnalyser syntaxAnalyser) throws GrammarCheckException {
GrammarTree tree = grammarTree.getSubNode(0);
if (tree == null || tree.getSiblingAmount() < 5) {
this.throwExceptionAndAddErrorMsg("step", syntaxAnalyser, null);
}
syntaxAnalys... |
86ecaf30-3a18-4e5d-9f50-23070f0b49a6 | 9 | public static XMLReader getXMLReader(Source inputSource, SourceLocator locator)
throws TransformerException
{
try
{
XMLReader reader = (inputSource instanceof SAXSource)
? ((SAXSource) inputSource).getXMLReader() : null;
if (null == rea... |
3257b2b8-9001-4c2d-94f5-05b1c997d160 | 3 | public void drawText(Graphics g){
g.setFont(font);
// draw lives
g.setColor(Color.WHITE);
g.drawImage(CharacterManager.boyStandFront, WindowManager.width - 100, WindowManager.height - 90, this);
g.drawString("x", WindowManager.width - 65, WindowManager.height - 50);
g.drawString(Integer.toString(Character... |
a322c487-7874-4d03-a901-d03f4a90362b | 1 | @Override
public int hashCode() {
int hash = 0;
hash += (inhusa != null ? inhusa.hashCode() : 0);
return hash;
} |
f7bd5bc8-2dc1-4cdd-82a7-f2aff7c4d8f8 | 3 | private static void read() {
String temp = null;
try {
File file = new File(SavePath.getSettingsPath());
if(file.exists()) {
FileReader fileReader = new FileReader(file.getAbsoluteFile());
BufferedReader bufferedReader = new BufferedReader(fileReader);
temp=bufferedReader.readLine();
b... |
4b130ff0-6929-4c89-8c40-8fbebe553dab | 2 | public void dumpExpression(TabbedPrintWriter writer)
throws java.io.IOException {
if (!postfix)
writer.print(getOperatorString());
writer.startOp(writer.NO_PAREN, 2);
subExpressions[0].dumpExpression(writer);
writer.endOp();
if (postfix)
writer.print(getOperatorString());
} |
6ba6a106-a272-47d4-9ff7-d1cee0569ee2 | 3 | @SuppressWarnings("unchecked")
private static void loader(){
for(String name : typeNames){
try {
types.add((Class<? extends Pet>) Class.forName(name));
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
} |
0a8addd1-c4f7-4380-89cc-f4aca8636179 | 1 | public void visitDefExpr(final DefExpr expr) {
if (expr instanceof MemExpr) {
visitMemExpr((MemExpr) expr);
}
} |
ae7e7a8d-c207-4058-9aa8-25cf528d463a | 6 | public PRectangle createCartesianIntersection(PRectangle src2) {
PRectangle rec = new PRectangle(src2.x, src2.y, src2.width, src2.height);
float xLeft = (x > rec.x) ? x : rec.x;
float xRight = ((x + width) > (rec.x + rec.width)) ?
(rec.x + rec.width) : (x + width);
float... |
eefe031e-aef8-4e30-b790-a6824dd0f3bd | 5 | public String getDifficultyString() {
switch (difficulty){
case 0:
return "Human";
case 1:
return "Random";
case 2:
return "Moderate";
case 3:
return "Hard";
case 4:
return "Extreme";
default:
return "Unknown difficulty";
}
} |
783592df-eaa7-49d7-90d8-bbe7c5d0af9d | 1 | public void beginTurn()
{
for (Unit unit : units) {
unit.beginTurn();
}
} |
2d15a9f6-f187-499e-a3e2-2a0cc4c1fd5b | 1 | public static Reminder findByApptAndUser(long apptId, long userId) throws SQLException {
PreparedStatement statement = connect.prepareStatement(
"select * from Reminder where appointmentId = ? and userId = ?");
statement.setLong(1, apptId);
statement.setLong(2, userId);
statement.executeQuery();
ResultSe... |
16c36c43-a394-4154-86c2-9dca3337127c | 4 | public boolean hasCycle(ListNode head) {
ListNode slow = head;
ListNode fast = head;
while( slow != null &&fast!= null && fast.next!= null){
slow = slow.next;
fast = fast.next.next;
if(slow == fast)
return true;
}
return false;
... |
8a2ce969-420b-4713-ad2a-9b9c7fd0fe55 | 8 | @Override
public void doAlgorithm() {
GraphModel g = graphData.getGraph();
boolean cont = true;
int fillin = 0;
while(cont) {
Vertex v1 = requestVertex(g, "select a vertex");
Vector<Vertex> InV = new Vector<>();
Vector<Vertex> OutV = new Vector<>()... |
5c981339-4af0-4074-843d-a06d0d81b780 | 5 | @SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create (Gson gson, TypeToken<T> type) {
if (!type.getRawType().isEnum())
return null;
final Map<String, T> map = Maps.newHashMap();
for (T c : (T[]) type.getRawType().getEnumConstants()) {
map.put(... |
a4e1982a-34ee-4884-8945-18a526a6ffa9 | 7 | public LearningEvaluation evalModel (InstanceStream trainStream, InstanceStream testStream, AbstractClassifier model) {
ClassificationPerformanceEvaluator evaluator = new BasicClassificationPerformanceEvaluator();
evaluator.reset();
long instancesProcessed = 0;
System.out.println("Evalua... |
8dbf00b1-fc38-4474-b2fe-020ce8dcbdc9 | 9 | public IndexResolution resolveIndex(final int index, final boolean fallLeftOnBoundaries) {
checkIndex(index, "Index");
if (fallLeftOnBoundaries && index==0) {
/* If falling to left at index 0, then we miss the first component completely. This is
* not useful in practice!
... |
cd10131a-c955-4218-99e2-a08a5236362b | 2 | private static boolean readFully(InputStream in, byte[] buf) throws IOException {
int len = buf.length;
int pos = 0;
while (pos < len) {
int read = in.read(buf, pos, len - pos);
if (read == -1) {
return true;
}
pos += read;
}
return false;
} |
18dc4286-d88f-4686-b048-7d380884f2c0 | 9 | private void doAction(final Pair<String> action) {
switch(action.one) {
case "add_user":
final String[] temp = action.two.split(" ");
if( temp.length == 2 ) {
if( addUser(temp[0], temp[1]) ) {
writeToScreen("ADDUSER: Added user '" + temp[0] + "' with password '" + temp[1] + "'.");
}
else ... |
8c0707b6-5d3f-433d-81cc-f18cf6b72478 | 4 | public boolean setWindow(GameWindow window) {
boolean test = false;
if (test || m_test) {
System.out.println("Game :: setWindow() BEGIN");
}
m_gameWindow = window;
if (test || m_test) {
System.out.println("Game :: setWindow() END");
}
... |
1d176aa8-1007-4751-897b-d65c80bd68f0 | 0 | public static void main(String[] args)
{
System.out.println(getPinyin("你你好吗"));
} |
ddab0ccd-afec-47b3-9db9-fd4a7c62c0e1 | 1 | public static String getDisplayString(Object obj) {
if (obj == null) {
return EMPTY_STRING;
}
return nullSafeToString(obj);
} |
95e278fe-08a5-48c8-a0e2-9f3ed53c867a | 9 | private boolean setFrameworkFieldsAndValidate(Framework f) {
if (f == null) {
f = new Framework();
}
String name = txtName.getText();
String currentVersion = txtCurrentVersion.getText();
String homePage = txtHomePage.getText();
String creator = txtCreator.getText();
String lastReleaseDate = txtReleaseD... |
e95c4022-1729-4d4f-b361-a73ee8c04736 | 4 | public int getTextHeight(boolean shadowed) {
int height = 10;
if (name.equalsIgnoreCase("p11_full")) {
height = 11;
}
if (name.equalsIgnoreCase("p12_full")) {
height = 14;
}
if (name.equalsIgnoreCase("b12_full")) {
height = 14;
}
if (name.equalsIgnoreCase("q8_full")) {
height = 16;
}
ret... |
fa1578db-f609-4dc2-84b9-5bdeae634316 | 3 | public void test_16_indels() {
String vcfFile = "tests/1kg.indels.vcf";
VcfFileIterator vcf = new VcfFileIterator(vcfFile);
for (VcfEntry ve : vcf) {
StringBuilder seqChangeResult = new StringBuilder();
for (Variant sc : ve.variants()) {
if (seqChangeResult.length() > 0) seqChangeResult.append(",");
... |
76b6fd2b-4be7-4ab4-9dcc-ee68c7457d86 | 3 | public int[] Sort(int data[], int n){
// pre: 0 <= n <= data.length
// post: values in data[0..n-1] in ascending order
int numSorted = 0; // number of values in order
int index; // general index
while (numSorted < n){ // bubble a large element to higher array index
for (ind... |
b74f900a-b41d-4842-9595-192413835e72 | 4 | @Override
@EventHandler
public void handleTeamPlayerDeath(PlayerDeathEvent e) {
if (inTeam( CTFPlugin.getTeamPlayer(e.getEntity()) )) {
System.out.println("Played died");
//set the respawn point
e.getEntity().setBedSpawnLocation(spawnLocations.get(rand.nextInt(spawnLocations.size())));
... |
d91a3f5b-4372-4b6f-a5c4-72a0934f9e8f | 5 | @Override
protected String createResourceString(ArrayList<StringResource> resource, String locale) {
StringBuilder sb = new StringBuilder();
sb.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
sb.append("\n\n");
sb.append(getAutoGeneratedText());
sb.append("\n");
sb.append("<resources>");
sb.append(... |
bb49d66d-14b1-4d5a-81d0-af7080cefb12 | 3 | private void initialize()
{
File f = new File("etc/map.html");
brw.setUrl(f.toURI().toString());
//
brw.addProgressListener(new ProgressListener() {
@Override
public void completed(ProgressEvent arg0) {
for(Runnable r : enqueuedMarkers)
execute(r);
enqueuedMarkers.clear();
synchroniz... |
850b9709-6cfa-4f42-a7bd-a1e210cad367 | 8 | @Override
public boolean importData( TransferSupport support )
{
if( !canImport(support) )
return false;
JTabbedPaneTransferable d = null;
try
{
d = (JTabbedPaneTransferable)support.getTransferable().getTransferData( draggab... |
da84c3b2-867d-457c-80d4-1ded8450af03 | 0 | @Override
public void setWorkingDay(String workingDay) {
super.setWorkingDay(workingDay);
} |
3a8610e8-abea-4a37-97e8-7bbb2a1e30f0 | 5 | protected void dataAttributeChanged(final BPKeyWords keyWord, final Object value) {
if (value != null) {
if (keyWord == BPKeyWords.UNIQUE_NAME) {
setValue(value);
textChanged();
} else if (keyWord == BPKeyWords.NAME || keyWord == BPKeyWords.DESCRIPTION || ... |
4e73b782-ed83-4a46-8a37-b8ada2714ff5 | 7 | public ArrayList<String> CMBProjetos(String CodDepartamento) throws SQLException {
ArrayList<String> Projeto = new ArrayList<>();
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
try {
conexao = BancoDadosUtil.getConnection()... |
7bb51d1c-7a93-4bcf-a8c2-0e81eba7f17f | 7 | public byte[] crypt(byte[] data) {
int remaining = data.length;
int llength = 0x5B0;
int start = 0;
while (remaining > 0) {
byte[] myIv = BitTools.multiplyBytes(this.iv, 4, 4);
if (remaining < llength) {
llength = remaining;
}
for (int x = start; x < (start + llength); x++) {
if ((x - start)... |
74a46a6b-f228-4ec4-95b9-e86a1ba46d59 | 6 | public int GetNpcKiller(int NPCID) {
int Killer = 0;
int Count = 0;
for (int i = 1; i < server.playerHandler.maxPlayers; i++) {
if (Killer == 0) {
Killer = i;
Count = 1;
} else {
if (npcs[NPCID].Killing[i] > npcs[NPCID].Killing[Killer]) {
Killer = i;
Count = 1;
} else if (npcs[NPCI... |
32ba68e1-f061-4f0f-87fd-24c0db661e6c | 6 | @Override
public boolean onCommand(CommandSender sender, Command command,
String label, String[] args) {
if(!sender.hasPermission(pluginMain.pluginManager.getPermission("thf.mute"))){
sender.sendMessage(ChatColor.DARK_RED + "You do not have permission! I am going to haunt you from " +
"beyond the grave!")... |
45fa89f6-d0d2-4cd2-b3f2-2dbd85ffac5d | 7 | @Override
public void mouseClick(int X, int Y) {
Rectangle TopRect = new Rectangle(this.getSize().getWidth() -10, 0, 10, 10);
Rectangle BottomRect = new Rectangle(this.getSize().getWidth() -10, this.getSize().getHeight() - 10, 10, 10);
if(TopRect.contains(X,Y) && this.ScrollYValue > 0)
... |
d95bdc05-dfd4-468e-abd9-88e69320f6ea | 0 | public LLParsePane(GrammarEnvironment environment, Grammar grammar,
LLParseTable table) {
super(environment, grammar);
this.table = new LLParseTable(table) {
public boolean isCellEditable(int r, int c) {
return false;
}
};
initView();
} |
ced8ba2a-e8c2-46c7-85b4-6a9a3e400963 | 5 | public static void main(String[] args) {
if (args.length == 0) {
solveRandomPuzzle();
} else {
if (args[0].equals("a")) {
new IdaVSAstarComparison().run(esim1);
}
if (args[0].equals("b")) {
new AverageRunTime(new Ma... |
e04cf406-03b0-4ea4-8489-c9735d68b501 | 7 | public static void main(String[] args) throws IOException, ParseException {
int classNumber = 5; //Define the number of classes in this Naive Bayes.
int Ngram = 1; //The default value is unigram.
// The way of calculating the feature value, which can also be "TFIDF",
// "BM25"
String featureValue = "BM25";
... |
f9e09a73-c592-46b7-abeb-6ae58bbd47f9 | 4 | public void travel()
{
while(this.isLiving == true)
{
if(settlementList.size() > 1)
{
Settlement from;
Settlement to;
for(int i=0; i<settlementList.size() -1; i++)
{
from = settlementList.get(i);
to = settlementList.get(i+1);
if(to.getPopulation() >0)
{
this.move(fro... |
84c73e44-33ee-4866-a2ec-7a7be07bc14b | 7 | public OutputStream getOutputStream() throws IOException {
if (output==null) {
throw new IOException("headers already sent");
}
final Charset ascii = StandardCharsets.US_ASCII;
final byte[] separ = ": ".getBytes(ascii);
final byte[] comma = ", ".getBytes(ascii);
final byte[] endl = "\n".getBytes(ascii);
... |
bb334a03-5404-4b01-8a73-12fa1e0bf6cf | 7 | public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... |
cd5a273b-4722-4e65-aa19-1b8a9e869560 | 6 | @SuppressWarnings("unchecked")
public void listen() {
try {
SSLContext sc = SSLContext.getInstance("TLS");
sc.init(null, null, null);
SSLServerSocketFactory ssf = sc.getServerSocketFactory();
SSLServerSocket socketS = (SSLServerSocket) ssf.createServerSocket(port);
bb.net.util.Socket.enableAnonConn... |
f576401f-a357-4db7-ab8b-7c04d761ef21 | 1 | private double[] calculateCognitiveVelocity(int particle){
double[] cognitiveVelocity = new double[position[particle].length];
for(int k = 0; k < cognitiveVelocity.length; k++){
cognitiveVelocity[k] = cognitiveConstant * (personalBest[particle][k] - position[particle][k]);
}
return cognitiveVelocity;
... |
d982fa40-eb6b-43f4-b501-8f6c3f49f7d4 | 4 | protected int insertWithReturn(String sql) {
try {
// createConnection();
createPreparedStatement(sql);
int affectedRows = pstmt.executeUpdate();
if (affectedRows == 0) {
throw new SQLException("Creating failed, no rows affected.");
}
try (ResultSet generatedKeys = pstmt.ge... |
99d37359-01bb-4ec6-bba8-ae501c064cb3 | 6 | public int mergeAdjacentFace (HalfEdge hedgeAdj,
Face[] discarded)
{
Face oppFace = hedgeAdj.oppositeFace();
int numDiscarded = 0;
discarded[numDiscarded++] = oppFace;
oppFace.mark = DELETED;
HalfEdge hedgeOpp = hedgeAdj.getOpposite();
HalfEdge hedgeAdjPrev = hedgeAdj.prev;
Ha... |
23ffa767-82ff-4880-92de-123d01aff954 | 8 | private void findRecord(String[] data) {
String option = null;
String prefix = null;
GregorianCalendar fromGc = null;
GregorianCalendar toGc = null;
long id = 0;
try {
option = data[1].toLowerCase();
MyArrayList<Employee> findResult = new MyArrayList<>();
switch (option) {
case "id":
findRes... |
627766c2-ede3-4ae5-aeda-4162b264a789 | 2 | private void addDoorSprite( int centerX, int centerY, int level, ShipLayout.DoorCoordinate doorCoord, SavedGameParser.DoorState doorState ) {
int offsetX = 0, offsetY = 0, w = 35, h = 35;
int levelCount = 3;
// Dom't scale the image, but pass negative size to define the fallback dummy image.
BufferedImage bigI... |
aebb481a-29ed-4a99-92c2-192e01a61fb4 | 0 | public static byte[] ElgamalDecrypt(String key, String base, BigInteger x, BigInteger p) throws Exception {
BigInteger c = new BigInteger(key, 16);
BigInteger a = new BigInteger(base, 16);
//decrypt m = (c - a^x)(mod p)
BigInteger m = c.subtract(a.modPow(x, p)).mod(p);
return Ut... |
ef94e685-7ab5-4e31-932b-958f5b7724aa | 5 | public static void enemyturn() {
int enemyHitChance; //enemies Hit Chance
int enemyAttack; //enemies Attack
Random rnd = new Random();
EnemyRat RatTurn = new EnemyRat();
if (enemyHealth > 0 && Statistics.Health > 0) {
enemyHitChance = rnd.nextInt(20) + 3;
if (enemyHitChance > 12) {
enemyAttack =... |
ffe71dae-97fb-4c74-a4c5-bfb4fadd6110 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Fragestellung other = (Fragestellung) obj;
if (frageStellung == null) {
if (other.frageStellung != null)
return false;
} else if (!frage... |
43b1ba3c-3e9f-4637-9085-e59a2b0d837a | 2 | public int dimensions() {
for (int i = 0; i < desc.length(); i++) {
if (desc.charAt(i) != Type.ARRAY_CHAR) {
return i;
}
}
throw new IllegalArgumentException(desc
+ " does not have an element type.");
} |
fe703483-962c-405d-8d52-8942e748f765 | 8 | @Override
public ArrayList<BoardPosition> getPossibleMoves(Board board, BoardPosition startingPosition) {
//replace with enpassant - b/c pawn cannot capture when going forward
ArrayList<BoardPosition> possibleMoves = new ArrayList<BoardPosition>();
PawnStraightMove forward = new PawnStraight... |
81b896af-2372-4898-ba0e-77941f25ed7d | 1 | public static void toggleCommentAndClearText(Node currentNode, JoeTree tree, OutlineLayoutManager layout) {
CompoundUndoablePropertyChange undoable = new CompoundUndoablePropertyChange(tree);
toggleCommentAndClearForSingleNode(currentNode, undoable);
if (!undoable.isEmpty()) {
undoable.setName("Toggle Comment... |
92f38c8b-1b07-46d5-99a6-9fd024e2da92 | 0 | public void initLoadNetFile() {
isRun = true;
urlPath = "";
savePath = "";
fileName = "";
speedKB = 0;
} |
132dced9-40e3-4af8-9a7f-d28934609a1c | 9 | public static void printType(Node node)
{
System.out.print(node.getNodeName() + " type=");
int type = node.getNodeType();
switch (type)
{
case Node.COMMENT_NODE:
System.out.println("COMMENT_NODE");
break;
case Node.DOCUMENT_FRAGMENT_NODE:
System.out.println("DOCUMENT_FRAGMENT_NODE");
break;
c... |
f67dc120-5b23-448a-aa27-c95f4f51af26 | 6 | private static boolean isPrime(int n) {
if (n < 10) {
return n == 2 || n == 3 || n == 5 || n == 7;
}
int end = (int) Math.ceil(Math.sqrt(n));
for (int i = 2; i <= end; i++)
if (n % i == 0)
return false;
return true;
} |
4775fa52-45ec-456b-8bb0-8cba26beae7a | 8 | int readPartition(ByteSequencesReader reader) throws IOException {
long start = System.currentTimeMillis();
if (valueLength != -1) {
int limit = ramBufferSize.bytes / valueLength;
for(int i=0;i<limit;i++) {
BytesRef item = null;
try {
item = reader.next();
} catch (... |
ce58cdfc-65d7-4d5b-a3d5-db8cb1e615f1 | 5 | @Override
public VirtualMachineStatus status(VirtualMachine virtualMachine)
throws Exception {
boolean vmExists = checkWhetherMachineExists(virtualMachine);
if (!vmExists) {
return VirtualMachineStatus.NOT_CREATED;
}
ProcessBuilder statusProcess = getVMProcessBuilder(virtualMachine,
"status");
E... |
a8d8f182-cbb8-411a-820a-a26964fbf354 | 2 | private static int[] createMask(Text[] tt) {
int[] mask = new int[9];
try {
for (int i = 0; i < tt.length; i++) {
mask[i] = Integer.parseInt(tt[i].getText());
}
} catch (Exception e) {
e.printStackTrace();
}
return mask;
} |
5705a749-d57e-447f-ad7c-648c2ef4b958 | 6 | public static void main(String[] args) {
// cr�ation et ouverture du fichier en lecture
Fichier fichierR = new Fichier();
fichierR.ouvrir(args[0], 'R');
String ligneInput = null;
Map<String, Vertex<String>> vertices = new HashMap<String, Vertex<String>>();
Graph<String, Integer> graph = new AdjacencyMapGrap... |
3c59156c-4125-4062-8e76-b43e7fa1c674 | 1 | private void indirectSort(T[] a, int[] perm, int[] aux,
int lo, int hi)
{ // Sort perm[lo..hi].
if (hi <= lo)
return;
int mid = lo + (hi - lo) / 2;
indirectSort(a, perm, aux, lo, mid); // Sort left half.
indirectSort(a, perm, aux, mid + 1, hi); // Sort right half.
mergeIndirect(a, perm, aux, lo, mid, h... |
309efff8-2781-4a6e-b212-72a5a730f68b | 4 | @Override
public void Undo()
{
Rectangle obr = getObjectRectangle();
for (LevelItem obj : objs)
{
Rectangle r = obj.getRect();
r.x -= XDelta;
r.y -= YDelta;
r.width -= XSDelta;
r.height -= YSDelta;
obj.setRect(r);
... |
33eb8712-7ebe-4440-831b-780c49a5fae5 | 0 | public void setPoints(Vecteur<Integer>[] value) {
etat = value;
} |
96c42cde-f4d2-4e52-acdc-887f70de08fd | 1 | public void restart()
{
for(Tile t : gameBoard)
{
t.updateState(TileState.BLANK);
}
player = 1;
gameWon = false;
} |
f74c18c0-6299-4fb3-a485-2a94d97274ce | 8 | public static void main(String[] artgs) {
long startTime = System.nanoTime();
//the first and last digits must be 2, 3, 5, 7
// System.out.print("Primes under 10: ");
// for (int i = 2; i < 10; i++) {
// if (p7primefinder.isPrime(i)) {
// System.out.print(i + ", "... |
0a309a83-c779-42ab-a844-8495d39661b5 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
e3bb19e1-2991-4a10-be16-6d7f55c8f39b | 5 | private void button8MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_button8MouseClicked
if(numberofpins < 4)
{
if(numberofpins == 0)
{
Login_form.setString1("7");
}
if(numberofpins == 1)
{
Login_form.setString2("7");
}
if(numberofpins == 2)
{
Login_... |
c2ade714-f3a4-404e-a4b1-4f42a3ab232b | 6 | public ArrayList<Trade> newRound(int round, ArrayList<EconomicIndicator> indicators, ArrayList<Stock> stocks) {
HashMap<String, Stock> stockMap = mapPrices(stocks);
ArrayList<Trade> allTrades = new ArrayList<Trade>();
for (Player player : players){
ArrayList<Trade> trades = player.placeTrade(round,
... |
1c581d22-ae81-40df-a805-c951b59953dd | 3 | @Override
public void deserialize(Buffer buf) {
reportedId = buf.readUInt();
if (reportedId < 0 || reportedId > 4294967295L)
throw new RuntimeException("Forbidden value on reportedId = " + reportedId + ", it doesn't respect the following condition : reportedId < 0 || reportedId > 4294967... |
927ba42c-7a8c-4e4a-b259-6e42b9b95d95 | 4 | /* */ @EventHandler
/* */ public void onPlayerInteractEntity(PlayerInteractEntityEvent event)
/* */ {
/* 225 */ if (Main.getAPI().isSpectating(event.getPlayer()))
/* */ {
/* 227 */ if (Main.getAPI().isReadyForNextScroll(event.getPlayer()))
/* */ {
/* 229 */ if (Main... |
25c2c125-47fe-4813-a707-2579d4e45d67 | 8 | public boolean start() {
if (socketExchanger == null) {
log.error("A socket-exchanger is required.");
}
if (serverSocket == null && !openSocketServer()) {
return false;
}
int initWorkers = socketExchanger.minWorkers;
if (initWorkers < 1) initWorkers = 1;
boolean initError = false;
try {
for (i... |
0d1fefcf-0fae-49d7-83ec-dee33b2b809a | 7 | public static void removeStateChange(int objectType, int objectX, int objectY, int objectHeight)
{
for (int index = 0; index < stateChanges.size(); index++)
{
StateObject so = stateChanges.get(index);
if(so == null)
continue;
if((so.getX() == objectX && so.getY() == objectY && so.getHeight() == object... |
31a405d1-cde3-4f48-b6ec-7f34027f966e | 6 | @Override
public void keyReleased(KeyEvent e) {
// if we're waiting for an "any key" typed then we don't
// want to do anything with just a "released"
if (waitingForKeyPress) {
return;
}
if (e.getKeyCode() == KeyEvent.VK_L... |
01649c84-7a27-42f9-ae83-640123f11bf7 | 2 | public void logMessage(int level, String message) {
if (this.level <= level) {
writeMessage(message);
}
if (nextLogger != null) {
nextLogger.logMessage(level, message);
}
} |
d784c925-33f4-4303-8bfb-0d2409ff6257 | 4 | @Points(value = 5)
@Test
public void dutchTwoHundredFrameBallAndScoreTest()
{
int[] pinsKnockedDownArray = new int[] { 1, 9, 10, 2, 8, 10, 3, 7, 10, 4, 6, 10, 5, 5, 10, 6, 4 };
for (int frameNumber = 1; frameNumber <= 9; frameNumber++)
{
assertEquals(frameNumber, singlePlayerBowlingScoreboard_STUDENT.getCu... |
d4de03fc-bb2d-48ba-a6bb-4f282638282a | 8 | public CubeColor[][] getColorMapByFace(Face face) {
CubeColor[][] colorMap = new CubeColor[getCubeComplexity()][];
for (int i=0; i<getCubeComplexity(); i++) {
colorMap[i] = new CubeColor[getCubeComplexity()];
for (int j=0; j<getCubeComplexity(); j++) {
CubeColor c... |
7f308dbe-ca9b-4d08-915b-b78dcdf48408 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
186eba0e-bd0a-4c19-af16-3828a3d85771 | 5 | private void plotOverlay( Graphics2D g )
{
// If overlay drawing fails, just ignore it
try
{
File overlayImg = graphDef.getOverlay();
if ( overlayImg != null )
{
BufferedImage img = ImageIO.read(overlayImg);
int w = img.getWidth();
int h = img.getHeight();
int rgbWhite = ... |
ddb24ffa-137b-40ed-a6ca-de39013a98df | 4 | public void showAutoComplete(InterfaceController controller, ConstructEditor editor, IAutoCompleteListener listener, EInterfaceAction binding)
{
if(mAutoCompleteDialog != null &&
mAutoCompleteEditor != editor) {
hideAutoComplete(true);
}
// Figure out top left position of dialog
Component editorComp... |
3259c4c8-0903-4994-aee0-9e0079ae7b0d | 1 | private JLabel getJLabel1() {
if (jLabel1 == null) {
jLabel1 = new JLabel();
jLabel1.setText("SQL:");
}
return jLabel1;
} |
a4d0b672-6826-4ed7-882a-7339138656da | 5 | private String getExceptParams(ArrayList<String> alExcept) {
String resultado = "";
for (Map.Entry<String, String> entry : this.parameters.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (!value.equalsIgnoreCase("")) {
St... |
f94fda1e-9bef-4be7-b13b-0e1dc81797f7 | 9 | private double calcWeightsLL(int a, int b) {
double sum=0;
int ri=trainSet.getRi(a);
int rii=trainSet.getRi(b);
for (int j = 0; j < trainSet.getRi(b); j++) {
for (int k = 0; k < trainSet.getRi(a); k++) {
for (int c = 0; c < trainSet.getS(); c++) {
int Nijkc = 0;
int NJikc = 0;
... |
5f3cf797-2e7f-4e87-acde-d60d7db78633 | 1 | @Test
public void testDisconnectDueToMin() throws Exception {
final Properties config = new Properties();
final int min_uptime = 20;
final int max_uptime = 2000;
config.setProperty("min_uptime", "" + min_uptime);
config.setProperty("max_uptime", "" + max_uptime);
f... |
af0f6ba1-1c95-468e-ab1a-959c48d1f0aa | 2 | public static int getLogLevel() {
for (Map.Entry<Integer, Integer> entry : logLevelEquivalents.entrySet()) {
if (entry.getValue().equals(org.apache.log4j.Logger.getRootLogger().getLevel().toInt())) {
return entry.getKey();
}
}
return 0;
} |
1b8586bc-cc96-41a1-b3b7-c52d4c024bb8 | 8 | private void mouseAction(int idx) {
/* Spurious entry into cell (Random mouse movement) */
if (m_dragFlag == false || State.gameOverFlag) {
return;
}
boolean adjacent = checkAdjacentCell(idx);
if (m_Button[idx].isSelected() == false) {
if (adjacent || m_... |
9ce1f74b-9f8d-4371-b9a5-49611a9f4af3 | 2 | public Object getChild(Object parent, int index) {
if (parent instanceof Page) {
Page p = (Page) parent;
if (index >= p.subPages.size()) {
int j = index - p.subPages.size();
return p.names.get(j);
} else {
return p.subPages.get(... |
11df9c84-c995-4f9a-bca7-6e380b4518a4 | 2 | public void visitMultiANewArrayInsn(final String desc, final int dims) {
mv.visitMultiANewArrayInsn(desc, dims);
if (constructor) {
for (int i = 0; i < dims; i++) {
popValue();
}
pushValue(OTHER);
}
} |
63d0c23c-e3fd-4b87-abb6-d7dcc95927df | 5 | protected void write(final byte[] message) throws SyslogRuntimeException {
if (this.socket == null) {
createDatagramSocket(false);
}
final InetAddress hostAddress = getHostAddress();
final DatagramPacket packet = new DatagramPacket(
message,
message.length,
hostAddress,
this.syslogConfig.ge... |
eefb1f3e-e790-431a-9ad0-8bd001e46bb3 | 4 | public void removeProduction(Production production) {
myProductions.remove(production);
GrammarChecker gc = new GrammarChecker();
/**
* Remove any variables that existed only in the production being
* removed.
*/
String[] variablesInProduction = production.getVariables();
for (int k = 0; k < variable... |
8c2e1eaf-6c62-4aef-8a30-275411e35bf9 | 9 | private void cleaningText() {
int latinCount = 0, nonLatinCount = 0;
for(int i = 0; i < text.length(); ++i) {
char c = text.charAt(i);
if (c <= 'z' && c >= 'A') {
++latinCount;
} else if (c >= '\u0300' && UnicodeBlock.of(c) != UnicodeBlock.LATIN_EXTEND... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.