method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
5c2a3ca2-0a7f-4960-a0b8-487d5b686f47 | 3 | public void branch() {
//List<Integer> listToBranch = copyIntegerList(this.integerPeptideList);
//this.integerPeptideList.clear();
int peptideListSize = this.integerPeptideList.size();
for (int i = 0; i < peptideListSize; i++) {
List<Integer> peptide = this.integerPeptideLis... |
7605dc59-1c04-467e-9449-c54dde0fba15 | 5 | @Override
public List<User> findUserAll() {
List<User> list = new ArrayList<User>();
Connection cn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
cn = ConnectionHelper.getConnection();
ps = cn.prepareStatement(QTPL_SELECT_ALL);
... |
d4cf9af2-29d0-48d9-ba4b-a15954a4f2f1 | 5 | @Test
public void checkHazardousmap()
{
map = HazardousMap.getInstance();
Boolean isGood = false;
map.setSize(10,5);
map.createMap();
int amntOfBlue = 0;
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
if(map.getTiles()[i][j] == Colour.BLUE)
amntOfBlue++;
}
}
if... |
6f91878b-094a-45b7-ae2a-42a83eba984e | 8 | @Override
public Object getValueAt(int pLinha, int pColuna) {
Layout dado = dados.get(pLinha);
switch(pColuna)
{
case 0: return dado.descricao;
case 1: return dado.posicaoInicial;
case 2: return dado.posicaoFinal;
case 3: return dado.g... |
1e8c4ad5-b046-48e0-aeee-8d936685008f | 9 | private void updateCreature(Creature creature,
long elapsedTime)
{
// apply gravity
if (!creature.isFlying()) {
creature.setVelocityY(creature.getVelocityY() +
GRAVITY * elapsedTime);
}
// change x
float dx = creature.getVelocityX();
... |
a139599f-d3d8-4ad2-8dca-2a5c71214d37 | 5 | private static int[] findFirstDiff(BufferedImage image1, PixImage image2,
int border) {
if (image1.getWidth() != image2.getWidth()
|| image1.getHeight() != image2.getHeight()) {
return new int[] { -1, -1 };
}
BufferedImage bImage2 = ImageUtils.pixImage2buffer(image2);
for (int y = border; y < image1.g... |
9f25dbdd-e827-427a-83c6-a904e965fbaa | 6 | @Override
public void loadData(DataInput input) throws IOException {
TagBase tag = null;
while (true) {
int tagTypeId = input.readByte();
EnumTagType tagType = EnumTagType.fromTypeId(tagTypeId);
if (tagType != null) {
if (tagType != EnumTagType.TAG_End) {
String tagName = input.readUTF();
... |
24b11afb-145d-4f8e-83e6-14795c16d7f3 | 5 | @Override
public Vector3 refract(RayTracer tracer, Scene scene, Ray ray, Vector3 point, Vector3 norm, Primitive primitive) {
Material material = primitive.getMaterial(point);
double refractionPower = calcRefractionPower(scene, ray, material, point, norm);
// Refraction
... |
bbff0760-4c49-482d-b4a2-21cf66c441de | 6 | ArrayList<String> parseCommandParameters(String command) {
ArrayList<String> params = new ArrayList<String>();
String cmd = command;
cmd = cmd.trim();
cmd = cmd.replace(',', ' ');
cmd = cmd.replace(';', ' ');
int lastSpace = 0;
for (int i = 0; i < cmd.length(); i++) {
if (cmd.charAt(i) == ' ' || i + ... |
5c2ce10b-432f-4e71-b3ae-bbbff2675818 | 1 | private static ArrayList<Location> getAsLocationArray(SearchNode searchNode) {
ArrayList<Location> searchPath = new ArrayList<Location>();
SearchNode currentTile = searchNode;
while ((currentTile = currentTile.parent) != null) {
searchPath.add(currentTile.getAsLocation());
}
return searchPath;
} |
43efb126-88f6-4d9a-9713-c3e527864880 | 5 | public void componentResized(ComponentEvent e) {
Dimension newSize = e.getComponent().getSize();
newSize.width = (newSize.width > 0) ? newSize.width : 1;
newSize.height = (newSize.height > 0) ? newSize.height : 1;
if ((offGraphics == null) || (newSize.width != offDimension.width)
|| (newSize.height ... |
42a0a9fc-9a2b-4813-ac4f-27f2083844e5 | 5 | public void forcePaint(final Graphics2D g) {
if (reverse) {
if (current < 200) {
final float percentage = (float) current / 200f;
g.setColor(new Color(238, 228, 218, 186));
g.fillRect(22, 136, 495, 495);
g.setColor(new Color(119, 110, 1... |
10dedda6-ac16-4d14-b36a-7533ed7d270e | 4 | private InputStream getInputStream(Object arg) throws IOException
{
if(arg instanceof File)
{
return new FileInputStream((File)arg);
}
if(arg instanceof String)
{
return new FileInputStream((String)arg);
}
if(arg instanceof URL)
{
return ((URL)arg).openStream();
}
if(arg instanceof InputSt... |
ec3ae3c5-4d4a-458f-9259-c03695a982dc | 1 | private void evalParts() {
if (getOthers() == 1) {
radar = new LockRadar(this);
gun = new LinearGun(this);
wheel = new RamWheel(this);
} else {
radar = new SpinRadar(this);
gun = new LinearGun(this);
}
} |
316c1669-241d-4649-911f-f25661827a5d | 3 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
if (cmbEscolhaProjeto.getSelectedItem().equals("Selecione")) {
JOptionPane.showMessageDialog(null, "Selecione um projetos",
"Projetos", JOptionPane.ERROR_MESSAGE);
... |
a52cdda4-8e0b-41bc-a0ee-c0dbf39c9cc3 | 9 | public Row(COLOR color, int lineChoice) {
Type [] type_list = {ROOK,KNIGHT,BISHOP,QUEEN,KING,BISHOP,KNIGHT,ROOK};
if (color == EMPTY) {
for(int i=0;i<8;i++) {
Piece piece = Piece.create(color,NO_PIECE);
rowPieces.add(piece);
}
} else if (color == WHITE){
for(int i=0;i<8;i++) {
Piece ... |
ac07575c-b349-4214-93e9-6c3f3bf337c4 | 1 | protected void doInit(ILogger logger, IRemoteServerConnection rsc) throws Exception {
setLogger(logger);
setRemoteServerConnection(rsc);
getRemoteServerConnection().addConnectionDisconnectListener(new ConnectionDisconnectListener() {
public void OnConnectionDisconnectEvent(ConnectionDisconnectEvent ev... |
292a2ae8-823f-47f6-951c-985ce31cf64f | 3 | @Override
protected void paintComponent(Graphics g){
setBackground(Color.BLACK);
g.setColor(Color.WHITE);
super.paintComponent(g);
for(int i=0; i<10; ++i)
g.drawString(game.toString().substring(i*40,i*40+40), 17, 40*(i+1)+20);
if (status==GameStatus.SHOTHIT)
g.drawString("You got 'em! YAAAY!", 120, 480... |
0a34c715-86d4-4652-a724-86960068f1f1 | 5 | public void check( TValidationWorkingSet wSet )
{
TMultiLanguageEntry ref = wSet.getRefEntry() ;
TMultiLanguageEntry dummy = wSet.getLoopEntry() ;
TLanguageList langList = TGlobal.projects.getLanguages() ;
int len = langList.getSize() ;
int sim = 0 ;
for(int t = 0 ; t < len ; t++)
{
... |
0a053bcd-f6da-4b11-9a2e-4310c760153e | 9 | private void go(){
try {
FileReader fr = new FileReader(inputFile);
BufferedReader br = new BufferedReader(fr);
String ln = br.readLine();
String[] species = {};
while(ln != null){
StringTokenizer stk = new StringTokenizer(ln,", \t");
int nsp = stk.countTokens()-1;
String tok;
if... |
759bfa72-d4da-4e4f-8810-bef0bf36adb6 | 4 | public void init(int mode, byte[] key, byte[] iv) throws Exception{
String pad="NoPadding";
byte[] tmp;
if(iv.length>ivsize){
tmp=new byte[ivsize];
System.arraycopy(iv, 0, tmp, 0, tmp.length);
iv=tmp;
}
if(key.length>bsize){
tmp=new byte[bsize];
System.arraycopy(k... |
73a6514a-7ff4-495b-9bf1-f978c203c572 | 4 | protected DateTimeField getField(int index, Chronology chrono) {
switch (index) {
case 0:
return chrono.hourOfDay();
case 1:
return chrono.minuteOfHour();
case 2:
return chrono.year();
case 3:
... |
3db2d24e-4204-4ca9-9cd6-7076118ae34a | 6 | private int indexOfNextNameChar(int index) {
for (int lookahead = index; lookahead < chars.length; lookahead++) {
char c = chars[lookahead];
if (Character.isLetterOrDigit(c)) {
return lookahead;
}
switch (c) {
case '.':
return lookahead;
case '-':
return lookahead;
case '_':
... |
e3f834cf-880b-4daa-9933-0c17b6025663 | 2 | public static void main(String[] args) {
// Working with Arrays and ArrayLists
int[] evenNums = { 2, 4, 6, 8, 10 };
// System.out.println(evenNums[2]);
evenNums[2] = 12;
// System.out.println(evenNums[2]);
// System.out.println(evenNums.length);
for (int i = 0; i < evenNums.length; i++) {
// Syst... |
0e205bd2-71b4-4b59-8293-bc4d01d8c6eb | 7 | private static Predictor train(List<Instance> instances, String algorithm) {
// TODO Train the model using "algorithm" on "data"
// TODO Evaluate the model
// generate initial values
int sgd_iterations = 20;
if (CommandLineUtilities.hasArg("sgd_iterations"))
sgd_iterations = CommandLineUtilities.getOpti... |
11fa9c4d-42d9-47ab-993c-8eb348a9271d | 2 | public AnnotationVisitor visitArray(String name) {
AnnotationVisitor v = av.visitArray(name);
return v == null ? null : (v == av
? this
: new RemappingAnnotationAdapter(v, renamer));
} |
83b4dbb0-fa88-433a-8c49-5a035e7f0903 | 3 | public boolean addPlayer(Player player)
{
//check if Player is persisted.
try {
if ( pairs.size() < 2 )
{
if (player.getId() == null) // not persisted yet
{
//persist(player);
throw new ... |
5f20362c-3a85-42f1-93a9-2f8ea38bae7c | 7 | public Client(IObserver... observer) throws ClassNotFoundException, NoUserInterfaceChosen {
pfactory = new PacketFactory();
ConsoleReader cr = ReaderFactory.getReader(pfactory);
try {
if (observer.length == 0) {
LOG.warn("No user interface specified!");
... |
aa8de743-04a2-491a-b2c3-ab64df3d9785 | 8 | private void loadBlock() throws IOException
{
int opensize = Integer.reverseBytes(fp.readInt());
int packsize = Integer.reverseBytes(fp.readInt());
int checksum = Integer.reverseBytes(fp.readInt());
int ccount = 0xFFFF&(int)Short.reverseBytes(fp.readShort());
System.out.printf(" unpacked size: %08X... |
56bae843-d0c8-4c6a-af36-6449261751ff | 2 | public Map<String, String> filterProperties(List<String> filter) {
Map<String, String> filteredProperties = new HashMap<String, String>();
for (String propertyName : filter) {
if (properties.containsKey(propertyName)){
filteredProperties.put(propertyName, properties.get(prope... |
e3a67fd8-550f-4bd6-98e7-cc58effce74d | 1 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((code == null) ? 0 : code.hashCode());
return result;
} |
4d5a7f1b-3c80-41e0-98e8-11ac052ddb6a | 6 | @Override
public void actionPerformed(ActionEvent ae) {
String comando = ae.getActionCommand();
switch (comando) {
case "Retirar":
if (!Base.hasConnection()) {
Base.open("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/quiniela", "tecpro", "tecpro");
... |
c3cc4815-21a2-467e-9ebe-66db196fcd37 | 2 | public String generateNewID() {
int maxID = 0;
int tempID;
for (Project p : projectResultList) {
tempID = Integer.parseInt(p.getProjectID());
if (tempID > maxID) {
maxID = tempID;
}
}
return String.format("%03d", maxID + 1);
} |
114eb45e-dc56-4d45-bdd9-6a87f786df87 | 9 | public int[][] randomizeMap(){
//init random
Random random = new Random();
//random first part
for(int count = 0; count < xSpan; count++)
{
for(int count2 = 0; count2 < ySpan; count2++)
{
prop[count][count2] = random.nextInt(Integer.MAX_VALUE) % 3;
if((count2 == 19) && (count < 3))
... |
82d630c0-83d1-4dd0-96c7-60546ef9bd0e | 3 | @Override
public DatabaseTable createTable(String name, Class<?> layout) {
DatabaseTable table = new SQLDatabaseTable(this, name);
if (tableExists(name)) {
return table;
}
if (!table.create(layout)) {
return null;
}
return table;
} |
cf1f513f-e111-42ca-becb-ab345802a53c | 9 | public void init(byte[] input, int windowStart, int from, int to) {
int[] hashVal = this.hashVal;
int[] head = this.head;
int[] same = this.same;
int[] prev = this.prev;
int[] hashVal2 = this.hashVal2;
int[] head2 = this.head2;
int[] prev2 = this.prev2;
System.arraycopy(Cookie.intMOnes,... |
10fe664f-5e40-427f-925c-9fa319ef0661 | 1 | private void acao104() {
if(!analisandoRegistro)
listaIdsVariaveis = new ArrayList<>();
else
listaIdsCamposRegistroTemp = new ArrayList<>();
contextoListaIds = ContextoListaIds.DECLARACAO;
} |
f611d1a8-2107-4e5a-af53-b1406965bda0 | 5 | @Override
public void run() {
//
// Get the updated text field
//
String text = nameField.getText();
//
// Suggest a name if the text has changed. The new name will start
// with the characters entered so far and the caret will be
// positioned at t... |
8e078ed6-694b-4694-ab93-fe63053c8adf | 2 | public AudioManager() {
buffers = new HashMap<String, IntBuffer>();
buffer = BufferUtils.createIntBuffer(1);
source = BufferUtils.createIntBuffer(1);
sourcePos = BufferUtils.createFloatBuffer(3).put(new float[] { 0.0f, 0.0f, 0.0f });
sourcePos.flip();
sourceVel ... |
bc75bad8-2a0f-4ca9-866c-29060bbd92fb | 5 | public void run() {
try {
String getLine = new String(datapacket.getData(), 0, datapacket.getLength());
StringTokenizer st = new StringTokenizer(getLine);
String response;
String tag = st.nextToken();
String name = st.nextToken();
if(tag.equals("search")) { //search rese... |
79abbf1e-bae7-44ae-8009-c33acbb6f063 | 8 | void render(short colixA, short colixB, byte endcaps, int diameter, int xA, int yA, int zA, int xB, int yB, int zB) {
if (diameter > (g3d.width + g3d.height) * MAX_FIX)
return;
// XIE: begin: deal with long sticks to prevent huge raster arrays from being produced
dxB = xB - xA;
dyB = yB - yA;
if (dxB * dxB... |
9f469513-b893-47cd-99c2-90cefc6b317c | 0 | @BeforeClass
public static void testSetup() {
context = new ClassPathXmlApplicationContext("spring_beans.xml");
} |
4d450e6a-e40c-4c22-b687-720c704a93da | 4 | public void populate(String u) throws Exception{
Connection conn =null;
Statement stmt = null;
ResultSet rs=null;
try{
Class.forName("com.mysql.jdbc.Driver");
conn=DriverManager.getConnection(url);
stmt = conn.createStateme... |
3502d9b6-c6e9-4870-927b-d518013c7321 | 2 | private Float sum(float[] weeksPrices) {
float sum = 0;
for (float f : weeksPrices) {
if (f == f) {
sum += f;
}
}
return sum;
} |
422a57e7-1d58-4eb4-b640-308f558ef75a | 4 | private void placerPostes(Graphics2D g){
g.setStroke(new BasicStroke()) ;
for(Poste poste : modele){
g.setColor(Color.gray) ;
int xPoste = Parametres.posteX(poste.getPosition().getTravee(),poste.getOrientation()) ;
int yPoste = Parametres.posteY(poste.getPosition().getRangee(),poste.getOrientation()) ... |
e42550e5-ea3e-486d-a050-2d3ab760d6f7 | 6 | public static Proposition findDuplicateProposition(Proposition self) {
if (Logic.descriptionModeP() ||
((BooleanWrapper)(KeyValueList.dynamicSlotValue(self.dynamicSlots, Logic.SYM_LOGIC_DESCRIPTIVEp, Stella.FALSE_WRAPPER))).wrapperValue) {
return (null);
}
if (self.kind == Logic.KWD_DISABLED) ... |
0302df5d-61f5-40b1-8f70-3910f3b46c2a | 5 | private Tile findTileToMark() {
if (! (mind.home() instanceof Venue)) return null ;
final Venue lair = (Venue) mind.home() ;
float angle = Rand.num() * (float) Math.PI * 2 ;
final Vec3D p = lair.position(null) ;
final int range = Nest.forageRange(species) ;
final Tile tried = world.tileAt(
... |
ed962e7a-aece-481d-9017-f416401e65e3 | 7 | public void loadScores(){
try{
reader = new BufferedReader(new FileReader("HighScore.txt"));
new Scanner(reader);
}
catch(FileNotFoundException e){
System.out.println("waah!");
return;
}
for(int x = 0; x<5; x++){
... |
ec1e3bd7-6123-4678-b283-22efd93e46de | 4 | public void loadTable(String[] data) {
Object[][] h = new Object[data.length - 2][3];
for (int i = 0; i < h.length; i++) {
for (int j = 0; j < 3; j++) {
if (j == 0) {
h[i][j] = data[i + 1];
} else if (j == 2) {
h[i][j] =... |
1d6078a1-db0e-444e-9540-61387182e323 | 5 | private void createCurrDirection(SessionRequestContent request) {
Direction currDir = (Direction) request.getSessionAttribute(JSP_CURRENT_DIRECTION);
if (currDir == null) {
currDir = new Direction();
currDir.setDescription(new Description());
currDir.setTourType(new T... |
a36c1fcb-5a49-4c10-b0a5-61db4edbfa11 | 4 | @Override
public void run() {
running = true;
gameStart = false;
image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);
g = (Graphics2D) image.getGraphics();
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g.setRenderingHint(RenderingHints.KEY_TE... |
b42918c9-35f4-4ba3-81ca-f463444f798a | 6 | private GameState waitressNightAction(GameState state, Card card)
{
Color faction = card.getFaction();
Player player = state.getPlayer(faction);
GameState[] choices = waitressNightChoices(state, card);
if(player.checkCPU())
{
GameState sell = null;
if(choices.length > 1)
{
sell = choices[1... |
a017d232-3111-47b7-bc0e-f56d188ef473 | 4 | private static Image buildDirectionsImage(Image image, Image Gx, Image Gy) {
Image direction = image.shallowClone();
for (int x = 0; x < image.getWidth(); x++) {
for (int y = 0; y < image.getHeight(); y++) {
for (ChannelType c : Image.rgbValues()) {
double pxGx = Gx.getPixel(x, y, c);
double pxGy =... |
df41c349-9a8c-4bdb-892b-cf3bf0003939 | 2 | public static boolean isInt(double a,double b){
double value;
if(a == b) {
return true;
}
value = Math.sqrt(a * b);
if(value == Math.round(value)){
return true;
}
return false;
} |
62b4cfcd-8ef6-493f-b5f4-7950605f28d3 | 7 | public List<Tag> compile(String rules){
// states
List<Tag> tags;
Tag nextTag, prevTag;
Tag blockExtTag;
String tagName, blockExtName;
// instantiate tag list
tags = new ArrayList<Tag>();
// add root tag
nextTag = new Tag();
nextTag.setKi... |
09f88be9-c603-4dbb-b20a-a1a07be19e31 | 0 | public void setNameLab(String nameLab) {
this.nameLab = nameLab;
} |
044cf1aa-35f4-41f3-ad40-3593e2b00185 | 0 | public ArrayList<Event> getEvents() {
return events;
} |
915d89ff-7f96-467c-a73a-55452bdb5758 | 2 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
FooterPanel = new javax.swing.JPanel();
HeaderPanel = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = ... |
c996af21-ec15-4865-badc-5ea553f89e5e | 5 | public void route(String url)
{
String[] ma = url.split("\\?");
String[] m = ma[0].split("/");
if(ma.length > 1)
{
this.params = ma[1];
}
if(m.length>1 && m[1] != null) this.control = StrUtils.ucfirst(m[1]);
if(m.length>2 && m[2] != null) this.action = m[2];
} |
7f62c04d-23d0-480b-a018-9293e95007eb | 4 | public static void logMessage(int logLevel, String message) {
// If it is not important enough for us then do not print it
if (logLevel > log_level)
return;
// We should not have an empty logfile
if (logfile == null || logfile.equals(""))
return;
// Open file to prepare a print
PrintWriter pw;
... |
822eb65b-fff5-4138-87b9-bcf41e48d44a | 6 | private void close() {
// try to close the connection
try {
if (sOutput != null)
sOutput.close();
} catch (Exception e) {
}
try {
if (sInput != null)
sInput.close();
} catch (Exception e) {
}
;
try {
if (socket != null)
socket.close();
} catch (Exception e) {
... |
2a9b8bbb-ea34-442b-bea6-7c9f472d9d9a | 6 | private Node booleanRelation() {
// sumExpr ((LE^ | LT^ | GE^ | GT^ | EQUAL^ | NOT_EQUAL^) sumExpr)?
Node sumExpr = sumExpression();
TokenType type = lookAhead(1);
if (type == TokenType.LESS_EQUAL) {
return new LessEqualOpNode(match(TokenType.LESS_EQUAL).getPosition(),
sumExpr, sumExpression());
} els... |
66063f14-ddb9-458b-adfa-b671a7aebd6e | 5 | @Override
public void valueRecived(SlotInterface s, Value v) {
if (s.getLabel().equals(_trigger)) {
try {
FileDialogMode mode = (FileDialogMode) getNodeSetting(_mode)
.getValue().getEnum();
JFileChooser fc = new JFileChooser();
// In response to a button click:
int returnVal = JFileChooser.... |
82540df7-6085-4577-af83-978fc37cf939 | 5 | public void handleShopMenuInput(){
String userChoice;
ArrayList<Integer> selectionInfo = new ArrayList<Integer>();
boolean leaveShop = false;
while(!leaveShop){
System.out.println("Command: ");
userChoice = input.nextLine();
if(userChoice.compareTo("Health Potion") == 0|| userChoice.compareTo("health poti... |
46501652-a2d8-4861-9d38-8dd28ceaecbf | 7 | public static int deleteExistingUser(String UserName, String Password){
/* Try to delete the given user from the data file if the password is validated.
* 0: fail
* 1: success
* 50:account error
* 99:non exist
*/
int iRet = 0;
String strList = FileHandle.readDataFile(strFile_User);
// String st... |
e67db2ba-28b8-4d07-a46e-a6d219dd5183 | 5 | public PublicKey decodePublicKey(byte[] k) {
// magic
if (k[0] != Registry.MAGIC_RAW_SRP_PUBLIC_KEY[0]
|| k[1] != Registry.MAGIC_RAW_SRP_PUBLIC_KEY[1]
|| k[2] != Registry.MAGIC_RAW_SRP_PUBLIC_KEY[2]
|| k[3] != Registry.MAGIC_RAW_SRP_PUBLIC_KEY[3]) {
throw new Ill... |
7b2d78fc-12b1-4240-92d9-b63aac540814 | 7 | public List<TipoRecurso> listarTipoRecurso(TipoRecurso tipoRecurso){
ArrayList<TipoRecurso> listaRetorno = new ArrayList<TipoRecurso>();
if ( tipoRecurso.recuperarTipo() == null || tipoRecurso.recuperarTipo().isEmpty()){
for (TipoRecurso tipoRec : this.tipoRecursos) {
if(tipoRec.recuperaStatus() !... |
605e8fa7-9590-45e3-8821-8b27c6cc9d58 | 1 | public void func() {
Iterator<Map.Entry<String, Flyweight>> iterator = flies.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, Flyweight> e = iterator.next();
Flyweight fw = e.getValue();
fw.func();
}
} |
7f1dde6c-3536-4f62-adb9-2e2519b93f67 | 6 | public void startDownload() {
File path = new File(dir);
if (!path.exists())
path.mkdirs();
String fileFormat = format == FORMAT_JPG ? "jpg" : remoteurl
.substring(remoteurl.lastIndexOf(".") + 1);
File file = new File(dir + filename + "." + fileFormat);
if (!(file.exists() && file.length() > 0)) {
/... |
57071e84-75d3-42aa-971c-7129c7e1a2e1 | 6 | private void AddbtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddbtnActionPerformed
int Fi = Table.getSelectedRow();
if (Fi < 0) {
String Mensaje = "Elija Un Producto Antes de Continuar,"
+ "o elija menos de dos productos";
JOptionPan... |
0d294a08-1a5c-49e6-bee3-b0bc8c0bdc55 | 0 | public static void main(String[] args) {
JPCTDemo start=new JPCTDemo(args);
} |
a6694054-48fd-490c-92b9-d6b20dd62630 | 9 | public List<Integer> topKFrequent(int[] nums, int k) {
List<Integer> result = new ArrayList<Integer>();
if (nums == null || nums.length == 0 || k > nums.length || k < 1) {
return result;
}
// O(n)
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
for (int n : nums) {
if (map.keySet().... |
a1380d3d-b9e7-4ed1-9de5-2e09f8f1dea2 | 5 | public void printStreamInfo() throws IOException {
OggPacketReader r = ogg.getPacketReader();
System.out.println("Processing file \"" + file.toString() + "\"");
int pc = 0;
int streams = 0;
int lastSid = -1;
Map<Integer, String> streamTypes = new HashMap<Integer, Strin... |
ada02edd-b77a-4837-9b7f-692330031417 | 2 | public static void main(String[] args)
throws java.io.IOException {
char choice;
System.out.println("Help on:");
System.out.println(" 1. if");
System.out.println(" 2. switch");
System.out.println(" Choose one: ");
choice = (char) System.in.read();
switch(choi... |
9178864b-0b57-4b1a-b335-3baa671f6464 | 2 | private static int hexDigitToDec(char c)
{
for (int i = 0; i < hexNums.length; i++)
{
if (hexNums[i] == c)
{
return i;
}
}
System.err.println("invalid character \"" + c + "\"");
return -1;
} |
47cf2f36-feea-405f-810f-75d0a6c313b6 | 3 | public void update(long delta) {
if (active) {
InputHandler input = InputHandler.getInstance();
if (input.isPressed() && checkMouse(input.getClickPoint())) {
isPressed = true;
}
}
} |
9db9e1f0-4e21-419e-a80a-564b86be4317 | 3 | public ArrayList<Conditional> getRuleCondition(int id)
{
ArrayList<Conditional> cond = new ArrayList();
try{
stat.setQueryTimeout(30);
ResultSet rs = stat.executeQuery("SELECT * FROM Condition Where RuleId ="+id+";");
while(rs.next())
{
... |
07f678aa-ab12-4cc4-98ec-a3bd80d5058b | 4 | public void getNewAbility() {
// TODO Auto-generated method stub
if(this.getLevel() == 2)
{
//sneak attack
//deals damage based on dex instead of atk
addAbility(new SneakAttack());
}
if(this.getLevel() == 4)
{
//snipe
//chance to get a critical hit
addAbility(new Snipe());
}
if(this.ge... |
c1f711f5-205b-4965-9cb4-f454c862d5d6 | 6 | public static String[] toString(ItemStack is) {
ArrayList<String> msg = new ArrayList<String>();
MaterialData md = is.getData();
msg.add(Integer.toString(is.getAmount()) + " of " + md.getItemType().name() + " ");
if( is.hasItemMeta() ) {
ItemMeta im = is.getItemMeta();
if( im.hasEnchants() ) {
... |
b75a08fa-ced8-49ba-8b6a-30f2ad1c558a | 5 | void read()
{
lastDataTime = System.currentTimeMillis();
byte[] readBuffer = inputBuffer.buffer;
int bytesAvailable = 0;
try {
bytesAvailable = inputStream.read(readBuffer, inputBuffer.length, readBuffer.length-inputBuffer.length);
inputBuffer.length += bytesAvailable;
} catch (IOException e) {
... |
88b7f546-aa09-48bf-abde-a72bc9c52c75 | 9 | public void addSeries(Comparable seriesKey, double[][] data) {
if (seriesKey == null) {
throw new IllegalArgumentException(
"The 'seriesKey' cannot be null.");
}
if (data == null) {
throw new IllegalArgumentException("The 'data' is null.");
}
... |
d55cbcf1-b65a-4309-8988-75c2d5662bcb | 8 | @Override
public void update(final int delta) {
if (Controls.getInstance().wasF12()) {
world.finish();
}
if (Controls.getInstance().wasR() || !player.isAlive()) {
newLevel(false);
}
titelTimeleft -= delta;
world.update(delta);
player.update(delta);
if (world.isFinished() && !levelFinished) {
... |
af7717d8-6dec-463e-a8ad-4d024819de64 | 2 | private void colorCode(int i, int j, long temp) {
if (temp >= HIGH_TEMP) {
colorHighTemp(i, j, temp);
} else if (temp <= LOW_TEMP) {
colorLowTemp(i, j, temp);
} else {
colorMidTemp(i, j, temp);
}
} |
0fdcd490-6fb5-46d9-b93f-cb4b4b349ca2 | 5 | public void keyPressed(KeyEvent e)
{
if (e.getKeyCode() == KeyEvent.VK_ENTER)
{
chatCount = chatCount + 1;
charNum = 0;
clearChat();
}
if (awaitInput == true)
{
{
if (e.getKeyCode() == KeyEvent.VK_1 || e.getKeyCode() == KeyEvent.VK_2 || e.getKeyCode() == KeyEvent.VK_3)
{
... |
597bda92-0804-4c4e-90fb-f9fc4bc068b4 | 9 | public final IJson.Result fromJSON(JSONObject json, int version) {
try {
version = json.getInt("version");
if(version > JSON_VERSION)
return IJson.Result.OUTDATED_APP;
groups = new ArrayList<PrivilegeGroup>();
JSONArray jsonGroups = json.optJSONArray("groups");
if(jsonGroups != null) {
int len... |
86d7b9a5-5b25-491e-bbf2-e5053b2e89fd | 0 | public DocumentSettings(OutlinerDocument document) {
this.doc = document;
updateSimpleDateFormat(createModDatesFormat.cur);
} |
ac3c80d4-5eff-4b6c-a8eb-7619de3ee7d0 | 6 | public void timerTick(privAVLTree myTree, connectionInfo source)
{
branchKill++;
if(children[0] != null)
children[0].timerTick(myTree, source);
if(children[1] != null)
children[1].timerTick(myTree, source);
if(branchKill>8)
{
myTree.balanceDelete(this);
try
{
if(data.getName().... |
5324676e-ee18-4ced-9c1f-de014d2ec6cf | 0 | public ArrayList<Boolean> getPictureInventoryList()
{
return pictureInventoryList;
} |
e34e4f6b-39d9-49e4-9a0c-8a55a47c23a2 | 2 | public boolean validGameNode() {
return (areCoordinatesSet() && howManyEdges() >= 0 && howManyEdges() <= 4);
} |
84646bd3-f9d7-4b7b-91c2-b5ea9444fd66 | 2 | public static void handle(String[] tokens, Client client) {
Channel channel = Server.get().getChannel(tokens[1]);
if(channel == null || !channel.getClients().contains(client)) {
return;
}
channel.leave(client);
client.leaveChannel(channel);
} |
2506c13f-eb7b-4645-b9fe-5c00997bc804 | 6 | public static List getAllConceptsWithPrefix(Module module, boolean localP, String prefix) {
{ Iterator iter = Logic.allNamedDescriptions(module, localP);
List result = List.newList();
String downcasedprefix = Native.stringDowncase(prefix);
{ NamedDescription description = null;
Iterator i... |
21c1be5d-9127-417d-8978-d2a8979facaf | 1 | public void test_compareTo() {
assertEquals(0, iField.compareTo(iField));
assertEquals(-1, iField.compareTo(ISOChronology.getInstance().minutes()));
DurationField dummy = new PreciseDurationField(DurationFieldType.seconds(), 0);
assertEquals(1, iField.compareTo(dummy));
// try {
/... |
8ea596d5-bc13-421a-9358-7d3c7c090bee | 9 | private boolean isLastPicture() {
int index = 0;
CobolToken last = this.allTokens.getFromLast(index);
if (last == null) {
return false;
}
if (last.getType() == CobolType.CONTINUATION) {
index++;
last = this.allTokens.getFromLast(index);
... |
39967f57-7973-4f5b-96c4-d0515563f05f | 7 | public MacroCallStatement(SourceFile sourceFile, int lineNo, Token[] tokens) throws SyntaxError {
// Super-class (Statement) constructor
super(sourceFile, lineNo, tokens);
operands = new ArrayList<Token>();
// First token must be a Macrocall (Macrocalls are tokenized as... |
2b8d0232-fb36-4389-b0df-610381394f35 | 5 | private String randomMelody(int length) {
// Shortest length of note is 1/16th
length *= 16;
int count = 0;
String s = "";
int prevInt = 0;
int currInt = 1;
int currTone = this.key + 60;
int prevLength = 0;
int currLength = 0;
while(count < length) {
prevLength = currLength;
currLength = rand... |
c369f2b2-b1f0-4758-b36b-a528c7540bd3 | 6 | @Override
public Object getValueAt(int indiceLigne, int indiceColonne) {
switch(indiceColonne){
case 0 :
return praticiensHesitants.get(indiceLigne).getNumP() ;
case 1 :
return praticiensHesitants.get(indiceLigne).getNomP() ;
case 2 :
return praticiensHesitants.get(indiceLigne).getVilleP() ;
ca... |
76854724-bc59-4782-8384-d8f4d3bbab12 | 7 | public boolean equals(Object _other)
{
if (_other == null) {
return false;
}
if (_other == this) {
return true;
}
if (!(_other instanceof FriendsPk)) {
return false;
}
final FriendsPk _cast = (FriendsPk) _other;
if (userId != _cast.userId) {
return false;
}
if (friendsWith !... |
d8f29d68-d033-4e59-a148-b60e51d9ec25 | 0 | public SameAsServiceImpl() {
this.gsonBuilder.registerTypeAdapter(Equivalence.class, new EquivalenceDeserializer());
this.gsonBuilder.registerTypeAdapter(EquivalenceList.class, new EquivalenceListDeserializer());
} |
3bc10ba5-bd3e-425f-8310-2d4dc4f9e917 | 2 | private InfoflowResults analyzeAPKFile(boolean enableImplicitFlows) throws IOException {
String androidJars = System.getenv("ANDROID_JARS");
if (androidJars == null)
androidJars = System.getProperty("ANDROID_JARS");
if (androidJars == null)
throw new RuntimeException("Android JAR dir not set");
System.out... |
9f10fe6d-17f7-434c-b77e-71a4afce3e14 | 8 | public String toString() {
StringBuffer result = new StringBuffer();
result.append("---- " + name + " ----\n");
if (dough != null) {
result.append(dough);
result.append("\n");
}
if (sauce != null) {
result.append(sauce);
result.append("\n");
}
if (cheese != null) {
result.append(cheese);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.