method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
92d0f2e1-fe1f-4c48-9bab-5e9246ef98fc | 0 | private void getcontent(){
CategoryDataset dataset = getDataSet();
chart = ChartFactory.createBarChart3D( "统计图", // 图表标题
"端口", // 目录轴的显示标签
"包数量", // 数值轴的显示标签
dataset, // 数据集
PlotOrientation.VERTICAL, // 图表方向:水平、垂直
true, ... |
3e165066-bc6a-4a78-a005-9dc5f67ea5b6 | 0 | public void setFolderPath(String folderPath) {
this.folderPath = folderPath;
} |
9e778af0-aa9b-4de5-bda8-e4fa3e031a4a | 4 | public Tile getTile(int xPos, int yPos) {
if (xPos < 0 || yPos < 0 || xPos >= width || yPos >= height) {
return Tile.voidTile;
}
return Tile.tiles[tiles[xPos + yPos * width]];
} |
9c6e44d6-848d-41df-b0a8-2f243b07e060 | 2 | public Map<String, Integer> getStatusFrequencyOverPartOfDay(){
Map<String, Integer> map = new HashMap<String, Integer>();
for(Record record : log.getRecords()){
Integer hour = record.getTime().getDate().get(Calendar.HOUR_OF_DAY);
String partOfDay = getPartOfDate(hour);
Integer number = map.get(partOfDay... |
6cdea198-3dd0-41eb-9956-c702ce6e92b7 | 7 | public void nextCombo(){
currentComboNo++;
if(currentComboNo <= numberOfCombos){
spatial.getControl(LabelControl.class).changeText(comboList());
if(comboNumber == 4){
if(StoredInfo.level < 3){
spatial.getContr... |
448fdb3a-ddea-4e97-bc60-b4ab908b7404 | 5 | void nachLinks() {
if (dx > 0) {
dx = 0;
try {
texture = TextureLoader.getTexture("PNG", new FileInputStream(new File(uT.locationMid)));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
... |
095ce1f6-23cc-4459-8103-a6a733b9adaf | 6 | @Override
public void run()
{
threadRun = true;
Simulator simulator = Main.getSimulator();
while(threadRun && numSteps > 0 && simulator.getSimulatorView().isViable(simulator.getField()))
{
Main.getSimulator().simulateOneStep();
numSteps--;
while(infinite && numSteps == 0)
{
numSteps++;
... |
fbee6078-5cce-49f0-b8f2-e8a076c65eae | 8 | @Test(dataProvider = "regCSVDataBBDuplicate_club", dataProviderClass = BBRegistrationDataClub.class, enabled=true, dependsOnMethods={"newClubRegistrationUsingCSVFile"},alwaysRun=true)
public void DuplicateClubRegistrationUsingCSVFile(BBRegistrationDataClub registrationData) {
Log.startTestCase("Test Case:: Duplicate... |
20c8d7eb-4aee-4c70-8b44-5e65a559b545 | 6 | public void handleKeyPress(int value) {
switch (value) {
case MinuetoKeyboard.KEY_UP:
this.keyUp = true;
break;
case MinuetoKeyboard.KEY_LEFT:
this.keyLeft = true;
break;
case MinuetoKeyboard.KEY_RIGHT:
this.keyRight = true;
break;
case MinuetoKeyboard.KEY_DOWN:
this.keyDown = true;
b... |
370bb920-0336-4241-99a5-cf5a0584e665 | 0 | public HTMLExportFileFormat() {} |
5cec3b82-e104-481b-a192-1bc7fe996eb1 | 4 | public void setExpLogica(List<?> list)
{
for(PExpLogica e : this._expLogica_)
{
e.parent(null);
}
this._expLogica_.clear();
for(Object obj_e : list)
{
PExpLogica e = (PExpLogica) obj_e;
if(e.parent() != null)
{
... |
353d7517-fb6b-40e9-b0f4-d4667a8760c6 | 6 | public void addFilesOrDir(Component parent) {
final JFileChooser resfc = new JFileChooser();
resfc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
int returnVal = resfc.showOpenDialog(parent);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = resfc.getSelectedFile();
i... |
10f1ed3c-baaf-4b0b-8672-192a62a64bfb | 6 | private void createRect(TileMap map,int lengthX,int lengthY){
// initialize the rect
rect=new TileCoordinate[lengthY][lengthX];
// get the dimensions
//int maxWidth=map.getMap()[0].length;
int maxHeight=map.getMap().length;
//System.out.println(maxHeight+" HEIGHT :: TileRect");
... |
0a057742-9597-49f3-968d-c4c4d03b0ff2 | 2 | public void enterPrescription(int employee_no, int patient_no, int type_id) {
try {
// check whether the patient is allowed to take the specified test
// type
if (this.isAllowed(patient_no, type_id) == false) {
System.out
.println("Sorry this patient is not allowed to take this test!");
} else {... |
00aa87cd-7120-4fb3-ba74-fb2a551dbfef | 1 | private static void printBinaryTree(Node root) {
if (root == null)
return;
// preorder
System.out.println(root.v);
printBinaryTree(root.left);
printBinaryTree(root.right);
} |
0a9037db-fff3-40b2-a095-8497c83fe840 | 6 | private void updateZebraColors( )
{
if ( (rowColors[0] = getBackground( )) == null )
{
rowColors[0] = rowColors[1] = java.awt.Color.white;
return;
}
java.awt.Color sel = javax.swing.UIManager.getColor(
"Tree.selectionBackground" );
if ( sel... |
28ad413e-2afd-40ca-9b48-f4bb67d9d541 | 7 | public void mouseMoved(MouseEvent mouseEvent) {
Iterator<PComponent> it = components.iterator();
while (it.hasNext()) {
PComponent comp = it.next();
if (shouldHandleMouse) {
if (comp.shouldHandleMouse())
comp.mouseMoved(mouseEvent);
... |
65717388-321f-4a36-91c4-48f12a722dec | 6 | private Field randomGrid() {
// Length of the grid
int length = Integer.parseInt(Config.getProperty("Grid.Length"));
// Width of the grid
int width = Integer.parseInt(Config.getProperty("Grid.Width"));
// New grid
Field s = new Field(length, width);
// List of... |
932d3e91-3c0c-4ae6-b1d7-6572f84948a8 | 1 | public void visit_caload(final Instruction inst) {
stackHeight -= 2;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 1;
} |
baf6bd42-1376-4a0f-808b-4895d513c8d0 | 0 | @Override
public SeatType[] getSeatTypes() {
return this._seatTypes;
} |
9adc919f-cece-45f3-823d-40d16ae4cba4 | 1 | public Player getPlayerFromColor(boolean isWhite) {
return isWhite ? this.playerWhite : this.playerBlack;
} |
55a73823-c53a-4bf0-9d39-50bb02cacf8e | 1 | @Override
public void deleteElement(String value) throws NotExist {
if (exists(value)) {
super.deleteElement(value);
} else {
throw new NotExist("Element that you want to deleted doesn't exist");
}
} |
f077c4bd-5f44-4783-924f-343fb05a7508 | 2 | private void select() {
if (currentChoice == 0) {
gsm.setState(7);
bgMusic.stop();
}
if (currentChoice == 1) {
System.exit(0);
}
} |
78c62170-7e66-4201-ac85-ec24519b939b | 8 | public String manage(String acao, Map<String, String[]> req,
JogoService jogoService) {
EventosDoJogo evento = EventosDoJogo.valueOf(acao.toUpperCase());
switch (evento) {
case GRUPO:
return jogoService.montarGrupo(req);
case ENCERRAR:
jogoService.grupo = new HashMap<String, Grupo>();
return "{\... |
c0e93eca-d0ee-48e8-9deb-4f40368996ee | 5 | public void classifyTest(String fileLoc){
Instances data = null;
BufferedReader reader = null;
System.out.println("Reading in Test data ");
try {
//Read in data from the .arff file
reader = new BufferedReader(new FileReader(fileLoc));
data = new Instances(reader);
reader.close();
//Sets the c... |
8e5bcea1-3a0a-48a1-8cef-ae296a2db314 | 5 | private void checkSimplificationProgress() {
if (inPlayOne.size() > 1) {
rotateToPosition(0);
cloneList(inPlayOne);
simplificationStrand = 0;
removeMoleculesToBeSimplified(inPlayOne);
} else if (inPlayTwo.size() > 1) {
rotateToPosition(6);
cloneList(inPlayTwo);
simplificationStrand = 1;
rem... |
5b62b76e-82be-4ebd-99aa-fe7a2f112ca4 | 8 | public static void main( String[ ] args ) throws IOException {
BufferedReader in = new BufferedReader( new InputStreamReader( System.in ) );
String line = "";
StringBuilder out = new StringBuilder( );
int r[] = new int[ 'Z' - 'A' + 1 ];
while ( (line = in.readLine( )) != null && line.length( ) != 0 ) {
if ... |
784e8543-46fb-4a4f-90da-90b68fe37f3c | 2 | public void testPropertyCompareToMinute() {
Partial test1 = new Partial(TYPES, VALUES1);
Partial test2 = new Partial(TYPES, VALUES2);
assertEquals(true, test1.property(DateTimeFieldType.minuteOfHour()).compareTo(test2) < 0);
assertEquals(true, test2.property(DateTimeFieldType.minuteOfHou... |
ca3b256f-2262-4ca2-b3bf-c4eb41bcad0f | 6 | public static int dealTableCards() {
int turn = 0;
// River
if (theGame.getTableCards()[3] != null && theGame.getTableCards()[4] == null) {
// Burn a card
theGame.getDeck().drawCard();
theGame.getTableCards()[4] = theGame.getDeck().drawCard();
turn... |
29d99454-bafc-4524-9813-1d96250ae36e | 4 | private List<Reducer> estimateReducers(List<Mapper> newMapperList, boolean useRuntimeMaxJvmHeap) {
int fReducerNum = finishedConf.getMapred_reduce_tasks();
if(fReducerNum == 0)
return null;
//if(isMapperConfChanged == false && isSplitSizeChanged == false && isReducerConfChanged == false)
// return job.getR... |
bc6d6f2d-a313-4a23-ac92-5320d61678c3 | 6 | public static void main(String[] args) throws Exception {
Client test = new Client();
String serverHostname = new String ("127.0.0.1");
int serverPort = 10009;
if (args.length > 0)
serverHostname = args[0];
System.out.println ("En attente de connexion sur le ... |
9d58d56e-9afa-43e4-8063-9accd27c97f1 | 2 | public void remove(){
EntityManager em = conexao();
try {
Paciente p = em.find(Paciente.class, id);
em.getTransaction().begin();
em.remove(p);
em.getTransaction().commit();
} catch (Exception e) {
if (em.getTransaction().isActive())
... |
10ce10da-45ad-4f8d-9dfc-848d5f16e9fb | 4 | Boolean isCollectionsObject(Class<?> c)
{
Boolean res = false;
if (c.isArray())
{
res = true;
}
else
{
// check if c is a Map
if (ObjectTools.implementsInterfaceIncludingSuper(c, Map.class))
{
res = true;
}
else if (ObjectTools.implementsInterfaceIncludingSuper(c, Collection.class))
... |
ce720cf4-c28d-4c1e-8c3e-4e1bd9592e1c | 7 | private int inventorySize(int level) {
switch(level) {
case 0:
return 2;
case 1:
return 3;
case 2:
return 4;
case 3:
return 6;
case 4:
return 8;
case 5:
return 9;
case 6:
return 10;
}
return 0;
} |
14263947-5703-427e-8de7-0596e6a80e05 | 8 | public static List relationsWithDescriptions() {
{ List result = List.newList();
{ Stella_Class renamed_Class = null;
Iterator iter000 = Module.allClasses(null, false);
Cons collect000 = null;
while (iter000.nextP()) {
renamed_Class = ((Stella_Class)(iter000.value));
... |
d9204a09-2b77-47b3-bd0b-56467233e83e | 3 | private void checkKey(final String key) {
if ((key == null) || (key.trim().length() == 0) || (containsWhitespace(key))) {
throw new IllegalArgumentException("Wrong key!");
}
} |
94c8667b-b107-4fde-bd85-66a5ddf7a751 | 4 | private String scanDirectiveIgnoredLine () {
while (peek() == ' ')
forward();
if (peek() == '"') while (NULL_OR_LINEBR.indexOf(peek()) == -1)
forward();
char ch = peek();
if (NULL_OR_LINEBR.indexOf(ch) == -1)
throw new TokenizerException("While scanning a directive, expected a comment or line break but... |
30059374-ba09-4e01-b333-65d78ff3a00a | 9 | @Override
protected void execute(CommandSender sender, String[] args) {
if (args.length > 0) {
if (args[0].equalsIgnoreCase("bless")) {
skillInfo(sender, plugin.SM.getSkill("bless"));
}
if (args[0].equalsIgnoreCase("confuse")) {
skillInfo(sender, plugin.SM.getSkill("confuse"));
}
if (args[0].e... |
df5e90cb-19a7-42b1-a7ce-596b81e516f2 | 4 | public void setUseSocketTimeout(boolean use_socket_timeout) throws SocketException {
if (this.use_socket_timeout && !use_socket_timeout) {
socket.getSocket().setSoTimeout(0);
} else if (!this.use_socket_timeout && use_socket_timeout) {
socket.getSocket().setSoTimeout(getSocketTim... |
1b72beba-6224-4f1a-99ea-222fd7f152ad | 2 | public List obtenerEmisionCapitulo(Date dia){
List emi = new ArrayList();
for (EmisionCapitulo emisionCapitulo : emisiones) {
List infoEmision = emisionCapitulo.obtenerInfoEmision(dia);
if (infoEmision != null){
emi.add(infoEmision);
}
}
... |
d67589cf-7fda-41fe-8c40-d285ae1ff73d | 5 | private void subrend2(GOut g) {
if (id < 0)
return;
GL gl = g.gl;
if (Config.profile)
curf = prof.new Frame();
if (!subrend(g))
return;
if (curf != null)
curf.tick("render");
g.texsel(id);
//GOut.checkerr(gl);
... |
98fc6697-f2c7-44cb-abb8-20964e78410f | 3 | public JSONObject request(String method, String url, JSONObject body)
throws AftershipAPIException,IOException,ParseException,JSONException{
BufferedReader rd;
StringBuilder sb;
OutputStreamWriter wr;
HttpURLConnection connection;
URL serverAddress= new URL(new URL(t... |
24508247-c670-4d69-9415-f155c4716366 | 3 | public void codeVersion6(Client sockector, Response msg){
byte[] msgs = CoderUtils.toByte(msg.getBody());
WebSocketMessage messageFrame = sockector.getRequestWithFile().<WebSocketMessage>getMessageHeader(msg.getRequestIndex());
if(messageFrame == null){
messageFrame = new WebSocketMessage();
}
message... |
d3104fd7-9d5d-4686-bc57-2030d82b8ab1 | 1 | public void print() {
for(int i = 0; i < nodes.size(); i++) {
((Node)nodes.get(i)).print();
}
} |
8e758036-589e-4ed2-a548-aadc6d0508dc | 7 | public boolean conformingSignaturesP(Slot superslot) {
{ Table self = this;
if (StandardObject.conformingTypeSpecP(self.slotBaseType, superslot.type()) &&
(StandardObject.conformingTypeSpecP(((CompoundTypeSpecifier)(KeyValueList.dynamicSlotValue(self.dynamicSlots, Stella.SYM_STELLA_SLOT_TYPE_SPECIF... |
5ef026ab-4b6a-4eb8-974b-d976cc77c166 | 3 | private Agrupamento criarAgrupamentoPorAtividade() {
Agrupamento agrupamento = new Agrupamento("Alunos por estado do vínculo");
for(Object o : alunos){
if(o instanceof Aluno){
Aluno aluno = (Aluno)o;
agrupamento.addItem((aluno.getAtivo() ? "Ativo" : "... |
f7869f0a-82e3-46bc-85ad-95710e2e08f0 | 3 | public void testSoundStop() throws Exception {
System.out.println("playSoundStop");
MusicController mc = new MusicController();
Thread instance=new Thread (mc);
instance.start();
for(int i=0;i<30;i++){
System.out.println(i+" Seconds passed ");
Thread.sleep... |
918197a6-e905-4dc3-937b-05c5765588db | 0 | public Renderer() {
// Set up all them gosh durned command handlers.
handlers.put("g", new MoveHandler(true, true));
handlers.put("f", new MoveHandler(false, true));
handlers.put("+", new TurnHandler(true));
handlers.put("-", new TurnHandler(false));
handlers.put("&", new PitchHandler(true));
handlers.put... |
e3aa9575-b454-46c5-9965-33e83e70c6ac | 5 | public CheckResultMessage check30(int day) {
int r1 = get(39, 5);
int c1 = get(40, 5);
int r2 = get(43, 5);
int c2 = get(44, 5);
BigDecimal b = new BigDecimal(0);
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
b = getValue(r2 +... |
7fb63dbe-3841-45f6-ae3f-7ddb64e54002 | 6 | @SuppressWarnings("deprecation")
@Override
public boolean a() {
Entity ep = null;
String[] s = this.entitycreature.getCustomName().split("");
if(Bukkit.getServer().getPlayer(s[0]) != null){
ep = ((CraftPlayer)Bukkit.getServer().getPlayer(s[0])).getHandle();
}
if(ep == null){
return false;
}else i... |
2e8fd627-0183-4df6-abdf-47ade7fe7044 | 2 | public void getMumJoke() {
/* Code to Test JRobo */
try {
Thread.sleep(30000);
} catch (InterruptedException ex) {
Logger.getLogger(JRobo.class.getName()).log(Level.SEVERE, null, ex);
}
randomBoolean = (int) (Math.random() * 10 % 2);
if(randomBoolean == 1) {
connection.sendln... |
21b4388f-cc03-4de0-83ff-d08b9adf14c0 | 4 | public boolean isAnnotationNameEqualWithOutputClassName(Class<?> input,
Class<?> output) throws OwnMapperException {
logger.debug("Trying to compare annotation name and output class name");
if (!input.isAnnotationPresent(ClassAnnotation.class)) {
String msg = String
.format("Source class -%s- not contain... |
4340c046-f769-46d4-a517-2e4cf27f58b5 | 9 | public String printSeats() {
String ret = "";
Seat[][] arr = fillSeats();
if(arr.length == 14)
ret = " A B C D " +"\n";
if(arr.length == 40)
ret = " A B C D E F " +"\n";
if(arr.length == 44)
ret = " A B C D E F G " +"\n";
for(int r = 0; r < arr.l... |
4da392eb-3cd7-448f-8991-02f8b9e65824 | 4 | public void run()
{
while (!Thread.currentThread().isInterrupted())
{
try {
Thread.sleep(250);
} catch(InterruptedException ex) {
Thread.currentThread().interrupt();
break;
}
if (connected && associatedQ3)
{
application.getHeartRatePanel().updateValue(patie... |
8fc17f14-be35-4d77-b9c8-527c13a2f300 | 1 | public static final StdImage getToolkitImage(Image image) {
if (image instanceof StdImage) {
return (StdImage) image;
}
return createOptimizedImage(image);
} |
a844805f-8806-4bfd-96f6-0ec848a8e970 | 4 | @Override
public void onDraw(Graphics G, int viewX, int viewY) {
if (X>viewX&&X<viewX+300&&Y>viewY&&Y<viewY+300)
{
G.setColor(Color.white);
int deg = r.nextInt(360);
G.fillArc((int)(X-1)-viewX, (int)(Y)-viewY, 2, 1, deg, 60);
deg = r.nextInt(360);
... |
2d69a4a6-50ab-4af6-b79d-2f9051f35790 | 0 | @AfterClass
public static void tearDownClass() throws Exception {
System.out.println("End");
MyUnit.getDriver().quit();
} |
a72f0633-039d-4dab-a2d9-0c3603338131 | 0 | @AfterClass
public static void tearDownClass() {
} |
48c6c138-78f8-4637-b2a1-8092c3b38f23 | 9 | public void configl() {
PluginDescriptionFile pdfFile = plugin.getDescription();
String ver = "0.1.15";
String str = plugin.getConfig().getString("version#");
if(new File("plugins/BaseCommands/config.yml").exists()) { //checks if config.yml already exsits
plugin.logger.info("[BaseCommands] Config Loaded");... |
f57f133c-cce7-49f0-a0d3-e7dc2adb5d23 | 3 | private void btnUnlockActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUnlockActionPerformed
char[] pw = txtPassword.getPassword();
//for(int i=0; i<pw.length; i++)
if(pw.length==2)
if(pw[0]=='i' && pw[1]=='9')
{
GetRosterGUI roster = new GetR... |
8301aa5b-4ef9-40ce-95f7-d7ca9c161559 | 3 | public String[] getDependencies(String variable, Grammar grammar,
VariableDependencyGraph graph) {
ArrayList list = new ArrayList();
String[] variables = grammar.getVariables();
for (int k = 0; k < variables.length; k++) {
if (!variable.equals(variables[k])) {
if (isDependentOn(variable, variables[k], g... |
c6f7218c-3657-4810-bd58-6714443ffb88 | 6 | public void run()
{
if(BackendType.equals(Backends.MySQL))
{
if(sqlToExecute.size() > 0)
{
String[] clone = sqlToExecute.toArray(new String[0]);
for (String sql : clone)
{
sqlConnection.executeUpdate(sql);
}
s... |
0218dad4-b614-44f6-a393-226b4f186044 | 5 | public IteratorInt(Node node) {
while (!(node instanceof LeafNodeInt)) {
InternalNodeInt iNode = (InternalNodeInt) node;
if (!iNode.getChildren().isEmpty()) {
node = iNode.getChildren().get(0);
}
}
currentNode = (LeafNodeInt) node;
if (!currentNode.getKVPairs().isEmpty()) {
currentPos = current... |
5a355915-73ac-4dd3-a104-dc00a87b29f9 | 3 | @Override
public void draw(GL2 gl, int mode) {
beforeDraw(gl);
PolygonObject j;
for (Map.Entry i : models.entrySet()) {
j = (PolygonObject) i.getValue();
// vererbe Kameradistanz an Unterobjekte
j.setCamDistance(camDistance);
// Fuelle Names... |
ee0197a2-e0d3-4c57-845c-052b14617602 | 2 | @Override
protected boolean stopCriteria(Result result) {
boolean stop = super.stopCriteria(result);
if (stop) return true;
// No rank sum? => stop
GeneSet geneSet = result.getLatestGeneSet();
if (geneSet.rankSum() <= 0) return true;
return false;
} |
50056aa5-77d1-4ffd-831a-e3abbffc163c | 1 | public void test_getDifference_long_int() {
assertEquals(567, MillisDurationField.INSTANCE.getDifference(567L, 0L));
assertEquals(567 - 1234, MillisDurationField.INSTANCE.getDifference(567L, 1234L));
assertEquals(567 + 1234, MillisDurationField.INSTANCE.getDifference(567L, -1234L));
try ... |
2f4ef98f-dcc6-478b-9ba2-7d9594bb9450 | 3 | private void projectSelected(String newProjectName) {
if (newProjectName != null) {
table.getItems().clear();
displayedIssues = model.getIssueIds(newProjectName);
for (String id : displayedIssues) {
final ObservableIssue issue = model.getIssue(id);
... |
70305d82-bf89-4637-bae4-06886cc653d6 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ContactType other = (ContactType) obj;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.e... |
5bb293db-bf7e-43f0-b59d-772d5b125095 | 5 | private void checkInternetConnection() {
checkingLabel.setText("Checking network configuration...");
try {
Configuration.hostname = InetAddress.getLocalHost().getHostName();
} catch ( UnknownHostException ex ) {
checkingLabel.setText("Checking network config... |
5de5f11a-553e-4700-935e-ba98199b1a07 | 9 | public void quickSort(int[] a, int begin, int end) {
int left = begin;
int right = end;
int temp = a[left];
while (left < right) {
while (left < right && a[right] >= temp)
right--;
if (left < right)
a[left] = a[right];
while (left < right && a[left] < temp)
left++;
if (left < right)
... |
b19fcbc3-d4cd-458b-8237-a51c5db8ae7b | 5 | public Problem validate(final Object instance,
final MatchMethod annotation, final Object target,
final Object actualValue)
{
Object expectedValue;
try
{
final String methodName = annotation.value();
expectedValue = ReflectionUtils.getValueOfMethod(methodName,
instance);
}
catch... |
f64434b8-37a6-45a3-82f0-ba88b4acc238 | 2 | public void init(int type, int level){
if(type==DEFLATER){
stream.deflateInit(level);
this.type=DEFLATER;
}
else if(type==INFLATER){
stream.inflateInit();
inflated_buf=new byte[BUF_SIZE];
this.type=INFLATER;
}
} |
80012001-769f-400d-b51d-554b91aabbf4 | 3 | @Override
public void render(Graphics2D g)
{
if (pConnector != null)
{
coordinate = pConnector.get();
}
Path2D.Double indicator = new Path2D.Double();
indicator.moveTo(coordinate.getX() - 5, coordinate.getY());
indicator.lineTo(coordinate.getX... |
2a831cea-e261-4b09-aeb6-7a972ba906dd | 9 | LoginHandler(String username, char[] passwordChars, boolean remember, boolean autoLogin) throws MalformedURLException, IOException, Exception {
if( !remember ) {
File file = new File(System.getenv("APPDATA") + "\\.MinebookLauncher\\login");
if( file.exists() ) {
... |
e67d5199-09d4-41fe-9b2a-a77cb5ec974a | 4 | @Override
public void processEntity(Entity collectableEntity) {
Collide collideComponent = collectableEntity.getComponent(Collide.class);
// Poll the list of entities it collided with, i'll want to rewrite
// this to be observer based so it will only call this logic when a
// collectable has actually been col... |
b91b814a-10d3-44e5-b094-360605fb4a20 | 4 | public Object getValueAt(int row, int col) {
if (data == null) {
return null;
}
if (col >= columnNames.length || col < 0 || row < 0) {
return null;
}
return data[row][col];
} |
4cfbd7bb-f383-42ce-8e36-d97d3c3c25f7 | 9 | @Override
public void paint(Graphics g) {
super.paintComponents(g);
g.setColor(Color.BLACK);
for (int i = 0; i < BOUND_MAX_X; i += 100) {
for (int j = 0; j < BOUND_MAX_Y; j += 100) {
g.drawRect(i, j, 100, 100);
}
}
synchronized (simpleCreatures) {
List<SimpleCreature> sL = Collections
.syn... |
35a60a87-6f16-41dc-9d09-11dc92901478 | 2 | public WidgetMap(int c, int r, int s, boolean showGrid)
{
super(showGrid ? c*(s+1)-1 :c*s, showGrid ? r*(s+1)-1 : r*s, s, 2, 1, 1);
rows = r;
cols = c;
size = s;
grid = new WidgetStackGrid(c, r, s, showGrid);
grid.setObjectName("map");
setLayer(1, grid);
grid.pressed.connect(pressed);
grid.over.co... |
a7099994-eb6d-4e11-ab7c-bf023f864de7 | 4 | @Override
public void collide(Entity entity, double xa, double ya) {
if (entity instanceof Mob) {
Mob mobEnt = (Mob) entity;
if (mobEnt.isNotFriendOf(owner) && !(entity instanceof Building)) {
mobEnt.hurt(this,damage);
hit = true;
}
}
if (hit) {
MojamComponent.soundPlayer.playSound("/sound/Sh... |
42cef8e4-10f3-43ba-84d4-e1c9f908da2e | 6 | private double calUtility () {
double uti = 0;
// The more moves made, the more punish on utility.
uti += gameS.getNumOfMoves() * UTI_PUNISH_MOVES;
// The more golds gotten, the more bonus on utility.
uti += gameS.getGoldCollected() * UTI_BONUS_GOTTEN_GOLD;
uti += getKe... |
b6b99b91-b4ee-477e-ba60-3b9254f2f453 | 0 | public synchronized void setParent(EquationBTreeNode node) {this.parent = node;} |
0f02025f-0431-40bd-916d-db52028f0c18 | 7 | public void keyPressed(KeyEvent e) {
torvalds = GameManager.getTorvalds();
gates = GameManager.getGates();
int keys = e.getKeyCode();
int itnext;
set.add(keys);
Iterator it = set.iterator();
... |
9bfa4cb0-d6a5-467f-887d-ebe4848ca4c3 | 0 | public Assassin() {
super(new DoubleAttack(), new SonicBlow(), new ThrowVenomKnife(), 50.0, 40.0, 0, 10.0, 100.0, 80.0, "Assassin",200,100);
//super(new DoubleAttack(), new SonicBlow(), new ThrowVenomKnife(), 50.0, 40.0, 0, 10.0, 100.0, 80.0, "Assassin");
} // End DVC |
1e0a9f73-ce3c-4b95-ab28-3ec9fb5d3eff | 9 | public static void removeProduct(ActionEvent e)
{
System.out.println("Remove from the invoice button clicked.");
if (e.getSource() instanceof JButton)
{
JButton source = (JButton) e.getSource();
if (upcField == null || upcField.getText().isEmpty())
{
invoiceView.displayError("No UPC Provided.");
... |
2e7782b8-056c-492d-bed3-693a5fe24068 | 8 | @Override
public void generate() {
BSP root = new BSP(0, 0, width, height);
List<BSP> bus = new ArrayList<>();
List<BSP> fin = new ArrayList<>();
List<BSP> con = new ArrayList<>();
bus.add(root);
while (!bus.isEmpty()) {
BSP cur = bus.remove(0);
... |
e83f83c3-d1d6-4921-95c4-70d7b35cccf0 | 2 | public void run(){
if(! started){
started = true;
for(Provider provider : providers){
provider.run();
}
}
} |
4a1ead82-58ec-4c22-aeb3-eec0ca060736 | 9 | public void updateCritters() {
if (firstRun)
firstRun = false;
else {
activeCritterList.clear();
activeCritterList.addAll(inactiveCritterHash.keySet());
}
inactiveCritterHash.clear();
int roundCounter = 0;
int[] sequence = generateRandomSequence(activeCritterList.size());
for (int i : sequence... |
4f57d534-0562-4637-ae4a-37288e46db21 | 6 | public static DBObject convert(final Object entity) {
final DBObject dbObject = new BasicDBObject();
final Class<?> type = entity.getClass();
if (!FIELD_CACHE.containsKey(type)) {
// populate cache.
final List<Field> declaredFields = getAllDeclaredFields(type);
... |
4b9083ce-9391-49ca-b32d-71ca70ff62c6 | 2 | public void processBet(PackReplyOldBetEtx message) { // faz o cal. do Sbet
// faz a adicao do par <chave, valor>
// chave = num de caminhos, valor = numero de nodos
// descendentes com 'aquela' quantidade de caminho
if(sonsPathMap.containsKey(message.getPath())){
sonsPathMap.put(message.getPath(), sonsPathM... |
d00887c7-b89e-402a-8c05-20dfa2e3d150 | 1 | public void testNegated() {
Minutes test = Minutes.minutes(12);
assertEquals(-12, test.negated().getMinutes());
assertEquals(12, test.getMinutes());
try {
Minutes.MIN_VALUE.negated();
fail();
} catch (ArithmeticException ex) {
// expec... |
6bd489da-7db1-4bed-b84d-b0be3d1bc297 | 4 | public void validaUsuario(Usuario usuario){
if(!usuario.getSenha().equals(usuario.getConfirmaSenha())){
throw new ValidationException(new MensagensPadronizadas().senhasIncompativeis);
}
for(Usuario user:usuarioDao.listarTodosUsuarios()){
if(usuario.getUsername().toUpperCase().equals(user.getUsername(... |
357613f7-eeb0-4cfa-91c8-7db927d503a3 | 9 | public static MailItem[] getMessages(String player) {
if (!initialised) return null;
Connection connection = null;
PreparedStatement statement = null;
ResultSet result = null;
try {
connection = DriverManager.getConnection(url, username, password);
statement = connection.prepareStatement(GET_MESSAGES_CO... |
c394cb4c-5c01-4dd8-840f-b0b0c9196b11 | 2 | public List<PrestataireDeService> ListerPrestatairesDeService() {
try {
String sql = "SELECT * FROM User WHERE role='PrestataireDeService'";
ResultSet rs = crud.exeRead(sql);
List<PrestataireDeService> liste = new ArrayList<PrestataireDeService>();
while (rs.next(... |
a7f1654c-6fa3-45c9-81e5-e6e66ad6813a | 8 | @EventHandler
public void onEntityDamageByEntity(EntityDamageByEntityEvent event){
if(event.getEntity() instanceof Player){
final Player player = (Player) event.getEntity();
if(GameUtils.isInGame(player)){
Arena arena = ArenaUtils.getPlayerArena(player);
if(arena.getStatus() == GameStatus.INGA... |
50e4e2a4-3692-4d9c-9c29-2cdbb10b3362 | 9 | private void readPageWithThread(final String uri) {
// files that should be opened in a pop-up.
if (uri.toLowerCase().endsWith(".zip")) { // load a compressed file
EventQueue.invokeLater(new Runnable() {
public void run() {
ZipDownloader downloader = new ZipDownloader(Page.this, uri);
if (downloade... |
d4cf9023-7344-411b-bf30-a2fff7a31183 | 1 | public void initBank() {
Account[] accounts = new Account[NUM_ACCOUNTS];
for (int i = 0; i < NUM_ACCOUNTS; ++i) {
Account account = new Account(i,
(int) (Math.random() * MAX_INIT_AMOUNT));
accounts[i] = account;
}
bank = new Bank(accounts);
... |
349e1a7f-3b3b-4939-8699-22bcea35ca10 | 7 | protected static String getPinyin2(int hz) {
String py = "";
if (hz > 0 && hz < 160)
py += hz;
//else if (hz < -20319 || hz > -10247);
else if (hz <= -10247 && hz >= -20319){
PinyinCode pc = null;
int i = pinyin.size() - 1;
for (; i >= 0; i--) {
pc = (PinyinCode) pinyin.get(i);
if (pc.code <... |
4ebd1b66-4f61-44b3-892c-25f85a44fefa | 9 | public static void ScanFolder(String path) {
try {
System.out.println("Scan " + path);
File folder = new File(path);
File[] fList = folder.listFiles();
for (File file : fList){
if(file.isFile()) {
String fileName = file.getName();
String extension = fileName.substring(f... |
44c19649-e427-4a34-9d88-cc9bdb485cf9 | 6 | @Override
public boolean onReceievedAction(InterfaceController controller, EInterfaceAction binding, SimpleAutoCompleteEntry construct) {
switch(binding) {
case Bind_DeleteAll:
deleteSelected();
break;
case Bind_DeleteTopmost:
DeleteTopmost();
break;
case Bind_Save:
SaveTo... |
812809f8-d014-4dab-9c44-a73f8714f782 | 2 | private void sendPublisher() {
for(Publisher publisher : publishers) {
Response response = publisherTarget
.request(MediaType.APPLICATION_JSON)
.post(Entity.entity(publisher, MediaType.APPLICATION_JSON));
if(response.getStatus() >= 300){
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.