method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e921fbfb-40d7-44b5-8999-9cb0619e53f3 | 2 | public int getCheckedCount() {
int result = 0;
for (int i = 0; i < checkedItems.length; i++) {
if (checkedItems[i]) {
result++;
}
}
return result;
} |
ffc7961e-e46c-4407-88c3-cfa579ffbf21 | 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... |
32ee6e4b-1011-4bb4-a548-76219b1fc163 | 3 | public static void main(String[] args) throws FileNotFoundException {
RoomCheckinCheckoutTracker roomCheckinCheckoutTracker = new RoomCheckinCheckoutTracker();
System.out.println("Enter the number of visits ");
Scanner scanner = new Scanner(System.in);
int totalInputs = Integer.parseInt(... |
2947cb41-2b4e-448c-9a15-42c1cec4b0da | 9 | public void start() {
String input;
while (IN.hasNextLine()) {
input = IN.nextLine();
input = input.trim();
if (input.startsWith("VOTE ") && input.length() > 5) {
machine.vote(input.substring(5));
} else if (input.startsWith("ADD PARTY ")... |
59c9efad-e115-454d-8198-0b4f59b5c75a | 2 | public int getRowDepth(int col) {
// XXX Memento?
for (int row = 0; row < model.numOfRows(); ++row) {
if (model.getCell(col, row) != CellState.EMPTY) {
// FIXME warum -1? weil bei check horizontal muss ich wieder +1
return row - 1;
}
}
// FIXME warum -1? weil bei check horizontal muss ich wieder +... |
ffc7abb7-ade9-4338-9307-2fdaed97a935 | 3 | @Override
public Class getColumnClass(int column) {
Class returnValue;
if ((column >= 0) && (column < getColumnCount())) {
if(getValueAt(0, column)==null)
return String.class;
returnValue = getValueAt(0, column).getClass();
... |
e3451c3f-5666-41fd-9624-640b33a0bfa9 | 5 | private void printMap()
{
System.out.println("Bombs");
for(int i=0; i<mapHeight; i++)
{
for(int j=0; j<mapWidth; j++)
{
if(map[i][j])
System.out.print("*");
else
System.out.print("_");
... |
ba00b314-9c92-4b98-8755-bd1162185b98 | 4 | public static void main(String[] args) {
FastqVariant fastqVariantIn = FastqVariant.FASTQ_ILLUMINA;
FastqVariant fastqVariantOut = FastqVariant.FASTQ_SANGER;
if (args.length != 1) {
System.err.println("Usage: Fastq2Fastq inFile.fastq > outFile.fastq");
System.exit(-1);
}
// Parse command lien argumen... |
7c5b56aa-56c9-4bfb-8c7c-8e0e671ec348 | 8 | public void control(MeView me, AgentView[] agents, ThingView[] things) {
if (things != null)
throw new Error("internal error: no things yet");
me.a = 0;
me.vt = 0;
AgentView ta = null;
for (AgentView av : agents) {
double d2 = dist2(me, av);
if... |
88d65589-115d-4fd0-a8bb-2424b45a9dbf | 3 | @Override
public boolean addPackage(DCPackage p, boolean waiting) {
if(!waiting) {
nextScheduledRound = -1;
return true;
}
roundRange = p.getNumberRange();
currentRound = p.getNumber();
if(currentRound == nextScheduledRound || nextScheduledRound == -1) {
nextScheduledRound = calculateNextRound();
... |
c51fa529-8a4b-4761-84c4-71bd921c2c39 | 4 | @Override
public void run() {
for (Citation c : citations.getCitations()) {
io.println(c.getId() + ": " + c.getTitle());
}
Integer command = -5;
try {
command = io.getInteger("Give id of the article to remove (or -1 to cancel): ");
}
c... |
4252e488-b930-4446-9c1f-2646d0073ace | 1 | private void buildComponents(Container window) {
if (window instanceof Frame)
frame = (Frame) window;
window.setFont(new Font("dialog", Font.PLAIN, 10));
classpathField = new TextField(50);
classField = new TextField(50);
sourcecodeArea = new TextArea(20, 80);
errorArea = new TextArea(3, 80);
verbose... |
fc847966-e979-4ce8-9968-d3d13dcb810e | 4 | public void grabTexture(int var1, boolean var2) {
int var3;
if((var3 = this.getSlot(var1)) >= 0) {
this.selected = var3;
} else {
if(var2 && var1 > 0 && SessionData.allowedBlocks.contains(Block.blocks[var1])) {
this.replaceSlot(Block.blocks[var1]);
}
}
... |
eba90cbd-9ac4-44c4-b269-f4a57a46da2e | 0 | static public double getYToMap()
{
return yToMap[zoomIndex];
} |
5303a0be-3586-448a-9971-364be3c86c85 | 0 | @RequestMapping("/{producto}")
public ModelAndView agregarStock( @PathVariable String producto) {
Stock stock = Stock.getInstance();
// Obtenemos la cantidad de stock del producto pasado por parametro
Integer productStock = stock.obtenerStock().get(producto);
ModelMap model = new ModelMap();
model.p... |
916495d2-1999-4465-b81f-08971a0b0d91 | 4 | @EventHandler
public void onTalk(AsyncPlayerChatEvent event){
Player player = event.getPlayer();
if(!player.hasPermission("NodeWhitelist.Whitelisted")){
if(!whitelistWaive.isWaived(player)){
if(!Config.GetBoolean("NoneWhitelisted.Restraints.CanTalk")){
if(!Config.GetString("NoneWhitelisted.Messages.Speak... |
d5f13905-fb2e-43ff-859f-5df1ef6bdb5d | 6 | public int startTurn(ArrayList<Integer> guessNumAry){
while(true){
int currentGuess = guessNumAry.get(0);
//if there's only one element in the guessNumAry, just check that one
if(guessNumAry.size()==1){
if (currentCorrectButton == guessNumAry.get(0))
... |
dd64453f-17a9-4fce-b583-812649e7ee84 | 4 | @Override
public String toString(){
String o = "Deck "+name+'\n';
int count = 0;
if(this.repeated){
for(int i=0; i<cards.size(); i++){
o = o + quantity.get(i) + ' ' + cards.get(i) + '\n';
count += quantity.get(i);
}
}else{
for(int i=0; i<cards.size(); i++){
o = o + cards.get(i) + '\n';
... |
107ca58a-fda2-47e3-b0ce-056ad529ca09 | 2 | public void execlisteMetaDonneesParTitre(String nom) {
ResultSet resultat = null;
resultat = listeMetaDonneesParTitre(nom);
try {
while (resultat.next()) {
System.out.println(resultat.getString("nom"));
}
} catch (SQLException e) { // TODO Auto-generated catch block
e.printStackTrace();
}
setCh... |
c4890f30-9e22-4baf-9426-ff213e9419b4 | 0 | @Basic
@Column(name = "ip_address")
public String getIpAddress() {
return ipAddress;
} |
8d224f81-0b60-4745-892c-d44fa04d048b | 5 | public int compareTitleTo(Movie z)
{
if(getTitle().equals(z.getTitle())) {
return 0;
}
int forloopLength;
if(getTitle().length() > z.getTitle().length()) {
forloopLength = z.getTitle().length();
}
else {
forloopLength = getTitle().length();
}
for(int i = 0; i < forloopLength;... |
95eb76c9-0300-4594-8162-fb4161031738 | 8 | public void left()
{
if (mState != jumping && mState != beginJump && mState != ducking && mState != hardLanding)
{
facing = left;
mState = running;
if (heroxSpeed > 0)
heroxSpeed = -.5f;
else if (heroxSpeed > -4)
heroxSpeed -= .5f;
}
else if (mState == hardLanding)
heroxSpeed *= .9;
... |
12131627-3fda-49c3-9d28-4bf7cf3e7208 | 9 | public void Punkterechnen() {
//Kurve wird zurückgessezt
resetBersetKurve();
//punkte werden in ein neues Arry uebertragen
Point punkte[][] = new Point[30][30];//speichert die Punkte
System.arraycopy(eingabePunkte, 0, punkte[0], 0, eingabePunkte.length);
//Startpunkt der ... |
96e0371a-5b76-4bbb-818a-091a23072e29 | 5 | @Override
public void action(Player player) {
int amount = 0;
fireMessageEvent(player.getPlayerId());
if(dm < 0) {
int positive = dm * -1;
for(Player p : playerHashMap.values()) {
if(!player.equals(p)) {
p.addMoney(positive);
amount += positive;
}
}
player.pay(amount);
} else {
... |
eda1539f-c1c9-4776-a274-0db1c3ba6d61 | 3 | public void objectRestore(Object obj) {
if(!obj.getClass().getSimpleName().equals(this.classObj))
throw new RuntimeException("Can't restore an object from a different class.");
System.out.println("DEBUG: Restore object " + obj.getClass().getSimpleName());
for(Field fld : this.storeObj.getClass().getFields()) {... |
0282c07e-bef1-423b-aa89-2e678b60726b | 0 | private void placeInitialConditions() {
initialConditionsPanel.setLayout(gridBagLayout);
//Create GridBagConstraints
GridBagConstraints constraints = new GridBagConstraints();
constraints.anchor = GridBagConstraints.NORTHWEST;
constraints.insets = DEFAULT_INSETS;
constra... |
55a731d9-6cbf-47ea-a92f-ceae49349850 | 0 | public State[] getSelected() {
return (State[]) selected.toArray(new State[0]);
} |
cb42c003-7a95-46c3-abfe-88b476e5dfc7 | 7 | private void txtnumtfijoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtnumtfijoKeyTyped
char caracter = evt.getKeyChar();//Validacion del campo telefono movil
if (caracter >= '0' && caracter <= '9' || caracter == 8 || caracter == KeyEvent.VK_BACK_SPACE || caracter == KeyEvent.VK_CAPS_LOCK ||... |
45b3c184-8c0a-4003-9033-11fcd0654d69 | 5 | public ITask taskForNeed(Need need, Collection<ITask> tasks, double time, Person person, SimulationMap map){
List<ITask> tasksForNeed = new ArrayList<>();
for(ITask task: tasks){
if(task.fulfilledNeed() != null && task.fulfilledNeed().equals(need.name())){
try{
... |
c9033b6b-13f2-49ba-b1c6-5cd54aaf80d0 | 7 | public static void main(String[] args) throws Exception
{
HashMap<String, List<Double>> pcaMap = getFirstAxes();
BufferedReader reader = new BufferedReader(new FileReader(new File(
ConfigReader.getCREOrthologsDir() + File.separator +
"chs_11_plus_cards.txt")));
BufferedWriter writer = new Buffere... |
162db328-7764-4a38-8e4c-59946adf8da0 | 0 | public boolean getIsRunning() {
return running;
} |
e2c7252a-cd2e-42b9-97fe-4dcda42a3a1f | 1 | public void removeSong(Song s){
try{
org.hibernate.Transaction tx = session.beginTransaction();
session.delete(s);
tx.commit();
} catch (Exception e){
e.printStackTrace();
}
} |
2e373e71-35ef-46e1-8c33-7ae52b01c58c | 2 | @Override
public T validate(String fieldName, T value) throws ValidationException {
if (value == null) {
return null;
}
if (max.compareTo(value) < 0) {
return max;
}
return value;
} |
c508f092-6d99-4253-b751-19c812fd18aa | 2 | public static String[] removeDuplicateStrings(String[] array) {
if (ObjectUtils.isEmpty(array)) {
return array;
}
Set<String> set = new TreeSet<String>();
for (String element : array) {
set.add(element);
}
return toStringArray(set);
} |
d502c869-2900-4bd7-bc47-b3fbba601e01 | 5 | * @return true if the email-address is correct, false otherwise
*/
public static boolean checkEmail(String str) {
int i;
boolean atChar = false;
if (!str.contains(".")) {
return false;
}
for (i = 0; i < str.length(); i++) {
if (str.charAt(i) == '@... |
e03bda33-2847-4265-8e59-c6c62c757590 | 8 | @Override
public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
this.sbg = sbg;
gc.setShowFPS(false);
txtName = new TextField(gc, ttf, 148, 27, 320, 27, new ComponentListener() {
public void componentActivated(AbstractComponent source) {
S... |
1ad0c5e8-aa75-4467-afac-5fa27c9457c7 | 1 | @Override
public void messageReceived(String sender, String message) {
message = HTML.escapeTags(message);
String myNick = getServerTab().getConnection().getNick();
if ( message.indexOf(myNick) > -1 )
message = HTML.blue(message);
appendText( HTML.bold(sender) + ": " + ... |
f7330d30-f308-4302-b460-57452a55875a | 5 | public static boolean tryGoingToRepairIfNeeded(Unit unit) {
// Only wounded mechanical units should consider being repaired
if (!unit.isWounded() || !unit.isRepairable()) {
return false;
}
if (!isUnitReallyWoundedAndNotAScratch(unit)) {
return false;
}
// ===========================================... |
566d64ba-e284-4a46-bc77-692503746812 | 2 | public static String combineStringList(List<String> words, String separator) {
String string = "";
for (String word : words) {
if (!string.isEmpty())
string += separator;
string += word;
}
return string;
} |
9c78be49-8e57-44fe-bce8-70acaebe92f4 | 9 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Statistics that = (Statistics) o;
if (id != that.id) return false;
if (questions != that.questions) return false;
if (rightAnswers != t... |
2ab90fb1-2959-43b6-9ffb-ef9f233301d9 | 0 | public int getMP() {
return mp;
} |
5b86c688-41cb-4255-afe2-7c9545e6727c | 5 | public int minPathSum(int[][] grid) {
int m = grid.length;
if (m==0){
return 0;
}
int n = grid[0].length;
int result[][] = new int [m][n];
result[0][0] = grid[0][0];
for (int i=1;i<m;i++){
result[i][0] = result[i-1][0]+grid[i][0];
}... |
c398cb34-dee2-4e92-ae06-138edffafe92 | 5 | public double getSternThickness(){
if(!this.sternOption){
System.out.println("Class: GouyChapmanStern\nMethod: getSternThickness");
System.out.println("The Stern modification has not been included");
System.out.println("A value of zero has been returned");
return ... |
da88bb19-d3c6-4f5b-9ce0-213c71060c22 | 7 | public int setStructure(Instances headerInfo){
Capabilities cap = getCapabilities();
if (!cap.test(headerInfo))
throw new IllegalArgumentException(cap.getFailReason());
if(m_writeMode == WAIT && headerInfo != null){
m_instances = headerInfo;
m_writeMode = STRUCTURE_READY;
... |
36a0fc86-10c3-4690-9c3e-59382090e7bf | 1 | public Class<?> getReturnParam()
{
return this.returnParameter;
} |
921f78af-8195-4c74-8d61-a9053e96049f | 4 | private void displayMove(Unit unit)
{
currentMoveLabel.setText(String.valueOf(unit.getCurrentMove()));
maximumMoveLabel.setText(String.valueOf(unit.getMove()));
moveBar.setMaximum(unit.getMove());
moveBar.setValue(unit.getCurrentMove());
if (unit.getCurrentMove() == unit.getMove()) {
if (unit.getMove(... |
e9a3eefe-6af8-48dd-82bd-ed5cfb374052 | 1 | @Override
public GameGraphic[] getObject(String name, Map<String, String> data) {
// If a cache of this object already exists, return it
if (cache.containsKey(name)) {
return cache.get(name);
}
/*
* Make a call to our asset manager to get a 2d array of BufferedImage.
* IE a sliced image.
*/
Buff... |
e87f24ff-c503-440c-992a-358e03a27217 | 0 | @Test
public void shouldCompareCorrectly() {
assertTrue(new Version("2.5", "2", "5").compareTo(new Version("3.1", "3", "1")) < 0);
assertTrue(new Version("7.0.1", "7", "0.1").compareTo(new Version("7.0", "7", "0")) > 0);
assertTrue(new Version("7.0.1", "7", "0.1").compareTo(new Version("7.0.... |
c15afe53-71e3-42e7-836c-76debc5b02ed | 7 | public synchronized void gridletCancel(int gridletId, int userId) {
SSGridlet sgl = null;
// The jobs whose execution time is larger than this time have to be
// shifted forwards. There's no point in changing jobs that are
// scheduled to start before this time.
double refTim... |
ca865671-40eb-41bf-8eed-8fb73f7bb6da | 7 | public static boolean hasProperty(String k) {
if (!(Integer.valueOf(k.substring(1, 4)) % 2 == 0))
return false;
if (!(Integer.valueOf(k.substring(2, 5)) % 3 == 0))
return false;
if (!(Integer.valueOf(k.substring(3, 6)) % 5 == 0))
return false;
if (!(Integer.valueOf(k.substring(4, 7)) % 7 == 0))
retu... |
3db6ec4d-d7d8-4a27-bfef-9b439c03dcbc | 0 | public void block() {
System.out.println("[DcClient] SEVERE: blocking is currently unavailable");
} |
b05f63da-8e2d-4258-967b-0b98c9ab02e0 | 3 | private static void calcNoOfNodes(Node node) {
if (node instanceof Parent) {
if (((Parent) node).getChildrenUnmodifiable().size() != 0) {
ObservableList<Node> tempChildren = ((Parent) node).getChildrenUnmodifiable();
noOfNodes += tempChildren.size();
f... |
eb2534e6-3817-488c-a840-038df0be9fde | 3 | public String cadastrar() {
if (!nome.isEmpty() && valor != null) {
ExameDAO exame = new ExameDAO(null, nome, valor);
FacesContext contexto = FacesContext.getCurrentInstance();
if (exame.cadastrar()) {
FacesMessage mensagem = new FacesMessage("Cadastro realiza... |
14b47255-ff72-4ae7-ab5e-322e0cbfebde | 5 | @Override
public Table createTable(final String tableName, List<Class<?>> columnTypes) throws IOException {
checkName(tableName);
String fullPath = tableDir + File.separator + tableName;
if (columnTypes == null || columnTypes.size() == 0) {
throw new IllegalArgumentException("wr... |
437c16ee-7583-4cde-ae42-b64953b75c9e | 6 | private void checkTask(Calendar cal) {
Task[] tasks = DBHandler.getAllTasks();
boolean wasChange;
for (Task task : tasks) {
wasChange = false;
if (!task.isWas_handled()) {
if (!(task.isTasKFirstSent())) {
sendTaskToRecipient(task);
task.setFirstsent(true);
wasChange = true;
}
... |
ff69b1fa-cd6f-4e74-a7d2-a7f4a207398a | 1 | public Ticket(JSONObject jsonobj){
//System.out.println(jsonobj.get("data"));
String jsonText = jsonobj.get("data").toString();
System.out.println("JSON STRING: " + jsonText);
JSONParser parser = new JSONParser();
try {
Object obj = parser.parse(jsonText);
JSONObject jsonObject = (JSONObject) obj;
JS... |
07877a5d-1b89-4688-b9f8-7c995499aa9a | 4 | public ArrayList<Action> getAdmissibleActions() {
ArrayList<Action> admissibleActions = new ArrayList<>();
admissibleActions.add(Action.DOWN);
admissibleActions.add(Action.UP);
admissibleActions.add(Action.LEFT);
admissibleActions.add(Action.RIGHT);
if (blankColumn == 0)
admissibleActions.remove(Action.L... |
b8deddfb-84d8-4d5e-ae73-e081f27e7b87 | 9 | public static void balance(Player player, String[] args) {
boolean adminPerm = player.hasPermission("boxeconomy.admin");
if (args.length > 0) {
// balance <player>
if (adminPerm && args.length == 1) {
Player target = Bukkit.getPlayer(args[0]);
if (target == null) {
player.sendMessage("player does... |
f7ef4493-d4ba-4ae5-9566-39d18aeab121 | 7 | public String readLine2() throws IOException {
sb.delete(0, sb.length());
int c = -1;
boolean eol = false;
while (!eol) {
switch (c = read()) {
case -1:
case '\n':
eol = true;
break;
case '\r':
eol = true;
long cur = getFilePointer();
if ((read()) != '\n') {
seek(cur);
}... |
2cd51a10-112d-4501-a83a-0712c152b834 | 3 | private void quit() {
if (!askForSave()) {
return;
}
if (dic != null) {
try {
dic.cleanup();
} catch (IOException ex) {
showError(Localization.getInstance().get("cleanupError"), ex);
}
}
System.exit(0);
} |
a432600c-a45c-4108-bd7f-63efebf64059 | 3 | public boolean equalsExpr(final Expr other) {
if (!(other instanceof ConstantExpr)) {
return false;
}
if (value == null) {
return ((ConstantExpr) other).value == null;
}
if (((ConstantExpr) other).value == null) {
return false;
}
return ((ConstantExpr) other).value.equals(value);
} |
a5bda31c-7c23-4e4e-9834-f7cf1790f581 | 0 | public InetAddress getInetAddress() {
return _inetAddress;
} |
7760b377-9693-4ed9-a0a0-1e7132598c1e | 8 | private static void treeToArray(Node node, int i, Integer[] arr) {
if(node!=null && arr!=null && i<arr.length && arr[i]!=null){
if(node.left!=null && arr.length>(2*i+1) ){
arr[2*i+1] = node.left.value;
treeToArray(node.left, 2*i+1, arr);
}
if(node.right!=null && arr.length>(2*i+2) ){
arr[2*i+2] =... |
ae84cbf9-0fd3-452e-9332-398aa0db4b69 | 5 | public List<Proveedor> getListaProveedor(){
List<Proveedor> ListaProveedor = new LinkedList();
Conexionbd.conexion bd = new Conexionbd.conexion();
List<producto> lp = new LinkedList();
try{
bd.conectarBase();
ResultSet rs = bd.sentencia.executeQuery("SELECT * FROM... |
e0ec72d8-a400-4ee3-95ff-d27e6008df70 | 8 | public Mochila getCandidato(double pRandom)
{
System.out.printf("Numero entre 0 y 1: " + "%3.2f",pRandom);
System.out.println();
double Porcentaje = -1;
for(int i = 0; i < _ListaDePorcentajes.size()-1 && Porcentaje == -1; i++)
{
if(_ListaDePorcentajes.get(i) <= pR... |
fd13b4df-5f7f-44f3-a0f4-5d75bce38ac6 | 8 | public ArrayList<Integer> rechenArt()
{
ArrayList<Integer> list = new ArrayList<>();
int a = 0, s = 0, m = 0, d = 0, p = 0, w = 0;
try
{
ResultSet set = read("SELECT RECHENART FROM OPERATION");
while(set.next())
{
switch(set.getStrin... |
cc55d94e-a3bd-497b-aa3c-aa1efc53376d | 6 | private boolean isGameOver(Point [] testPoints, Tile clickedTile)
{
for(int i = 0; i < 2; i++)
{
Point currentPoint = testPoints[i];
Tile currentTile;
int arrayIndex;
//checks to make sure the test point isn't outside the board.
if(currentPoint.getXPos() < 0 || currentPoint.getXPos() > ... |
e70ff4d1-1192-4ca9-8916-57becc65ee67 | 8 | public static void truncate(Image image) {
for (int x = 0; x < image.getWidth(); x++) {
for (int y = 0; y < image.getHeight(); y++) {
double red = image.getPixel(x, y, RED);
double green = image.getPixel(x, y, GREEN);
double blue = image.getPixel(x, y, BLUE);
if (red > Image.MAX_VAL) {
red = I... |
846287f3-d0c2-48b9-b0fd-dad28e79e9aa | 8 | @Override
public void executeTask() {
try {
DatagramSocket ssFQ = new DatagramSocket(4112); // create a new
// socket
DatagramSocket socket = new DatagramSocket(6666); // UDP socket to
// listen on,
String requestedFile;
InetAddress clientIP;
int clientPort;
while (tr... |
b190b8ff-30aa-41a7-9b47-8dd48e032546 | 4 | public boolean update(DataRow parameters, DataRow row)
{
if(!checkUser())
{
return false;
}
boolean result;
row = addIdentifyingParameters(row);
try
{
result = local.update(parameters, row);
if(server.checkConnection())
... |
3eb77820-cd81-4c64-8fd3-66098cb6a757 | 0 | @Override
public void windowOpened(WindowEvent e)
{
} |
1ceb3baa-c361-45a7-b924-1b83b8215772 | 1 | public int maxPathAsRoot(treeNode curRoot) {
this.running_time_asRoot++;
if (curRoot == null)
return 0;
return maxPathNotRoot(curRoot.leftLeaf)
+ maxPathNotRoot(curRoot.rightLeaf) + curRoot.value;
} |
764f4c02-d4ba-4bfe-9d71-a276cc2ea72e | 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... |
d2082d95-bd6e-40a3-a692-d9aefbed6c98 | 0 | public Wall(int x, int y, int w, int h, TankClient tc) {
super();
this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.tc = tc;
} |
af50dfbe-7bb7-4997-8d2f-88c75508acaf | 1 | public static void write (org.omg.CORBA.portable.OutputStream ostream, pgrid.service.corba.PeerReference[][] value)
{
ostream.write_long (value.length);
for (int _i0 = 0;_i0 < value.length; ++_i0)
pgrid.service.corba.PeerArrayHelper.write (ostream, value[_i0]);
} |
e2fd2ef6-880e-4496-83e5-1d83837e5031 | 9 | public boolean initialize() {
boolean success = true;
String adbLocation = System
.getProperty("com.android.screenshot.bindir");
// for debugging (follwing line is an example)
// adbLocation = "C:\\ ... \\android-sdk-windows\\platform-tools"; // Windows
// adb... |
52bacf1f-74ee-45cf-acf2-4132248f7697 | 3 | private void clearSystemTables() throws RedisForemanException
{
for (TableIdentifier idd : TableIdentifier.values())
{
if (!idd.equals(TableIdentifier.TABLE))
{
Map<RedisBigTableKey, byte[]> entries = getAll(idd.getId());
for (Entry<RedisBigTableKey, byte[]> entry : entries.entrySet())
{
del... |
c636c017-b216-472d-b6bc-7311da875674 | 2 | void turn() {
if (whichIndex == 0) {
whichIndex = 1;
step = step * -1;
}
else {
whichIndex = 0;
}
max[whichIndex]--;
if (max[whichIndex] <= 0)
closed = true;
} |
28573b7c-c5e6-457a-830a-044202f0bd53 | 3 | public static ArrayList getPesquisa3(String prod, String data_in, String data_fim, Integer gmp) throws SQLException, ClassNotFoundException {
ArrayList<bConsulta> sts = new ArrayList<bConsulta>();
Connection conPol = conMgr.getConnection("PD");
ResultSet rs;
if (conPol == null) {
... |
858eeedc-1754-4ac9-8a83-6abaebadb774 | 5 | private boolean check_gt() {
boolean N = (sr & SR_N) == SR_N;
boolean V = (sr & SR_V) == SR_V;
boolean Z = (sr & SR_Z) == SR_Z;
return (N && V && !Z) || (!N && !V && !Z);
} |
894a1525-f730-4155-898a-acf0dec8ae68 | 5 | @Override
public void actionPerformed(ActionEvent e) {
String action = e.getActionCommand();
switch (action) {
case "addStation":
m_currentlyAdding = true;
this.setCursor(m_crsStation);
m_addingType = "station";
bre... |
b4ab3427-2897-4ada-9203-8eb0ad9b9a05 | 2 | public static <T extends DC> Set<T> codom(Set<Pair<T,T>> phiMax)
{ if(phiMax!=null)
{ if(phiMax.getNext()!=null)
{ return new Set(phiMax.getFst().snd(),codom(phiMax.getNext()));
}
else
{ return new Set(phiMax.getFst().snd(),null);
}
}
else
{ return null;
}
} |
b55ffeb0-4ce4-4131-ac97-fe09d71fe83d | 0 | public void mouseMoved(MouseEvent e) {
} |
3c4a39d0-b0c0-4b7a-9dc5-b5a189df156f | 3 | @SuppressWarnings("unchecked")
public static HashMap<Player, Boolean> load(String path)
{
try
{
@SuppressWarnings("resource")
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(path));
Object result = ois.readObject();
return (HashMap<Player, Boolean>)result;
}
catch(Exception e)
... |
4171ca9e-aa1f-46d4-b2d3-d7283f2e075c | 6 | public static Stella_Object access_PLDirectoryContents_Slot_Value(PLDirectoryContents self, Symbol slotname, Stella_Object value, boolean setvalueP) {
if (slotname == GuiServer.SYM_GUI_SERVER_DirectoryName) {
if (setvalueP) {
self.DirectoryName = ((StringWrapper)(value)).wrapperValue;
}
el... |
a11bb83d-be08-4e80-bbb2-e190b7611eaa | 2 | private synchronized void putMessage(int num) throws InterruptedException {
//while (cola.llena() == true)
switch(num){
case 1:{ //BLOCKING
//System.out.print("\t\tReceive: Blocking\n");
wait();
System.out.print("\t\tSend: Blocking\n");
//cola.InsertaFinal(message, prioridad, this.nomP... |
fc0b89c9-c90f-4dc6-b068-fa999b022712 | 2 | public static String formatHeight(int inches) {
int feet = inches / 12;
inches %= 12;
if (feet > 0) {
String buffer = format(feet) + '\'';
if (inches > 0) {
return buffer + ' ' + format(inches) + '"';
}
return buffer;
}
return format(inches) + '"';
} |
ef849d35-a6a0-4eea-9a00-aad59ea792ee | 2 | public double rawAllResponsesTotal(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.rawAllResponsesTotal;
} |
567e111b-66ab-4eaa-aae2-706d1f34524a | 1 | public JSONArray optJSONArray(String key) {
Object o = this.opt(key);
return o instanceof JSONArray ? (JSONArray) o : null;
} |
a369ac53-bc5d-405d-ace0-b08fcda6f9c8 | 4 | @SuppressWarnings("unchecked")
public static <T> ImmutableSet<T> viewOf(final ImmutableSet<? extends T> s1, final ImmutableSet<? extends T> s2) {
if (s1.isEmpty()) {
return (ImmutableSet<T>) s2;
} else if (s2.isEmpty()) {
return (ImmutableSet<T>) s1;
} else {
... |
f1028420-17ed-4d57-91a4-abd5712c4b6b | 7 | public TDefSku checkSku(TDefSku sku) {
String store = sku.getStore();
String sql = "SELECT a.Sku, a.PName, a.Clr, a.Size, b.Style, b.StyleName, b.Attrib22 as isStarProduct, b.Attrib23 as isFinger, b.SkuPrintMoud as remark, b.SafetySort as description FROM [" + ConfigurationManager.getDbName() + "].[dbo].[TDefSku]... |
5bdad71f-7180-4443-9e89-c51d2747ca40 | 6 | @Override
public String toString() {
String str = "";
byte[][] dataStr;
int minX, maxX, minY, maxY, i, j;
Vecteur<Integer>[] tempTabVec;
tempTabVec = getPoints();
int minMaxValues[][] = minMax();
minX = minMaxValues[0][0];
maxX = minMaxValues[0][1];
... |
6cab7804-f204-4533-ad9d-da9098ae0332 | 8 | public V eliminar(K k) {
int llave=hash(k);
V x=null;
if(areaPrimaria[llave]!=null){
if(areaPrimaria[llave].darLlave().equals(k)){
areaPrimaria[llave]=null;
x=areaPrimaria[llave].darElemento();
tamanio--;
actualizarFactorDeCarga();
}
else{
for(int i=llave;i<areaPrimaria.length&&x==nul... |
22535ed0-19bc-43ec-abb4-db43c2475ef1 | 6 | public static void floodFill(int r, int c) {
map[r][c] = '0';
for (int i = 0; i < dir.length; i++)
if (r + dir[i][0] >= 0 && r + dir[i][0] < size
&& c + dir[i][1] >= 0 && c + dir[i][1] < size
&& map[r + dir[i][0]][c + dir[i][1]] == '1')
floodFill(r + dir[i][0], c + dir[i][1]);
} |
2b48b67b-39c7-44f0-8579-5a51eefd1943 | 3 | @Override
public boolean remove(int codigo) {
boolean status = false;
Connection con = null;
PreparedStatement pstm = null;
try {
con = ConnectionFactory.getConnection();
pstm = con.prepareStatement(REMOVE);
pstm.setInt(1, codigo);
pstm... |
fae7728c-764a-43d4-9f7f-8f9464b13e41 | 0 | public NewHelpAction() {
} |
25fbe70b-efd3-44d0-883f-89181a99404f | 3 | @Override
public void actionPerformed(ActionEvent event) {
Component comp = getFocusOwner();
if (comp instanceof JTextComponent) {
((JTextComponent) comp).paste();
} else {
Pastable pastable = getTarget(Pastable.class);
if (pastable != null && pastable.canPasteSelection()) {
pastable.pasteSelection(... |
86ea01d1-ed42-44cb-82bc-c8143db0bc99 | 8 | private void executeReadRequestOnReadQuorum(
HashMap<Machine, String> responseMap,
HashSet<Machine> successfulServers, HashSet<Machine> failedServers,
int articleReadFrom) {
if (failedServers != null) {
if (failedServers.contains(myInfo)) {
/*
* if the failedServers contain myMachine then I am a... |
da1181bb-4d0c-4e6d-9ca1-323811317886 | 9 | public synchronized void sendPSO(SecureMessagingWrapper wrapper,
byte[] certData) throws CardServiceException {
int maxBlock = 223;
int blockSize = 223;
int offset = 0;
int length = certData.length;
if (certData.length > maxBlock) {
int numBlock = certData.length / blockSize;
if (numBlock * blockSize... |
fb8fb085-8982-4554-bbc8-992a2c859dfe | 6 | public void calculateVision() {
if (!vision) {
resetVision();
calculateVisionEntity(player);
for (Living l : live) {
if (l instanceof TorchPickup) {
calculateVisionEntity(l);
}
}
} else {
for ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.