method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
a3479ae9-57bf-4df6-ba67-0bac212e65f6 | 9 | private Passenger(Element elemPassenger, java.util.ArrayList<Company> companies) {
setName(elemPassenger.attribute("name").getValue());
setPointsDelivered(Integer.parseInt(elemPassenger.attribute("points-delivered").getValue()));
Attribute attr = elemPassenger.attribute("lobby");
if (att... |
183e8f8f-bc54-4198-bbbf-4d5e8ee128d6 | 1 | public void setShift( TextShiftStrategy shift ) {
if( shift == null ) {
throw new IllegalArgumentException( "shift must not be null" );
}
this.shift = shift;
regraph();
} |
cdc6cc5d-0b25-402b-adda-932b4c2ea47c | 6 | @Override
public int read(byte[] b, int off, int len) throws IOException {
init();
if (meEof) {
return -1;
}
if (dbuffer == null || dbufferIndex >= dbuffer.getLength()) {
if(tasks.size() == 0) {
meEof = true;
return -1;
}
DecompTask task = tasks.removeFirst();
try {
dbuffer = ta... |
f02a8838-6c09-4f43-8f89-84552f705b2d | 4 | private void respuestasActuales() {
_columnaAActual = new ArrayList();
_columnaBActual = new ArrayList();
for (int i = 0; i < _preguntas.get(_posicion).getRespuestas().size(); i++) {
_columnaAActual.add(_preguntas.get(_posicion).getRespuestas().get(i));
i++;
_... |
254e2ca3-9485-46c9-a8f7-b19e9c03ff1d | 0 | public void setConnectionInfo(ConnectionInfo connectionInfo) {
this.connectionInfo = connectionInfo;
} |
df84a76a-deac-40c3-8c08-73f65bf776ac | 7 | protected void encodePacket(OutputStream out, String sharedSecret, RadiusPacket request)
throws IOException {
// check shared secret
if (sharedSecret == null || sharedSecret.length() == 0)
throw new RuntimeException("no shared secret has been set");
// check request authenticator
if (request != null && ... |
c62c992f-c68a-49b8-9085-e1ccef3180dc | 1 | public void visit_dreturn(final Instruction inst) {
stackHeight -= 2;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
} |
f00575be-046d-4696-9235-ff7ea7a258c9 | 8 | private void BtGravarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtGravarActionPerformed
if (camposobrigatoriospreenchidos()) {
if (JOptionPane.showConfirmDialog(null, "Tem certeza que deseja Gravar esta operação e de que todas as informações estao corretas?", "Deseja gravar?"... |
13839acd-a8af-4201-8905-81b90ee65c38 | 4 | public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
int lw = getWidth() - 1;
int lh = getHeight() - 1;
int rw = GraphicField.SPACE_BETWEEN * 2;
int rh = GraphicField.SPACE_BETWEEN * 2;
BasicStroke pen = new BasicStroke(5, BasicStroke.CAP_ROUND, BasicStroke.... |
fa41c5aa-ab7f-41ae-9421-2df2889cc632 | 9 | @Override
public Parameter getParameter(final int parameterIndex) {
Parameter parameter;
switch (parameterIndex) {
case 0:
parameter = lo;
break;
case 1:
parameter = mid;
break;
case 2:
... |
068b7984-9d0c-4413-b0ad-3dfd4b508fb2 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Pedido other = (Pedido) obj;
if (codigo == null) {
if (other.codigo != null)
return false;
} else if (!codigo.equals(other.codigo))
r... |
a920fc71-660b-442d-bcf6-1b5a6ec6d850 | 8 | @Override
public boolean handleMessage(SOAPMessageContext context) {
System.out.println("Server : handleMessage()......");
Boolean isRequest = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
//for response message only, true for outbound messages, false for inbound
... |
8f357506-8ffa-4096-90c4-481fc6f42054 | 5 | private boolean jj_3R_11() {
Token xsp;
xsp = jj_scanpos;
if (jj_3_5()) {
jj_scanpos = xsp;
if (jj_3_6()) {
jj_scanpos = xsp;
if (jj_3_7()) {
jj_scanpos = xsp;
if (jj_3_8()) {
jj_scanpos = xsp;
if (jj_3_9()) return true;
}
}
}
}
return false;
} |
c3df3028-3fdd-46f5-9292-f410039d11bc | 1 | protected static ImageIcon createImageIcon(String path) {
java.net.URL imgURL = SplashScreen.class.getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL);
} else {
System.err.println("Couldn't find file: " + path);
return null;
}
} |
0cf351a3-4236-4c53-8716-6b83c2d7bb59 | 7 | public static double niceNumber(double x, boolean round) {
// exponent of x
int expv = (int) Math.floor(Math.log(x) / Math.log(10));
// fractional part of x, between 1 and 10
double f = x / Math.pow(10., expv);
// nice, rounded fraction */... |
3a99bd59-6fce-4a34-9566-313990409bc7 | 1 | public int numRangeAtoms() {
int cnt = 0;
for (RangeAtom ra = rangeList; ra != null; ra = ra.next) {
cnt++;
}
return cnt;
} |
353875e5-41ff-492d-a647-6e7512dbf5d5 | 7 | static final void method3437(int i, int i_0_) {
r var_r = null;
for (int i_1_ = i; i_1_ < i_0_; i_1_++) {
s var_s = Class348_Sub1_Sub1.aSArray8801[i_1_];
if (var_s != null) {
for (int i_2_ = 0; i_2_ < Class348_Sub41.anInt7054; i_2_++) {
for (int i_3_ = 0; i_3_ < Class318_Sub7.anInt6451;
i_3_++) ... |
6f8d737f-1d3a-467b-ae83-a161cdb83995 | 3 | public void processResourceUpdateUDP(UDPResource up) {
if (up != null) {
if (resources.containsKey(up.id)) {
Resource resource = resources.get(up.id);
if (resource != null) {
resource.processUpdate(up);
}
}
}
... |
b36411b3-6961-40d3-81e3-b7e1ab8d0fe3 | 9 | public LinkedList<TT> sort() throws Poset.Exception
{
//System.out.println("Initial events.source.main:");
//printGreaterLesserOrig(findNode("Context(events.source.main)"));
LinkedList<Node> Q = new LinkedList();
LinkedList<TT> out = new LinkedList(); // Sorted List
// Q <- Set of nodes with no incoming edge
for ... |
ac7c48d0-2f8a-4ade-8961-561577f6e09b | 7 | public static void main (String[] args) { //Set Main As Main Class
boolean classSelected;
classSelected = false;
String userAction;
Statistics charStats = new Statistics(); //Create Stats Object
System.out.printf("\nX----------------------------------------------------X\n");
System.out.printf( "| ... |
4b13ab1b-d2b9-440f-989b-37137ad0029c | 6 | public final LogoParser.singleLine_return singleLine() throws RecognitionException {
LogoParser.singleLine_return retval = new LogoParser.singleLine_return();
retval.start = input.LT(1);
Object root_0 = null;
Token char_literal9=null;
Token EOL10=null;
LogoParser.sente... |
43da1f76-5568-47af-b5e3-2fd3de164218 | 3 | private static double H(ArrayList<HashMap<String, String>> examples,
HashMap<String, String[]> attributeValues, String goalAttribute) {
double out = 0;
for (String goalValue : attributeValues.get(goalAttribute)) {
int valueCounter = 0;
for (HashMap<String, String> example : examples) {
if (example.get(... |
529b3e4e-b13a-4cc8-90f0-b259bb74d167 | 5 | public DescargarArchivo(String url)
{
String nombreFichero = url.substring(url.lastIndexOf("/")+1,url.lastIndexOf("."));
String extFichero = url.substring(url.lastIndexOf("."));
InputStream in = null;
FileOutputStream fout = null;
try//Guarda el flujo de datos de int... |
369c6889-eb11-4ef3-9c71-76f50d7ecece | 6 | public void connecterUtilisateur(String nomUtil, String motDePasse) throws NamingException, SQLException{
String trimNomUtil = "";
String trimMotDePasse = "";
if (nomUtil != null && motDePasse != null){
trimNomUtil = nomUtil.trim();
trimMotDePasse = motDePasse.trim();
}
if (trimNomUtil != "" && tr... |
6deac672-6611-464a-9e95-82150693133b | 8 | public boolean verifyHashing() {
System.out.println("Verifying reverse hashing:");
Random r = new Random();
for (int numIt=0; numIt<5; numIt++) {
if (numIt != 0)
System.out.println();
if (useExtended) {
//for (int i=0; i<num; i++) System.out.println(byteArrayToString(F[i]));
//System.ou... |
b3c6f7ef-f2e9-440a-a85e-c403a98b5568 | 4 | public void run() {
// double nsPerFrame = 1000000000.0 / 60.0;
// double unprocessedTime = 0;
// double maxSkipFrames = 10;
//
// long lastTime = System.nanoTime();
// long lastFrameTime = System.currentTimeMillis();
// int frames = 0;
// int updates = 0;
// while(running){
// long now = System.nanoTime();... |
0992e0a7-baa2-49a7-a899-d99e152e22c3 | 9 | public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
if (imgName.equals("Bamboo 1")) {
image = createImageIcon("images/Bamboo 1.png", "fall");
image.paintIcon(this, g2, 23, 20);
} else if (imgName.equals("Chrysanthemum")) {
image = createImageIcon("images/Ch... |
231750f5-b70e-4aca-a0ed-e57434143481 | 9 | public Object getValueAt(int row, int col) {
if (character == null){
return data[row][col];
}
ATTRIBUTEType attribute = character.getAttributes().get(columnKey[row]);
switch (col) {
case 0: return data[row][col];
case 1: return new Integer(attribute.getRacevalue());
case 2: return new Integer(attri... |
69ccccfe-21af-4f96-b68e-9e48de256e4a | 4 | public void menuArrondissement() {
int d;
String input = (String) JOptionPane.showInputDialog(frame.getFrame(), "Entrez la valeur du nouvel arrondissement:", "Changement arrondissement", JOptionPane.INFORMATION_MESSAGE, new ImageIcon("java2sLogo.GIF"), null, "");
try {
d = Integer.pa... |
30b2840c-5be0-4fd7-bb16-4ce7d80b8867 | 2 | public double average() {
// no data - guess an average
if (nround == 0)
return nfruits * sum(pref)/nkindfruits;
double sum = 0;
for (int i = 0; i < nround; i++)
sum += score(i);
return sum/nround;
} |
01eb880a-4505-4013-a364-1b2db93f08ee | 5 | private void initialize() {
try {
if (socket == null) {
statusMessage("Connecting to server...");
socket = new Socket(Parameters.SERVER, Parameters.port);
}
} catch (UnknownHostException e) {
System.out.println("Error trying to connect to host");
statusMessage("Unable to reach server");
this... |
328c2e33-a78f-41ee-968c-ff0a23dd858d | 7 | private boolean roadsEqual(Route newRoute, Route oldRoute) {
if (newRoute.path == null || oldRoute == null) return false ;
boolean match = true ;
for (Tile t : newRoute.path) t.flagWith(newRoute) ;
int numMatched = 0 ;
for (Tile t : oldRoute.path) {
//if (t.blocked()) I.say("TILE BLOCKED AT: "... |
d5d2300b-9604-4624-af6f-8e9c19473b95 | 9 | private static int findLastSum(Pair[] sortedSums, long key, int i) {
int l = 0;
int r = sortedSums.length - 1;
while (l <= r) {
int m = l + (r - l) / 2;
Pair mp = sortedSums[m];
if (mp.indx < i - 1 && mp.sum == key && (m == sortedSums.length - 1 || sortedSums... |
20b6d071-1a54-444b-bd90-cdc1430e196d | 2 | public static void main(String[] args) {
WeighingWithStones weight = new WeighingWithStones();
int[] stones = weight.findStones(40);
if(stones != null) {
for(int stone : stones) {
System.out.println(stone);
}
}
} |
6ed94ed4-4aa7-42f9-a434-29426cf25b46 | 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... |
cce08d50-7b41-4120-91a2-bbdfc4e9db79 | 1 | public byte[] getBytes() throws InvalidBEncodingException {
try {
return (byte[])this.value;
} catch (ClassCastException cce) {
throw new InvalidBEncodingException(cce.toString());
}
} |
5f752947-2ee9-45b6-a2cf-5c6b7075ce6e | 8 | public ArrayList<Piece> getCapturedPieces(Board board) {
int x = origin.getX(), y = origin.getY();
int dirX = origin.getX() < anchor.getX() ? 1 : -1;
dirX = origin.getX() == anchor.getX() ? 0 : dirX;
int dirY = origin.getY() < anchor.getY() ? 1 : -1;
dirY = origin.getY() == anchor.getY() ? 0 : dirY;... |
7385b7a7-8f7f-4d77-8a49-8af70730e8d2 | 6 | final Class318_Sub4 method2386(int i, AbstractToolkit var_ha) {
anInt9968++;
AnimatableToolkit class64 = ((Class318_Sub1_Sub1_Sub1) this).aClass235_9955
.method1668(false, true, -128, 2048, var_ha);
if (class64 == null)
return null;
Class101 class101 = var_ha.method3705();
class101.method894(((Class3... |
2ea09e8f-ea60-473b-a3b2-7705df537671 | 1 | public void disconnect() throws IOException {
running = false;
if(ishost == true) {
serverSocket.close();
} else {
clientSocket.close();
}
ishost = false;
playing = false;
opponentready = false;
} |
38dbcf6e-0351-46c1-b711-dc62c00a9080 | 9 | public int[] solution(String S, int[] P, int[] Q) {
// write your code in Java SE 8
int[][] prefixSumMatrix = new int[3][S.length() + 1];
for (int i = 0; i < S.length(); i++) {
short a = 0, c = 0, g = 0;
switch (S.charAt(i)) {
case 'A':
... |
46b7ca0c-1b43-4e2b-9d50-6658581daf3b | 2 | public MethodVisitor visitMethod(
int access,
String name,
String desc,
String signature,
String[] exceptions)
{
String newDesc = remapper.mapMethodDesc(desc);
MethodVisitor mv = super.visitMethod(access,
remapper.mapMethodName(className, name,... |
e64aeafb-cddd-4bb2-8d4b-c4de0e07a697 | 4 | private void expandCluster(HashSet<Point> cluster, HashSet<Point> neighbourPts) {
Queue<Point> neighbourList = new LinkedList<Point>(neighbourPts);
while(!neighbourList.isEmpty()) {
Point p = neighbourList.remove();
if(!p.visited) {
p.visited =... |
6adbcc2c-a61a-4c87-921f-16343c40d398 | 0 | @Override
public void Area(double dx) {
this.hight+=dx;
this.area = 6*hight*hight;
} |
00035706-eb7e-4626-8232-317ee8c1c37f | 2 | public double standardizedAllResponsesStandardDeviation(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.standardizedAllResponsesStandardDeviation;
} |
d8b64bfc-5bd7-42b2-b370-0dcc0f5eb8e9 | 1 | public void stopDecryptingComCards() {
try {
decryptComSub.remove();
comDecryptionCount = 0;
} catch (Exception e) {
// do nothing
}
decryptComSub = null;
} |
271fc541-f7c0-47d1-97ae-48d2b65e086d | 7 | public void updateTimer()
{
long var1 = System.currentTimeMillis();
long var3 = var1 - this.lastSyncSysClock;
long var5 = System.nanoTime() / 1000000L;
double var7 = (double)var5 / 1000.0D;
if (var3 > 1000L)
{
this.lastHRTime = var7;
}
els... |
73e704b2-9095-4872-a68d-dd90b0c6be70 | 6 | public void passEigenValues( double[] eigenValues, double[][] eigenVectors )
{
EigenValueDialog eigenDl =
new EigenValueDialog(owner, "Please select the eigenvalues...", eigenValues);
if ( eigenDl.open() )
{
boolean[] accept = eigenDl.getAcceptanceList();
int l = accept.length;
int n = 0;
for ( int i = 0;... |
d779c58d-3fc8-42cf-b9a7-e367a8726105 | 2 | public void systemMessage(String s){
String userInput;
BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
try {
while ((userInput = stdIn.readLine()) != null) {
sendMessage(userInput);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
... |
dc492b16-aac1-400c-89b3-f4adf786b9b4 | 6 | private void drawPreview(Graphics2D graphics) {
/*
* Berechnung der Groesse der Blockelemente. Die Groesse ist abhaengig
* von der Anzahl der Spalten und Zeilen und der jeweils verfuegbaren
* Hoehe und Breite des Panels.
*/
int heightBlockSize = this.getHeight() / Fi... |
e67714ed-da21-4189-b0ac-004bae0166bf | 2 | public Item removeLast() {
if (isEmpty())
throw new java.util.NoSuchElementException();
else if (size() == 1)
return removeFirst();
Item item = last.item;
last = last.prev;
last.next = null;
size--;
return item;
} |
6f740e99-f602-4082-9fb4-ec71229d476c | 8 | public synchronized void drawPopUps()
{
try
{
CoreClass.dialogSemaphore.acquire();
}
catch (InterruptedException e)
{
e.printStackTrace();
}
Set<PopUps> temp = Collections.unmodifiableSet(CoreClass.notifications);
g.setColor(Color.BLACK);
for(PopUps p: temp)
{
... |
58974fe7-1253-40eb-be7a-a413e2a9d83b | 4 | protected List<Ball>[] getCollisions(List<Ball> balls) {
@SuppressWarnings("unchecked")
List<Ball>[] collisionsArray = new LinkedList[balls.size()];
/*
* För att kolla om två cirklar är inom räckhåll av varandras areor så
* räknar vi avståndet mellan deras koordinater i var sitt led. Sen
* använder vi p... |
5027c14b-c914-4834-b13b-baf00180c30d | 2 | @Override
public String toString() {
String saSituation ;
if(this.situation == Vehicule.DISPONIBLE){
saSituation = "Disponible" ;
}
else if(this.situation == Vehicule.LOUE){
saSituation = "Loué" ;
}
else {
saSituation = "Réservé" ;
}
return "Vehicule [immatriculation=" + immatriculation + ", m... |
258b70fb-7ea8-42a5-b46a-a3a9037262de | 7 | public ASTExplorer(Composite parent,int style) {
super(parent,style);
this.problems = new IProblem[0];
this.blue = getDisplay().getSystemColor(SWT.COLOR_BLUE);
this.red = getDisplay().getSystemColor(SWT.COLOR_RED);
GridLayout gridLayout = new GridLayout();
super.setLayout(gridLayout);
Composite com... |
fc7bf9a3-8d3b-4dc5-9573-e4729f723846 | 4 | public Rectangle getBounds(String side) {
if (side.equals("left")) {
return left;
}
if (side.equals("right")) {
return right;
}
if (side.equals("up")) {
return up;
}
if (side.equals("down")) {
return down;
} else {
System.out.println("ERROR IN GETTING PLAYERBOUNDS: SIDE NOT SPECIFIED CORR... |
216accd0-d3c8-41c2-8e40-7ed80c3827a1 | 6 | public ArrayList<String> anagrams(String[] strs) {
// Start typing your Java solution below
// DO NOT write main() function
HashMap<String, ArrayList<Integer>> map = new HashMap<String, ArrayList<Integer>>();
int n = strs.length;
ArrayList<String> res = new ArrayList<String>();
if (n < 2)
return res;
f... |
80646c72-73eb-4488-9418-a7d6eeb3692e | 3 | protected boolean setFile(String fpath)
{
if(cur_file_loader != null)
{
cur_file_loader.die();
cur_file_loader = null;
}
if (fpath == null)
{
frame.setTitle(UIStrings.APPNAME + " - no file loaded");
return false;
}
// grab the filename a... |
fcd0747e-0ffe-4b5d-89a7-10cfcd090de8 | 5 | private void jj_rescan_token() {
jj_rescan = true;
for (int i = 0; i < 1; i++) {
try {
JJCalls p = jj_2_rtns[i];
do {
if (p.gen > jj_gen) {
jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
switch (i) {
case 0: jj_3_1(); break;
}
}
... |
ab692fcd-5cd6-44b5-9d61-4f41cc453173 | 2 | private void initialiseerVeld1(VeldType[][] eenVeldType1) {
for (int i = 0; i < eenVeldType1.length; i++) {
for (int j = 0; j < eenVeldType1[i].length; j++) {
eenVeldType1[i][j] = VeldType.LEEG;
}
}
eenVeldType1[0][1] = VeldType.MUUR;
eenVeldType... |
156269b7-e6ab-4ec0-bfe9-94640f2f94c4 | 4 | public Posizione getPosizione(int riga, int colonna) throws FuoriDamException
{
//ritorna la casella della damiera specificata dagli argomenti.
if(riga<0 || riga>7 || colonna<0 || colonna>7)
throw new FuoriDamException();
else
return damiera[riga][colonna];
} |
b59ccabc-e653-45dc-bee7-d18d1508fd12 | 2 | public Set<T> del(T a)
{ Set<T> res=this;
if(res.hasElement(a))
{ if(res.a.equals(a))
{ return res.next;}
else
{ return new Set(res.a, res.next.del(a));}
}
else
{ return res;
}
} |
596d8b46-06ab-4255-bbfb-724c09e31d16 | 8 | public ArrayList<Monster> mapToListMonster(char[][] map) {
ArrayList<Monster> monster = new ArrayList<Monster>();
for (int i = 0; i < map.length; i++){
for (int j = 0; j < map[i].length;j++) {
switch(map[i][j]){
case 'q':
monster.add(new Ranged(1, 40*i, 40*j, 1, Direction.BAS,"res/Monster/Rang... |
6fe3a1df-6a0c-4645-84ee-449457033d14 | 3 | public Element drawLine(List<mxPoint> pts, Map<String, Object> style)
{
String strokeColor = mxUtils.getString(style,
mxConstants.STYLE_STROKECOLOR);
float strokeWidth = (float) (mxUtils.getFloat(style,
mxConstants.STYLE_STROKEWIDTH, 1) * scale);
Element elem = document.createElement("v:shape");
if (... |
c5d36021-e57f-424e-b8bc-b00bd100d80b | 8 | public void putAll( Map<? extends Integer, ? extends Double> map ) {
Iterator<? extends Entry<? extends Integer,? extends Double>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Integer,? extends Double> e = it.next();
this.put(... |
d5751145-3c83-4843-b8a8-4ddd72a162ef | 7 | private void compareDealerHandToPlayerHands() {
for (Seat seat : seatManager.getSeats()) {
if (seat.hasHands()) {
for (Hand hand : seat.getHands()) {
int handTotal = hand.getFinalTotal();
int dealerTotal ... |
df36d45e-efc5-4da8-add4-143646b994ee | 5 | public static void main(String args[]) throws IOException{
int opc=-1;
Gabinete g;
Scanner input= new Scanner(System.in);
System.out.println("Qual Gabinete o cliente deseja? \n");
switch( menu_marcas(input, GabineteGamer.getListaMarcas()) ){
case GAMER: g = new GabineteGamer();
break;
case CLONE: g=n... |
1cb5c454-f7d6-4ed6-a48d-f4a3f6632d6a | 7 | public void load(String filename, String kzVrRr, String charSet) throws IOException {
logger.info("lade Spieler (" + kzVrRr + ") von " + filename);
CSVLoader loader;
if ("R".equalsIgnoreCase(kzVrRr)) {
loader = new CSVLoader() {
@Override
void processRow(String[] token) {
Spieler spieler = getSpi... |
afce0312-bfac-4f22-a3d0-2e14e4c48c8c | 1 | public void visitAttribute(final Attribute attr) {
text.add("\n");
super.visitAttribute(attr);
if (cv != null) {
cv.visitAttribute(attr);
}
} |
850f4b03-8569-4fc5-85ea-aaef18e52e33 | 3 | private int getNumberOfZombie(int time){
if (vectors[0][0] == null){
return 0;
}
int res = 0;
for (Vector vector: vectors[time]){
if (vector.getBeing().isZombie()){
res++;
}
}
return res;
} |
35c2b221-3f33-4b84-b887-d19036ada942 | 3 | public ArrayList<Integer> findValidMove(int piece) {
ArrayList<Integer> moveList = new ArrayList<Integer>();
for (int i = 0; i < 8; ++i)
for (int j = 0; j < 8; ++j) {
if (isValidMove(piece, i, j)){
b.set_suggest(i, j, 1);
moveList.add(i);
moveList.add(j);
}
}
return moveList;
} // en... |
a13223a9-9c93-45b0-a3bc-7bcd82d4ed6b | 5 | private boolean answerRiddle(Command command){
Room room = rooms.get(currentRoom);
if(!command.hasNthWord(2)){
System.out.println("Answer with what?");
} else if(!(room instanceof SpecialRoom) || ((SpecialRoom)room).complete()){
System.out.println("Answer who?");
... |
452f7110-3000-44ec-9eec-74493e0f5cbe | 5 | public static void setInput(Node[] gameboard, char side){
char otherside = 'o';
if(side == 'o'){
otherside = 'x';
}
int turn = 0;
int num = 0;
//put in the x's
for(int i = 0; i < 48; i++){
if(gameboard[i].getChar() == 'x'){
input[i] = 1;
turn++;
num++;
}
else{
input[i] = 0;
... |
8f151b0c-f333-45ff-b87a-05330c8a87cf | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> <S-IS... |
ccb4a919-bdbd-441f-a5e8-5ce5743df745 | 0 | public void setData(InputStream data) {
this.data = data;
} |
de3cefa4-490e-4de9-bc6c-24e0bf6b7f1e | 6 | public void listItinerary() {
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
System.out.println("Where is your MySQL JDBC Driver?");
e.printStackTrace();
}
PreparedStatement ps = null;
Connection con = null;... |
42a1aed8-2ea5-4d3e-820c-7bdc9873b5cc | 6 | public void setData(int length, ByteBuffer data) {
// read the table size values
short segCount = (short) (data.getShort() / 2);
short searchRange = data.getShort();
short entrySelector = data.getShort();
short rangeShift = data.getShort();
// create arrays to store ... |
bd41fc79-f43a-416f-985f-b4c1be80bfc0 | 4 | @Override
public void detectAndSendChanges()
{
super.detectAndSendChanges();
for (Object crafter : crafters)
{
ICrafting crafting = (ICrafting) crafter;
if (lastProgress != te.progress)
crafting.sendProgressBarUpdate(this, 0, te.progress);
... |
55e39211-3306-4fd4-b7b9-840fa9b23155 | 9 | public void run(){
DatagramPacket BroadCast=null;
if(State){//上线
while(State){
try {
for (int i=3000;i<3005;i++){
try {
String SendS="h"+" "+Name+" "+Port;
BroadCast = new DatagramPacket(SendS.getBytes("UTF-8"),SendS.length(),InetAddress.getByName("255.255.255.255"),i) ;
for... |
34af9a18-4f07-4b44-9503-43d64055bca0 | 4 | @Override
public void keyReleased(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_ESCAPE:
getScreen().getGUI().exit();
break;
case KeyEvent.VK_DOWN:
getScreen().selectNext();
break;
case KeyEvent.VK_UP:
getScreen().selectPrevious();
break;
case KeyEvent.VK_ENTER:
getScreen(... |
82247816-7dd8-4642-92f2-36a2954b9454 | 5 | public int stackHeight() {
if (isVoid()) {
return 0;
}
if (isWide()) {
return 2;
}
if (paramTypes != null) {
int numParams = 0;
// Count longs and doubles as 2.
for (int i = 0; i < paramTypes.length; i++) {
if (paramTypes[i].isWide()) {
numParams++;
}
numParams++;
}
r... |
5e63cddd-682a-4f1b-94fd-8960ed04e8c1 | 4 | public void body()
{
initializeResultsFile();
createGridlet(super.get_id(), NUM_GRIDLETS);
// schedule the initial sending of gridlets.
// The sending will start in a ramdom time within 5 min
Random random = new Random();
int init_time = random.nextInt(5*60);
... |
936b65fb-bc25-4cb1-83c2-a1aacc46c109 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof IPP)) {
return false;
}
IPP other = (IPP) obj;
if (serverIP == null) {
if (other.serverIP != null) {
return false;
}
} else if (!serverIP.equals(o... |
bf856679-f5dc-4ab4-b82e-0c0a3ca0a8d7 | 1 | public void setAsExecutor(Command cmd) {
cmd.setDescription(annot.desc());
cmd.setUsage(annot.usage());
cmd.setPermission(annot.permission());
cmd.setAliases(new ArrayList<String>(Arrays.asList(annot.alias())));
if (cmd instanceof PluginCommand) {
PluginCommand pcmd = ((PluginCommand)cmd);
pcmd.... |
b1762213-5230-4fb2-8ad1-7d8f9996a7f6 | 8 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
if (jTextField2.getText() == null || jTextField2.getText().length() < 1) {
JOptionPane.showMessageDialog(this, "Please select valid server/account id", "Error", JOptionPane.ERROR_MESSAGE)... |
4a5921b3-c6ee-498f-9876-3e334ceceb3c | 1 | @Override
public FileVisitResult preVisitDirectory(Path path, BasicFileAttributes attrs) throws IOException {
if (shouldSkip(path)) {
return FileVisitResult.SKIP_SUBTREE;
}
return FileVisitResult.CONTINUE;
} |
aaa9c51e-f160-408b-9d94-3b46c6034295 | 0 | @Test
public void testEndOfDay() throws ParseException {
Date date = dateService.getNextDay(dateFormat.parse("19.08.2014 20:47:54.345"));
assertEquals(dateFormat.parse("19.08.2014 23:59:59.999"), date);
} |
b4be652e-41b6-4558-b6a0-b75aed0e6052 | 1 | public PlotCommand(CommandParameter par) {
if(par == null)
throw new NullPointerException("PlotCommand has a null CommandParameter");
this.par= par;
} |
974e25d6-002d-4d35-a8d6-d6287bb3016d | 8 | public void putAll( Map<? extends Byte, ? extends V> map ) {
Iterator<? extends Entry<? extends Byte,? extends V>> it = map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Byte,? extends V> e = it.next();
this.put( e.getKey(), e.getValue() );
... |
4551c9e0-ae76-409a-8376-ec0ec9240f05 | 5 | public void putAll2(Map<? extends V,? extends K> m) {
for (Entry<? extends V, ? extends K> e : m.entrySet())
put2(e.getKey(),e.getValue());
} |
4e5a4246-a178-4c1e-ae4f-7a34540fef80 | 7 | public int firstMissingPositive(int[] nums)
{
if (nums.length == 0)
return 1;
for (int i = 0; i < nums.length; ++i)
{
// Move things into their 'right' place by
// swapping until we can no longer do it.
// That is each nums[i] should contain (i+1).
// We continue swapping until either nums[i]
... |
79539c54-ad9a-4bf6-85bc-098c1df7597d | 7 | public void run() {
preRender();
long previousTime = System.nanoTime();
double secondsPerTick = 1 / 60.0;
double unprocessedSeconds = 0;
boolean ticked = false;
int fpsTemp = 0;
long tickCount = 0;
requestFocus();
while (running) {
long currentTime = System.nanoTime();
unprocessedSeconds +... |
5f569fd5-2dfb-4fa3-99a3-3875f65963aa | 4 | public Color getColor(int row, int col) {
if (row >=0 && row < rows && col >= 0 && col < columns)
return grid[row][col];
else
return null;
} |
e34dd7e0-d62b-4b53-a2ea-75a286517798 | 9 | public static void textPack(byte packedData[], String text) {
if (text.length() > 80) {
text = text.substring(0, 80);
}
text = text.toLowerCase();
int carryOverNibble = -1;
int ofs = 0;
for (int idx = 0; idx < text.length(); idx++) {
final char c = text.charAt(idx);
int tableIdx = 0;
for (int i ... |
a55d8a45-f057-47fc-8ce0-98fb84d56a43 | 3 | public void drawBullets(Graphics2D g2d, Bullet bullets[], int[] screen) {
for(int i = 0; i < bullets.length; i++) {
try{
if(bullets[i].living) {
bullets[i].draw(g2d, screen, this);
bullets[i].draw(g2d, screen, this);
}
} catch (NullPointerException e) {
// we... |
09fb14f9-302c-48b9-8e1d-1ac969c526e0 | 0 | public int size() {
return _queue.size();
} |
947604e1-d8f4-4b1b-94e9-b4351a857f63 | 2 | public <T> void process(final HttpServletRequest request, final HttpServletResponse response, final ModelMap model,
final CallBackHandler callback) {
Object jsonResult = null;
CommonResp<T> serviceResult = null;
try {
serviceResult = callback.handle();
if (serviceResult.isSuccess()) {
jsonResult = c... |
1655d06e-f3a0-4379-b5b4-1c5bea932e8e | 7 | @Override
public UnitItemStack[] write(DataOutputStream out, PassthroughConnection ptc, KillableThread thread, boolean serverToClient) {
if(length == null || value == null) {
return null;
}
length = lengthUnit.write(out, ptc, thread, serverToClient);
if(length == null) {
return null;
}
if(leng... |
a899bfe6-b4c0-4d25-a598-7e596043d6cc | 1 | @Override
public int releaseAudioObject(int objectId) {
if (objectId != 0) {
objects.remove(objectId);
}
return 0;
} |
b6a9657b-66ee-4cc8-9125-125f4175c4ad | 4 | private void initView() {
setTerminalAction = new TooltipAction("Set Terminal",
"Begins the split of a group on a terminal.") {
public void actionPerformed(ActionEvent event) {
MinimizeTreeNode node = getNode();
if (node == null) {
JOptionPane
.showMessageDialog(ControlPanel.this, NODE_ERRO... |
c12a14c2-382c-4c1d-9d4a-236177555110 | 0 | IllegalNumberOfOperandsException(){
super("The stack must not be empty to be evaluated");
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.