method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
140efadd-cbdb-4ba7-8b54-b5ee29b4233e | 9 | public static void testCorrectness(boolean isBWT)
{
System.out.println("\nBWT"+(!isBWT?"S":"")+" Correctness test");
// Test behavior
for (int ii=1; ii<=20; ii++)
{
System.out.println("\nTest "+ii);
int start = 0;
byte[] buf1;
Random r... |
7f651f80-b1c6-44e8-9706-7f12fbc970d3 | 2 | public static int maximun(int ar[]) {
int max = ar[0];
System.out.print("Array Is :\t");
System.out.print(ar[0] + " ");
for (int i = 1; i < ar.length; i++) {
System.out.print(ar[i] + " ");
if (max < ar[i]) {
max = ar[i];
}
}
System.out.println();
return max;
} |
1204e99d-4957-4645-9575-f2b3721fe419 | 1 | public Type getSuperType() {
if (elementType instanceof IntegerType)
return tRange(tObject, this);
else
return tRange(tObject,
(ReferenceType) tArray(elementType.getSuperType()));
} |
8fc165d8-7869-4ab6-87b0-5d0fa8a9f044 | 5 | private Scenery[][] loadRandomMap(GameMap g, int multiplier, int xOfMap, int yOfMap,
int levelsDeep, TextDisplay textDisplay) throws Exception {
String path = PATH_TO_MAPS;
if (notSpawnedPlayerCount > 2) {
path += "PlayerMaps" + File.separator;
initPlayerMaps();
} else {
initMapLoade... |
c642c57f-c6f5-4a86-b18c-8b870a8fe39d | 8 | public Response serve( String uri, String method, Properties header, Properties parms, String data )
{
try{
String response_string=null;
if(data!=null){
System.out.println(DateFormat.getTimeInstance(DateFormat.FULL).format(Calendar.getInstance().getTime()));
System.out.println("Command: " + data);
... |
e65d8761-1069-4ea3-954c-5c211f8c9939 | 8 | @Override
public boolean equals(Object obj) {
if(!(obj instanceof Anime)) {
return false;
}
Anime anime = (Anime)obj;
return (anime.episodes == episodes && anime.id == id &&
anime.score == score && anime.title.equals(title) &&
an... |
947d03bc-630d-498f-ad4d-8f5e3b428ed3 | 6 | public Loop(List<String> identifiers, List<String> values) {
this.rows = new ArrayList<Map<String,String>>();
int identSize = identifiers.size();
// TODO check that the identifiers are unique
int valIndex = 0;
// don't want to loop endlessly if there's no keys
if(identSize == 0 && values.size() > 0) {
th... |
d947405a-047f-43e5-a30e-563ca8824428 | 2 | @SuppressWarnings("unchecked")
public E previous() {
if (nextIndex == 0) {
throw new NoSuchElementException();
}
if(next != null) {
lastReturned = next = next.previous;
} else {
lastReturned = next = tail.previous; // index > 0 => not tail is not head.
}
nextIndex--;
checkForComodific... |
c40dd1f3-bcc7-4e7c-b224-5c52e646eb9e | 5 | public void imprimirRelatorio(int argumento1,int argumento2, String nomedorelatorio, String nomedocampoparaarguemntacao, String nomedegravacaodorelatorio) throws IOException, JRException, ClassNotFoundException, Exception {
ServletOutputStream servletOutputStream;
File arquivoGerado;
System.out.... |
6463c47e-f93d-4ba0-8f49-cc405d996590 | 8 | public Integer getBiggestBorrower() {
Integer id = -1;
Integer max = 0;
Map<Integer, Integer> total = new HashMap<Integer, Integer>();
for (Integer stockId : this.stock.keySet()) {
Map<Integer, Integer> currentStock = stock.get(stockId)
.getBookingTotals(... |
f05cf8d2-538a-4673-8a4d-83b00ca726f0 | 9 | @Override
public void setEntityValue(ResultSet rs, int index, Object entity) throws Exception {
Field f = getField();
Integer ordinal = rs.getInt(index);
Enum<?> value = null;
if(ordinal == null) {
getField().set(entity, value);
return;
}
@SuppressWarnings("unchecked")
Class<? extends Enum... |
45c07892-3915-44c4-9565-8124db46a4ff | 4 | private String getExpression(int index) throws SyntaxErrorException {
int c = 1;
for (int j = index + 1; j < expression.length(); j++) {
char s = expression.charAt(j);
if (s == '(')
c++;
if (s == ')')
c--;
currentPosition = j;
if (c == 0)
return expression.substring(index + 1, j);
}
t... |
8b846ca6-f817-4fc4-b98f-97d9669fefe8 | 1 | public List<String> getDescription() {
if (description == null) {
description = new ArrayList<String>();
}
return description;
} |
6c24c5f9-95e8-40a0-bf83-0826c9e54436 | 9 | public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
int n = 0;
d: do {
line = br.readLine();
if (line == null || line.length() == 0)
break d;
char[] a = lin... |
ae66cdf2-9478-43e7-a58b-cb12f0c18c3d | 3 | private void draw() {
double size = getWidth() < getHeight() ? getWidth() : getHeight();
canvas.setWidth(size);
canvas.setHeight(size);
ctx.clearRect(0, 0, size, size);
if (isFrameVisible()) { //frame
Paint frame = new LinearGradient(0.14 * size, 0.14 * size,
... |
8006b909-e1b1-484f-b3da-618b2bc0c1ce | 4 | public void rollback() throws DatabaseManagerException {
try {
if( conn == null || conn.isClosed() || conn.getAutoCommit() == true ) {
throw new IllegalStateException("Transaction not valid for commit operation.");
}
conn.rollback();
} catch(SQLException e) {
throw new DatabaseManagerException("Err... |
028a52ec-4e93-4a8b-8cf5-7f0b982fe22b | 1 | public void resolveCollision(Sprite collidee)
{
// The normal is a unit vector along the line between the sprites.
Vector2d normal = collidee.getPosition().minus(getPosition());
normal.setMagnitude(1);
Vector2d relativeVelocity = collidee.getVelocity().minus(getVelocity());
... |
7a7e56af-70dc-4ea9-acb8-a87433b9d477 | 9 | @Override
public void processGameEvent(GameEvent e) {
if(e instanceof TimerEvent)
return;
if(e instanceof InternalGameEvent)
return;
if(e instanceof GameStartEvent)
synchronized(this) { notify(); }
else if(e instanceof GameEndEvent) {
out.println(e.getUpdateStrin... |
56cbec68-946b-438d-a238-c570018a74cd | 2 | public HierarchicalClustering(int link, Instances data) {
if (link == 0)
this.link = new CompleteLink();
else if (link == 1)
this.link = new SingleLink();
else
this.link = new AverageLink();
this.instances = data;
} |
fe272003-fb81-4281-8e5d-d4a1fcda1b0e | 7 | public NodeBuilder<?,?> addChildNode(Class<CallableData<?,?>> clazz, Initializer<? extends CallableData<T,E>> initializer){
NodeBuilder<?,?> node = new NodeBuilder(clazz,initializer,root);
local.getNext().add(node.getLocal());
return node;
} |
c963c15b-5c49-4333-9c7d-28b8af4c88f9 | 4 | public void invoke(T entity, EntityProperty entityProperty, Cell cell) {
try {
Method method = entityProperty.getPropertyDescriptor().getWriteMethod();
switch (entityProperty.getColumnType()) {
case TEXT:
method.invoke(entity, cell.getStr());
... |
11387901-c15b-4e08-9efc-85e386b151db | 2 | public PayloadSubjectExceptionData(Node exception) {
if(exception == null) {
throw new IllegalArgumentException("Node not specified.");
}
if(!exception.getLocalName().equals("PayloadSubjectException")) {
throw new IllegalArgumentException("Unknown node \'" + exception.getNodeName() + "\', expected Payloa... |
3dbfa011-9ae0-4ed6-b939-30b4565e7509 | 0 | protected AnnotatedHandlerBuilder<Field> handleField()
{
return wrapped.handleField();
} |
6863f4a8-fb2e-4647-8997-a7b488772068 | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=prof... |
e957f9f8-1faf-4265-8429-1ef003535c7d | 0 | @Override
public void setHouseNumber(String houseNumber) {
super.setHouseNumber(houseNumber);
} |
06100a2d-8749-4389-a195-57ed30b6b201 | 1 | public static synchronized void monitorBalance() {
int b = myValue;
if (b != 1) {
System.out.println("Balance change: " + b);
System.exit(1);
}
} |
a929848c-25cb-4b3a-b881-1822787a16a3 | 2 | private static void printSummary() {
GlobalOptions.err.println();
if (failedClasses.size() > 0) {
GlobalOptions.err.println("Failed to decompile these classes:");
Enumeration enum_ = failedClasses.elements();
while (enum_.hasMoreElements()) {
GlobalOptions.err.println("\t" + enum_.nextElement());
}
... |
e299bf3b-2f8b-4b00-8d16-92f60141ab7c | 4 | public static void main(String[] args) throws Exception {
LOG.info("Args: ");
int i = 0;
for (String arg : args) {
LOG.info("{}:{}", i++, arg);
}
// create Options object
Options options = new Options();
options.addOption("array_id", true, "the parame... |
161e03df-cc63-47d5-8d0c-82feed1303fd | 3 | public static void Spectrum(byte[] audioBytes, AudioFormat format, Vector<Line2D.Double> SpectrumData) {
SpectrumData.removeAllElements();
int h=105, w=689;
int[] audioData = null;
int nlengthInSamples = audioBytes.length/2;
audioData = new int[nlengthInSamples];
for (int i = ... |
eb3177a4-1332-4504-b0cc-74de5600c674 | 4 | private boolean dropTargetValidate(DropTargetEvent event, File targetFile) {
if (targetFile != null && targetFile.isDirectory()) {
if (event.detail != DND.DROP_COPY && event.detail != DND.DROP_MOVE) {
event.detail = DND.DROP_MOVE;
}
} else {
event.detail = DND.DROP_NONE;
}
return event.detail != DN... |
abeebaeb-1800-4a1b-8308-523e9c2d244c | 2 | public boolean isFull() {
for(Park park : this.parkList) {
if(!park.isFull()) {
return false;
}
}
return true;
} |
2d0f7f98-c99f-4b72-b4a7-e666bb93dc13 | 8 | protected void done() {
fr.setVisible(true);
if (exito && !this.isCancelled() && Vista.OS.equals("windows")){
eti.setText("Minecraft instalado con éxito en " + System.getProperty("user.home") + "\\AppData\\Roaming\\.minecraft");
bot.setVisible(true);
bot.setEnabled(tr... |
8ed3ea0f-bc10-481b-86b8-9d888113e1b8 | 6 | public UpcomingEventType getEventType() {
if ("HTML".equalsIgnoreCase(getType())) return UpcomingEventType.Html;
if ("MANAGED_OD".equalsIgnoreCase(getType())) return UpcomingEventType.Html;
if ("MANAGED_HTML".equalsIgnoreCase(getType())) return UpcomingEventType.Html;
if ("THREAD".equalsIgnoreCase(getType())... |
aa74b952-9bf3-4188-9b95-0c194c540164 | 4 | public static float convertTensionUnitIndexToFactor(int index) {
switch (index) {
case 0:
return NEWTON;
case 1:
return POUND_FORCE;
case 2:
return KILOGRAM_FORCE;
case 3:
return DECANEWTON;
... |
61ed7200-5bd7-4172-aa40-5a8b0963ce78 | 3 | public static String toString(JSONObject jo) throws JSONException {
boolean b = false;
Iterator<String> keys = jo.keys();
String string;
StringBuilder sb = new StringBuilder();
while (keys.hasNext()) {
string = keys.next();
if (!jo.isNull(string)) {
... |
35c073d1-7cd5-4070-8b9c-b93290446aec | 3 | protected void close() {
if(!statusSent) status(500); // Internal server error
if(!headersSent) completeHeaders();
try {
connection.shutdownOutput();
connection.close();
} catch (IOException e) { e.printStackTrace(); }
} |
ae0fa4a4-cec0-4765-9617-f39d6055ee78 | 5 | static final public void simpleExpr() throws ParseException {
terme();
label_8:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case OU:
case ADD:
case SUBNEG:
;
break;
default:
jj_la1[18] = jj_gen;
break label_8;
}
opAdd();
... |
e8f351c1-5eac-42e4-ac93-9ff0c007ca48 | 4 | public static Player Load()
{ //loads the character's file (plaintext)
Scanner Input = new Scanner(System.in);
Player player;
Player decoy = new Player();
String strFile;
String charName;
int[] stats = new int[9];
String cmd="";
System.out.println("Enter ... |
853f3659-4963-40e8-a99d-6ca58838627c | 3 | public static synchronized void open(File file) {
if (PASS_THROUGH) {
OpenDataFileCommand opener = new OpenDataFileCommand(file);
if (!SwingUtilities.isEventDispatchThread()) {
EventQueue.invokeLater(opener);
} else {
opener.run();
}
} else {
if (PENDING_FILES == null) {
PENDING_FILES = n... |
7cd86473-9c9e-47f4-a423-5ad5cd4d6cf0 | 4 | public String getColumnData(int i) throws Exception {
if (i == 0)
return getPersonID();
else if (i == 1)
return getName();
else if (i == 2)
return getProjectID();
else if (i == 3)
return getRole();
else
throw new Exception("Error: invalid column index in courselist table");... |
5df3b1da-45e8-4b0c-9a14-c7f9a3c15496 | 9 | void menuOpenFile() {
animate = false; // stop any animation in progress
// Get the user to choose an image file.
FileDialog fileChooser = new FileDialog(shell, SWT.OPEN);
if (lastPath != null)
fileChooser.setFilterPath(lastPath);
fileChooser.setFilterExtensions(OPEN_FILTER_EXTENSIONS);
fileChooser.se... |
3541b362-b00a-44df-8af8-7211b3d80bfc | 9 | @SuppressWarnings("rawtypes")
private BeanDefinition createProxyBeanDefinition(String serviceName,
Class serviceInterface, Exposer exposer) {
// HTTP http://host:port/contextPath/serviceName
String httpServiceUrl = new StringBuilder(HTTP_PROTOCOL)
.append(getHost()).append(":").append(getHttpPort())
.a... |
f84cb877-a568-4e4e-93ac-9e974ad2a52b | 9 | void run(){
Scanner sc = new Scanner(System.in);
dp = new int[30][51][6];
for(;;){
C = sc.nextInt(); D = sc.nextInt(); W = sc.nextInt(); X = sc.nextInt();
if((C|D|W|X)==0)break;
E = new int[C][D]; F = new int[C][D];
for(int i=0;i<C;i++)for(int j=0;j<D;j++)E[i][j]=sc.nextInt();
for(int i=0;i<C;i++)f... |
4a09722a-284e-4238-bf13-60965e29c31e | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... |
16556715-063d-43c4-b184-aadafe69bd3e | 1 | public MiniXMLToken getToken() {
MiniXMLToken oMiniXMLToken = new MiniXMLToken();
oMiniXMLToken.setType(tError);
if (!bInsideTag)
return getTokenOutsideTag(oMiniXMLToken);
else
return getTokenInsideTag(oMiniXMLToken);
} |
7885e5d4-95f5-43b2-aa8f-b5d0f8925344 | 4 | private void checkVarDeclaration() throws Exception {
if(iterator < tokenList.size() && tokenList.get(iterator++).getType() != TokenType.ID) {
// missing identificator
throw new Exception("Syntax Error at line " + tokenList.get(iterator-1).getLine() +
": Expected identificator and got \"" + tokenList.get(... |
788129d2-559c-4311-8431-13ba7d4706b2 | 8 | public void acceptClusterer(BatchClustererEvent ce) {
if (ce.getTestSet() == null ||
ce.getTestOrTrain() == BatchClustererEvent.TEST ||
ce.getTestSet().isStructureOnly()) {
return;
}
Instances trainHeader = new Instances(ce.getTestSet().getDataSet(), 0);
String titleString = ce.g... |
15a733ed-17ce-4812-845c-b494754f3d1d | 4 | public static ArrayList<Kill> compairEntityKill(ArrayList<Kill> Kills,
String name) {
ArrayList<Kill> output = new ArrayList<Kill>();
for (Kill k : Kills) {
if (k.getAttackers().size() != 0) {
for (ShipAndChar attacker : k.getAttackers()) {
if (attacker.getPilot().findAttribute(name)) {
output... |
c38525a0-74ca-4577-86a4-26522aab8f4a | 1 | public static void clearEditableText(Node currentNode, JoeTree tree, OutlineLayoutManager layout) {
CompoundUndoablePropertyChange undoable = new CompoundUndoablePropertyChange(tree);
clearEditableForSingleNode(currentNode, undoable);
if (!undoable.isEmpty()) {
undoable.setName("Clear Editability for Node");
... |
789719ca-2f52-4e57-b2ba-1312212f3f3e | 1 | public int queueLengthRec(){
if (nextPatient == null){
return 1;
}
int count = nextPatient.queueLengthRec() + 1;
return count;
} |
23b44f73-2f21-4ae8-9945-949c9220c453 | 3 | public static Const constant(int value) {
switch(value) {
case 0: return C0;
case 1: return C1;
case 2: return C2;
}
return new Const(value);
} |
6342c953-51f0-431a-bf7b-3dd160df24c0 | 7 | public Object nextValue() throws JSONException {
char c = nextClean();
String string;
switch (c) {
case '"':
case '\'':
return nextString(c);
case '{':
back();
return new JSONObject(this);
case '[':
... |
925a9e3d-633c-446d-8e24-a257a1677c30 | 0 | public FrameAddArraysData(){
super("Arrays Editor");
initialize();
} |
7e649724-e798-494b-b47d-acba9967c15c | 9 | public static int parseInt(String s, int offset, int length, int base)
throws NumberFormatException
{
int value=0;
if (length<0)
length=s.length()-offset;
for (int i=0;i<length;i++)
{
char c=s.charAt(offset+i);
int digit=c-'0... |
fa30618f-f555-447c-a623-e87bc7145655 | 7 | public void moveElement(Element element, Direction direction) {
if (element == null || direction == null)
throw new IllegalArgumentException("The given parameters are invalid!");
if (!canMoveElement(element, direction))
throw new IllegalArgumentException("This element can't move in the given direction!");
... |
f449f5ea-b2ff-4282-a0de-4c340f0cbbeb | 6 | public void setSelectedItem(Object element) {
if (element == null) {
if (elementIndex != -1) {
elementIndex = -1;
fireContentsChanged(this, -1, -1);
}
} else if (element instanceof String) {
int index = 0;
for (DBElement e :... |
5e174703-8899-4467-8c1c-2ced0f11528d | 7 | public synchronized void tick() {
if (unchoked.size() == maxUnchoked && interested.size() > maxUnchoked) {
long now = System.currentTimeMillis();
Peer slowest = null;
for (Map.Entry<Peer, Long> e : unchoked.entrySet()) {
if (now - e.getValue() > 10000) {
... |
7eec6668-08e6-42aa-a22b-3db1ee78c8ab | 1 | public void setPasswordfieldDownshift(int shift) {
if (shift < 0) {
this.passwordfieldDownshift = UIShiftInits.PWAREA_DOWN.getShift();
} else {
this.passwordfieldDownshift = shift;
}
} |
73638f25-673a-4caf-a068-229dc1083c7f | 2 | private double calcValue(double point) {
double value = 0;
for (int i = 0; i < equationCoef.length; i++) {
if (equationPower[i] != 0) {
value = value + equationCoef[i] * Math.pow(point, equationPower[i]);
} else {
value = value + equationCoef[i];
... |
60b0041b-b86a-47aa-b787-f8b270150579 | 7 | @Override
public boolean nextKeyValue() throws IOException, InterruptedException {
if (key == null) {
key = new LongWritable();
}
key.set(pos);
if (value == null) {
value = new Text();
}
value.clear();
final Text endline = new Text("\n"... |
afcabf5d-db25-429d-a714-d0affeb362d1 | 1 | public static void quit() {
if (loggingEnabled)
handler.close();
} |
09fa8f0e-6878-4ef8-b27c-38de5b4a72a0 | 6 | public static AuthorizationToken generateToken(String controller, String type, String id, String passcode) {
if (type.equals(ComponentTypes.Authorization.NONE_FALSE.name())) {
return new AuthorizationToken(controller, ComponentTypes.Authorization.NONE_FALSE);
}
else if (type.equals(ComponentTypes.Authorization... |
2cd60298-154c-4800-9fb6-7c8d6bd2790b | 2 | public void saveIssueFired(ActionEvent event) {
final ObservableIssue ref = getSelectedIssue();
final Issue edited = new DetailsData();
SaveState saveState = computeSaveState(edited, ref);
if (saveState == SaveState.UNSAVED) {
model.saveIssue(ref.getId(), edited.getStatus(),
... |
cd1ea167-babb-4eb5-95f6-061e9c91c477 | 5 | @Override
public Map<Course, Integer> getMarks(int userId) throws SQLException {
Map<Course, Integer> courseMark = new HashMap<>();
Connection connect = null;
PreparedStatement statement = null;
try {
Class.forName(Params.bundle.getString("urlDriver"));
connec... |
dbf1ddb6-2478-4f95-a278-cb435a0043bd | 2 | public Quester(String[] questerInfoInString, Player player) {
//this.plugin = plugin;
this.theQuestersName = player.getName();
this.questID = Integer.parseInt(questerInfoInString[0]);
this.questsCompleted = Integer.parseInt(questerInfoInString[1]);
this.moneyEarnedFromQuests = Integer.parseInt(questerInfoI... |
fbb8b7c4-30a4-4447-b605-2aa5ca8b9078 | 6 | public boolean isNearTree(Coordinate coord) {
ElementType to;
for (int i = 0; i < 4; i++) {
Coordinate coordTemp = coord.copy();
switch (i) {
case 0:
coordTemp.moveNorth();
break;
case 1:
coordTemp.moveEast(dimension);
break;
case 2:
coordTemp.moveSouth(dimension);
break;
... |
f5daf891-ed0d-455f-966c-be52bdb8b03b | 7 | private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... |
d9e7ce12-7b3e-4c7b-8177-b49668df2c33 | 2 | public void setDAO(String daoLine) {
if (daoLine.equals("Mock")) {
dao = new MockDAO();
}
else if (daoLine.equals("MySQL")) {
dao = new MySQLDAO();
}
} |
26ac66a7-2777-4410-88ec-76c8f5a28a29 | 6 | public LayerMatcher(Layer layer)
{
// match 1 = tagname
// match 2 = id
// match 3 = attributes
String layerRegex = "^(<[a-z^>]*>)?([A-z\\-\\_]*)?(\\[.*\\])?$";
String layerName = layer.toString();
Pattern p = Pattern.compile(layerRegex);
Matcher m = p.matcher(layerName);
if(m.matches()) {
// g... |
c5685bcb-ded2-44d3-a51f-963bda51332c | 1 | public static synchronized Config getInstance() {
if (instance == null) {
instance = new Config();
}
return instance;
} |
896d8acf-8597-4657-85d3-6240aefe1a32 | 8 | public static void main(String[] args) throws IOException {
String s;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Integer t = new Integer(br.readLine());
for(int i=0;i<t;i++){
s = br.readLine();
if(s.length()>3){
Syste... |
fe380f10-edd2-46b1-bbe8-6e4b7d01f807 | 1 | public boolean _setMapCanvas(GenericCanvas mapcanvas)
{
if(mapcanvas != null)
{
this.mapcanvas = mapcanvas;
return true;
}
else
{
return false;
}
} |
b4260155-cfec-4766-bf02-f339109bbd20 | 6 | public void reserve() {
if (this.capacity - this.length < JSONzip.substringLimit) {
int from = 0;
int to = 0;
this.root = new Node();
while (from < this.capacity) {
if (this.uses[from] > 1) {
Kim kim = this.kims[from];
... |
d48f285b-e3a0-4f15-9048-b02a24497624 | 1 | public ArrayList<Pizza> haeMyydyimmat() throws DAOPoikkeus {
// Hakee etusivulle tiedot kolmesta myydyimmästä pizzasta.
TilastointiDAO tilasto = new TilastointiDAO();
ArrayList<Toppizzat> pizzatop = tilasto.haeToppizzat();
TuoteDAO tDao = new TuoteDAO();
Pizza pizza = new Pizza();
ArrayList<Pizza> myy... |
a106622f-5fd4-4323-834b-6aeeb252e573 | 2 | @Override
public void setCourseName(String courseName) {
if(courseName == null || courseName.length() == 0) {
JOptionPane.showMessageDialog(null,
"Error: courseName cannot be null of empty string");
System.exit(0);
}
this.courseName = courseName;
... |
f67901ae-01aa-44c4-91d2-7e20cdd69846 | 6 | public static void main(String args[]) throws Exception
{
final int TOP = 200;
String outputPath = "C:/z-ling/task/HEY/ResultTest/HamTopSim_"+TOP+".txt";
FileOutputStream fos=new FileOutputStream(outputPath);
OutputStreamWriter osw=new OutputStreamWriter(fos);
Buffer... |
30034516-44bb-4b36-a34c-a2344b203edc | 2 | public JSONObject putOpt(String key, Object value) throws JSONException {
if (key != null && value != null) {
this.put(key, value);
}
return this;
} |
2861ed46-1abe-40c8-a203-904a8505a1ab | 5 | public Button loadButton(Location loca) {
String wName = loca.getWorld().getName();
String saveLoc = Utils.convertLoc(loca);
Button button = new Button();
buttonConfig = new Configuration(new File(configDir + File.separator + "buttons" + File.separator + wName + File.separator + saveLoc + ".yml"));
File finde... |
2221a378-fd45-44fb-b9f8-249b309ea1d0 | 2 | protected void processMouseWheelEvent(MouseWheelEvent e) {
if (hasFocus()) {
int code = InputManager.MOUSE_WHEEL_DOWN;
if (e.getWheelRotation() < 0) {
code = InputManager.MOUSE_WHEEL_UP;
}
mapGameAction(code, true);
}
e.cons... |
97a9d34a-0141-4330-8809-64e972ac05e2 | 5 | public static int deleteMstxRecommend(int mid) {
int result = 0;
Connection con = DBUtil.getConnection();
PreparedStatement pstmt = null;
try {
pstmt = con.prepareStatement("delete from mstx_recommend where mid=?");
pstmt.setInt(1, mid);
result = pstmt.executeUpdate();
} catch (Exception e) {
e.pr... |
54e77dc9-9a6a-458a-ab24-adf22247f591 | 6 | public static void main(String[] args) {
Scanner teclado = new Scanner(System.in);
int[] rgb = new int[3];
int ladoCuadrado;
int ladoMax = 200,
ladoMin = 100;
boolean rgbValido = true;
do System.out.print("Dame el lado del cuadrado [100, 200]: ");
while((ladoCuadrado = teclado.nextInt()) < ladoMin |... |
7db8c949-d632-4ab7-92e7-fbbd2ecba83f | 9 | public SortedList quicksort(ListNode head) {
// IMPORTANT: Please reset any member data you declared, as
// the same Solution instance will be reused for each test case.
if(head==null || head.next==null) return new SortedList(head, head);
ListNode lHead = null;
ListNode... |
05253122-96a1-487f-9199-14c2613b9a5a | 5 | private void spawnFruit() {
//Reset the score for this fruit to 100.
this.nextFruitScore = 100;
/*
* Get a random index based on the number of free spaces left on the board.
*/
int index = random.nextInt(BoardPanel.COL_COUNT * BoardPanel.ROW_COUNT - snake.size());
/*
* While we could just as easi... |
36153b4a-5cea-4af7-bdc5-698854ea342e | 2 | @Override
public ParseResult<T, A> parse(LList<T> tokens) {
ParseResult<T,A> r = this.parser.parse(tokens);
if(!r.isSuccess()) {
// parser failed -> fail
return r;
} else if(this.pred.apply(r.getValue())) {
// result is present and predicate passes -> pass
return r;
} else {
// result is present... |
a6ad9e17-740d-446f-9d7f-c1c23cd3ce9e | 0 | public void run(){
} |
41071c19-25f0-468a-9d5c-47d6e9385f46 | 5 | public Tile(int x, int y, int tilesize, Sprite sprite){
this.x = x;
this.y = y;
this.dX = 0;
this.dY = 0;
this.dir = 1;
this.tilesize = tilesize;
this.sprite = sprite;
this.crect = new Rectangle(x,y,tilesize,tilesize);
if (sprite != null) {
this.id = sprite.getId();
if (this.id > 0 && this.id <=... |
5610e956-1a40-4d62-be76-ac33ddd25fb0 | 1 | public int read(CharBuffer cb) {
if (count-- == 0)
return -1;
String result = Double.toString(next()) + " ";
cb.append(result);
return result.length();
} |
9b33f82d-f887-4297-ba62-a3e43c39e41e | 0 | @Override
public void setBoilerState(int boilerState) {
this.boilerState = boilerState;
} |
b2a3f0c1-f8d4-41c5-aa41-a07f933625fc | 4 | public void translateDemands(int period, Conversion cons) {
//
// Firstly, we check to see if the output good is in demand, and if so,
// reset demand for the raw materials-
final float demand = shortageOf(cons.out.type) ;
if (verbose) I.sayAbout(venue, "Demand for "+cons.out.type+" is: "+demand) ... |
f171ee75-a733-461b-a99a-0497d08df311 | 2 | public static SingleItem getItem(int id) {
String input = null;
try {
input = Untils.readPage(new URL(SINGLE_ITEM + id));
} catch (MalformedURLException e) {
e.printStackTrace();
}
HashMap<String, Object> parse = Parser.parse(input);
if (parse.get("name") == null)
return null;
parse = Parser.... |
afa1be69-7e0a-4c28-a6f8-cd0d8f131018 | 7 | @Override
public void writeBuffer(ReceiveBuffer wbuf) {
try {
Thread.sleep(1);
} catch (InterruptedException e) {
}
if(wbuf.length() >=4 && wbuf.charAt(0)=='M' && wbuf.charAt(1)=='1' &&wbuf.charAt(2)=='0' &&wbuf.charAt(3)=='5' ){
isM105=true;
}
sendbuf.put(wbuf.array,0,wbuf.length());
isSend=true... |
eaaa5507-ac70-41d0-851d-58ad862b82e3 | 8 | private void testData() {
if ((useKNN() && knn != null) || (!useKNN() && gaussian != null)) {
int c = 1;
int numClasses = getNumTestClasses();
int[][] confusionMatrix = new int[numClasses][numClasses];
while (classHasFiles(String.format("c:/ordata/test-%s",testTextField.getText()), String.format("%d",c)))... |
f54c0227-1163-43bd-9f22-a0acb3b5efc6 | 9 | public static void main( String[] args ) throws Exception
{
TestingHelper.CONFIG.read();
OptionManager.initialize( TestingHelper.CONFIG ); // initialize options from config file
OptionManager.initialize( args ); // initialize options from commandline (override the config file)
Optio... |
ddcdbe0b-0ef7-4771-88ed-910185a01821 | 7 | @EventHandler
public void WitherSpeed(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getZombieConfig().getDouble("Wither.Speed.Dod... |
57a04f65-0f54-4043-bad4-14b09b1c2132 | 0 | protected void onDeVoice(String channel, String sourceNick, String sourceLogin, String sourceHostname, String recipient) {} |
8cb4d747-699a-443c-b43e-bb75c58c5de9 | 2 | private boolean setCoordinates(int r, int c) {
// If the coordinates are not already set
if (!areCoordinatesSet()) {
// Ensure valid coordinates
if (!validCoordinates(r, c)) {
throw new IllegalArgumentExcep... |
10d09cf9-5a93-46a9-bd57-df454a98617d | 7 | public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
if (getBarDateTime() != null) {
_hashCode += getBarDateTime().hashCode();
}
if (getOpen() != null) {
_hashCode += g... |
19cb41e6-679e-4505-9ec7-a85b383f84e3 | 6 | public void render(Graphics g){
g.setColor(Color.BLACK);
int size = display.frame.getHeight() / 12;
int xOff = (display.frame.getWidth() - size * 9) / 2;
int yOff = (display.frame.getHeight() - size * 9) / 4;
for(int x = 0; x < 9; x++){
for(int y = 0; y < 9; y++){
if(board.get(x).get(y) != 0){
if(... |
d4a59ea4-9799-40bc-a323-ab7de158f462 | 0 | public String getIP() {
return clientIP;
} |
f120839f-7be7-4f20-a064-3c7fe7718232 | 7 | public void start() {
try {
this.createWindow();
try {
Keyboard.create();
Mouse.create();
} catch (LWJGLException e) {
e.printStackTrace();
}
this.postInit();
while (!Display.isCloseRequested()) {
Display.update();
this.getCamera().input();
this.input();
if(this.isHa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.