method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b313a103-ab30-4f0a-a8cb-d16abcb903d8 | 5 | @Override
public void deserialize(Buffer buf) {
super.deserialize(buf);
worldX = buf.readShort();
if (worldX < -255 || worldX > 255)
throw new RuntimeException("Forbidden value on worldX = " + worldX + ", it doesn't respect the following condition : worldX < -255 || worldX > 255"... |
dbc4af54-2915-44e5-ba1b-af108eb4c92f | 8 | public void makeMove(LaenderGraph laenderGraph) {
while(!zugZuende) {
int vonID = brett.getID();
int nachID = brett.getID();
System.out.println("Von: ");
Land von = laenderGraph.getLaenderList().getLandByID(vonID);
System.out.println("Nach");
Land nach = laenderGraph.getLaenderList(... |
c42ca7a1-2262-4e59-8f1b-4ca00f634359 | 6 | public void stateChanged(ChangeEvent e) {
SpinnerNumberModel model = (SpinnerNumberModel) ((JSpinner) e.getSource()).getModel();
int value = model.getNumber().intValue();
boolean increase = (value > oldSpinnerValue) ? true : false;
oldSpinnerValue = value;
int month = getMonth();
if (increase) {
month ... |
2ea903bf-1891-4124-8b78-33697ae7a1e8 | 4 | private static Tile generateGrass(int x, int y) {
Tile tile = null;
byte b = (byte) (Math.random() * 3);
if (b == 0) {
tile = new GrassTile(x * MyStage.TILE_SIZE, y * MyStage.TILE_SIZE);
} else if (b == 1) {
tile = new GrassFlowersTile(x * MyStage.TILE_SIZE, y * M... |
04904168-ba5e-4f40-8325-a56549b881a1 | 9 | private static ExternalFinderItem generateFinderItem(Node item) {
if (!item.hasChildNodes()) {
return null;
}
final NodeList childNodes = item.getChildNodes();
final ExternalFinderItem finderItem = new ExternalFinderItem();
// retrive popup
if (item.hasAttri... |
3109e244-e822-4e4a-a334-34fa723df641 | 7 | @Override
public void initialize(URL arg0, ResourceBundle arg1) {
PlayerPtrVector ppv = HockmanMain.game.getLeague().getPlayerVector();
this.statppv = new PlayerPtrVector();
int nofPlayers = ppv.GetNofPlayers();
for (int i = 0; i < nofPlayers; i++) {
Player player = ppv.GetPlayer(i);
Team team = player.g... |
b5935d7b-090b-49f0-8c21-e2a10b6d46de | 3 | public final synchronized int numberOfLines(){
FileInput fin = new FileInput(this.pathName);
fin.setSupressMessageToTrue();
boolean test = true;
int nLines = 0;
while(test){
String inputLine = fin.readLineL();
if(fin.eof){
... |
e8e4d1c7-d5ac-4d69-a3d3-8a9fd524ecc7 | 4 | private List<NoeudInterface> loadServerStubs() {
List<NoeudInterface> liste = new LinkedList<NoeudInterface>();
for(String host: hostnames){
try {
Registry reg = LocateRegistry.getRegistry(host, 5042);
liste.add((NoeudInterface) reg.lookup("noeud"));
} catch (NotBoundException e) {
System.out.p... |
a5df5573-faa8-47f8-b9f4-b709989ea601 | 1 | public static void main(String[] args) throws Exception {
InputStream inputStream = Recicled.class.getResourceAsStream("C-large-practice.in");
InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
BufferedReader bf = new BufferedReader(inputStreamReader);
int cases = Integer.parseInt(bf.read... |
4c7e7e71-b6ff-43e7-aae6-7cfaaad05270 | 9 | public void prompt() {
if (promptOnError) {
System.err.println(localize("resume.abort"));
char ch;
try {
while (true) {
switch (System.in.read()) {
case 'a': case 'A':
System.exit(-1);
... |
0f32cebb-d23a-42db-8aa0-62895a751ac0 | 3 | public Vector2 GetNormalized()
{
double length = Math.sqrt(X * X + Y * Y);
if (length != 0.0)
{
float s = 1.0f / (float) length;
double newX = X * s, newY = Y * s;
if (newX > 1)
{
newX = 1;
newY = 0;
}
else if (newY > 1)
{
newY = 1;
newX = 0;
}
return (new Vector2(newX,... |
c21ad826-58f9-45c2-b7d2-12e315253637 | 2 | public static String getFileName(String path) {
if (StringUtil.isEmpty(path))
return "";
path = path.replace("\\", "/");
if (path.lastIndexOf("/") > -1)
return path.substring(path.lastIndexOf("/") + 1);
return path;
} |
063c7b20-459c-491e-98f0-3d43345259eb | 7 | @Override
public List<Produto> Buscar(Produto obj) {
String consulta = "select p from Produto p";
String filtro = "";
HashMap<String, Object> parametros = new HashMap<String, Object>();
if (obj != null) {
if (obj.getIdProduto()!= null) {
... |
4c1bc6bc-6d0e-4dfc-868e-9b26996ab156 | 2 | public int attackNormal( Character opponent ) {
int type = (int)(Math.random()*2);
int damage = 0;
if (type == 0){
System.out.println(_name+" assigns a pop test! It's worth 95% of your grade!");
damage = givesTest(opponent);}
else {
System.out.println(_name + " forces students to use slow comp... |
9a1b03de-b09a-456f-bcaa-43ad0fefe870 | 9 | public void fileMerge(String outputFilePath, File...files) throws Exception {
BufferedWriter outputFile = new BufferedWriter(new FileWriter(outputFilePath));
List<BufferedReader> inputFiles = new ArrayList<BufferedReader>(files.length);
for(int i = 0; i < files.length; i++) {
inputFiles.add(new BufferedRead... |
60c99cac-e1e1-411c-83a1-26b36ea59478 | 2 | private static void printInterface (int indent, Interface intf)
throws IOException
{
indentLine (indent, "<"
+ intf.getInterfaceClassName ()
+ " number='"
+ intf.getNumber ()
+ "' alt='"
+ intf.getAlternateSetting ()
+ "' endpoints='"
+ intf.getNumEndpoints ()
+ "'");
i... |
8fdb0fa6-5d87-49bf-85b3-8e64f32ca9e1 | 7 | private String buildPostBody(String method, Map<String, String> params, String... strings) {
StringBuilder builder = new StringBuilder(100);
builder.append("method=");
builder.append(method);
builder.append('&');
for (Iterator<Entry<String, String>> it = params.entrySet().iterator(); it.hasNext();) {
Entry... |
cf149ba7-52fe-4938-a441-75a12819dd33 | 5 | final void method3224(byte i) {
if (((Class348_Sub42_Sub11) this).anIntArray9580 != null) {
for (int i_3_ = 0;
((i_3_ ^ 0xffffffff)
> (((Class348_Sub42_Sub11) this).anIntArray9580.length
^ 0xffffffff));
i_3_++)
((Class348_Sub42_Sub11) this).anIntArray9580[i_3_]
= Class273.bitOr((((Class34... |
dbe69768-9ebe-4781-b58f-82d1f13c123d | 8 | public static void printResult(InputReader in, String outputFile) throws IOException{
FileWriter f = new FileWriter(outputFile);
BufferedWriter outFile = new BufferedWriter(f);
outFile.write("Rezultate pentru: (");
for (int i = 0; i < in.NC; i++) {
outFile.write(in.k... |
57d57c5e-b8be-4880-a7ab-ac47e0ab3aaa | 3 | public char skipTo(char to) throws JSONException {
char c;
try {
int startIndex = this.index;
reader.mark(Integer.MAX_VALUE);
do {
c = next();
if (c == 0) {
reader.reset();
this.index = startIndex... |
23269069-d169-48cb-b99b-ee3c9800e6d9 | 1 | private static void addShutdownHook() throws Throwable {
LOG.info("Adding ShutdownHook");
try { // adding shutdown hook
Runtime.getRuntime().addShutdownHook(new Thread(new ShutdownHook()));
LOG.info("ShutdownHook added");
} catch (Throwable t) {
LOG.error("Add... |
7ae4b054-d1e2-433c-b817-87a5e4768a9f | 9 | void setOtherOptions() {
reverseMouseButtons2And3
= choices[mouseButtonIndex].getSelectedItem().equals("Reversed");
viewOnly
= choices[viewOnlyIndex].getSelectedItem().equals("Yes");
if (viewer.vncCanvas != null)
viewer.vncCanvas.enableInput(!viewOnly);
shareDesktop
= choices... |
17346a0d-71ed-4d81-9c88-3d10d6930bd0 | 2 | public void addEdge(Edge edge) {
// check for already added removed
// if (adjacentEdges.contains(edge)) {
// throw new
// IllegalArgumentException("Edge has already been added");
// } else
if (howManyEdges() >= 4) {
... |
73dfa74e-254d-4c9b-99ed-ed47ee8e2dcc | 6 | public static void main(String[] args) {
Population first = new Population(20);
double peakFitness = -10.0;
int peakGen =1;
for (int a =0; a<100; a++)
{
//generates comparision teams
Population generationFoes = new Population(10);
... |
545a0fa8-a7b6-4087-9b9c-04335776a002 | 1 | public void visitEnd() {
if (av != null) {
av.visitEnd();
}
} |
f10369c9-51d1-4986-96d8-d72c488d9e59 | 8 | public static boolean isValidLanguageVersion(int version)
{
switch (version) {
case VERSION_DEFAULT:
case VERSION_1_0:
case VERSION_1_1:
case VERSION_1_2:
case VERSION_1_3:
case VERSION_1_4:
case VERSION_1_5:
cas... |
2283a9dd-cd9c-4e05-bea8-8fb805c711b3 | 1 | public Command getCommand(String name) {
name = name.toLowerCase();
Match match = rootElement.xpath("commands/command[@name='" + name + "']");
if ( match.isEmpty() )
return null;
else
return new Command(name, match.text() );
} |
fc21732c-96d0-4b5b-acd2-c7abc1f7709e | 5 | private static void drawLeftToRight(Graphics g, LivingEntity e, int x, int y, int size) {
float ratio = tex.bar[0].getWidth() / (float)e.getMaxHP();
g.drawImage(tex.frame[0], x, y, tex.frame[0].getWidth() * size, tex.frame[0].getHeight() * size,null);
int color;
if (e.getHP() > e.getMaxH... |
a7eb8ec6-a37b-4a41-a52f-162fc8243294 | 6 | public void testNodeTraverse() throws IOException, XPatherException {
final StringBuffer superstar = new StringBuffer();
node.traverse(new TagNodeVisitor() {
public boolean visit(TagNode parentNode, HtmlNode node) {
if (node instanceof TagNode) {
TagNode t... |
2cefcdf0-73c5-4031-87bf-0091af6536da | 9 | private static int[] getComplementarySizes(GridRelation gridRelation, int[] colRowSizes, FlowSizeSpec colFlowSpec, FlowSizeSpec rowFlowSpecs, boolean isColSizes) {
/**
* RUBEN isColSizes=false not supported yet!
*/
int[] complementarySizes=new int[isColSizes?gridRelation.nRows:gridRelation.nCols];
for(in... |
c5c1470d-d50e-47fc-ae5d-f608a333387b | 6 | private boolean precisaAutenticar(String url){
return !url.contains("login.xhtml") &&
!url.contains("teste.xhtml")&&
!url.contains("javax.faces.resource") &&
!url.contains("index.xhtml") &&
!url.contains("contato.xhtml") &&
!url.contains... |
32c1a876-b465-4169-944d-c8c859cbe56a | 1 | public void generate(TextArea area){
try {
gt.analyse();
ge_code(area, gt.root);
}catch (SemanticErr e){
area.setText("");
area.append("Exception: ");
area.append(e.getMessage());
}
} |
80f79e2f-f698-4f33-88a3-ca8541988c38 | 5 | private static void initTabel(){
subst = new String[729];
//generam toate combinatiile de 2 caractere posibile
for(int i = 0;i<27;i++){
for(int j = 0;j<27;j++){
subst[i*27+j] = charAtIndex(i) +""+charAtIndex(j);
}
}
//dam valorile peste cap dupa o formula aiurea cu ajutorul vectorului permut ce indi... |
beef1619-f9ce-4978-94cd-ccd7f5e421bb | 5 | public void reloadInternCommands() {
interncommands.clear();
try {
ClassFinder classFinder = new ClassFinder();
String[] classes = classFinder.listClasses("net.sf.odinms.client.messages.commands.chunins", true);
registerInternCommand(new HelpInternCommand()); // regis... |
7166ee37-b419-45a5-bf34-21ce948bfe30 | 6 | @Override
public RoleSchool addRoleSchool(String json, long id) {
RoleSchool role = null;
if (json.contains("Teacher")) {
role = trans.fromJson(json, Teacher.class);
}
if (json.contains("Student")) {
role = trans.fromJson(json, Student.class);
}
... |
b107ce96-28f8-44f9-b200-381421729624 | 3 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!(obj instanceof Tile))
return false;
Tile other = (Tile) obj;
if (val != other.val)
return false;
return true;
} |
acf1f41b-3351-473b-b5a1-50fc33fe04b1 | 0 | @Override
public void restoreTemporaryToDefault() {
copyHashMap(def,tmp);
} |
1a048a8d-15bd-4005-8afd-70f2315cf48f | 1 | protected void allocMemory () {
arrY = new double [matHeight][matWidth];
mat[0] = new Matrix(arrY, matHeight, matWidth);
if (codeCbCr) {
arrCb = new double [matHeightC][matWidthC];
arrCr = new double [matHeightC][matWidthC];
mat[1] = new Matrix(arrCb, matHeig... |
df750d7c-1cbb-495d-a2f7-3c7655faeb65 | 4 | public int Create(HashMap<String, String> params) {
this.DBConn = new DBHelper();
String fields = "", values = "", QueryStr;
Iterator<Map.Entry<String, String>> it = params.entrySet().iterator();
while (it.hasNext()) {
if (!fields.equals("")) {
fields += " , "... |
adf1b06b-0b37-4c88-a608-5c1353093192 | 5 | public static void fillBox(int size) {
box = new long[size + 1];
long limit, area = 1L << 25L, limit2;
for (int i = 1; i < box.length; i++) {
area = 1L << 25L;
limit = (long) Math.ceil(Math.sqrt(i));
for (int j = 1; j <= limit; j++)
if (i % j == 0) {
limit2 = i / j;
for (int k = 1; k <= lim... |
09f09349-7481-4318-a984-d7147ede1ac8 | 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... |
11c86924-51d6-4f84-9dc1-30debd7b00cf | 8 | private void moveToNextCell() {
if (lastKeyPressedEvent != null) {
if (lastKeyPressedEvent.getKeyCode() == KeyEvent.VK_DOWN) {
setNextCellSelectedBelow();
} else if (lastKeyPressedEvent.getKeyCode() == KeyEvent.VK_UP) {
setNextCellSelectedAbove();
} ... |
aaf95c2e-c4d3-4968-9c08-9f207ed321f2 | 6 | public static void main(String[] args) {
if (args.length < 3){
System.out.println("Syntax: [nick] [server] [channel]");
return;
}
IrcConsole c = new IrcConsole();
for(String s:args){
System.out.println(s);
}
String name= args[0];
String server=args[1];
String channel=args[2];
MahjongBot b ... |
62f6fac6-0330-4a4d-baea-69d5d1bbc06d | 4 | private boolean predicateApplies(Subscriber<?> s, Object message) {
if (s instanceof PredicatedSubscriber
&& !((PredicatedSubscriber<?>) s).appliesO(message)) {
return false;
}
return true;
} |
3a00a9f3-03e4-4de6-b877-7ab9a9f1992f | 7 | protected void loopImpl(WatchService watcher) {
WatchKey key = watcher.poll();
if(key != null) {
for(WatchEvent<?> event: key.pollEvents()) {
@SuppressWarnings("unchecked")
WatchEvent<Path> pathEvent = (WatchEvent<Path>) event;
Kind<?> kind = event.kind();
Path path = pathEvent.con... |
3bec2d6b-717c-43df-8730-f3210566fe4a | 2 | public int getMove(int x, int y)
{
if(Game.inMap(x, y))
{
if(movement[x][y] != 0) {
return movement[x][y];
}
}
return 2147483647;
} |
063e3eef-0704-462a-af5e-13eee3a65c0e | 2 | public String getColorHtml(String type) {
if (countByType.get(type) == null) return "ffffff"; // Not found? => White
long count = get(type);
Long max = Long.MIN_VALUE, min = Long.MAX_VALUE;
for (String key : countByType.keySet()) {
long v = get(key);
max = Math.max(max, v);
min = Math.min(min, v);
... |
42ac5a49-9737-4ee0-ae33-046364e665cd | 3 | @Override
public AModelDAO getModelDAO(String type) {
AModelDAO modelDAO=null;
switch(type){
case "Game Model":
modelDAO=new NonSQLGameModelDAO(this);
break;
case "Game Description":
modelDAO=new NonSQLGameDescriptionDAO(this);
break;
case "Users":
modelDAO=new NonSQLUsersDAO(this);
break;
... |
3d615d75-e0f3-4804-be3f-6ec4b3cd61e5 | 8 | private static void runTourn(String args[],GameEngine engine,long seed, int n)
{
Statement s;
java.net.InetAddress localMachine = null;
try {
localMachine = java.net.InetAddress.getLocalHost();
} catch (UnknownHostException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
String... |
2019c475-e815-442b-a28d-363f158e1a3c | 0 | public PumpingLemma()
{
myDoneCases = new ArrayList();
myAllCases = new ArrayList();
myAttempts = new ArrayList();
setRange();
setDescription();
reset();
addCases();
} |
5d6b5e4b-f020-49bf-9502-6ca3a9dea126 | 3 | public void tick() {
if (this.active)
{
if (!this.clearAnimations[this.whichAnimation].nextImage())
{
this.active = false;
if (this.whichAnimation == this.clearAnimations.length - 1)
this.clear = true;
}
}
} |
327286cf-56be-483a-81c3-3795b0ed41f4 | 5 | public static String putPieceInCross(Cube cube, TileColor c) {
int count = 0;
String movements = "";
TileColor otherPiece = cube.getColor(Cube.getOthers(getPos(cube, c)).get(0));
while (Cube.getOthers(getPos(cube, c)).get(0)[0] != otherPiece.getInt()) {
cube.turn(Turn.U);
count++;
}
if (count == 1) {
... |
0f85e240-8ffd-4fa2-bbab-c6655374ac92 | 9 | protected void calcLiValue() {
double t = 0.0;
int i, j, k;
double result = 0.0;
double[] x = new double[Def.N];
double[] y = new double[Def.N];
try {
t = Double.parseDouble(liTTextField.getText());
} catch (NumberFormatException e) {
JOptionPane.showMessageDialog(null, ErrMessage.T_WRONG);
liTT... |
e99e134b-d810-4501-9474-6f1c38233c15 | 4 | @Override
public Integer execute() {
super.execute();
Scanner sc = new Scanner(System.in);
String s = sc.next().toLowerCase();
if (s.equals("yes") || s.equals("да")){
return this.getYesBranchID();
}
else if (s.equals("no") || s.equals("нет")) {
... |
ae4e36b0-7477-4fbe-8f2c-067425896e99 | 6 | @Override
public void run() {
while (Server.isRunning) {
try {
readConnection();
} catch (SocketException e) {
if (e.getMessage().equals("socket closed")) {
MaintenanceServer.println("Socket forcefully closed.");
} e... |
f3757ba2-0faa-4d88-9e0b-ede914c7ba0b | 5 | public void depositBalance(){
boolean state = false;
double monto;
do{
System.out.print("Ingrese el Numero de Cuenta: ");
int num = scan.nextInt();
if(num==-1){
break;
}
int index = searchIndex(num, state);
i... |
8fae85d7-c387-41a4-be11-3cdc4974e6b4 | 4 | public void deleteCity(int id) {
Connection con = null;
Statement stmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABASE_URL(),
dbCon.getDB_USE... |
5cde94c1-b42c-47b2-b1a6-e0b5d1592fa7 | 9 | void vibration() throws ScriptException {
if (statementLength < 2)
subcommandExpected();
Token token = statement[1];
float period = 0;
switch (token.tok) {
case Token.on:
period = viewer.getDefaultVibrationPeriod();
break;
case Token.off:
case Token.integer:
period = token.intValue;
break;
... |
bf08b8aa-c524-458e-96c7-2de7b4a81b7c | 7 | private static File initializeDirectory() {
File directory;
String path = System.getProperty(PropKey, System.getProperty(PropFileName, ""));
if (path.length() == 0) {
directory = new File(DefaultDir);
} else {
File file = new File(path);
if (file.isDir... |
3fc22561-0d69-4a78-97a5-609557b510b6 | 4 | @Override
public void mousePressed(MouseEvent e) {
if (e.getSource() instanceof JButton) {
JButton boton = (JButton) e.getSource();
cliente.realizarOP(boton.getName());
} else if (e.getSource() instanceof JList) {
JList list = (JList) e.getSource();
... |
a814c963-e715-4f9e-a883-1d7db089a097 | 3 | public boolean pieceActive() {
if(fallingPiece == null)
return false;
for(int i = 0; i < 4; i++) {
IntPoint p = fallingPiece.getBlocks()[i];
if(p.getZ() < height - SAFE_HEIGHT)
return true;
}
return false;
} |
c75132b5-dc4e-49f7-b88b-e0eb77471737 | 2 | public static final FileType[] getOpenable() {
ArrayList<FileType> openable = new ArrayList<>();
for (FileType type : TYPES) {
if (type.allowOpen()) {
openable.add(type);
}
}
return openable.toArray(new FileType[openable.size()]);
} |
9b1732b3-a0b5-4a1c-b69b-32ccdd7fc3c2 | 4 | public void updateLogicalLocations(ViewEventArgs args){
int i, j;
Point dummyPoint = new Point(Integer.MIN_VALUE, Integer.MIN_VALUE);
for (i = 0; i < this.index; i++){
Row currentRow = this.logicalDocument.getRows().get(i);
currentRow.setTop(Integer.MIN_VALUE);
currentRow.setLeft(Integer.MIN_VALUE);
f... |
047cdc49-1214-4803-bcb8-905646e1973e | 1 | public ArrayList<Integer> buildnReps() {
ArrayList<Integer> nReps = new ArrayList<Integer>();
while (nReps.size() <= this.cells.size() - 1) {
nReps.add(nReps.size());
}
return nReps;
} |
8274fc75-3c50-4ee6-8193-ff1c3d02c66c | 0 | public static void checkVersion(Side side)
{
ThreadVersionCheck.startCheck(side);
} |
5a56769c-e4c6-4bd6-a5f6-444a44596088 | 3 | public boolean solved() {
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
if (board[i][j].getValue() == 0) {
return false;
}
}
}
return true;
} |
42bcd1ac-dd56-4480-b5b1-eb1c214e87a8 | 0 | public String getStatus()
{
return status;
} |
4c178464-5103-45b7-9946-286a728d7bb5 | 1 | @Override
public boolean setAlive(boolean alive) {
dmg = alive ? 0 : maxHP;
return alive;
} |
43fe29bc-b72b-41a5-b942-d428afdc3cdb | 6 | public Boolean getboolean(String path){
String s;
if((s = data.get(path)) == null){
return null;
}else{
boolean b;
try{
b = Boolean.valueOf(s);
if(!s.equals("true") || !s.equals("false")){
if(showError)
System.err.println("YAML ERROR: You asked for a boolean, but there was an other obj... |
f4fa073a-7da3-4a7d-9348-80d20122f521 | 9 | public static void main(String[] argv) throws Exception {
MP3Decoder decoder = new MP3Decoder(new FileInputStream(FILE));
FFT fft = new FFT(1024, 44100);
fft.window(FFT.HAMMING);
float[] samples = new float[1024];
float[] spectrum = new float[1024 / 2 + 1];
float[] lastSpectrum = new float[1024 / 2 + 1];
... |
bf34a530-0ff4-413b-8ce6-91f144458a7b | 0 | private void drawGround(Graphics2D g) {
g.setColor(new Color(1, 166, 17));
g.fillRect(0, 0, GraphicsMain.WIDTH, GraphicsMain.HEIGHT);
} |
da20a98f-a4d8-4e13-ac77-722be97b9612 | 8 | public static ArrayList<Post> getCategoryPage(int page, int cate_num) throws SQLException, NamingException {
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
ArrayList<Comment> comment = new ArrayList<Comment>();
ArrayList<Graffiti> graffiti = new ArrayList<Graffiti>();
DataSource ds... |
961b445b-98e4-4d07-96d2-dca5f1eb0612 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof TipoAtendimento)) {
return false;
}
TipoAtendimento other = (TipoAtendimento) object;
if ((this.codtipoatendime... |
46f9873f-cb21-48f7-9c97-da91a647e225 | 7 | public void updateDraw(){
if(drawUpdated)return;
DrawHand dh = null;
if(common != 3 && common != 4){
for(int i=0;i<len;i++)hand[i].draw = 0;
}else{
if(common == 3){
dh = new DrawHand(new Card(Card.libValueToValue(comCard[0])),
new Card(Card.libValueToValue(comCard[1])),
new Card(Card.libVa... |
1d10d4e7-f64c-45d9-a52b-a065698e67b7 | 3 | public static void main(String [] args){
System.out.println("Enter value of n:");
Scanner scan=new Scanner(System.in);
int n=scan.nextInt();
for(int i=n;i>=1;i--){
for(int j=1;j<=n-(i-1);j++)
System.out.print(" ");
for(int k=i;k>=1;k--){
System.out.print(" "+ i);
... |
cdbdf96f-8480-4fce-936f-1dcfd2cac687 | 4 | private void filtrarCaracteresNoNumericos(java.awt.event.KeyEvent evt) {
char c = evt.getKeyChar();
if ((c >= 58 && c <= 126) || (c >= 32 && c <= 47)) {
evt.consume();
}
} |
7753616d-d385-4143-a6ed-d278ffca8d34 | 7 | private void startLSH(){
if(linear){
if(queries != null){
for(Vector query:queries){
List<Vector> neighbours = LSH.linearSearch(dataset, query, numberOfNeighbours, measure);
System.out.print(query.getKey()+";");
double sum = 0.0;
for(Vector neighbour:neighbours){
sum += measure.distan... |
7b83bbfe-4d12-40f8-a727-6fc43dc85e1e | 7 | private Map<String,List<String>> getLoginScripts()
{
final Hashtable<String,List<String>> extraScripts=new Hashtable<String,List<String>>();
final String[] VALID_SCRIPT_CODES={"PASSWORD","EMAIL","ANSI","THEME","RACE","GENDER","STATS","CLASS","FACTIONS","END"};
final List<String> extras=CMParms.parseCommas(CMProp... |
97a970a0-c08e-417a-b250-cd2edd14267b | 4 | @Test(groups = { "Character-Sorting", "Fast Sort" })
public void testQuickSortChar() {
Reporter.log("[ ** Quick Sort ** ]\n");
try {
testSortCharacters = new QuickSort<>(
fastShuffledArrayChar.clone());
Reporter.log("1. Unsorted Random Array\n");
timeKeeper = System.currentTimeMillis();
testSo... |
364d416b-bbcb-415e-89fd-6249361368f0 | 9 | public JPanel createPanelGenerateExercises() {
//create
// Données :
int longueurExercice = 10;
JPanel pan = new JPanel();
// Panel haut
JPanel panHaut = new JPanel();
panHaut.add(new BmgLabel("Here you can (not yet) generate exercises : ", "red"));
/... |
97e2d973-4a87-440d-9295-dc56a3488a5d | 3 | public void setSelectedFlags(boolean[] flags) {
for (int i = 0; i < size(); i++) {
getLabel(i).select(flags[i]);
if (group != null && flags[i])
return;
}
} |
4ad5a2e5-a14a-44fa-a6b4-0c1bb7470ce0 | 0 | public MyTimerDown() {
} |
b9efca46-0ad4-4b46-b7df-c0cdc51c65d3 | 4 | public void loop() {
stop();
try {
bitStream.reset();
} catch (IOException e) {
// ignore if no mark
}
player = new Thread() {
public void run() {
while (player == Thread.currentThread()) {
try {
playStream(Thread.currentThread());
} catch (InternalException e) {
e.pri... |
4e12f656-07b3-4f5c-9a82-1e19c14ed6c7 | 8 | protected SNorm extractSNorm(String line) {
List<String> token = Op.split(line, ":");
if (token.size() != 2) {
throw new RuntimeException("[syntax error] "
+ "expected property of type (key : value) in line: " + line);
}
String name = token.get(1).trim();
... |
30c351cd-1b31-46d7-a681-05704d14e635 | 2 | public void render(int xScroll, int yScroll, Screen screen) {
int x0 = xScroll >> 4;
int x1 = (xScroll + screen.width + 16) >> 4;
int y0 = yScroll >> 4;
int y1 = (yScroll + screen.height + 16) >> 4;
for (int y = y0; y < y1; y++) {
for (int x = x0; x < x1; x++) {
screen.renderTile(x<<4, y<<4, getTile... |
f9afbad5-fb0b-48e1-bd5e-63b9148a06c5 | 2 | public void setDomain(String domain) {
if(domain.length() < 256) {
try {
isValidDomain(domain);
this.domain = domain;
} catch(Exception e) {
System.out.println(e.getMessage());
System.out.println("Domain not set.");
}
}
else
System.out.println("Domain part length must be less than 256 charact... |
b9480c69-3f3c-4af8-843b-30a7758115f6 | 0 | @Override
public void keyTyped(KeyEvent e) {
// TODO Auto-generated method stub
} |
6896fdfd-4ad4-4546-b59d-7fc26eaa8e57 | 2 | public void printCards() {
for (int i = 0; i < cards.length; i++) {
if (cards[i] != 0) {
Output.printTabLn(" " + id2Card(cards[i]), Output.DEBUG);
}
}
} |
2a7a83e1-2766-491a-89f5-477955a7b70d | 9 | public void performDraw(Graphics g) {
for (SimObject obj : this.allObjects) {
if (obj.getBody() != null || obj.isSpecial()) {
obj.draw(g);
if (obj.isMoveable() && obj instanceof Gate) {
float x = ((Gate)obj).getPosition().x;
float y = ((Gate)obj).getPosition().y;
Ellipse2D el = new Ellipse2D... |
ec4cf000-7a28-49eb-9484-72366ae0e2d4 | 3 | public void runConversion() throws IOException {
for (int row = 0; row < width; row++) {
for (int col = 0; col < height; col++) {
convertYCBCRtoRGB(yCbCrArray[row][col][0],
yCbCrArray[row][col][1],
yCbCrArray[row][col][2]);
... |
4a0df35b-36e1-4769-9272-0fc406d58301 | 1 | public List<ExtensionsType> getExtensions() {
if (extensions == null) {
extensions = new ArrayList<ExtensionsType>();
}
return this.extensions;
} |
197c3963-5daa-43b9-8d6e-53dce111ee40 | 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... |
3d2d9ec5-2d51-4c0b-aa83-8aba844924ea | 9 | public static void drawDwarf(Graphics graphicsObject, int xCoordinate, int yCoordinate, int width, int height, Dwarf dwarf){
int facing = dwarf.getFacingDirection();
Image drawImage;
switch(facing){
case 8:
if(dwarfBack == null){//if its null lets load the image
dwarfBack = new ImageIcon("Resources\\E... |
061240f3-4009-4786-897f-7a6166d8abcb | 2 | public void testGetValue() {
YearMonth test = new YearMonth();
assertEquals(1970, test.getValue(0));
assertEquals(6, test.getValue(1));
try {
test.getValue(-1);
} catch (IndexOutOfBoundsException ex) {}
try {
test.getValue(2);
} catch (Inde... |
99328543-e72b-46fe-bf73-8b95dcf2edf9 | 3 | private static HttpURLConnection createConnection(Connection.Request req) throws IOException {
HttpURLConnection conn = (HttpURLConnection) req.url().openConnection();
conn.setRequestMethod(req.method().name());
conn.setInstanceFollowRedirects(false); // don't rely on native redirect... |
1504bf61-8368-426c-b67e-a961c052e3b1 | 3 | public Object[] update(double D[][], int L[], double A[][], int n, int nA, double F[][], double FA[][]) {
// Replace A into D and FA into F using the indices stored in L,
for (int i = 0; i < nA; i++) {
for (int j = 0; j < n; j++) {
D[L[i]][j] = A[i][j];
}
... |
b60f3e61-40b3-435c-83a1-dd8a77f2b901 | 8 | @FXML
public void onBuySellButtonPress( ActionEvent event ){
String s = event.getSource().toString(); //example output: "Button[id=buyWaterButton, styleClass=button]" // usin this is bad, sorry, -Sid
int unitCost = 0, quantity = 0;
Resource resource = null;
switch (... |
f5421dd3-b3ff-4c99-a32c-1e96639b1750 | 1 | @Override
protected Order createSession(int clientHashCode,SocketAddress from)
{
int sessionId = Security.generateSessionID(clientHashCode,from);
if(sessionId != Security.ERROR){
CONNECTED_USERS.put(sessionId,User.ANONYMOUS_USER);
return new Order(OrderType.CONNECT, sessionId);
}else{
//Throw an err... |
bc1ea6cc-5051-4c49-b07a-13ff7ef4cfda | 2 | public void visitIfCmpStmt(final IfCmpStmt stmt) {
if (stmt.left == from) {
stmt.left = (Expr) to;
((Expr) to).setParent(stmt);
} else if (stmt.right == from) {
stmt.right = (Expr) to;
((Expr) to).setParent(stmt);
} else {
stmt.visitChildren(this);
}
} |
df86fd65-cb1d-4b9d-a30e-28e19edc5e48 | 2 | private void special() {
daysarray.add(lstDays.getSelectionModel().getSelectedIndex());
int[] specialarray1 = {2, 6, 0, 6, 2, 0, 1, 0};
int[] specialarray2 = {2, 0, 4, 2, 0, 1};
if (daysarray.toString().equals(Arrays.toString(specialarray1))) {
txtInfo.setText(txtInfo.getText... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.