method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
3181a56d-38e5-4fef-bfe6-e5635d950e2f | 6 | private double surfaceChargeDensity1(double psi){
double surCharDen = 0.0D; // temporary values of surface charge density
// bisection method
double sigmaLow = 0.0D;
double sFuncLow = this.sigmaFunction0(sigmaLow, psi);
double sigmaHigh = 0.0D;
for(int i=0; i<this.num... |
337e67ac-e917-45b0-80a3-98350b26c47f | 5 | public static GenLayerRiverMix traditionalExpansion(long par0, GenLayer genlayer3, ClimateControlSettings settings)
{
BiomeRandomizer.instance.set(settings.biomeIncidences);
boolean flag = false;
byte b0 = 4;
if (settings.biomeSize.value() != null);
{
b0 = (byte)s... |
c9a32743-3b40-4559-bf39-8af3a4ff9555 | 0 | public void setDateOfJoining(Date dateOfJoining) {
this.dateOfJoining = dateOfJoining;
} |
3fb9a6b1-a94c-4558-94be-5a2d3d39b34f | 4 | public static boolean interactChild(WidgetChild wc, String... actions) {
return wc != null
&& wc.visible()
&& (wc.getBoundingRectangle().contains(Mouse.getLocation()) && selectMenu(actions) ? true
: interact(wc, actions));
} |
1969652f-1a1e-433f-8f08-1dbd2e1f4d43 | 2 | public void play(int x, int y, int xp, int yp) {
permut(x, y, xp, yp);
detectLinesAndCols();
if (matrixb[x][y] || matrixb[xp][yp])
prepar();
else
permut(x, y, xp, yp);
} |
31fdf954-dbc0-4a90-815d-40e91b906360 | 9 | private static int calcIndex(ArrayList<PokerCard> cards)
{
int i, s;
long o;
long v = 0;
for (i = 0 ; i < 5; i++)
{
o = 0;
int cardValue = cards.get(i).getCardValue();
o = (long)Math.pow(2, cardValue *4);
v += o * (( v / o & 15 ) +1);
}
PokerCard firstCard = cards.get(0);
Poker... |
1b5c3241-90b5-4ba8-99ea-ac3ed7098ea8 | 0 | @Override
public void destroy() {
node = null;
oldValue = null;
newValue = null;
} |
965a889f-4afe-4b94-8640-c552e86bf252 | 7 | private static boolean isValidAdditionalInputCommand(String input)
{
//grab the command
char option = input.charAt(0);
if(input.length() > 1)
{
//all add'l command require whitespace after initial char
if(!Character.isWhitespace(input.charAt(1)))
... |
a56caeaf-cf68-451c-8988-331042df158e | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Responsavel other = (Responsavel) obj;
if (!Objects.equals(this.idResponsavel, other.idResponsavel)) {
... |
b60b9aab-d035-4ccb-8265-4facde7b5a54 | 2 | private Class getExpectedType(Field field, Method writeMethod) {
if (field != null) {
return field.getType();
} else if (writeMethod != null) {
return writeMethod.getReturnType();
} else {
return null;
}
} |
9a54d2d2-465c-48b6-acaf-77640003abbf | 7 | @RequestMapping( ApplicationConstants.JOIN_CHAT)
public Object joinChatRoom(@RequestParam("chatRoomId") String chatRoomId,
@RequestParam("userId") String userId) {
UserChatRoom chatRoom=new UserChatRoom();
Map<Object,String> errorMap=new HashMap<Object, String>();
System.out.println("nam... |
3d818dde-637c-4674-abeb-d31abb3a7e5d | 3 | public WordData remove(){
WordData returnWord = new WordData("" , 0 , "" );
lock.lock();
try{
//Buffer is empty, wait for item to remove
while(count == 0){
full.await();
}
//Remove WordData
returnWord = buffer[removePointer];
buffer[removePointer] = null;
removePointer++;
//Custom... |
0a49c49d-343c-4608-a6af-3257f8845a22 | 1 | private void chargerListeVisiteur() throws DaoException {
List<Visiteur> desVisiteurs = daoVisiteur.getAll();
getVue().getModeleJComboBoxVisiteur().removeAllElements();
for (Visiteur unVisiteur : desVisiteurs) {
getVue().getModeleJComboBoxVisiteur().addElement(unVisiteur);
}
... |
96fcfc5e-67ca-4402-87d2-c978307673d7 | 5 | public ConstructDocument(String filename)
throws FileNotFoundException
{
if(filename == null) {
throw new IllegalArgumentException("filename cannot be null");
}
mConstructEditorStore = new ConstructEditorStore();
// Ensure we can access & read the file
File file = new File(filename);
if(!file.e... |
fa6130d8-22fd-4751-b94c-89de277e88ce | 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... |
7fb7c955-2bab-4572-9926-7e850045a980 | 9 | @Override
public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand();
switch (command) {
case "deal":
if (!playerPurse.betAcceptable()) {
ui.gameOver("Choose smaller bet!");
return;
}
... |
5db916a4-f177-4f83-adb7-5fbddd32491c | 1 | public static byte[] permutFunc(byte[] input, int[] table) {
int nrBytes = (table.length - 1) / 8 + 1;
byte[] out = new byte[nrBytes];
for (int i = 0; i < table.length; i++) {
int val = getBitInt(input, table[i] - 1);
setBit(out, i, val);
}
return out;
... |
46bc34a4-0158-4019-a27e-e9a448c4a516 | 0 | public Worker(Process process) {
this.process = process;
} |
a85d4ebe-c9e0-4b37-b1f1-343ac7fcf228 | 4 | public void loadResources(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();
for (int i=0; i<height; ++i) {
for (int j=0; j<width; ++j) {
r =... |
3681402d-68bf-4005-ba26-df5dbd4a6f47 | 5 | private static String encode64(byte[] Input) {
int iLen = Input.length;
int oDataLen = (iLen * 4 + 2) / 3; // output length without padding
int oLen = ((iLen + 2) / 3) * 4; // output length including
// padding
char[] out = new char[oLen];
int ip = 0;
int op = 0;
while (ip < iLen) {
int i0 = Input[i... |
3c3451f4-f1bc-45d7-a9e3-8f8ddc6fb137 | 0 | public void actionPerformed(ActionEvent event) {
/* Formerly the help page was shown, but for now, we just refer
* one to the tutorial.
*/
//displayHelp(NewAction.class);
//Temporary command
JOptionPane.showMessageDialog(null, "For help, feel free to access the JFLAP tutorial at\n" +
" ... |
e51ea456-2207-43c1-85cc-4bfe98644c17 | 9 | public boolean growCactus(Player player, String[] args, int radius) {
Block playerCenter = player.getLocation().getBlock(); // Get Centrepoint (Player)
int cactus = 0;
for (int x = -radius; x < radius; x++) {
for (int y = -radius; y < radius; y++) {
for (int z = -radius; z < radius; z... |
251edfe1-56c2-48e3-ab44-212197501f0d | 3 | public int getMapCount(int arg0, int arg1, int arg2) {
int id = (arg2 << 8) + arg1;
for (int i = 0; i < mapIndices1.length; i++) {
if (mapIndices1[i] == id) {
if (arg0 == 0) {
return mapIndices2[i];
} else {
return mapIn... |
208b3e2d-a5a3-4aef-851c-97c98c0227bc | 6 | @Override
public IPeriod intersectionWith(IPeriod period) {
Period newPeriod = null;
if (bt.compareTo(period.getBeginTime()) == -1) {
if (et.compareTo(period.getBeginTime()) == 1) {
if (et.compareTo(period.getEndTime()) == 1) {
newPeriod = new Period(... |
b872b0e5-65dd-4548-b251-00af4e3570be | 9 | protected static boolean tryImportantActions(Unit unit) {
// Try to load infantry inside bunkers if possible.
if (BunkerManager.tryLoadingIntoBunkersIfPossible(unit)) {
unit.setAiOrder("Into bunker");
return true;
}
// If enemy has got very close near to us, move away
if (RunManager.runFromCloseOppone... |
2b77d15a-40d3-4d60-b385-991780b306b5 | 3 | public static void setDistanceToTip(JadeTree tree) {
for (TreeNode node : tree.externalNodes()) {
double h = 0.0;
((JadeNode)node).setDistanceToTip(h);
while (node != null) {
h += node.getBL();
if (((JadeNode)node).getDistanceToTip() < h) {
((JadeNode)node).setDistanceToTip(h);
}
node = ... |
3fa3a6fa-7689-46c4-ae0d-c37addf8a1e8 | 9 | public void placeCritter(String critterFile, int col, int row) {
assert thisWorld != null;
if (getSpace() == 0) {
P.rint("!!No more space left to place Critters (Creator)");
return;
}
if(col > thisWorld.MAX_COLUMN || row > thisWorld.MAX_ROW ||
col < 0 || row < 0) {
P.rint("!!The given coordinates a... |
cda5cb9f-fc6b-4106-ac84-dd76deeb8586 | 3 | public OptimusInterator(OptimusData data, OptimusShape start,
OptimusShape off) {
this.data = data;
this.rstart = start;
this.roff = off;
jump = new int[this.rstart.getShape().length];
int[] fsize = this.data.getOff().getShape();
jump[0] = fsize[0];
for (int i = 1; i < jump.length; i++) {
jump[i] ... |
450ae8c3-e9b3-4d8c-af44-d7ef6523a115 | 5 | public static void main(String[] args) throws Exception {
URL url = Test.class.getClassLoader().getResource("a.txt");
System.out.println(url.getPath());
System.out.println(url.getFile());
System.out.println("===========");
BufferedReader br = new BufferedReader(new FileReader(System.getProperty("user.dir") + ... |
05c79767-b4e3-4922-8be7-ed803a26f422 | 8 | public void run()
{
requestScreenParam();
while(true)
{
try
{
int command = is.read();
switch(command)
{
case RoboProtocol.SCREEN_ADJUSTMENT_END: screenAdjustmentEnd(true); break;
case RoboProtocol.SCREEN_RESPONSE_PART: screenAdjustmentEnd(false); break;
... |
caf7bf88-7f0f-42f4-81d3-7a3c869169c3 | 8 | public double funct(int n, double x[]){
double lh = 0.0;
for(int i=1 ; i<x.length; i++){
if(x[i] <= 0|| x[i] > PMAX)
return LARGE;
}
try{
BigDecimal bd1 = new BigDecimal(x[1]);
bd1 = bd1.setScale(decimalPlace,BigDecimal.ROUND_HALF_UP);
x[1] = bd1.doubleValue();
}catch(java.lang.NumberFormatExc... |
a9f1250c-e5e8-4534-b428-d517a9cb4cd6 | 9 | public void firstPass() {
Iterator i = opcodes.iterator();
opCode oc;
boolean vary = false;
//Iterate through the op ArrayList
while(i.hasNext()){
oc = (opCode)i.next();
if(oc instanceof opFrames)
numFrames = ((opFrames)oc).getNum();
else if(oc instanceof opBasename)
baseName = ((opBasena... |
33356cd3-c7a3-4478-8f6d-6e632f0a1052 | 3 | public static <T> String createJSON(T values) {
final OutputStream out = new ByteArrayOutputStream();
final ObjectMapper mapper = new ObjectMapper();
String output = "";
try {
mapper.writeValue(out, values);
final byte[] data = ((ByteArrayOutputStream) out).toByteArray();
output = new String(data);
... |
3dd5842e-3a1f-4864-b129-08c832ddf685 | 3 | public void exit() {
Logger.getLogger(MainInterface.class.getName()).entering(MainInterface.class.getName(), "exit");
this.setVisible(false);
if (readInterface != null) {
readInterface.exit();
}
savePreferences();
this.dispose();
profiles.saveProfilesPropertie... |
acd8617c-2177-431a-8594-10f08b328d68 | 6 | @Override
public void a(PacketDataSerializer packetDataSerializer) throws IOException {
action = Action.values()[packetDataSerializer.a()];
if(action.ordinal() == Action.SET_SIZE.ordinal())
{
newRadius = packetDataSerializer.readDouble();
}
if(action.ordinal() == ... |
7913f340-1f2f-4ddb-a0ca-5d292d8ba179 | 6 | public void sort() {
// insertion sort routine
if (head == null) {
return;
}
Node<T> i = head;
while (i.next != null) {
// list[0..i] is sorted - loop invariant
Node<T> j = i.next;
Node<T> p = head;
boolean jInserted =... |
ed05ac49-a4e0-4033-ae3a-1b8260d7cac3 | 7 | @SuppressWarnings("unchecked")
// We can safely ignore the warnings because it's being checked
public void loadAllClasses() {
new Thread(new Runnable() {
@Override
public void run() {
// Create a File object on the root of the directory containing
// the
// class file
SorterLoader.this.classe... |
b764785a-59ed-46cc-a147-79f3d0c47b12 | 5 | @Override
public void close()
{
externsheet = null;
if( ptga != null )
{
if( ptga instanceof PtgRef )
{
ptga.close();
}
else
{
ptga.close();
}
ptga = null;
}
if( expression != null )
{
while( !expression.isEmpty() )
{
GenericPtg p = (GenericPtg) expression.pop();
... |
54d935e0-393c-450e-8a5a-99576219667a | 8 | protected void calcMap()
{
int pointAmt=20;
for (int x=0;x<Square.xAmt();++x)
{
for (int y=0;y<Square.yAmt();++y)
{
map[x][y].paths=0;
}
}
for (int n=0;n<pointAmt;n++)
{
// System.out.println("Calcing poin... |
88e0c748-d0d4-433a-a490-fa645bddc1bb | 0 | public String getNewTranslation(){
return newTranslation.getText();
} |
f4cb78fc-2158-46c9-b32d-1485b6a02aa8 | 4 | public void setDatosTabla(producto p){
this.nombre.setText(p.getNombre());
this.precio.setText(p.getPrec().getValor()+"");
int numm = p.getNumRef();
this.numRef.setText(numm+"");
this.descripcion.setText(p.getDescripcion());
ControladorProductoyEspecific... |
916a6c0b-22c4-4c45-b8a2-3c5a97d31a0f | 7 | @Override
public void redo() throws CannotRedoException {
super.redo();
if (selectedManipulable instanceof Part) {
Shape shape = selectedManipulable.getShape();
if (shape instanceof TransformableShape) {
TransformableShape s = (TransformableShape) shape;
switch (scaleDirection) {
case 0:
s.s... |
cbf87841-5adf-4b22-926b-b598947768f1 | 8 | public static int countSplitInversionsAndMerge(int start, int end, int leftStart, int leftEnd, int rightStart, int rightEnd) {
int subArray1[] = new int[leftEnd - leftStart + 1];
int subArray2[] = new int[rightEnd - rightStart + 1];
int count = 0;
for (int i = leftStart; i <= leftEnd; i++) {
subArray1[cou... |
63269db8-5ae1-4ed2-9854-c2c30ef597ec | 4 | public void darkbow()
{
if(IsAttackingNPC && playerEquipment[playerWeapon] == 15156)
{
setAnimation(426);
actionTimer = 4;
SpecDamgNPC(45);
DDS2Damg = true;
DDStimer = 1;
resetAnimation();
teleportToX = absX;
teleportToY = absY;
... |
a3ecfec5-766a-4aa8-a61f-e99fccfbab5a | 6 | public static final String getASCIIHexStr(byte[] bs, int index, int len) {
StringBuffer ascii = new StringBuffer();
if ((bs == null) || (index > bs.length) || (index < 0) || (len <= 0) || (index + len > bs.length)) {
return ascii.toString();
}
for (int i = 0; i < len; i++) {
ascii.append((char) Integer.pa... |
51cb8421-bcad-476c-8612-51eaa79a9f87 | 7 | private void buildEuropeanNationTypeDetail(EuropeanNationType nationType, JPanel panel) {
Font boldFont = ResourceManager.getFont("SimpleFont", Font.BOLD, 16f);
Set<Ability> abilities = nationType.getAbilities();
Set<Modifier> modifiers = nationType.getModifiers();
panel.setLayout(new... |
0e32bfba-3e2d-41a2-8689-9f845bfca1cc | 8 | private static void diffImages(BufferedImage goodImage, PixImage studentPixImage) {
BufferedImage studentImage = ImageUtils.pixImage2buffer(studentPixImage);
int diffCount = 0;
System.out.println("The difference is:");
if (studentImage.getWidth() != goodImage.getWidth()) {
System.out.println("The ... |
de0120b3-c748-4c35-9445-0b03216239e3 | 0 | public void setGameGUI()
{
} |
3568fa52-88ea-41fd-a6ee-4b33403b66a8 | 8 | public void actionPerformed(ActionEvent arg0)
{
String command = arg0.getActionCommand();
if (command.compareToIgnoreCase("Begin") == 0)
{
// disable the begin button and the configPanel (freeze the config)
controlPanel.begin.setEnabled(false);
configPanel.setEnabled(false);
fast = false;
// T... |
6fa0c14d-a000-47fe-9801-ae3a4ae0430c | 1 | public double getComplexity() {
if (code == null)
return 0.0;
else
return code.getInstructions().size();
} |
d831ef8d-126d-406c-a02d-6b2a1fd6076b | 1 | @Override
public void handleSpellingError(String word, UiGlyph[] glyphs) {
for (UiGlyph uiGlyph : glyphs){
uiGlyph.getGlyph().select(this.graphics, Color.RED, Color.WHITE, uiGlyph.getPosition().x, uiGlyph.getPosition().y);
}
} |
072524b3-8273-429f-ae26-34862ccd084d | 6 | public static void main(String[] args) {
String usr = "root";
String pwd = "root";
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost/distribuida";
Connection con = null;
PreparedStatement pstm = null;
ResultSet rs = null;
... |
3405b0e3-58b6-431c-9ed1-9076700fb0cc | 7 | private static void addTemplateCallResults(List<ConstraintViolation> results, QueryOrTemplateCall qot,
Resource resource, boolean matchValue, SPINModuleRegistry registry) {
TemplateCall templateCall = qot.getTemplateCall();
Template template = templateCall.getTemplate(registry);
if(template != null && template... |
5fa40129-ca9e-414f-8a65-5e95db2f517d | 1 | protected static int count(String longOne, String toCount) {
int i = 0;
while (longOne.contains(toCount)) {
i++;
longOne = longOne.replace(toCount, "");
}
return i;
} |
74d4fa6b-0d14-4772-9623-f06e41a363df | 4 | @Override
public boolean verify(JComponent input) {
JTextField textField = (JTextField) input;
String text = textField.getText();
if (text.equals(lastGood)) {
valueChanged = false;
return true;
}
try {
int parseInt = Integer.parseInt(text)... |
b00b64d1-a6b0-443d-b489-006f649139b2 | 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... |
ec2768f7-e515-40c9-b47a-3b00aa02ba40 | 2 | protected void setStringToPop(String stringToPop) {
/*
* if (!automata.StringChecker.isAlphanumeric(stringToPop)) throw new
* IllegalArgumentException("Pop string must "+ "be alphanumeric!");
*/
PushdownAutomaton myPDA = (PushdownAutomaton) this.getAutomaton();
if (myPDA.singleInputPDA && stringToPop.len... |
32ba621c-67ea-41d1-8ecb-25e37b8692bf | 9 | public static void generateRecipes(CommandSender[] c){
for(CommandSender cs : c){
cs.sendMessage(ChatColor.YELLOW + "[RecipeCreator] Generating Recipe Files");
}
ArrayList<Recipe> defaultbukkit = getDefaultBukkitRecipes();
for(Recipe r : defaultbukkit){
SerializedRecipe sr1 = null;
if(r instanceof Shap... |
e015cb44-4ceb-4393-becd-822fe936d239 | 3 | @Override
public List<Notice> getNewsAboutSubject(String subject) throws RemoteException {
List<Notice> notices = new ArrayList<Notice>();
for(Notice notice : news.getNews()){
for(String subj : notice.getSubjects()){
if(subj.equals(subject)) {
notices.add(notice);
break;
}
}
}
re... |
9587eb9b-f348-4a8b-915c-d9f52fddf136 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final LogTarefa other = (LogTarefa) obj;
if (this.id != other.id && (this.id == null || !this.id.equals(other.i... |
15e57390-f620-460a-8de0-7f480ae0b557 | 9 | private static void fireEventImmediately(
EventDispatcher dispatcher, int type,
Map<BundleContext, List<ListenerInfo>> listeners,
EventObject event, Dictionary<String, Object> oldProps)
{
if (!listeners.isEmpty())
{
// Notify appropriate listeners.
for... |
ff820ec8-fe92-482d-8c8c-4bba78120ba0 | 5 | protected void attack() {
if (this.getPlayer() == Player.NEUTRAL) {
return;
}
for (MyObject neighbour : model.getBoard().getObjectsNear(getXY())) {
for (Skill skill : neighbour.getSkills()) {
if (skill.blockTowerAttack(this)) {
return;
... |
4d448d4d-59a4-47a0-aca6-b1d337e9c194 | 5 | public void events(int xLoc, int yLoc) {
boolean auto = false;
boolean special = false;
if (xLoc == 1 && yLoc == 4) {
msg = new String[] { "Heading Upstairs!..." };
IndoorTiles.StairUp.Register(xLoc, yLoc);
special = true;
}
if (xLoc == 6 && yLoc == 0) {
msg = new String[] { "Going Outside!..." };... |
52ca36f9-9339-4507-beaf-c7d624d5f35e | 2 | public void paint(Graphics screen)
{
if(page == Page.HOME)
{
drawHome(screen);
}
if(page == Page.GAME)
{
drawGame(screen);
}
} |
f169afc9-acd2-4801-9471-884e33df8c3f | 1 | public void visitEnd() {
checkEnd();
end = true;
if (av != null) {
av.visitEnd();
}
} |
c8fccb5e-1080-4c94-91a1-ebf22cbcce5b | 4 | @Override
public void keyReleased(KeyEvent e) {
if(e.getKeyCode() == KeyEvent.VK_P) { //se cambia la pausa al presionar p
pausa = !pausa;
}
if(pausa) { //si esta pausado, no se procesa el evento
return;
}
//se marca como presionada la tecla para mover ... |
e0ea9474-53e0-42e7-88a1-d8f0913cd59d | 7 | public void populateWithRuins() {
float ruined = terGen.baseAmount(Habitat.CURSED_EARTH) ;
ruined = (ruined + (1 - totalFertility)) / 2f ;
final int
numMajorRuins = (int) ((ruined * numMajor) + 0.5f),
numMinorRuins = (int) ((ruined * numMinor) + 0.5f) ;
I.say("Major/minor ruins: "+numMa... |
7242e464-c748-4542-9735-f7b3d5728556 | 5 | public void searchRandom()
{
String result = "";
if(binaryTree)
{
result = binarytree.findRandom();
}
else if(naryTree)
{
result = narytree.findRandom();
}
else if(hashList)
{
result = hashlist.findRandom();
}
else if(hashTable)
{
result = hashtable.findRandom();;
}
if(res... |
ac90a1aa-bff4-4cae-8f18-f4078b89e508 | 1 | public void setYear(int y)
{
if(y>=0)
year = y;
else
year = 2000;
} |
038041ad-55cc-4ec3-bd7d-9747f0cd45dc | 4 | public static void makeSimple(mxAnalysisGraph aGraph)
{
// remove all self-loops
// reduce all valences >1 to 1
mxGraph graph = aGraph.getGraph();
Object parent = graph.getDefaultParent();
Object[] edges = aGraph.getChildEdges(parent);
//removing self-loops
for (int i = 0; i < edges.length; i++)
{
... |
2330e77b-2672-47f9-8bb5-81b0af899e08 | 1 | public double getPropagationValue(double energy) {
if (VERBOSE) {
System.out.println("Propagation value for energy " + energy);
}
return getPropagationMatrix(intervals.size() - 1, energy).getElem(1, 1).abs();
} |
e72f128e-06cd-4cc8-9e35-356c8432fe39 | 2 | public void clearScreen(){
for(int x = 0; x < width; x++){
for(int y = 0; y < height; y++){
setPixel(x, y, 0x00000000, -1);
}
}
} |
befbef95-39b5-4247-af53-0bb633540762 | 7 | @Override
public void keyPressed(KeyEvent e) {
if(e.getKeyCode() == KEY_JUMP) {
if(!player.getVerticalMovingBehavior().equals(fallingBehavior)) {
player.setVerticalMovingBehavior(jumpingBehavior);
}
}
else if(e.getKeyCode() == KEY_LEFT) {
player.setHorizontalMovingBehavior(moveLeftBehavior);... |
b7b0e44d-b0ac-40d3-8dd1-7104c189d600 | 6 | private boolean check(EdgeWeightedDigraph G) {
// edge-weighted digraph is cyclic
if (hasCycle()) {
// verify cycle
DirectedEdge first = null, last = null;
for (DirectedEdge e : cycle()) {
if (first == null) first = e;
if (last != null... |
a4a53fd6-21f5-47a0-b9b5-2dc4c2aee938 | 5 | public EventDone performEvent(SimulationEvent reaction) {
if ( reaction instanceof SIREventWithRate) {
SIREventWithRate event = ((SIREventWithRate) reaction);
Agent fromAgent = event.getFromAgent();
Agent toAgent = event.getToAg... |
9d7dfdcd-cbd2-4f80-970e-8e6c782a916c | 7 | @Override
public String toXml() {
XmlCharacterEncoder xce = new XmlCharacterEncoder();
String xml = "<anemometer";
if (stencil != ONE_POINT)
xml += " stencil=\"" + stencil + "\"";
String uid = getUid();
if (uid != null && !uid.trim().equals(""))
xml += " uid=\"" + xce.encode(uid) + "\"";
if (attachID... |
714d74fd-98b6-4d6f-94b7-904491dc42dc | 1 | @Override
public void run() {
logger_.debug("Selecting a host to meet with.");
Collection<Host> hosts = RoutingTable.randomSelect(1, routingTable_.getAllHosts());
for (Host host : hosts) {
meetWith(host);
}
} |
c6700106-815f-4c79-85d1-e8cf6bba3ebe | 2 | public boolean method579() {
if (modelIds == null) {
return true;
}
boolean flag1 = true;
for (int element : modelIds) {
flag1 &= Model.isCached(element & 0xffff);
}
return flag1;
} |
7ea5b441-8dd1-4d9d-bfbc-418a523e3dc1 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PairImpl<?> other = (PairImpl<?>) obj;
return Tuples.equals(_first, other._first)
&& Tuples.equals(_second, other._se... |
c30caf59-e888-42d0-91ce-dd5f4038fb42 | 3 | public Shortcut(JComponent source, KeyStroke shortcut, String name, final boolean autoRepeat, final AbstractAction action){
isRepeated = false;
source.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
isRepeated = f... |
95d56372-5fa5-4f1f-90ec-5e3ffa3cd248 | 2 | public void removeTrack(String name) {
for(int x = 0; x<tracks.size(); x++) {
if(tracks.get(x).getName().matches(name)) {
tracks.get(x).getClip().stop();
tracks.get(x).getClip().close();
tracks.remove(x);
}
}
} |
8e2dc2ef-85c6-4159-84d8-e839f2ce1632 | 3 | public static void update()
{
if(Game.logo.getY() > Game.SCREEN_HEIGHT/2 - 210){
Game.logo.setPosition(Game.logo.getX(), Game.logo.getY() - 3);
y -= 3;
delta++;
}
if(Game.logo.getY() <= Game.SCREEN_HEIGHT/2 - 210){
radius += 5;
}
if(radius >= 1000) Game.setState(GameState.MAINMENU);
} |
f82724d3-e179-410d-a465-c2ac1f3519f0 | 2 | public void test_getOffsetFromLocal_Moscow_Autumn_overlap_mins() {
for (int min = 0; min < 60; min++) {
if (min < 10) {
doTest_getOffsetFromLocal(10, 28, 2, min, "2007-10-28T02:0" + min + ":00.000+04:00", ZONE_MOSCOW);
} else {
doTest_getOffsetFromLocal(10... |
aa432366-3b69-4d64-a044-9c95a1058e9f | 0 | public String getNote() {
return note;
} |
594e8adb-d23b-40b5-b939-3942352f640c | 5 | public void run() {
Console.log("[UDP] sender started.");
try {
int sendCounter = 0;
while (!done) {
selector.select(60000); // important property!
Set<SelectionKey> keys = selector.selectedKeys();
Iterator<SelectionKey> iter = keys... |
bcb943ae-ff84-479d-9f88-e24c22424bac | 8 | public static Proposition extractInvertedGoal(Proposition proposition, Proposition goal) {
if (goal.kind == Logic.KWD_NOT) {
return (Proposition.extractInvertedGoal(proposition, ((Proposition)((goal.arguments.theArray)[0]))));
}
{ Keyword testValue000 = proposition.kind;
if (testValue000 == Log... |
15280f2f-143f-4f0c-908c-1452a3282c0d | 7 | public Classements(int width, int height, ActionListener parent) {
try{
// recherche et classe l'historique des scores
ListeScore listeScore = new ListeScore();
listeScore.SetRangByScore();
//Initialise les titres
this.setLayout(null);
... |
066a90a1-fe92-4be6-94b7-274769f978fc | 2 | public String getString(String key, String def) {
if(fconfig.contains(key)) {
return fconfig.getString(key);
}
else {
fconfig.set(key, def);
try { fconfig.save(path); } catch (IOException e) { e.printStackTrace(); }
return def;
}
} |
da205d35-692d-481a-9026-0f75af324a04 | 9 | @Override
public int castingQuality(MOB mob, Physical target)
{
if(mob!=null)
{
if(target instanceof MOB)
{
final Room R=((MOB)target).location();
boolean found=false;
if(R!=null)
for(int r=0;r<R.numInhabitants();r++)
{
final MOB M=R.fetchInhabitant(r);
if((M!=null)&&(M!=mo... |
e7e66774-055c-4443-baa9-4acb7a135c7a | 3 | public String toString() {
switch (flags) {
case BEFORE:
return "BEFORE " + super.toString();
case AFTER:
return "AFTER " + super.toString();
case BETWEEN:
return "BETWEEN " + super.toString() + " AND " + date2.toString();
default:
return "DateRange[UNKNOWN " + super.toString() + "]";
... |
aa4c24f1-ce1f-4801-b3ba-567e97ad2392 | 4 | protected void undo() throws CannotUndoException {
if (insertionPoint <= 0) {
throw new CannotUndoException();
}
while ((insertionPoint > 0) && (!edits.get(insertionPoint - 1).isSignificant())) {
AbstractEdit edit = edits.get(insertionPoint - 1);
edit.undo();
... |
7b1a7b35-83bc-42cf-9937-1847940fa67a | 6 | public RawImageDialog(final Panel panel, final File arch) {
setTitle("Load raw image");
setBounds(1, 1, 250, 120);
// setLocation(560, 400);
Dimension size = getToolkit().getScreenSize();
setLocation(size.width / 3 - getWidth() / 3, size.height / 3
- getHeight() / 3);
this.setResizable(false);
setLayo... |
153f1ab3-23dc-4fbc-8ebd-3ee9c931f285 | 3 | public void insertAt(Card card, int index) {
Card [] temp = new Card[cardArray.length + 1]; // temp nieuwe array met de waardes + 1 (die toegevoegd gaat worden)
for(int i = 0; i < temp.length; i++){
if(i < index){
temp[i] = cardArray[i];
} else if (i == index)... |
ef271ca9-ef9e-4d19-892c-e23f1c8bc59c | 8 | public void main(){
Scanner s = new Scanner(System.in);
Num num = null;
boolean get = false;
while (!get){
System.out.print("Enter an integer (3 digits): ");
num = new Num(s.nextInt());
get = (num.length() == 3);
if (!get) System.out.print(... |
1fccbc77-f126-4228-a20b-2921f7f2fb26 | 5 | public static void find(int[] A, int p, int r, int findNum){
if(findNum == A[p]){
Print.println("The number have fond,the index is " + p);
return;
}
if(p == r){
Print.println("The number have not fond, the index is " + p);
}
if(p < r){
int q = (p + r) / 2;
if(A[q] > findNum){
find(A,p,q,... |
5a395e86-da58-4d80-89b5-c1103d81f76a | 3 | public static void main(String[] args) {
if(args.length != 1) {
System.out.println("Usage: DDJOServer <port>");
return;
}
int port;
try {
port = Integer.parseInt(args[0]);
}
catch(NumberFormatException fex) {
System... |
3acedfdc-a819-4958-b5c0-66fe1185e9d4 | 4 | public static String getColor(int i) {
String retval = "Unknown";
switch (NATIONS.values()[i]) {
case Dwarf:
retval = "(Red)";
break;
case Elf:
retval = "(Green)";
break;
case Giant:
retval = "(Yellow)";
brea... |
d326e4f9-9a44-4e83-952d-73af41c18d0a | 6 | public void reflection(int index, int[] rgb, int level) {
level++;
if (level < 2) {
if ((allSphere[index].getMat().mirrorColor[0] != 0)
&& (allSphere[index].getMat().mirrorColor[1] != 0)
&& (allSphere[index].getMat().mirrorColor[2] != 0)) {
double dist = 2.0 * vec.dot(normal, w);
ReflectedRay[0... |
9552c296-9a02-40c5-8326-19895eaef03e | 3 | @Override
public void renderTile(int aX, int aY, Graphics g)
{
final int xPos = (int) (aX * mTileWidth / 2), yPos = (int) (aY * mTileHeight);
final TileValue tile = mField.getTileValue(aX, aY);
final MaskValue mask = mField.getMaskValue(aX, aY);
g.drawImage(DataManager.getImage(((aX + aY) % 2 == 1 ? REVERSE :... |
cd7f3329-dd88-4c2a-b1e7-0a61434332a2 | 0 | public static void main(String[] args)
{
World map = new World();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.