method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
11056c0e-08c2-4a81-9100-b19d2d696ca9 | 1 | public void visit_ifge(final Instruction inst) {
stackHeight -= 1;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
} |
56620711-dc47-499e-9049-bf6f2c9c7e93 | 2 | public void deleteFromList(int vertex) {
for (int i : this.list)
if (this.list.get(i) == vertex) {
this.list.remove(i);
return;
}
} |
1d2c209c-3f60-4d60-b1af-44d5e12f090a | 4 | public Hunter move() {
int newX = this.xCoord + this.xDirection;
int newY = this.yCoord + this.yDirection;
if (0 > newX || newX >= 4 || 0 > newY || newY >= 4){
//--> bump, exit}
} else {
this.xCoord = this.xCoord + this.xDirection;
this.yCoord = this.yCoord + this.yDirection;
}
this.perform... |
5bc23e9e-5f6d-4101-9a88-99ca759f786c | 1 | public void remove() {
if (useGraphics) {
picture.remove();
}
} |
c53fc101-950c-4f06-a503-5fb6031148a1 | 2 | @Override
public int getAddress(Identifier var, int size)
throws Exception {
addressRecord a = usedMem.get(var);
if(a != null) {
if(a.size != size) {
throw new Exception("varaible accessed as different size than expected");
}
return a.addre... |
e231fa94-84be-4e9d-b7c9-a611dfb6b297 | 0 | @Test
public void testGetNumberOfWins()
{
assertNotNull(_underTest);
// during setUp() the Player was newly instanciated - thus the number of
// wins is 0
assertEquals(0, _underTest.getNumberOfWins());
_underTest.incrementWins();
_underTest.incrementWins();
... |
4d9d24d1-403f-4268-8b64-9ac470a2aa93 | 4 | @Override
public void display(Boolean showCorrect) {
System.out.println(prompt);
for ( int i=0; i < col1Choices.size(); i++){
//System.out.println((i+1)+"). " + col1Choices.get(i) + "\t" + (i+1) + ")." + col2Choices.get(i));
System.out.format("\t"+(i+1)+").%-15s"+(i+1) + ").%-15s\n", col1Choices.get(i), col... |
a8f31295-36da-4d39-a9c9-8393d467a394 | 1 | private static void SwapRowData(int scrRowId, int targetRowId,
float[][] array) {
int aryLength = array[scrRowId].length;
float temp;
for (int i = 0; i < aryLength; i++) {
temp = array[scrRowId][i];
array[scrRowId][i] = array[targetRowId][i];
array[targetRowId][i] = temp;
}
} |
02f85864-4117-4305-81d8-365e60824d76 | 5 | protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
String data = "";
response.setContentType("text/plain");
response.setCharacterEncoding("UTF-8");
PrintWriter writer = response.getWriter();
String dbDriver = "org.postgresql.Driver";
... |
59e28ef3-61a0-43e8-b8db-08b0fa5c29a1 | 9 | public static PolicyConfigurationFactory getPolicyConfigurationFactory() throws ClassNotFoundException,
PolicyContextException
{
// Validate the caller permission
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkPermission(new SecurityPermission("setPolicy... |
c424b2d7-a81c-4aca-9629-61d2a025440a | 7 | private ShareableHashMap<GSSNode, Set<GSSNode>> getShifts(Collection<GSSNode> gss) {
// collect all shift transitions in the gss
ShareableHashMap<GSSNode, Set<GSSNode>> shifts = new ShareableHashMap<GSSNode, Set<GSSNode>>();
ShareableHashSet<GSSNode> todo = new ShareableHashSet<GSSNode>();
Set<GSSNode> done = n... |
0627f552-4ae2-41eb-b4ff-c2db4a26fa79 | 7 | public float getPrecision(String[] manualSummaries, String[] generatedSummaries){
String manualSummary,generatedSummary;
int matchCount = 0;
int generatedSummaryCount=0;
String[] manualOneGram = null,generatedOneGram = null;
if(manualSummaries==null || generatedSummaries==null || manualSummaries.length!=gener... |
f85cc682-e1e8-4db2-8816-300423490554 | 9 | private static void displayMenu(){
boolean terminateLoop = false;
Long initClock=System.currentTimeMillis();
Long exitClock=initClock+Constants.AMNODEALIVEDURATION;
if(Constants.AUTOMATICMODE){
while(System.currentTimeMillis()<exitClock){
MultiCastMessage results = readMessage(Constants.MESSAGESFILE);
... |
8d9dd5ad-db15-4360-bde5-89b1cbb1fc8f | 9 | public void sendData(Player player, OreLookup ores) {
DecimalFormat f = new DecimalFormat("#0.000");
player.sendMessage(ChatColor.GOLD+"### Ore Rates from "+ChatColor.BLUE+ores.getPlayer()+ChatColor.GOLD+" ###");
player.sendMessage(ChatColor.DARK_GRAY+"Stone: "+ores.getStone()+" ### Netherrack: "+ores.getNetherra... |
9bbc2958-065a-4ebb-aec4-b496c329bfc6 | 4 | public void checkForDupedItem() {
Chunk chunk = getBlock().getChunk();
for (Entity entity : chunk.getEntities()) {
if (entity instanceof Item && entity.getLocation().equals(item.getLocation()) && !entity.equals(item)) {
entity.remove();
}
}
} |
f8491bd5-61bf-443e-8bf2-fea58a6eace1 | 6 | public static RSTNode withoutBlock(RSTNode n, Block toBeRemoved) {
int matches = 0;
Block[] blocks = n.getBlocks();
for( int i=0; i<blocks.length; ++i ) if( blocks[i].equals(toBeRemoved) ) ++matches;
if( matches == 0 ) return n;
if( matches == blocks.length ) return EMPTY;
Block[] newBlocks = new B... |
45435b5d-1a20-4344-b121-e7cf70992d10 | 5 | public static String removeMessageFlags(MessageContext context, String message) {
String botNick = context.getBot().getNick();
if (message.startsWith("%")) {
// Emily was called by prefix
message = message.substring(1);
} else if (message.startsWith(botNick)) {
// Emily was reffered to by name
int nic... |
34192902-7a6a-4aa5-bcce-f464192a752e | 7 | private void updateGambling(int numUpdates) {
final Batch <Actor> absent = new Batch <Actor> () ;
for (Actor a : gambleResults.keySet()) {
if (a.aboard() != this) absent.add(a) ;
}
for (Actor a : absent) gambleResults.remove(a) ;
if (numUpdates % POT_INTERVAL == 0) {
Actor wins = nu... |
17a0d722-0b31-4188-b25f-e2ef283dc4d4 | 9 | public ArrayList<String> replaceStopWords(ArrayList<String> segments){
ArrayList<String> outList = new ArrayList<String>();
StringTokenizer st;
ElimOrReplaceStopWords em = new ElimOrReplaceStopWords();
for(int i = 0; i < segments.size(); i++){
//System.out.println("Before: "+segments[i]);
String temp = ""... |
f200fcf9-fa23-4932-b747-9b8665220713 | 4 | @Override
public String[] gibTabs() {
String[] re = new String[5];
re[0] = "Punkte\n";
re[1] = "Punktlisten\n";
re[2] = "Kanten\n";
re[3] = "Flaechen\n";
re[4] = "Gesamt\n";
String[] points = QGui.pointArrayToStringArray(gibPoints());
for (int i = 0; i < points.length; i++) {
re[0] += points[i] + "... |
9aec522a-dda0-4ab5-ae1b-cbc98ff3bf4d | 5 | @Override
public void handleGuiKeyInput() {
if (KeyHandler.isValidationKeyPressed())
select();
if (KeyHandler.isPressed(KeyHandler.UP)) {
currentChoice--;
if (currentChoice == -1)
currentChoice = options.length - 1;
}
if (KeyHandler.isPressed(KeyHandler.DOWN)) {
currentChoice++;
if (currentC... |
5b1cd7dc-15f6-47cf-953c-ca6a26937325 | 9 | public Config(InputStream aStream)
{
// create resource Loader
m_ResourceLoader = new DefaultResourceLoader();
if (_groupTable == null)
{
_groupTable = new Hashtable<String, Hashtable<Object, Object>>();
}
if (_exports == null)
{
_exp... |
6babd729-ec10-4c5c-8633-603709dcd0d9 | 9 | public PrimIntegerSpec combine(PrimIntegerSpec other) {
if (this == other) {
return this;
}
if (myBitCount == UNLIMITED_BITS) {
return this;
}
if (other.bitCount() == UNLIMITED_BITS) {
return other;
}
if (myBitCount < other.bitCount()) {
return other;
}
if (myBitCount > other.bitCount()) {... |
e74fbddf-5088-4886-a71e-aeb01c1c9f15 | 6 | static final void method3641(int i, int i_35_, byte i_36_, int i_37_,
int i_38_, int i_39_) {
anInt4575++;
if (i_36_ != -75)
chnkX = 73;
if (i_35_ == i_38_)
Class127.method1116(i, i_37_, i_39_, i_38_, (byte) -99);
else if (Class369.anInt4960 <= i_39_ + -i_38_
&& (i_39_ - -i_38_ ^ 0xffffffff) >= (C... |
0537544d-a51c-4762-afb1-a26d714dcc4b | 8 | public void visitStoreExpr(final StoreExpr expr) {
if (expr.expr() instanceof CheckExpr) {
// This makes copy propagation more effective after PRE.
// x := rc(y) --> rc(x := y)
final CheckExpr rc = (CheckExpr) expr.expr();
if (replace) {
final Node parent = expr.parent();
// x := rc(y) --> x := ... |
426e75c2-d32a-41c7-ba77-6d78b8f148ef | 8 | public Point2DInt[] getCornersOfOneSide(LineSegmentInt seg, int sgn) {
final Point2DInt[] corners = getCorners();
final double sgn0 = seg.side(corners[0]);
final double sgn1 = seg.side(corners[1]);
final double sgn2 = seg.side(corners[2]);
final double sgn3 = seg.side(corners[3]);
int nb = 0;
if (Math.sig... |
9aa5baff-f0ac-4bbe-b3e4-89affeb572f7 | 2 | private boolean hasTag(String version) {
for (final String string : Updater.NO_UPDATE_TAG) {
if (version.contains(string)) {
return true;
}
}
return false;
} |
0d6900d5-4783-4d76-9d9b-fca136e1906d | 3 | @Override
public void display(UserInterface ui) {
if (breakpointLinesToSet.isEmpty()) {
UserInterface.print("Breakpoints can be set on lines: ");
for (String breakpointLine : breakableLineNumbers) {
UserInterface.print(breakpointLine + " ");
}
} el... |
af200cd9-7654-4d7e-9e28-0a8a46eebc70 | 6 | public static final String getVersion()
{
if( null == version )
{
loadBuildProps();
version = buildProps.getProperty( "version", "unknown" );
if( version.endsWith( "-SNAPSHOT" ) )
{
version = version.substring( 0, version.length() - 9 );
String timestamp = buildProps.getProperty( "timestamp" ... |
68e77e0f-1d73-4a4b-96d9-92d834070382 | 7 | public static void readFile() {
try {
File file = new File("data/out.txt");
if (file.isFile() && file.exists()) {
InputStreamReader read = new InputStreamReader(
new FileInputStream(file));
BufferedReader bufferedReader = new BufferedReader(read);
String lineTxt = null;
StringBuilder sb = ... |
cc39a310-f215-473d-9d99-c7689f54b365 | 4 | public static int random_inserts( CommunityDAO db, int howmany ) throws Exception {
CryptoUtils c = new CryptoUtils();
List<String> keys = new ArrayList<String>();
long start = System.currentTimeMillis();
for( int i=0; i<howmany; i++ ) {
keys.add(Base64.encode(c.getPair().getPublic().getEncoded()).repla... |
f35abd64-51c4-423a-9342-631d1c918cc9 | 1 | public void visitIincInsn(final int var, final int increment) {
if (mv != null) {
mv.visitIincInsn(var, increment);
}
execute(Opcodes.IINC, var, null);
} |
d2155841-7dad-4a09-b422-ccc73ad26a08 | 0 | @Column(name = "PRP_MOA_CONSEC")
@Id
public Integer getPrpMoaConsec() {
return prpMoaConsec;
} |
8e1b073d-ce3b-4f0b-8bc2-0364d1096b1f | 4 | @Override
public void actionPerformed(ActionEvent e) {
// TODO:
// We first need to update the text in the DocumentManager
// and THEN call save on it.
boolean save = false;
if (documentManager.validate(tabManager.getText())) {
save = true;
} else {
int choice = JOptionPane
.showConfirmDialog... |
517caae4-8a24-4e5f-8295-f9b19f6dd305 | 1 | public void declareFunction(String name, FunDecl funDecl) {
if(funDecls.containsKey(name)) {
throw new RuntimeException("Function <" + name + "> already defined current context");
}
funDecls.put(name, funDecl);
} |
66b95c6c-d06c-48ef-bbd8-972ef21363d2 | 7 | public void setPeaks(PeakData p, int index) {
if (index == 0) {
peaks1 = p;
if (!head2tail) {
selectPeakList.clear();
}
} else if (index == 1) {
peaks2 = p;
}
if (peaks1 != null) {
massRange = peaks1.compMaxMzPrecusor(precursor);
}
if (peaks2 != null) {
massRange = Math.max(peaks2.co... |
6b4dbca5-635f-4118-ba38-b216dad0a16c | 5 | private void createCommandButtons()
{
{
Button clearButton = new Button(inputGroup, SWT.PUSH);
clearButton.setText("Clear view state");
clearButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
inputText.setText("");
}
});
}
{
Button ser... |
84daebfd-b8f0-4f7e-80bb-315253339d88 | 6 | public static void main(String[] args) {
items = new ArrayList<>();
int op;
do{
System.out.println("1-AGREGAR");
System.out.println("2-RENTAR");
System.out.println("3-LISTAR");
System.out.println("4-EVALUAR ESTADO");
System.out... |
f17f2182-7f33-41c4-839a-6cc599771861 | 0 | private int right(int i) {
return left(i) + 1;
} |
95fc33c2-e7f5-44d9-9a0f-72ad3993cf47 | 3 | public int inserir(Funcionario f){
Connection conn = null;
PreparedStatement pstm = null;
int retorno = -1;
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(INSERT, Statement.RETURN_GENERATED_KEYS);
pstm.setString(1, f.getNom... |
7d2e43f7-f2ea-4a2d-9d9d-63cf224426b8 | 3 | public void doHandle( String path, Class<?> classPathEntry )
{
if ( this.filter.matches( classPathEntry ) )
{
for ( ClassPathEntryHandler classHandler : this.classHandlers )
{
classHandler.doHandle( path, classPathEntry );
}
}
} |
3ca8bc15-2e75-4389-a957-c2b0a51d449e | 5 | public static void main(final String[] args)
{
while(contin){
contin = false;
controller = new Controller(new Field());
view = new GUI(controller);
TUIview =new TUI(controller);
view.welcomePlayer();
view.demandPlayerInstructions();
gamestate = GAMESTATE.running;
while(((gamestat... |
4b3be118-3f65-47c5-9004-8e7f7b4d9f9d | 8 | public void shiftRubiks(String face) {
switch(dir) {
case "Up" : shiftUp(grid[0][1]); break;
case "Down" : shiftDown(grid[0][1]); break;
case "Left" : shiftLeft(grid[0][0]); break;
case "Right" : shiftRight(grid[0][0]); break;
case "RotateC" : shiftRotate("F", 1); break;
case ... |
ec69cac0-80d6-430f-b6de-067656d547b6 | 8 | private static int method524(char ac[]) {
if (ac.length > 6)
return 0;
int k = 0;
for (int l = 0; l < ac.length; l++) {
char c = ac[ac.length - l - 1];
if (c >= 'a' && c <= 'z')
k = k * 38 + ((c - 97) + 1);
else if (c == '\'')
k = k * 38 + 27;
else if (c >= '0' && c <= '9')
k = k * 38 +... |
4ab9065e-4105-4ba8-ad93-9adfdffb47ca | 9 | private static Object jsConstructor(Context cx, Scriptable scope,
Scriptable thisObj, Object[] args)
{
if (args.length == 0 || args[0] == null ||
args[0] == Undefined.instance)
{
throw ScriptRuntime.typeError1("msg.no.properties",
... |
cc9e4dd6-58a8-4478-b50e-1a637bcdedfa | 2 | public int gambleAttack(Character target){
int damage = (int) (10 * Math.random()) + (int) (attack * multiplier * Math.random());
if (damage <= 0){
damage = 1;
}
if ( ((int) (100 * Math.random()) + 1) < target.getEvasiveness()){
damage = 0;
}
target.lowerHP(damage);
return damage;
} |
4287f24b-f61b-4e8d-b674-8db63f597ac1 | 5 | public static void registerXMLRowVTIs( String className )
throws Exception
{
// find public static methods which return ResultSet
Class theClass = Class.forName( className );
Method[] methods = theClass.getMethods();
int count = methods.length;... |
6d3b9ea8-93c1-484e-8d05-00ecdf042de6 | 0 | @Test
@TestLink(externalId = "T3")
@Ignore("Does not run.")
public void testIgnore() {
assertTrue(true);
} |
ab8e719e-4df9-4fb9-bf03-7a0091fb9787 | 1 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
logger.log(Level.INFO, "=============== Downloading Application to Device " + device.toString() + " ===============");
jProgressBar1.setIndeterminate(true);
new Thread() {
... |
6788795a-a353-415f-8393-2cdf0a910689 | 8 | public boolean equals(Object obj) {
if (!(obj instanceof PartialTimestamp)) {
return false;
} else {
PartialTimestamp pt = (PartialTimestamp)obj;
for (int field = CENTURY; field < FIELD_COUNT; field++) {
if (this.isSet(field) && pt.isSet(f... |
a5aef742-4d10-415b-8208-9fa97018b611 | 3 | @Override
public void validate(Ingredient c) throws IngredientRepositoryException {
Ingredient cat = getIngredient(c.getIngredientId());
if(cat == null){
throw new IngredientRepositoryException("Could not find ingredient with id"+c.getIngredientId());
}
for(int parent : c.getParentIngredients()){
Ingredi... |
3843fb8e-c431-4949-9865-58d7ef8c746d | 0 | public Shooter() {
super(0.08, 0, 0.28);
_speedSensor.setMinSpeedRpm(200);
_accelerator.setMinSpeed(0);
getPIDController().setOutputRange(-2/OUTPUT_SCALE, 2/OUTPUT_SCALE);
setAbsoluteTolerance(15);
LiveWindow.addSensor("Shooter", "Speed Sensor", _speedSensor);
Liv... |
0d5d643b-a6d0-40a0-8699-cede4de400fb | 0 | private MessageDialog()
{
super();
setModal(true);
JPanel contentPane = new JPanel();
setContentPane(contentPane);
BoxLayout boxLayout = new BoxLayout(contentPane, BoxLayout.Y_AXIS);
contentPane.setLayout(boxLayout);
... |
776f16e5-7d8d-429e-8dc1-25a7abe28258 | 4 | public void write(String outputFileName){
TextIO.writeFile(outputFileName);
TextIO.putf("!This is a copy of the file %s\n", inputFileName);
TextIO.putf("!We could have done something more complex than this\n");
TextIO.putf("Rows: %d\n",this.rows);
TextIO.putf("Cols: %d\n",this.cols);
//prints names
for(in... |
86d2749b-7821-484d-8a9f-afe2d62e9778 | 0 | public void setPlayer(Sprite player) {
this.player = player;
} |
7a184500-99b6-4dc8-ad8b-9f3c8ca99b6d | 1 | protected void changedQLFiles(){
for(ModelChangeListener mcl : listeners){
mcl.changedQLFiles(quick_launch_files);
}
} |
37f86136-4fdc-4963-aa89-93d3dea94708 | 4 | public void setTime (Calendar startCal, Calendar endCal, String dateTime)
{
String[] dateTimes = dateTime.split("\\s+");
try
{
int year = Integer.parseInt(dateTimes[3]);
int day = Integer.parseInt(dateTimes[2].replace(",", ""));
SimpleDateFormat monthForma... |
387a5ed3-3c3f-4f8f-91bc-b256f61db026 | 9 | public ClassifierSetup(Element secondlevel) throws Exception {
listOfLists = new ArrayList<List<String>>();
List<List<String>> localListOfLists;
List<String> list;
KeyValue name;
hasOptions = false;
if(secondlevel.getAttributeList().size() != 1)
throw new Exception("Classifier tag MUST contain name=\"... |
d606264f-ce8b-4eba-97c4-530caad40b9c | 3 | private void easyAddLock(String resource, String transaction, LockType type) {
// When this is called, every thing should be safe.
// So:
if (this.type == null) {
this.type = type;
this.transactions.add(transaction);
} else if (this.type == LockType.WRITE || type ... |
a72bc931-3a01-4300-90a2-559585e8f42f | 7 | public byte[] iteration_loop(SideInfoEnc side_info, FrameDataQuantized fd, int mean_bits) {
int channels = fd.getChannels();
EChannel cod_info;
int max_bits;
int enc[][][] = fd.ix;
SideInfo side_info_dec = fd.si;
int freq_index = fd.getFsIndex();
scalefac_band_long = sfBandIndex[freq_index][0];
sc... |
c6dd5d25-d767-4a34-b657-92ae2690f6f5 | 7 | int laskeSivut(Muodostelma muod) {
int sivut = 0;
List<Palikka> palikat = muod.getPalikat();
for (int i = 0; i < palikat.size(); i++) {
int x = palikat.get(i).getX();
int y = palikat.get(i).getY();
if (x + 1 > 9) {
sivut++;
} else i... |
3e663313-5581-49c0-89ff-dccf0cc9a3db | 0 | public int getMaxTries() {
return maxTries;
} |
153ee8b0-5722-47f8-965c-81a34e4119ee | 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... |
345da2c9-801d-4488-bb8a-62a18729e96d | 8 | private void checkScreenFit() {
Logger.getLogger(ReadComponent.class.getName()).entering(ReadComponent.class.getName(), "checkScreenFit");
float ratio = 0;
if (fitToScreenHorizontally && drawingImageWidth > readInterfaceScrollPane.getWidth()) {
ratio = (float)readInterfaceScrollPane.... |
72cd61a4-1933-4877-ade2-06c1542b65c6 | 0 | public static Sundae makeSundae() {
return new Sundae();
} |
8604c3f3-84b2-4c62-a5d8-f86d37d170df | 6 | @EventHandler
public void GiantHeal(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getGiantConfig().getDouble("Giant.Heal.DodgeCha... |
ac932790-6a4b-45f1-9940-8477e1ef0427 | 7 | public Maze(String s)
{
try
{
BufferedReader br = new BufferedReader(new FileReader(s));
String s1;
while ((s1 = br.readLine()) != null)
{
rows++;
columns = s1.length();
}
open = new boolean[colu... |
e1f2cb03-f6f9-4bbb-ae7a-2a9ffa35d3e7 | 6 | public void dumpCode(java.io.PrintWriter output) {
for (Iterator iter = instructions.iterator(); iter.hasNext();) {
Instruction instr = (Instruction) iter.next();
output.println(instr.getDescription() + " "
+ Integer.toHexString(hashCode()));
Instruction[] succs = instr.getSuccs();
if (succs != null)... |
7a7255d3-4abe-4ffa-99d5-6488ee730ee6 | 5 | public Color chooseColorByPoint(Vertex vertex)
{
if (vertex == vertices.endA)
return Color.MAGENTA;
if (vertex == vertices.endB)
return Color.red;
if (vertex == draggedFromVertex)
return Color.orange;
if (vertex == draggedToVertex)
retu... |
43cd721d-ea9a-4adc-9b1f-619942a9d6f3 | 4 | public static LinkedHashMap<String,Object> array_flip(Map<String,Object> hm) {
//OK
LinkedHashMap<String,Object> newhm = new LinkedHashMap<String,Object>();
if (hm == null) return newhm;
synchronized (hm) {
for (Map.Entry<String,Object> entry : hm.entrySet()) {
String key = entry.getKey();
Object va... |
15a848e0-7ceb-410d-80c4-d9aa32f439b0 | 5 | static public GeoPoint trilaterate(GeoPoint c1, double r1, GeoPoint c2, double r2, GeoPoint c3, double r3){
if (r1 < 0 || r2 < 0 || r3 < 0)
return null;
// convert geo points to cartesian
Projection proj = GeoProjections.newSimpleProjection((c1.getLon() + c2.getLon(... |
38041df0-76b8-41d2-980e-70f2a5cecd71 | 8 | private void Input() {
Gdx.input.setInputProcessor(new InputHandler(){
public boolean keyDown(int keycode){
switch(keycode){
case Keys.W:
movement.y = speed;
break;
case Keys.A:
movement.x =- speed;
break;
case Keys.S:
movement.y =- speed;
break;
case Keys.D:
... |
96d247eb-9ba6-41c0-be24-aa992895255a | 5 | @Override
public void run()
{
Dimension scrSize = Toolkit.getDefaultToolkit().getScreenSize();
Insets toolHeight = Toolkit.getDefaultToolkit().getScreenInsets(getGraphicsConfiguration());
int x = scrSize.width - getWidth() - 2;
int y = scrSize.height;
for(int i = 0; i < getHeight() + toolHeight.bottom; i++)... |
6e2b8134-7e25-4a7c-bc8a-677dca3cd4f4 | 4 | public Class<?> getWriteType() {
if (writeMethod != null) {
return writeMethod.getParameterTypes()[0];
} else if (field != null && !Modifier.isFinal(field.getModifiers())) {
return field.getType();
} else {
throw new IllegalStateException(name + " property is not writable.");
}
} |
fa78e4fb-b387-4059-a088-b19d8b8a200f | 9 | private static int estimateBlackPoint(int[] buckets) throws NotFoundException {
// Find the tallest peak in the histogram.
int numBuckets = buckets.length;
int maxBucketCount = 0;
int firstPeak = 0;
int firstPeakSize = 0;
for (int x = 0; x < numBuckets; x++) {
if (buckets[x] > firstPeakSiz... |
8848eab3-5b83-4b85-b275-2a9969fbae6d | 3 | public void setValidUntil(String validUntil)
{
if (validUntil == null || validUntil.length() != 8 || !validUntil.matches("\\d{8}"))
throw new IllegalArgumentException("The valid until date field in the " + frameType.getId() + " frame contains an invalid value, " + validUntil + ". It must have the fo... |
e1158576-75e2-4748-89c4-b1381c396220 | 3 | public void setGhost(Player player, boolean isGhost) {
// Make sure the player is tracked by this manager
if (!hasPlayer(player))
addPlayer(player);
if (isGhost) {
ghosts.add(player.getName());
player.addPotionEffect(new PotionEffect(PotionEffectType.INVISIB... |
a10dbd7a-c45d-474e-a18f-6fa8911ae8f2 | 5 | public synchronized static void deleteTask(String id, String mail) {
try {
XStream xstream = new XStream(new DomDriver());
File remFile = new File((String) Server.prop.get("taskFilePath"));
Task[] allTask = (Task[]) xstream.fromXML(remFile);
List<Task> retList = new ArrayList<Task>(Arrays.asList(allTa... |
d178a95d-b443-4e2a-9033-92b3b7b1981d | 3 | public int idDropped(int var1, Random var2) {
return this.blockID == Block.oreCoal.blockID?Item.coal.shiftedIndex:(this.blockID == Block.oreDiamond.blockID?Item.diamond.shiftedIndex:(this.blockID == Block.oreLapis.blockID?Item.dyePowder.shiftedIndex:this.blockID));
} |
90d0ac93-e017-46d0-a2e9-af814fbba55b | 5 | public static String performIDAStar(char[] startState, boolean verbose) {
// Don't bother wasting CPU cycles for an already solved Cube
if (Arrays.equals(startState, Cube.GOAL.toCharArray())) {
return "The given cube is already in a solved state";
}
// Initialize the root node with the start state
CubeNode... |
f4460cde-94d9-4dce-8094-8c3def730ff0 | 7 | public static TreeSet<String> findTestsToRun(
ArrayList<String> implementationDirectories,
ArrayList<String> testDirectories, ArrayList<String> modifiedClasses)
throws IOException, ClassNotFoundException {
// iterate directory to build dependency graph & tests
HashMap... |
e37ec7ca-418f-4349-a21e-459e40e7ef35 | 8 | final void HA(int i, int i_37_, int i_38_, int i_39_, int[] is) {
try {
anInt7681++;
float f
= (((float) i_38_
* (((Class101_Sub3) ((OpenGlToolkit) this).aClass101_Sub3_7760)
.aFloat5784))
+ ((float) i_37_ * (((Class101_Sub3)
((OpenGlToolkit) this).aClass101_Sub3_7760)
.... |
c3ff955a-95cc-4634-9b4b-dd906e295a1b | 8 | public static void printMatrixSpirally(int[][] mat,int m, int n) {
int k=0,l=0;
System.out.println("spirally matrix printing :");
while (k < m && l < n) {
for (int i = k; i < n; i++) {
System.out.print(mat[k][i] + " ");
}
k++;
for (int i = k; i < m; i++) {
System.out.print(mat[i][n-1] + " ");
... |
93409867-3353-4178-8f55-d49ce360c704 | 8 | private static int isTwoPairs(ArrayList<Card> list) {
assert(list.size() == EFFECTIVE_CARD_NUM);
if (containSet(list) >= 0 || isKingKong(list) >= 0){
return -1;
}
if (list.get(0).getPoint() == list.get(1).getPoint() &&
list.get(2).getPoint() == list.get(3).getPoint()) {
return list.get(2).getPo... |
2d17ff05-45f6-4fa4-a933-9ea111dc5ea0 | 0 | public void setSequence(long value) {
this._sequence = value;
} |
ed3698e4-fb29-43b5-b3e3-5563445a29f7 | 6 | @Override
public void currentUserList(String[] users) {
//System.out.println("Here i am");
if (mg != null) {
this.users = users;
String temp = "";
if (mg.getjList1() != null) {
temp = getUser(mg.getjList1().getSelectedIndex());
}
... |
a5b04312-42bd-4bf6-bcfb-d015e2d1852a | 7 | public void createFrames(){
int iter = getIterations();
frames = new BufferedImage[iter+1];
frames[0] = imageToEncryptDecrypt;
// If animation mode 0 then we need to create encryption frames.
if(getAnimationMode() == 0){
for(int i = 1; i <= iter; i++){
... |
062b9aca-501d-48b6-bb1f-7b1b244df0ec | 1 | @Test
public void testPlaceAnts() throws IOException, Exception {
System.out.println("placeAnts");
AntBrain blackBrain = new AntBrain("cleverbrain1.brain");
AntBrain redBrain = new AntBrain("cleverbrain2.brain");
World instance = new World();
instance.generateRandomContestWor... |
269384f7-0fb3-4411-9e53-0df77589b86c | 7 | protected ArrayList<ByteRange> generateUpdate(int fileSize) throws IOException {
ModificationPart modificationPart = this.getModificationPart();
int bs1, bs2, bs3 = 0;
ArrayList<ByteRange> ranges = null;
switch (modificationPart){
case B:
... |
67c07d45-fe20-44d5-8440-5b46ab38ec51 | 8 | public String[] getOptions() {
String[] superOptions = super.getOptions();
String[] options = new String[3 + superOptions.length];
int current = 0;
if (getMarkovBlanketClassifier())
options[current++] = "-mbc";
options[current++] = "-S";
switch (m_nScoreType) {
case (Scoreable.BAYES... |
62d1790c-4294-4ea6-845f-5c89fbcf7b0a | 7 | private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... |
7fcc57e7-f466-4053-b1a9-df71ec025f3a | 1 | public static synchronized Preferences getInstance() {
if (INSTANCE == null) {
throw new RuntimeException(UNINITIALIZED);
}
return INSTANCE;
} |
92268a76-b039-47a0-a647-1d29176da48c | 5 | public OpenLoop copy(){
if(this==null){
return null;
}
else{
OpenLoop bb = new OpenLoop();
this.copyBBvariables(bb);
bb.nBoxes = this.nBoxes;
bb.nSeg = this.nSeg;
bb.checkPath = this.checkPath;
bb.checkNoMix = t... |
e3d8be75-89a6-4204-bc42-9a818b010ddc | 3 | public static Image negative(Image original) {
if (original == null) {
return null;
}
Image inverse = original.shallowClone();
for (int x = 0; x < original.getWidth(); x++) {
for (int y = 0; y < original.getHeight(); y++) {
double red = original.getPixel(x, y, RED);
double green = original.getPixe... |
ee3220f3-ca3b-4b8c-951e-854a0c5ce4cd | 5 | private void bindToModelModifications() {
mProfileModel.getToolbarModel().addPropertyChangeListener(
new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
switch (evt.getPropertyName()) {
case ToolbarModel.CONTRAST_PROPERTY:
for (ItemBar iBar :... |
ce053fc2-84fb-42fc-9330-d2d44230fdb4 | 2 | public homeInfo getHome(String playerName) {
homeInfo home = null;
//String SQL = "SELECT *" + " FROM " + tblHomes + " WHERE `player` LIKE ?;";
String SQL = "SELECT *" + " FROM " + tblHomes + " WHERE `player` LIKE ?;";
try {
Connection con = getSQLConnection();
PreparedStatement statement = con... |
31d410eb-82ee-4a92-ab41-167b9ea06147 | 3 | protected String compressCssStyles(String source) {
//set default css compressor
if(cssCompressor == null) {
YuiCssCompressor yuiCssCompressor = new YuiCssCompressor();
yuiCssCompressor.setLineBreak(yuiCssLineBreak);
cssCompressor = yuiCssCompressor;
}
//detect CDATA wrapper
boolean cdataWr... |
82fd87ab-6f5b-4cb3-97a2-e10c96ec01e9 | 8 | public void paintComponent(Graphics gx) {
super.paintComponent(gx);
if (m_plotInstances != null
&& m_plotInstances.numInstances() > 0
&& m_plotInstances.numAttributes() > 0) {
if (m_plotCompanion != null) {
m_plotCompanion.prePlot(gx);
}
m_JRand = new Random(m_JitterVal);
paintAxis(... |
c0aa9d5e-2904-474b-ac4d-c5c5235b6eda | 2 | public JMenuItem findJMenuItem ( String id ) {
int i;
for( i=0; i < listOfJMenuItem.size(); i++ ) {
if( listOfJMenuItem.get( i ).getText().equals( id ) == true ) {
return listOfJMenuItem.get( i );
}
}
return null;
} |
920ba2ad-5c0b-4bdb-aa95-c3f595226729 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
@SuppressWarnings("unchecked")
PieceMovePair<Piece, Move> other = (PieceMovePair<Piece, Move>) obj;
if (move == null) {
if (other.move != nu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.