method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7daf9d05-2363-491a-9141-7fe3ff5e0b31 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
IkszorBinaryObject other = (IkszorBinaryObject) obj;
if (!Arrays.equals(decodedValue, other.decodedValue))
return false;
if (!Arrays.equals(... |
8c0ba5b4-ed1a-4668-af5a-feded20c0e14 | 8 | private Result pDirectAbstractDeclarator$$Tail1(final int yyStart)
throws IOException {
Result yyResult;
int yyBase;
int yyOption1;
Node yyOpValue1;
Action<Node> yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pSymbol... |
cff5a7a7-89f2-4767-953e-b63248fe653c | 3 | public static void filledCircle(double x, double y, double r) {
if (r < 0) {
throw new IllegalArgumentException("circle radius must be nonnegative");
}
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2 * r);
double hs = factorY(2 * r);
... |
ac10a55a-3d0c-4634-a7d1-a680f8c1a4aa | 5 | public boolean setPlayer2(Player player) {
boolean test = false;
if (test || m_test) {
System.out.println("Game :: setPlayer2() BEGIN");
}
if (player == null) {
throw new IllegalArgumentException(
"Game::SetPlayer2 - Invalid player type(null) for player2");
}
m_pl... |
0dd80b05-9340-4875-9afb-9973a9d753a2 | 1 | @Override
public int getRoll(){
Iterator<IStrategy> it = this.getStrategies().iterator();
int max = 0;
while(it.hasNext()){
max = Math.max(it.next().getRoll(), max);
}
return max;
} |
9aa9377e-2ea0-4509-8b36-736eaaec6904 | 1 | public void addAgent(Agent agent) {
agents.add(agent);
if(this instanceof Connection){
agent.addConnection(this);
} else {
System.out.println(this.toString());
}
} |
d38a6c61-53b0-433d-8454-2323121e24be | 8 | public int maxPoints(Point[] points) {
Map<Double, Integer> statistic = new HashMap<Double, Integer>();
int maxNum = 0;
int duplicate = 1;
double k = 0.0;
for(int i=0; i < points.length; i++) {
statistic.clear();
statistic.put(Double.MIN_VALUE, 0); //itself
... |
4d159c0b-1fd1-4dc7-aaba-ca76d17df606 | 0 | @Override
public boolean hasMoreElements() {
return hasMore;
} |
c282ad39-aeec-4e74-a22b-d26e9342fad3 | 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... |
cdf98f36-3980-489c-8bf3-d4f67aa4857b | 1 | public List<List<Integer>> permute(int[] num) {
length = num.length;
if(length == 0) return result;
flag = new boolean[length]; //init flag
DFS(num); // dfs deep first research
return result; // return
} |
70a2ab0c-0397-4106-8000-080a2e027d97 | 3 | @Test
public void testGetPastMeetingList1()
{
cmInst.addNewPastMeeting(testContactSet, pastDate, "added as NewPastMeeting");
Calendar fDate = Calendar.getInstance();
fDate.setTime(new Date());
fDate.add(Calendar.SECOND, 1);
int fmId = cmInst.addFutureMeeting(testContactSet, fDate);
try {
Thread.sleep(1... |
3a5588d4-d793-4ac4-a589-d65b9f14275e | 8 | public CoordinateWrapper promptForCoordinates() {
Scanner in = Sudoku260.input;
int x, y;
do {
//Prompt the user for the coordinates:
System.out.println("Enter the coordinates in the format: x y");
String response = in.nextLine();
if(r... |
e2c8443d-29c6-4093-be56-e9b06d284b1c | 7 | public void fillWithData()
{
try
{
synchronized (this)
{
if (reader != null)
{
final ByteArrayOutputStream bout = new ByteArrayOutputStream();
while (reader.available() > 0)
{
final int c = reader.read();
if (c == -1)
throw new IOException("Received EOF");
if (... |
9614875d-c9b5-42ed-a910-99e5489b0157 | 1 | public SignatureVisitor visitReturnType() {
endFormals();
if (!hasParameters) {
buf.append('(');
}
buf.append(')');
return this;
} |
2f84bc2b-ca9d-4547-82f3-d51169cd2262 | 9 | public void doDrawing(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setColor(Color.black);
g2d.drawString("START", 30, 250);
int[] c = new int[3];
c[0] = 20;
c[1] = 80;
c[2] = 50;
int[] d = new int[3];
d[0] = 290;
d[1] = 290;
d[2] = 310;
g2d.fillPolygon( c, d, 3 );
g2d.fillRect(40, 250, 20, 40);
g... |
e575ffb7-baca-4399-9409-13ab88a946f3 | 5 | public static ArrayList<String> words(String line){
if(stopwords.size() == 0)
addStopwords();
ArrayList result = new ArrayList();
String[] words = line.split("[ \t\n,\\.\"!?$~()\\[\\]\\{\\}:;/\\\\<>+=%*]");
for(int i=0; i < words.length; i++){
if(words[i] != null && !words[i].equals("")){
String wor... |
b792f662-a0a9-4df1-92ee-73de431f2758 | 4 | @Override
public void actionPerformed(ActionEvent e)
{
if ("yes".equals(e.getActionCommand()))
{
action.buttonClicked(ButtonClicked.YES_CLICKED);
if (action.removeFrame())
{
frame.dispose();
}
}
if ("no".equals(e.getActionCommand()))
{
action.buttonClicked(ButtonClicked.NO_CLICKED);
if... |
effd6b25-5382-449e-83d5-8bb825034638 | 7 | public int splitBalanced(int[] array) {
if (array == null
|| array.length == 0
|| array.length == 1) {
return -1;
}
int length = array.length;
long leftSum = 0;
long rightSum = 0;
int quit = -1;
for (int i = 1; i < len... |
e58be9c5-d92d-4618-9104-fb44c4b663bd | 9 | public String getPermutation(int n, int k) {
if (n==1) return "1";
String rs = "";
if(k==1) {
for (int i=1; i<=n; i++){
rs += i;
}
return rs;
}
k = k - 1;
int[] product = new int[8];
product[0] = 1;
fo... |
75841b4e-8a8f-44cc-80c0-e6b1c93ce5ec | 5 | public State[] getStatesOnTerminal(String terminal, State[] states,
Automaton automaton) {
ArrayList list = new ArrayList();
for (int k = 0; k < states.length; k++) {
State state = states[k];
Transition[] transitions = automaton.getTransitionsFromState(state);
for (int i = 0; i < transitions.length; i++... |
084b4212-8a6e-4e09-9255-2a5f66c67c83 | 0 | @Override
public EntityManager getEntityManager() {
return super.getEntityManager();
} |
7a44938a-2a63-4640-bd1a-b6e634e6f158 | 4 | @Override
public boolean isInsideCircle(int cX, int cY, int rad, FieldObject fo) {
int dx = cX - fo.getX();
int dy = cY - fo.getY();
boolean insSq = Math.abs(dx) <= rad && Math.abs(dy) <= rad;
if (!insSq) { return false; }
if (dx * dy < 0) { return true; }
... |
1974306c-d234-4467-af8c-a788a095b102 | 9 | private void playGame()
{
gameCurrentlyRunning = true;
//infinite game!!
while(true)
{
if(currentGame == totalLevels){
JOptionPane.showMessageDialog( null, "Thanks for playing Asteroids! Congrats on battling the asteroid belt.\nRestart game..." );
//gameCurrentlyRunning = false;
currentGame = -... |
ffe287ce-ddc5-43ad-bd40-17b719f28571 | 4 | public static void loadFonkozeBase(){
ImD1 = new ImportDriver1("//localhost/fonkoze","root","");
if(ImD1.verifyConnection()){
try{
result=ImD1.executer("SELECT * FROM membre");
if(result !=null){
while(result.next()){
System.out.println("id: "+result.getInt("id"));
... |
ef96bce1-30b0-486a-9a19-ad95a3163585 | 2 | public void addReturn(CtClass type) {
if (type == null)
addOpcode(RETURN);
else if (type.isPrimitive()) {
CtPrimitiveType ptype = (CtPrimitiveType)type;
addOpcode(ptype.getReturnOp());
}
else
addOpcode(ARETURN);
} |
db8106be-11ba-4c2d-a658-d3c8421dd9f9 | 2 | public void setKickingDistance(float newDistance) {
if (newDistance <= 1.0f && newDistance > 0.0f)
kickingDistance = newDistance;
} |
fa74d193-0b58-4cb7-ac16-e8f040839b38 | 6 | public static Ptg calcNormsInv( Ptg[] operands )
{
if( operands.length != 1 )
{
return PtgCalculator.getValueError();
}
try
{
double x = operands[0].getDoubleVal();
if( (x < 0) || (x > 1) )
{
return new PtgErr( PtgErr.ERROR_NUM );
}
/*
* the algorithm is supposed to iterate over NOR... |
3ab251b2-be85-48a3-bf6c-68e0c0b97bab | 4 | public String getColumnName(int i) throws Exception {
String colName = null;
if (i == 0)
colName = "personID";
else if (i == 1)
colName = "name";
else if (i == 2)
colName = "projectID";
else if (i == 3)
colName = "role";
else
throw new Exception("Access to invalid colu... |
6befb169-7a77-4f04-ad8b-da22eaa6bfcf | 4 | public Currency search(String token) {
for (Currency currency : CurrencySet.getInstance()) {
if (currency.getCode().toLowerCase().equals(token.toLowerCase()))
return currency;
if (currency.getSymbol().toLowerCase().equals(token.toLowerCase()))
return curre... |
9076d5f5-c034-4d60-9a05-7d795249cfdc | 2 | public static RailSubmodesOfTransportEnumeration fromValue(String v) {
for (RailSubmodesOfTransportEnumeration c: RailSubmodesOfTransportEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
70ac114d-c8ab-46af-ae05-e4e76e9ce5fe | 6 | private static boolean verifyRunningReplica(Task task, OurSim ourSim) {
int running = 0;
for (Replica replica : task.getReplicas()) {
ExecutionState replicaState = replica.getState();
if (ExecutionState.RUNNING.equals(replicaState) || ExecutionState.UNSTARTED.equals(replicaState)) {
running++;
}... |
c123027f-e66f-4cc7-8f62-7432af1edbb0 | 6 | @SuppressWarnings("deprecation")
@EventHandler
public void onPlayerInteractBlock(PlayerInteractEvent event)
{
if(event.getPlayer().hasPermission("skeptermod.useitem.warhammer") || (event.getPlayer().isOp()))
if(event.getPlayer().getItemInHand().getTypeId() == Material.GOLD_AXE.getId() && event.getPlayer().get... |
1ea751ce-a3b2-4b79-9a1b-fb20d7023508 | 5 | public void setLine(Line line) {
if (line.getPoint0() == this || line.getPoint1() == this) {
haveLine = true;
this.line = line;
if (this == line.getPoint0()) {
if (line.getPoint0().getX() == line.getPoint1().getX()) { //Для вертикальных прямых
... |
58d0316a-37f8-4c29-8ba4-9ad4645a293a | 1 | private void read_page (PageId pageno, Page page) throws
BufMgrException {
try {
SystemDefs.JavabaseDB.read_page(pageno, page);
} catch (Exception e) {
throw new BufMgrException(e, "BUFMGR: read_page() failed");
} // end try
} // end read_page() |
dbfefd38-8508-4b55-b38e-28ab0dd0d011 | 8 | @Override
public ArrayList< DefaultConfig > loadConfig( String configPath )
{
ArrayList< DefaultConfig > result = new ArrayList< DefaultConfig >();
File config = null;
FileInputStream fis = null;
InputStreamReader isr = null;
BufferedReader reader = null;
String line = null;
String name = null;
Defa... |
b625273f-285c-4cc7-9501-f8e75aa06008 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
User other = (User) obj;
if (firstname == null) {
if (other.firstname != null)
return false;
} else if (!firstname.equals(other.firstnam... |
44bad31a-be36-416f-b42f-77c173bb9dc4 | 8 | * @param end
* @param dict
* @return
*/
public ArrayList<ArrayList<String>> findLadders(String start, String end, HashSet<String> dict) {
ArrayList<ArrayList<String>> result = new ArrayList<ArrayList<String>>();
dict.add(end);
int size = dict.size();
ArrayList<String> ... |
c5194db3-5ae2-41cb-b0f3-8a4430541058 | 3 | @Override
public void run() {
while(running){
try{
if(inStream.available() > 0){
gameTime = inStream.readDouble();
//playerArray = (int[][]) inStream.readObject();
}
} catch(Exception e){
e.printStackTrace();
}
}
} |
1839e2a1-a037-43fb-9364-8058189689a4 | 1 | public Placeable getRandomPlacable() {
Placeable p = null;
Object[] ks = placeables.keySet().toArray();
if (ks.length > 0) {
String s = ks[Rand.getRange(0, ks.length - 1)].toString();
p = placeables.get(s);
}
return p;
} |
657809cf-995e-4bae-9fa6-3f7bbd016cf2 | 1 | @Override
public void connect() throws Exception {
if (remoteClientCall == null) {
throw new IllegalStateException("RemoteClientConnection is not initial.");
}
remoteClientCall.connect();
} |
69518e2c-5fd1-4a6b-bce0-93baaffe9f23 | 4 | private Vector2 SnapToGrid(Vector2 mouse)
{
if (mouse.X % gridW[mode] != 0)
{
if (mouse.X < 0)
mouse.X -= gridW[mode];
mouse.X = ((int) (mouse.X / gridW[mode])) * gridW[mode];
}
if (mouse.Y % gridH[mode] != 0)
{
if (mouse.Y < 0)
mouse.Y -= gridH[mode];
mouse.Y = ((int) (mouse.Y / gridH[mo... |
e53c28fd-58b7-4d0a-bf2e-1fc184e03694 | 1 | public void start() {
if (state == EnumStopWatchState.STOP) {
timer = new Timer(NAME);
timer.scheduleAtFixedRate(this, 0, 1000);
state = EnumStopWatchState.RUNNING;
log.info("start stopwatch, it's state:" + state + ", elapseTime:"
+ elapseTime);
}
} |
aa36f9eb-c682-491b-8078-4a03b34cbc7c | 2 | public File getTransactionFile(String name) {
for (File f : getTransactionFiles()) {
main.debug("Comparing " + f.getName() + " to " + name + ".yml");
if (f.getName().equals(name + ".yml")) {
return f;
}
}
return null;
} |
a1482d95-de75-4c5d-ab48-95fa981a5b9f | 6 | protected void updateTable(String name, Map<String, String> columns) throws SQLException {
PreparedStatement statement = null;
try {
StringBuilder builder = new StringBuilder();
builder.append("CREATE TABLE IF NOT EXISTS ? (");
for (int i = 0; i < columns.size(); i++)... |
73991ddd-17db-4c69-9c20-3260f602411e | 0 | @Override
public void clearAppenders() {
doClearAppenders();
} |
8d0f1afb-e41d-4bc5-a86d-3baf9290b677 | 2 | public void addInputCallPanel(final String remoteChannel, final String localChannel){
if(remoteChannel!=null&&localChannel!=null){
final String remoteNumber = remoteChannel.substring(0,remoteChannel.indexOf("-"));
JPanel panel = new JPanel();
answerButton = new JButton("Ответить");
answerButton.a... |
abf3d01e-4b40-41c7-9442-344617a1a02c | 5 | JComponent getBankingTab() {
JPanel inner = new JPanel(new GridBagLayout());
GridBagConstraints innerConstraints = new GridBagConstraints();
innerConstraints.fill = GridBagConstraints.BOTH;
innerConstraints.gridx = 0;
innerConstraints.gridy = 0;
innerConstraints.weightx = 1;
innerConstraints.gridwidth = ... |
ae3dcb39-73ed-46b8-ac19-a805e5864d56 | 0 | @AfterClass
public static void tearDownClass() {
} |
122ec0d1-af94-47db-b06b-7997c1f77ee6 | 2 | public static Storyboard findStoryboardById(ArrayList<Storyboard> storyboards, int id) {
for(Storyboard storyboard:storyboards) {
if(storyboard.getId()==id) {
return storyboard;
}
}
return new Storyboard();
} |
2166a610-d71a-4f74-ba96-79bf4635c790 | 7 | @Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == browse) {
JFileChooser chooser = new JFileChooser();
int approve = chooser.showOpenDialog(null);
if(approve == JFileChooser.APPROVE_OPTION) {
File selectedFile = chooser.getSelectedFile();
... |
e4e12321-4f92-4d63-86e2-b8926d779fbc | 0 | @Override
protected void finalize() throws Throwable {
stat.close();
conn.close();
super.finalize();
} |
0a13c6a9-d717-45b9-a5dc-9b2a2c30f758 | 9 | protected void applyToTitle(Title title) {
if (title instanceof TextTitle) {
TextTitle tt = (TextTitle) title;
tt.setFont(this.largeFont);
tt.setPaint(this.subtitlePaint);
}
else if (title instanceof LegendTitle) {
LegendTitle lt = (LegendTitle) ti... |
4e4c7c65-2fa1-4194-a879-fbeae7722773 | 4 | @Override
public void deleteDirectory(String directory)
{
if (!dirEntries.containsKey(directory.toLowerCase())) return;
DirEntry de = dirEntries.get(directory.toLowerCase());
DirEntry parent = de.parentDir;
if (parent != null)
parent.childrenDirs.remove(de);
... |
907d8d5c-58e8-43ae-92a4-a1104d77207a | 9 | public static void main(String[] args) {
Socket clientSocket = null;
DataInputStream in = null;
PrintStream out = null;
DataInputStream inputLine = null;
//open a socket on port 6001
try {
clientSocket = new Socket("localhost", 6001);
out = new PrintStream(clientSocket.getOutpu... |
ba6dc45b-ee77-48ff-8af9-a923376c0b2f | 1 | public boolean ModificarTrabajo(Trabajo p){
if (p!=null) {
cx.Modificar(p);
return true;
}else {
return false;
}
} |
cbd4908c-feee-4fd2-aef3-b368efb0af91 | 9 | private void execute() {
if(newWorkspace == null && removedImports.size() == 0) {
for(String newImport : addedImports) {
doImport(newImport);
}
imported.addAll(addedImports);
addedImports.clear();
if(imported.size() > 0 && reloadImportButton != null)
reloadImportButton.setEnabled(true);
... |
63e8e741-eca9-47b7-840d-d97e87e86aca | 8 | static final public void instruction() throws ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ident:
affectation();
break;
case LIRE:
lecture();
break;
case ECRIRE:
case ALALIGNE:
ecriture();
break;
case SI:
conditionnelle();
break;
... |
b157efd0-b417-4f19-8958-4ef88cff70c1 | 0 | public void setLoaded(boolean loaded) {
this.loaded = loaded;
} |
e7668951-81a1-495f-a9c0-82a97338b1ee | 7 | public GameWindow(Game game) {
boolean test = false;
if (test || m_test) {
System.out.println("GameWindow :: GameWindow() BEGIN");
}
boolean m_Trace = false;
if(m_Trace) System.out.println
("GameWindow::GameWindow() - window initializing");
if(m_Trace) System.out.println
("GameWin... |
31f36be5-8354-444c-b689-97c30545a986 | 5 | public static Properties readConf(String s) {
File f = new File(s);
System.out.println(s);
if (f.exists() && f.canRead()) {
try {
String s1 = null;
BufferedReader read = new BufferedReader(new FileReader(f));
while ((s1 = read.readLine()) != null) {
if (s1.startsWith("#")) {
} els... |
98ca3da1-3537-4e60-8594-9025a6eafc02 | 8 | @Override
protected void drawData(Graphics g) {
if(graphValues == null) return;
int X, Y;
int lastX = Integer.MIN_VALUE;
int highestValue = bufferYmax;
int lowestValue = bufferYmin;
if (lowestValue <= highestValue){
//jLabelVMin... |
5cab840a-45b2-4c64-9934-62afc35c1894 | 1 | public void selectSize(int x,int y)
{
for(int i=0;i<markers;i++)
{
marker[i].selectSize(x, y);
}
} |
094a4044-88f2-4b9a-908b-5e30b753b0ad | 6 | @SuppressWarnings("resource")
public void serverStart() throws Exception {
System.out.println("Server started");
ServerSocket serverSocket = new ServerSocket(5432);
LinkedList<Socket> clientSockets = new LinkedList<Socket>();
ArrayList<PrintWriter> outArrayList = new ArrayList<PrintWriter>();
int coun... |
bdfbd9b7-d45a-4d73-8016-77364ee29b28 | 0 | public void setUsername(String username) {
this.username = username;
} |
07a95b32-5ce2-470d-8730-796847adc9fd | 1 | public void setRpcPass(String rpcPass) throws InvalidSettingException {
if (rpcPass != null) {
this.rpcPass = rpcPass;
} else {
throw new InvalidSettingException("Invalid Password");
}
} |
bfd857e5-55a0-427a-8af5-aee62c5a1c1d | 3 | 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... |
cbb68194-f728-42af-97c2-a33b34589222 | 1 | @Test ( timeout = 2000 )
public void serverWriteToSocketClosedByServer () throws Exception {
Socket[] sockets = connectToServer();
try ( Socket serverSocket = sockets[ 0 ];
Socket clientSocket = sockets[ 1 ] ) {
serverSocket.close();
// wait for close to propag... |
ce35d412-2b8d-4495-ad9e-81612e2ecb0b | 0 | public JobSchedulerBuilder withStoreDurably( boolean storeDurably )
{
this.storeDurably = storeDurably;
return this;
} |
ab5b29ca-0437-4bb6-8f9e-9b36c22993da | 4 | public <T extends IMessage>void addHandler(final Class<T> type, final IMessageHandler<T> handler) {
List<IMessageHandler<? extends IMessage>> handlers = handlersByMessage.get(type);
if (handlers == null) {
handlers = new ArrayList<IMessageHandler<? extends IMessage>>();
... |
a8d1737c-84cf-4df5-a72f-e039ab73a03b | 3 | ClientSideView( int portNum, String host )
{
eventMapper = new EventMapper( new ClientActionConfigurator().getConfigurator());
text = new JLabel( "Text to send over socket:" );
textField = new JTextField( 20 );
button = new JButton( "Click Me" );
webSocketPortOpener = new JButton( "Open web-socket port" );
... |
8e503737-013c-42f7-ab12-8f54e74c4ee0 | 1 | private synchronized boolean checkPulse(Peer p){
return p.hasPulse()? true:false;
} |
4c5c10fd-e317-4e26-ac91-3bd33828164b | 4 | protected double objectiveFunction() throws NNException {
double result = 0;
for (Pattern<?,?> pattern : patterns) {
List<Double> processed = network.process(pattern.getInputSignal());
for (int i = 0; i < processed.size(); i++) {
result += Math.pow(processed.get(i).doubleValue() - pattern.getOutputSignal(... |
f52ea3dd-8f5b-42a1-a721-a3f877a51c74 | 0 | @Override
public int attack(double agility, double luck) {
System.out.println("I did a default skill attack");
return (int) agility;
} |
d1acbaee-121f-4cc8-a8de-58059c1a733b | 9 | public void onEndPage(PdfWriter writer, Document document) {
if (this.numberPos > 0) {
float width = document.getPageSize().getWidth();
float height = document.getPageSize().getHeight();
try {
if (total == null)
total = writer.getDirectContent().createTemplate(30, 16);
if (this.hasTotleNumber)
... |
44cb7707-de74-4af7-8ab1-79624d963681 | 1 | public Expression mergeIntoExpression(Expression expr) {
/* assert expr.getFreeOperandCount() == stackMap.length */
for (int i = stackMap.length - 1; i >= 0; i--) {
// if (!used.contains(stackMap[i]))
// used.addElement(stackMap[i]);
expr = expr.addOperand(new LocalLoadOperator(stackMap[i].getType(),
... |
3758f719-954b-4c2f-9f9a-bb4ee025a666 | 9 | public void create(PypAdmAgend pypAdmAgend) {
if (pypAdmAgend.getPypAdmAsistConList() == null) {
pypAdmAgend.setPypAdmAsistConList(new ArrayList<PypAdmAsistCon>());
}
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
... |
1d95e9ae-516c-4438-8d5e-e78f29ce1e21 | 2 | @Override
public void paint(Graphics2D g2d) {
super.paint(g2d);
g2d.setColor(Color.CYAN);
g2d.drawString("R:"+salud, x, y+50);
if(salud <= 10 && vidas > 0){
g2d.setColor(Color.LIGHT_GRAY);
g2d.drawString("v:"+vidas, x, y+10);
}
} |
448ae4c1-369d-4f5e-899b-02b68c6dcff7 | 0 | public void setRoomEventList(final List<RoomEvent> roomEventList) {
this.roomEventList = roomEventList;
} |
5b24ccf2-c1cf-4681-8065-c7e4f8d3404b | 5 | private void updateALUTable(){
//Get a copy of the memory stations
ALUStation[] temp_alu = sim_instance.getALUStations();
//Update the table with current values for the stations
for( int i =0; i < temp_alu.length; i++ ){
//generate a meaningfull repre... |
c6ab4244-dee7-41e3-8836-9808122c2a4e | 3 | public static void main(String[] args) {
System.out.println("Starting client...");
// Parse and set command-line arguments
try {
parseCommandLineArguments(args);
} catch (IllegalArgumentException iae) {
System.err.println("Error parsing port number: " + iae.getLoc... |
7326a28f-ab70-4daa-81a2-e8fe309fd7f0 | 7 | public static void main(String[] args) throws Exception {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
String linea;
while((linea=bf.readLine())!=null){
String[] boxes = linea.split(" ");
long totalCajas = 0 ;
for(int i=0;i<boxes.length;++i){
totalCajas += Integer.parseIn... |
a73f0b63-eb95-4f73-903d-f5c8105366c2 | 1 | public String getAuthor() {
return this.author == null ? "" : this.author;
} |
fcbb9b4e-198c-4ff3-93e7-e60ddf5c39e4 | 0 | public static void main(String[] args) {
creator1 = new ConcreteCreator1();
product1 = creator1.factory();
creator2 = new ConcreteCreator2();
product2 = creator2.factory();
} |
912ef84c-a68d-47a4-a1c1-94d8b9eb7e2e | 0 | public void mouseDragged(MouseEvent e){
x = e.getX();
y = e.getY();
} |
f2934623-7a74-497e-9af3-20ca80d88e42 | 7 | public void sort(SortArray a, SortCanvas c) {
int j;
int limit = a.length();
int st = 0;
while (st < limit) {
boolean flipped = false;
st++;
limit--;
for (j = st; j < limit; j++) {
if (a.greater(j, j + 1)) {
a.swap(j, j+1);
flipped = true;
}
c.paintNumbers();
}
if (!flip... |
e48cbb18-7553-4a01-9c57-75040997de84 | 7 | public void buildAssociations(Instances instances) throws Exception {
Frame valuesFrame = null; /* Frame to display the current values. */
/* Initialization of the search. */
if (m_parts == null) {
m_instances = new Instances(instances);
} else {
m_instances = new IndividualInstances(new I... |
d0f62c8a-286a-4885-a1a2-c41c39731462 | 3 | public void ForgotPassword(RequestPacket request, DBCollection coll, User user) {
try {
// Check that given username and email match a record in DB
DBCursor cursor = coll.find(new BasicDBObject("user_name", request.getUser_name()));
if(cursor.hasNext()) {
if(request.getEmail().equalsIgnoreCase(((BasicDBO... |
b70821dc-e824-4657-ad97-08273e573870 | 1 | public void createHuffTree()
{
while(items > 2)
{
Node first = removeFirst();
Node second = removeFirst();
Node newNode = new Node(first.frequency + second.frequency, -1);
newNode.left = first;
newNode.right = second;
first.next = first.prev = second.next = second.prev = null;
insert(newNo... |
db413e2a-9052-483c-af5a-0e76cb6ddd22 | 1 | public synchronized void stop() {
running = false;
try {
thread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
} |
f75c5692-d54f-4dd4-8408-ac6dcfdb4965 | 6 | public static void save(String filename, double[] input) {
// assumes 44,100 samples per second
// use 16-bit audio, mono, signed PCM, little Endian
AudioFormat format = new AudioFormat(SAMPLE_RATE, 16, 1, true, false);
byte[] data = new byte[2 * input.length];
for (int i = 0; i... |
e026fab8-99c6-469e-a413-e74c9160dec6 | 3 | public void doAll() {
// TODO Auto-generated method stub
switch (currentStep) {
case CREATE_SINGLE_TRAPSTATE:
JOptionPane.showMessageDialog(frame,
"Just create a state.\nIt's not too difficult.",
"Create the State", JOptionPane.ERROR_MESSAGE);
return;
}
for (Integer key:myNeededTransitionMap.key... |
0b4edb06-1a7c-4fa7-bc52-51a8e3b48e04 | 3 | private JFileChooser setFilters(JFileChooser jfc, boolean predefined, String comment, String extension) {
if (predefined ||
!jfc.getFileFilter().getDescription().equalsIgnoreCase("Todos los Archivos")) {
jfc.setAcceptAllFileFilterUsed(false);
}
FileNameExtensionFilte... |
cadecfee-2d2a-442c-8ab8-5e40b032e4fd | 7 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if((affected==null)||(!(affected instanceof MOB))||(target==null))
return true;
final MOB mob=(MOB)affected;
if(mob.location()!=target.location())
unInvoke();
if(mob.getVictim()!=target)
unInvoke();
if(mob.rangeToTar... |
719659f0-0188-4096-8cb8-681b0821b683 | 0 | @RequestMapping(value = "/", method = RequestMethod.GET)
public String home(Locale locale, Model model) {
logger.info("Welcome home! The client locale is {}.", locale);
Date date = new Date();
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
String formatt... |
3c3b7898-b86a-4c69-be22-faa03986e6a3 | 2 | public void log(String content) {
try {
if ( !Files.exists(dir, LinkOption.NOFOLLOW_LINKS) )
Files.createDirectory(dir);
content += System.getProperty("line.separator");
Files.write(file, content.getBytes(), StandardOpenOption.CREATE,
... |
c58d6eca-14c8-4f61-a39f-01dc3ac24fc0 | 5 | public void print(List<String> IdsToStrings,String pad) {
Iterator<T> uniIter=UnigramCounts.keySet().iterator();
T myValue;
Double myVal;
int getVal;
if (pad==null) {
pad="";
}
while (uniIter.hasNext()) {
myValue=uniIter.next();
myVal=UnigramCounts.g... |
0d8c612f-f410-4e16-9fce-ed3f2f39c9cd | 6 | private static boolean available(int port) {
if (port < MIN_PORT_NUMBER || port > MAX_PORT_NUMBER) {
throw new IllegalArgumentException("Invalid start port: " + port);
}
ServerSocket ss = null;
DatagramSocket ds = null;
try {
ss = new ServerSocket(port);
ss.setReuseAddress(true);
ds = new Datagra... |
03d4b3a7-2908-4af3-a07c-18c23ede4f71 | 1 | @Override
public List<Integer> save(List<Order> beans, GenericSaveQuery saveGeneric, Connection conn) throws DaoQueryException {
try {
return saveGeneric.sendQuery(SAVE_QUERY, conn, Params.fill(beans, (Order bean) -> {
Object[] obj = new Object[8];
obj[0] = bean.g... |
16ae8c63-c0ac-4a95-bf7b-236a3a8d774f | 7 | public PanelValidationReservation(JFrame frame, List<Reservation> listeReservations) {
SimpleDateFormat formatterDeb = new SimpleDateFormat("'Le 'dd/MM/yyyy' de 'HH'h '");
SimpleDateFormat formatterFin = new SimpleDateFormat("HH");
infosPaiement = null;
Date dateReservation = null;
int duree;
dateReservati... |
636edb4e-a220-4860-b6bc-167363141a8c | 0 | private static void getCommand() {
System.out.print("[Moves:" + moves + " Score:" + score + " Ratio:" + ratio + " Possible directions:" + possibleDirs + "] ");
Scanner inputReader = new Scanner(System.in);
command = inputReader.nextLine();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.