method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e28be2dd-8dc6-40e9-8ec0-09e417e01e89 | 2 | public void noteOn(int note, int velocity) {
//search through the voices to find one that's available and press it
for (int i = 0; i < voices.length; i++) {
if (!voices[i].isInUse()) {
voices[i].press(note, velocity);
break;
}
}
} |
f7e84d54-b1b4-4aa2-83e9-684f50510a79 | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Physical target=mob.location();
if(target==null)
return false;
if(target.fetchEffect(ID())!=null)
{
mob.tell(L("This place is already a blood hearth."));
return false;
}
if(!s... |
c7e9d4ed-3d95-4fee-8794-86ec375a86f0 | 3 | protected void forwardAction(String className){
Point currentLocation = myFrame.getLocation();
myFrame.setVisible(false);
try{
Class<?> clazz = Class.forName(className);
Constructor<?> con = clazz.getConstructor(Point.class);
con.newInstance(currentLocation);
} catch(Exception e){
System.out.println... |
7bedf169-804b-4bfe-9f6e-fe3678eec445 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Ticket other = (Ticket) obj;
if (code == null) {
if (other.code != null)
return false;
} else if (!code.equals(other.code))
return fa... |
562475a8-58fc-44fd-a6f4-751024b6103d | 3 | public void changeVolume(VolumeControlGUI vc,int newVolume)
{
if(vc != null)
{
for(int i=0; i<list.capacity(); i++)
{
//only change the volume, if this slider does not changed the volume
if(list.get(i) != vc)
{
list.get(i).setVolume(newVolume);
}
//finally set it in the sound sy... |
917ead7c-ecfb-4bfb-b911-23c29c6b2cbc | 9 | private void useData(String line)
{
int data[] = convertData(line);
if(data[0] == 1 && !logedin)
{
login(data);
}
if(data[0] == 2)
{
//gets the best scores.
List<MysqlPlayerScore> scores = getBestScore(data[1],true);
//formats a message to send.
String message = "/pBestS;";
i... |
295bef57-9e54-49a3-b425-493adb59fc24 | 4 | public void run(int pumpCount, int attendantCount, int duration){
makePumps(pumpCount);
makeAttendants(attendantCount);
for (int i=0;i<duration;i++){
carQueue();
while(freePump()&&l.hasNext()&&freeAttendant()){
tryToFill();
}
nextFrame();
}
} |
3d6b9a12-c6d3-4916-ab2a-0edf2d87c312 | 6 | public String getMask() {
StringBuilder mask = new StringBuilder();
// Build Flag mask
mask.append(isMemory() ? "1" : "0");
mask.append(isOverflow() ? "1" : "0");
mask.append(isNot() ? "1" : "0");
mask.append(isCarry() ? "1" : "0");
mask.append(isNegative... |
fb6b7947-88f2-4d94-b0e1-75b2ec7f8e35 | 9 | public boolean valid(int tableIndex, int columnIndex, String value) {
boolean result = true;
boolean findColumn = false;
boolean or = false;
boolean nonFilter = true;
if(tableIndex == 1){
System.out.println("This is Date");
}
for (String filter : filters) {
if(tableIndex == 1){
System.out.printl... |
59cd0620-a755-4a27-b99e-584bd26784d6 | 5 | public static <GInput, GOutput> Pointer<GOutput> convertedPointer(final Converter<? super GInput, ? extends GOutput> converter,
final Pointer<? extends GInput> pointer) throws NullPointerException {
if (converter == null) throw new NullPointerException("converter = null");
if (pointer == null) throw new NullPoint... |
968e1c45-1ed9-4cc7-b6e3-dc6aa98a1dcf | 7 | public RegisterServiceType() {
setTitle("Tipo de Servi\u00E7o");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 500, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JScrollPane scrollPan... |
9a49ba2b-0d28-457b-b0a4-f87837fdb4ac | 0 | public static int critRate(int uCrit, int eLuk)
{
return Math.min(uCrit - eLuk, 100);
} |
e5ac4413-7c86-4d83-91f2-65a100aa319e | 7 | @Override
public void onFTP(
final String senderIP,
final String senderName,
final String fileName,
final String fullpath,
final int socketNo,
final long fileLength) {
//
// Process this ftp request with a thread so that
... |
b18de829-e8e7-4531-81e3-679cdbb672f2 | 5 | public EvaluationResult evaluate(List inputs, EvaluationCtx context) {
// Evaluate the arguments
AttributeValue [] argValues = new AttributeValue[inputs.size()];
EvaluationResult result = evalArgs(inputs, context, argValues);
if (result != null)
return result;
// No... |
f3966bc9-9a46-4d26-888e-17309f7750c8 | 5 | public static void main(String[] args) {
try {
System.out.println("Starting...");
CycAccess cycAccess = new CycAccess("public1", 3600);
InferenceParameters parameters = new DefaultInferenceParameters(cycAccess);
parameters.put(new CycSymbol(":MAX-NUMBER"), new Integer(10));
parameters.... |
79862a2f-75e0-4953-ae0e-a38ed9e2614b | 2 | public void run() {
while (run == true) {
try {
udpSocket.receive(datagram);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("Received!");
System.out.println(run);
}
} |
9feb486b-88bc-4ae9-9630-69019ffecdd5 | 8 | @Override
public LegendItem getLegendItem(int datasetIndex, int series) {
CategoryPlot cp = getPlot();
if (cp == null) {
return null;
}
if (isSeriesVisible(series) && isSeriesVisibleInLegend(series)) {
CategoryDataset dataset = cp.getDataset(datasetIndex);
... |
8692927c-cee0-4808-a697-dc33f1fd3747 | 6 | private Document _checkResponse(final String response) {
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
// Get and parse into a document
final DocumentBuilder db = dbf.newDocumentBuilder();
final Document doc = db.parse(new InputSource(new StringReader(response)));
// Na... |
3e124e29-01e9-4a54-9a7f-b8522ee6d528 | 8 | public void setLisState(int num){
if(num == 1){
currentState = LisState.LINE;
}else if(num == 2){
currentState = LisState.DRAW;
}else if(num == 3){
currentState = LisState.TRIANGLE;
}else if(num == 4){
currentState = LisState.ERASE;
... |
8aa96f3f-e6db-4361-aa6e-4094a654e0e5 | 9 | public void run() {
try {
boolean running = true;
while (running) {
try {
String line = null;
while ((line = _breader.readLine()) != null) {
try {
_bot.handleLine(line);
... |
5245e3bd-c8d3-44d8-8786-041555eb24fa | 7 | public InetAddress getFirstNonLoopbackAddress(boolean preferIpv4, boolean preferIPv6) throws SocketException {
Enumeration en = NetworkInterface.getNetworkInterfaces();
while (en.hasMoreElements()) {
NetworkInterface i = (NetworkInterface) en.nextElement();
for (Enumeration en2 = i.getInetAd... |
5f661fa9-2647-413d-9229-8781cc878a9f | 9 | public String getImgCodeManual(String url) throws IOException {
url = url + RandomUtil.getJSRandomDecimals();
String imageCode = "";
String fileSuffix =".gif";
if(url.contains("CreateCode2")){
fileSuffix =".jpg";
}
String fileName = Util.generateUUID() + fileSuffix; // 生成唯一的id
String imgDir = ... |
ad714ea7-3329-40c1-a54d-ab1a04641b2c | 9 | public void propertyChange(PropertyChangeEvent e) {
String propertyName = e.getPropertyName();
if (!Task.PROP_DONE.equals(propertyName)) {
return; // sca
}
Task<?, ?> task = (Task<?, ?>) e.getSource();
if (task.isDone()) {
List... |
5b664d02-93c6-4bc9-8e3f-6bff7261d2b3 | 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... |
22af9d42-fa92-4c36-a10c-80c89404de5c | 5 | public boolean summon(Familiar familiar) {
if (!canSummon(familiar)) {
return false;
}
// Close bank
if (ctx.bank.opened()) {
ctx.bank.close();
ctx.sleep(500);
}
final Item pouch = ctx.backpack.shuffle().poll();
if (ctx.hud.open(Hud.Window.BACKPACK)) {
ctx.sleep(400);
return pouch.valid()... |
6b5c6458-f1ff-4266-8882-55ab39079598 | 8 | protected void naughtyCalculation(){
//Enable Naughty Lists Buttons if applicable
if(labs.exists()){
ArrayList<Student> studs = new ArrayList<Student>();
for(Student s: output.getFlagged()){
if(s.getFlaggedForLabs())
studs.add(s);
}
flaggedLabs.setText("Flagged for Labs - " + studs.size());
... |
4c45a8fe-ce4a-41fd-b684-485858c18aa2 | 8 | public static void main(String[] args) {
final String SAT = "sat";
final String UNSAT = "unsat";
int n = 0;
LocalSearchSAT lss = new LocalSearchSAT();
File satFolder = new File(SAT);
boolean checkSAT = true;
for (File file : satFolder.listFiles()) {
ClauseSet clauseSet = Parser.get(file);
System.o... |
218ec358-97c5-4f79-9d57-4993c85e0f46 | 5 | public String bestEpToString() {
String string = "";
for (HardwareSetAlternative hardwareSetAlternative : hardwareSystem.getHardwareSetAlternatives()) {
string += hardwareSetAlternative + " hosts ";
for (DeployedComponent deployedComponent : deploymentEP.getDeployedComponents())
if (deployedComponent.getH... |
16a40d6e-0818-4102-b8c4-fd2569c587ce | 7 | protected double[] missingValueStrategyAggregateNodes(double[] instance,
Attribute classAtt) throws Exception {
if (classAtt.isNumeric()) {
throw new Exception("[TreeNode] missing value strategy aggregate nodes, "
+ "but class is numeric!");
}
double[] preds = null;... |
f44d8d18-8a93-4d24-a658-bdf167409236 | 0 | public void setName(String name) {
this.name = name;
} |
a1ada5d6-3435-458f-b8a7-4afba5561735 | 8 | public void ViewCountAndCrowdSize(AbstractApi api )
{
Search info = new Search();
info.Init();
String tag = api.MainTag;
try
{
String qTable = tag + "questions_table";
String aTable = tag + "answers_table";
info.CreateTemporaryTable(tag, qTable);
info.CreateTemporaryRelatedTable(tag, aTable, qTa... |
a9e994dc-9b9e-474e-b178-c3ee6e09c12e | 4 | public void destruct() {
if(mySock == null) return; // already shutdown
try {
misc.println("ClientHandler: Client "+playerName+" disconnected.");
disconnected = true;
if(in != null) in.close();
if(out != null) out.close();
mySock.close();
mySock = null;
in = null;
out = null;
inStream =... |
90aee7e2-5c37-4e41-89e7-ef1611758be8 | 1 | private String lngTip() {
String tt = shrtTip();
if (tt != null) {
tt += "\nResource: " + GetResName();
}
return tt;
} |
07f87d80-288b-4ebe-90aa-250d2096b5ae | 2 | public boolean modifyBookCatalogue(int id, BookCatalogue bc){
if(id != 0){
String sql = "update book_catalogue set name=?, description=? where id=?";
try{
PreparedStatement ps = con.prepareStatement(sql);
ps.setString(1, bc.getName());
ps.s... |
b653fd6c-dfaa-46ef-87e3-112d7ef136e2 | 0 | public Filter or( Filter other )
{
return new Or( this, other );
} |
206932ce-b8c3-4411-8d47-2481666ec2ae | 9 | private void prepare() {
if (prepared) {
return;
}
if (elementConverter == null) {
if (classLoader == null && elementClass != null) {
classLoader = elementClass.getClassLoader();
}
elementConverter = Converters.bestConverter(elementClass, classLoader);
}
if (compressElement) {
ele... |
6eed8514-f8fd-42af-b12d-74f20377b1ed | 4 | Bot(Datamodel datamodel, Link url) {
if (Bot.linksFromUrl == -1) {
Bot.linksFromUrl = Integer.parseInt(Config.getInstance().get(
"LinksFromUrl"));
}
if (Bot.maxDoLinks == -1) {
Bot.maxDoLinks = Integer.parseInt(Config.getInstance().get(
"MaxDoLinks"));
}
if (Bot.maxTextSize == -1) {
Bo... |
70e326f1-b0d3-41be-abd5-48d9bc1a93be | 3 | public Expression negate() {
if (getOperatorIndex() == LOG_AND_OP || getOperatorIndex() == LOG_OR_OP) {
setOperatorIndex(getOperatorIndex() ^ 1);
for (int i = 0; i < 2; i++) {
subExpressions[i] = subExpressions[i].negate();
subExpressions[i].parent = this;
}
return this;
}
return super.negate(... |
71b46f1f-b249-47a5-89d3-564498d03b78 | 1 | @Override
public TVC clone() {
try {
return (TVC) super.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException("fatal", e);
}
} |
24c0c9b6-444c-4bde-b038-02490ed5ec88 | 0 | public Programmetajs() {
} |
3dc25c0c-1c99-4555-8349-7d82bd246fca | 9 | protected static Ptg calcBin2Hex( Ptg[] operands )
{
if( operands.length < 1 )
{
return new PtgErr( PtgErr.ERROR_NULL );
}
debugOperands( operands, "BIN2HEX" );
String bString = operands[0].getString().trim();
int places = 0;
if( operands.length > 1 )
{
places = operands[1].getIntVal();
}
//... |
6824fbf7-1689-4dab-a1db-8a4dcfbeb269 | 4 | @DataProvider(name = "group_tests")
public Iterator<Object[]> groupCommandsData() throws IOException {
CSVReader csvReader = new CSVReader(new FileReader(TESTS_FILENAME));
List<Object[]> commandBlocks = new ArrayList<Object[]>();
CommandDataBuilder builder = new CommandDataBuilder();
... |
21f79695-9491-49c7-be7a-3fc63375f8b6 | 5 | public final V get(final K key) {
this.querycount++;
final HashCounter hc = new HashCounter(key);
if (hc.minCounter == 0) return null;
Entry<K,V> e = new Entry<K,V>(key);
V r = null;
if (!pruned) {
Integer index = off[hc.mli].indexOf(e);
if (index == -1) {
this.fpcount++;
return r;
}
r =... |
7837ad82-0535-4b23-afca-1fffb01b3001 | 9 | @Override
public boolean onCommand(final CommandSender sender, Command cmdObj, String label, final String[] args) {
if(!(sender instanceof Player)) {
return false;
} else {
if(!((Player)sender).hasPermission("kitpvp.setspawnpoint")) {
sender.sendMessage(ChatColor.RED + "You do not have permission to ... |
379d826e-d555-4e46-9f33-6032538c5172 | 3 | public void setIntArr(TIntArr node)
{
if(this._intArr_ != null)
{
this._intArr_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
... |
03b28da1-16a2-42d8-9448-a0d963ade8ca | 9 | public void dreheZu(double pWohinH, double pWohinV)
{
if ((pWohinH != this.zStiftH) || (pWohinV != this.zStiftV))
{
if (pWohinH == this.zStiftH) {
if (pWohinV > this.zStiftV)
this.zWinkel = 270.0D;
else
this.zWinkel = 90.0D;
}
else if (pWohinV ==... |
0df9e452-fa01-48fb-8058-ab91b86f2376 | 9 | @Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Exam other = (Exam) obj;
if (mark == null) {
if (other.mark != null) {
return false;
}
} else if (!mar... |
cd7831c8-79b1-4f06-ab4d-0fe73562b61e | 4 | public int numOwners(){
int ownerCounter = 0;
ArrayList<String> nameOfOwners = new ArrayList<String>();
for(int i = 0; i < listOfUnits.size(); i++){
nameOfOwners.add(listOfUnits.get(i).getOwner().getName());
ownerCounter++;
}
for(int i = 1; i < nameOfOwners.size(); i++){
for(int j = i; j < nameOfOwn... |
779aa276-e01b-4413-a561-d4dc1fa21fb7 | 6 | public Future<?> execute() {
while(!queue.isEmpty()) {
checkToInterrupt();
if(future == null || future.isCancelled() || future.isDone()) {
callee = queue.poll();
if(callee != null) {
future = executor.submit(callee);
... |
b776a502-538b-48d1-977d-0794d429bb93 | 4 | private boolean buyBuildingSpecific(Player player , CastleBuilding b)
{
if (player.getResource(ResourceType.GOLD) > b.cost.gold &&
player.getResource(ResourceType.WOOD) > b.cost.wood &&
player.getResource(ResourceType.ORE) > b.cost.ore &&
!isBuyed()) {
player.addResource(ResourceType.GOLD, -b.cost.go... |
d8874c8a-2551-410f-a193-dd880f8e9ccb | 5 | public void asignarABodega()
{
for(int i=0;i<carros.size();i++)
{
if(!carros.get(i).getCargado())
{
//Creando nuevo Camino[] eliminando el camino a bodega (que est� en la �ltima posici�n)
Camino[] nuevo = new Camino[conjuntoCaminos.get(i).length-1];
for(int j=0;j<conjuntoCaminos.get(i).len... |
ec6314bf-c0df-480f-b66a-02f02a0a95a3 | 8 | public static GbAudio rewriteTo4bitFancy(short[] samples) {
int len = samples.length / 2;
int[] outSamples = new int[len * 2];
int[] soValues = new int[len];
for (int pos = 0; pos < len; pos++) {
int minSoError = Integer.MAX_VALUE;
int minSoErrorSo = 0;
for (int so = 0; so < 8; so++) ... |
28d61203-daa2-496d-9684-210dc5398a4e | 4 | public Combo_Box_Remove_Account() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException
{
//MAIN FRAME
super("Team J's Scheduler | Remove Account");
setBounds(50,50,500,300);
setResizable(false);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setLayout(null);
... |
f3c8ee85-98dd-4933-9e20-097a0ea2a2af | 2 | public void test_add_long_long() {
assertEquals(567L, iField.add(567L, 0L));
assertEquals(567L + 1234000L, iField.add(567L, 1234L));
assertEquals(567L - 1234000L, iField.add(567L, -1234L));
try {
iField.add(LONG_MAX, 1L);
fail();
} catch (ArithmeticExcepti... |
64305548-6baa-446a-834b-c2a7f99b9865 | 5 | public Writer write(Writer writer) throws JSONException {
try {
boolean b = false;
int len = length();
writer.write('[');
for (int i = 0; i < len; i += 1) {
if (b) {
writer.write(',');
}
Obj... |
3f4a8cef-8c1d-44e4-a50e-16d104bce5cb | 0 | public ROJoystickHandler() {
controllers = null;
activeControllers = new ArrayList<JInputController>();
} |
b69a7f9e-e876-49cf-8a17-0abbddd76520 | 2 | @Override
public int compareTo(PriorityItem item) {
if(this.priority != item.priority) {
return this.priority - item.priority;
}
if( o instanceof Number) {
return(((Number)this.o).intValue() - ((Number)item.o).intValue());
}
return 0;
} |
9499b04e-7f50-4aa3-8f3e-94f640c89939 | 9 | public void parseFile()
{
Element element = xmlDocument.getDocumentElement();
NodeList nl;
getFileName(element);
// parse CodeLists from DSD
nl = element.getElementsByTagName("CodeLists");
if(nl != null && nl.getLength() > 0)
{
for(int i = 0 ; i < nl.getLength();i++)
{
Element ele = (Elem... |
444023f9-c663-4895-8d10-6a48f705d710 | 3 | private void splitDown(ColorPatch patch, int x, int y) {
if ( ++y < image.getHeight() ) {
Color color = pixel(x, y);
if ( isIncluded(x, y) ) {
if ( patch.getColor().distance(color, Color.RGB_DISTANCE) < tolerance ) {
patch.add(color);
goLeft(patch, x, y);
goRight(patch, x, y);
splitDown(... |
5b715f31-1fcd-4e09-bdae-43eba78bfea8 | 5 | @Override
public void onEnable() {
if (getServer().getPluginManager().getPlugin("Vault") == null) {
getLogger().severe("Disabling plugin, Vault not found");
getServer().getPluginManager().disablePlugin(this);
return;
}
getCommand("rankup").setExecutor(new... |
b0d544f9-bb6c-4e66-94d0-4111fb89b477 | 8 | @EventHandler
public void craftingEvent(CraftItemEvent event) {
Material mat = event.getRecipe().getResult().getType();
if(mat == Material.IRON_HELMET) helmet = true;
if(mat == Material.IRON_CHESTPLATE) chestplate = true;
if(mat == Material.IRON_LEGGINGS) leggings = true;
if... |
c1aa9c62-129b-4b36-8c59-fc5624d3728e | 0 | public String getUserName( ) {
return mUserName;
} |
5c2f9caa-973b-4176-84ce-5dc7f43977c7 | 7 | public String getCurrentStatusString() {
switch (this.currentStatus) {
case NOT_STARTED:
return "not started";
case RUNNING:
return "running";
case PAUSED:
return "paused";
case CANCELLING:
return "ca... |
6c20b9c6-432c-4ade-b076-a6ef03502841 | 1 | public void modificar(int id, String valor) {
try {
PreparedStatement ps = MySQL_Connection.getConection()
.prepareStatement("UPDATE producto SET nombre = '"
+ valor + "' WHERE id = " + id);
ps.executeUpdate();
ps.close();
... |
b29fda19-ece6-4cbe-a03a-93b07a4af01c | 5 | public static void call(final String mapping, final String data) throws Exception {
final File mapFile = new File(mapping);
final File dataFile = new File(data);
// delimited by a comma
// text qualified by double quotes
// ignore first record
final Parser pzparser = Defa... |
7dc991db-231e-428e-9417-ee8417ebe0bf | 7 | public void processViewCommand(Command action) {
// Log a message
//
FroshProject.getLogger().log(Level.INFO,
"Message received from the view : " + action);
// Check if the action is set
//
if (action == null) {
return;
}
// S... |
042b31f7-63bd-4827-a531-ed67f4dcd736 | 3 | public ForeignKey getForeignKey(String table, String column) throws SQLException {
List<ForeignKey> foreignKeys = this.foreignKeys();
for (ForeignKey fk : foreignKeys) {
if (fk.sourceColumn.equals(column) && fk.sourceTable.equals(table)) {
return fk;
}
}
... |
20b0c712-2855-4320-8c12-ff28196531c0 | 3 | private void key(byte key[]) {
int i;
int koffp[] = { 0 };
int lr[] = { 0, 0 };
int plen = P.length, slen = S.length;
for (i = 0; i < plen; i++)
P[i] = P[i] ^ streamtoword(key, koffp);
for (i = 0; i < plen; i += 2) {
encipher(lr, 0);
P[i] = lr[0];
P[i + 1] = lr[1];
}
for (i = 0; i < slen;... |
a91f6ca6-3572-4ee2-bbab-7f2cc4269fc7 | 5 | int dinicDfs(int[] ptr, int[] dist, int dest, int u, int f) {
if (u == dest)
return f;
for (; ptr[u] < ady[u].size(); ++ptr[u]) {
Edge e = ady[u].get(ptr[u]);
if (dist[e.t] == dist[u] + 1 && e.f < e.cap) {
int df = dinicDfs(ptr, dist, dest, e.t,
Math.min(f, e.cap - e.f));
if (df > 0) ... |
86f38e36-b9c3-4963-b048-259ac93a031d | 8 | private void initializeMissions() {
// Full debug setup is very different.
if (FreeColDebugger.getDebugLevel() >= FreeColDebugger.DEBUG_FULL)
return;
AIMain aiMain = getAIMain();
// Give the ship a transport mission.
TransportMission tm = null;
for (AIUnit a... |
fedc708e-22f5-447c-801d-3e706e6aa848 | 2 | public static boolean isSupported() {
ContextCapabilities c = GLContext.getCapabilities();
return c.GL_ARB_shader_objects && c.GL_ARB_vertex_shader && c.GL_ARB_fragment_shader;
// return c.OpenGL20;
} |
5ea72612-aabe-45fb-9390-2d1359561b45 | 9 | private Map<Integer, Double> getTagRecencies(List<Bookmark> bookmarks) {
//Collections.sort(bookmarks); // TODO: necessary?
int testIndex = bookmarks.size() + 1;
Map<Integer, Integer> firstUsages = new LinkedHashMap<Integer, Integer>();
Map<Integer, Integer> lastUsages = new LinkedHashMap<Integer, Integer>();
... |
d8c2219a-e0a2-400e-8739-da795b7d5ef8 | 0 | public void setThickness(int thickness) {
this.thickness = thickness;
} |
53a0cc9c-8480-4a38-a75d-cd6bc6148b33 | 8 | private void createFullMatchPanel() {
LabelPanel.setPreferredSize(new Dimension(450, 35));
LabelPanel.setMaximumSize(new Dimension(20000, 35));
FullPanel.setLayout(new BoxLayout(FullPanel, BoxLayout.Y_AXIS));
JPanel titlePanel = new JPanel();
buildTotalTitlePanel(titlePanel);
FullPanel.add(titlePanel);
... |
5c03c5bb-8d84-488d-9058-eaa285fa7ac3 | 5 | private void initTileList() { //létrehozza a csempékhez a hozzájuk tartozó nézeteket, majd páronként beteszi őket a drawables Map-be.
Tile[][] tiles = geometry.getTiles();
for (int x = 0; x < tiles.length; x++) {
for (int y = 0; y < tiles[0].length; y++) {
if (tiles[x][y].getType().equals("FieldTile")) {
... |
7f96b5f5-b9f4-4aa8-84c5-0cf7349e152a | 2 | protected void doPadding(byte[] output, int outputOffset)
{
/*
* This is slightly ugly... we need to get the still
* buffered data, but the only way to get it from
* DigestEngine is to input some more bytes and wait
* for the processBlock() call. We set a variable
* with the count of actual data bytes... |
077ab8a8-e59e-4a82-afa6-bc6baea554aa | 9 | public void keyPressed(KeyEvent e) {
int dr=0;
if (e.getKeyCode() == KeyEvent.VK_P) {
if (pause)
pause = false;
else
pause = true;
}
/**
if (e.getKeyCode() == KeyEvent.VK_M) {
if (music)
music = false;
else
music = true;
}
*/
if (!pause) {
if (e.getKeyCode() ==... |
e0648657-e1e4-40c9-bf52-3721d7a0b515 | 1 | @Override
public boolean accept(File file) {
return file.isDirectory() || file.getName().endsWith(".cer");
} |
36ba9f4a-4665-4b90-82fb-123266462fd9 | 5 | public boolean click(Level level, Sprite sprite, int x, int y, int button)
{
if (level.player.carried == null)
{
level.player.addString("A key is required to use this lock");
return true;
}
if (!(level.player.carried instanceof ItemKey))
{
level.player.addString("A key is... |
e922425e-4142-4d6b-bb42-c5105b3c88b0 | 1 | public static <E> E getTypedSelectedItemFromCombo(JComboBox<E> combo) {
int index = combo.getSelectedIndex();
return index != -1 ? combo.getItemAt(index) : null;
} |
31cc3577-8d98-4965-a9fc-9de7122380c7 | 6 | public void handleRequest(Request toHandle) {
int request = toHandle.getRequest();
System.out.println("Handling request: " + request);
switch (request) {
case 69: theGUI.setTurnCheckBox(true); break;
case 98: PopUpStats a = new PopUpStats(toHandle.getHexagonSelected(), toHandle.getRoadNames(), toHandle.getS... |
7d36e7cf-5099-484e-a009-ceedcb458531 | 1 | public SaveFileFormat getExportFormat(String formatName) {
int index = indexOfName(formatName, exporterNames);
if (index >= 0) {
return (SaveFileFormat) exporters.get(index);
}
return null;
} |
cbdd19f6-99a4-403b-bae8-eda0d832c3dd | 1 | public static final Cursor getCursor() {
if (CURRENT_CURSOR == null) {
CURRENT_CURSOR = new Origin(NSpace.DEFAULT_NSPACE);
}
return CURRENT_CURSOR;
} |
92f7c3ab-8d59-481e-8560-c3b05dee2415 | 7 | public String reverseWords(String s) {
if(s.length()==0) return s;
String[] arr = s.split(" ");
ArrayList<String> aa = new ArrayList<String>();
if(arr.length == 0) return "";
int i =0;
while(i<arr.length)
{
if(!(arr[i].equals(" ")||arr[i].equals("")))
... |
98ef716c-a9c5-44bc-8066-2240e3e4d34c | 7 | private boolean inBattle(Territory territory){
if(defender){
if(territory==battle.getDefTerritory()) return true;
for(Territory t : battle.defSupport){
if(territory==t) return true;
}
}else{
if(territory==battle.getAttTerritory()) return true;
for(Territory t : battle.attSupport){
if(territor... |
fe785427-8409-40f4-bd55-ed422c9604c9 | 4 | public boolean isWithinCastle(Point point) {
int castleY = castle.getPosition().getY();
int castleX = castle.getPosition().getX();
for (int y = castleY; y < castleY + getCastleHeight(); y++ ) {
for (int x = castleX; x < castleX + getCastleWidth(); x++ ) {
if (point.ge... |
e054f7d0-efc9-413f-828f-379b2613b4bb | 4 | public void levelOrder( Method visit )
{
ArrayQueue<BinaryTreeNode<T>> q = new ArrayQueue<>( );
BinaryTreeNode<T> t = root;
while( t != null )
{
try
{
visit.invoke( null, t ); // visit tree root
}
catch ( Exception e )
{
Sys... |
dc92f915-8275-4c3e-a9c5-bde468018730 | 2 | private int getBranchOffset(Object to) {
Integer label = labels.get(to);
if(label == null) {
label = 0; // should result in an infinite loop if it is not fixed up
ArrayList<Integer> fix = fixup.get(to);
if(fix == null) {
fix = new ArrayList<Integer>();... |
635e5b13-2fe1-454d-bc88-fae38b674002 | 5 | @Override
public void actionPerformed(ActionEvent action) {
// TODO Auto-generated method stub
// If click on button
ipServer = txtIPServer.getText();
String userName = txtUserName.getText().toString();
int port = Integer.parseInt(txtPort.getText().toString());
if(!checkPortAvailability(port)){
txtPor... |
4c8e7dca-6c2c-457a-a8ea-d578beb89711 | 2 | private void setupVideoListener() {
videoListener = new MouseAdapter() {
@Override
public void mouseMoved(MouseEvent e1){
Canvas videoCanvas = (Canvas) e1.getSource();
VideoPlayer videoPlayer = (VideoPlayer) videoCanvas.getParent().getParent();
int yCoordinate = e1.getY();
... |
acc7300e-e6d8-41f6-85eb-c4d3dceed6fd | 3 | private boolean modifyClassfile(CtClass clazz, CtClass metaobject,
CtClass metaclass)
throws CannotCompileException, NotFoundException
{
if (clazz.getAttribute("Reflective") != null)
return false; // this is already reflective.
else
... |
5912d2be-ec51-42a9-803f-e66052b06062 | 9 | protected static void insertarPrivate(Nodo raiz, int dato)
{
if((raiz.getAcumulado()+dato) < Arbol.limit)
{
if(raiz.getOpt1() == null)
{
raiz.setOpt1(new Nodo(dato));
raiz.getOpt1().setAcumulado(dato + raiz.getAcumulado());
}
... |
914fa856-93cc-4384-980f-4cabccb489d9 | 2 | public void run()
{
while(true)
{
try
{
System.out.println("Producteur : " + this.counter++);
this.NEmpty.acquire();
this.NFull.release();
}
catch (Exception e)
{
e.printStackTrace();
}
}
} |
785727ff-d0c2-41d4-9b3b-d8c8789c6302 | 0 | public void makePayment(int amount) {
this.balance = this.balance - amount;
} |
bcdb2a07-a6da-4e09-9904-76201d86b61c | 2 | private void addLockonUPSiteWithVar(int varIndex, Transaction transaction, boolean isWrite) {
for(int i: sitesHasVar(varIndex).keySet()) {
Site site = sites.get(i);
if(!site.isFailed()) {
site.addLock(transaction, varIndex, isWrite);
}
}
} |
2132764b-122e-4c05-9c09-339383dc22fb | 5 | private void recommend(String type){
Vector<String> doneProbs = FileUtil.getUserDoneProbs(Context.getUserID());
boolean done[] = new boolean[4000];
for(int i = 0;i < doneProbs.size();i++){
done[Integer.valueOf(doneProbs.get(i)) - 1000] = true;
}
String[] probs = FileUtil... |
9a6663f0-6fcc-48fc-b0ce-eb4293f53c58 | 1 | public Obuffer decodeFrame(Header header, Bitstream stream)
throws DecoderException
{
if (!initialized)
{
initialize(header);
}
int layer = header.layer();
output.clear_buffer();
FrameDecoder decoder = retrieveDecoder(header, stream, layer);
decoder.decodeFrame();
output.write_buf... |
942b21bb-12fd-45ca-9818-98db7e55e3ce | 5 | public static void main(String[] args) {
int continuar = 1;
do {
System.out.println("##################################");
System.out.println("## 1. Ingresar Factura ##");
System.out.println("## 2. Total Ingresos ##");
System.out.println("## 3. Venta Mayor,Venta Menor ##");
Sys... |
27ef00c8-ab32-44be-a661-f294e8416b13 | 4 | public int getTripleIndexByPredicate( Vector<Vector<String>> tripleVector, String predicate)
{
for(int i=0; i<tripleVector.size() ;i++)
{ Vector<String> t = tripleVector.get(i);
if( t != null )
if( t.get(1)!=null && ((String)t.get(1)).equals(predicate))
{return i;}
}
return -1;
}//public String get... |
694d48ce-8cd3-4260-ba39-a8c15154cfdc | 0 | public JCellule(int x, int y) {
this.x = x;
this.y = y;
r = 255;
v = 255;
b = 255;
this.setBorder(null);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.