method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ccbb0d63-1783-4d08-a878-09294dff5b23 | 6 | public void moveLeft() {
Boolean ableToMove = true;
for (Block b : currentTetromino.getBlocks()) {
if ((b.getMapIndexX() == 0)
|| (tetrisMap[b.getMapIndexX() - 1][b.getMapIndexY()] == 1)) {
ableToMove = false;
}
}
if (ableToMove) {
for (Block b : currentTetromino.getBlocks()) {
tetrisMap... |
4f9807b0-eb6e-4434-bb4b-d40b6489cf26 | 1 | public void setStatic(final boolean flag) {
int modifiers = classInfo.modifiers();
if (flag) {
modifiers |= Modifiers.STATIC;
} else {
modifiers &= ~Modifiers.STATIC;
}
classInfo.setModifiers(modifiers);
this.setDirty(true);
} |
f1ab6466-f260-4974-a4a7-853eab6b49cb | 9 | @SuppressWarnings("unchecked")
public static ValuesReader createValuesReader(ValuesEntry valuesEntry){
Properties unisensProperties = UnisensProperties.getInstance().getProperties();
String readerClassName = unisensProperties.getProperty(Constants.VALUES_READER.replaceAll("format", valuesEntry.getFileFormat().getF... |
0c437853-599d-4dc9-84e5-0f80c7aac6ed | 0 | public void setErrorLog(LogFile errorLog) {this.errorLog = errorLog;} |
c534b9b3-dcab-4461-bbc7-408788ffb582 | 4 | private boolean setupSQL() {
if (config.getSQLValue().equalsIgnoreCase("MySQL")) {
dop = new MySQLOptions(config.getHostname(), config.getPort(), config.getDatabase(), config.getUsername(), config.getPassword());
}
else if (config.getSQLValue().equalsIgnoreCase("SQLite")) {
dop = new SQLiteOptions(new Fi... |
98b0fa82-22ff-4a93-b742-c649bfbf9266 | 9 | public static boolean scrapeInfo(String url) {
String[][] table = null;
int firstRealRow = 0;
boolean firstRealRowInitialized = false;
try {
Document doc = Jsoup.connect(url).get();
Elements tableElements = doc.select("table");
Elements tableRowElemen... |
3f0129cd-f97a-48b4-b32d-70199a0bf5d1 | 0 | public void setH(float h) {
this.h = h;
} |
27fb0613-28c0-41eb-a526-56d6cd2e3e70 | 2 | public void addNewScore(Score newScore) {
int newScorePoints = newScore.getPoints();
// jesli ostatni wynik jest lepszy, na pewno nie dodajemy
if (!isHighScore(newScorePoints)) {
return;
}
// wynik na pewno wyzszy niz ostatni
int i = 0;
// znajdywanie pierwszego mniejszego wyniku
while (newScorePoin... |
b92b5f37-1382-4bda-ac5d-10a23d619a93 | 4 | public BildanalysGUI(final IARDrone drone)
{
super("YADrone Paper Chase");
this.imageAnalyser = new ImageAnalyser();
this.drone = drone;
setSize(TagAlignment.IMAGE_WIDTH, TagAlignment.IMAGE_HEIGHT);
setVisible(true);
addWindowListener(new Window... |
b32f3a13-715d-4632-8e0a-414466ce751d | 1 | public MainWindow(int sizeX, int sizeY) throws Exception{
if(!frameCount){
this.sizeX = 3*sizeX;
this.sizeY = 3*sizeY;
frameCount = true;
}
else throw new Exception("Apllication is already started!");
} |
59bdb7be-9588-4c71-9537-0fce378c4669 | 1 | @Override
public void update(GameContainer gc, int d) throws SlickException {
for (TileMapLayer tileMapLayer : getLayersOrderedByImportance()) {
tileMapLayer.update(gc, d);
}
} |
a8084f7b-deef-4a7d-8d26-1dedb6e36127 | 1 | public CompareToIntOperator(Type type, boolean greaterOnNaN) {
super(Type.tInt, 0);
compareType = type;
this.allowsNaN = (type == Type.tFloat || type == Type.tDouble);
this.greaterOnNaN = greaterOnNaN;
initOperands(2);
} |
e7fb7991-28be-4da3-8b5b-c23162bf2dc1 | 8 | public void buildClassifier(Instances data) throws Exception{
//heuristic to avoid cross-validating the number of LogitBoost iterations
//at every node: build standalone logistic model and take its optimum number
//of iteration everywhere in the tree.
if (m_fastRegression && (m_fixedNumIterations < 0)) m_fixedNum... |
50d32fc4-fbbb-4acf-b642-6e8419caa909 | 4 | public void newBoard() {
hlight = new boolean[8][8];
int[] back = {2, 3, 4, 6, 5, 4, 3, 2};
int[] pawns = {1, 1, 1, 1, 1, 1, 1, 1};
Piece[] wback, wpawns, bpawns, bback;
wback = new Piece[8];
wpawns = new Piece[8];
bpawns = new Piece[8];
bback = new Piece... |
4ba8c2a2-3e76-42a3-93e8-7ac00a4369ce | 9 | private float getFloat(byte[] b) {
float sample = 0.0f;
int ret = 0;
int length = b.length;
for (int i = 0; i < b.length; i++, length--) {
ret |= ((int) (b[i] & 0xFF) << ((((bigEndian) ? length : (i + 1)) * 8) - 8));
}
switch (sampleSize) {
case 1:... |
2909e9ca-42a6-4cb4-afa3-a5f27a2422cc | 1 | @Override
protected void finalize() throws Throwable {
try {
this.stop();
}
catch (Exception exc) {
}
finally {
super.finalize();
}
} |
bd5268bb-0c26-4ed6-b8f6-bc43f3d132eb | 3 | public void setPan( float p )
{
// Make sure there is a pan control
if( panControl == null )
return;
float pan = p;
// make sure the value is valid (between -1 and 1)
if( pan < -1.0f )
pan = -1.0f;
if( pan > 1.0f )
pan = 1.0f;
... |
6dcb997f-df42-4517-b0cd-93b1c8355f0d | 6 | protected void startRelease(){
while(true){
if(this.count > this.singleConfig.getMinConns()){
Conn conn = this.pool.poll();
if(conn.getCurrentMinis() !=null && this.singleConfig.getMaxFreeInterval() != null && (System.currentTimeMillis() - conn.getCurrentMinis() > this.singleConfig.getMaxFreeInterval()))... |
6fb5dc14-7cfa-4925-9f23-c85c497c4b3a | 4 | public Properties load() {
final Properties settings = new Properties();
FileReader fr = null;
try {
fr = new FileReader(settingsFile);
settings.load(fr);
} catch (FileNotFoundException ignored) {
} catch (IOException e) {
e.printStackTrace();
} finally {
if (fr != null) {
try {
fr.clos... |
4ec8dfc5-ec2d-4232-9d68-e4e99200568d | 5 | public Packet unpackPacket(SocketAddress address, short id, byte[] data) {
if (!packets.containsKey(id)) {
throw new IllegalArgumentException("Received unknown packet with id: " + id);
}
Class<? extends Packet> packetClass = packets.get(id);
Constructor<? extends Packet> con... |
62d02e0e-6535-4d26-afb6-65b2336ed40a | 9 | protected static Ptg calcComplex( Ptg[] operands )
{
if( operands.length < 2 )
{
return new PtgErr( PtgErr.ERROR_NULL );
}
debugOperands( operands, "Complex" );
int real = operands[0].getIntVal();
int imaginary = operands[1].getIntVal();
String suffix = "i";
if( operands.length > 2 )
{
suffix =... |
95d80700-da13-438e-a031-97187f468f8d | 0 | @Override
public void add(String word) {
internalStorage.add(word);
} |
2781fdb3-a28f-4dec-9cfe-caa4b2816b71 | 0 | public InvalidBEncodingException(String message) {
super(message);
} |
4ad7e91a-0ded-4c02-bb6e-81907efdb5d2 | 6 | @EventHandler
public void WitchHunger(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.getWitchConfig().getDouble("Witch.Hunger.Dodg... |
4ceb7611-b56e-411a-b04b-302b61b572a9 | 1 | public static void main(String[] args) throws Exception
{
String tmp = "abcdef";
char[] ch = new char[tmp.length()];
tmp.getChars(0, tmp.length(), ch,0);
CharArrayReader input = new CharArrayReader(ch);
int i;
while (-1 != (i = input.read()))
{
System.out.println((char)i);
}
} |
62188070-57ad-4e3c-b728-4eeebdaed971 | 1 | public void Open() throws IOException {
BufferedReader br = new BufferedReader(new FileReader(file));
String line = null;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
} |
27f2fda4-d828-441d-9e9a-e00cfc76098a | 1 | @RequestMapping(value = "/createEntity", method = RequestMethod.POST)
public ModelAndView saveEntity(
final HttpServletRequest request,
final HttpServletResponse response,
@Valid @ModelAttribute("entityForm") final EntityForm entityForm,
final BindingResult bindingRes... |
a7d5744d-f39b-439c-a415-9535ea8f3284 | 3 | private void scanArchives() throws IOException {
for(File temp : LOLFOLDER.listFiles())
{
ArrayList<RAFFile> list = new ArrayList<RAFFile>();
for(File file : temp.listFiles())
{
if(file.getName().endsWith(".raf"))
{
... |
b1a2c897-7d7a-486f-ad6c-21b5c98ddbbf | 0 | public SimpleThread() {
super(Integer.toString(++threadCount));
start();
} |
518090cf-3724-4343-b4a5-70022dae76b0 | 7 | private void splitIrreducibleLoops() {
db(" Splitting irreducible loops");
final List removeEdges = new LinkedList();
Iterator iter = nodes().iterator();
// Iterate over all the blocks in this cfg. If a block could be
// the header of a reducible loop (i.e. it is the target of a
// "reducible backedge",... |
fccab4d3-9eb8-4223-b6ec-d7a61ef58ae3 | 3 | public boolean isCaveBG(int blockTypeId) {
boolean isCave = false;
if(blockTypeId > 0) {
BlockType bt = blockManager.getBlockTypeById((short)blockTypeId);
if(bt != null && bt.isBackground()) {
isCave = true;
}
}
return isCave;
} |
fb5b1756-a629-48a4-bf87-fe42e45b8c29 | 3 | @Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + ((address == null) ? 0 : address.hashCode());
result = prime * result + ((age == null) ? 0 : age.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
} |
054906b5-104c-4320-8066-6770e6478277 | 7 | public double computePartialTruth(QueryIterator query) {
{ IncrementalPartialMatch self = this;
{ ControlFrame baseframe = query.baseControlFrame;
PartialMatchFrame partialmatchframe = query.partialMatchStrategy;
FloatWrapper minimumscore = ((FloatWrapper)(query.options.lookup(Logic.KWD_MINIM... |
8fa9b3db-9d92-4862-8a05-1f0e825ed29d | 6 | public EasyDate beginOf(int field) {
switch (field) {
case Calendar.YEAR:
calendar.set(Calendar.MONTH, 0);
case Calendar.MONTH:
calendar.set(Calendar.DAY_OF_MONTH, 1);
case Calendar.DAY_OF_MONTH:
calendar.set(Calendar.HOUR_OF_DAY, 0);
case Calendar.HOUR_OF_DAY:
calendar.set(Calendar.MINUTE, 0);
... |
5c96d128-4d31-490d-8e73-8adf1a56766b | 2 | public static void loadSpawns() throws SQLException{
@SuppressWarnings("unused")
boolean newspawn = SpawnConfig.newspawn;
ResultSet res =SQLManager.sqlQuery("SELECT * FROM BungeeSpawns WHERE spawnname='ProxySpawn'");
while( res.next() ){
ProxySpawn = new Location(res.getString("server"), res.getString("world... |
ee92b28d-b46d-4480-8364-6aed07804657 | 2 | @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerDeath(PlayerDeathEvent event)
{
if(plugin.playerIsAffected(event.getEntity().getPlayer())) // TODO this will trigger, regardless of the death cause. Should be checking if player died from coldDamage!
{
... |
b453e30c-bea8-419d-86eb-f7eb41fe91cb | 2 | private void doCheckUser(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
String userName = StringUtil.toString(request.getParameter("userName"));
ObjectMapper mapper = new ObjectMapper();
Map result = new HashMap();
try {
User ... |
046ad596-2891-4080-bd86-8f8da0e32130 | 1 | public static void setPointLight(PointLight[] pointLights)
{
if(pointLights.length > MAX_POINT_LIGHTS)
{
System.err.println("Error: You passed in too many point lights. Max allowed is " + MAX_POINT_LIGHTS + ", you passed in " + pointLights.length);
new Exception().printStackTrace();
System.exit(1);
}
... |
64f90a8a-8c09-48e2-bca0-6a64b128cdb3 | 9 | public static void main(String[] args) {
/* Set up configuration */
Utility.configure();
jobTrackerComm =
new Communication(Utility.JOBTRACKER.ipAddress, Utility.JOBTRACKER.port);
/* Register this task tracker */
System.out.println("Registering on job tracker...");
Message msg = new Message(Utility.TA... |
c39140df-30e6-4201-afb0-1e48e593940b | 9 | protected void handleSwitchEvent(SelectionKey key)
{
SocketChannel channel = (SocketChannel) key.channel();
OFSwitch sw = _channel2Switch.get(channel);
OFMessageAsyncStream stream = sw.getStream();
try
{
// read events from the switches
if(key.isReadab... |
4286bd37-980b-47eb-bc77-6063fd701f7a | 4 | private void btnEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarActionPerformed
try{
int numero = Integer.parseInt(txt1.getText());
if(numero>0){
Statement consulta = conexion();
try{
Resul... |
0e6c7a07-6f74-40ab-859c-e40a62b0f451 | 2 | public void testgetPrefixWordsBadIndices() {
Lexicon lex = new Lexicon(true, false, false, false, false, 0.0, 0.0, null);
try {
lex.getPrefixWords(iUtt, -1);
fail("Should not allow negative indices");
}
catch (RuntimeException e) {}
try {
lex.getPrefixWords(iUtt, 1);
fail("Should not allow too hig... |
1ae3c8ce-d871-4b11-9238-f2c3344179c3 | 9 | public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
_hashCode += getBatchFileId();
_hashCode += getBatchId();
if (getContent() != null) {
for (int i=0;
i<java.lan... |
74c7359f-f54a-4b49-9f1a-5504b96208f1 | 0 | public void register(TravelTrip travelTrip){
em.persist(travelTrip);
return;
} |
b984fa7b-6b8c-4f43-ad93-b90080cc8277 | 4 | public void CheckWildrange(int pcombat)
{
if(((combat + WildyLevel >= pcombat) && (pcombat >= combat)) || ((combat - WildyLevel <= pcombat) && (pcombat <= combat)))
{
InWildrange = true;
}
else
{
InWildrange = false;
}
} |
da2d42f8-a7da-418e-8286-bef40b2b6727 | 9 | private void btn_calculateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_calculateActionPerformed
// declare the two main variables used in exponuntiation
float base = Float.parseFloat(txt_base.getText());
float exponent = Float.parseFloat(txt_exponent.getText());
txt_outpu... |
a13a2ae5-37a3-4884-9be4-1302bcf45706 | 0 | public getAvailableTimeSlot()
{
this.addParamConstraint("aUserId");
} |
485bb3ad-5117-49ed-a9e0-bf8e8f2d9404 | 7 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
f75cc80e-e9cc-4d20-93bb-0af44b794355 | 8 | private static String whoAmI(Registry registry) throws AccessException, RemoteException {
String name = null;
String[] boundServers = registry.list();
if (boundServers == null || boundServers.length == 0)
{
//Just return 1 if there are no other 0's
return String.valueOf(1);
}
ArrayList<Integer> ... |
0ccaeb04-eac9-4bdf-afb0-e220dc085292 | 8 | public List<Integer> getRow(int rowIndex) {
if (rowIndex == 0) {
return Arrays.asList(1);
}
int[] odd = new int[rowIndex / 2 + 1];
int[] even = new int[rowIndex / 2 + 1];
odd[0] = 1;
even[0] = 1;
for (int i = 0; i < rowIndex / 2; i++) {
for (int j = 1; j < i + 1; j++) {
even[j] = odd[j - 1] + o... |
5117ebdd-6f84-4606-b3da-8e61b2c4d43c | 8 | public boolean onCommand (CommandSender sender, Command cmd, String lable, String[] args)
{
Player p = (Player) sender;
PluginDescriptionFile pdf = this.getDescription();
try
{
if(sender instanceof Player)
{
if(lable.equalsIgnoreCase("gp"))
{
if (args[0].toLowerCase().equalsIgnoreCase("re... |
872d7075-4fa4-426b-954d-390ec3faa10f | 7 | public static void testSet() {
SeqnoRange range=new SeqnoRange(10, 15);
range.set(11, 12, 13, 14);
System.out.println("range=" + print(range));
assert range.size() == 6;
assert range.getNumberOfReceivedMessages() == 4;
assert range.getNumberOfMissingMessages() == 2;
... |
ae151069-5b6c-469f-baba-fd34b294f6c6 | 9 | public static boolean insertCurriculum(UserBean bean){
Statement stmt = null;
Curriculum curriculum=((AlumnoBean)bean).getCurriculum(); // OJO CON ESTA LINEA, DEBERIA FUNCIONAR
String query= "Insert into curriculums values ("+curriculum.getId()+","+bean.getRut()+",NOW())";
System.out.println(query);... |
d145641a-8a05-4548-9dc6-b63049af1ab3 | 6 | private ArrayList<Integer> generateActions(LongBoard state) {
ArrayList<Integer> result = new ArrayList<Integer>();
int middle = x/2;
//TODO choose random when x is even
if (state.isPlayable(middle)) {
result.add(middle);
}
for (int i=1; i <= x/2; i++) {
... |
2465d438-c1e1-4f2a-89c7-15a025286915 | 3 | public Player(float x, float y,GBGame game, TiledMapTileLayer layer) {
this.game = game;
this.collisionLayer = layer;
// Load up the stuff
try {
currentSprite = new Sprite(Art.player[0][0]);
} catch (Exception e) {
System.out.println("SPRITE NOT LOADING! TRY AGAIN!");
}
bounds = new Rectangle();
... |
4faa5f31-295c-49d0-a772-aa97cac89d0f | 8 | public DirectedEulerianCycle(Digraph G) {
// create local view of adjacency lists
Iterator<Integer>[] adj = (Iterator<Integer>[]) new Iterator[G.V()];
for (int v = 0; v < G.V(); v++)
adj[v] = G.adj(v).iterator();
// find vertex with nonzero degree as start of potential Eule... |
a2389aa7-5390-4d91-8f74-0807bedc6ec3 | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TabelOutletChain other = (TabelOutletChain) obj;
if (!Objects.equals(this.kodeChain, other.kodeChain)) {
... |
05020ac9-596e-4c46-a2fa-3c3a5607e5b6 | 8 | public static Object escape(Object original) {
if (original instanceof Character) {
char u = (char) ((Character)original);
int idx = "\b\t\n\f\r\"\'\\".indexOf(u);
if (idx >= 0)
return "\\"+"btnfr\"\'\\".charAt(idx);
if (u < 32)
re... |
9bcb1c93-6fdb-4b46-8857-d0a1772ecd7f | 9 | @Override
public void broadcast(final FacesEvent event) throws AbortProcessingException {
super.broadcast(event);
FacesContext context = getFacesContext();
if (!(event instanceof ActionEvent)) {
throw new IllegalArgumentException();
}
// OPEN QUESTION: should w... |
0bb948c9-0e63-4599-b919-6d64b0ae1cf3 | 3 | private int getStep() {
LayoutManager layout = getLayout();
if (layout instanceof ColumnLayout) {
return ((ColumnLayout) layout).getColumns();
} else if (layout instanceof FlexLayout && ((FlexLayout) layout).getRootCell() instanceof FlexGrid) {
int columns = ((FlexGrid) ((FlexLayout) layout).getRootCell()).... |
74920592-b0f9-4e3c-b988-80b5b29074fa | 8 | private StringBuilder getGallery() throws ClassNotFoundException, SQLException {
StringBuilder sb = new StringBuilder();
Reference r = References.createReference(this.id);
List<Gallery> galleries;
galleries = r.getGalleries();
if (galleries.size() > 0) {
sb.append("... |
e00351db-0e36-447a-9f4c-e459fc92cd38 | 4 | private void showGezin(Gezin gezin) {
// todo opgave 3
if (gezin == null) {
clearTabGezin();
} else {
tfGezinNr.setText(gezin.getNr() + "");
tfOuder1.setText(gezin.getOuder1().standaardgegevens());
if(gezin.getOuder2() != null)
tfOu... |
d7545105-55ff-41cc-b5b9-79ae191c3145 | 1 | private String chooseFile()
{
if (chooser.showDialog(org.analyse.main.Main.analyseFrame, null) == JFileChooser.APPROVE_OPTION) {
return chooser.getSelectedFile().getAbsolutePath();
}
return null;
} |
7f5a5623-bb99-4aa1-bba3-c3a4f506c70f | 3 | public void copySources(HashMap<String, Source> srcMap) {
if (srcMap == null)
return;
Set<String> keys = srcMap.keySet();
Iterator<String> iter = keys.iterator();
String sourcename;
Source srcData;
// remove any existing sources before starting:
sourceMap.clear();
// loop through and copy all the s... |
569c39b0-8cdb-4dee-a1a4-26e29d72a3fb | 9 | final boolean method810(int i, int i_2_, boolean bool, GraphicsToolkit graphicstoolkit) {
anInt11104++;
if (aNpcDefinition11122 == null || !method875(131072, true, graphicstoolkit)) {
return false;
}
Class336 class336 = graphicstoolkit.A();
int i_3_ = aClass99_10893.method1086(16383);
class336.method3860... |
dd48c4d5-886e-4243-a5bc-203c812c7848 | 0 | public void setStartCity(String startCity) {
this.startCity = startCity;
} |
69b287ec-329e-40a0-a5c3-b810615cacfd | 6 | private void isCorner() {
if (localMap.getPosition().getCorridor(0).getWeight() == 1
&& (localMap.getPosition().getCorridor(1).getWeight() == 1 || localMap
.getPosition().getCorridor(3).getWeight() == 1)) {
corner = true;
}
else if (localMap.getPosition().getCorridor(2).getWeight() == 1
&& (loca... |
aee4c7af-6ec6-489b-ab43-d371efddb3e4 | 3 | @Override
public void broadcast(String flName, TreeMap<Long, String> mapValues)
throws RemoteException {
if (!fileLock.containsKey(flName))
fileLock.put(flName, new ReentrantReadWriteLock());
// lock
fileLock.get(flName).writeLock().lock();
try {
System.out.println("Broadcasting to : " + replicaPath... |
7e8bf99b-527c-4230-a313-c7f5057171d8 | 6 | public void run(double frac) {
TupleSet ts = m_vis.getFocusGroup(Visualization.FOCUS_ITEMS);
counter = (counter + 1) % 9;
if (ts.getTupleCount() == 0)
return;
if (counter == 8) {
int xbias = 0, ybias = 0;
switch (m_orientation) {
case Constants.ORIENT_LEFT_RIGHT:
xbias = m_bias;
... |
ef60c457-efc5-459d-a6ac-24ba8a8f0093 | 2 | public void sendReplyFlooding(){ //Dispara o flooding das respostas dos nodos com papel BORDER e RELAY
if ((getRole() == NodeRoleOldBetEtx.BORDER) ||
(getRole() == NodeRoleOldBetEtx.RELAY)) {
this.setColor(Color.GRAY);
//Pack pkt = new Pack(this.hops, this.pathsToSink, this.ID, 1, this.sBet, TypeMessage.BOR... |
2057960f-740a-4460-bae8-2a9a9af1607b | 6 | @Test
public void testReceiveMultipleWithBound() {
int noOfMessages = 5;
int queueSize = 2;
try {
consumer = new AbstractMessageConsumer(mockTopic, queueSize) {
};
assertNotNull(mockTopic.getTopicSubscriber());
HashSet<Message> messages = new HashSet<Message>();
for (int i = 0; i < noOfMessages; ... |
2bb697fc-13c3-4aaf-9cb7-e15cc634bc8c | 2 | public void removeRestriction(String restrictionIdentifier)
{
for(Restriction r: restrictions){
if(r.getIdentifier().equals(identifier))
restrictions.remove(r);
}
} |
e0633e87-5241-46f1-b44a-65a9c32663f4 | 0 | public static Color getColor(int c, int r) {
int x = (int) (firstPick.getX() + c * (cellWidth + cellPadding));
int y = (int) (firstPick.getY() - r * (cellWidth + cellPadding));
return Main.fenrir.getColor(x, y);
} |
1ad213b7-0700-4a21-bf7a-8625d0ddf670 | 2 | @Override
public boolean equals(Object other) {
if (other == this) { return true; }
if (!(other instanceof Bearing)) { return false; }
return this.getBearingInDecimalDegrees().equals(((Bearing) other).getBearingInDecimalDegrees());
} |
86b65f46-1c24-45a5-b12b-1a6247e29da0 | 0 | public String getMsgID() {
return MsgID;
} |
94d5376f-6cbc-43d1-bfa2-4fc0a832e23e | 0 | public LocQueue() {
init();
} |
93125004-5547-4c2d-a001-5df626b28498 | 9 | @Override
public void unInvoke()
{
if((trapType()==Trap.TRAP_PIT_BLADE)
&&(affected instanceof Exit)
&&(myPit!=null)
&&(canBeUninvoked())
&&(myPitUp!=null))
{
final Room R=myPitUp.getRoomInDir(Directions.UP);
if((R!=null)&&(R.getRoomInDir(Directions.DOWN)==myPitUp))
{
R.rawDoors()[Directions.... |
7f938dde-8d85-4bd0-bcb9-f72ea7986795 | 7 | @Override
public Success<Import> parse(String s, int p) {
// Parse the "import" keyword.
Success<String> resImport = IdentifierParser.singleton.parse(s, p);
if (resImport == null || !resImport.value.equals("import"))
return null;
p = resImport.rem;
p = optWS(s, p)... |
7f31ddbb-6c7d-40a3-97c3-459dbb95372c | 6 | private Status.TermVectorStatus testTermVectors(SegmentInfo info, SegmentReader reader, NumberFormat format) {
final Status.TermVectorStatus status = new Status.TermVectorStatus();
try {
if (infoStream != null) {
infoStream.print(" test: term vectors........");
}
for (int j = ... |
39be1188-e5d5-4714-bcce-fad30cfc48eb | 9 | @Override
public boolean onCommand(final CommandSender sender, Command cmd, String label, String[] args) {
if (label.equalsIgnoreCase("oreevent")) {
if (sender instanceof Player) {
plugin.reloadConfig();
if (plugin.getConfig().getString("orex") == null) {
... |
95b8a71e-1c81-4659-9663-098ca36414f8 | 6 | public boolean move(Location from, Location to) {
if (to != Location.B3 && to != Location.R3) {
System.out.println("GAME: moving from " + from + " to " + to);
if ( from == loneRiderHere1 ) {
loneRiderHere1 = to;
} else if ( from == loneRiderHere2 ) {
loneRiderHere2 = to;
}... |
f52a9757-4478-43b5-ae84-81f0f26eab9c | 0 | public Capteur(int date1, int id1, int taille1) {
super(date1, id1, taille1);
} |
21a8eb79-6f6c-4916-a46b-9a7ce97714a5 | 5 | public static String getSelectString(Dictionary dictionary, Class c){
StringBuilder stringBuilder = new StringBuilder();
ArrayList <Dictionary> dictionaries = null;
Field field;
Object val = new Object();
try {
field = c.getField("TABLE");
val = field.get(... |
d17c3025-5da1-41d4-a36f-58af18a84c8b | 4 | private TreeNode successor(TreeNode predecessorNode) {
TreeNode successorNode = null;
if (predecessorNode.left != null) {
successorNode = predecessorNode.left;
while (successorNode.right != null) {
successorNode = successorNode.right;
}
} else {
successorNode = predecessorNode.parent;
while (s... |
e9a8c916-d66a-49d6-89cd-6ae6e30aefae | 8 | protected SSLServerSocketFactory createFactory()
throws Exception
{
_keystore = System.getProperty( KEYSTORE_PROPERTY,_keystore);
log.info(KEYSTORE_PROPERTY+"="+_keystore);
if (_password==null)
_password = Password.getPassword(PASSWORD_PROPERTY,null,null);
... |
b18c0864-89e0-458e-a8d8-87ca7ca30207 | 6 | public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
... |
b80dafdd-f39f-42db-84f2-1f247a9b9f22 | 8 | * @param input
*/
public static void writeHtmlEscapingUrlSpecialCharacters(PrintableStringWriter stream, String input) {
{ char ch = Stella.NULL_CHARACTER;
String vector000 = input;
int index000 = 0;
int length000 = vector000.length();
for (;index000 < length000; index000 = index000 + ... |
ed4e041d-bb71-4f73-ae83-2137c4f83076 | 0 | public void addSettingsGuiListener(SettingsGuiListener listener_) {
settingsGuiListener.add(listener_);
} |
573cd886-6254-4c05-989d-cbc81692b94f | 4 | public static void buildGroup(ContactGroupEntry group,
List<String> parameters) {
for (String string : parameters) {
if (!string.startsWith("--")) {
throw new IllegalArgumentException("unknown argument: " + string);
}
String param = string.substring(2);
String params[] = param... |
57a94b9d-1b51-49c9-ac3f-0d61c23293dc | 3 | public Link<T> getUnvisitedLink(Summit<T> summit) {
for (Link<T> link : links) {
if ( link.visited==false && link.start.label.equals(summit.label) ) {
link.visited=true;
return link;
}
}
return null;
} |
870e1921-72e9-41b5-9676-92f266fab874 | 4 | void checkNewVersion(Config config) {
// Download command checks for versions, no need to do it twice
if ((config != null) && !command.equalsIgnoreCase("download")) {
// Check if a new version is available
VersionCheck versionCheck = VersionCheck.version(SnpEff.SOFTWARE_NAME, SnpEff.VERSION_SHORT, config.getV... |
1bd4d288-36b0-494b-a941-9d63528f4960 | 8 | public FixtureBuilder() {
fileParser = new FileParser(KEYS);
List<File> files = FileUtils.getFiles("fixtures/");
for (File file : files) {
try {
Fixture fixture = buildFixture((FileUtils.readFile(file)));
String missingKey = FileValidator.isValid(fixture, REQUIRED_KEYS);
if (missingKey == null) {
... |
aec43faa-5b0d-43bb-96b7-90a610bc0256 | 3 | @Override
public void mouseClicked(MouseEvent e) {
if (PlayerTypes.values()[raceSelectionPointer].getColors() != null)
for (int i = 0; i < PlayerTypes.values()[raceSelectionPointer].getColors().length; i++)
if (new Rectangle(getWidth() / 2 - getWidth() / 8 + getWidth() / 32 + i % 2 * getWidth() / 8,
get... |
1b3098b4-d50b-4d0b-a1cc-35b41f93b5fd | 8 | private boolean bfs() {
Queue<Integer> q = new ArrayDeque<Integer>();
//initialize distances
for(int i = 1; i < n; i++) {
if(match[i] == NIL) {
dist[i] = 0;
q.add(i);
} else
dist[i] = INF;
}
dist[NIL] = INF;
while(!q.isEmpty()) {
int u = q.poll();
if(DEBUG) System.out.format... |
b3060e65-7ca7-46c2-8712-f054ef1d5490 | 1 | private void onFirstStatChanged(Stat newStat) {
for (StatProcessorListener listener: listeners) {
listener.onFirstStat(newStat);
}
} |
3903f880-18d6-40c2-86a7-72f607c5dfcf | 7 | @POST
@Path("/Login")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response Login (UserResponse data)
{
if (data == null
|| data.password == null
|| data.username == null)
return Response
.status(400) //... |
09dddba6-982c-499d-9eb4-71987c5032d2 | 4 | private int readAndCheckInput(int low, int high) throws IOException {
BufferedReader move = new BufferedReader(new InputStreamReader(System.in));
boolean bool;
int in = 0;
do {
try {
in = Integer.parseInt(move.readLine());
bool = false;
... |
a06f4074-9791-4da0-bf59-54e5f901eb52 | 8 | public void addComponent(Component component, Location location){
switch(location){
case TOP:
add(component,BorderLayout.PAGE_START);
components.add("TopComponent", component);
break;
case BOTTOM:
if(components.get("TopComponent") != null){
remove(components.get("TopComponent"));
components... |
e423e7b1-6a24-45c3-95cc-fcd8acc9d40b | 0 | public void setStartUrl(String startUrl) {
this.startUrl = startUrl;
} |
2aed8a5f-ee1c-45bd-a820-035b9957f0d6 | 7 | static void test2()
{
try
{
Reader in = new StringReader(
"<INPUT TYPE=HIDDEN NAME=\"MfcISAPICommand\" VALUE = \"MailBox\">\n"+
"<applet code=\"htmlstreamer.class\" codebase=\"/classes/demo/parser\"\nalign=\"baseline\" width=\"500\" height=\"800\"\nid=\"htmlstreamer\">\n"+
"<!DOCTYPE HTML PUBLIC \"-... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.