method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7855ba39-bb24-417d-8f81-f0e9fc80f66d | 2 | public static void main(String[] args)
{
PriorityQueue<GregorianCalendar> pq = new PriorityQueue<GregorianCalendar>();
pq.add(new GregorianCalendar(1906, Calendar.DECEMBER, 9)); // G. Hopper
pq.add(new GregorianCalendar(1815, Calendar.DECEMBER, 10)); // A. Lovelace
pq.add(new GregorianCalenda... |
09666b9a-bc00-4420-ae88-0d04bc2ec075 | 4 | public boolean initialize(){
if( is_init )
return true;
if( !dao_state.initialize() ){
System.out.println( "LocationHandler : failed to initialize PersonStateDao!" );
return false;
}
if( !dao_area.initialize() ){
System.out.println( "LocationHandler : failed to initialize LocationAreaDao!" );
dao... |
6827bbf4-09d1-4ada-bba2-5acc675e531a | 2 | protected void prepareAttributes(GrowableConstantPool gcp) {
if (unknownAttributes == null)
return;
Iterator i = unknownAttributes.keySet().iterator();
while (i.hasNext())
gcp.putUTF8((String) i.next());
} |
60e62ca4-dfd2-4743-89cb-a6b30839bbb3 | 5 | private static boolean isIntegral(JsonPrimitive primitive) {
if (primitive.value instanceof Number) {
Number number = (Number) primitive.value;
return number instanceof BigInteger || number instanceof Long || number instanceof Integer
|| number instanceof Short || number instanceof Byte;
}... |
0b6d3196-9e8f-4478-8017-4d97d5d48594 | 0 | public void setNewMainObject(Serializable obj){
theMainObject = obj;
} |
04a64240-8822-411c-aa52-68fd73f8aa0a | 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 Equipe)) {
return false;
}
Equipe other = (Equipe) object;
if ((this.getId() == null && other.getId() != null) ... |
36872f08-e8a8-4b33-bce5-890807e01f52 | 4 | @EventHandler
public void onPlayerPreLoginEvent(AsyncPlayerPreLoginEvent event) {
String playerName = event.getName();
// check if there is a ban...
Ban ban = plugin.getController().getBan(playerName);
// player is still banned, but he should already be unbanned
if (ban != ... |
20d29db8-e0b7-4feb-b550-65ef0049177e | 3 | public static JSONObject toJSONObject(java.util.Properties properties) throws JSONException {
JSONObject jo = new JSONObject();
if (properties != null && !properties.isEmpty()) {
Enumeration enumProperties = properties.propertyNames();
while (enumProperties.hasMoreElements()) {
... |
cdd1a856-4c76-4d40-81de-81f7ef83e073 | 0 | @Override
public void openSettingsView() {
settingsGui.setVisible(true);
settingsGui.setLocationRelativeTo(chatGui);
} |
dee9c366-77c7-4b88-8803-6b5b7080e822 | 6 | public static void Gauss(double[][] a, double[] b) {
for (int i = 0; i < a.length; i++) {
int rowMaxElem = rowMaxElem(a, i);
if (rowMaxElem == -1) {
System.out.println("Error!");
System.exit(1);
}
if (rowMaxElem != i)
... |
ab30a6db-8a65-475d-95ad-4a6a46da2590 | 3 | @Test
public void testGetPwEntriesString() throws Exception {
if (!isUnix())
return;
List<UnixPasswdEntry> pwEntries = UnixPasswdEntry.getPwEntries();
assertNotNull(pwEntries);
assertTrue("at least root & current user", pwEntries.size() > 2);
String loggedInAs = System.getProperty("user.name");
for (Uni... |
6ebefeee-b1a2-4987-94d1-05eecc74436f | 5 | @Override
public Class<?> getColumnClass( int columna )
{
switch ( columna )
{
case 0: // Nom de l'usuari
return String.class;
case 1: // Número de partides jugades
return Integer.class;
case 2: // Percentatge de victóries
return String.class;
case 3: // Puntuació global
return Integer... |
448677e8-4b6c-4540-ba7c-699893ee8615 | 3 | public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
int n,k;
while ((n=scanner.nextInt())>0){
k=scanner.nextInt();
List<Point> list=new ArrayList<>(n*n);
for(int i=0;i<n;++i){
for(int j=0;j<n;++j){
... |
4a84819e-ef40-4ce8-8152-f733cf288837 | 9 | @Override
public MovingDirection getDirection(AbstractMovingObject movingObject, AbstractGameObject targetObject, GameCollection gameCollection) {
MovingDirection direction = null;
int characterX = targetObject.getCoordinate().getX();
int characterY = targetObject.getCoordinate().getY();
... |
aae8b662-09dd-40cf-a374-9850fbd97dbf | 5 | public void extract(File zippedFile, File unzipDirectory) throws IOException
{
zipLogger.info("Unzipping file " + zippedFile + " to directory " + unzipDirectory);
if(unzipDirectory.exists() && !unzipDirectory.isDirectory())
{
zipLogger.severe("Unable to unzip! " + unzipDirectory + " exists, and it is not a... |
071cdc13-f4ca-4ab4-8318-3d034b252096 | 0 | @Override
public int available() throws IOException {
return data.length - ptr;
} |
b6042b8f-10c4-48be-90d3-f132f126bf16 | 8 | public void update(GameState pauseState, GameContainer gc, Map m){
Input input = gc.getInput();
int x = input.getMouseX();
int y = input.getMouseY();
Rectangle r = new Rectangle(x,y,2,2);
if(r.intersects(resume)){
if(gc.getInput().isMousePressed(Input.MOUSE_LEFT_BUTTON)){
visible = false;
}
inne... |
1cb67011-c1e3-45db-91c8-b2836c66ca05 | 7 | public boolean initDecrypt(String password)
{
if (password == null || password.length() < 1)
{
Application.getController().displayError(Application.getResourceBundle().getString("password_not_null_title"),
Application.getResourceBundle().getString("password_not_null... |
b73fccf1-d281-4bc3-8bda-59be1cb9a333 | 5 | public int getPuntos() {
if (null != valor) switch (valor) {
case "J":
case "Q":
case "K":
return 10;
case "A":
return 11;
default:
return Integer.parseInt(valor);
}
return -100;
} |
beeecdab-7829-4178-9b72-de99e5a30a22 | 5 | public static void main(String args[]) {
Die _die1 = new Die();
Die _die2 = new Die(1);
Die _die3 = new Die(2);
System.out.println(_die1);
System.out.println(_die2);
System.out.println(_die3);
_die1.roll();
_die2.roll();
_die3.roll();
Sy... |
c888cace-9223-4084-adb9-01748ba19d13 | 2 | public Object open() {
createContents();
UI.centerShell(getParent(), shell);
shell.open();
shell.layout();
Display display = getParent().getDisplay();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return result;
} |
59d7b94a-824e-4b37-bfd2-e1aa03286e1d | 2 | private Point mousePosition() {
try {
Point mp = this.getMousePosition();
if (mp != null) {
return this.getMousePosition();
} else {
return new Point(0, 0);
}
} catch (Exception e) {
return new Point(0, 0);
... |
c1be6c5d-4bfb-4bce-a1bf-84e1f2085c3e | 3 | private void insertEllipse(boolean[][] map, int row, int col, int width, int height)
{
for (int r = Math.max(0, row - height / 2); r < Math.min(row + height / 2, map.length); r++)
{
for (int c = Math.max(0, col - width / 2); c < Math.min(col + width / 2, map[r].length); c++)
... |
d76cd2a9-686a-4871-939d-c17985527bc5 | 5 | public static int getHeight(AbstractInsnNode insn, MethodNode method) {
Stack<AbstractInsnNode> branches = new Stack<AbstractInsnNode>();
int height = 0;
branches.push(method.instructions.get(0));
outie: while (branches.size() > 0) {
AbstractInsnNode current = branches.pop();... |
4a704b88-6104-4b13-a134-b2cbdaecd39c | 4 | @Override
public void updateKillStreak(String player_name, int curKillStreak) {
PreparedStatement pst = null;
int player_id = getPlayerId(player_name);
int killstreak = getKillStreak(player_id);
if (curKillStreak > killstreak) {
try {
pst = conn.prepareStatement("UPDATE ffa_leaderboards SET killstreak=?... |
7f52af80-3adb-4fc6-90b6-f3ee792db324 | 4 | @Override
public String toString() {
switch (this)
{
case LEFT:
return "R";
case RIGHT:
return "L";
case UP:
return "D";
case DOWN:
return "U";
default:
return ... |
019b0288-4c73-447e-bbcb-9b6fef6fe3e3 | 0 | @Basic
@Column(name = "sale_time")
public Timestamp getSaleTime() {
return saleTime;
} |
9cfe6f85-6a99-40e1-8efa-c3f562580788 | 8 | private static <V> V findAbbreviatedValue(Map<? extends IKey, V> map, IKey name,
boolean caseSensitive) {
String string = name.getName();
Map<String, V> results = Maps.newHashMap();
for (IKey c : map.keySet()) {
String n = c.getName();
boolean match = (caseSensitive && n.startsWith(string)... |
1ccfe208-ebc9-438e-b989-f600d19ddd28 | 6 | public Object parseClass() throws ParseException, IOException {
int linenr = scanner.getLineNr();
int token = scanner.getToken();
if (token != IDENTIFIER_TOKEN)
throw new ParseException(linenr, "Class name expected");
Object instance;
try {
Class clazz = Class.forName("jode.obfuscator.modules."
+ s... |
a59067b1-df15-46d6-9109-2eec2bef3ce1 | 7 | public static VulnLocation searchParam(String nameInclude, String s, String method, int sizePath){
BufferedReader buff;
String line;
int lineNumber;
String include = "";
String nameInclude2="";
VulnLocation includeVuln;
try{
lineNumber = 0;
int index1 = -1, index2 = -1;
buff = new BufferedRead... |
b3075a64-e78a-430b-b584-d12bffae6c91 | 0 | public static String getTipoFunc() {
return tipoFunc;
} |
8c32e259-20bd-4be1-b4a7-e82e9c5cb3ef | 9 | private void cargarSetPrueba(){
DefaultTableModel temp = (DefaultTableModel) this.tablaSetPruebas.getModel();
String csvFile = "dataset/diabetes_prueba.csv";
BufferedReader br = null;
String line = "";
String cvsSplitBy = ",";
try {
double maximo0 = normalizacion.obtenerMaximo(0, csvFile);
doubl... |
24a700b4-b32b-4110-82c6-8a4414babf59 | 0 | private Set<Card> twoEightsPlusQueenTenSevenKicker() {
return convertToCardSet("2S,7S,TD,8S,QD,8C,5H");
} |
fdf4be68-8326-417b-b74c-e39eafbefba5 | 5 | private long powerOfTen (int power) {
if ( power < 1 ) { return 0; }
if ( power < powTen.length && powTen[power] != 0 ) { return powTen [power]; }
long result = 1;
long currentPow = 10;
for ( int i = 1; i < power; i++ ) {
result = 9 * result + currentPow;
currentPow = currentPow * 10;
}
if ( power... |
b6a93daf-1714-4904-bf08-0e01f4684199 | 2 | public crearCocheWnd(java.awt.Frame parent, boolean modal, Coche mod) {
super(parent, modal);
initComponents();
taller = ctrlTaller.getInstance();
modCoche = mod;
clientsModel = new DefaultListModel();
if(modCoche != null){
matText.setText(modCoche.ge... |
ee9fe2c7-0f85-46c9-8f4e-e8321a7498fa | 5 | private void showHistogram(){
int[] histogram;
CreateHistogram.availableChannel histogramColor;
switch(this.jComboBoxHistogram.getSelectedItem().toString()){
case "RED":
histogram=ObjHistogram.histogramRed(ObjTransformFormats.iconToBufferedImage(this.jLabelImage.g... |
329bd608-0e3c-4630-966e-ea551e77cffb | 8 | public void update() {
int y = getLoc().getY();
int x = getLoc().getX();
if (upPressed && y > 3)
getLoc().setY(y - 5);
if (downPressed && y < StartUp.height - 26 - size)
getLoc().setY(y + 5);
if (leftPressed && x > 3)
getLoc().setX(x - 5);
if (rightPressed && x < StartUp.width - 7 - size)
getLoc... |
4b66bb56-64c6-4b96-bf32-ef6048bbaf54 | 1 | public Double getComision() {
if (comision==null) {
return 0.00;
}
return comision;
} |
8c1f90f4-7c58-46ec-aaed-3f38b5e80d2c | 7 | public Battleground(BattlegroundHandler handler, String name) {
this.handler = handler;
this.name = name;
this.state = BattlegroundState.MAINTENANCE;
try {
if (getConfigurationSection().contains("spawns")) {
for (String key : getConfigurationSection().getConfigur... |
9088bf7a-445f-47a1-840f-90f329597124 | 6 | @Override
public ArrayList<BoardPosition> getPossibleDestinations(Board board) {
ArrayList<BoardPosition> possibleDestinations = new ArrayList<BoardPosition>();
//is it a valid L move ?
int xDiff = Math.abs(startingPosition.getColumn() - targetPosition.getColumn());
int yDiff = Math... |
9e4b0088-5cf3-4ed8-b35e-f0529c5f3fe1 | 2 | private boolean hitAll(String S, int index, HashMap<String, Integer> allWords, int step) {
HashMap<String, Integer> left = new HashMap<String, Integer>(allWords);
while (left.size() > 0) {
if (hitOne(S, index, left, step)) {
index += step;
} else {
... |
50e47ff9-0c6d-415b-8691-628ce81d3795 | 6 | public int get(Object k){
int hash = hash(k);
int mask = cap - 1;
int bkt = (hash & mask);
int bhash = hopidx[bkt<<2];
if(bhash != 0)
{
Object bkey = keys[hopidx[(bkt<<2) + 1]];
if(hash == bhash && k.equals(bkey))
return hopidx[(bkt<<2) + 1];
for(;(bhash = hopidx[(bkt<<2) + 2]) != 0; bkt = (bkt + 1) &... |
83e0a935-bdca-4a89-93f8-fac957bfa19d | 3 | @Override
public byte unmute(int soundID) {
if(this.soundMap.containsKey(soundID)) {
if(this.isPlaying(soundID) && this.isMuted(soundID)) {
float previousVolume = this.mutedMap.get(soundID);
this.setVolumeChecked(soundID, previousVolume);
this.mutedMap.remove(soundID);
return 1;
} else {
... |
e7ab5f44-87d4-4879-924a-3e190faf5da4 | 6 | public static Set<Service> getMostUselessServicesMutated(Server server, Map<Server, Set<Application>> connections) {
Set<Service> mutatedServices = new LinkedHashSet<>();
List<Service> sortedServices = getServicesOrderedByUsage(server, connections);
if (server.getServices() != null) {
... |
0edc4d6a-1124-4602-b775-e405666da27e | 4 | public boolean addUser(ClientDB client) {
// TODO Auto-generated method stub
if (checkSpace()) {
if (checkDuplicate(client.getUserID())) {
for (int i = 0; i < clientObj.length; i++) {
if(clientObj[i]==null){
clientObj[i]=client;
return true;
}
}
}
else{
return false;
}
... |
a14671b7-00a6-4274-b711-6b561982e68c | 9 | public void writeClassAndObject (Output output, Object object) {
if (output == null) throw new IllegalArgumentException("output cannot be null.");
beginObject();
try {
if (object == null) {
writeClass(output, null);
return;
}
Registration registration = writeClass(output, object.getClass());
i... |
fe050f5e-69bc-46a7-a632-54bd79a44840 | 7 | public void setAsignaNumeroDientesPlato(int numerodientes[]) {
int i = 0;
boolean compruebadientes = true;
if (dientesplato.length == numerodientes.length) {
i = 1;
while (i < dientesplato.length && compruebadientes) {
if (numerodientes[i - 1] >= numerodientes[i]) {
compruebadientes = false;
}... |
3e15a7d4-861a-4a65-ac4f-5756dbbc6095 | 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... |
738a1f8f-740c-45da-9a11-ec2d839d0a8c | 2 | public static String ArrayToString(String[] array, int bottomlimit, int toplimit)
{
String string = "";
for(int i = bottomlimit; i <= (array.length - (1 + toplimit)); i++)
{
if (i != bottomlimit) string += " ";
string += array[i];
}
r... |
b0f692c6-7d82-4f26-b62d-945ce86776ab | 9 | @Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Parameterized other = (Parameterized) obj;
if (m_field == null)
{
if (other.m_field != null)
return false;
}
else
if (!m_field.e... |
8644f8dc-cd43-44b4-b8ae-41e695427821 | 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... |
43aa33be-d332-41cd-8005-57df187b4bc0 | 5 | public static void zip(File directory, File zipfile)
{
try
{
final URI base = directory.toURI();
final Deque<File> queue = new LinkedList<File>();
queue.push(directory);
final OutputStream out = new FileOutputStream(zipfile);
Closeable res = null;
final ZipOutputStream zout = new ZipOutputStream(... |
faf6fd06-6ab9-470d-bf9b-55c705bb4c24 | 2 | private void initialiseerVeld2(VeldType[][] eenVeldType2) {
for (int i = 0; i < eenVeldType2.length; i++) {
for (int j = 0; j < eenVeldType2[i].length; j++) {
eenVeldType2[i][j] = VeldType.LEEG;
}
}
eenVeldType2[0][1] = VeldType.MUUR;
eenVeldType... |
366fb8e0-a743-4bf3-adbb-c6408340965a | 1 | public void render(Graphics g) {
g.drawImage(sprite, (int)x - 7- View.x, (int)y -14- View.y, null);
if(curanim == 1) {
g.drawImage(Images.log, (int)x - 7- View.x, (int)y -23- View.y, null);
}
} |
2caec6ef-3b43-41c9-9c8c-9680e55c049e | 2 | public void destroy(Long id) throws NonexistentEntityException {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
Periodo periodo;
try {
periodo = em.getReference(Periodo.class, id);
perio... |
f97dc540-c1f5-40da-96ca-8ef3e248931c | 8 | public List<Statement> parse(Map<String, Integer> labels) {
List<Statement> statements = new ArrayList<Statement>();
while (true) {
// Ignore empty lines.
while (match(TokenType.LINE));
if (match(TokenType.LABEL)) {
... |
5286a143-bd7f-47ac-9d8d-e0021ce37def | 6 | private void intercept() {
// only one missile will be hit at iron dome
synchronized (missile) {
// calculate to know if missile will be intercept before he will hit
// the ground
if (destructAfterLaunch < missile.getFlyTime()
+ missile.getLaunchTime()
&& missile.getLaunchTime() <= destructAfterL... |
8b04ed57-5854-4d6f-8047-6b92b2cc5ba4 | 5 | public void setNextByAddr(FlowBlock flow) {
/* nextByAddr can be set, when reordering block in transform exc */
// if (nextByAddr != null)
// throw new IllegalStateException("nextByAddr already set");
if (flow == END_OF_METHOD || flow == NEXT_BY_ADDR)
throw new IllegalArgumentException("nextByAddr mustn't be... |
6a4904d1-f361-4ca2-aced-20e6c869d32b | 9 | @SuppressWarnings("deprecation")
private void processExternalCommand(final String[] tokens) {
// FIXME: searching broken for mixed case-sensitive / insensitive systems
if (!Enigma.isFileSystemCaseSensitive(env.getCurrentPath()))
tokens[0] = tokens[0].toLowerCase();
File match = null... |
4c3c773b-0faa-427d-a707-c5cf4b1778ab | 8 | public String fixColors(String str)
{
final StringBuffer buf=new StringBuffer(str);
int startedAt=-1;
for(int i=0;i<buf.length();i++)
{
if(buf.charAt(i)=='%')
{
if(startedAt<0)
startedAt=i;
else
if(((i+1)<buf.length())&&(buf.charAt(i+1)=='^'))
{
String found=null;
final Str... |
f83a1f2e-7b34-4786-b6d9-4f4c03203104 | 6 | public void runScript(String scriptPath) throws FuzzyEngineException {
int lineNumber = 0;
try(BufferedReader br = new BufferedReader(new InputStreamReader(
new BufferedInputStream(new FileInputStream(new File(scriptPath)))))) {
while(true) {
String line = br.readLine();
lineNumber++;
if(... |
5a5b11b8-7715-4917-9f89-a7a260a3ba79 | 6 | final public static void main( String[] args ) {
//determine the cards that the user is required to use in his/her
//163 expression
ArrayList < Integer > cardsRequiredToBeUsed = new ArrayList < Integer > ();
for ( int i = 0 ; i <= 5 ; i ++ ) {
cardsRequiredToBeUsed.add( Integer.valueOf( args[ i ] ) );
}... |
f280221a-6e08-44a1-9e3d-9bb4a5063eb0 | 3 | private void updateHitbox() {
hitbox.x += xvel;
hitbox.y += yvel;
if (incHitboxAlpha) {
hitboxAlpha += 0.1;
if (hitboxAlpha > 1) {
hitboxAlpha = 1;
incHitboxAlpha = false;
}
}
else {
hitboxAlpha -= 0.... |
d3d9126f-48ab-4267-b28a-5abca89ea2a7 | 9 | public void backTrack() {
boolean tmpCounter = false, skipCounter = false;
for(int i = closedNodes.size()-1; i >= 0; i--) {
skipCounter = false;
for (Node tmpDead : deadEndList) {
if((closedNodes.get(i).compareTo(tmpDead))==1){
skipCounter = true;
break;
}
}
if(skipCounter==false) {
... |
098d45df-a5c1-43f4-a99c-e2e392ec6015 | 4 | public void setDt(double dt) {
for (Component e : subPanel.getElements()) {
e.reset();
if (e instanceof DynaSys)
((DynaSys) e).setDt(dt);
else if (e instanceof ApproxDif)
((ApproxDif) e).setDt(dt);
else if (e instanceof Integration)
((Integration) e).setDt(dt);
}
} |
5a9a7509-1ed6-45ce-9533-567621f389eb | 5 | public static String exec(String command){
// Logger logger = org.apache.log4j.Logger.getLogger(CommandSystem.class);
String sStandar = "";
String sError = "";
String s;
try {
//logger.info("command = " + command);
// System.out.println("command = ... |
948c2253-5218-4edf-9233-6f90f7081f02 | 6 | public Boolean isWallAhead(Position position, int angle){
Boolean _result = true;
Position _pos = null;
if(angle >= 360){
angle -= 360;
}
if(angle < 0){
angle += 360;
}
switch(angle){
case 0:
_pos = new Position(position.getX(), position.getY() - 1);
_result = !this._nodes.containsKey(_po... |
c676b762-1b94-4515-bebb-cf15943db9c1 | 3 | @Override
public void update(long deltaMs) {
sinceLastSpawn += deltaMs;
if(sinceLastSpawn >= betweenSpawns && spawned < amount) {
GameSector s = Application.get().getLogic().getGame().getSector(sector);
if(s.free()) {
s.spawnEnemy(resource);
si... |
40488735-8ed4-4bbc-9fec-1f9b7b8063d4 | 9 | public boolean checkPass(int numPlayers){
if (numPlayers==3 && moveList.size() < 2){
return false;
} else if (numPlayers==2 && moveList.size() < 1){
return false;
} else if (numPlayers==2 && moveList.get(moveList.size()-1).Pass()){
return true;
} else if (numPlayers==3 && moveList.get(moveList.size()-2... |
9ff44b44-d7a8-4c73-9eda-14ddd3f08724 | 3 | public void dump(PrintStream out) {
for (int row = 0; row < SIZE; row++) {
for (int col = 0; col < SIZE; col++) {
out.print(square[row][col]);
if( col == (SIZE-1)) {
out.print("\n");
} else {
out.print(",");
}
}
out.flush();
}
out.print("\n\n");
out.flush();
} |
5c586c50-4743-47f5-bb34-a386d84e776b | 4 | @Override
public String log(Iterable<LogItem> items) throws Exception
{
StringBuilder result = new StringBuilder(2048);
InputStream in = getClass().getResourceAsStream(PREAMBULE_FILENAME);
if (in == null)
throw new Exception(PREAMBULE_FILENAME + " was not found.");
BufferedReader reader = new BufferedReade... |
c83eaf53-e004-42e2-ac2d-c7438cd25f7a | 2 | private void RemoverCampoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RemoverCampoActionPerformed
try {
if (NomeCampo_TextField.getText().equals("")) {
JOptionPane.showMessageDialog(null, "Indique qual o nome do campo a remover!", "Alerta!", JOptionPane.WARNING_... |
0cf09ef8-95c8-49f6-991f-d449cc620fda | 5 | public void loadCategories(File dir){
this.dir = dir;
categories.clear();
dialogs.clear();
lastUsedCatID = 0;
lastUsedDialogID = 0;
for(File file : dir.listFiles()){
if(!file.isDirectory())
continue;
DialogCategory category = loadCategoryDir(file);
Iterator<Entry<Integer, Dialog>> ite = categ... |
1f968933-d736-4ddd-966e-08068e0c11bf | 8 | public static void hessianCD(final ObjectiveFunctionFast afunc, final double[] ax, final double afx, double[][] ahess) {
int n = afunc.getDim();
double[] h = new double[n];
double xh, oldx, oldy;
int i, j;
double tol = Math.pow(MachineAccuracy.EPSILON, 0.25);//TODO revise maybe 1... |
a3352867-c74b-49ac-807a-f7a9fc7e080d | 4 | public void setEdgePoints(Object edge, List<mxPoint> points)
{
mxIGraphModel model = graph.getModel();
mxGeometry geometry = model.getGeometry(edge);
if (geometry == null)
{
geometry = new mxGeometry();
geometry.setRelative(true);
}
else
{
geometry = (mxGeometry) geometry.clone();
}
if (th... |
ad79ab9f-ec37-43e3-a939-26c986211aa0 | 0 | protected void onPing(String sourceNick, String sourceLogin, String sourceHostname, String target, String pingValue) {
this.sendRawLine("NOTICE " + sourceNick + " :\u0001PING " + pingValue + "\u0001");
} |
99075296-f77d-42ee-b06f-3bb176dffe0b | 4 | public PreparedStatementMapper(Class<T> clazz){
// this.clazz = clazz;
methods = clazz.getMethods();
//hashmap to store the setters
getters = new HashMap<String,Method>();
for( int i=methods.length -1; i>= 0; i--){
Column col = methods[i].getAnnotation(Column.class);
Class<?>[] parameters = meth... |
386743d2-21ba-489f-be44-9728fec2d5f5 | 2 | private ArrayList<Card> createTheFullPack() {
ArrayList<Card> theCards = new ArrayList<Card>(TOTAL_NUMBER_OF_CARDS);
int suitNum = A1Constants.CLUBS;
int cardValue = 0;
for (int i = 0; i < TOTAL_NUMBER_OF_CARDS; i++) {
theCards.add(new Card(cardValue, suitNum));
if (cardValue >= CARDS_IN_EACH_SUIT - 1) ... |
efe51773-cec8-41c4-8cf1-d63c5691cc03 | 9 | private void declaraProced() {
Simbolo simboloProced = null;
if (comparaLexema(Tag.VOID)) {
consomeToken();
if (comparaLexema(Tag.IDENTIFICADOR)) {
simboloProced = new Simbolo(escopoAtual + 1, null, listaTokens
.get(indiceLista).getNomeDoToken(), null,
"PROCEDIMENTO");
consomeToken()... |
3475606c-4e03-4bea-b8c4-87e89db123e0 | 7 | public static void sendFile
(
Socket sckIn
, String strId
, EzimFileOut efoIn
)
throws Exception
{
if (efoIn != null)
{
efoIn.setSocket(sckIn);
EzimDtxSemantics.initByteArrays();
byte[] bTmp = new byte[EzimNetwork.dtxBufLen];
int iTmp = 0;
long lCnt = 0;
long lCLen = 0;
FileInputS... |
833bd731-df08-4dc4-b871-f17150ad4e2a | 3 | private static Token matchLiteral(String word, int line, int position){
StringBuilder token = new StringBuilder();
int i = 0;
for (; i<word.length(); i++){
char current = word.charAt(i);
if (!Character.isDigit(current)){
break;
}
token.append(current);
}
if (i != 0)
return new Token(Token... |
df6494f0-ea8f-4570-a10e-68b7cba08c20 | 1 | public boolean next() {
if (hasNext()) {
tick();
return true;
}
return false;
} |
a3c4b479-ff39-4a05-879f-854179ff2df8 | 2 | public boolean hasparent(Widget w2) {
for (Widget w = this; w != null; w = w.parent) {
if (w == w2)
return (true);
}
return (false);
} |
9a0e5137-41a0-427e-a9e1-e8bd6bd7b042 | 7 | private void verifyComponentStart(Stack<LiteralComponent> componentStack, LiteralComponent componentToCheck,
String literalName) throws ComponentMismatchException {
if (componentStack.size() == 0) {
if (componentToCheck.compareTo(LiteralComponent.NAME_START) > 0) throw new ComponentMismatchException(
Error... |
aadd372b-58d7-484f-a3b2-2d2d5c8027f3 | 6 | public static void main(String[] args) throws Exception {
if(args.length < 1){
System.out.println("Usage : please input htmlFileName");
System.exit(0);
}
String workDir = System.getProperty("user.dir");
String fileSeparator = System.getProperty("file.separator");
// String urlReg = "href=\"(http://... |
504db59a-b474-4feb-8616-158b259f2934 | 0 | public void setSolPosId(int solPosId) {
this.solPosId = solPosId;
} |
b3fa6c3c-d346-49bc-8a30-42db32ef7350 | 9 | private void downloadPictures(int indexOfPicture)
{
try
{
File picturesDir = null;
URL aURL = new URL("http://www.cc.kyoto-su.ac.jp/~atsushi/Programs/CSV2HTML/PrimeMinisters/"+url+"0"+indexOfPicture+".jpg");
InputStream inputStream = aURL.openStream();
if(url == "images/")
{
picturesDir = new ... |
1b57045b-89d8-41ba-a5a8-7f9b96323c1d | 9 | @Override
public double[] calculateFractal3DWithoutPeriodicity(Complex pixel) {
iterations = 0;
double temp = 0;
Complex tempz = new Complex(pertur_val.getPixel(init_val.getPixel(pixel)));
Complex[] complex = new Complex[2];
complex[0] = tempz;
complex[1] = new Comp... |
1ab15979-2dde-43d1-8975-b2bb379ac746 | 1 | public static FillInBlankQuestion getQuestionByQuestionID(int questionID) {
try {
String statement = new String("SELECT * FROM " + DBTable + " WHERE questionid = ?");
PreparedStatement stmt = DBConnection.con.prepareStatement(statement);
stmt.setInt(1, questionID);
ResultSet rs = stmt.executeQuery();
r... |
301fde50-280e-498b-9429-0c5740b22b2a | 9 | private void calculateRootNode(CleanTimeValues cleanTimeValues, Set<String> namespacePrefixes) {
cleanTimeValues.rootNode = cleanTimeValues.htmlNode;
// original behavior -- just take the first html element ignoring all other content, or later html elements.
// if (properties.isOmitHtmlEnvelope()) {
// ... |
aa220f4a-ac94-4982-b4a8-2a3e0b080cff | 6 | @Test
public void testFailingData() {
boolean success = true;
try {
new Action(new JSONObject("{"
+ "'execute': 'exec testAction.ex',"
+ "'keywords': ["
+ " 'key',"
+ " 'word'"
+ "]"
+ "}"));
} catch(JSONException e) {
success = false;
}
if(success)fail("Missing Name doesn... |
dd0b2520-195c-4207-a9e5-487f27faa60c | 2 | public int getMethod() {
if (buttonGroup.getSelection().getActionCommand().equals("A"))
return 1;// DESX
if (buttonGroup.getSelection().getActionCommand().equals("B"))
return 2;// Knapsack
else
return 3;// AA
} |
01596a14-18a0-429b-bd6d-5a454773b5f9 | 1 | public static void main(String[] args) {
try {
Files.walkFileTree(Paths.get("/home/xander/Downloads"), new PrintFileVisitor());
} catch (IOException e) {
e.printStackTrace();
}
} |
b2746e49-8bd4-434d-915d-2e526de8aa0a | 1 | public void testIsEqual_YM() {
YearMonth test1 = new YearMonth(2005, 6);
YearMonth test1a = new YearMonth(2005, 6);
assertEquals(true, test1.isEqual(test1a));
assertEquals(true, test1a.isEqual(test1));
assertEquals(true, test1.isEqual(test1));
assertEquals(true, test1a.is... |
32a33c9f-54ce-4e11-98ca-0243892ee983 | 1 | public void sendLine(String line) throws IOException {
if (_acceptable) {
throw new IOException("You must call the accept() method of the DccChat request before you can use it.");
}
// No need for synchronization here really...
_writer.write(line + "\r\n");
_writer.fl... |
60d7d76a-4e7a-4039-a835-2ef35e55a2e9 | 5 | public boolean start() {
address = null;
try {
address = InetAddress.getByName(ip);
} catch (UnknownHostException e) {
e.printStackTrace();
}
Socket s;
try {
s = new Socket("google.com", 80);
selfIP = (s.getLocalAddress().getHostAddress());
if (selfIP == null) {
internetConnected = false;... |
d547b7f1-fd62-451b-ab5e-cba4fd8f7769 | 5 | public void showDwarfData(Dwarf dwarf) throws BadLocationException
{
doc.remove(0, doc.getLength());
doc.insertString(doc.getLength(), "ID: " + dwarf.getId() + "\n", stylePlain);
doc.insertString(doc.getLength(), "Name: ", stylePlain);
doc.insertString(doc.getLength(), dwarf.get... |
6332f54a-3a6c-4af3-9182-63bbda8f69ec | 7 | public static char toCompatibilityJamo(char jamo) {
if (jamo >= 0x1100 && jamo < 0x1100 + CHOSEONG_LIST.length) {
return CHOSEONG_LIST[jamo - 0x1100];
}
if (jamo >= 0x1161 && jamo <= 0x1175) {
return (char)(jamo - 0x1161 + 0x314F);
}
if (jamo == 0) {
return HANGUL_FILLER;
} else {
if (jamo >= 0x... |
ea9f3659-6fd9-4a88-b572-57bcf233c713 | 6 | * @param decode decode vector.
* @param bitsPerComponent bits per component .
*/
private static void alterRasterYCCK2CMYK(WritableRaster wr,
Vector<Integer> decode,
int bitsPerComponent) {
float[] origValues... |
4ac5fa48-dbf1-4cdc-a314-83900c237020 | 5 | private static int singleManeuverRoll(Dice d){
Flags rollFlags = new Flags();
rollFlags.ManeuverFlag = true;
d.rollDice();
if((d.getCurrentFace() instanceof ManeuverIcon)||(d.getCurrentFace() instanceof IDIcon))
return d.getCurrentFaceValue();
else if(d.getCurrentFace() instanceof SpecialIcons){
Spec... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.