method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
95a4c402-fc20-4c31-b2a4-19d6410a7d1f | 9 | public boolean isOfSameType(Type t) {
if (t == null)
return true;
if ((t.isConstant || isConstant) && !t.actualType.equals("nil") && !actualType.equals("nil")) {
String tbaseType = t.actualType;
String baseType = actualType;
if (dimensions != null) {
baseType = actualType.split("... |
c38d0e3e-cf9b-433b-abb8-7494ad941195 | 0 | public void ParseSource(String source)
{
this.Source = source.replaceFirst(":","");
String[] source_nicksplit = Source.split("!");
Nick = source_nicksplit[0];
String[] source_hostnamesplit = source_nicksplit[1].split("@");
Ident = source_hostnamesplit[0];
... |
01d1316f-2cf6-440d-9ae1-5792f22ec05f | 0 | @Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
addActionListener(this);
} |
d00bdf53-a522-4606-a8d4-29bb35104e49 | 3 | public boolean peutAttaquerUnTerritoire(Territoire to){
List<Territoire> occupes = this.peuple.getTerritoiresOccupes();
// Recherche d'un territoire pouvant attaquer
if (occupes.size() > 0) {
Iterator<Territoire> it = occupes.iterator();
while (it.hasNext()) {
Territoire tmp = it.next();
... |
815fc940-99c8-492f-a122-5f1a38280c19 | 3 | public Polynomial gcd(Polynomial x) throws Exception {
Polynomial a = monic();
Polynomial b = x.monic();
while (true) {
if (a.degree() < b.degree()) {
Polynomial t = a;
a = b;
b = t;
}
if (b.degree() < 0) re... |
9adf0da1-caec-41e9-bf7f-8fd4f6d6d91b | 1 | @Override
/**
* This function has to apply some change to colorArr Color c is curColor in
* GridPanel
*/
public ArrayList<Delta> apply(Color c, int x, int y, Color[][] colorArr) {
dMap = new ArrayList<>();
this.colorArr = colorArr;
q = new LinkedList<>();
q.push(ne... |
5847c808-3188-4aeb-b880-4feb639dea90 | 0 | public CardPane()
{
} |
a25c9b8b-76cf-4ffb-8f65-3806cc10616e | 4 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Observation other = (Observation) obj;
if (!Arrays.equals(capteurs, other.capteurs))
return false;
return true;
} |
25b7be47-6c2d-4d5f-8cfb-e6250e132667 | 5 | private void fugit()
{
for(int i = 0;i < robotar.size();i++)
{
robotar.get(i).increaseLifetime();
}
for(int i = 0;i < rp.size();i++)
{
rp.get(i).increaseLifetime();
}
for(int i = 0;i < sp.size();i++)
{
sp.get(i).incr... |
aebc67ce-b83f-4424-82f3-4687410c1155 | 2 | public static ArrayList<MusterReaction> findMusterReactionByTestId(ArrayList<MusterReaction> musterReactions, int id) {
ArrayList<MusterReaction> outputReactions = new ArrayList<MusterReaction>();
for(MusterReaction mr:musterReactions) {
if(mr.muster==id) {
outputReactions.add(mr);
}
}
return outputRe... |
6188e4f3-83cf-45a6-b843-e692e032579a | 0 | public static void main(String[] args) {
new Compare().search( 5, 3, 4);
} |
a2ee245e-a23e-407d-b6a1-6c1715580d09 | 6 | private void qs(int low, int high){
int i = low;
int j = high;
//select middle element as a pivot
int pivot = elements[ low + ((high - low)/2) ];
// split elements into two list
while (i <= j){
// iterate through the left side, searching for elements
// that are bigger... |
52846bfa-04b4-4965-9252-e263a3827bf5 | 5 | private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
// TODO add your handling code here:
if(!jTextField7.isEnabled()){
jTextField7.setText("");
}
if(!jTextField8.isEnabled()){
jTextField8.setText("");
... |
44c35b86-e1af-4b49-bd5f-aead5c266431 | 0 | @Before
public void setUp() {
dynamicArray = new DynamicArray();
arrayList = new ArrayList();
} |
66baf69c-9949-4681-8b7d-d0f9adad0ee7 | 8 | public void drop(DropTargetDropEvent dtde)
{
// Method Instances
boolean doChangePosition;
TreePath pathAfter;
int idxNew, idxOld;
BrowserItems.DefaultTreeItem itemParent;
BrowserItems.DefaultTreeItem itemSource;
BrowserItems.DefaultTreeItem itemAfter;
QueryTokens._Exp... |
905a9f51-2a3c-46d3-8bba-2ebdd300aa7e | 1 | @Override
public int hashCode() {
int hash = 0;
hash += (sucursalidSucursal != null ? sucursalidSucursal.hashCode() : 0);
return hash;
} |
fcc7dd27-2291-40ae-8fe1-ffec02fe4dbe | 5 | public void obterArvoreCMC(int raiz) throws Exception {
int n = this.grafo.numVertices();
this.pesoAresta = new double[n];
int vs[] = new int[n + 1];
this.antecessor = new int[n];
for (int u = 0; u < n; u++) {
this.antecessor[u] = -1;
pesoAresta[u] = Double.MAX_VALUE;
vs[u + 1] = u;
}
pesoA... |
6d3b2072-b56a-46e4-b631-95bc21347d65 | 6 | @Override
// Viento HORA ESTADO KMS/H
public InterfazCommand parse(String nombre) {
double velViento = 0;
String hora;
InterfazCommand c = null;
String[] atributos = nombre.split("\\s");
if (atributos.length >= 3)
{
if (atributos[0].equalsIgnoreCase("viento"))
{
hora = atributos[1];
Syst... |
8df62b05-52b2-4229-b8cb-6f7056ed5d64 | 1 | public static void initTimer(final int streamServerID, final String streamKey, final String id ){
timer = new Timer();
timer.schedule(new TimerTask() {
public void run() {
try {
JGroovex.markStreamKeyOver30Seconds(0, streamServerID, streamKey, id);
} catch (IOException e) {
e.printStackTrace(... |
8fb4a6c8-c4a2-44c4-a875-99cfe4b4f488 | 9 | public void visitMethodInsn(
final int opcode,
final String owner,
final String name,
final String desc){
if(mv != null)
{
mv.visitMethodInsn(opcode, owner, name, desc);
}
pop(desc);
if(opcode != Opcodes.INVOKESTATIC)
{
Object t = pop();
if(opcode == Opcodes.INVOKESPECIAL && name.charAt(0) == '<'... |
e8511e7f-37b0-497f-b937-103be2c41e43 | 4 | public void bfs(Node rt)
{
Queue<Node> q = new ArrayDeque<Node>();
if(rt != null) q.add(rt);
while(!q.isEmpty())
{
Node tNode = q.remove();
System.out.print(tNode.value+" ");
if(tNode.left!=null)
q.add(tNode.left);
if(tNode.right!=null)
q.ad... |
d3e5376e-7726-43eb-bb74-81444bf2df32 | 3 | private void initializeCommonRegions(int x) {
this.commonRegions = new long[2][6][x];
for(int i=0; i<this.commonRegions.length; i++) {
for(int j=0; j<this.commonRegions[0].length; j++) {
for(int k=0; k<this.commonRegions[0][0].length; k++) {
this.commonReg... |
b15716d3-f42d-4515-961c-f64c50f3934f | 5 | public static Field getField(Class cls, String fieldName)
{
Assert.notNull(cls, "cls cannot be null");
Assert.notNull(fieldName, "fieldName cannot be null");
// First check for public field using getField()
Field field = null;
try
{
field = cls.ge... |
11b6f1f6-8248-4486-be25-e57af2a90fd8 | 7 | private static Object processJsonArrayAsCollection(JsonElement jsonElement, Class<?> parameterClass, Class<?> genericClass) throws JsonException, IllegalAccessException, InstantiationException {
if (jsonElement.getType() != JsonType.ARRAY) throw new JsonException("Json Element is not Array");
if (!Coll... |
e0a1d539-eb61-48cd-944b-59d5d7ab4a12 | 7 | public double backPropagate(double[] input, double[] output)
{
double new_output[] = execute(input);
double error;
int i;
int j;
int k;
/* doutput = correct output (output) */
// Calcoliamo l'errore dell'output
for(i = 0; i < fLayers[fLayers.length - 1].Length; i++)
{
error = output[i] - new... |
50264b85-f342-424a-9ade-f0fdde3c247f | 0 | private boolean setupPermissions() {
RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class);
perms = rsp.getProvider();
return perms != null;
} |
c93e8843-e939-448f-8d85-a0ffdd777f3a | 1 | private static int calcLight(int radius, int radiusSq, int distX,
int distY, double dither, Color color) {
int distCenterSq = distY * distY + distX * distX;
if (distCenterSq > radiusSq) {
return 0;
}
return toData(((double) radius / (double) (distCenterSq)), dither,
color);
} |
3f537819-c709-42cd-83f5-dcc8e70baf20 | 6 | @Override
public void mouseDragged(MouseEvent e) {
List<GuiControl> controlList = new ArrayList<GuiControl>();
controlList.addAll(this.controlList);
for (GuiControl c : controlList)
c.mouseDragged(e);
if (e.getModifiersEx() == MouseEvent.BUTTON3_DOWN_MASK) {
scrollX -= e.getX() - diffX;
scrollY -... |
e354f211-72c9-4f32-85d3-d510e3bcce0e | 2 | public static OpCode parseOpCode(String str) {
for (OpCode op : values())
if (op.toString().equalsIgnoreCase(str))
return op;
return null;
} |
2cfb1840-e69b-41cf-a1f4-b1045d7a8607 | 4 | public int integerBreak(int n) {
if(n==2) return 1;
if(n==3) return 2;
int n3=n/3;
int left=n-3*n3;
int n2=0;
if(left==1){
n3-=1;
n2=2;
}else if(left==2){
n2=1;
}
return Double.valueOf(Math.pow(3, n3) * Math.po... |
b8be0942-1351-4dd6-8bd9-b2ced23726fd | 1 | @Override
public void actionPerformed(ActionEvent e) {
String teksti = syotekentta.getText();
if (!teksti.isEmpty()) {
teksti = teksti.substring(0, teksti.length() - 1);
syotekentta.setText(teksti);
}
} |
caf2be78-ec25-4b49-ad08-6c6829469d00 | 1 | public void createStatement(){
try {
stmt = con.createStatement();
} catch (SQLException e) {
e.printStackTrace();
}
} |
693ce093-c2c3-462e-bc88-6a9761087210 | 4 | public static KernighanLin processWithVertices(Graph g, Set<Vertex> vertexSet) {
Graph newG = new Graph();
for (Vertex v : vertexSet)
newG.addVertex(v);
for (Edge e : g.getEdges()) {
Pair<Vertex> endpoints = g.getEndpoints(e);
if (vertexSet.contains(endpoints.first) &&
... |
d24d36b8-4485-42d2-a960-14883bf161b8 | 5 | public boolean isSpaceAboveRobot() {
if(robot.getLocation().y <= 0) return false;
if(robot.getLocation().y <= GROUND_LEVEL) return true;
for(Rectangle hole:holes) {
if(((hole.y + hole.height) == robot.getLocation().y) &&
(robot.getLocation().x == hole.x)) {
return true;
}
}
return false;
} |
f40e60ad-a465-4081-aa64-1f6e57ed6bd3 | 8 | @Override
public double convertTo(int type) {
switch (type) {
case UnitConstants.FEET_SECOND:
return getValue() * 3.28084;
case UnitConstants.FEET_MINUTE:
return getValue() * 196.8504;
case UnitConstants.MILES_MINUTE:
return... |
096928d4-0981-4766-9863-4220e7ed03e4 | 6 | public GutterIconInfo[] getTrackingIcons(int line)
throws BadLocationException {
List retVal = new ArrayList(1);
if (trackingIcons!=null) {
int start = textArea.getLineStartOffset(line);
int end = textArea.getLineEndOffset(line);
if (line==textArea.getLineCount()-1) {
end++; // Hack
}
f... |
1f341956-b9ac-47d5-8674-9693cc145cfd | 8 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ChangesetCounter that = (ChangesetCounter) o;
if (counter != that.counter) return false;
if (day != that.day) return false;
if (hour !=... |
8c4abdcd-7877-49b1-94a4-0e52cfb97245 | 2 | private boolean bottomLeftCorner(int particle, int cubeRoot) {
for(int i = 0; i < cubeRoot; i++){
if(particle == i * cubeRoot * cubeRoot){
return true;
}
}
return false;
} |
78c56aa9-e440-4d4a-88fe-facaa42c7bfe | 3 | @Override
public void paint(Graphics g) {
g.setColor(super.getBackground());
g.fillRect(0, 0, this.getWidth(), this.getHeight());
if(autosize)
{
if(selected)
{
Image tmp = this.highlighted.getImage().getScaledInstance(this.getWidth(), this.getHeight(), java.awt.Image.SCALE_SMOOTH);
g.drawImag... |
24c2bab7-286f-4401-b0f7-21383cef91f5 | 1 | public void visitForceChildren(final TreeVisitor visitor) {
if (visitor.reverse()) {
expr.visit(visitor);
} else {
expr.visit(visitor);
}
} |
efed7b9f-f925-4b3d-a562-eb4e7df4dae7 | 0 | static void v(DangerousMonster d) {
d.menace();
d.destroy();
} |
195306a2-006d-46e7-8832-91220881b057 | 9 | private void updateLiteralRuleAssociationList_addRule(final Rule newRule) throws TheoryException {
// Set<Literal> literalList = newRule.getLiteralList();
Map<String, Rule> ruleList = null;
// theory type checking
if (newRule.hasTemporalInfo()) theoryType = TheoryType.TDL;
else if (newRule.hasModalInfo() && ... |
be66272f-e718-47bb-96d6-1e5c743d4cc2 | 8 | @Override
public void prepareInternal(int skips, boolean assumeOnSkip) {
//System.out.println("DelayUntil "+skips);
if(isCachable()) {
if (!assumeOnSkip) {
move.prepareInternal(0, false);
while(true) {
State s = curGb.newState();
boolean ret = move.doMove();
curGb.restore(s);
if(ret... |
67aeb379-fd92-482d-95ee-b9a6762a1682 | 4 | @Override
public void update(Observable arg1, Object arg2) {
if (this.controller != null) {
LOGGER.log(Level.FINE, "Updating GUI");
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
LOGGER.log(Level.FINE, "Number of connected clients: "
+ client.getUsers().size());
... |
a88f118c-5582-4d74-86fc-0e1fa4db7857 | 9 | public void onKeyReleased(int key) {
keys[key] = false;
if (key == Keyboard.KEY_RIGHT && !keys[Keyboard.KEY_LEFT]) {
player.setSpeed(0.0f, player.speed.y, player.speed.z);
}
if (key == Keyboard.KEY_LEFT && !keys[Keyboard.KEY_RIGHT]) {
player.setSpeed(0.0f, player.speed.y, player.speed.z);
}
if (k... |
848cc4ef-7a73-465a-890f-c6660fc99010 | 8 | private TokenizerProperty searchString(String image, boolean removeIt) {
char startChar = getStartChar(image.charAt(0));
PropertyList list = getList(startChar);
PropertyList prev = null;
while (list != null) {
TokenizerProperty prop = list._property;
String ... |
996385c3-59d7-4a6d-9a2b-4b38a9832f60 | 5 | private void btnExcelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExcelActionPerformed
final int totalFilas = this.table_ticket.getRowCount();
if (totalFilas > 0) {
final String rutaExcel = dir.getRuta_excel();
final ArrayList<Ticket> tickets... |
198fc43f-3d16-4746-99c0-4bce3fad59eb | 8 | public boolean sendPocsagMessage(PocsagMessage message) {
String tmp;
if (serialPort == null ) {
serialPort = openConnection(Config.btsPort, Config.btsBauds);
if (serialPort == null) {
return true;
}
}
try {
BufferedReader in = new BufferedReader(new InputStreamReader(serialPort... |
67dc5ab8-6c60-4d03-b13d-b2ff24efda3b | 9 | private int buildMatchHistory(int match, JPanel panel, int maxRounds) {
Vector columns = cdata.getColumnData(match);
int numRounds = cdata.getNumRounds(match);
int firstRound = 0;
// for (int i=firstRound; i<numRounds; i++) {
for (int i = numRounds - 1; i >= 0; i--) {
Color backColor;
// if ((i % 2 == ... |
d28c1e43-d2db-49d8-be97-fd505bb00838 | 5 | private void drawMenu(Graphics2D g){
g.setColor(Color.WHITE);
g.drawString("ASTEROIDS", (getWidth()-fm.stringWidth("ASTEROIDS"))/2, 100);
if (mainMenuTextAreas[0].contains(MouseInfo.getPointerInfo().getLocation()))
g.setColor(Color.RED);
else
g.setColor(Color.WHITE);
g.drawString("Play", (getWidt... |
d02f7478-e093-494d-93b0-ceadade29513 | 8 | public static void convertFolderToXML(String dir, boolean recursive)
{
File file = R2DFileUtility.getResource(dir);
if(!file.exists() || !file.isDirectory())
return;
R2DFileFilter filter = new R2DFileFilter();
for(File f : file.listFiles())
{
//Log.debug(f.isFile()+" "+filter.accept(file, f.getName()))... |
4b8a4b6c-4336-41fb-821a-480496e9df68 | 2 | private String needAbort(String transaction, Set<String> conflicts) {
transactionEntity thisone = transInfo.get(transaction);
for (String conflict : conflicts)
if (thisone.timestamp > transInfo.get(conflict).timestamp)
return conflict;
return null;
} |
1b79766c-d513-4f47-baac-86201b49c5da | 0 | public boolean isValid() {
return this.valid;
} |
74911a75-8921-4119-96c8-499b11461485 | 4 | public String getCameraType ()
{
switch (statusTable [1]) {
// case 0: ?
// case 1: return "DC-50";
// case 2: return "DC-120";
// case 3: return "DC-200";
// case 4: return "DC-210/215";
case 5: return "DC-240";
case 6: return "DC-280";
// FIXME:
case 7: return "DC-3400 (?)";
ca... |
4348137e-ba40-4eca-8a83-2903c6b8dcaf | 2 | public static void main (String args[]) {
Map<String, String> map = new HashMap();
fillData(map);
for (String key : map.keySet()) {
System.out.println(key + " " + map.get(key));
}
map.put("Added lately", "testing");
map.remove("Intellij");
for (Str... |
9bf1054a-ed2c-48b2-b0ad-a45f57c81403 | 5 | public static void main(String[] args) {
for (int i = 1; i <= 1000; i++) {
/**
* This is true if the number is divisible by 3.
*/
final boolean fizz = i % 3 == 0;
/**
* This is true if the number is divisible by 5.
*/
... |
a627f68f-45ba-4ddf-a589-efb74aa2a2d1 | 5 | public static void defend(SimulatedPlanetWars simpw) { //send ships from the lowest growing planet to the best one
// Tested
int maxGR = 0;
int minGR = 5;
Planet source = null;
Planet dest = null;
for (Planet p : simpw.MyPlanets()){
if (p.GrowthRate()>maxGR){
maxGR = p.GrowthRate();
dest = p;
... |
36b2fe64-5acd-41c9-80e2-a8d43ee121a9 | 7 | private void doFinishAction() {
switch (finishAction) {
case (NONE) : break;
case (HIDE) : {
if (component instanceof GUIComponentGroup) {
((GUIComponentGroup) component).hide();
}
break;
}
case (... |
5a121270-4a12-44aa-a721-9681a05f7b89 | 9 | public Boolean isStringValid(String in) {
//System.out.println("M " + in + " M");
Boolean returnVal=Boolean.TRUE;
if (in==null || in.length()==0) return returnVal;
Stack<Character> stk=new Stack<Character>();
try {
for (Character x: in.toCharArray()) {
if (startChars.indexOf(x)!=-1)
stk.push(... |
addcccb9-4acd-4617-bcdc-ece4c3e37fb3 | 6 | public static boolean isServerUpdateAvailable()
{
if( Settings.isOfflineMode() )
return false;
File tempFile;
boolean missingFile = false;
boolean outOfDateFile = false;
refreshLookupValues();
// Loop over local and remote application versions
// If there is a difference in the version, there... |
9a6efe14-195f-473f-90cc-367ce1c697e3 | 5 | public Read() throws IOException {
byte [] b = new byte [50000];
String fileName = System.getProperty("user.dir") + "/output/test.mp3";
File inputFile = new File(fileName);
InputStream is = new FileInputStream(inputFile);
is.read(b,0,50000);
for... |
996e2b02-8c2a-4801-ad91-0d6f2c4eb668 | 4 | private int[] defaultRgbArray(int width, int height) {
int[] rgbs = new int[width * height];
// fill everything with UnpassableSandTiles
Arrays.fill(rgbs, 0xffA8A800);
// add SandTiles for player bases
for (int y = 0 + 4; y < height - 4; y++) {
for (int x = (width / 2) - 5; x < (width / 2) + 4; x++) {
... |
19c0323c-2583-4144-a490-0ce3280d3d79 | 5 | public boolean initGUI()
{
InventoryOpenEvent ioe = new InventoryOpenEvent(this);
Bukkit.getPluginManager().callEvent(ioe);
if(ioe.isCancelled())
return false;
cont.setLayout(ContainerType.OVERLAY).setAnchor(WidgetAnchor.CENTER_CENTER).setWidth(width).setHeight(height).setX(-width/2).setY(-height/2);
con... |
d1ccba8c-ee0a-47c1-b577-a9e7b5512578 | 9 | protected void drawDays() {
Calendar tmpCalendar = (Calendar) calendar.clone();
tmpCalendar.set(Calendar.HOUR_OF_DAY, 0);
tmpCalendar.set(Calendar.MINUTE, 0);
tmpCalendar.set(Calendar.SECOND, 0);
tmpCalendar.set(Calendar.MILLISECOND, 0);
Calendar minCal = Calendar.getIns... |
89e091e5-c08e-47af-857f-a98d639d406b | 0 | public static void main(String[] args) {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("GSB-2014-eq1_initialPU");
} |
923322b1-37c4-4b54-9182-61f1e820aab9 | 7 | public ColorPallet(ColorPalletState initColorPalletState)
{
// WE'LL KEEP THE STATE, SINCE WE'LL USE
// IT EVERY TIME WE REFRESH
state = initColorPalletState;
XMLUtilities xmlloader = new XMLUtilities();
Document palletSettings = null;
try {
palle... |
6e0260a1-7453-4817-8aae-1a458a2b5ec6 | 8 | public void chgDir()
{
switch(dir)
{
case 0:
sprt = img1.getImage();
if(Game.tickCount2 == game.DELAY){
dir = 1;
}
break;
case 1:
sprt = img2.getImage();
if(Game.tickCount2 == game.DELAY){
dir = 0;
}
break;
case 2:
sprt = img3.getImage();
if(Game.tickCount... |
b56efe6c-154a-4b33-aca8-9b0632a57481 | 2 | public void setUserlistImagePadding(int[] padding) {
if ((padding == null) || (padding.length != 4)) {
this.userlistImg_Padding = UIPaddingInits.USERLIST_IMAGE.getPadding();
} else {
this.userlistImg_Padding = padding;
}
somethingChanged();
} |
20bb28a5-ab96-4f1d-b664-0fd5f01dc39c | 0 | public String getSource() { return Source; } |
83b669f1-d2a6-4573-b1d9-0593960f78e6 | 5 | private final String getChunk(String s, int slength, int marker)
{
StringBuilder chunk = new StringBuilder();
char c = s.charAt(marker);
chunk.append(c);
marker++;
if (isDigit(c))
{
while (marker < slength)
{
c = s.charAt(marker... |
d324a55e-4811-42f0-b75d-4cdca150f732 | 0 | @Override
public void execute() {
p.setBackground(Color.white);
} |
7ad41921-09bd-4193-bda6-223aef250906 | 6 | protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
JSONObject jb = new JSONObject();
InputStreamReader reader =
new InputStreamReader(request.getInputStream(), "utf-8");
String receivedString = "";
... |
2300a998-5629-4581-87ae-bafc132830a5 | 2 | @Override
public void setForeground(Color color) {
mColor = color;
if (mLink == null || mLink.getClientProperty(ERROR_MESSAGE_KEY) == null) {
super.setForeground(color);
}
} |
56bb0be7-e5b1-4fd0-a6e5-6be76063e1c1 | 2 | public static double evaluateState(SimulatedPlanetWars pw){
// CHANGE HERE
double enemyShips = 1.0;
double myShips = 1.0;
for (Planet planet: pw.EnemyPlanets()){
enemyShips += planet.NumShips();
}
for (Planet planet: pw.MyPlanets()){
myShips += planet.NumShips();
}
return myShips/en... |
af12bfa9-fb7d-44e7-a28d-42bebad05f05 | 1 | public static void EndTimeReport()
{
FileWriter fstream =null;
BufferedWriter out =null;
String ENDTIME = now("hh:mm:ss").toString();
try
{
fstream = new FileWriter(filename, true);
out = new BufferedWriter(fstream);
out.write("<table border=1 cellspaci... |
6c32e8f9-0d5e-4d43-a08f-8364266c4e7e | 6 | public int lengthOfLongestSubstring(String s) {
if(s.length()==0) {
return 0;
}
int j=1;
for(; j<s.length(); j++) {
int i=0;
for(; i<j; i++) {
if(s.charAt(i)==s.charAt(j)) {
break;
}
}
... |
9041ee3f-d982-4922-8606-53fb89734e1a | 0 | public IntNode getLink( )
{
return link;
} |
7f37e419-c398-4976-88c6-fc7ed939bf95 | 3 | public static void main(String args[]) {
//<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://download.oracle.com/java... |
712ae7a0-0140-4642-ac21-b239703601e7 | 3 | public JSONArray toJSONArray(JSONArray names) throws JSONException {
if (names == null || names.length() == 0) {
return null;
}
JSONArray ja = new JSONArray();
for (int i = 0; i < names.length(); i += 1) {
ja.put(this.opt(names.getString(i)));
}
re... |
68991a57-e934-4906-ad1e-e21ff2d7ab0c | 9 | public static String typeName(char _typeChar) {
String returnName = null;
switch (_typeChar) {
case SIGC_VOID:
returnName = "void";
break;
case SIGC_INT:
returnName = "int";
break;
case SIGC_DOUBLE:
returnName = "double";... |
32e85258-2d89-432e-8dc2-de2c9a19960b | 8 | public synchronized void actionPerformed(ActionEvent event) {
Object target = event.getSource();
if (target instanceof MenuItem) {
MenuItem item = (MenuItem)target;
int[] indexes = fOnlineList.getSelectedIndexes();
if (indexes... |
4c9b2f31-90be-4a80-8cd8-13c678ced720 | 0 | public void setAddress2(String address2) {
this.address2 = address2;
} |
89e6bdfb-8de5-41b2-b7f1-008bedc63cad | 6 | private void trInsertionSort (final int ISA, final int ISAd, final int ISAn, int first, int last) {
final int[] SA = this.SA;
int a, b;
int t, r;
for (a = first + 1; a < last; ++a) {
for (t = SA[a], b = a - 1; 0 > (r = trGetC (ISA, ISAd, ISAn, t) - trGetC (ISA, ISAd, ISAn, SA[b]));) {
do {
SA[b +... |
a22b8843-0113-4761-8e5c-cd935401d3c6 | 0 | public PainelDesenho() {
super();
this.addMouseListener(new EventosMouse());
objetos = new ArrayList<FiguraGeometrica>();
} |
40160a4e-b203-483d-883b-687efacbf093 | 3 | public void writeFile()
{
File file=new File("monsters.dat");
FileOutputStream fout;
ObjectOutputStream out;
try {
fout=new FileOutputStream(file);
out=new ObjectOutputStream(fout);
out.writeObject(current_id-2);
out.flush();
for(int i=0; i<current_id-1; i++){
out.writeObject(monsters.get... |
a9818df9-c155-4c97-85e8-1de4472c2eb1 | 0 | public Tea() {
this.setName("Coffee");
this.setPrice(new BigDecimal(15));
} |
bf4b28bf-14d4-49b9-8941-3fef040bceb3 | 1 | public static Session getInstance() {
if (instance == null ) {
instance = new Session();
}
return instance;
} |
cbbd3290-6d1a-42b3-8be3-783103ea9c48 | 4 | private static void writeToFile(String out) {
if (fileWriter == null) {
try {
fileWriter = new FileWriter("out.log");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
try {
fileWriter.write(out);
} catch (IOException e) {
// TODO Auto-generated cat... |
8792d518-0b10-43cf-bae2-30d732f9faca | 0 | public void setjTextFieldCP(JTextField jTextFieldCP) {
this.jTextFieldCP = jTextFieldCP;
} |
8beaeabb-8782-4839-bedf-c9c9f536a5f3 | 4 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PacketVO other = (PacketVO) obj;
if (packetId != other.packetId)
return false;
return true;
} |
1b2242bd-9d76-4c57-a725-783f7d248d30 | 9 | public void update()
{
Window window = Window.getInstance();
JPanel panel = window.getPanel();
if (pauseDelay > 0)
pauseDelay--;
if (keyboard.isDown(KeyEvent.VK_P) && pauseDelay <= 0)
{
if (!paused)
{
... |
22fba81a-93c2-40d3-916e-9d13ba649a27 | 1 | public String getBackground() {
if (styles == null) {
return null;
}
else {
return styles.get("bg");
}
} |
7b42fbd4-2091-4a7a-a537-6b5133f2fddc | 1 | public short evaluate_short(Object[] dl) throws Throwable {
if (Debug.enabled)
Debug.println("Wrong evaluateXXXX() method called,"+
" check value of getType().");
return 0;
}; |
15591224-34a2-4bf8-b3d4-2a3ade1d37a8 | 2 | public double[] rawItemMedians(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.rawItemMedians;
} |
143889da-6af1-48fc-896d-4b7f5c66e785 | 6 | private void printFinals(int maxRound, ArrayList<Match> finals, ArrayList<Match> sFinals, ArrayList<Match> qFinals) throws SQLException
{
/*
* Quarter Finals
*/
if (maxRound >= 7)
{
printShowQFinalHeader();
for (Match m : qFinals)
{
... |
979f523b-7f7c-4494-835f-3344e3a31fa9 | 3 | public TarHeader readNextFileHeader() throws IOException {
if(this.lastHeader != null) {
throw new RuntimeException("Must first read file content of last entry");
}
// Read a complete File entry
byte[] header = new byte[512];
do {
if(-1 == Util.readBloc... |
d7f72436-e7cb-4fdb-bbd5-5968988b5943 | 4 | private long neuerZaehler(char operation, Bruch tmpBruch2) {
// Anhand der übergebenen Operation wird die Rechnugn durchgeführt
switch (operation) {
case '+':
return (this.zaehler * tmpBruch2.nenner)
+ (tmpBruch2.zaehler * this.nenner);
cas... |
10430d56-0d5f-4f04-b40f-c6733b9c1c67 | 8 | public static void zoom(Model3D m, double d, int w, int h) {
if (h < 6 || w < 6)
return;
m.setDecalageX(w / 2);
m.setDecalageY(h / 2);
double smlX = w, hgX = 0, smlY = h, hgY = 0;
for (int i = 0; i < m.getPoints().size(); i++) {
if (m.getPoints().get(i).x < smlX) {
smlX = m.getPoints().get(i).x;
... |
d15412f9-0c50-470f-8083-a684f5b1d5fb | 0 | public Person2(int id, String Name, Double height) {
this.id = id;
this.Name = Name;
this.height = height;
} |
5b373438-235c-4fe4-95c4-73fd0ade966d | 0 | public boolean isProduction(Production production) {
return myProductions.contains(production);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.