method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
859139f9-80aa-46c3-ac4b-e348abf51408 | 6 | public static void selectSort(double[] aa, double[] bb, int[] indices){
int index = 0;
int lastIndex = -1;
int n = aa.length;
int m = bb.length;
if(m<n)throw new IllegalArgumentException("The second argument array, bb, (length = " + m + ") should be at least a... |
27f910cf-af2b-4c32-aca7-8e73faf474d6 | 2 | public final void changeWait(int wait)
throws GetHttpException {
if(wait < 100 || wait > 20000)
throw new GetHttpException("The wait value is not correct");
GetHttpPage.wait= wait;
} |
6a725f88-925f-4b1f-8808-9ea916a6d934 | 1 | public void setAttribute(String attrName, Object attr) {
if (this.requestAttributes.containsKey(attrName)){
this.requestAttributes.replace(attrName, attr);
} else {
this.requestAttributes.put(attrName, attr);
}
} |
44ad1716-4305-452c-84f2-befc7ac4436c | 1 | public void update(){
for (GameComponent component:components){
component.update();
}
} |
7c672298-1279-42bb-8f14-24486259d3d0 | 9 | private boolean checkSwitchHeating(State state) {
if (this.topLevelIngredient.getHeated()) {
ObjectInstance obj = state.getObject(this.topLevelIngredient.getName());
if (obj != null) {
if (!IngredientFactory.isHeatedIngredient(obj) && !IngredientFactory.isMeltedAtRoomTemperature(obj)) {
return true;
... |
0a3bf50e-f838-437e-ae63-3e870a3f38b8 | 7 | public synchronized T getResponse() {
// Wait the thread until 'response' is available. Notice that
// we have to process the events manually if the current
// thread is the Event Dispatch Thread (EDT).
try {
if (SwingUtilities.isEventDispatchThread()) {
Even... |
637cf042-3d55-4784-9e7f-b194bfb71812 | 0 | protected FrameBuffer getBuffer() {
return buffer;
} |
2e2a8543-a5ab-43bd-ba3f-47cd1fd8919e | 4 | private static boolean isOverridable(Method method, Class<?> targetClass) {
if (Modifier.isPrivate(method.getModifiers())) {
return false;
}
if (Modifier.isPublic(method.getModifiers())
|| Modifier.isProtected(method.getModifiers())) {
return true;
}
return getPackageName(method.getDeclaringClass())... |
d866e02f-f922-440c-836e-4de39255dc26 | 2 | public static void delete (int [ ] values, int pos) {
if (pos<0 || pos>=values.length) {
return;
}
// your code goes here
} |
46f669f1-e94c-47ed-8508-3161b2be7f9b | 8 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String lavel, String[] args){
//Not from console please.
if(!(sender instanceof Player)){
sender.sendMessage(ChatColor.RED + "You must be a player to use this command.");
return true;
}
//We need args...
if(args.length == 0){
send... |
b07bdd81-e693-4490-8ac1-70e9053207e0 | 2 | @Override
public int compareTo(Item o) {
if(this.num < o.num){
return -1;
}else if(this.num == o.num){
return 0;
}else{
return 1;
}
} |
b584ea82-2f8a-4945-a2a5-13ce818d09ca | 0 | private void bntNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bntNuevoActionPerformed
nuevo.setVisible(true);
}//GEN-LAST:event_bntNuevoActionPerformed |
a524c27d-66c3-4d90-abca-bd1e773c2f14 | 8 | public boolean matchTree(Node<T> root1, Node<T> root2, boolean matchFound){
if(root1 ==null || root2 ==null){
matchFound = false;
return matchFound;
}
if(root1.data.compareTo(root2.data) ==0){
matchFound = true;
if(root1.left!=null) {
... |
7c6b2c66-8367-4cb7-a2d4-c91d02bfccd4 | 3 | private static int readInt(BitInputStream in, int numBits) throws IOException {
if (numBits < 0 || numBits > 32)
throw new IllegalArgumentException();
int result = 0;
for (int i = 0; i < numBits; i++)
result |= in.readNoEof() << i; // Little endian
return result;
} |
f995efe7-c4c4-4e23-a130-25a6ec67cf47 | 2 | public int addPlayer(Player player) {
if (currentPlayers < players.length) {
this.players[currentPlayers++] = player;
player.setSeatNumber(currentPlayers);
turns[(currentPlayers - 1)] = currentPlayers;
if (currentPlayers == players.length) {
isWaitingForPlayers = false;
}
return currentPlayers;
... |
febe23e4-316b-433c-990b-fdf3720bf2ea | 4 | public static int triangleAmax(int x[][]) {
int max = x[0][0];
System.out.print("Triangle Is:\n");
for (int i = 0; i < x.length; i++) {
System.out.print("\n");
for (int j = 0; j < x[i].length; j++) {
if (i <= j) {
System.out.print(x[i][j] + " ");
if (max < x[i][j]) {
max = x[i][j];
... |
018a8a87-875f-445e-a453-e7ab71bdeebc | 2 | public synchronized ServerTCPMultithreadBus getLigneID(int ID){
ServerTCPMultithreadBus val= null;
for (ServerTCPMultithreadBus l : Lignes) {
if(l.getID()==ID) val=l;
}
return val;
} |
87839e3c-dc6d-4b32-ab2a-bcebc3f7352e | 3 | public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.print("Enter a month number (1 through 12) " );
//your code here
if (in.hasNextInt())
{
int lemonthy = in.nextInt();
if (lemonthy <1 || lemonthy >12)
{
... |
e59c241d-94df-4fbb-80cd-c829d017ec1e | 5 | public Sign_Up(int width, int height) {
this.setSize(width, height);
this.setVisible(true);
this.setTitle("Create an Account");
this.setLayout(new FlowLayout());
mainPanel = new JPanel();
mainPanel.setSize(width, height);
mainPanel.setLayout(new GridLayout(3, 2));
this.add(mainPanel);
promptUsername =... |
1e6799a0-91eb-4c0b-8221-1b6ca1a1905e | 3 | public void processOtherEvent(Sim_event ev) {
double currentTime = GridSim.clock();
if(ev.get_src() == myId_ && ev.get_tag() == EXPIRY_TIME) {
if(currentTime > lastCheckExpiryTime) {
checkExpiryTime();
lastCheckExpiryTime = currentTime;
}
} else {
super.processOthe... |
e4475b41-3af5-4394-8ff0-b60769db8b54 | 6 | @EventHandler
public void CreeperFireResistance(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.getCreeperConfig().getDouble("Creep... |
966b5ff1-c129-4472-83db-069a8030ceb5 | 3 | public static double SquaredL2Distance(FeatureVector linearParam, Instance instance) {
double result = 0.0;
// take the union of the keyset
Set<Integer> keyUnion = new HashSet<Integer>();
keyUnion.addAll(linearParam.getVector().keySet());
keyUnion.addAll(instance.getFeatureVector().getVector().keySet());
... |
bcfdf3ac-13ee-4524-a5ed-0f3e3561c32e | 5 | private ArrayList<String> getFormattedLines(MarketSign sign) {
ArrayList<String> layout = layouts.get(sign.getType().toString());
ArrayList<String> repl = new ArrayList<String>(3);
String region = sign.getRegion().getId();
String intervall = "";
// format intervall
if (sign instanceof RentSign) {
interva... |
f2cf899b-4f6d-4847-93e5-32d321423ccb | 0 | public void setUserRoleId(int userRoleId) {
this.userRoleId = userRoleId;
} |
e4a899ca-0df5-4cf9-933b-c4a3a05f720b | 3 | public String getPlayer(int idFile, int tipoSource, String filename) throws IOException, ServletException {
WebContext wctx = WebContextFactory.get();
String page;
switch (tipoSource){
case VIDEO:
page = "Video";
break;
case AUDIO:
... |
3edad9e9-276e-47b9-b12d-296e8fda89d1 | 0 | private void clearMemButMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_clearMemButMouseClicked
// TODO add your handling code here:
mm.clearmemory();
}//GEN-LAST:event_clearMemButMouseClicked |
52582b44-2339-4a2d-a508-84045c735b63 | 5 | public static String HTTPGet(String inUrl) {
StringBuilder sb = new StringBuilder();
BufferedReader in = null;
try {
in = new BufferedReader(new InputStreamReader(
new URL(inUrl).openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) {
sb.append(inputLine);
}
in.clos... |
9e958f1d-a73c-4aef-90c4-4ccb4532d83d | 3 | public void showModal()
{
// Open the new overlay
JPanel overlayPanel = new JPanel();
overlayPanel.setLayout(new BorderLayout());
overlayPanel.setOpaque(false);
// Discard all mouse and keyboard events
MouseAdapter mouseAdapter = new MouseAdapter() {};
overlayPanel.addMouseListener(mouseAdapter);
ov... |
7f376392-907e-4cfc-9721-7a1cb44b2217 | 0 | public void generateWorld() {
this.world = new World();
this.world.generateRandomContestWorld();
this.world.checkValidForTournament();
} |
c9c47ef3-e742-4a29-a0c1-ae8bd5c5aab7 | 9 | private void handle_account_login(final String arg, final Client client) {
System.out.println("handle_account_login");
final Player player = getPlayer(client);
final LoginData data = loginData.get(client);
// state indicator: is the server responding to our input or spitting
// data about what to input nex... |
d29d0637-861c-46fa-b91a-be787c523eaf | 2 | public Prototype getPrototype(String name) {
Prototype object = null;
// 如果清单中包含需要的原型名称
if (prototypes.containsKey(name)) {
// 将清单中对应原型的复制品返回给客户
Prototype p = (Prototype) prototypes.get(name);
// 克隆
object = (Prototype) p.clone();
} else {
// 清单中不存在需要的原型
try {
// 利用反射创建需要的势力
object = (... |
e9d1f7eb-f280-4982-b7c8-18af1295c410 | 8 | @Override
public boolean execute(MOB mob, List<String> commands, int metaFlags)
throws java.io.IOException
{
final Room room=mob.location();
if(room==null)
return false;
mob.tell(room.getArea().getTimeObj().timeDescription(mob,room));
if((mob.playerStats()!=null)&&(mob.playerStats().getBirthday()!=null))... |
0367c5dd-eaa6-4ab0-8d67-02b18a5b60a9 | 3 | @Override
public void mouseWheelMoved(MouseWheelEvent e) {
int notches = e.getWheelRotation();
if (!centerZoom) {
if (notches > 0) map.zoomOutRelativeToMouse(0.05, mousePosX, mousePosY);
else map.zoomInRelativeToMouse (0.05, mousePosX, mousePosY);
} else /* c... |
4fbf0241-7d30-4fc5-a79a-ebd8aa7f594d | 5 | public void paint(Graphics g)
{
g.setColor(new Color(0, 170, 255, 50));
if(getDrag()==true)
{
if(startDragX-xMouse < 0 & startDragY- yMouse < 0)
{
g.fillRect(startDragX,startDragY,xMouse-startDragX,yMouse-startDragY);
}
if(startDragX-xMouse < 0 & yMouse - startDragY < 0)
{... |
71b1067b-b6ed-4d75-b546-c5ab9e72071b | 7 | public static String ads2Str(ArchiveDataSpecification ads) {
StringBuilder sb = new StringBuilder(1024);
sb.append("Archivanfrage:");
sb.append("\n Obj: " + ads.getObject().getNameOrPidOrId());
sb.append("\n Atg: " + ads.getDataDescription().getAttributeGroup().getNameOrPidOrId());
sb.append("\n... |
83254a4a-2bc0-49b7-97be-98220ceea573 | 3 | void put(final MethodWriter owner, final ByteVector out, final int source,
final boolean wideOffset) {
if ((status & RESOLVED) == 0) {
if (wideOffset) {
addReference(-1 - source, out.length);
out.putInt(-1);
} else {
addReference(source, out.length);
out.putShort(-1);
}
} else {
if (w... |
2a5f7a44-8076-4425-84b7-21112fdfe0c6 | 2 | @Override
public void decreaseBalance(int id, double amount) {
double balance = findCustomersBalance(id) - amount;
String sql = "UPDATE customer SET balance='" + balance
+ "' WHERE customer_id='" + id + "';";
Connection con = null;
try {
con = getConnection();
PreparedStatement statement = con.pr... |
6f1cd28d-061e-4c82-9302-85610806db94 | 5 | private Object createBean(ResultSet rs, Class type,
PropertyDescriptor[] props, int[] columnToProperty)
throws SQLException {
Object bean = this.newInstance(type);
for (int i = 1; i < columnToProperty.length; i++) {
if (columnToProperty[i] == PROPERTY_NOT_FOUND) {
... |
56c60830-cad5-4e77-8f3c-4244f6484678 | 3 | static private ArrayList<Field> getAllFields (Class type) {
ArrayList<Class> classes = new ArrayList();
Class nextClass = type;
while (nextClass != null && nextClass != Object.class) {
classes.add(nextClass);
nextClass = nextClass.getSuperclass();
}
ArrayList<Field> allFields = new ArrayList();
for(in... |
d3d4a999-12a0-4818-a7be-e8eba23f807a | 1 | public int getUpperLeftX(){
if (x1 > x2) {
return x1;
} else {
return x2;
}
} |
b20d4f7b-faea-4b0b-b00d-152d9860f163 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
EventItem other = (EventItem) obj;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equal... |
2f281350-04a1-4d11-93e2-b1d91256d8af | 4 | boolean containsAll(Literal other){
outer:
for (byte otherEntry:other.entries){
if(otherEntry==0)
continue; //a mapped constant (have a look to the constructor Literal(Literal original, Mapping mapping))
for(byte thisEntry: this.entries){
if(otherE... |
3672d393-eaad-4489-b26a-a91a367113ae | 5 | public void makeMove() throws IOException {
while(!game.gameOverByDraw()) {
out.print("Enter a number between 1-9: ");
int place = Integer.parseInt(reader.readLine());
if (board.isAlreadyOccupied(place)) {
out.println("Location already taken\n");
... |
376827c5-f9c0-4bd1-a43d-e9ab39cf153a | 6 | @Test
public void testValidate() {
try {
PageXmlInputOutput.setAdditionalSchemaLocation("c:/junit/schema");
} catch (NoSchemasException e) {
fail(e.getMessage());
}
//Valid
PageWriter writer;
try {
writer = PageXmlInputOutput.getWriterForLastestXmlFormat();
} catch (UnsupportedSchemaVersionExce... |
bdecdfc4-b8df-4aee-9a33-c31050dbd5ef | 1 | private LinkedList<ModelCRLV> fetchAll() throws SQLException, ClassNotFoundException{
LinkedList<ModelCRLV> crlvs = new LinkedList<ModelCRLV>();
con = abrirBanco(con);
String sql = "select * from crlv inner join ipva "
+ "on (id_crlv = crlv_id_crlv)";
PreparedSta... |
d22da351-49ef-4662-a5df-5485a67c4eb1 | 7 | public String getSummary() throws IOException, InterruptedException {
if (pipeIn == null)
getReader(); // spawn parsing thread
while (true) {
synchronized(this) {
if (summary.length() >= SUMMARY_LENGTH || pipeInStream.full())
break;
wait(10);
... |
91903bb1-267e-4517-b48c-3b64439e3a14 | 2 | public Emitter emit(String event, Object... args) {
ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.get(event);
if (callbacks != null) {
callbacks = new ConcurrentLinkedQueue<Listener>(callbacks);
for (Listener fn : callbacks) {
fn.call(args);
... |
e76b3cc2-1357-4baf-a420-e185e6b12726 | 5 | @Override
public String getText()
{
String ret = "";
if (chckbxSwaped_20_90.isSelected())
ret += "+";
else
ret += "-";
ret += "#";
if (chckbxSwaped_100_900.isSelected())
ret += "+";
else
ret += "-";
ret += "#";
if (chckbxSwaped_1000_9000.isSelected())
ret += "+";
else
ret += ... |
5f9d34e3-4e49-4dab-bb64-ed109dd77b97 | 2 | public boolean opEquals(Operator o) {
return o instanceof StoreInstruction
&& o.operatorIndex == operatorIndex && o.isVoid() == isVoid();
} |
a96c442e-f775-47ea-8ac4-983050751a38 | 5 | private static TreePanel createTestPanel(boolean wrapped, boolean allowDropRowCopy) {
TreeRoot root = new TreeRoot(new Notifier());
TreePanel panel = new TreePanel(root);
panel.setAllowedRowDropTypes(allowDropRowCopy ? DnDConstants.ACTION_COPY_OR_MOVE : DnDConstants.ACTION_MOVE);
panel.setAllowRowDropFromExtern... |
4b0b9774-252c-4f83-9dd4-8d275e2e451a | 2 | private T getNextObject() {
lock.lock();
try {
if (head == null) {
return factory.makeObject();
} else {
Node ret = head;
head = head.next;
if (head == null) tail = null;
ret.next = null;//help GC
... |
c1d74bf2-b013-4f09-a389-bf287012e35d | 5 | private static Method checkForCleanupMethod(Method m) {
if(m.getAnnotation(TestObjectCleanup.class) == null) {
return null;
}
if(!m.getReturnType().equals(void.class)) {
throw new RuntimeException("@TestObjectCleanup "
+ "must return void");
}
... |
e8c66c3e-163e-4a43-9313-5a59c9ee955b | 7 | Individual spinWheel(double[] weights,
List<Individual> population){
Individual chosenParent = null;
double random = Math.random();
for(int i = 0; i < population.size(); i++){
boolean inRange = false;
if(i == 0 && weights[i] >= random){
... |
27252e0d-a936-4fa9-89d9-639c18b01207 | 5 | @Override
public boolean keyDown(int keycode) {
switch(keycode){
case Keys.ESCAPE:
case Keys.Q:
level.game.setScreen(new RealStartScreen(level.game));
break;
case Keys.H:
level.grid.showHelp = !level.grid.showHelp;
break;
case Keys.S:
if(level.grid.sequencer.isPlaying){
level.grid.sequence... |
a8ca267d-dc06-4aaa-a0a5-6bb2ec0d6bae | 2 | static QoS valueOf(int i) {
for(QoS q: QoS.values()) {
if (q.val == i)
return q;
}
throw new IllegalArgumentException("Not a valid QoS number: " + i);
} |
38728de3-1de4-4ba2-adc8-e1d757dc0548 | 8 | public void move(){ //move function, when uses keyboard to control
if(ifLeft == true && ifPu == false){
moveLeft();
}
if(ifRight == true && ifPu == false){
moveRight();
}
x += dx;
if(ifJump == true){
currentSpeed += 0.2;
y += currentSpeed;
}
if(y == 500){ //on ground
ifJump = fa... |
bc0cd220-9e59-4a84-bb5c-0826550b9f88 | 8 | public static void main(String[] args) {
Master master = new Master(new PlusWorker(), 5);
for (int i = 0; i < 100; i++) {
master.submit(i);
}
master.execute();
int result = 0;
Map<String, Object> resultMap = master.getResultMap();
while (resultMap.size... |
5cdf214d-9dc3-443d-bce8-5bbf8ecab74f | 3 | @Override
public void resize(int width, int height, int dx, int dy) {
Tile[][] newMap = new Tile[height][width];
HashMap<Object, Properties> newTileInstanceProperties = new HashMap<Object, Properties>();
int maxX = Math.min(width, bounds.width + dx);
int maxY = Math.min(height, boun... |
436fb919-fd41-46cf-90ab-c37b2bd41b2f | 0 | @Override
public String toString() {
return "FORMAL " + identifier + " " + offset;
} |
5ab1a794-5a0b-4dc6-b3e4-79f1d8f973b1 | 9 | @Override
public void or(Filter filter) {
if(filter == null
|| !(filter instanceof Filter)
|| filter.vectorSize != this.vectorSize
|| filter.nbHash != this.nbHash) {
throw new IllegalArgumentException("filters cannot be or-ed");
}
ThreadSafeCBloomFilter cbf = (Thread... |
c155489d-d9a9-49ad-8b09-cd08fb1f8ccf | 1 | public synchronized boolean hasRecordedDuplicateOfIncomingPacket(Packet packet) {
return (packet == null ? false : hasReceivedPacketWithSequenceNumber(packet.getDuplicateSequenceNumber()));
} |
f3c4d1be-6bd3-4b1a-bb19-ace97802213b | 9 | void computeDisplayText (GC gc) {
int availableWidth = width - 2 * parent.getHeaderPadding ();
if (super.getImage () != null) {
availableWidth -= super.getImage ().getBounds ().width;
availableWidth -= CTable.MARGIN_IMAGE;
}
if (sort != SWT.NONE) {
availableWidth -= parent.arrowBounds.width;
availableWidth... |
89f8284e-3f0e-4d39-819a-2523239993f0 | 7 | public int AppRead(){
try {
Scanner create_file = new Scanner(System.in);
String inputFileName = create_file.nextLine().trim();
FileInputStream file = new FileInputStream(new File(inputFileName));
//Get the workbook instance for XLS file
HSSFWorkbook workbook = new HSSFWorkbo... |
c35b862f-aa7c-4639-b03c-dd6e187300a9 | 6 | private void normalize() {
Set<String> newDeleted = new HashSet<>();
newDeleted.addAll(deleted.get());
for (String key : old.keySet()) {
if (old.get(key).equals(diff.get().get(key))) {
diff.get().remove(key);
}
if (newDeleted.contains(key)) {
... |
580d2b78-80db-4e46-8ad2-238594c97d41 | 0 | public static void main(String[] args) {
int x = 0, y = 1, z = 2;
String s = "x, y, z ";
System.out.println(s + (x + y + z));
System.out.println(s + x + y + z);
} |
84ddde07-2e8e-483c-929f-c0b182953bea | 3 | private static boolean containsFormatCode(int[] formatCodeClass, int formatCode){
assert(_opCode == 16 || _opCode == 17);
for (int i = 0; i < formatCodeClass.length; i++) {
if (formatCode == formatCodeClass[i]) {
return true;
}
}
return false;
} |
a72d1467-2f4e-4430-b26d-169d50258b8d | 9 | private void checkVehicleSkill() {
List<Integer> list = new ArrayList<Integer>();
//each route
for (Route r : Solution.getRoutes()) {
list.clear();
int vehicle = 0;
boolean b=false;
if (r.isHasType()) {
vehicle = r.getType();
}
List<Integer> vehicleSkill = getSkillVehicle(Instance
.getF... |
9c6daa49-aee2-4399-8acf-efdf5b22e55b | 0 | public String getInvokeCommand() {
return invokeCommand;
} |
1f8e48b3-6d12-4a8b-9555-53aeae19dd4f | 7 | private void extractCandidates() {
nakeds = new LinkedList<NakedCandidates>();
int length = board.size*board.size;
for (int x=0; x < length; x++) {
for (int y=0; y < length; y++) {
if (board.getStringValue(x, y).equals(new String("*"))) {
candidate = new NakedCandidates(board.size*board.size);
... |
7b1020fc-b09d-4c73-aee3-ec7fd1a8e464 | 4 | public static void injectValue(Object object, String fieldName, Object value)
throws JStrykerException, IllegalArgumentException {
if (object == null) {
throw new IllegalArgumentException("Object cannot be null.");
}
if (fieldName == null) {
throw new IllegalArgumentException("Field name cannot be null.... |
e53b48df-dcd8-4c33-88a1-cd91b2f30375 | 4 | static int findBlack(BitStream inb, Code code) throws IOException {
code.reset();
while (!inb.atEndOfFile()) {
int i = inb.getBits(1);
code.append(i != 0);
int j;
j = findPositionInTable(code, tbcodes);
if (j >= 0) {
//System.er... |
9723a860-89fb-4414-b6bd-e0f043ff5d39 | 8 | private void method117(Stream stream)
{
stream.initBitAccess();
int j = stream.readBits(1);
if(j == 0)
return;
int k = stream.readBits(2);
if(k == 0)
{
anIntArray894[anInt893++] = myPlayerIndex;
return;
}
if(k == 1)
{
int l = stream.readBits(3);
myPlayer.moveInDir(false, l);
int k1 ... |
1e7890e2-5987-4180-b572-63b68599a463 | 8 | @Override
public boolean placeOrder(Order order) {
List<BaseStock> baseStockList = order.getVendor().getBaseStockList();
List<ToppingStock> toppingStockList = order.getVendor().getToppingStockList();
if (!orderDataService.add(order))
return false;
BaseStock b = null;
ToppingStock t = null;
for(... |
fba04214-f788-4b4d-8913-42c704e20a1b | 1 | public int getScore() {
int score = 0;
for (Team team : this) {
score += team.getScore();
}
return score;
} |
644fb076-d95d-4b5f-bc3d-36c2a589a7b2 | 0 | public void setSourceEnd(int sourceEnd)
{
_sourceEnd = sourceEnd;
} |
0f4ab3ee-e4b3-47d7-9e69-a7e2d4252e56 | 8 | public static boolean classImplements(Class<?> classUnderTest, Class<?> interfaceExpected) {
if (classUnderTest.equals(interfaceExpected)) {
return true;
}
Class<?>[] interfaces = classUnderTest.getInterfaces();
if (interfaces != null) {
for (Class<?> clazz : interfaces) {
if (clazz.equals(interfaceEx... |
1dea73d2-6f34-42ba-93d9-9b5f8da02be2 | 0 | private Target(String key){
_key = key;
} |
437bec37-20ad-4de7-ba50-e80aa18f6574 | 4 | private void cpu() {
switch (this.getGeneratoreRouting().getNextRoute()) {
case IO:
if (this.getIo().isFree()) {
this.getIo().setFree(false);
this.getIo().setJob(this.getCpu().getJob());
this.getCpu().setJob(null);
... |
1089d2a2-0531-4b3a-8041-9fdccccfc209 | 8 | private void loadConfiguration() {
Boolean checkConfigurationFile = true;
Boolean checkUpdateNecessarity = true;
while (checkConfigurationFile) {
//Check for configuration file
if (this.pMain.getProgram().getConfiguration().ConfigurationFileExists()) {
... |
e885734e-bb67-4f5e-9f7a-ec62c04bf65c | 3 | public int getDividerPosition() {
if (isFull()) {
if (mDividerPosition == -1) {
if (mHorizontal) {
return mChildren[0].getWidth();
}
return mChildren[0].getHeight();
}
return Math.min(mDividerPosition, getDividerMaximum());
}
return 0;
} |
7c17facf-53cc-4ac3-8aaf-689d1289ffce | 0 | public Items getNext() {
return next;
} |
ad3aaf74-d599-472e-9cbf-26b4bdbeccba | 6 | public String getString(Segment segment, int segmentNo) {
switch (segment) {
case A:
return getStringForSegmentA(segmentNo);
case B:
return getStringForSegmentB(segmentNo);
case C:
return getStringForSegmentC(segmentNo);
... |
357448b6-6b14-4749-8c5f-e0d9a5141b1b | 9 | public String simplifyPath(String path) {
if (path == null) {
return null;
}
if (path.trim().length() == 0) {
return "/";
}
StringBuffer stringBuffer = new StringBuffer();
Stack<String> stack = new Stack<String>();
... |
3341354f-f8f2-4d9c-8399-ad22e90362b3 | 0 | private ApplicationNoSpring() {
} |
282c08fd-a463-4027-be2d-961eb54e8bf9 | 0 | public void SetBusReleaseInfo(int outputBuffer, int inputBuffer, int sequence, int bus)
{
this.outputBuffer = outputBuffer;
this.inputBuffer = inputBuffer;
this.sequence = sequence;
this.bus = bus;
} |
515afa1d-9a56-43d0-b0db-87cff3ee084a | 2 | public void timed() {
boolean captured = false;
try {
captured = lock.tryLock(2, TimeUnit.SECONDS);
} catch(InterruptedException e) {
throw new RuntimeException(e);
}
try {
System.out.println("tryLock(2. TimeUnit SECONDS):" +captured);
... |
339152a4-b2fd-42c1-8aef-7e7aa14c073e | 7 | public static List<PTM> filterPTMsByAminoAcidSpecificityPosition(List<PTM> resultMaps, String position) {
List<Specificity> specificities = new ArrayList<>();
Set<PTM> resultPTMs = new HashSet<>();
if(Specificity.parsePositon(position) == Specificity.Position.NTERM){
// For NTerm so... |
be4178b3-11cb-467c-8759-4de03de5044c | 9 | public double determinantRecursive(double[][] matrix) {
double determinant = 0;
if (matrix.length > 2) {
for (int k = 0; k < matrix.length; k++) {
double[][] innerMatrix = new double[matrix.length - 1][matrix.length - 1];
/* Määritetään sisempi matriisi */
... |
a20a99a1-5c70-4ce1-a565-05b2f7fccc4b | 7 | public static int fillTableVerbose(int rows, int cols,int colStart,int colEnd){
int cri=1;//current row index. begin calc at table [1][1]
int cci=1;//current col. index
int up,left,caddy,bestChoice=0,val=0;//the ones to look at and the one to choose.
char let1,let2;//left and top seq letters. gene left genome t... |
116ee803-1b4f-4994-893e-4c4f03083a0a | 1 | @Override
public int filterRGB(int x, int y, int argb) {
int red = argb >> 16 & 0xFF;
int green = argb >> 8 & 0xFF;
int blue = argb & 0xFF;
int p1 = 100 - mPercentage;
int p2 = mUseWhite ? 255 * mPercentage : 0;
red = (red * p1 + p2) / 100;
green = (green * p1 + p2) / 100;
blue = (blue * p1 + p2) / 10... |
b82b4110-b1bc-4983-a030-10ee3aa35294 | 1 | public String status() {
return "#" + id + "(" +
(countDown > 0 ? countDown : "LiftOff!") + ") ";
} |
c597c14b-d6cb-46de-9a4f-9cb39310f1c3 | 3 | public double getTotalResponseTime()
{
if (exitTimes_ == null || entryTimes_ == null) {
return 0;
}
double time = 0;
try
{
double startTime = ((Double)exitTimes_.firstElement()).doubleValue();
double receiveTime = ((Double)entryTimes_.last... |
7f56141f-ea1c-4727-9452-29b5529a1a22 | 0 | public String toString() {
return super.toString();
// return "("+text+", "+weight+")";
} |
b6dae91d-9f74-4293-8be3-3c12379490f9 | 8 | private static void insertRecordIntoDbUserTable(ArrayList<String> xmlList) throws SQLException {
// generates rows in table with file name and one keyword
Connection dbConnection = null;
PreparedStatement statement = null;
try {
dbConnection = getDBConnection();
statement = dbConnection.prepareStat... |
a9c79bb5-5fff-4168-9f7d-8a600156b3b8 | 2 | private void awardBonus() {
BigInteger bonusReduction = BigInteger.valueOf(100);
for (int i=start; i<end; i++) {
BankAccount currentAccount = accounts.get(i);
if (currentAccount.getBalance().signum() > 0)
currentAccount.depo... |
7b4d4c23-30c7-46fe-b129-ea28b579bb23 | 3 | public void setKorting(String id, KortingStrategyType type) {
Product product = getProduct(id);
switch (type) {
case GEEN:
product.setKorting(new GeenKortingStrategy(product));
break;
case REGULAR:
product.setKorting(new RegularCustomeKortingSTrategy(product));
break;
case KWANTUM:
product.setK... |
ca6a7001-6079-427f-8039-2e74dd7b3847 | 6 | public void setAll() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Ill... |
0df3516d-c617-4c7e-8891-69fe5273c08f | 7 | public static ArrayList<BillAccount> readBillAccounts(String filename)
{
File file = new File(filename);
if (file.exists())
{
ObjectInputStream ois = null;
try
{
//
// Read the previously stored SecretKey.
/... |
824c588a-d8f7-432a-9f61-d4bb74a886ba | 0 | public long getId() {
return id;
} |
a0966085-c778-4bdd-89e6-a6764949f7ab | 2 | public String toString()
{
// System.out.println("elements length: "+elements.length);
// System.out.println("elements quantity: "+Element.properties(elements[0]));
String out = "";
for(int i = 0; i < elements.length; i++)
out += elements[i].toString();
if(quantity > 1)
out = "("+out+")"+quantity;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.