method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
1f25dcf9-7b39-4d2d-b9ce-0399237886f7 | 1 | synchronized void sendPacket(Packet packet) throws IOException {
if (open) {
out.writeInt(packet.id);
packetTypes.get(packet.id).write(packet, out);
}
} |
7d8cd724-aafe-4ebf-a513-32e0b269855a | 0 | @Test
public void testIntegrative() throws FileNotFoundException {
final JUnitCore core = new JUnitCore();
core.addListener(new TestLinkXmlRunListener());
core.addListener(new TestLinkLoggingRunListener(LoggerFactory.getLogger("MYTESTLINK"), URI.create("http://testlink.sourceforge.net/demo/"... |
dedd12ce-d0c9-467b-9983-6f455f33820c | 8 | @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
String action = request.getParameter("act");
if(action != null) {
try {
RequestContext context = new RequestContext(request);
if(context.isLogged(... |
826bb553-8a5a-4966-87ef-a0153c2c23cc | 0 | public void incFrequency() {
docFrequency++;
} |
c46f74b4-8f1f-4b51-8ce3-60c3e51b2cf1 | 7 | public static void printDescriptionsAsKifRule(Description head, Description tail, Proposition rule, boolean reversepolarityP) {
{ OutputStream stream = ((OutputStream)(Logic.$PRINTLOGICALFORMSTREAM$.get()));
boolean forwardarrowP = ((BooleanWrapper)(KeyValueList.dynamicSlotValue(rule.dynamicSlots, Logic.SYM_L... |
b6c70dbb-d429-4517-baec-3a304a3f0ff5 | 5 | @Override
public boolean equals(Object obj) {
if(this == obj)
{
return true;
}
if(obj != null)
{
if(obj instanceof Coordinates)
{
Coordinates otherCoordinates = (Coordinates)obj;
if(otherCoordinates.getX() ==... |
ed39f441-098a-4ecf-b5e4-6f138918f3e1 | 9 | private void showTeachingPlan() {
content = null;
head = null;
Object fb = logic.showTPHead();
if (fb instanceof Feedback) {
JOptionPane.showMessageDialog(null, ((Feedback) fb).getContent());
} else if (fb instanceof String[]) {
head = (String[]) fb;
fb = logic
.showTPContent(((DeptVO) deptChoo... |
db0f70cb-925e-41dd-b6c6-d3a067af2ec7 | 0 | @Override
public String[] getHelp() {
return new String[]{
"ttp help",
"Displays help information"
};
} |
fed56cc5-4a64-4f8c-8aa7-8bf3a230e3fe | 1 | public AnnotationVisitor visitAnnotationDefault() {
text.add(tab2 + "default=");
TraceAnnotationVisitor tav = createTraceAnnotationVisitor();
text.add(tav.getText());
text.add("\n");
if (mv != null) {
tav.av = mv.visitAnnotationDefault();
}
return tav;
} |
070d60e3-48df-48ea-8eee-ecd363b9f362 | 2 | public boolean getBoolean(String columnLabel) {
Object obj = getObject(columnLabel);
if (!(obj instanceof Boolean)) {
throw new RuntimeException("[" + columnLabel + "] is not a boolean, but a "+ (null == obj ? "null" : obj.getClass().getName()) +".");
}
return (boolean) obj;
} |
a2bacf77-bdd8-4322-bbed-55efef449e11 | 9 | @Override
public LauncherAction createActionFromDataElement(Element element) {
if(element == null) return null;
AppletDesc desc = new AppletDesc();
initNameAndId(desc, element);
//Use Browser
if(element.getAttribute("use-browser").equals("true")) {
de... |
0467b426-a0f2-4f1a-9647-1f5360fe3692 | 0 | public State getStateForVariable(String variable) {
return (State) MAP.get(variable);
} |
e7ed96e7-9a89-4772-8d91-b5682bcc10d1 | 0 | public DisplayPane(LSystem lsystem) {
super(new BorderLayout());
this.lsystem = lsystem;
expander = new Expander(lsystem);
// We can't edit the expansion, of course.
expansionDisplay.setEditable(false);
// The user has to be able to change the recursion depth.
JSpinner spinner = new JSpinner(spinnerModel... |
0f70c6e6-eb98-4924-a302-ca8fd5536862 | 1 | public void setMapData(File file) {
if (!file.exists()) {
throw new IllegalArgumentException("Map data file does not exist.");
}
this.mapData = file;
} |
268e43f0-025e-4536-aa90-3886e77623d5 | 4 | private static long getLastCached(String playerName) {
// Already found
if (lastCached.containsKey(playerName))
return lastCached.get(playerName);
// Search for lowercase matches
for (final String loggedName : lastCached.keySet()) {
if (loggedName.equalsIgnoreCase(playerName)) {
pla... |
3bd5a7c1-ed7a-4abd-a00f-41bd8ba46204 | 2 | public void buildTrackForTest()
{
if (!built)
{
// Create
Record r = new Record();
r.setAuthor("fake-author");
r.setCategory(new Category("fake-cat", 12));
r.setCatNo("fake-cat-no");
r.setDate(new Date());
r.setDiscogsNum(12);
r.setF... |
6815c416-78c3-4ca9-b183-238611e0d8bb | 3 | @Override
public boolean onCommand(CommandSender sender, org.bukkit.command.Command cmd, String[] args) {
if(!Commands.isPlayer(sender)) return false;
Player p = (Player) sender;
if(args.length != 1) return false;
if(PlayerChat.plugin.getConfig().getBoolean("CustomChannels.Enabled", true)) {
channel.join... |
955ce75d-2be9-49f6-8260-9565bf1b8ccd | 5 | private Image getImage(int i){
if (i == 1){
return newgame;
}
if (i == 2){
return loadgame;
}
if (i == 3){
return credits;
}
if (i == 4){
return options;
}
if (i == 5){
return quit;
... |
0781750d-defd-45ce-99f4-ce1bfced28f7 | 2 | public void update() {
for (int particleIndex = 0; particleIndex < particleArray.length; particleIndex++) {
if (particleArray[particleIndex] != null) {
particleArray[particleIndex].update();
}
}
this.removeDeadParticles();
} |
4a1b9d02-297e-4aef-ba60-a2854820883c | 5 | String run(String input){
String[] array = new Tokenizer().makeToken(input);
double mChance = 0;
double fChance = 0;
for(int i = 0; i < array.length; i++){
if(mProb.keySet().contains(array[i])){
mChance = mChance + (Math.log(mProb.get(array[i])/(mProb.get(array[i]) + fProb.get(array[i])) / Math.log(2)));
... |
bb0d9aa4-60df-44dc-a89e-09d953fca94d | 8 | private String whichBinary(String type)
{
for (int i = 0; i < Expression.binaryTypes.length; i++)
{
if (type.equals (Expression.binaryTypes[i]))
{
if(type.equals("plus")||type.equals("minus")||type.equals("times")
||type.equals("divided by"))
{
return "operator";
}
else if(type.e... |
985d0f17-04b9-464b-82e0-80375c312fc5 | 7 | private void scan() {
for(String location : locations) {
File pluginDir = new File(location);
if (pluginDir.exists() && pluginDir.isDirectory()) {
for (String n : pluginDir.list()) {
if (n.endsWith(".jar")) {
try {
URL url = new File(location + File.separator + n)
.toURI().toURL()... |
f92b1480-563f-47a2-b9b0-a6a49645b041 | 8 | @Override
public void merge(I merger, I mergee) {
Set<TKey<?, ?>> keys = mergee.getAvailableKeys();
for (TKey key : keys) {
if (filterKeys.contains(key)) {
List<?> qvs = mergee.getQualifiedValues(key);
merger.deleteValues(key);
for (Object ... |
e6fdef3d-55f9-4f95-aac3-fe798e3feaf8 | 0 | public String getTaxes(String s)
{
String taxValue = "17";
return taxValue;
}; |
7388f52b-f053-4641-95cf-e4c75d9bdaa1 | 5 | public int getMinimum() {
int res = -1;
int min = -1;
for (int i = 0; i < result.length; i++) {
if (result[i] != -1 && visited[i] != 1 && (result[i] < min || min == -1)) {
min = result[i];
res = i;
}
}
return res;
} |
51c141f2-47d5-420e-8d3b-0942e5876285 | 4 | public LocalDataManager(String dataHome) throws WrongArgumentException
{
File dfile = new File(dataHome);
if( dfile == null || !dfile.exists())
{
dfile.mkdir();
}else if(dfile.exists()&&!dfile.isDirectory()){
throw new WrongArgumentException("dataHome","Can not create Directory"+dataHome);
}
this.dat... |
794c180e-6da5-4be0-8bc7-22104480e8ad | 3 | public double geometricMean_as_double() {
double gmean = 0.0D;
switch (type) {
case 1:
double[] dd = this.getArray_as_double();
gmean = Stat.geometricMean(dd);
break;
case 12:
BigDecimal[] bd = this.getArray_as_BigDecimal();
gmean = Stat.geometricMean(bd);
bd = null;
break;
case 14:
th... |
3c9af7a3-20d4-4faa-a5e5-ccfee3c960ac | 7 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("Starting");
String userName = request.getParameter("username");
String password1 = request.getParameter("password1");
String password2 = request.getParameter("password2");
... |
0d14dbab-cefd-46fd-9a19-4445c6a11e49 | 0 | public void setDateTo(Date dateTo) {
this.dateTo = dateTo;
} |
37e6580f-060c-4d62-bd1d-337a370fbddc | 7 | private void addAnimPanel() {
String s = MDView.getInternationalText("Animation");
animPanel = new JPanel(new BorderLayout());
JPanel p = new JPanel(new BorderLayout(5, 5));
p.setBorder(new EmptyBorder(10, 10, 10, 10));
animPanel.add(p, BorderLayout.NORTH);
JPanel child = new JPanel(new SpringLayout());... |
e2947603-cf3f-414c-9f0e-f550c53fd419 | 8 | @Override
public void endElement(String uri,
String localName,
String qname) {
if (qname.equals("parse")) {
indent -= 2;
scopes.pop();
} else if (qname.equals("uncommon_trap")) {
currentTrap = null;
} else if (qname.equals("late_inl... |
d1cfb4b4-542f-4da3-9c1a-08cf73a8d13d | 2 | public static AccessToken getAccessToken(String appid, String appsecret) {
AccessToken accessToken = null;
String requestUrl = access_token_url.replace("APPID", appid).replace(
"APPSECRET", appsecret);
JSONObject jsonObject = httpRequest(requestUrl, "GET", null);
// ɹ
if (null != jsonObject) {
try {
... |
88426813-e14f-4b2f-9dd9-8b7790f13b93 | 3 | public String remove(int key) {
Node current, previous;
current = head;
previous = null;
while (current != null && current.getKey() != key) {
previous = current;
current = current.getNext();
}
String output = current.getContent();
if (previ... |
f2cb8e24-9e53-489b-bb25-8933b0cb0da8 | 0 | public void setHP(int hp)
{
this.hp = hp;
} |
2cce3f09-feb9-4b27-bd92-247a166d2646 | 8 | @Override
public final String readLine() throws IOException {
if (lineBuffer == null) {
lineBuffer = new char[LINE_BUFFER_INCREMENT_SIZE];
}
char[] buf = lineBuffer;
int room = buf.length;
int offset = 0;
int c;
loop: while (true) {
c... |
08b73f01-5749-41cb-a130-2519bc8128b1 | 6 | public int transform(CtClass tclazz, int pos, CodeIterator iterator,
ConstPool cp) throws BadBytecode
{
int c = iterator.byteAt(pos);
if (c == PUTFIELD || c == PUTSTATIC) {
int index = iterator.u16bitAt(pos + 1);
String typedesc = isField(tclazz.getCl... |
d99cc0d5-c420-4b9e-800d-163ed5532664 | 2 | public ArrayList<Integer> readData(String filename) throws FileNotFoundException {
Scanner scanner = new Scanner(new BufferedInputStream(new FileInputStream(filename)));
ArrayList<Integer> data = new ArrayList<Integer>();
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
if (line.trim().l... |
f7a2025d-1c9b-4a70-ac00-3a1e787b54a3 | 7 | public void initialize() throws Exception {
m_RunNumber = getRunLower();
m_DatasetNumber = 0;
m_PropertyNumber = 0;
m_CurrentProperty = -1;
m_CurrentInstances = null;
m_Finished = false;
if (m_UsePropertyIterator && (m_PropertyArray == null)) {
throw new Exception("Null array for ... |
0f026233-6d2b-49d5-9205-2abce1702f30 | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TMasterProduct other = (TMasterProduct) obj;
if (!Objects.equals(this.pcodeSap, other.pcodeSap)) {
... |
e14e5549-460a-4313-9d75-6ac027c47411 | 7 | public void run(){
try{
sendChannelOpen();
Buffer buf=new Buffer(rmpsize);
Packet packet=new Packet(buf);
Session _session=getSession();
int i=0;
while(isConnected() &&
thread!=null &&
io!=null &&
io.in!=null){
i=io.in.read(buf.buf... |
21d1e616-84ce-42cf-afba-48874e41c840 | 6 | @Override
public void execute() throws BuildException {
Migrator migrator = new Migrator(url, driver, user, password, scriptsLocation);
log(migrator.printBeforeDiagnostics());
if (action != null) {
if (action.equals(UPGRADE)) {
log(UPGRADE + " action started");
migrator.migrateUp();
log(... |
28473c01-40b8-4e8d-b9ea-a328469bf2aa | 1 | public Integer getRosterCount (Date d) {
Integer rc = 0;
for (Trip t: getAllTrips(d)) {
rc += t.getRosterCount();
}
return rc;
} |
00fede1d-cc33-45df-aa56-9dace4ffc40c | 9 | public double describe(GameState state, Player player)
{
Map<Player, Integer> largestClusterSize = new HashMap<Player, Integer>();
Set<Country> countedCountries = new HashSet<Country>();
for (Country country : state.getCountries())
{
if (countedCountries.contains(country))
continue;
int clusterS... |
f1e1f0cd-210f-4d4f-aba8-35152caaf818 | 7 | private void makeHashTable(NonDuplicateArrayList<String> newTransaction,
int[] hashTable,
int iteration,
int[] newHashTable,
NonDuplicateArrayList<String> newnewTransaction){
int[] occurrenceCount = new int[newTransaction.size()];
// for (NonDuplicateArrayList<Integer> subset: ge... |
762c813f-af8f-4d04-9da2-7975c7fdae9c | 8 | public TargetPicker createTargetPicker(String targetPickerId, NamedNodeMap attributes, List<Element> childElements){
currentAttributesMap = attributes;
TargetPickerId id = TargetPickerId.valueOf(targetPickerId);
TargetPicker targetPicker;
switch(id){
case ADJACENT:
targetPicker = new TargetAdjacentEntitie... |
9a4834e2-829a-47d9-8098-6c7865e89fb6 | 4 | public Component getListCellRendererComponent(
JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus)
{
String v = value.toString();
String dv = v;
final ImageIcon archIcon = new ImageIcon(get... |
f9b793c4-8d46-4e5e-9b50-ffdbd2d1d870 | 8 | public void run() {
ServerThread sendToClients = new ServerThread(this);
sendToClients.start();
while (true) {
try {
DatagramPacket recvPacket = new DatagramPacket(recvBuffer, recvBuffer.length);
sock.receive(recvPacket);
String data = new String(recvPacket.getData());
InetAddress ip = recv... |
de42858f-f935-4b87-a209-64cc931dee06 | 9 | public int calculateFitness(Hypothesis h)
{
if (type == RANDOM)
{
//Just return a random fitness
return (int)(Math.random() * 100);
}
else if (type == TARGET)
{
double sumPerc = 0;
int hIndex = 0;
for (int i = 0; i <... |
b3378f67-8584-402a-bc01-23da67456676 | 1 | private void checkMessage() {
while (true) {
jTextArea1.append(jTextField1.getText() + control.receiveMessage() + "\n");
}
} |
41cdce63-e287-4d42-853c-aee5fd660ae9 | 5 | public Dimension getPreferredSize() {
int height = 0;
int width = 0;
//
// Use the size set by the application
//
if (isPreferredSizeSet())
return super.getPreferredSize();
//
// Leave room for the component border
//
Border b... |
99f6b3f1-1708-494e-8afd-762815fc4f7e | 9 | public static void main(String[] args)
{
try
{
//////////////////////////////////////////
// Step 1: Initialize the GridSim package. It should be called
// before creating any entities. We can't run this example without
// initializing GridSim ... |
f7812714-934a-4c62-ad96-bc12b4c25ccf | 8 | int getPreferredWidth (int columnIndex) {
int width = 0;
GC gc = new GC (parent);
gc.setFont (getFont (columnIndex, false));
width += gc.stringExtent (getText (columnIndex, false)).x + 2 * MARGIN_TEXT;
if (columnIndex == 0) {
if (parent.col0ImageWidth > 0) {
width += parent.col0ImageWidth;
width += CTable.... |
888aa4ac-7ea8-447c-af1e-a41147e44820 | 5 | private void inputTextPaneKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_inputTextPaneKeyPressed
// TODO add your handling code here:
String s = (String) sendToCombo.getSelectedItem() ;
if(!s.equals("To All")){
whisper = true;
}
else{
whisper ... |
c44f04a5-602a-4763-a6cc-5b96d5c77afa | 6 | public Main_Frame() {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;... |
7034f577-4ecf-4fde-b30f-1c958f2cdfe3 | 0 | public static boolean isVariable(char ch) {
return Character.isUpperCase(ch);
} |
3f0483c4-4d64-487f-b8ec-7becf82bc52d | 9 | protected void byteLoop(RasterAccessor src,
RasterAccessor dst,
int filterSize) {
int dwidth = dst.getWidth();
int dheight = dst.getHeight();
int dnumBands = dst.getNumBands();
byte dstDataArrays[][] = dst.getByteDataArrays();
... |
3f39908c-90a1-4d6f-b0cd-7e4115acf9a4 | 2 | @Override
public String execute(SessionRequestContent request) throws ServletLogicException {
String page = ConfigurationManager.getProperty("path.page.user");
String prevPage = (String) request.getSessionAttribute(JSP_PAGE);
findUser(request);
if(page == null ? prevPage == null : !p... |
260adefb-fa4f-493d-8cc4-0d6a17a71b23 | 5 | static void getMax(ArrayList<Integer> input, int k, int[] maxNum,ArrayList<Integer> output){
if(k==0){
int sum=0;
for(int v:input){
sum*=10;
sum+=v;
}//calculate the number after several swaps
if(sum>maxNum[0]){
maxNum[0]=sum;
deepCopyList(input,output);
}//update the results... |
46c80f33-4c57-415f-8876-54197066d133 | 5 | @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = false)
public void onJoin(PlayerJoinEvent e)
{
if(!isStaff(e.getPlayer()))
{
if(!e.getPlayer().hasPermission(Permissions.SPEAK))
{
return;
}
}
if(StaffChat.getStaffChat().getToggledStaffMembers().contains(e.g... |
8e468687-7e3e-487f-8845-fb34dcb02584 | 3 | public char revert(char c) {
if (c != '0' && c != '1') {
throw new IllegalArgumentException("Argument must be '0' or '1'");
}
return (c == '1') ? '0' : '1';
} |
19c2268e-1427-43cf-8e07-c6dd38a6bdb8 | 5 | public void showWall() {
allPosts = new ArrayList<TimedPosts>();
for (int i = 0; i < this.posts.size(); i++) {
String newPost = this.name + ": " + this.posts.get(i).getPost();
Long time = posts.get(i).getTime();
allPosts.add(new TimedPosts(newPost, time));
}
... |
2dab42a9-c98f-4f19-8ab0-75a74a8ad3cd | 2 | public ArrayList<Curso> listar(String condicao) throws Exception
{
ArrayList<Curso> listaCurso = new ArrayList<Curso>();
String sql = "SELECT * FROM curso " + condicao;
try
{
PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql);
ResultSet rs = stmt.executeQuery();
wh... |
d560ce57-e0e4-4c5e-9a28-4ec522321de9 | 3 | public WumpusWorld()
{
String option = Config.getOption();
if (option.equalsIgnoreCase("gui"))
{
showGUI();
}
if (option.equalsIgnoreCase("sim"))
{
runSimulator();
}
if (option.equalsIgnoreCase("simdb"))
{
... |
7a8616f1-5002-4707-9415-89a9156861ea | 9 | public synchronized void parse(InputStream is) throws MiniXMLException {
automaton.reset();
try {
oTokenParser = new MiniXMLTokenParser(is);
} catch (IOException e) {
throw new MiniXMLException(MiniXMLException._MXMLE_TP_E_IE);
}
MiniXMLToken oMiniXMLToken;
boolean bEnd = false;
handler.startDocumen... |
b004b426-4a71-46be-8e7b-4022c0f7f5c8 | 5 | private static void initAgents(Simulation controller) {
agents = new Agent[numAgents];
int id = 0;
for(int i = 0; i < numStrategies; i++) {
int a = 0;
while (a < agentsStrat[i]) {
agents[id] = new Agent(controller, id, strategies[i]);
id++;
a++;
}
a = 0;... |
e849a0f5-f866-4c86-b3e1-c014f05e0d09 | 6 | @Override
public List<Framedata> translateFrame(ByteBuffer buffer, int available) {
List<Framedata> frames = new LinkedList<Framedata>();
int offset = 0;
Framedata cur;
if (incompleteframe != null) {
while (true) {
try {
int available_next_byte_count = available;// The number of
//... |
71ebee0a-119e-4a2b-be91-8b0933f7eb52 | 2 | public Boolean has4Walls() {
boolean ok = true;
for (Boolean wall : walls) {
if (!wall) {
ok = false;
}
}
return ok;
} |
9b6ab57f-2500-4ade-9e08-76dab1309e15 | 5 | public void run() {
decompiler.setOption("verbose", verboseCheck.getState() ? "1" : "0");
decompiler.setOption("pretty", prettyCheck.getState() ? "1" : "0");
errorArea.setText("");
// /#ifdef AWT10
// / saveButton.disable();
// /#else
saveButton.setEnabled(false);
// /#endif
lastClassName = classFiel... |
35ecf8f0-eb28-4a95-a659-b0d8d5c737ae | 1 | void addLightTrailPart(Position position) {
if (!player.getGrid().validPosition(position))
throw new IllegalArgumentException("Invalid Position");
final LightTrailPart part = new LightTrailPart(player.getGrid(), this);
player.getGrid().addElementToPosition(part, position);
lightTrail.offer(part);
} |
1323dc8e-2d30-46a3-bb96-fe0be26fe5fd | 7 | private HGAtomRef.Mode getReferenceMode(Class<?> javaClass, PropertyDescriptor desc)
{
//
// Retrieve or recursively create a new type for the nested
// bean.
//
try
{
Field field = JavaTypeFactory.findDeclaredField(javaClass, desc.getName());
if (field == null)
return null;
AtomReference a... |
7f6dd1d9-50c3-45f8-9785-4f7c16cf1aa1 | 2 | @Override
public void Play(PlayerResponse response) {
// Send all Users the players and their positions relative to User
for (PinochlePlayer player : mP.getPlayers()) {
PinochleMessage message = new PinochleMessage();
message.setPlayers(mP.getUserNamesAndPositions(player));
player.setMessage(message);
}... |
a569da33-cf19-438f-a771-9bc8e5cabd38 | 9 | private void writeExcel() {
double[] test0 = new double [64];
double[] test1 = new double [64];
double[] test2 = new double [64];
double base = 0;
double sequence = 0;
int pos = 0;
int posY = 6;
//on aditionne tout les excel chromosomes.xls des enfants
for(int k = 0; k < filelist.size(); k... |
509a68d3-9576-42dd-9501-2f542e2b8a7d | 3 | public static void jogo(String[][] matriz){
for(int a=0; a<=8;a++){
for(int b=0; b<=8;b++){
int valor = Integer.parseInt(String.valueOf(a)+String.valueOf(b));
if(matriz[a][b].equals("")){
Celula celula = new Celula(0, a, b);
sud... |
25ba065c-5591-4383-b95f-323347fd2073 | 4 | @Override
public void onRepaint(Graphics g) {
final Graphics2D g2d = (Graphics2D)g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
if(show) {
g2d.setColor(Constants.BLACK_TRANS);
g2d.fill(Constants.CHATBOX_AREA);
g2d.setColor(Color.PINK);
g2d.setFont(Con... |
f7f2e81a-c9ad-4447-8220-371802b86388 | 2 | public JSONObject toJson(long uid) throws Exception {
JSONObject apptJo = new JSONObject();
apptJo.put("id", this.getId());
apptJo.put("initiator", User.findById(this.initiatorId).toJson());
apptJo.put("name", this.name);
apptJo.put("venueId", this.venueId);
apptJo.put("startTime", this.startTime);
apptJo... |
fdabfe0b-512d-4218-966a-966ae27384ec | 4 | public byte[] decodeBuffer(String encoded) throws IOException {
StringBuffer buff = new StringBuffer(encoded.length());
for (int i = 0; i < encoded.length(); ++i) {
char c = encoded.charAt(i);
if (c == '-') {
c = '+';
} else if (c == '.') {
c = '/';
} else if (c == '_') {
c = '=';
}
b... |
030b0d30-b4c7-415e-a051-e1fe8352c612 | 6 | public boolean isValid(Integer meeting, Integer timeslot)
{
ArrayList<Integer> connectedMeetings = this.getConnectedMeetings(meeting);
for(Integer m: connectedMeetings)
{
if(this.Assignment.containsKey(m)){
Integer cmTimeslot = this.Assignment.get(m);
if( cmTimeslot == timeslot)
{
return fals... |
173fd90a-53c0-46af-9d21-a4b191580a1a | 7 | public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
if (isPlainFlavor(flavor)) {
String data = getPlainData();
data = (data == null) ? "" : data;
if (String.class.equals(flavor.getRepresentationClass())) {
return data;
} else if (Reader.class.equals(... |
4a80c4b9-b23c-4904-9cc6-7f30a43788cc | 3 | public Especificacion getEspecificacionesProd(producto prod){
Especificacion esp = new Especificacion();
Conexionbd.conexion bd = new Conexionbd.conexion();
bd.conectarBase();
try {
ResultSet rs = bd.sentencia.executeQuery("SELECT * FROM ESPECIFICACIONESxPROD WHERE NOMBRE_PRO... |
bd6cfea4-ad46-4bdd-8e8b-1ad3d06e504e | 9 | public static Method[] getUniqueDeclaredMethods(Class<?> leafClass)
throws IllegalArgumentException {
final List<Method> methods = new ArrayList<Method>(32);
doWithMethods(leafClass, new MethodCallback() {
public void doWith(Method method) {
boolean knownSignature = false;
Method methodBeingOverridden... |
3a7dee02-906f-4ac5-b929-180ed67c0681 | 2 | public void enableGPS() throws IllegalAccessError, SocketTimeoutException {
try {
clientSocket.Escribir("ONGPS\n");
serverAnswer = clientSocket.Leer();
} catch (IOException e) {
throw new SocketTimeoutException();
}
if(serverAnswer.contains("529 ERR")) {
throw new IllegalAccessError();
}
System.... |
d4ad1fb0-f8dc-40d0-b3a5-d57f2b1d3320 | 3 | public static Thsis searchThsis(Thsis t) throws IOException {
String encodedThsisTitle = t.getTitle().trim().replace(" ", "+");
// 拼接URL
String url = GCR_SEARCH_THSIS_URL + encodedThsisTitle;
// 得到响应
Document htmldoc = connect(url);
if(htmldoc == null){
return null;
}
// 得到论文信息
Elements thsisElemen... |
3845bfc3-9061-4d04-be02-1234cfd56598 | 5 | public static void main(String[] args) {
String fullFileName = "/Users/Johan/Documents/CellTowers/cells_exact_samples67-120_2036.json";
opencellid.Controller cont = new opencellid.Controller();
List<OpenCellIdCell> cells = cont.parseCells(fullFileName, 240, 0, 1000000);
for(OpenCellIdCell cell : cells) {
if(... |
b3bd783c-8e43-48d4-97e3-61411fc0a39d | 3 | protected boolean addFirework(Firework f)
{
for(int i = 0; i < MAX_FIREWORKS; i++)
{
if((fireworks[i] == null) || !fireworks[i].isAlive())
{
fireworks[i] = f;
return true;
}
}
return false;
} |
7cb8f31a-7b05-41f2-8576-3356f54f8a56 | 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... |
944fdff6-1743-49c8-9d40-b8b37514fa82 | 1 | private void createPath(){
if( path == null ){
EndPointAttachement source = getSourceEndPoint().getAttachement();
EndPointAttachement target = getTargetEndPoint().getAttachement();
Point sl = source.getLanding();
Point sa = source.getApproach();
Point ta = target.getApproach();
Point tl = target... |
e6529fed-769b-4c33-9631-9ed2604c44e5 | 2 | @Override
public boolean equals(Object o) {
if (o == null)
return false;
if (!o.getClass().equals(this.getClass()))
return false;
return getUUID().equals(((Host) o).getUUID());
} |
a3b4735d-8b04-4154-9d19-2bdffcfc67b1 | 7 | public static DefaultFormatterFactory creaFormatoControl(int tipo,
int cantEnt, int cantFra, char caracter){
DefaultFormatterFactory factory = null;
MaskFormatter numcase = null;
String cadena = "";
int i;
for(i=0;i<cantEn... |
64d3f8cc-a44d-40f1-ab2a-bba376d7af4d | 6 | private void handleCancelList(Sim_event ev)
{
boolean success = false;
int tag = -1;
int src = 0;
try
{
// [0]=reservID, [1]=list of Gridlet IDs, [2]=transID, [3]=senderID
Object[] obj = ( Object[] ) ev.get_data();
// get the data inside ... |
5324393e-996f-47d2-af77-71d3a73efd3f | 8 | public static void cleanUp() {
ModPack pack = ModPack.getSelectedPack();
File tempFolder = new File(OSUtils.getDynamicStorageLocation(), "ModPacks" + sep + pack.getDir() + sep);
for(String file : tempFolder.list()) {
if(!file.equals(pack.getLogoName()) && !file.equals(pack.getImageName()) && !file.equals("vers... |
b5df9228-0beb-4b0c-8b78-ed8014e78ead | 2 | public ArrayList<String> find_baseNumOfPublications(){
HashMap<String, String[]> domainSet = DataLoad.loadDomain();
Collection<String> collection = domainSet.keySet();
Iterator<String> iter = collection.iterator();
while(iter.hasNext()){
person = iter.next();
temp = domainSet.get(person);
if(temp.lengt... |
347092f6-cb4d-442a-8f6a-8c623ebcd335 | 1 | @Override
public void mouseClicked(MouseEvent e) {
int col = table.getTableHeader().columnAtPoint(e.getPoint());
if (col == 0) {
// Add new row
Object[] data = {"Remove","",""};
model.addRow(data);
model.fireTableDataChanged();
}
} |
c2c4260a-2ee3-417f-92a8-a1d315aa1b0a | 0 | public Integer getContestId() {
return this.contestId;
} |
b4f1ebab-2975-4be7-bc29-ae7140879db1 | 5 | public String getStatus()
{
switch(this.status)
{
case 0:
return "Running";
case 1:
return "Wait";
case 2:
return "Idle";
case 3:
return "Terminated";
case 4:
return "Aborted";
default:
return "ERROR: No Status!";
}
} |
53151cc6-9799-4072-b0f9-21716d27752b | 9 | private boolean cvc( String str ) {
int length=str.length();
if ( length < 3 )
return false;
if ( (!vowel(str.charAt(length-1),str.charAt(length-2)) )
&& (str.charAt(length-1) != 'w') && (str.charAt(length-1) != 'x') && (str.charAt(length-1) != 'y')
&& (vowel(str.charAt(length-2... |
0922e315-d735-4957-9827-cf64168ec284 | 9 | static final public void NewArrayExpr() throws ParseException {
jj_consume_token(NEW);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ID:
jj_consume_token(ID);
break;
case BOOLEAN:
case CHAR:
case VOID:
case INT:
PrimitiveType();
break;
default:
jj_la1[40] = j... |
427d460b-8781-4e8e-8458-e3fd8ddd0720 | 2 | private static boolean contains(String name, List<Joueur> list) {
for(Joueur j : list) {
if(j.getNom().equals(name))
return true;
}
return false;
} |
f7738880-0a8f-48e2-a301-7534c555b587 | 3 | private void invokeQueue() {
if (active)
return;
synchronized (LOCK_QUEUE) {
if (queue.isEmpty())
return;
}
active = true;
new Thread() {
@Override
public void run() {
report.toggleProcess(true);
boolean queueEmpty;
synchronized (LOCK_QUEUE) {
queueEmpty = queue.isEmpty();
... |
ea287340-389b-47f4-9447-dc05d49a7829 | 0 | public int getX() {
return x;
} |
3df2bf88-bbaf-4b04-b977-30fd44b92939 | 0 | public final ArrayList<Entry<K, V>>[] getOnl() { return onl; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.