method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
8d771146-1123-47b8-b839-3cca890ec022 | 6 | public void Process()
{
Scanner sc = new Scanner(System.in);
int choice = 0;
while(choice != 3)
{
printMenu();
choice = sc.nextInt();
switch(choice)
{
case 1: //Aliasing
System.out.println("Aliasing----------------------------");
System.out.println("Please en... |
0e75eca1-a46b-4c8d-bf41-16a4be51af04 | 7 | public String toString()
{
StringBuffer buf = new StringBuffer();
buf.append("DNSPacket[");
buf.append(isQuery() ? "Query" : "Responce");
if(isAuthoritativeAnswer())
buf.append(" Authoratative");
if(isTruncated())
buf.append(" Truncated");
buf.append(" Q:" + _Questions.size());
buf.append(" A:" + _... |
0a2c2f29-6528-4f31-8125-60ec1108274f | 0 | public static void main(String[] args) {
int x, y, z;
x = y = z = 1;
System.out.println("x = " + x + ", y = " + y + ", z = " + z);
//x = 1, y = 1, z = 1
x = (y = (z = z + 1) + 1) + 1;
System.out.println("x = " + x + ", y = " + y + ", z = " + z);
//x = 4, y = 3, z = 2
x = (y = 1) + (z = 1);
System.out.println("... |
52816ee8-5dc9-45b1-bdfe-21f15a180bc5 | 1 | public ShieldPart(Body body, Box2DSprite sprite){
super(body);
this.sprite = sprite;
nonBoostedColor = Color.TEAL.cpy();
nonBoostedColor.a = 0.2f;
boostedColor = Color.TEAL;
if(!boosted){
sprite.setColor(nonBoostedColor);
}
} |
15e0bc7c-1a74-4883-935b-91c8f28b2279 | 9 | private void warnPrePurge(MOB mob, long timeLeft)
{
// check for valid recipient
if(mob==null)
return;
if((mob.playerStats()==null)
||(mob.playerStats().getEmail().length()==0)) // no email addy to forward TO
return;
// timeLeft is in millis
final String from="AutoPurgeWarning";
final String to=... |
d144bcc2-bb4f-4ac8-b11b-1b8c882f501b | 7 | public String agregarDocumento(Venta doc) {
tablaVentas();
ArrayList<Venta> nuevoDoc = new ArrayList<Venta>();
String concepto=doc.getConcepto();
String fechaemi=doc.getFechaemi();
String fechaven=doc.getFechaven();
double subtotal=doc.getSubtotal();
double igv=do... |
c8433d0c-65fa-4411-9195-e3098c9048a9 | 4 | public Descent(DescentFrame frame) {
this.frame = frame;
CardLayout layout = new CardLayout();
setLayout(layout);
setBackground(new Color(48, 0, 48));
setPreferredSize(new Dimension(640, 480));
setDoubleBuffered(true);
this.logger = Logger.getLogger("Descent");
... |
8c3db691-d052-41f5-999a-6ef5957de920 | 3 | private void debugLevelPrint() {
for (int i = 0; i < getLevel().bricks.length; i++) {
for (int j = 0; j < getLevel().bricks[i].length; j++) {
System.out.print(getLevel().bricks[i][j] != null ? getLevel().bricks[i][j]
+ " "
: "* ");
}
System.out.println();
}
System.out.p... |
4b2e5ae0-a7e3-487d-acd2-0cf3690b18a4 | 6 | private void setTextDescriptionInArray() {
String t = Database.DESCRIPTIONS.get(Database.dbSet.get(tickerID))
.replaceAll("_", " ");
double rankTotal = calculateWordRankTotal(t);
double rankAverage = calculateWordRankAverage(t);
for(int i = 0; i<15; i++)
lines.add(new String(" "));
lines.add("word rank su... |
7a84d137-14a4-4e42-82cb-eac4721e2246 | 0 | public boolean isChange() {
return myChange;
} |
ff6484b5-87f7-4dea-9db7-9dfaadd4f89b | 3 | public void clearJuego(){
for(int i = 0; i< ejercito.size(); i++){
ejercito.get(i).detener = true; //detener cada hilo
}
for(int i = 0; i< edificios.size(); i++){
edificios.get(i).detener = true; //detener cada hilo
}
for(int i = 0; i <tropas.siz... |
c887853b-f9fa-473b-a033-de6e2c84decc | 1 | @Test
public void testTimeStep_ANNUAL_MEAN_OCT_TO_SEP() throws Exception {
printDebug("----------------------------");
printDebug("Annual Mean with Period Oct to Sep: " + this.toString());
printDebug("----------------------------");
CSTable t = DataIO.table(r, "obs");
Assert.... |
b0cdff0f-6d17-4d0d-9c26-222a459f25bd | 9 | public void move() {
xPrev = x;
yPrev = y;
if (colDectUP()) {
if (Controler.up) {
y -= Game.pSpeed;
dir = 1;
animUp.startAnimation();
}
}
else {
y += 1;
}
if (colDectDOWN()) {
if (Controler.down) {
y += Game.pSpeed;
dir = 0;
animDown.startAnimation();
}
}
if (col... |
e539a991-9efa-46ba-90d3-3524a8bf55a6 | 1 | public void setCost(double appC)
{if (appC > 0)
{this.cost = appC;}
else
{this.cost = 0;}} |
6dc20a83-efff-4b7e-a25d-bc630c7031dc | 7 | public static void assignTokenAttribute(TextComponent document)
throws ParseException {
String numericRegex = properties.getString("regex.token.numeric");
String wordRegex = properties.getString("regex.token.word");
String punctuationRegex = properties
.getString("regex.token.punctuation");
Pattern nume... |
7d85c470-b02f-4113-bea9-43f8c0ef4a57 | 8 | private boolean addmodules(SortedArrayList<Module> unscheduledModules, Module previouslyScheduled, boolean looping, int count) {
int attemptedModuleCount =count;
Module moduleToSchedule;
if (previouslyScheduled==null && looping==false){
// if null, means successfully scheduled last module.. therefore n... |
5ab1bff4-53ca-48c4-9643-580f60d54982 | 4 | private EndPointAttachementSite endPointAttachementSite( final EndPoint endPoint ){
return new EndPointAttachementSite() {
private Point hit;
private Point getHit(){
if( hit == null ){
hit = Geom.intersection( boundaries, getCenter(), endPoint.getOtherEndPoint().getArrayCenter() );
}
return... |
f34739dd-cf23-4dd5-b2a6-ca8e9b345e83 | 1 | @Override
public int compare(Ban o1, Ban o2) {
int result = o1.getUntil().compareTo(o2.getUntil());
if(!reverse) {
return result;
} else {
return result * -1;
}
} |
ceb08134-0b4a-4a16-8759-ae5bc06299a7 | 7 | private void initCloseCode() throws InvalidFrameException {
code = CloseFrame.NOCODE;
ByteBuffer payload = super.getPayloadData();
payload.mark();
if( payload.remaining() >= 2 ) {
ByteBuffer bb = ByteBuffer.allocate( 4 );
bb.position( 2 );
bb.putShort( payload.getShort() );
bb.position( 0 );
code... |
0468ce9b-8971-40f8-aaaa-4c035d97187a | 5 | private TreeNode<T> getNode(TreeNode<T> subNode, T value){
if(subNode.getValue().equals(value)){
return subNode;
}
if(subNode.getLeftChild()!=null){
TreeNode<T> node = getNode(subNode.getLeftChild(), value);
if(node != null){
return node;
}
}
if(subNode.getRightChild()!=null){
TreeNode<... |
cc295cf2-3d4e-4377-b3de-5fc0730e8dff | 2 | public void addEntry(Card c, String set) {
String key = c.getFileName();
String value = map.get(key);
if(value == null) {
map.put(key, set);
try {
// Append new set to file
FileUtilities.fixDirs(indexFile);
FileWriter pw = new FileWriter(indexFile, true);
pw.write(key + "\t" + set + "\n"... |
60bd7e2a-6844-4237-b375-b0913dae0f15 | 7 | protected void saveTile(){
editor.emptyTile(activeTile); //dumps everything on the tile for replacement
for (TileObjectDisplayData todd : itemData){
activeTile.addItem(todd.getItem());
}
if (characterData != null){
Character c = characterData.getCharacter(activeTile);
if (c instanceof Player){
ed... |
fcd76b81-6aa6-422a-8b16-bf05db686ffa | 7 | public boolean isRouteBetweenNodes(GraphNode node1, GraphNode node2){
if(node1==null || node2 == null){
return false;
}
if(node1==node2){
return true;
}
for(GraphNode node : node1.connectedNodes){
boolean b = isRouteBetweenNodes(node, node2);
... |
bfde05df-8337-4770-887b-13e8d004462e | 0 | public Node(char ch, int freq, Node left, Node right) {
this.ch = ch;
this.freq = freq;
this.left = left;
this.right = right;
} |
a29e5c10-4894-469b-80bc-387634f80e7c | 0 | public void defaut(){
setTailleLigne(4);
setNbCouleurs(6);
setNbCoupMax(10);
propriete.setProperty("couleur", "RVJBOGMPCTPN");
} |
37cc6de5-f948-4eab-9207-f193f9ecc2ef | 5 | public static String formParamDecode(String value) {
int nCount = 0;
for (int i = 0; i < value.length(); i++) {
if (value.charAt(i) == '%') {
i += 2;
}
nCount++;
}
byte[] sb = new byte[nCount];
for (int i = 0, index = 0; i < value.length(); i++) {
if (value.charAt(i) != '%') {
sb[index++... |
0b594cc9-f86f-4eb9-90b6-b90863f75a47 | 5 | public static boolean store(String[] data, String name) {
if (data == null) {
return false;
}
BufferedReader in = null;
PrintWriter printWrite = null;
FileWriter fileWriter = null;
BufferedWriter out = null;
StringReader stringReader = null;
String str;
name = "Data/" + name + ".txt";
try {
... |
7b75f9e5-f76e-4304-a9cc-38451e4d9902 | 0 | public void enterFunction() {
environmentStack.push(new FunctionEnvironmentRecord());
} |
5df54f14-2a4d-49f9-a6a4-36387d9926a4 | 7 | public void paint1(Graphics g) {
g.setFont(new Font("TimesRoman", Font.BOLD, 25));
g.setColor(Color.WHITE);
if (piso != null) {
g.drawImage(fondo1, 0, 0, this);
for (int i = 0; i < tubosA.size(); i++) {
BaseEnemigo actualA = (BaseEnemigo) (tubosA.get(i));... |
5dc98af3-9e07-45ab-a5a6-68cedf05cc54 | 0 | public static void main(String[] args) {
Detergent x = new Detergent();
x.dilute();
x.apply();
x.scrub();
x.foam();
System.out.println(x);
System.out.println("Testing base class:");
Cleanser.main(args);
} |
1197f6cb-f108-499a-b40c-0b7a7c9fb910 | 3 | public static void call(final String mapping, final String data) throws Exception {
// delimited by a comma
// text qualified by double quotes
// ignore first record
final Parser pzparser = DefaultParserFactory.getInstance().newDelimitedParser(new File(mapping), new File(data), ',', '"',... |
8f7c9ff6-40a9-4630-b9dd-963a149d5538 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UsersAndRoles that = (UsersAndRoles) o;
if (roleIdrole != that.roleIdrole) return false;
if (userIduser != that.userIduser) return false;
... |
19a0a80a-6250-4893-a48c-593e461a26c3 | 7 | public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int rounds = 0;
int inter = 0;
int gremio = 0;
int empates = 0;
int todo = 1;
for(int i = 0; ; i++){
if(i % 2 == 0){
if(todo == 1){
i... |
bd29919c-a4a6-479b-aa6c-56c4b4564e7b | 3 | @Override
public Match insert(Match obj) {
PreparedStatement pst = null;
try {
pst = this.connect().prepareStatement("INSERT INTO Matches (equipeA, equipeB,datematch,scoreA,scoreB,id) VALUES (?,?,?,?,?,?);");
pst.setString(1, obj.getEquipeA());... |
435203b2-1f7b-41b8-b6cb-66426420f473 | 2 | @Override
public void init(FilterConfig filterConfig) throws ServletException {
String includeFilterURL = filterConfig.getInitParameter("include");
if (includeFilterURL == null)
return;
includeFilterPattern = createPattern(includeFilterURL, "\\.", "|\\.");
String exclud... |
b0600f69-be37-43d2-9913-80dc9db47de2 | 3 | public void saldiereHandelsware( int auswahl, int menge )
{
switch ( auswahl )
{
case 1: // Korn
this.korn += menge;
break;
case 2: // Mehl
this.mehl += menge;
break;
case 3: // Dünger
this.duenger += menge;
break;
}
} |
1d9532fc-827c-4d9d-86a5-c4733c99f11c | 6 | protected void uninitialize()
{
// Sets the backgrounds invisible and unanimated
if (this.backgrounds != null)
{
for (int i = 0; i < this.backgrounds.size(); i++)
{
Background b = this.backgrounds.get(i);
b.setInvisible();
if (b.getSpriteDrawer() != null)
b.getSpriteDrawer().inactivat... |
ab005fdb-eeb7-4000-b613-9ab0b319684a | 7 | public Possession assignTeamRoles(Possession poss, Play play, Team home, Team away)
{
if (play.GetPlayAction() instanceof JumpBall)
{
JumpBall jBall = (JumpBall)play.GetPlayAction();
Player player = jBall.GetPossessionPlayer();
if (home.HasPlayer(player) && !away.HasPlayer(player))
{
poss.SetTeamRo... |
94cfae25-734b-4ad6-99fe-3b619f853c1f | 1 | protected Class<? extends Annotation> getAnnotationType()
{
return this.annotationType;
} |
4617e8cb-d1d0-48b5-b65e-6ab2c54cd960 | 3 | protected void listen() {
String messageReceived;
while (core.isOn()) {
try {
if ((messageReceived = input.readLine()) != null)//reads message
System.out.println(messageReceived);
core.recibirSocket(messageReceiv... |
9cda442d-9920-4131-9125-260677a98c89 | 2 | public final void modifyFatigue(int toMod)
{
fatigue+=toMod;
if(fatigue > 100)
{
fatigue = 100; //sleep forever (bad)
}
else if(fatigue < 0)
{
fatigue = 0; //actually good for once
}
} |
5e52521a-3e90-4f6f-9be6-63bc2cc08d12 | 9 | @Override
public void writePortable(PortableWriter writer) throws IOException {
if(dateProperty != null) {
writer.writeLong("dateProperty", dateProperty.getTime());
}
if(intProperty != null) {
writer.writeInt("intProperty", intProperty);
}
if(longPrope... |
e50f4af7-818c-4205-aca7-4ac1191f185d | 5 | @Override
public Object getValueAt(int rowIndex, int colIndex) {
Object result;
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy");
Car car = getRow(rowIndex);
switch (colIndex) {
case 0:
result = car.getProducer();
break;
case 1:
result = car.getModification();
... |
ae43544c-3856-4918-a3d2-b123dbac08f3 | 2 | public void cleanOldSweeps() {
conn.prepare("set search_path=esri,public");
PreparedStatement stmt = conn.getPreparedStatement();
try {
stmt.execute();
stmt.close();
} catch (SQLException e) {
e.printStackTrace();
}
/*conn.prepare("select "+SCHEMA+".clean_sweeps()");
stmt = conn.getPreparedSta... |
822328b3-7d48-448e-8b7c-0668c43feade | 5 | private String renameTeevra(char ch) {
switch(ch) {
case 'M':
return String.valueOf(ch) + "Teevr";
case 'r':case 'g':case 'd':case 'n':
return String.valueOf(ch) + "Komal";
default:
return String.valueOf(ch);
}
} |
040bcc86-c95c-4266-a160-4d0f4567554b | 9 | public void execute(Object parent)
{
mxGraphHierarchyModel model = layout.getModel();
currentXDelta = 0.0;
initialCoords(layout.getGraph(), model);
if (fineTuning)
{
minNode(model);
}
double bestXDelta = 100000000.0;
if (fineTuning)
{
for (int i = 0; i < maxIterations; i++)
{
// Medi... |
fbfc86ed-f0c8-48f7-90aa-9828ef5445d0 | 7 | private void updateStacks()
{
Object[][] state = Simulator.getField().getFieldArray();
int countRabbit = 0;
int countFox = 0;
int countHunter = 0;
int countGrass = 0;
int countKorenwolf = 0;
// Count all field participants
for(int i = ... |
3a07d7c2-4c6f-4fda-902c-4cc73a6441e6 | 4 | protected void refresh() {
Logger.getLogger(PreviewComponent.class.getName()).entering(PreviewComponent.class.getName(), "refresh");
int width = getParent().getWidth();
int height = getParent().getHeight() - statusToolBarHeigh;
int maxWidth = (width / 5) + (width / 2);
if (previ... |
c6a96a3d-15a5-4ef7-ad5e-be92529c5467 | 3 | private ArrayList<ArrayList<Integer>> getPins() throws JSONException {
JSONObject result = Utils.getJSON("items/getPinData/");
/*
* {"items":[...], "pins":[
* {"id":"11446","character_id":"163988","typ":"1"
* ,"stufe":"1","created":""},
* {"id":"11452","character_id":"163988","typ"
* :"2","stufe":"1"... |
1b7806bc-085f-4ed4-8dbd-582bc7869e77 | 8 | public void addEdge(int v, int w) throws InvalidEdgeException,
SelfLoopExistsException, ParallelEdgeExistsException
{
// check for invalid edge
if (v < 0 || v >= V || w < 0 || w >= V)
throw new InvalidEdgeException("Invalid edge : " + v + "-" + w);
if (v == w)
throw new SelfLoopExistsException("Self lo... |
de148185-eabe-42e2-b030-d8b04bf9d36c | 4 | public void startSBRefresh() {
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
@Override
public void run() {
if(!isGameRunning())
setScoreboard();
else {
if(!isGameFinished) {
seconds++;
if(seconds == 60) {
seconds = 0;
minutes++;
}
... |
b8a6ca97-3203-492c-adff-fa0dfa655c50 | 3 | @Override
public boolean remove(Object item) {
// TODO Auto-generated method stub
int position;
if (item == null)
throw new IllegalArgumentException();
if(!contains(item))
return false;
else{
position=findIndex(item);
if(position==items.length-1){
items[position]=putDefault(position);
}... |
eea67ada-25cb-445a-9d22-5f601222c810 | 3 | @Override
public Class getColumnClass(int columnIndex) {
if (columnIndex == 0) {
return Movie.class;
} else if (columnIndex == 1) {
return Integer.class;
} else if (columnIndex == 3) {
return Double.class;
}
return String.class;
} |
d56f532a-8438-46e5-b9d7-51ab8ecd9f29 | 7 | public void buildClassifier(Instances data) throws Exception {
m_saveMemory = false;
if (data.classAttribute().isNumeric()) {
throw new Exception("Can only handle nominal class!");
}
if (m_backwardWithDelete == null) {
setUpSearch();
m_search = m_backwardWithDelete;
}
/* ... |
d8b1d180-af3e-41ac-a818-90f2a33669b4 | 7 | public Modifier toModifier()
{
ArrayList<Assignment> realAssignments = new ArrayList<Assignment>();
for (ParseAssignment pa : assignments)
{
realAssignments.add(pa.toAssignment());
}
if (type.equals("Perlin"))
return new PerlinModifier(identifier,realAssignments);
if (type.equals("WeightedPerlin"))
... |
108fa921-8b32-4dc2-9bbf-6fdadf61b77f | 5 | public int lastIndexOf(Object ob){
if(ob == null){
for(int i = size - 1; i >= 0; i--)
if(elements[i] == null)
return i;
}
else{
for(int i = size - 1; i >= 0; i--){
if(ob.equals(elements[i]))
return i;
}
}
return -1;
} |
25e8dac1-1541-4676-bbca-05cab35a89fd | 1 | private boolean jj_2_26(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_26(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(25, xla); }
} |
9dfb2e13-d8de-4666-9474-a7a9700a717f | 5 | public void update(){
checkTileMapCollision();
animation.update();
if(currentAction == CHARGING){
long elapsed = (System.nanoTime() - spitTime) / 1000000;
if(elapsed > 5000){
currentAction = SPITTING;
}
}
if(currentAction == SPITTING){
Spit sc = new Spit("/Sprites/Enemies/SpitterBall.... |
330c0d2c-2002-4f68-8631-cc4b287186ee | 0 | public TestUnit(String id, int spawnX, int spawnY){
super(id, spawnX, spawnY);
sprite = Sprite.void_;
//setDestination(64, 64);
} |
fb95c8d2-5b8e-4021-bb4f-a7f818284f70 | 7 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
repairDown-=adjustedLevel;
if((repairDown<=0)&&(affected instanceof Item))
{
repairDown=REPAIR_MAX;
final Item I=(Item)affected;
if((I.subjectToWearAndTear())&&(I.usesRemaining()<100))
{
... |
2e3a3421-531f-45eb-b6e7-174baea8c1b4 | 9 | public void fillFeatureVectors(DependencyInstance instance,
FeatureVector[][][] fvs,
double[][][] probs,
FeatureVector[][][] fvs_trips,
double[][][] probs_trips,
FeatureVector[][][] fvs_sibs,
double[][][] probs_sibs,
FeatureVector[][][][] nt_fvs,
double[][][][] nt... |
5fc72a66-298c-45cc-89a2-be09d9b2ebf7 | 2 | public int maxProfit(int[] prices) { // only get profit >= 0
int maxp = 0;
int diff = 0;
for (int i = prices.length - 2; i >= 0; i--) {
if (diff >= 0)// accumulate if positive
diff += prices[i + 1] - prices[i];
else
// diff is no more +=, which means it discarded the negative one
diff = Math.max... |
9597ce09-a295-4619-8b6f-557483cfccf9 | 7 | public final MapleStatEffect getAttackEffect(final MapleCharacter chr, int skillLevel, final ISkill skill_) {
if (Skills.isMulungSkill(skill)) {
skillLevel = 1;
} else if (skillLevel == 0) {
return null;
}
if (Skills.isLinkedAranSkill(skill)) {
final ISkill skillLink = SkillFactory.getSkill(skill);
... |
8e102159-7a19-460d-9230-4ba8cd6d8fba | 0 | private static Venue createOneFromResultSet(ResultSet result) throws SQLException {
Venue rtn = new Venue();
rtn.id = result.getLong("id");
rtn.name = result.getString("name");
rtn.capacity = result.getInt("capacity");
rtn.findArray("aWaitingId", rtn.aWaitingId);
return rtn;
} |
7a13a6b3-ccfb-4aab-a271-ece4f502522c | 0 | public static Circle getNewRandomCircle(){
Random rand = new Random();
int radius = rand.nextInt(MAX_CIRCLE_RADIUS) + MIN_CIRCLE_RADIUS;
int x = rand.nextInt(PANEL_WIDTH-(2*radius))+radius;
int y = rand.nextInt(PANEL_HEIGHT-(2*radius))+radius;
Circle c = new Circle(x, y, radius);
return c;
} |
837af05d-05b4-46a1-9e13-3aae75005976 | 1 | public static CharacterFactory create(){
if(characterFactory == null)
characterFactory = new CharacterFactory();
return characterFactory;
} |
b031334e-a88a-4927-880e-87f46c729008 | 5 | @Override
public V put(K key, V value) {
V oldValue = null;
MapEntry<K, V> pair = new MapEntry<K, V>(key, value);
int index = Math.abs(key.hashCode()) % SIZE;
if(buckets[index] == null) {
buckets[index] = new LinkedList<MapEntry<K, V>>();
LinkedList<MapEntry<K... |
402e15f0-ee96-4d6b-a1fc-4e6210164a51 | 7 | public List<ThreatClass> getSelectedThreats() {
List<ThreatClass> selectedThreats = new ArrayList<ThreatClass>();
if (!treeThreats.isSelectionEmpty())
for (TreePath treePath : treeThreats.getSelectionPaths()) {
TreeNodeThreat treeNodeThreat = (TreeNodeThreat)
treePath.getLastPathComponent();
Object... |
0807b7b3-a66f-4523-8adf-cca161e30f7a | 0 | public void windowIconified(WindowEvent e) {
isIdle=true;
} |
a02ab2ec-7019-4b1b-850f-d3ef5a132184 | 9 | @Override
public void delProperRoom(Room R)
{
if(R==null)
return;
if(R instanceof GridLocale)
((GridLocale)R).clearGrid(null);
synchronized(properRooms)
{
if(R.roomID().length()==0)
{
if((R.getGridParent()!=null)&&(R.getGridParent().roomID().length()>0))
{
final String id=R.getGridPar... |
81472919-e5a8-4d3b-b40c-4d081ff7d3e2 | 5 | public Board recursiveMoveStarter(boolean recurse) {
int recursiveDepth = 4;
if (!recurse) {
Evaluator ev = new Evaluator(b, color);
HashMap<Integer, Move> meMoves = ev.evaluateAllMoves();
int bestMoveSoFar = 0;
Move highValueMove = bestMoveFinder.defendMyKing(color);
for (Entry<Integer, Move> e : me... |
7a80c81d-8e6f-4889-a842-5392f5cce94b | 0 | @Override
public boolean isWebDriverType(String type)
{
return StringUtils.equalsIgnoreCase("firefox", type);
} |
a6b43c72-a6d0-4314-952d-ee54c2d83cfd | 8 | public static void main(String[] args) {
MyCallable_ForFutureTask callable1 = new MyCallable_ForFutureTask(1000);
MyCallable_ForFutureTask callable2 = new MyCallable_ForFutureTask(2000);
FutureTask<String> futureTask1 = new FutureTask<String>(callable1);
FutureTask<String> futureTask2 =... |
8bd1702a-f6ee-4d47-b5da-9a581057db29 | 7 | public void prepareForFilling (RNG rng)
{
for (Enumeration<String> e = modifiers.keys(); e.hasMoreElements();)
{
Modifier mod = modifiers.get(e.nextElement());
switch(mod.getType())
{
case PERLIN:
((PerlinModifier) mod).setRNG(rng, maxScale);
mod.setLocation(minX, minY, minZ, maxX, maxY, maxZ);... |
bd653180-e862-467d-a90e-50a607e2d765 | 4 | @Override
public void update(long deltaMs) {
getInput();
camera.update(deltaMs);
scene.update(deltaMs);
// clear screen
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
// set the viewing location, inverted so stuff is drawn correctly in the opposite directi... |
923d2710-b2bc-40ec-8eab-a009829fcbec | 9 | public boolean hasPrivateDeviceIDType() {
switch (getDeviceIDType()) {
case 0:
case 40:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
return true;
}
return false;
} |
9e15db77-d93b-44ae-a6b0-954128fbcfc4 | 3 | public void setAttribute(String name, Object value) {
if (logConstructor != null) {
logDiagnostic("setAttribute: call too late; configuration already performed.");
}
if (value == null) {
attributes.remove(name);
} else {
attributes.put(name, value);
... |
f414d426-c5fa-4737-894b-e6ccd442226e | 3 | public void searchPaciente() {
facesContext = FacesContext.getCurrentInstance();
List<Cliente> listCliente;
try {
listCliente = genericDAO.searchObject(Cliente.class,"cliente",
null, null,
new String[]{"cli_CNS"},
new Object[]{cliente.getCli_CNS()});
if... |
37841f43-8f88-45e8-9d9e-da10e423a9ca | 2 | protected HttpClient createHttpClient() {
DefaultHttpClient client = new DefaultHttpClient();
client.getParams().setParameter(AllClientPNames.USER_AGENT,
"alliancetechrest-java library");
if (UtilityMethods.isValidString(getUsername())
&& UtilityMethods.isValidStr... |
8b0eccf6-897a-4538-bb35-938f6914be6b | 1 | public Entity(EntityManager entityManager, UUID id, IComponent... components) {
this.entityManager = entityManager;
this.id = id;
// Add all of the components without causing a refresh of the entity
// manager (which causes system list refreshes)
for (IComponent component : components) {
addComponentNoRef... |
3fb7c01e-0c62-4bb2-a8a6-20dd62e4b1b4 | 1 | public List findByExample(Member instance) {
log.debug("finding Member instance by example");
try {
List results = getSession().createCriteria(
"com.oj.hibernate.daoNdo.Member").add(Example.create(instance))
.list();
log.debug("find by example successful, result size: "
+ results.size());
re... |
72cfcd62-9bf1-4538-9741-998cc93437bd | 6 | public void savePreferences() {
String empty = "";
if(emptyString.equals(lambda)) empty = lambdaText;
else if(emptyString.equals(epsilon)) empty = epsilonText;
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
DocumentBuilder builder;
try {
File file = new File(pathToFile);
... |
65875f19-7bef-4e9f-95b4-d6582b0a8adc | 9 | public ArrayList<String> getSlowaKluczowe() {
int slkl = -1;
int op = -1;
String [] slowaKluczowe = null;
ArrayList<String> slKluczowe = new ArrayList<String>();
String slowa = "";
String replaced = "";
String trimmed = "";
String slowaKlucz = "(?i)(?s)S.owa kluczowe:|S.owa kluczowe|SŁOWA KLUCZE:";
... |
8d8cfbcf-3e8e-4499-b994-653a313f2a57 | 1 | public void visitJumpInsn(final int opcode, final Label label) {
buf.setLength(0);
buf.append(tab2).append(OPCODES[opcode]).append(' ');
appendLabel(label);
buf.append('\n');
text.add(buf.toString());
if (mv != null) {
mv.visitJumpInsn(opcode, label);
}
} |
fa8a1bb5-f423-48b0-8177-cad2cf1c74e0 | 6 | @Override
protected StatsCollector compute() {
StatsCollector collector = new StatsCollector(min, max, numBuckets);
int children = (numChunks < 0) ? calcNumChunks(numIterations) : numChunks;
if (numIterations <= minChunkSize || children == 1) {
for (int i = 0; i < numIterations; i++) {
collector.addObs(Ne... |
437c511b-08db-44e0-a081-f5a5c5370833 | 2 | public void paataJono() throws IllegalStateException {
if (seuraavaArvollinen == null) {
throw new IllegalStateException();
}
if (this.eiSisallaLaskutoimituksia()) {
return;
}
viimeinen.setTakajasen(seuraavaArvollinen);
seuraavaAr... |
7d3ea22c-7ce2-43f5-bf6b-4f392629e0b5 | 4 | public void save(String filename) {
File file = new File(filename);
String suffix = filename.substring(filename.lastIndexOf('.') + 1);
// png files
if (suffix.toLowerCase().equals("png")) {
try { ImageIO.write(offscreenImage, suffix, file); }
catch (IOException e... |
4677f794-80c4-433a-a025-47672b5a0e2f | 2 | @SuppressWarnings("unchecked")
ArrayList new60() /* reduce ANonTerminal$Formalrest */
{
@SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
@SuppressWarnings("unused") ArrayList nodeArrayList2 = pop();
@SuppressWarnings("unused") ArrayList nodeArrayList1 = pop();
L... |
f49340d2-9960-4a9d-b212-43cc607ccc32 | 7 | private void drawHealthBar(Graphics2D g2d) {
int health = sc.getHealth();
g2d.setColor(Color.white);
g2d.fillRoundRect(19, 19, 102, 12, 2, 2);
if(health == 10)
g2d.setColor(new Color(0,255,0));
else if(health >= 7)
g2d.setColor(new Color(255,255,0));
else if(health >= 4)
g2d.setColor(new Color(0... |
459f76fd-f15f-448e-9138-dc4a8be90dff | 1 | @SuppressWarnings("unchecked")
public E next() {
checkForComodification();
int i = cursor;
if (i >= size()) {
throw new NoSuchElementException();
}
cursor = i + 1;
return (E) get(lastRet = i);
} |
a8412292-96f0-4bea-95e6-e2dc1f61f818 | 9 | public static void main(String[] args) {
int n=Integer.parseInt(JOptionPane.showInputDialog("Ingrese el rango del vector"));
int[] arreglo=new int[n];
int c=0;
for (int i = 0; i < arreglo.length; i++) {
int numero=Integer.parseInt(JOptionPane.showInputDialog("I... |
69429b18-d8e2-49ec-8b31-447618d7faf3 | 1 | public static void main(String[] args) throws IOException {
StaticDynamicUncertaintyULHSolver solverWithoutADI = new StaticDynamicUncertaintyULHSolver();
StaticDynamicUncertaintyWithADIULHSolver solverWithADI = new StaticDynamicUncertaintyWithADIULHSolver();
ConstantNormalDistributedProblemGenerator problemGenera... |
8fcbf46f-807f-4cf1-aaa6-d003db671696 | 8 | public static void move(int to, Room curRoom)
{
if(to==0)
{
Room[] nRoom = curRoom.getConnects();
System.out.println("You went North");
try //checks if a room to the north exists. If not..
{
nRoom[0].equals(null);
}catch(NullPointerException npe)
{ ///... It'll make a new room for you and... |
cad41564-fcc9-43d3-a9e1-4c8a04da638d | 6 | public void loadTerrain(String file)
{
int r, g, b;
int width, height;
Scanner sc;
try {
sc = new Scanner(new File(file));
sc.nextLine();
sc.nextLine();
width = sc.nextInt();
height = sc.nextInt();
sc.nextInt();
tmap = new Terrain[height][];
for (int i=0; i<height; ++i) {
tmap[i]... |
60ecceff-dad3-40f1-a23a-65a340b7fdfb | 1 | private void sleep() {
try {
Thread.sleep(msSpeed);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}
} |
0806aa06-c506-4715-a24c-5262b6b152d5 | 2 | private void calcularPrecioTotal() {
//Si no tiene cantidad o no tiene precio @return null, si no, calcula el precio total
precioTotal = cantidad == null || precioUnitario == null ? null : ((Long) (cantidad * precioUnitario.longValue())).doubleValue();
} |
2e055bfc-81ab-4572-8073-10a1c5168a25 | 5 | private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed
String text = txtBuscar.getText().toString();
UsuariosCRUD udao = new UsuariosCRUD(MyConnection.getConnection());
ArrayList<Usuarios> listado = new ArrayList<>();
Usuarios u... |
88eca791-715a-4d71-8af7-eec1f84d1f7d | 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 FirstcupUser)) {
return false;
}
FirstcupUser other = (FirstcupUser) object;
if ((this.fid == null && other.fid != null)
|| (this.fid != null &&... |
43cc50f8-4540-42f7-81ef-ddace37e7c42 | 2 | public static void quitToMenu() {
try {
renderer.shutdown();
game.setGameState(GameThread.STATE_STOPPED);
game.join();
if (networkConnection != null) {
networkConnection.close();
networkConnection.join();
}
} cat... |
8ae04b45-0f21-4954-83ff-78b8b7dc19db | 9 | public void readMatrix(String filepath) throws IOException {
/*
* Read matrix from file
*/
BufferedReader in = new BufferedReader(new FileReader(filepath));
try{
String lineString;
String[] valueStrings;
int x = 0;
while((lineString = in.readLine()) != null )
{
valueStrings = li... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.